4634 lines
1.1 MiB
4634 lines
1.1 MiB
import{a as rd,r as sd,ah as Rs,ai as Ih,o as SE,e as ME,f as e1,H as Dm,aj as P4,ak as EE,al as TE,j as R4,_ as $n,ab as L4,L as N0,G as D4,u as zp}from"./entry.aa7356a8.js";var I4=Object.defineProperty,O4=Object.defineProperties,k4=Object.getOwnPropertyDescriptors,Jf=Object.getOwnPropertySymbols,AE=Object.prototype.hasOwnProperty,CE=Object.prototype.propertyIsEnumerable,By=(i,e,t)=>e in i?I4(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Me=(i,e)=>{for(var t in e||(e={}))AE.call(e,t)&&By(i,t,e[t]);if(Jf)for(var t of Jf(e))CE.call(e,t)&&By(i,t,e[t]);return i},bt=(i,e)=>O4(i,k4(e)),N4=(i,e)=>{var t={};for(var n in i)AE.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&Jf)for(var n of Jf(i))e.indexOf(n)<0&&CE.call(i,n)&&(t[n]=i[n]);return t},B4=(i,e,t)=>(By(i,typeof e!="symbol"?e+"":e,t),t),rl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d9(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var rs={exports:{}};/**
|
||
* @license
|
||
* Lodash <https://lodash.com/>
|
||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||
* Released under MIT license <https://lodash.com/license>
|
||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||
*/(function(i,e){(function(){var t,n="4.17.21",r=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",o="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",d=500,f="__lodash_placeholder__",g=1,y=2,_=4,w=1,S=2,b=1,T=2,E=4,C=8,A=16,D=32,I=64,F=128,P=256,k=512,j=30,G="...",ne=800,ce=16,Z=1,$=2,K=3,pe=1/0,re=9007199254740991,se=17976931348623157e292,ue=0/0,Te=4294967295,fe=Te-1,Ce=Te>>>1,qe=[["ary",F],["bind",b],["bindKey",T],["curry",C],["curryRight",A],["flip",k],["partial",D],["partialRight",I],["rearg",P]],Ke="[object Arguments]",me="[object Array]",Ut="[object AsyncFunction]",nt="[object Boolean]",it="[object Date]",Le="[object DOMException]",vt="[object Error]",ve="[object Function]",xe="[object GeneratorFunction]",Ae="[object Map]",We="[object Number]",Be="[object Null]",rt="[object Object]",ot="[object Promise]",st="[object Proxy]",Ft="[object RegExp]",yt="[object Set]",H="[object String]",B="[object Symbol]",he="[object Undefined]",we="[object WeakMap]",Ne="[object WeakSet]",Ue="[object ArrayBuffer]",Xe="[object DataView]",U="[object Float32Array]",Ee="[object Float64Array]",Je="[object Int8Array]",ke="[object Int16Array]",X="[object Int32Array]",Re="[object Uint8Array]",De="[object Uint8ClampedArray]",at="[object Uint16Array]",ze="[object Uint32Array]",et=/\b__p \+= '';/g,Ie=/\b(__p \+=) '' \+/g,ct=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wt=/&(?:amp|lt|gt|quot|#39);/g,Ct=/[&<>"']/g,jn=RegExp(wt.source),Yi=RegExp(Ct.source),Us=/<%-([\s\S]+?)%>/g,Fs=/<%([\s\S]+?)%>/g,Vs=/<%=([\s\S]+?)%>/g,Hs=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Co=/^\w*$/,gu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Aa=/[\\^$.*+?()[\]{}|]/g,yu=RegExp(Aa.source),V=/^\s+/,te=/\s/,de=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ge=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,gt=/[()=,{}\[\]\/\s]/,_t=/\\(\\)?/g,St=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Dt=/\w*$/,Nt=/^[-+]0x[0-9a-f]+$/i,Vt=/^0b[01]+$/i,yn=/^\[object .+?Constructor\]$/,Tr=/^0o[0-7]+$/i,ls=/^(?:0|[1-9]\d*)$/,cs=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ci=/($^)/,Pt=/['\n\r\u2028\u2029\\]/g,gi="\\ud800-\\udfff",Cn="\\u0300-\\u036f",Zi="\\ufe20-\\ufe2f",or="\\u20d0-\\u20ff",zr=Cn+Zi+or,Gs="\\u2700-\\u27bf",On="a-z\\xdf-\\xf6\\xf8-\\xff",Ws="\\xac\\xb1\\xd7\\xf7",Po="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ii="\\u2000-\\u206f",Hv=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",kd="A-Z\\xc0-\\xd6\\xd8-\\xde",Nd="\\ufe0e\\ufe0f",us=Ws+Po+Ii+Hv,Ki="['’]",Ca="["+gi+"]",Si="["+us+"]",Ar="["+zr+"]",Pl="\\d+",Gv="["+Gs+"]",Ro="["+On+"]",_u="[^"+gi+us+Pl+Gs+On+kd+"]",xu="\\ud83c[\\udffb-\\udfff]",Bd="(?:"+Ar+"|"+xu+")",bu="[^"+gi+"]",wu="(?:\\ud83c[\\udde6-\\uddff]){2}",Lo="[\\ud800-\\udbff][\\udc00-\\udfff]",Do="["+kd+"]",Su="\\u200d",Mu="(?:"+Ro+"|"+_u+")",Wv="(?:"+Do+"|"+_u+")",zd="(?:"+Ki+"(?:d|ll|m|re|s|t|ve))?",Ud="(?:"+Ki+"(?:D|LL|M|RE|S|T|VE))?",Fd=Bd+"?",Vd="["+Nd+"]?",Eu="(?:"+Su+"(?:"+[bu,wu,Lo].join("|")+")"+Vd+Fd+")*",Pa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",jv="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Io=Vd+Fd+Eu,Xv="(?:"+[Gv,wu,Lo].join("|")+")"+Io,Tu="(?:"+[bu+Ar+"?",Ar,wu,Lo,Ca].join("|")+")",Hd=RegExp(Ki,"g"),qv=RegExp(Ar,"g"),Au=RegExp(xu+"(?="+xu+")|"+Tu+Io,"g"),Yv=RegExp([Do+"?"+Ro+"+"+zd+"(?="+[Si,Do,"$"].join("|")+")",Wv+"+"+Ud+"(?="+[Si,Do+Mu,"$"].join("|")+")",Do+"?"+Mu+"+"+zd,Do+"+"+Ud,jv,Pa,Pl,Xv].join("|"),"g"),Zv=RegExp("["+Su+gi+zr+Nd+"]"),Kv=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Jv=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Qv=-1,vn={};vn[U]=vn[Ee]=vn[Je]=vn[ke]=vn[X]=vn[Re]=vn[De]=vn[at]=vn[ze]=!0,vn[Ke]=vn[me]=vn[Ue]=vn[nt]=vn[Xe]=vn[it]=vn[vt]=vn[ve]=vn[Ae]=vn[We]=vn[rt]=vn[Ft]=vn[yt]=vn[H]=vn[we]=!1;var un={};un[Ke]=un[me]=un[Ue]=un[Xe]=un[nt]=un[it]=un[U]=un[Ee]=un[Je]=un[ke]=un[X]=un[Ae]=un[We]=un[rt]=un[Ft]=un[yt]=un[H]=un[B]=un[Re]=un[De]=un[at]=un[ze]=!0,un[vt]=un[ve]=un[we]=!1;var $v={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},eg={"&":"&","<":"<",">":">",'"':""","'":"'"},tg={"&":"&","<":"<",">":">",""":'"',"'":"'"},ng={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ig=parseFloat,rg=parseInt,Cu=typeof rl=="object"&&rl&&rl.Object===Object&&rl,sg=typeof self=="object"&&self&&self.Object===Object&&self,ni=Cu||sg||Function("return this")(),Pu=e&&!e.nodeType&&e,hs=Pu&&!0&&i&&!i.nodeType&&i,Gd=hs&&hs.exports===Pu,ar=Gd&&Cu.process,Oi=function(){try{var J=hs&&hs.require&&hs.require("util").types;return J||ar&&ar.binding&&ar.binding("util")}catch{}}(),Wd=Oi&&Oi.isArrayBuffer,yi=Oi&&Oi.isDate,jd=Oi&&Oi.isMap,Ra=Oi&&Oi.isRegExp,Ru=Oi&&Oi.isSet,Rl=Oi&&Oi.isTypedArray;function Mi(J,le,ie){switch(ie.length){case 0:return J.call(le);case 1:return J.call(le,ie[0]);case 2:return J.call(le,ie[0],ie[1]);case 3:return J.call(le,ie[0],ie[1],ie[2])}return J.apply(le,ie)}function og(J,le,ie,je){for(var ft=-1,Wt=J==null?0:J.length;++ft<Wt;){var Pn=J[ft];le(je,Pn,ie(Pn),J)}return je}function Ji(J,le){for(var ie=-1,je=J==null?0:J.length;++ie<je&&le(J[ie],ie,J)!==!1;);return J}function ag(J,le){for(var ie=J==null?0:J.length;ie--&&le(J[ie],ie,J)!==!1;);return J}function Oo(J,le){for(var ie=-1,je=J==null?0:J.length;++ie<je;)if(!le(J[ie],ie,J))return!1;return!0}function kn(J,le){for(var ie=-1,je=J==null?0:J.length,ft=0,Wt=[];++ie<je;){var Pn=J[ie];le(Pn,ie,J)&&(Wt[ft++]=Pn)}return Wt}function ds(J,le){var ie=J==null?0:J.length;return!!ie&&Cr(J,le,0)>-1}function lr(J,le,ie){for(var je=-1,ft=J==null?0:J.length;++je<ft;)if(ie(le,J[je]))return!0;return!1}function _n(J,le){for(var ie=-1,je=J==null?0:J.length,ft=Array(je);++ie<je;)ft[ie]=le(J[ie],ie,J);return ft}function Ur(J,le){for(var ie=-1,je=le.length,ft=J.length;++ie<je;)J[ft+ie]=le[ie];return J}function La(J,le,ie,je){var ft=-1,Wt=J==null?0:J.length;for(je&&Wt&&(ie=J[++ft]);++ft<Wt;)ie=le(ie,J[ft],ft,J);return ie}function js(J,le,ie,je){var ft=J==null?0:J.length;for(je&&ft&&(ie=J[--ft]);ft--;)ie=le(ie,J[ft],ft,J);return ie}function hn(J,le){for(var ie=-1,je=J==null?0:J.length;++ie<je;)if(le(J[ie],ie,J))return!0;return!1}var Xd=Da("length");function gn(J){return J.split("")}function Lu(J){return J.match(ht)||[]}function ki(J,le,ie){var je;return ie(J,function(ft,Wt,Pn){if(le(ft,Wt,Pn))return je=Wt,!1}),je}function Ll(J,le,ie,je){for(var ft=J.length,Wt=ie+(je?1:-1);je?Wt--:++Wt<ft;)if(le(J[Wt],Wt,J))return Wt;return-1}function Cr(J,le,ie){return le===le?pg(J,le,ie):Ll(J,qd,ie)}function Du(J,le,ie,je){for(var ft=ie-1,Wt=J.length;++ft<Wt;)if(je(J[ft],le))return ft;return-1}function qd(J){return J!==J}function Yd(J,le){var ie=J==null?0:J.length;return ie?ko(J,le)/ie:ue}function Da(J){return function(le){return le==null?t:le[J]}}function Iu(J){return function(le){return J==null?t:J[le]}}function Dl(J,le,ie,je,ft){return ft(J,function(Wt,Pn,ln){ie=je?(je=!1,Wt):le(ie,Wt,Pn,ln)}),ie}function Ia(J,le){var ie=J.length;for(J.sort(le);ie--;)J[ie]=J[ie].value;return J}function ko(J,le){for(var ie,je=-1,ft=J.length;++je<ft;){var Wt=le(J[je]);Wt!==t&&(ie=ie===t?Wt:ie+Wt)}return ie}function Il(J,le){for(var ie=-1,je=Array(J);++ie<J;)je[ie]=le(ie);return je}function ps(J,le){return _n(le,function(ie){return[ie,J[ie]]})}function Ou(J){return J&&J.slice(0,Kd(J)+1).replace(V,"")}function _i(J){return function(le){return J(le)}}function Oa(J,le){return _n(le,function(ie){return J[ie]})}function ka(J,le){return J.has(le)}function Na(J,le){for(var ie=-1,je=J.length;++ie<je&&Cr(le,J[ie],0)>-1;);return ie}function Xs(J,le){for(var ie=J.length;ie--&&Cr(le,J[ie],0)>-1;);return ie}function No(J,le){for(var ie=J.length,je=0;ie--;)J[ie]===le&&++je;return je}var Ol=Iu($v),lg=Iu(eg);function cg(J){return"\\"+ng[J]}function ug(J,le){return J==null?t:J[le]}function Bo(J){return Zv.test(J)}function qs(J){return Kv.test(J)}function hg(J){for(var le,ie=[];!(le=J.next()).done;)ie.push(le.value);return ie}function ku(J){var le=-1,ie=Array(J.size);return J.forEach(function(je,ft){ie[++le]=[ft,je]}),ie}function Zd(J,le){return function(ie){return J(le(ie))}}function fs(J,le){for(var ie=-1,je=J.length,ft=0,Wt=[];++ie<je;){var Pn=J[ie];(Pn===le||Pn===f)&&(J[ie]=f,Wt[ft++]=ie)}return Wt}function Ba(J){var le=-1,ie=Array(J.size);return J.forEach(function(je){ie[++le]=je}),ie}function dg(J){var le=-1,ie=Array(J.size);return J.forEach(function(je){ie[++le]=[je,je]}),ie}function pg(J,le,ie){for(var je=ie-1,ft=J.length;++je<ft;)if(J[je]===le)return je;return-1}function zo(J,le,ie){for(var je=ie+1;je--;)if(J[je]===le)return je;return je}function Ys(J){return Bo(J)?kl(J):Xd(J)}function cr(J){return Bo(J)?Bt(J):gn(J)}function Kd(J){for(var le=J.length;le--&&te.test(J.charAt(le)););return le}var fg=Iu(tg);function kl(J){for(var le=Au.lastIndex=0;Au.test(J);)++le;return le}function Bt(J){return J.match(Au)||[]}function ms(J){return J.match(Yv)||[]}var mg=function J(le){le=le==null?ni:vs.defaults(ni.Object(),le,vs.pick(ni,Jv));var ie=le.Array,je=le.Date,ft=le.Error,Wt=le.Function,Pn=le.Math,ln=le.Object,Nu=le.RegExp,Jd=le.String,Ei=le.TypeError,Zs=ie.prototype,Qd=Wt.prototype,Fr=ln.prototype,Nl=le["__core-js_shared__"],Bl=Qd.toString,en=Fr.hasOwnProperty,$d=0,Uo=function(){var a=/[^.]+$/.exec(Nl&&Nl.keys&&Nl.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}(),zl=Fr.toString,vg=Bl.call(ln),Fo=ni._,gg=Nu("^"+Bl.call(en).replace(Aa,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ul=Gd?le.Buffer:t,gs=le.Symbol,Fl=le.Uint8Array,Vl=Ul?Ul.allocUnsafe:t,Hl=Zd(ln.getPrototypeOf,ln),Gl=ln.create,ep=Fr.propertyIsEnumerable,Wl=Zs.splice,jl=gs?gs.isConcatSpreadable:t,Vo=gs?gs.iterator:t,Ks=gs?gs.toStringTag:t,Xl=function(){try{var a=ja(ln,"defineProperty");return a({},"",{}),a}catch{}}(),yg=le.clearTimeout!==ni.clearTimeout&&le.clearTimeout,Bu=je&&je.now!==ni.Date.now&&je.now,_g=le.setTimeout!==ni.setTimeout&&le.setTimeout,ql=Pn.ceil,Ho=Pn.floor,zu=ln.getOwnPropertySymbols,xg=Ul?Ul.isBuffer:t,tp=le.isFinite,bg=Zs.join,wg=Zd(ln.keys,ln),Xn=Pn.max,ui=Pn.min,Sg=je.now,Mg=le.parseInt,np=Pn.random,Eg=Zs.reverse,Uu=ja(le,"DataView"),Js=ja(le,"Map"),Fu=ja(le,"Promise"),Go=ja(le,"Set"),za=ja(le,"WeakMap"),Ua=ja(ln,"create"),Yl=za&&new za,Ni={},ip=Xa(Uu),Tg=Xa(Js),Ag=Xa(Fu),Vu=Xa(Go),Cg=Xa(za),Zl=gs?gs.prototype:t,Fa=Zl?Zl.valueOf:t,rp=Zl?Zl.toString:t;function O(a){if(Un(a)&&!Et(a)&&!(a instanceof Mt)){if(a instanceof Bi)return a;if(en.call(a,"__wrapped__"))return _w(a)}return new Bi(a)}var Wo=function(){function a(){}return function(u){if(!Nn(u))return{};if(Gl)return Gl(u);a.prototype=u;var v=new a;return a.prototype=t,v}}();function ur(){}function Bi(a,u){this.__wrapped__=a,this.__actions__=[],this.__chain__=!!u,this.__index__=0,this.__values__=t}O.templateSettings={escape:Us,evaluate:Fs,interpolate:Vs,variable:"",imports:{_:O}},O.prototype=ur.prototype,O.prototype.constructor=O,Bi.prototype=Wo(ur.prototype),Bi.prototype.constructor=Bi;function Mt(a){this.__wrapped__=a,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Te,this.__views__=[]}function Pg(){var a=new Mt(this.__wrapped__);return a.__actions__=er(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=er(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=er(this.__views__),a}function ys(){if(this.__filtered__){var a=new Mt(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a}function Rg(){var a=this.__wrapped__.value(),u=this.__dir__,v=Et(a),M=u<0,R=v?a.length:0,N=nP(0,R,this.__views__),W=N.start,Y=N.end,Q=Y-W,_e=M?Y:W-1,be=this.__iteratees__,Se=be.length,Ve=0,tt=ui(Q,this.__takeCount__);if(!v||!M&&R==Q&&tt==Q)return Hb(a,this.__actions__);var dt=[];e:for(;Q--&&Ve<tt;){_e+=u;for(var Lt=-1,pt=a[_e];++Lt<Se;){var Ht=be[Lt],qt=Ht.iteratee,pr=Ht.type,Ui=qt(pt);if(pr==$)pt=Ui;else if(!Ui){if(pr==Z)continue e;break e}}dt[Ve++]=pt}return dt}Mt.prototype=Wo(ur.prototype),Mt.prototype.constructor=Mt;function _s(a){var u=-1,v=a==null?0:a.length;for(this.clear();++u<v;){var M=a[u];this.set(M[0],M[1])}}function Lg(){this.__data__=Ua?Ua(null):{},this.size=0}function Dg(a){var u=this.has(a)&&delete this.__data__[a];return this.size-=u?1:0,u}function Ig(a){var u=this.__data__;if(Ua){var v=u[a];return v===h?t:v}return en.call(u,a)?u[a]:t}function Og(a){var u=this.__data__;return Ua?u[a]!==t:en.call(u,a)}function sp(a,u){var v=this.__data__;return this.size+=this.has(a)?0:1,v[a]=Ua&&u===t?h:u,this}_s.prototype.clear=Lg,_s.prototype.delete=Dg,_s.prototype.get=Ig,_s.prototype.has=Og,_s.prototype.set=sp;function Vr(a){var u=-1,v=a==null?0:a.length;for(this.clear();++u<v;){var M=a[u];this.set(M[0],M[1])}}function op(){this.__data__=[],this.size=0}function kg(a){var u=this.__data__,v=Xo(u,a);if(v<0)return!1;var M=u.length-1;return v==M?u.pop():Wl.call(u,v,1),--this.size,!0}function ap(a){var u=this.__data__,v=Xo(u,a);return v<0?t:u[v][1]}function Ng(a){return Xo(this.__data__,a)>-1}function Bg(a,u){var v=this.__data__,M=Xo(v,a);return M<0?(++this.size,v.push([a,u])):v[M][1]=u,this}Vr.prototype.clear=op,Vr.prototype.delete=kg,Vr.prototype.get=ap,Vr.prototype.has=Ng,Vr.prototype.set=Bg;function Ti(a){var u=-1,v=a==null?0:a.length;for(this.clear();++u<v;){var M=a[u];this.set(M[0],M[1])}}function lp(){this.size=0,this.__data__={hash:new _s,map:new(Js||Vr),string:new _s}}function zg(a){var u=Cp(this,a).delete(a);return this.size-=u?1:0,u}function Ug(a){return Cp(this,a).get(a)}function Hu(a){return Cp(this,a).has(a)}function Fg(a,u){var v=Cp(this,a),M=v.size;return v.set(a,u),this.size+=v.size==M?0:1,this}Ti.prototype.clear=lp,Ti.prototype.delete=zg,Ti.prototype.get=Ug,Ti.prototype.has=Hu,Ti.prototype.set=Fg;function Hr(a){var u=-1,v=a==null?0:a.length;for(this.__data__=new Ti;++u<v;)this.add(a[u])}function Vg(a){return this.__data__.set(a,h),this}function jo(a){return this.__data__.has(a)}Hr.prototype.add=Hr.prototype.push=Vg,Hr.prototype.has=jo;function Qi(a){var u=this.__data__=new Vr(a);this.size=u.size}function Hg(){this.__data__=new Vr,this.size=0}function Gg(a){var u=this.__data__,v=u.delete(a);return this.size=u.size,v}function Kl(a){return this.__data__.get(a)}function Wg(a){return this.__data__.has(a)}function jg(a,u){var v=this.__data__;if(v instanceof Vr){var M=v.__data__;if(!Js||M.length<r-1)return M.push([a,u]),this.size=++v.size,this;v=this.__data__=new Ti(M)}return v.set(a,u),this.size=v.size,this}Qi.prototype.clear=Hg,Qi.prototype.delete=Gg,Qi.prototype.get=Kl,Qi.prototype.has=Wg,Qi.prototype.set=jg;function cp(a,u){var v=Et(a),M=!v&&qa(a),R=!v&&!M&&$o(a),N=!v&&!M&&!R&&rc(a),W=v||M||R||N,Y=W?Il(a.length,Jd):[],Q=Y.length;for(var _e in a)(u||en.call(a,_e))&&!(W&&(_e=="length"||R&&(_e=="offset"||_e=="parent")||N&&(_e=="buffer"||_e=="byteLength"||_e=="byteOffset")||to(_e,Q)))&&Y.push(_e);return Y}function up(a){var u=a.length;return u?a[n0(0,u-1)]:t}function Xg(a,u){return Pp(er(a),Ai(u,0,a.length))}function Va(a){return Pp(er(a))}function Jl(a,u,v){(v!==t&&!Xr(a[u],v)||v===t&&!(u in a))&&Gr(a,u,v)}function Ha(a,u,v){var M=a[u];(!(en.call(a,u)&&Xr(M,v))||v===t&&!(u in a))&&Gr(a,u,v)}function Xo(a,u){for(var v=a.length;v--;)if(Xr(a[v][0],u))return v;return-1}function hp(a,u,v,M){return Wr(a,function(R,N,W){u(M,R,v(R),W)}),M}function dp(a,u){return a&&bs(u,hi(u),a)}function Gu(a,u){return a&&bs(u,nr(u),a)}function Gr(a,u,v){u=="__proto__"&&Xl?Xl(a,u,{configurable:!0,enumerable:!0,value:v,writable:!0}):a[u]=v}function Wu(a,u){for(var v=-1,M=u.length,R=ie(M),N=a==null;++v<M;)R[v]=N?t:A0(a,u[v]);return R}function Ai(a,u,v){return a===a&&(v!==t&&(a=a<=v?a:v),u!==t&&(a=a>=u?a:u)),a}function $i(a,u,v,M,R,N){var W,Y=u&g,Q=u&y,_e=u&_;if(v&&(W=R?v(a,M,R,N):v(a)),W!==t)return W;if(!Nn(a))return a;var be=Et(a);if(be){if(W=rP(a),!Y)return er(a,W)}else{var Se=Ci(a),Ve=Se==ve||Se==xe;if($o(a))return jb(a,Y);if(Se==rt||Se==Ke||Ve&&!R){if(W=Q||Ve?{}:uw(a),!Y)return Q?q3(a,Gu(W,a)):X3(a,dp(W,a))}else{if(!un[Se])return R?a:{};W=sP(a,Se,Y)}}N||(N=new Qi);var tt=N.get(a);if(tt)return tt;N.set(a,W),Uw(a)?a.forEach(function(pt){W.add($i(pt,u,v,pt,a,N))}):Bw(a)&&a.forEach(function(pt,Ht){W.set(Ht,$i(pt,u,v,Ht,a,N))});var dt=_e?Q?p0:d0:Q?nr:hi,Lt=be?t:dt(a);return Ji(Lt||a,function(pt,Ht){Lt&&(Ht=pt,pt=a[Ht]),Ha(W,Ht,$i(pt,u,v,Ht,a,N))}),W}function qg(a){var u=hi(a);return function(v){return Ql(v,a,u)}}function Ql(a,u,v){var M=v.length;if(a==null)return!M;for(a=ln(a);M--;){var R=v[M],N=u[R],W=a[R];if(W===t&&!(R in a)||!N(W))return!1}return!0}function pp(a,u,v){if(typeof a!="function")throw new Ei(o);return Ju(function(){a.apply(t,v)},u)}function Ga(a,u,v,M){var R=-1,N=ds,W=!0,Y=a.length,Q=[],_e=u.length;if(!Y)return Q;v&&(u=_n(u,_i(v))),M?(N=lr,W=!1):u.length>=r&&(N=ka,W=!1,u=new Hr(u));e:for(;++R<Y;){var be=a[R],Se=v==null?be:v(be);if(be=M||be!==0?be:0,W&&Se===Se){for(var Ve=_e;Ve--;)if(u[Ve]===Se)continue e;Q.push(be)}else N(u,Se,M)||Q.push(be)}return Q}var Wr=Kb(Pr),fp=Kb(ec,!0);function Yg(a,u){var v=!0;return Wr(a,function(M,R,N){return v=!!u(M,R,N),v}),v}function $l(a,u,v){for(var M=-1,R=a.length;++M<R;){var N=a[M],W=u(N);if(W!=null&&(Y===t?W===W&&!dr(W):v(W,Y)))var Y=W,Q=N}return Q}function Zg(a,u,v,M){var R=a.length;for(v=Rt(v),v<0&&(v=-v>R?0:R+v),M=M===t||M>R?R:Rt(M),M<0&&(M+=R),M=v>M?0:Vw(M);v<M;)a[v++]=u;return a}function mp(a,u){var v=[];return Wr(a,function(M,R,N){u(M,R,N)&&v.push(M)}),v}function ii(a,u,v,M,R){var N=-1,W=a.length;for(v||(v=aP),R||(R=[]);++N<W;){var Y=a[N];u>0&&v(Y)?u>1?ii(Y,u-1,v,M,R):Ur(R,Y):M||(R[R.length]=Y)}return R}var ju=Jb(),vp=Jb(!0);function Pr(a,u){return a&&ju(a,u,hi)}function ec(a,u){return a&&vp(a,u,hi)}function Wa(a,u){return kn(u,function(v){return no(a[v])})}function xs(a,u){u=Jo(u,a);for(var v=0,M=u.length;a!=null&&v<M;)a=a[ws(u[v++])];return v&&v==M?a:t}function gp(a,u,v){var M=u(a);return Et(a)?M:Ur(M,v(a))}function xi(a){return a==null?a===t?he:Be:Ks&&Ks in ln(a)?tP(a):fP(a)}function Xu(a,u){return a>u}function Kg(a,u){return a!=null&&en.call(a,u)}function Jg(a,u){return a!=null&&u in ln(a)}function Qg(a,u,v){return a>=ui(u,v)&&a<Xn(u,v)}function qu(a,u,v){for(var M=v?lr:ds,R=a[0].length,N=a.length,W=N,Y=ie(N),Q=1/0,_e=[];W--;){var be=a[W];W&&u&&(be=_n(be,_i(u))),Q=ui(be.length,Q),Y[W]=!v&&(u||R>=120&&be.length>=120)?new Hr(W&&be):t}be=a[0];var Se=-1,Ve=Y[0];e:for(;++Se<R&&_e.length<Q;){var tt=be[Se],dt=u?u(tt):tt;if(tt=v||tt!==0?tt:0,!(Ve?ka(Ve,dt):M(_e,dt,v))){for(W=N;--W;){var Lt=Y[W];if(!(Lt?ka(Lt,dt):M(a[W],dt,v)))continue e}Ve&&Ve.push(dt),_e.push(tt)}}return _e}function $g(a,u,v,M){return Pr(a,function(R,N,W){u(M,v(R),N,W)}),M}function qo(a,u,v){u=Jo(u,a),a=fw(a,u);var M=a==null?a:a[ws(Lr(u))];return M==null?t:Mi(M,a,v)}function yp(a){return Un(a)&&xi(a)==Ke}function e0(a){return Un(a)&&xi(a)==Ue}function m(a){return Un(a)&&xi(a)==it}function c(a,u,v,M,R){return a===u?!0:a==null||u==null||!Un(a)&&!Un(u)?a!==a&&u!==u:p(a,u,v,M,c,R)}function p(a,u,v,M,R,N){var W=Et(a),Y=Et(u),Q=W?me:Ci(a),_e=Y?me:Ci(u);Q=Q==Ke?rt:Q,_e=_e==Ke?rt:_e;var be=Q==rt,Se=_e==rt,Ve=Q==_e;if(Ve&&$o(a)){if(!$o(u))return!1;W=!0,be=!1}if(Ve&&!be)return N||(N=new Qi),W||rc(a)?aw(a,u,v,M,R,N):$3(a,u,Q,v,M,R,N);if(!(v&w)){var tt=be&&en.call(a,"__wrapped__"),dt=Se&&en.call(u,"__wrapped__");if(tt||dt){var Lt=tt?a.value():a,pt=dt?u.value():u;return N||(N=new Qi),R(Lt,pt,v,M,N)}}return Ve?(N||(N=new Qi),eP(a,u,v,M,R,N)):!1}function x(a){return Un(a)&&Ci(a)==Ae}function L(a,u,v,M){var R=v.length,N=R,W=!M;if(a==null)return!N;for(a=ln(a);R--;){var Y=v[R];if(W&&Y[2]?Y[1]!==a[Y[0]]:!(Y[0]in a))return!1}for(;++R<N;){Y=v[R];var Q=Y[0],_e=a[Q],be=Y[1];if(W&&Y[2]){if(_e===t&&!(Q in a))return!1}else{var Se=new Qi;if(M)var Ve=M(_e,be,Q,a,u,Se);if(!(Ve===t?c(be,_e,w|S,M,Se):Ve))return!1}}return!0}function q(a){if(!Nn(a)||cP(a))return!1;var u=no(a)?gg:yn;return u.test(Xa(a))}function ee(a){return Un(a)&&xi(a)==Ft}function Oe(a){return Un(a)&&Ci(a)==yt}function lt(a){return Un(a)&&kp(a.length)&&!!vn[xi(a)]}function mt(a){return typeof a=="function"?a:a==null?ir:typeof a=="object"?Et(a)?Qs(a[0],a[1]):Zo(a):Qw(a)}function jt(a){if(!Ku(a))return wg(a);var u=[];for(var v in ln(a))en.call(a,v)&&v!="constructor"&&u.push(v);return u}function Jt(a){if(!Nn(a))return pP(a);var u=Ku(a),v=[];for(var M in a)M=="constructor"&&(u||!en.call(a,M))||v.push(M);return v}function jr(a,u){return a<u}function Yo(a,u){var v=-1,M=tr(a)?ie(a.length):[];return Wr(a,function(R,N,W){M[++v]=u(R,N,W)}),M}function Zo(a){var u=m0(a);return u.length==1&&u[0][2]?dw(u[0][0],u[0][1]):function(v){return v===a||L(v,a,u)}}function Qs(a,u){return g0(a)&&hw(u)?dw(ws(a),u):function(v){var M=A0(v,a);return M===t&&M===u?C0(v,a):c(u,M,w|S)}}function _p(a,u,v,M,R){a!==u&&ju(u,function(N,W){if(R||(R=new Qi),Nn(N))D3(a,u,W,v,_p,M,R);else{var Y=M?M(_0(a,W),N,W+"",a,u,R):t;Y===t&&(Y=N),Jl(a,W,Y)}},nr)}function D3(a,u,v,M,R,N,W){var Y=_0(a,v),Q=_0(u,v),_e=W.get(Q);if(_e){Jl(a,v,_e);return}var be=N?N(Y,Q,v+"",a,u,W):t,Se=be===t;if(Se){var Ve=Et(Q),tt=!Ve&&$o(Q),dt=!Ve&&!tt&&rc(Q);be=Q,Ve||tt||dt?Et(Y)?be=Y:qn(Y)?be=er(Y):tt?(Se=!1,be=jb(Q,!0)):dt?(Se=!1,be=Xb(Q,!0)):be=[]:Qu(Q)||qa(Q)?(be=Y,qa(Y)?be=Hw(Y):(!Nn(Y)||no(Y))&&(be=uw(Q))):Se=!1}Se&&(W.set(Q,be),R(be,Q,M,N,W),W.delete(Q)),Jl(a,v,be)}function Ob(a,u){var v=a.length;if(v)return u+=u<0?v:0,to(u,v)?a[u]:t}function kb(a,u,v){u.length?u=_n(u,function(N){return Et(N)?function(W){return xs(W,N.length===1?N[0]:N)}:N}):u=[ir];var M=-1;u=_n(u,_i(ut()));var R=Yo(a,function(N,W,Y){var Q=_n(u,function(_e){return _e(N)});return{criteria:Q,index:++M,value:N}});return Ia(R,function(N,W){return j3(N,W,v)})}function I3(a,u){return Nb(a,u,function(v,M){return C0(a,M)})}function Nb(a,u,v){for(var M=-1,R=u.length,N={};++M<R;){var W=u[M],Y=xs(a,W);v(Y,W)&&Yu(N,Jo(W,a),Y)}return N}function O3(a){return function(u){return xs(u,a)}}function t0(a,u,v,M){var R=M?Du:Cr,N=-1,W=u.length,Y=a;for(a===u&&(u=er(u)),v&&(Y=_n(a,_i(v)));++N<W;)for(var Q=0,_e=u[N],be=v?v(_e):_e;(Q=R(Y,be,Q,M))>-1;)Y!==a&&Wl.call(Y,Q,1),Wl.call(a,Q,1);return a}function Bb(a,u){for(var v=a?u.length:0,M=v-1;v--;){var R=u[v];if(v==M||R!==N){var N=R;to(R)?Wl.call(a,R,1):s0(a,R)}}return a}function n0(a,u){return a+Ho(np()*(u-a+1))}function k3(a,u,v,M){for(var R=-1,N=Xn(ql((u-a)/(v||1)),0),W=ie(N);N--;)W[M?N:++R]=a,a+=v;return W}function i0(a,u){var v="";if(!a||u<1||u>re)return v;do u%2&&(v+=a),u=Ho(u/2),u&&(a+=a);while(u);return v}function It(a,u){return x0(pw(a,u,ir),a+"")}function N3(a){return up(sc(a))}function B3(a,u){var v=sc(a);return Pp(v,Ai(u,0,v.length))}function Yu(a,u,v,M){if(!Nn(a))return a;u=Jo(u,a);for(var R=-1,N=u.length,W=N-1,Y=a;Y!=null&&++R<N;){var Q=ws(u[R]),_e=v;if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return a;if(R!=W){var be=Y[Q];_e=M?M(be,Q,Y):t,_e===t&&(_e=Nn(be)?be:to(u[R+1])?[]:{})}Ha(Y,Q,_e),Y=Y[Q]}return a}var zb=Yl?function(a,u){return Yl.set(a,u),a}:ir,z3=Xl?function(a,u){return Xl(a,"toString",{configurable:!0,enumerable:!1,value:R0(u),writable:!0})}:ir;function U3(a){return Pp(sc(a))}function Rr(a,u,v){var M=-1,R=a.length;u<0&&(u=-u>R?0:R+u),v=v>R?R:v,v<0&&(v+=R),R=u>v?0:v-u>>>0,u>>>=0;for(var N=ie(R);++M<R;)N[M]=a[M+u];return N}function F3(a,u){var v;return Wr(a,function(M,R,N){return v=u(M,R,N),!v}),!!v}function xp(a,u,v){var M=0,R=a==null?M:a.length;if(typeof u=="number"&&u===u&&R<=Ce){for(;M<R;){var N=M+R>>>1,W=a[N];W!==null&&!dr(W)&&(v?W<=u:W<u)?M=N+1:R=N}return R}return r0(a,u,ir,v)}function r0(a,u,v,M){var R=0,N=a==null?0:a.length;if(N===0)return 0;u=v(u);for(var W=u!==u,Y=u===null,Q=dr(u),_e=u===t;R<N;){var be=Ho((R+N)/2),Se=v(a[be]),Ve=Se!==t,tt=Se===null,dt=Se===Se,Lt=dr(Se);if(W)var pt=M||dt;else _e?pt=dt&&(M||Ve):Y?pt=dt&&Ve&&(M||!tt):Q?pt=dt&&Ve&&!tt&&(M||!Lt):tt||Lt?pt=!1:pt=M?Se<=u:Se<u;pt?R=be+1:N=be}return ui(N,fe)}function Ub(a,u){for(var v=-1,M=a.length,R=0,N=[];++v<M;){var W=a[v],Y=u?u(W):W;if(!v||!Xr(Y,Q)){var Q=Y;N[R++]=W===0?0:W}}return N}function Fb(a){return typeof a=="number"?a:dr(a)?ue:+a}function hr(a){if(typeof a=="string")return a;if(Et(a))return _n(a,hr)+"";if(dr(a))return rp?rp.call(a):"";var u=a+"";return u=="0"&&1/a==-pe?"-0":u}function Ko(a,u,v){var M=-1,R=ds,N=a.length,W=!0,Y=[],Q=Y;if(v)W=!1,R=lr;else if(N>=r){var _e=u?null:J3(a);if(_e)return Ba(_e);W=!1,R=ka,Q=new Hr}else Q=u?[]:Y;e:for(;++M<N;){var be=a[M],Se=u?u(be):be;if(be=v||be!==0?be:0,W&&Se===Se){for(var Ve=Q.length;Ve--;)if(Q[Ve]===Se)continue e;u&&Q.push(Se),Y.push(be)}else R(Q,Se,v)||(Q!==Y&&Q.push(Se),Y.push(be))}return Y}function s0(a,u){return u=Jo(u,a),a=fw(a,u),a==null||delete a[ws(Lr(u))]}function Vb(a,u,v,M){return Yu(a,u,v(xs(a,u)),M)}function bp(a,u,v,M){for(var R=a.length,N=M?R:-1;(M?N--:++N<R)&&u(a[N],N,a););return v?Rr(a,M?0:N,M?N+1:R):Rr(a,M?N+1:0,M?R:N)}function Hb(a,u){var v=a;return v instanceof Mt&&(v=v.value()),La(u,function(M,R){return R.func.apply(R.thisArg,Ur([M],R.args))},v)}function o0(a,u,v){var M=a.length;if(M<2)return M?Ko(a[0]):[];for(var R=-1,N=ie(M);++R<M;)for(var W=a[R],Y=-1;++Y<M;)Y!=R&&(N[R]=Ga(N[R]||W,a[Y],u,v));return Ko(ii(N,1),u,v)}function Gb(a,u,v){for(var M=-1,R=a.length,N=u.length,W={};++M<R;){var Y=M<N?u[M]:t;v(W,a[M],Y)}return W}function a0(a){return qn(a)?a:[]}function l0(a){return typeof a=="function"?a:ir}function Jo(a,u){return Et(a)?a:g0(a,u)?[a]:yw(sn(a))}var V3=It;function Qo(a,u,v){var M=a.length;return v=v===t?M:v,!u&&v>=M?a:Rr(a,u,v)}var Wb=yg||function(a){return ni.clearTimeout(a)};function jb(a,u){if(u)return a.slice();var v=a.length,M=Vl?Vl(v):new a.constructor(v);return a.copy(M),M}function c0(a){var u=new a.constructor(a.byteLength);return new Fl(u).set(new Fl(a)),u}function H3(a,u){var v=u?c0(a.buffer):a.buffer;return new a.constructor(v,a.byteOffset,a.byteLength)}function G3(a){var u=new a.constructor(a.source,Dt.exec(a));return u.lastIndex=a.lastIndex,u}function W3(a){return Fa?ln(Fa.call(a)):{}}function Xb(a,u){var v=u?c0(a.buffer):a.buffer;return new a.constructor(v,a.byteOffset,a.length)}function qb(a,u){if(a!==u){var v=a!==t,M=a===null,R=a===a,N=dr(a),W=u!==t,Y=u===null,Q=u===u,_e=dr(u);if(!Y&&!_e&&!N&&a>u||N&&W&&Q&&!Y&&!_e||M&&W&&Q||!v&&Q||!R)return 1;if(!M&&!N&&!_e&&a<u||_e&&v&&R&&!M&&!N||Y&&v&&R||!W&&R||!Q)return-1}return 0}function j3(a,u,v){for(var M=-1,R=a.criteria,N=u.criteria,W=R.length,Y=v.length;++M<W;){var Q=qb(R[M],N[M]);if(Q){if(M>=Y)return Q;var _e=v[M];return Q*(_e=="desc"?-1:1)}}return a.index-u.index}function Yb(a,u,v,M){for(var R=-1,N=a.length,W=v.length,Y=-1,Q=u.length,_e=Xn(N-W,0),be=ie(Q+_e),Se=!M;++Y<Q;)be[Y]=u[Y];for(;++R<W;)(Se||R<N)&&(be[v[R]]=a[R]);for(;_e--;)be[Y++]=a[R++];return be}function Zb(a,u,v,M){for(var R=-1,N=a.length,W=-1,Y=v.length,Q=-1,_e=u.length,be=Xn(N-Y,0),Se=ie(be+_e),Ve=!M;++R<be;)Se[R]=a[R];for(var tt=R;++Q<_e;)Se[tt+Q]=u[Q];for(;++W<Y;)(Ve||R<N)&&(Se[tt+v[W]]=a[R++]);return Se}function er(a,u){var v=-1,M=a.length;for(u||(u=ie(M));++v<M;)u[v]=a[v];return u}function bs(a,u,v,M){var R=!v;v||(v={});for(var N=-1,W=u.length;++N<W;){var Y=u[N],Q=M?M(v[Y],a[Y],Y,v,a):t;Q===t&&(Q=a[Y]),R?Gr(v,Y,Q):Ha(v,Y,Q)}return v}function X3(a,u){return bs(a,v0(a),u)}function q3(a,u){return bs(a,lw(a),u)}function wp(a,u){return function(v,M){var R=Et(v)?og:hp,N=u?u():{};return R(v,a,ut(M,2),N)}}function tc(a){return It(function(u,v){var M=-1,R=v.length,N=R>1?v[R-1]:t,W=R>2?v[2]:t;for(N=a.length>3&&typeof N=="function"?(R--,N):t,W&&zi(v[0],v[1],W)&&(N=R<3?t:N,R=1),u=ln(u);++M<R;){var Y=v[M];Y&&a(u,Y,M,N)}return u})}function Kb(a,u){return function(v,M){if(v==null)return v;if(!tr(v))return a(v,M);for(var R=v.length,N=u?R:-1,W=ln(v);(u?N--:++N<R)&&M(W[N],N,W)!==!1;);return v}}function Jb(a){return function(u,v,M){for(var R=-1,N=ln(u),W=M(u),Y=W.length;Y--;){var Q=W[a?Y:++R];if(v(N[Q],Q,N)===!1)break}return u}}function Y3(a,u,v){var M=u&b,R=Zu(a);function N(){var W=this&&this!==ni&&this instanceof N?R:a;return W.apply(M?v:this,arguments)}return N}function Qb(a){return function(u){u=sn(u);var v=Bo(u)?cr(u):t,M=v?v[0]:u.charAt(0),R=v?Qo(v,1).join(""):u.slice(1);return M[a]()+R}}function nc(a){return function(u){return La(Kw(Zw(u).replace(Hd,"")),a,"")}}function Zu(a){return function(){var u=arguments;switch(u.length){case 0:return new a;case 1:return new a(u[0]);case 2:return new a(u[0],u[1]);case 3:return new a(u[0],u[1],u[2]);case 4:return new a(u[0],u[1],u[2],u[3]);case 5:return new a(u[0],u[1],u[2],u[3],u[4]);case 6:return new a(u[0],u[1],u[2],u[3],u[4],u[5]);case 7:return new a(u[0],u[1],u[2],u[3],u[4],u[5],u[6])}var v=Wo(a.prototype),M=a.apply(v,u);return Nn(M)?M:v}}function Z3(a,u,v){var M=Zu(a);function R(){for(var N=arguments.length,W=ie(N),Y=N,Q=ic(R);Y--;)W[Y]=arguments[Y];var _e=N<3&&W[0]!==Q&&W[N-1]!==Q?[]:fs(W,Q);if(N-=_e.length,N<v)return iw(a,u,Sp,R.placeholder,t,W,_e,t,t,v-N);var be=this&&this!==ni&&this instanceof R?M:a;return Mi(be,this,W)}return R}function $b(a){return function(u,v,M){var R=ln(u);if(!tr(u)){var N=ut(v,3);u=hi(u),v=function(Y){return N(R[Y],Y,R)}}var W=a(u,v,M);return W>-1?R[N?u[W]:W]:t}}function ew(a){return eo(function(u){var v=u.length,M=v,R=Bi.prototype.thru;for(a&&u.reverse();M--;){var N=u[M];if(typeof N!="function")throw new Ei(o);if(R&&!W&&Ap(N)=="wrapper")var W=new Bi([],!0)}for(M=W?M:v;++M<v;){N=u[M];var Y=Ap(N),Q=Y=="wrapper"?f0(N):t;Q&&y0(Q[0])&&Q[1]==(F|C|D|P)&&!Q[4].length&&Q[9]==1?W=W[Ap(Q[0])].apply(W,Q[3]):W=N.length==1&&y0(N)?W[Y]():W.thru(N)}return function(){var _e=arguments,be=_e[0];if(W&&_e.length==1&&Et(be))return W.plant(be).value();for(var Se=0,Ve=v?u[Se].apply(this,_e):be;++Se<v;)Ve=u[Se].call(this,Ve);return Ve}})}function Sp(a,u,v,M,R,N,W,Y,Q,_e){var be=u&F,Se=u&b,Ve=u&T,tt=u&(C|A),dt=u&k,Lt=Ve?t:Zu(a);function pt(){for(var Ht=arguments.length,qt=ie(Ht),pr=Ht;pr--;)qt[pr]=arguments[pr];if(tt)var Ui=ic(pt),fr=No(qt,Ui);if(M&&(qt=Yb(qt,M,R,tt)),N&&(qt=Zb(qt,N,W,tt)),Ht-=fr,tt&&Ht<_e){var Yn=fs(qt,Ui);return iw(a,u,Sp,pt.placeholder,v,qt,Yn,Y,Q,_e-Ht)}var qr=Se?v:this,ro=Ve?qr[a]:a;return Ht=qt.length,Y?qt=mP(qt,Y):dt&&Ht>1&&qt.reverse(),be&&Q<Ht&&(qt.length=Q),this&&this!==ni&&this instanceof pt&&(ro=Lt||Zu(ro)),ro.apply(qr,qt)}return pt}function tw(a,u){return function(v,M){return $g(v,a,u(M),{})}}function Mp(a,u){return function(v,M){var R;if(v===t&&M===t)return u;if(v!==t&&(R=v),M!==t){if(R===t)return M;typeof v=="string"||typeof M=="string"?(v=hr(v),M=hr(M)):(v=Fb(v),M=Fb(M)),R=a(v,M)}return R}}function u0(a){return eo(function(u){return u=_n(u,_i(ut())),It(function(v){var M=this;return a(u,function(R){return Mi(R,M,v)})})})}function Ep(a,u){u=u===t?" ":hr(u);var v=u.length;if(v<2)return v?i0(u,a):u;var M=i0(u,ql(a/Ys(u)));return Bo(u)?Qo(cr(M),0,a).join(""):M.slice(0,a)}function K3(a,u,v,M){var R=u&b,N=Zu(a);function W(){for(var Y=-1,Q=arguments.length,_e=-1,be=M.length,Se=ie(be+Q),Ve=this&&this!==ni&&this instanceof W?N:a;++_e<be;)Se[_e]=M[_e];for(;Q--;)Se[_e++]=arguments[++Y];return Mi(Ve,R?v:this,Se)}return W}function nw(a){return function(u,v,M){return M&&typeof M!="number"&&zi(u,v,M)&&(v=M=t),u=io(u),v===t?(v=u,u=0):v=io(v),M=M===t?u<v?1:-1:io(M),k3(u,v,M,a)}}function Tp(a){return function(u,v){return typeof u=="string"&&typeof v=="string"||(u=Dr(u),v=Dr(v)),a(u,v)}}function iw(a,u,v,M,R,N,W,Y,Q,_e){var be=u&C,Se=be?W:t,Ve=be?t:W,tt=be?N:t,dt=be?t:N;u|=be?D:I,u&=~(be?I:D),u&E||(u&=~(b|T));var Lt=[a,u,R,tt,Se,dt,Ve,Y,Q,_e],pt=v.apply(t,Lt);return y0(a)&&mw(pt,Lt),pt.placeholder=M,vw(pt,a,u)}function h0(a){var u=Pn[a];return function(v,M){if(v=Dr(v),M=M==null?0:ui(Rt(M),292),M&&tp(v)){var R=(sn(v)+"e").split("e"),N=u(R[0]+"e"+(+R[1]+M));return R=(sn(N)+"e").split("e"),+(R[0]+"e"+(+R[1]-M))}return u(v)}}var J3=Go&&1/Ba(new Go([,-0]))[1]==pe?function(a){return new Go(a)}:I0;function rw(a){return function(u){var v=Ci(u);return v==Ae?ku(u):v==yt?dg(u):ps(u,a(u))}}function $s(a,u,v,M,R,N,W,Y){var Q=u&T;if(!Q&&typeof a!="function")throw new Ei(o);var _e=M?M.length:0;if(_e||(u&=~(D|I),M=R=t),W=W===t?W:Xn(Rt(W),0),Y=Y===t?Y:Rt(Y),_e-=R?R.length:0,u&I){var be=M,Se=R;M=R=t}var Ve=Q?t:f0(a),tt=[a,u,v,M,R,be,Se,N,W,Y];if(Ve&&dP(tt,Ve),a=tt[0],u=tt[1],v=tt[2],M=tt[3],R=tt[4],Y=tt[9]=tt[9]===t?Q?0:a.length:Xn(tt[9]-_e,0),!Y&&u&(C|A)&&(u&=~(C|A)),!u||u==b)var dt=Y3(a,u,v);else u==C||u==A?dt=Z3(a,u,Y):(u==D||u==(b|D))&&!R.length?dt=K3(a,u,v,M):dt=Sp.apply(t,tt);var Lt=Ve?zb:mw;return vw(Lt(dt,tt),a,u)}function sw(a,u,v,M){return a===t||Xr(a,Fr[v])&&!en.call(M,v)?u:a}function ow(a,u,v,M,R,N){return Nn(a)&&Nn(u)&&(N.set(u,a),_p(a,u,t,ow,N),N.delete(u)),a}function Q3(a){return Qu(a)?t:a}function aw(a,u,v,M,R,N){var W=v&w,Y=a.length,Q=u.length;if(Y!=Q&&!(W&&Q>Y))return!1;var _e=N.get(a),be=N.get(u);if(_e&&be)return _e==u&&be==a;var Se=-1,Ve=!0,tt=v&S?new Hr:t;for(N.set(a,u),N.set(u,a);++Se<Y;){var dt=a[Se],Lt=u[Se];if(M)var pt=W?M(Lt,dt,Se,u,a,N):M(dt,Lt,Se,a,u,N);if(pt!==t){if(pt)continue;Ve=!1;break}if(tt){if(!hn(u,function(Ht,qt){if(!ka(tt,qt)&&(dt===Ht||R(dt,Ht,v,M,N)))return tt.push(qt)})){Ve=!1;break}}else if(!(dt===Lt||R(dt,Lt,v,M,N))){Ve=!1;break}}return N.delete(a),N.delete(u),Ve}function $3(a,u,v,M,R,N,W){switch(v){case Xe:if(a.byteLength!=u.byteLength||a.byteOffset!=u.byteOffset)return!1;a=a.buffer,u=u.buffer;case Ue:return!(a.byteLength!=u.byteLength||!N(new Fl(a),new Fl(u)));case nt:case it:case We:return Xr(+a,+u);case vt:return a.name==u.name&&a.message==u.message;case Ft:case H:return a==u+"";case Ae:var Y=ku;case yt:var Q=M&w;if(Y||(Y=Ba),a.size!=u.size&&!Q)return!1;var _e=W.get(a);if(_e)return _e==u;M|=S,W.set(a,u);var be=aw(Y(a),Y(u),M,R,N,W);return W.delete(a),be;case B:if(Fa)return Fa.call(a)==Fa.call(u)}return!1}function eP(a,u,v,M,R,N){var W=v&w,Y=d0(a),Q=Y.length,_e=d0(u),be=_e.length;if(Q!=be&&!W)return!1;for(var Se=Q;Se--;){var Ve=Y[Se];if(!(W?Ve in u:en.call(u,Ve)))return!1}var tt=N.get(a),dt=N.get(u);if(tt&&dt)return tt==u&&dt==a;var Lt=!0;N.set(a,u),N.set(u,a);for(var pt=W;++Se<Q;){Ve=Y[Se];var Ht=a[Ve],qt=u[Ve];if(M)var pr=W?M(qt,Ht,Ve,u,a,N):M(Ht,qt,Ve,a,u,N);if(!(pr===t?Ht===qt||R(Ht,qt,v,M,N):pr)){Lt=!1;break}pt||(pt=Ve=="constructor")}if(Lt&&!pt){var Ui=a.constructor,fr=u.constructor;Ui!=fr&&"constructor"in a&&"constructor"in u&&!(typeof Ui=="function"&&Ui instanceof Ui&&typeof fr=="function"&&fr instanceof fr)&&(Lt=!1)}return N.delete(a),N.delete(u),Lt}function eo(a){return x0(pw(a,t,ww),a+"")}function d0(a){return gp(a,hi,v0)}function p0(a){return gp(a,nr,lw)}var f0=Yl?function(a){return Yl.get(a)}:I0;function Ap(a){for(var u=a.name+"",v=Ni[u],M=en.call(Ni,u)?v.length:0;M--;){var R=v[M],N=R.func;if(N==null||N==a)return R.name}return u}function ic(a){var u=en.call(O,"placeholder")?O:a;return u.placeholder}function ut(){var a=O.iteratee||L0;return a=a===L0?mt:a,arguments.length?a(arguments[0],arguments[1]):a}function Cp(a,u){var v=a.__data__;return lP(u)?v[typeof u=="string"?"string":"hash"]:v.map}function m0(a){for(var u=hi(a),v=u.length;v--;){var M=u[v],R=a[M];u[v]=[M,R,hw(R)]}return u}function ja(a,u){var v=ug(a,u);return q(v)?v:t}function tP(a){var u=en.call(a,Ks),v=a[Ks];try{a[Ks]=t;var M=!0}catch{}var R=zl.call(a);return M&&(u?a[Ks]=v:delete a[Ks]),R}var v0=zu?function(a){return a==null?[]:(a=ln(a),kn(zu(a),function(u){return ep.call(a,u)}))}:O0,lw=zu?function(a){for(var u=[];a;)Ur(u,v0(a)),a=Hl(a);return u}:O0,Ci=xi;(Uu&&Ci(new Uu(new ArrayBuffer(1)))!=Xe||Js&&Ci(new Js)!=Ae||Fu&&Ci(Fu.resolve())!=ot||Go&&Ci(new Go)!=yt||za&&Ci(new za)!=we)&&(Ci=function(a){var u=xi(a),v=u==rt?a.constructor:t,M=v?Xa(v):"";if(M)switch(M){case ip:return Xe;case Tg:return Ae;case Ag:return ot;case Vu:return yt;case Cg:return we}return u});function nP(a,u,v){for(var M=-1,R=v.length;++M<R;){var N=v[M],W=N.size;switch(N.type){case"drop":a+=W;break;case"dropRight":u-=W;break;case"take":u=ui(u,a+W);break;case"takeRight":a=Xn(a,u-W);break}}return{start:a,end:u}}function iP(a){var u=a.match(oe);return u?u[1].split(ge):[]}function cw(a,u,v){u=Jo(u,a);for(var M=-1,R=u.length,N=!1;++M<R;){var W=ws(u[M]);if(!(N=a!=null&&v(a,W)))break;a=a[W]}return N||++M!=R?N:(R=a==null?0:a.length,!!R&&kp(R)&&to(W,R)&&(Et(a)||qa(a)))}function rP(a){var u=a.length,v=new a.constructor(u);return u&&typeof a[0]=="string"&&en.call(a,"index")&&(v.index=a.index,v.input=a.input),v}function uw(a){return typeof a.constructor=="function"&&!Ku(a)?Wo(Hl(a)):{}}function sP(a,u,v){var M=a.constructor;switch(u){case Ue:return c0(a);case nt:case it:return new M(+a);case Xe:return H3(a,v);case U:case Ee:case Je:case ke:case X:case Re:case De:case at:case ze:return Xb(a,v);case Ae:return new M;case We:case H:return new M(a);case Ft:return G3(a);case yt:return new M;case B:return W3(a)}}function oP(a,u){var v=u.length;if(!v)return a;var M=v-1;return u[M]=(v>1?"& ":"")+u[M],u=u.join(v>2?", ":" "),a.replace(de,`{
|
||
/* [wrapped with `+u+`] */
|
||
`)}function aP(a){return Et(a)||qa(a)||!!(jl&&a&&a[jl])}function to(a,u){var v=typeof a;return u=u??re,!!u&&(v=="number"||v!="symbol"&&ls.test(a))&&a>-1&&a%1==0&&a<u}function zi(a,u,v){if(!Nn(v))return!1;var M=typeof u;return(M=="number"?tr(v)&&to(u,v.length):M=="string"&&u in v)?Xr(v[u],a):!1}function g0(a,u){if(Et(a))return!1;var v=typeof a;return v=="number"||v=="symbol"||v=="boolean"||a==null||dr(a)?!0:Co.test(a)||!Hs.test(a)||u!=null&&a in ln(u)}function lP(a){var u=typeof a;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?a!=="__proto__":a===null}function y0(a){var u=Ap(a),v=O[u];if(typeof v!="function"||!(u in Mt.prototype))return!1;if(a===v)return!0;var M=f0(v);return!!M&&a===M[0]}function cP(a){return!!Uo&&Uo in a}var uP=Nl?no:k0;function Ku(a){var u=a&&a.constructor,v=typeof u=="function"&&u.prototype||Fr;return a===v}function hw(a){return a===a&&!Nn(a)}function dw(a,u){return function(v){return v==null?!1:v[a]===u&&(u!==t||a in ln(v))}}function hP(a){var u=Ip(a,function(M){return v.size===d&&v.clear(),M}),v=u.cache;return u}function dP(a,u){var v=a[1],M=u[1],R=v|M,N=R<(b|T|F),W=M==F&&v==C||M==F&&v==P&&a[7].length<=u[8]||M==(F|P)&&u[7].length<=u[8]&&v==C;if(!(N||W))return a;M&b&&(a[2]=u[2],R|=v&b?0:E);var Y=u[3];if(Y){var Q=a[3];a[3]=Q?Yb(Q,Y,u[4]):Y,a[4]=Q?fs(a[3],f):u[4]}return Y=u[5],Y&&(Q=a[5],a[5]=Q?Zb(Q,Y,u[6]):Y,a[6]=Q?fs(a[5],f):u[6]),Y=u[7],Y&&(a[7]=Y),M&F&&(a[8]=a[8]==null?u[8]:ui(a[8],u[8])),a[9]==null&&(a[9]=u[9]),a[0]=u[0],a[1]=R,a}function pP(a){var u=[];if(a!=null)for(var v in ln(a))u.push(v);return u}function fP(a){return zl.call(a)}function pw(a,u,v){return u=Xn(u===t?a.length-1:u,0),function(){for(var M=arguments,R=-1,N=Xn(M.length-u,0),W=ie(N);++R<N;)W[R]=M[u+R];R=-1;for(var Y=ie(u+1);++R<u;)Y[R]=M[R];return Y[u]=v(W),Mi(a,this,Y)}}function fw(a,u){return u.length<2?a:xs(a,Rr(u,0,-1))}function mP(a,u){for(var v=a.length,M=ui(u.length,v),R=er(a);M--;){var N=u[M];a[M]=to(N,v)?R[N]:t}return a}function _0(a,u){if(!(u==="constructor"&&typeof a[u]=="function")&&u!="__proto__")return a[u]}var mw=gw(zb),Ju=_g||function(a,u){return ni.setTimeout(a,u)},x0=gw(z3);function vw(a,u,v){var M=u+"";return x0(a,oP(M,vP(iP(M),v)))}function gw(a){var u=0,v=0;return function(){var M=Sg(),R=ce-(M-v);if(v=M,R>0){if(++u>=ne)return arguments[0]}else u=0;return a.apply(t,arguments)}}function Pp(a,u){var v=-1,M=a.length,R=M-1;for(u=u===t?M:u;++v<u;){var N=n0(v,R),W=a[N];a[N]=a[v],a[v]=W}return a.length=u,a}var yw=hP(function(a){var u=[];return a.charCodeAt(0)===46&&u.push(""),a.replace(gu,function(v,M,R,N){u.push(R?N.replace(_t,"$1"):M||v)}),u});function ws(a){if(typeof a=="string"||dr(a))return a;var u=a+"";return u=="0"&&1/a==-pe?"-0":u}function Xa(a){if(a!=null){try{return Bl.call(a)}catch{}try{return a+""}catch{}}return""}function vP(a,u){return Ji(qe,function(v){var M="_."+v[0];u&v[1]&&!ds(a,M)&&a.push(M)}),a.sort()}function _w(a){if(a instanceof Mt)return a.clone();var u=new Bi(a.__wrapped__,a.__chain__);return u.__actions__=er(a.__actions__),u.__index__=a.__index__,u.__values__=a.__values__,u}function gP(a,u,v){(v?zi(a,u,v):u===t)?u=1:u=Xn(Rt(u),0);var M=a==null?0:a.length;if(!M||u<1)return[];for(var R=0,N=0,W=ie(ql(M/u));R<M;)W[N++]=Rr(a,R,R+=u);return W}function yP(a){for(var u=-1,v=a==null?0:a.length,M=0,R=[];++u<v;){var N=a[u];N&&(R[M++]=N)}return R}function _P(){var a=arguments.length;if(!a)return[];for(var u=ie(a-1),v=arguments[0],M=a;M--;)u[M-1]=arguments[M];return Ur(Et(v)?er(v):[v],ii(u,1))}var xP=It(function(a,u){return qn(a)?Ga(a,ii(u,1,qn,!0)):[]}),bP=It(function(a,u){var v=Lr(u);return qn(v)&&(v=t),qn(a)?Ga(a,ii(u,1,qn,!0),ut(v,2)):[]}),wP=It(function(a,u){var v=Lr(u);return qn(v)&&(v=t),qn(a)?Ga(a,ii(u,1,qn,!0),t,v):[]});function SP(a,u,v){var M=a==null?0:a.length;return M?(u=v||u===t?1:Rt(u),Rr(a,u<0?0:u,M)):[]}function MP(a,u,v){var M=a==null?0:a.length;return M?(u=v||u===t?1:Rt(u),u=M-u,Rr(a,0,u<0?0:u)):[]}function EP(a,u){return a&&a.length?bp(a,ut(u,3),!0,!0):[]}function TP(a,u){return a&&a.length?bp(a,ut(u,3),!0):[]}function AP(a,u,v,M){var R=a==null?0:a.length;return R?(v&&typeof v!="number"&&zi(a,u,v)&&(v=0,M=R),Zg(a,u,v,M)):[]}function xw(a,u,v){var M=a==null?0:a.length;if(!M)return-1;var R=v==null?0:Rt(v);return R<0&&(R=Xn(M+R,0)),Ll(a,ut(u,3),R)}function bw(a,u,v){var M=a==null?0:a.length;if(!M)return-1;var R=M-1;return v!==t&&(R=Rt(v),R=v<0?Xn(M+R,0):ui(R,M-1)),Ll(a,ut(u,3),R,!0)}function ww(a){var u=a==null?0:a.length;return u?ii(a,1):[]}function CP(a){var u=a==null?0:a.length;return u?ii(a,pe):[]}function PP(a,u){var v=a==null?0:a.length;return v?(u=u===t?1:Rt(u),ii(a,u)):[]}function RP(a){for(var u=-1,v=a==null?0:a.length,M={};++u<v;){var R=a[u];M[R[0]]=R[1]}return M}function Sw(a){return a&&a.length?a[0]:t}function LP(a,u,v){var M=a==null?0:a.length;if(!M)return-1;var R=v==null?0:Rt(v);return R<0&&(R=Xn(M+R,0)),Cr(a,u,R)}function DP(a){var u=a==null?0:a.length;return u?Rr(a,0,-1):[]}var IP=It(function(a){var u=_n(a,a0);return u.length&&u[0]===a[0]?qu(u):[]}),OP=It(function(a){var u=Lr(a),v=_n(a,a0);return u===Lr(v)?u=t:v.pop(),v.length&&v[0]===a[0]?qu(v,ut(u,2)):[]}),kP=It(function(a){var u=Lr(a),v=_n(a,a0);return u=typeof u=="function"?u:t,u&&v.pop(),v.length&&v[0]===a[0]?qu(v,t,u):[]});function NP(a,u){return a==null?"":bg.call(a,u)}function Lr(a){var u=a==null?0:a.length;return u?a[u-1]:t}function BP(a,u,v){var M=a==null?0:a.length;if(!M)return-1;var R=M;return v!==t&&(R=Rt(v),R=R<0?Xn(M+R,0):ui(R,M-1)),u===u?zo(a,u,R):Ll(a,qd,R,!0)}function zP(a,u){return a&&a.length?Ob(a,Rt(u)):t}var UP=It(Mw);function Mw(a,u){return a&&a.length&&u&&u.length?t0(a,u):a}function FP(a,u,v){return a&&a.length&&u&&u.length?t0(a,u,ut(v,2)):a}function VP(a,u,v){return a&&a.length&&u&&u.length?t0(a,u,t,v):a}var HP=eo(function(a,u){var v=a==null?0:a.length,M=Wu(a,u);return Bb(a,_n(u,function(R){return to(R,v)?+R:R}).sort(qb)),M});function GP(a,u){var v=[];if(!(a&&a.length))return v;var M=-1,R=[],N=a.length;for(u=ut(u,3);++M<N;){var W=a[M];u(W,M,a)&&(v.push(W),R.push(M))}return Bb(a,R),v}function b0(a){return a==null?a:Eg.call(a)}function WP(a,u,v){var M=a==null?0:a.length;return M?(v&&typeof v!="number"&&zi(a,u,v)?(u=0,v=M):(u=u==null?0:Rt(u),v=v===t?M:Rt(v)),Rr(a,u,v)):[]}function jP(a,u){return xp(a,u)}function XP(a,u,v){return r0(a,u,ut(v,2))}function qP(a,u){var v=a==null?0:a.length;if(v){var M=xp(a,u);if(M<v&&Xr(a[M],u))return M}return-1}function YP(a,u){return xp(a,u,!0)}function ZP(a,u,v){return r0(a,u,ut(v,2),!0)}function KP(a,u){var v=a==null?0:a.length;if(v){var M=xp(a,u,!0)-1;if(Xr(a[M],u))return M}return-1}function JP(a){return a&&a.length?Ub(a):[]}function QP(a,u){return a&&a.length?Ub(a,ut(u,2)):[]}function $P(a){var u=a==null?0:a.length;return u?Rr(a,1,u):[]}function eR(a,u,v){return a&&a.length?(u=v||u===t?1:Rt(u),Rr(a,0,u<0?0:u)):[]}function tR(a,u,v){var M=a==null?0:a.length;return M?(u=v||u===t?1:Rt(u),u=M-u,Rr(a,u<0?0:u,M)):[]}function nR(a,u){return a&&a.length?bp(a,ut(u,3),!1,!0):[]}function iR(a,u){return a&&a.length?bp(a,ut(u,3)):[]}var rR=It(function(a){return Ko(ii(a,1,qn,!0))}),sR=It(function(a){var u=Lr(a);return qn(u)&&(u=t),Ko(ii(a,1,qn,!0),ut(u,2))}),oR=It(function(a){var u=Lr(a);return u=typeof u=="function"?u:t,Ko(ii(a,1,qn,!0),t,u)});function aR(a){return a&&a.length?Ko(a):[]}function lR(a,u){return a&&a.length?Ko(a,ut(u,2)):[]}function cR(a,u){return u=typeof u=="function"?u:t,a&&a.length?Ko(a,t,u):[]}function w0(a){if(!(a&&a.length))return[];var u=0;return a=kn(a,function(v){if(qn(v))return u=Xn(v.length,u),!0}),Il(u,function(v){return _n(a,Da(v))})}function Ew(a,u){if(!(a&&a.length))return[];var v=w0(a);return u==null?v:_n(v,function(M){return Mi(u,t,M)})}var uR=It(function(a,u){return qn(a)?Ga(a,u):[]}),hR=It(function(a){return o0(kn(a,qn))}),dR=It(function(a){var u=Lr(a);return qn(u)&&(u=t),o0(kn(a,qn),ut(u,2))}),pR=It(function(a){var u=Lr(a);return u=typeof u=="function"?u:t,o0(kn(a,qn),t,u)}),fR=It(w0);function mR(a,u){return Gb(a||[],u||[],Ha)}function vR(a,u){return Gb(a||[],u||[],Yu)}var gR=It(function(a){var u=a.length,v=u>1?a[u-1]:t;return v=typeof v=="function"?(a.pop(),v):t,Ew(a,v)});function Tw(a){var u=O(a);return u.__chain__=!0,u}function yR(a,u){return u(a),a}function Rp(a,u){return u(a)}var _R=eo(function(a){var u=a.length,v=u?a[0]:0,M=this.__wrapped__,R=function(N){return Wu(N,a)};return u>1||this.__actions__.length||!(M instanceof Mt)||!to(v)?this.thru(R):(M=M.slice(v,+v+(u?1:0)),M.__actions__.push({func:Rp,args:[R],thisArg:t}),new Bi(M,this.__chain__).thru(function(N){return u&&!N.length&&N.push(t),N}))});function xR(){return Tw(this)}function bR(){return new Bi(this.value(),this.__chain__)}function wR(){this.__values__===t&&(this.__values__=Fw(this.value()));var a=this.__index__>=this.__values__.length,u=a?t:this.__values__[this.__index__++];return{done:a,value:u}}function SR(){return this}function MR(a){for(var u,v=this;v instanceof ur;){var M=_w(v);M.__index__=0,M.__values__=t,u?R.__wrapped__=M:u=M;var R=M;v=v.__wrapped__}return R.__wrapped__=a,u}function ER(){var a=this.__wrapped__;if(a instanceof Mt){var u=a;return this.__actions__.length&&(u=new Mt(this)),u=u.reverse(),u.__actions__.push({func:Rp,args:[b0],thisArg:t}),new Bi(u,this.__chain__)}return this.thru(b0)}function TR(){return Hb(this.__wrapped__,this.__actions__)}var AR=wp(function(a,u,v){en.call(a,v)?++a[v]:Gr(a,v,1)});function CR(a,u,v){var M=Et(a)?Oo:Yg;return v&&zi(a,u,v)&&(u=t),M(a,ut(u,3))}function PR(a,u){var v=Et(a)?kn:mp;return v(a,ut(u,3))}var RR=$b(xw),LR=$b(bw);function DR(a,u){return ii(Lp(a,u),1)}function IR(a,u){return ii(Lp(a,u),pe)}function OR(a,u,v){return v=v===t?1:Rt(v),ii(Lp(a,u),v)}function Aw(a,u){var v=Et(a)?Ji:Wr;return v(a,ut(u,3))}function Cw(a,u){var v=Et(a)?ag:fp;return v(a,ut(u,3))}var kR=wp(function(a,u,v){en.call(a,v)?a[v].push(u):Gr(a,v,[u])});function NR(a,u,v,M){a=tr(a)?a:sc(a),v=v&&!M?Rt(v):0;var R=a.length;return v<0&&(v=Xn(R+v,0)),Np(a)?v<=R&&a.indexOf(u,v)>-1:!!R&&Cr(a,u,v)>-1}var BR=It(function(a,u,v){var M=-1,R=typeof u=="function",N=tr(a)?ie(a.length):[];return Wr(a,function(W){N[++M]=R?Mi(u,W,v):qo(W,u,v)}),N}),zR=wp(function(a,u,v){Gr(a,v,u)});function Lp(a,u){var v=Et(a)?_n:Yo;return v(a,ut(u,3))}function UR(a,u,v,M){return a==null?[]:(Et(u)||(u=u==null?[]:[u]),v=M?t:v,Et(v)||(v=v==null?[]:[v]),kb(a,u,v))}var FR=wp(function(a,u,v){a[v?0:1].push(u)},function(){return[[],[]]});function VR(a,u,v){var M=Et(a)?La:Dl,R=arguments.length<3;return M(a,ut(u,4),v,R,Wr)}function HR(a,u,v){var M=Et(a)?js:Dl,R=arguments.length<3;return M(a,ut(u,4),v,R,fp)}function GR(a,u){var v=Et(a)?kn:mp;return v(a,Op(ut(u,3)))}function WR(a){var u=Et(a)?up:N3;return u(a)}function jR(a,u,v){(v?zi(a,u,v):u===t)?u=1:u=Rt(u);var M=Et(a)?Xg:B3;return M(a,u)}function XR(a){var u=Et(a)?Va:U3;return u(a)}function qR(a){if(a==null)return 0;if(tr(a))return Np(a)?Ys(a):a.length;var u=Ci(a);return u==Ae||u==yt?a.size:jt(a).length}function YR(a,u,v){var M=Et(a)?hn:F3;return v&&zi(a,u,v)&&(u=t),M(a,ut(u,3))}var ZR=It(function(a,u){if(a==null)return[];var v=u.length;return v>1&&zi(a,u[0],u[1])?u=[]:v>2&&zi(u[0],u[1],u[2])&&(u=[u[0]]),kb(a,ii(u,1),[])}),Dp=Bu||function(){return ni.Date.now()};function KR(a,u){if(typeof u!="function")throw new Ei(o);return a=Rt(a),function(){if(--a<1)return u.apply(this,arguments)}}function Pw(a,u,v){return u=v?t:u,u=a&&u==null?a.length:u,$s(a,F,t,t,t,t,u)}function Rw(a,u){var v;if(typeof u!="function")throw new Ei(o);return a=Rt(a),function(){return--a>0&&(v=u.apply(this,arguments)),a<=1&&(u=t),v}}var S0=It(function(a,u,v){var M=b;if(v.length){var R=fs(v,ic(S0));M|=D}return $s(a,M,u,v,R)}),Lw=It(function(a,u,v){var M=b|T;if(v.length){var R=fs(v,ic(Lw));M|=D}return $s(u,M,a,v,R)});function Dw(a,u,v){u=v?t:u;var M=$s(a,C,t,t,t,t,t,u);return M.placeholder=Dw.placeholder,M}function Iw(a,u,v){u=v?t:u;var M=$s(a,A,t,t,t,t,t,u);return M.placeholder=Iw.placeholder,M}function Ow(a,u,v){var M,R,N,W,Y,Q,_e=0,be=!1,Se=!1,Ve=!0;if(typeof a!="function")throw new Ei(o);u=Dr(u)||0,Nn(v)&&(be=!!v.leading,Se="maxWait"in v,N=Se?Xn(Dr(v.maxWait)||0,u):N,Ve="trailing"in v?!!v.trailing:Ve);function tt(Yn){var qr=M,ro=R;return M=R=t,_e=Yn,W=a.apply(ro,qr),W}function dt(Yn){return _e=Yn,Y=Ju(Ht,u),be?tt(Yn):W}function Lt(Yn){var qr=Yn-Q,ro=Yn-_e,$w=u-qr;return Se?ui($w,N-ro):$w}function pt(Yn){var qr=Yn-Q,ro=Yn-_e;return Q===t||qr>=u||qr<0||Se&&ro>=N}function Ht(){var Yn=Dp();if(pt(Yn))return qt(Yn);Y=Ju(Ht,Lt(Yn))}function qt(Yn){return Y=t,Ve&&M?tt(Yn):(M=R=t,W)}function pr(){Y!==t&&Wb(Y),_e=0,M=Q=R=Y=t}function Ui(){return Y===t?W:qt(Dp())}function fr(){var Yn=Dp(),qr=pt(Yn);if(M=arguments,R=this,Q=Yn,qr){if(Y===t)return dt(Q);if(Se)return Wb(Y),Y=Ju(Ht,u),tt(Q)}return Y===t&&(Y=Ju(Ht,u)),W}return fr.cancel=pr,fr.flush=Ui,fr}var JR=It(function(a,u){return pp(a,1,u)}),QR=It(function(a,u,v){return pp(a,Dr(u)||0,v)});function $R(a){return $s(a,k)}function Ip(a,u){if(typeof a!="function"||u!=null&&typeof u!="function")throw new Ei(o);var v=function(){var M=arguments,R=u?u.apply(this,M):M[0],N=v.cache;if(N.has(R))return N.get(R);var W=a.apply(this,M);return v.cache=N.set(R,W)||N,W};return v.cache=new(Ip.Cache||Ti),v}Ip.Cache=Ti;function Op(a){if(typeof a!="function")throw new Ei(o);return function(){var u=arguments;switch(u.length){case 0:return!a.call(this);case 1:return!a.call(this,u[0]);case 2:return!a.call(this,u[0],u[1]);case 3:return!a.call(this,u[0],u[1],u[2])}return!a.apply(this,u)}}function eL(a){return Rw(2,a)}var tL=V3(function(a,u){u=u.length==1&&Et(u[0])?_n(u[0],_i(ut())):_n(ii(u,1),_i(ut()));var v=u.length;return It(function(M){for(var R=-1,N=ui(M.length,v);++R<N;)M[R]=u[R].call(this,M[R]);return Mi(a,this,M)})}),M0=It(function(a,u){var v=fs(u,ic(M0));return $s(a,D,t,u,v)}),kw=It(function(a,u){var v=fs(u,ic(kw));return $s(a,I,t,u,v)}),nL=eo(function(a,u){return $s(a,P,t,t,t,u)});function iL(a,u){if(typeof a!="function")throw new Ei(o);return u=u===t?u:Rt(u),It(a,u)}function rL(a,u){if(typeof a!="function")throw new Ei(o);return u=u==null?0:Xn(Rt(u),0),It(function(v){var M=v[u],R=Qo(v,0,u);return M&&Ur(R,M),Mi(a,this,R)})}function sL(a,u,v){var M=!0,R=!0;if(typeof a!="function")throw new Ei(o);return Nn(v)&&(M="leading"in v?!!v.leading:M,R="trailing"in v?!!v.trailing:R),Ow(a,u,{leading:M,maxWait:u,trailing:R})}function oL(a){return Pw(a,1)}function aL(a,u){return M0(l0(u),a)}function lL(){if(!arguments.length)return[];var a=arguments[0];return Et(a)?a:[a]}function cL(a){return $i(a,_)}function uL(a,u){return u=typeof u=="function"?u:t,$i(a,_,u)}function hL(a){return $i(a,g|_)}function dL(a,u){return u=typeof u=="function"?u:t,$i(a,g|_,u)}function pL(a,u){return u==null||Ql(a,u,hi(u))}function Xr(a,u){return a===u||a!==a&&u!==u}var fL=Tp(Xu),mL=Tp(function(a,u){return a>=u}),qa=yp(function(){return arguments}())?yp:function(a){return Un(a)&&en.call(a,"callee")&&!ep.call(a,"callee")},Et=ie.isArray,vL=Wd?_i(Wd):e0;function tr(a){return a!=null&&kp(a.length)&&!no(a)}function qn(a){return Un(a)&&tr(a)}function gL(a){return a===!0||a===!1||Un(a)&&xi(a)==nt}var $o=xg||k0,yL=yi?_i(yi):m;function _L(a){return Un(a)&&a.nodeType===1&&!Qu(a)}function xL(a){if(a==null)return!0;if(tr(a)&&(Et(a)||typeof a=="string"||typeof a.splice=="function"||$o(a)||rc(a)||qa(a)))return!a.length;var u=Ci(a);if(u==Ae||u==yt)return!a.size;if(Ku(a))return!jt(a).length;for(var v in a)if(en.call(a,v))return!1;return!0}function bL(a,u){return c(a,u)}function wL(a,u,v){v=typeof v=="function"?v:t;var M=v?v(a,u):t;return M===t?c(a,u,t,v):!!M}function E0(a){if(!Un(a))return!1;var u=xi(a);return u==vt||u==Le||typeof a.message=="string"&&typeof a.name=="string"&&!Qu(a)}function SL(a){return typeof a=="number"&&tp(a)}function no(a){if(!Nn(a))return!1;var u=xi(a);return u==ve||u==xe||u==Ut||u==st}function Nw(a){return typeof a=="number"&&a==Rt(a)}function kp(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=re}function Nn(a){var u=typeof a;return a!=null&&(u=="object"||u=="function")}function Un(a){return a!=null&&typeof a=="object"}var Bw=jd?_i(jd):x;function ML(a,u){return a===u||L(a,u,m0(u))}function EL(a,u,v){return v=typeof v=="function"?v:t,L(a,u,m0(u),v)}function TL(a){return zw(a)&&a!=+a}function AL(a){if(uP(a))throw new ft(s);return q(a)}function CL(a){return a===null}function PL(a){return a==null}function zw(a){return typeof a=="number"||Un(a)&&xi(a)==We}function Qu(a){if(!Un(a)||xi(a)!=rt)return!1;var u=Hl(a);if(u===null)return!0;var v=en.call(u,"constructor")&&u.constructor;return typeof v=="function"&&v instanceof v&&Bl.call(v)==vg}var T0=Ra?_i(Ra):ee;function RL(a){return Nw(a)&&a>=-re&&a<=re}var Uw=Ru?_i(Ru):Oe;function Np(a){return typeof a=="string"||!Et(a)&&Un(a)&&xi(a)==H}function dr(a){return typeof a=="symbol"||Un(a)&&xi(a)==B}var rc=Rl?_i(Rl):lt;function LL(a){return a===t}function DL(a){return Un(a)&&Ci(a)==we}function IL(a){return Un(a)&&xi(a)==Ne}var OL=Tp(jr),kL=Tp(function(a,u){return a<=u});function Fw(a){if(!a)return[];if(tr(a))return Np(a)?cr(a):er(a);if(Vo&&a[Vo])return hg(a[Vo]());var u=Ci(a),v=u==Ae?ku:u==yt?Ba:sc;return v(a)}function io(a){if(!a)return a===0?a:0;if(a=Dr(a),a===pe||a===-pe){var u=a<0?-1:1;return u*se}return a===a?a:0}function Rt(a){var u=io(a),v=u%1;return u===u?v?u-v:u:0}function Vw(a){return a?Ai(Rt(a),0,Te):0}function Dr(a){if(typeof a=="number")return a;if(dr(a))return ue;if(Nn(a)){var u=typeof a.valueOf=="function"?a.valueOf():a;a=Nn(u)?u+"":u}if(typeof a!="string")return a===0?a:+a;a=Ou(a);var v=Vt.test(a);return v||Tr.test(a)?rg(a.slice(2),v?2:8):Nt.test(a)?ue:+a}function Hw(a){return bs(a,nr(a))}function NL(a){return a?Ai(Rt(a),-re,re):a===0?a:0}function sn(a){return a==null?"":hr(a)}var BL=tc(function(a,u){if(Ku(u)||tr(u)){bs(u,hi(u),a);return}for(var v in u)en.call(u,v)&&Ha(a,v,u[v])}),Gw=tc(function(a,u){bs(u,nr(u),a)}),Bp=tc(function(a,u,v,M){bs(u,nr(u),a,M)}),zL=tc(function(a,u,v,M){bs(u,hi(u),a,M)}),UL=eo(Wu);function FL(a,u){var v=Wo(a);return u==null?v:dp(v,u)}var VL=It(function(a,u){a=ln(a);var v=-1,M=u.length,R=M>2?u[2]:t;for(R&&zi(u[0],u[1],R)&&(M=1);++v<M;)for(var N=u[v],W=nr(N),Y=-1,Q=W.length;++Y<Q;){var _e=W[Y],be=a[_e];(be===t||Xr(be,Fr[_e])&&!en.call(a,_e))&&(a[_e]=N[_e])}return a}),HL=It(function(a){return a.push(t,ow),Mi(Ww,t,a)});function GL(a,u){return ki(a,ut(u,3),Pr)}function WL(a,u){return ki(a,ut(u,3),ec)}function jL(a,u){return a==null?a:ju(a,ut(u,3),nr)}function XL(a,u){return a==null?a:vp(a,ut(u,3),nr)}function qL(a,u){return a&&Pr(a,ut(u,3))}function YL(a,u){return a&&ec(a,ut(u,3))}function ZL(a){return a==null?[]:Wa(a,hi(a))}function KL(a){return a==null?[]:Wa(a,nr(a))}function A0(a,u,v){var M=a==null?t:xs(a,u);return M===t?v:M}function JL(a,u){return a!=null&&cw(a,u,Kg)}function C0(a,u){return a!=null&&cw(a,u,Jg)}var QL=tw(function(a,u,v){u!=null&&typeof u.toString!="function"&&(u=zl.call(u)),a[u]=v},R0(ir)),$L=tw(function(a,u,v){u!=null&&typeof u.toString!="function"&&(u=zl.call(u)),en.call(a,u)?a[u].push(v):a[u]=[v]},ut),eD=It(qo);function hi(a){return tr(a)?cp(a):jt(a)}function nr(a){return tr(a)?cp(a,!0):Jt(a)}function tD(a,u){var v={};return u=ut(u,3),Pr(a,function(M,R,N){Gr(v,u(M,R,N),M)}),v}function nD(a,u){var v={};return u=ut(u,3),Pr(a,function(M,R,N){Gr(v,R,u(M,R,N))}),v}var iD=tc(function(a,u,v){_p(a,u,v)}),Ww=tc(function(a,u,v,M){_p(a,u,v,M)}),rD=eo(function(a,u){var v={};if(a==null)return v;var M=!1;u=_n(u,function(N){return N=Jo(N,a),M||(M=N.length>1),N}),bs(a,p0(a),v),M&&(v=$i(v,g|y|_,Q3));for(var R=u.length;R--;)s0(v,u[R]);return v});function sD(a,u){return jw(a,Op(ut(u)))}var oD=eo(function(a,u){return a==null?{}:I3(a,u)});function jw(a,u){if(a==null)return{};var v=_n(p0(a),function(M){return[M]});return u=ut(u),Nb(a,v,function(M,R){return u(M,R[0])})}function aD(a,u,v){u=Jo(u,a);var M=-1,R=u.length;for(R||(R=1,a=t);++M<R;){var N=a==null?t:a[ws(u[M])];N===t&&(M=R,N=v),a=no(N)?N.call(a):N}return a}function lD(a,u,v){return a==null?a:Yu(a,u,v)}function cD(a,u,v,M){return M=typeof M=="function"?M:t,a==null?a:Yu(a,u,v,M)}var Xw=rw(hi),qw=rw(nr);function uD(a,u,v){var M=Et(a),R=M||$o(a)||rc(a);if(u=ut(u,4),v==null){var N=a&&a.constructor;R?v=M?new N:[]:Nn(a)?v=no(N)?Wo(Hl(a)):{}:v={}}return(R?Ji:Pr)(a,function(W,Y,Q){return u(v,W,Y,Q)}),v}function hD(a,u){return a==null?!0:s0(a,u)}function dD(a,u,v){return a==null?a:Vb(a,u,l0(v))}function pD(a,u,v,M){return M=typeof M=="function"?M:t,a==null?a:Vb(a,u,l0(v),M)}function sc(a){return a==null?[]:Oa(a,hi(a))}function fD(a){return a==null?[]:Oa(a,nr(a))}function mD(a,u,v){return v===t&&(v=u,u=t),v!==t&&(v=Dr(v),v=v===v?v:0),u!==t&&(u=Dr(u),u=u===u?u:0),Ai(Dr(a),u,v)}function vD(a,u,v){return u=io(u),v===t?(v=u,u=0):v=io(v),a=Dr(a),Qg(a,u,v)}function gD(a,u,v){if(v&&typeof v!="boolean"&&zi(a,u,v)&&(u=v=t),v===t&&(typeof u=="boolean"?(v=u,u=t):typeof a=="boolean"&&(v=a,a=t)),a===t&&u===t?(a=0,u=1):(a=io(a),u===t?(u=a,a=0):u=io(u)),a>u){var M=a;a=u,u=M}if(v||a%1||u%1){var R=np();return ui(a+R*(u-a+ig("1e-"+((R+"").length-1))),u)}return n0(a,u)}var yD=nc(function(a,u,v){return u=u.toLowerCase(),a+(v?Yw(u):u)});function Yw(a){return P0(sn(a).toLowerCase())}function Zw(a){return a=sn(a),a&&a.replace(cs,Ol).replace(qv,"")}function _D(a,u,v){a=sn(a),u=hr(u);var M=a.length;v=v===t?M:Ai(Rt(v),0,M);var R=v;return v-=u.length,v>=0&&a.slice(v,R)==u}function xD(a){return a=sn(a),a&&Yi.test(a)?a.replace(Ct,lg):a}function bD(a){return a=sn(a),a&&yu.test(a)?a.replace(Aa,"\\$&"):a}var wD=nc(function(a,u,v){return a+(v?"-":"")+u.toLowerCase()}),SD=nc(function(a,u,v){return a+(v?" ":"")+u.toLowerCase()}),MD=Qb("toLowerCase");function ED(a,u,v){a=sn(a),u=Rt(u);var M=u?Ys(a):0;if(!u||M>=u)return a;var R=(u-M)/2;return Ep(Ho(R),v)+a+Ep(ql(R),v)}function TD(a,u,v){a=sn(a),u=Rt(u);var M=u?Ys(a):0;return u&&M<u?a+Ep(u-M,v):a}function AD(a,u,v){a=sn(a),u=Rt(u);var M=u?Ys(a):0;return u&&M<u?Ep(u-M,v)+a:a}function CD(a,u,v){return v||u==null?u=0:u&&(u=+u),Mg(sn(a).replace(V,""),u||0)}function PD(a,u,v){return(v?zi(a,u,v):u===t)?u=1:u=Rt(u),i0(sn(a),u)}function RD(){var a=arguments,u=sn(a[0]);return a.length<3?u:u.replace(a[1],a[2])}var LD=nc(function(a,u,v){return a+(v?"_":"")+u.toLowerCase()});function DD(a,u,v){return v&&typeof v!="number"&&zi(a,u,v)&&(u=v=t),v=v===t?Te:v>>>0,v?(a=sn(a),a&&(typeof u=="string"||u!=null&&!T0(u))&&(u=hr(u),!u&&Bo(a))?Qo(cr(a),0,v):a.split(u,v)):[]}var ID=nc(function(a,u,v){return a+(v?" ":"")+P0(u)});function OD(a,u,v){return a=sn(a),v=v==null?0:Ai(Rt(v),0,a.length),u=hr(u),a.slice(v,v+u.length)==u}function kD(a,u,v){var M=O.templateSettings;v&&zi(a,u,v)&&(u=t),a=sn(a),u=Bp({},u,M,sw);var R=Bp({},u.imports,M.imports,sw),N=hi(R),W=Oa(R,N),Y,Q,_e=0,be=u.interpolate||ci,Se="__p += '",Ve=Nu((u.escape||ci).source+"|"+be.source+"|"+(be===Vs?St:ci).source+"|"+(u.evaluate||ci).source+"|$","g"),tt="//# sourceURL="+(en.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Qv+"]")+`
|
||
`;a.replace(Ve,function(pt,Ht,qt,pr,Ui,fr){return qt||(qt=pr),Se+=a.slice(_e,fr).replace(Pt,cg),Ht&&(Y=!0,Se+=`' +
|
||
__e(`+Ht+`) +
|
||
'`),Ui&&(Q=!0,Se+=`';
|
||
`+Ui+`;
|
||
__p += '`),qt&&(Se+=`' +
|
||
((__t = (`+qt+`)) == null ? '' : __t) +
|
||
'`),_e=fr+pt.length,pt}),Se+=`';
|
||
`;var dt=en.call(u,"variable")&&u.variable;if(!dt)Se=`with (obj) {
|
||
`+Se+`
|
||
}
|
||
`;else if(gt.test(dt))throw new ft(l);Se=(Q?Se.replace(et,""):Se).replace(Ie,"$1").replace(ct,"$1;"),Se="function("+(dt||"obj")+`) {
|
||
`+(dt?"":`obj || (obj = {});
|
||
`)+"var __t, __p = ''"+(Y?", __e = _.escape":"")+(Q?`, __j = Array.prototype.join;
|
||
function print() { __p += __j.call(arguments, '') }
|
||
`:`;
|
||
`)+Se+`return __p
|
||
}`;var Lt=Jw(function(){return Wt(N,tt+"return "+Se).apply(t,W)});if(Lt.source=Se,E0(Lt))throw Lt;return Lt}function ND(a){return sn(a).toLowerCase()}function BD(a){return sn(a).toUpperCase()}function zD(a,u,v){if(a=sn(a),a&&(v||u===t))return Ou(a);if(!a||!(u=hr(u)))return a;var M=cr(a),R=cr(u),N=Na(M,R),W=Xs(M,R)+1;return Qo(M,N,W).join("")}function UD(a,u,v){if(a=sn(a),a&&(v||u===t))return a.slice(0,Kd(a)+1);if(!a||!(u=hr(u)))return a;var M=cr(a),R=Xs(M,cr(u))+1;return Qo(M,0,R).join("")}function FD(a,u,v){if(a=sn(a),a&&(v||u===t))return a.replace(V,"");if(!a||!(u=hr(u)))return a;var M=cr(a),R=Na(M,cr(u));return Qo(M,R).join("")}function VD(a,u){var v=j,M=G;if(Nn(u)){var R="separator"in u?u.separator:R;v="length"in u?Rt(u.length):v,M="omission"in u?hr(u.omission):M}a=sn(a);var N=a.length;if(Bo(a)){var W=cr(a);N=W.length}if(v>=N)return a;var Y=v-Ys(M);if(Y<1)return M;var Q=W?Qo(W,0,Y).join(""):a.slice(0,Y);if(R===t)return Q+M;if(W&&(Y+=Q.length-Y),T0(R)){if(a.slice(Y).search(R)){var _e,be=Q;for(R.global||(R=Nu(R.source,sn(Dt.exec(R))+"g")),R.lastIndex=0;_e=R.exec(be);)var Se=_e.index;Q=Q.slice(0,Se===t?Y:Se)}}else if(a.indexOf(hr(R),Y)!=Y){var Ve=Q.lastIndexOf(R);Ve>-1&&(Q=Q.slice(0,Ve))}return Q+M}function HD(a){return a=sn(a),a&&jn.test(a)?a.replace(wt,fg):a}var GD=nc(function(a,u,v){return a+(v?" ":"")+u.toUpperCase()}),P0=Qb("toUpperCase");function Kw(a,u,v){return a=sn(a),u=v?t:u,u===t?qs(a)?ms(a):Lu(a):a.match(u)||[]}var Jw=It(function(a,u){try{return Mi(a,t,u)}catch(v){return E0(v)?v:new ft(v)}}),WD=eo(function(a,u){return Ji(u,function(v){v=ws(v),Gr(a,v,S0(a[v],a))}),a});function jD(a){var u=a==null?0:a.length,v=ut();return a=u?_n(a,function(M){if(typeof M[1]!="function")throw new Ei(o);return[v(M[0]),M[1]]}):[],It(function(M){for(var R=-1;++R<u;){var N=a[R];if(Mi(N[0],this,M))return Mi(N[1],this,M)}})}function XD(a){return qg($i(a,g))}function R0(a){return function(){return a}}function qD(a,u){return a==null||a!==a?u:a}var YD=ew(),ZD=ew(!0);function ir(a){return a}function L0(a){return mt(typeof a=="function"?a:$i(a,g))}function KD(a){return Zo($i(a,g))}function JD(a,u){return Qs(a,$i(u,g))}var QD=It(function(a,u){return function(v){return qo(v,a,u)}}),$D=It(function(a,u){return function(v){return qo(a,v,u)}});function D0(a,u,v){var M=hi(u),R=Wa(u,M);v==null&&!(Nn(u)&&(R.length||!M.length))&&(v=u,u=a,a=this,R=Wa(u,hi(u)));var N=!(Nn(v)&&"chain"in v)||!!v.chain,W=no(a);return Ji(R,function(Y){var Q=u[Y];a[Y]=Q,W&&(a.prototype[Y]=function(){var _e=this.__chain__;if(N||_e){var be=a(this.__wrapped__),Se=be.__actions__=er(this.__actions__);return Se.push({func:Q,args:arguments,thisArg:a}),be.__chain__=_e,be}return Q.apply(a,Ur([this.value()],arguments))})}),a}function e4(){return ni._===this&&(ni._=Fo),this}function I0(){}function t4(a){return a=Rt(a),It(function(u){return Ob(u,a)})}var n4=u0(_n),i4=u0(Oo),r4=u0(hn);function Qw(a){return g0(a)?Da(ws(a)):O3(a)}function s4(a){return function(u){return a==null?t:xs(a,u)}}var o4=nw(),a4=nw(!0);function O0(){return[]}function k0(){return!1}function l4(){return{}}function c4(){return""}function u4(){return!0}function h4(a,u){if(a=Rt(a),a<1||a>re)return[];var v=Te,M=ui(a,Te);u=ut(u),a-=Te;for(var R=Il(M,u);++v<a;)u(v);return R}function d4(a){return Et(a)?_n(a,ws):dr(a)?[a]:er(yw(sn(a)))}function p4(a){var u=++$d;return sn(a)+u}var f4=Mp(function(a,u){return a+u},0),m4=h0("ceil"),v4=Mp(function(a,u){return a/u},1),g4=h0("floor");function y4(a){return a&&a.length?$l(a,ir,Xu):t}function _4(a,u){return a&&a.length?$l(a,ut(u,2),Xu):t}function x4(a){return Yd(a,ir)}function b4(a,u){return Yd(a,ut(u,2))}function w4(a){return a&&a.length?$l(a,ir,jr):t}function S4(a,u){return a&&a.length?$l(a,ut(u,2),jr):t}var M4=Mp(function(a,u){return a*u},1),E4=h0("round"),T4=Mp(function(a,u){return a-u},0);function A4(a){return a&&a.length?ko(a,ir):0}function C4(a,u){return a&&a.length?ko(a,ut(u,2)):0}return O.after=KR,O.ary=Pw,O.assign=BL,O.assignIn=Gw,O.assignInWith=Bp,O.assignWith=zL,O.at=UL,O.before=Rw,O.bind=S0,O.bindAll=WD,O.bindKey=Lw,O.castArray=lL,O.chain=Tw,O.chunk=gP,O.compact=yP,O.concat=_P,O.cond=jD,O.conforms=XD,O.constant=R0,O.countBy=AR,O.create=FL,O.curry=Dw,O.curryRight=Iw,O.debounce=Ow,O.defaults=VL,O.defaultsDeep=HL,O.defer=JR,O.delay=QR,O.difference=xP,O.differenceBy=bP,O.differenceWith=wP,O.drop=SP,O.dropRight=MP,O.dropRightWhile=EP,O.dropWhile=TP,O.fill=AP,O.filter=PR,O.flatMap=DR,O.flatMapDeep=IR,O.flatMapDepth=OR,O.flatten=ww,O.flattenDeep=CP,O.flattenDepth=PP,O.flip=$R,O.flow=YD,O.flowRight=ZD,O.fromPairs=RP,O.functions=ZL,O.functionsIn=KL,O.groupBy=kR,O.initial=DP,O.intersection=IP,O.intersectionBy=OP,O.intersectionWith=kP,O.invert=QL,O.invertBy=$L,O.invokeMap=BR,O.iteratee=L0,O.keyBy=zR,O.keys=hi,O.keysIn=nr,O.map=Lp,O.mapKeys=tD,O.mapValues=nD,O.matches=KD,O.matchesProperty=JD,O.memoize=Ip,O.merge=iD,O.mergeWith=Ww,O.method=QD,O.methodOf=$D,O.mixin=D0,O.negate=Op,O.nthArg=t4,O.omit=rD,O.omitBy=sD,O.once=eL,O.orderBy=UR,O.over=n4,O.overArgs=tL,O.overEvery=i4,O.overSome=r4,O.partial=M0,O.partialRight=kw,O.partition=FR,O.pick=oD,O.pickBy=jw,O.property=Qw,O.propertyOf=s4,O.pull=UP,O.pullAll=Mw,O.pullAllBy=FP,O.pullAllWith=VP,O.pullAt=HP,O.range=o4,O.rangeRight=a4,O.rearg=nL,O.reject=GR,O.remove=GP,O.rest=iL,O.reverse=b0,O.sampleSize=jR,O.set=lD,O.setWith=cD,O.shuffle=XR,O.slice=WP,O.sortBy=ZR,O.sortedUniq=JP,O.sortedUniqBy=QP,O.split=DD,O.spread=rL,O.tail=$P,O.take=eR,O.takeRight=tR,O.takeRightWhile=nR,O.takeWhile=iR,O.tap=yR,O.throttle=sL,O.thru=Rp,O.toArray=Fw,O.toPairs=Xw,O.toPairsIn=qw,O.toPath=d4,O.toPlainObject=Hw,O.transform=uD,O.unary=oL,O.union=rR,O.unionBy=sR,O.unionWith=oR,O.uniq=aR,O.uniqBy=lR,O.uniqWith=cR,O.unset=hD,O.unzip=w0,O.unzipWith=Ew,O.update=dD,O.updateWith=pD,O.values=sc,O.valuesIn=fD,O.without=uR,O.words=Kw,O.wrap=aL,O.xor=hR,O.xorBy=dR,O.xorWith=pR,O.zip=fR,O.zipObject=mR,O.zipObjectDeep=vR,O.zipWith=gR,O.entries=Xw,O.entriesIn=qw,O.extend=Gw,O.extendWith=Bp,D0(O,O),O.add=f4,O.attempt=Jw,O.camelCase=yD,O.capitalize=Yw,O.ceil=m4,O.clamp=mD,O.clone=cL,O.cloneDeep=hL,O.cloneDeepWith=dL,O.cloneWith=uL,O.conformsTo=pL,O.deburr=Zw,O.defaultTo=qD,O.divide=v4,O.endsWith=_D,O.eq=Xr,O.escape=xD,O.escapeRegExp=bD,O.every=CR,O.find=RR,O.findIndex=xw,O.findKey=GL,O.findLast=LR,O.findLastIndex=bw,O.findLastKey=WL,O.floor=g4,O.forEach=Aw,O.forEachRight=Cw,O.forIn=jL,O.forInRight=XL,O.forOwn=qL,O.forOwnRight=YL,O.get=A0,O.gt=fL,O.gte=mL,O.has=JL,O.hasIn=C0,O.head=Sw,O.identity=ir,O.includes=NR,O.indexOf=LP,O.inRange=vD,O.invoke=eD,O.isArguments=qa,O.isArray=Et,O.isArrayBuffer=vL,O.isArrayLike=tr,O.isArrayLikeObject=qn,O.isBoolean=gL,O.isBuffer=$o,O.isDate=yL,O.isElement=_L,O.isEmpty=xL,O.isEqual=bL,O.isEqualWith=wL,O.isError=E0,O.isFinite=SL,O.isFunction=no,O.isInteger=Nw,O.isLength=kp,O.isMap=Bw,O.isMatch=ML,O.isMatchWith=EL,O.isNaN=TL,O.isNative=AL,O.isNil=PL,O.isNull=CL,O.isNumber=zw,O.isObject=Nn,O.isObjectLike=Un,O.isPlainObject=Qu,O.isRegExp=T0,O.isSafeInteger=RL,O.isSet=Uw,O.isString=Np,O.isSymbol=dr,O.isTypedArray=rc,O.isUndefined=LL,O.isWeakMap=DL,O.isWeakSet=IL,O.join=NP,O.kebabCase=wD,O.last=Lr,O.lastIndexOf=BP,O.lowerCase=SD,O.lowerFirst=MD,O.lt=OL,O.lte=kL,O.max=y4,O.maxBy=_4,O.mean=x4,O.meanBy=b4,O.min=w4,O.minBy=S4,O.stubArray=O0,O.stubFalse=k0,O.stubObject=l4,O.stubString=c4,O.stubTrue=u4,O.multiply=M4,O.nth=zP,O.noConflict=e4,O.noop=I0,O.now=Dp,O.pad=ED,O.padEnd=TD,O.padStart=AD,O.parseInt=CD,O.random=gD,O.reduce=VR,O.reduceRight=HR,O.repeat=PD,O.replace=RD,O.result=aD,O.round=E4,O.runInContext=J,O.sample=WR,O.size=qR,O.snakeCase=LD,O.some=YR,O.sortedIndex=jP,O.sortedIndexBy=XP,O.sortedIndexOf=qP,O.sortedLastIndex=YP,O.sortedLastIndexBy=ZP,O.sortedLastIndexOf=KP,O.startCase=ID,O.startsWith=OD,O.subtract=T4,O.sum=A4,O.sumBy=C4,O.template=kD,O.times=h4,O.toFinite=io,O.toInteger=Rt,O.toLength=Vw,O.toLower=ND,O.toNumber=Dr,O.toSafeInteger=NL,O.toString=sn,O.toUpper=BD,O.trim=zD,O.trimEnd=UD,O.trimStart=FD,O.truncate=VD,O.unescape=HD,O.uniqueId=p4,O.upperCase=GD,O.upperFirst=P0,O.each=Aw,O.eachRight=Cw,O.first=Sw,D0(O,function(){var a={};return Pr(O,function(u,v){en.call(O.prototype,v)||(a[v]=u)}),a}(),{chain:!1}),O.VERSION=n,Ji(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){O[a].placeholder=O}),Ji(["drop","take"],function(a,u){Mt.prototype[a]=function(v){v=v===t?1:Xn(Rt(v),0);var M=this.__filtered__&&!u?new Mt(this):this.clone();return M.__filtered__?M.__takeCount__=ui(v,M.__takeCount__):M.__views__.push({size:ui(v,Te),type:a+(M.__dir__<0?"Right":"")}),M},Mt.prototype[a+"Right"]=function(v){return this.reverse()[a](v).reverse()}}),Ji(["filter","map","takeWhile"],function(a,u){var v=u+1,M=v==Z||v==K;Mt.prototype[a]=function(R){var N=this.clone();return N.__iteratees__.push({iteratee:ut(R,3),type:v}),N.__filtered__=N.__filtered__||M,N}}),Ji(["head","last"],function(a,u){var v="take"+(u?"Right":"");Mt.prototype[a]=function(){return this[v](1).value()[0]}}),Ji(["initial","tail"],function(a,u){var v="drop"+(u?"":"Right");Mt.prototype[a]=function(){return this.__filtered__?new Mt(this):this[v](1)}}),Mt.prototype.compact=function(){return this.filter(ir)},Mt.prototype.find=function(a){return this.filter(a).head()},Mt.prototype.findLast=function(a){return this.reverse().find(a)},Mt.prototype.invokeMap=It(function(a,u){return typeof a=="function"?new Mt(this):this.map(function(v){return qo(v,a,u)})}),Mt.prototype.reject=function(a){return this.filter(Op(ut(a)))},Mt.prototype.slice=function(a,u){a=Rt(a);var v=this;return v.__filtered__&&(a>0||u<0)?new Mt(v):(a<0?v=v.takeRight(-a):a&&(v=v.drop(a)),u!==t&&(u=Rt(u),v=u<0?v.dropRight(-u):v.take(u-a)),v)},Mt.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},Mt.prototype.toArray=function(){return this.take(Te)},Pr(Mt.prototype,function(a,u){var v=/^(?:filter|find|map|reject)|While$/.test(u),M=/^(?:head|last)$/.test(u),R=O[M?"take"+(u=="last"?"Right":""):u],N=M||/^find/.test(u);R&&(O.prototype[u]=function(){var W=this.__wrapped__,Y=M?[1]:arguments,Q=W instanceof Mt,_e=Y[0],be=Q||Et(W),Se=function(Ht){var qt=R.apply(O,Ur([Ht],Y));return M&&Ve?qt[0]:qt};be&&v&&typeof _e=="function"&&_e.length!=1&&(Q=be=!1);var Ve=this.__chain__,tt=!!this.__actions__.length,dt=N&&!Ve,Lt=Q&&!tt;if(!N&&be){W=Lt?W:new Mt(this);var pt=a.apply(W,Y);return pt.__actions__.push({func:Rp,args:[Se],thisArg:t}),new Bi(pt,Ve)}return dt&&Lt?a.apply(this,Y):(pt=this.thru(Se),dt?M?pt.value()[0]:pt.value():pt)})}),Ji(["pop","push","shift","sort","splice","unshift"],function(a){var u=Zs[a],v=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",M=/^(?:pop|shift)$/.test(a);O.prototype[a]=function(){var R=arguments;if(M&&!this.__chain__){var N=this.value();return u.apply(Et(N)?N:[],R)}return this[v](function(W){return u.apply(Et(W)?W:[],R)})}}),Pr(Mt.prototype,function(a,u){var v=O[u];if(v){var M=v.name+"";en.call(Ni,M)||(Ni[M]=[]),Ni[M].push({name:u,func:v})}}),Ni[Sp(t,T).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Pg,Mt.prototype.reverse=ys,Mt.prototype.value=Rg,O.prototype.at=_R,O.prototype.chain=xR,O.prototype.commit=bR,O.prototype.next=wR,O.prototype.plant=MR,O.prototype.reverse=ER,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=TR,O.prototype.first=O.prototype.head,Vo&&(O.prototype[Vo]=SR),O},vs=mg();hs?((hs.exports=vs)._=vs,Pu._=vs):ni._=vs}).call(rl)})(rs,rs.exports);const Ma=(i,e,t)=>{if(!i.has(e)){const n=t();return i.set(e,n),n}return i.get(e)},z4=i=>{throw new Error("unexpected value: "+i)},zy=(i,e,t=new WeakSet)=>{if(Array.isArray(i)){if(t.has(i))return;t.add(i);for(let n=0;n<i.length;++n){const r=i[n];e(n,r,i),zy(r,e,t)}}else if(i&&typeof i=="object"){if(t.has(i))return;t.add(i);for(const[n,r]of Object.entries(i))e(n,r,i),zy(r,e,t)}},PE=(i,e)=>{const t=i.indexOf(e);return t===-1?!1:(i.splice(t,1),!0)},RE=(i,e=-1)=>i[i.length+e],Uy=(i,e)=>Math.random()*(e-i)+i,J_=(i,e,t)=>{let n,r=!1,s,o,l=t==="trailingPromise"?new Promise(h=>o=h):void 0;return(...h)=>{if(s=h,r)return l??n;r=!0,(t==="leading"||t==="both")&&(n=i(...s));const d=()=>{(t==="trailing"||t==="both"||t==="trailingPromise")&&(n=i(...s),o==null||o(n),l=t==="trailingPromise"?new Promise(f=>o=f):void 0),r=!1};return e>0?setTimeout(d,e):queueMicrotask(d),l??n}},U4=(i,e)=>{if(e===0){let n=!0;return queueMicrotask(()=>n&&i()),()=>n=!1}const t=setTimeout(i,e);return()=>clearTimeout(t)},Mr=(i,e,t)=>{let n,r,s,o,l=t==="trailingPromise"?new Promise(h=>o=h):void 0;return(...h)=>(s=h,n?n():(t==="leading"||t==="both")&&(r=i(...s)),n=U4(()=>{(t==="trailing"||t==="both"||t==="trailingPromise")&&(r=i(...s),o==null||o(r),l=t==="trailingPromise"?new Promise(d=>o=d):void 0),n=void 0},e),l??r)},F4=i=>i,yl=(i,e)=>{let t,n=!1,r=e==null?void 0:e();return(...s)=>{if(e){const o=e();r!==o&&(n=!1),r=o}return n?t:(n=!0,t=i(...s))}},ks=(i,e)=>{for(const t of e)for(const n of Object.getOwnPropertyNames(t.prototype))!(n in i.prototype)&&Object.defineProperty(i.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n)||Object.create(null))};class Q_{constructor(e=void 0){this._cb=e,this.done=void 0,this._value=void 0,this._callbacks=void 0,this._watched=void 0}then(e){var t;return this.done?(e(this._value),new En):(((t=this._callbacks)!==null&&t!==void 0?t:this._callbacks=new Set).add(e),new En(()=>this._callbacks.delete(e)))}watch(e){var t;return this.done?e._resolve(this._value):(((t=this._watched)!==null&&t!==void 0?t:this._watched=new Set).add(e),e.then(()=>this._watched.delete(e)),e)}_resolve(e){var t;if(this.done)return this;if(this.done=!0,this._value=e,(t=this._cb)===null||t===void 0||t.call(this,e),this._callbacks)for(const n of this._callbacks)n(e);if(this._watched)for(const n of this._watched)n._resolve(e);return this}}class Fc extends Q_{constructor(e){super(e)}resolve(e){return this._resolve(e)}}class En extends Q_{constructor(e){super(e)}cancel(){return this._resolve()}}class $_ extends Q_{constructor(e){super(e)}_resolve(){return this.dispose(),this}dispose(){return super._resolve()}}new En().cancel();class LE{constructor(){this.cbsMap=new Map}on(e,t){var n;if(Array.isArray(e)){const s=new En;for(const o of e)s.watch(this.on(o,t));return s}!((n=this.states)===null||n===void 0)&&n.has(e)&&t(this.states.get(e));const r=Ma(this.cbsMap,e,()=>new Set);return r.add(t),new En(()=>r.delete(t))}once(e,t){const n=new En;return n.watch(this.on(e,r=>{n.cancel(),t(r)})),n}emit(e,t){if(this.cbsMap.has(e))for(const n of this.cbsMap.get(e))n(t)}hasState(e){var t;return!!(!((t=this.states)===null||t===void 0)&&t.has(e))}setState(e,t){var n;(n=this.states)!==null&&n!==void 0||(this.states=new Map),!(this.states.has(e)&&this.states.get(e)===t)&&(this.states.set(e,t),this.emit(e,t))}getState(e){var t;return(t=this.states)===null||t===void 0?void 0:t.get(e)}deleteState(e){var t;(t=this.states)===null||t===void 0||t.delete(e)}clear(){var e;this.cbsMap.clear(),(e=this.states)===null||e===void 0||e.clear()}}class V4{constructor(){this.cbs=new Set}on(e){return"state"in this&&e(this.state),this.cbs.add(e),new En(()=>this.cbs.delete(e))}once(e){const t=new En;return t.watch(this.on(n=>{t.cancel(),e(n)})),t}emit(e){for(const t of this.cbs)t(e)}setState(e){"state"in this&&this.state===e||(this.state=e,this.emit(e))}getState(){return this.state}}var Er=()=>{const i=new V4;return[s=>i.emit(s),(s,o)=>o?i.once(s):i.on(s),s=>i.setState(s),()=>i.getState()]};const H4=new WeakSet,Ge=i=>{const[,e,t,n]=Er();t(i);const r=s=>{if(s){const o=new En;return o.watch(e(l=>s(l,o))),o}return n()};return H4.add(r),[t,r]},Im=(i,e)=>t=>{const n=e();n&&i([...n,t])},Om=(i,e)=>t=>{const n=e();n&&i(n.filter(r=>r!==t))},G4=(i,e)=>{const t=e();return t&&typeof t=="object"&&(zy(t,(n,r)=>Object.freeze(r)),Object.freeze(t)),()=>i(t)},Ls=[],t1=i=>{var e,t,n;const r=Ls[Ls.length-1];return(e=(t=r.fiber)[n=r.count++])!==null&&e!==void 0?e:t[n]=i()},n1=i=>{var e,t;const n=Ls[Ls.length-1],r=n.count++;return(e=(t=n.fiber)[r])!==null&&e!==void 0||(t[r]=i),[()=>n.fiber[r],s=>n.fiber[r]=s]},DE=(i,e,t,n,r,s)=>{Ls.push({count:0,fiber:t,handle:i});const o=n.map(d=>typeof d=="function"?d():d),l=!r||o.some((d,f)=>d!==r[f]);l&&typeof e=="function"&&e();const h=l?s():void 0;return Ls.pop(),[h,o,l]},W4=(i,e)=>{const t=t1(()=>Ls[Ls.length-1].handle.watch(new En(()=>{var w;return(w=r())===null||w===void 0?void 0:w()})));if(t.done)return t;const n=t1(()=>[]),[r,s]=n1(void 0),[o,l]=n1(void 0),h=r(),d=o();h&&typeof h!="function"&&console.warn("cleanup is not a function");const[f,g,y]=DE(t,h,n,e,d,i);return y&&s(typeof f=="function"?f:void 0),l(g),t},Kt=(i,e)=>{const t=new En(()=>setTimeout(()=>r==null?void 0:r())),n=[];let r,s;const o=Mr(()=>{const[l,h,d]=DE(t,r,n,e,s,i);d&&(r=typeof l=="function"?l:void 0),s=h},0,"trailing");o();for(const l of e)typeof l=="function"&&t.watch(l(o));return t},j4=i=>{var e,t,n;const r=Ls[Ls.length-1];return(e=(t=r.fiber)[n=r.count++])!==null&&e!==void 0?e:t[n]={current:typeof i=="function"?i():i}};class Tn{constructor(e){[this.set,this.get]=Ge(e)}}/**
|
||
* @license
|
||
* Copyright 2010-2022 Three.js Authors
|
||
* SPDX-License-Identifier: MIT
|
||
*/const ex="140",oc={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ac={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},X4=0,i1=1,q4=2,IE=1,Y4=2,dh=3,Oh=0,xr=1,_a=2,OE=1,rn=0,yo=1,Qf=2,r1=3,s1=4,Fy=5,Es=100,Z4=101,K4=102,o1=103,a1=104,Vy=200,J4=201,Q4=202,$4=203,$f=204,em=205,kE=206,eI=207,NE=208,tI=209,nI=210,iI=0,rI=1,sI=2,Hy=3,oI=4,aI=5,lI=6,cI=7,km=0,uI=1,hI=2,As=0,BE=1,dI=2,pI=3,fI=4,mI=5,zE=300,Vc=301,Hc=302,kh=303,Gy=304,Nm=306,Nh=1e3,yr=1001,Wy=1002,Xt=1003,l1=1004,c1=1005,Hn=1006,vI=1007,od=1008,dl=1009,gI=1010,yI=1011,pl=1012,_I=1013,Ff=1014,is=1015,Ts=1016,xI=1017,bI=1018,zc=1020,wI=1021,SI=1022,Or=1023,MI=1024,EI=1025,cl=1026,Gc=1027,TI=1028,AI=1029,CI=1030,PI=1031,RI=1033,B0=33776,z0=33777,U0=33778,F0=33779,u1=35840,h1=35841,d1=35842,p1=35843,LI=36196,f1=37492,m1=37496,v1=37808,g1=37809,y1=37810,_1=37811,x1=37812,b1=37813,w1=37814,S1=37815,M1=37816,E1=37817,T1=37818,A1=37819,C1=37820,P1=37821,R1=36492,jy=2200,Xy=2201,DI=2202,tm=2300,nm=2301,V0=2302,Ic=2400,Oc=2401,im=2402,tx=2500,UE=2501,II=0,p9=1,f9=2,Ds=3e3,Ln=3001,OI=3200,Bm=3201,_l=0,FE=1,fo="srgb",al="srgb-linear",H0=7680,kI=519,Bh=35044,rm=35048,L1="300 es",qy=1035;class Ea{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){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const bi=[];for(let i=0;i<256;i++)bi[i]=(i<16?"0":"")+i.toString(16);let D1=1234567;const yh=Math.PI/180,zh=180/Math.PI;function kr(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(bi[i&255]+bi[i>>8&255]+bi[i>>16&255]+bi[i>>24&255]+"-"+bi[e&255]+bi[e>>8&255]+"-"+bi[e>>16&15|64]+bi[e>>24&255]+"-"+bi[t&63|128]+bi[t>>8&255]+"-"+bi[t>>16&255]+bi[t>>24&255]+bi[n&255]+bi[n>>8&255]+bi[n>>16&255]+bi[n>>24&255]).toLowerCase()}function Jn(i,e,t){return Math.max(e,Math.min(t,i))}function nx(i,e){return(i%e+e)%e}function NI(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function BI(i,e,t){return i!==e?(t-i)/(e-i):0}function _h(i,e,t){return(1-t)*i+t*e}function zI(i,e,t,n){return _h(i,e,1-Math.exp(-t*n))}function UI(i,e=1){return e-Math.abs(nx(i,e*2)-e)}function FI(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function VI(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function HI(i,e){return i+Math.floor(Math.random()*(e-i+1))}function GI(i,e){return i+Math.random()*(e-i)}function WI(i){return i*(.5-Math.random())}function jI(i){i!==void 0&&(D1=i);let e=D1+=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 XI(i){return i*yh}function qI(i){return i*zh}function Yy(i){return(i&i-1)===0&&i!==0}function VE(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function sm(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function YI(i,e,t,n,r){const s=Math.cos,o=Math.sin,l=s(t/2),h=o(t/2),d=s((e+n)/2),f=o((e+n)/2),g=s((e-n)/2),y=o((e-n)/2),_=s((n-e)/2),w=o((n-e)/2);switch(r){case"XYX":i.set(l*f,h*g,h*y,l*d);break;case"YZY":i.set(h*y,l*f,h*g,l*d);break;case"ZXZ":i.set(h*g,h*y,l*f,l*d);break;case"XZX":i.set(l*f,h*w,h*_,l*d);break;case"YXY":i.set(h*_,l*f,h*w,l*d);break;case"ZYZ":i.set(h*w,h*_,l*f,l*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ZI(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function KI(i,e){switch(e.constructor){case Float32Array:return i;case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}var G0=Object.freeze({__proto__:null,DEG2RAD:yh,RAD2DEG:zh,generateUUID:kr,clamp:Jn,euclideanModulo:nx,mapLinear:NI,inverseLerp:BI,lerp:_h,damp:zI,pingpong:UI,smoothstep:FI,smootherstep:VI,randInt:HI,randFloat:GI,randFloatSpread:WI,seededRandom:jI,degToRad:XI,radToDeg:qI,isPowerOfTwo:Yy,ceilPowerOfTwo:VE,floorPowerOfTwo:sm,setQuaternionFromProperEuler:YI,normalize:KI,denormalize:ZI});class ae{constructor(e=0,t=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,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,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,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}ae.prototype.isVector2=!0;class Gn{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,r,s,o,l,h,d){const f=this.elements;return f[0]=e,f[1]=r,f[2]=l,f[3]=t,f[4]=s,f[5]=h,f[6]=n,f[7]=o,f[8]=d,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,r=t.elements,s=this.elements,o=n[0],l=n[3],h=n[6],d=n[1],f=n[4],g=n[7],y=n[2],_=n[5],w=n[8],S=r[0],b=r[3],T=r[6],E=r[1],C=r[4],A=r[7],D=r[2],I=r[5],F=r[8];return s[0]=o*S+l*E+h*D,s[3]=o*b+l*C+h*I,s[6]=o*T+l*A+h*F,s[1]=d*S+f*E+g*D,s[4]=d*b+f*C+g*I,s[7]=d*T+f*A+g*F,s[2]=y*S+_*E+w*D,s[5]=y*b+_*C+w*I,s[8]=y*T+_*A+w*F,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],r=e[2],s=e[3],o=e[4],l=e[5],h=e[6],d=e[7],f=e[8];return t*o*f-t*l*d-n*s*f+n*l*h+r*s*d-r*o*h}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],l=e[5],h=e[6],d=e[7],f=e[8],g=f*o-l*d,y=l*h-f*s,_=d*s-o*h,w=t*g+n*y+r*_;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/w;return e[0]=g*S,e[1]=(r*d-f*n)*S,e[2]=(l*n-r*o)*S,e[3]=y*S,e[4]=(f*t-r*h)*S,e[5]=(r*s-l*t)*S,e[6]=_*S,e[7]=(n*h-d*t)*S,e[8]=(o*t-n*s)*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,r,s,o,l){const h=Math.cos(s),d=Math.sin(s);return this.set(n*h,n*d,-n*(h*o+d*l)+o+e,-r*d,r*h,-r*(-d*o+h*l)+l+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),r=this.elements,s=r[0],o=r[3],l=r[6],h=r[1],d=r[4],f=r[7];return r[0]=t*s+n*h,r[3]=t*o+n*d,r[6]=t*l+n*f,r[1]=-n*s+t*h,r[4]=-n*o+t*d,r[7]=-n*l+t*f,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])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)}}Gn.prototype.isMatrix3=!0;function HE(i){for(let e=i.length-1;e>=0;--e)if(i[e]>65535)return!0;return!1}function Uh(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function ul(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Vf(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}const W0={[fo]:{[al]:ul},[al]:{[fo]:Vf}},Yr={legacyMode:!0,get workingColorSpace(){return al},set workingColorSpace(i){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(i,e,t){if(this.legacyMode||e===t||!e||!t)return i;if(W0[e]&&W0[e][t]!==void 0){const n=W0[e][t];return i.r=n(i.r),i.g=n(i.g),i.b=n(i.b),i}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(i,e){return this.convert(i,this.workingColorSpace,e)},toWorkingColorSpace:function(i,e){return this.convert(i,e,this.workingColorSpace)}},GE={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},ri={r:0,g:0,b:0},Zr={h:0,s:0,l:0},Up={h:0,s:0,l:0};function j0(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}function Fp(i,e){return e.r=i.r,e.g=i.g,e.b=i.b,e}class Pe{constructor(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=fo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Yr.toWorkingColorSpace(this,t),this}setRGB(e,t,n,r=al){return this.r=e,this.g=t,this.b=n,Yr.toWorkingColorSpace(this,r),this}setHSL(e,t,n,r=al){if(e=nx(e,1),t=Jn(t,0,1),n=Jn(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=j0(o,s,e+1/3),this.g=j0(o,s,e),this.b=j0(o,s,e-1/3)}return Yr.toWorkingColorSpace(this,r),this}setStyle(e,t=fo){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],l=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Yr.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Yr.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l)){const h=parseFloat(s[1])/360,d=parseInt(s[2],10)/100,f=parseInt(s[3],10)/100;return n(s[4]),this.setHSL(h,d,f,t)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Yr.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Yr.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=fo){const n=GE[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=ul(e.r),this.g=ul(e.g),this.b=ul(e.b),this}copyLinearToSRGB(e){return this.r=Vf(e.r),this.g=Vf(e.g),this.b=Vf(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=fo){return Yr.fromWorkingColorSpace(Fp(this,ri),e),Jn(ri.r*255,0,255)<<16^Jn(ri.g*255,0,255)<<8^Jn(ri.b*255,0,255)<<0}getHexString(e=fo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=al){Yr.fromWorkingColorSpace(Fp(this,ri),t);const n=ri.r,r=ri.g,s=ri.b,o=Math.max(n,r,s),l=Math.min(n,r,s);let h,d;const f=(l+o)/2;if(l===o)h=0,d=0;else{const g=o-l;switch(d=f<=.5?g/(o+l):g/(2-o-l),o){case n:h=(r-s)/g+(r<s?6:0);break;case r:h=(s-n)/g+2;break;case s:h=(n-r)/g+4;break}h/=6}return e.h=h,e.s=d,e.l=f,e}getRGB(e,t=al){return Yr.fromWorkingColorSpace(Fp(this,ri),t),e.r=ri.r,e.g=ri.g,e.b=ri.b,e}getStyle(e=fo){return Yr.fromWorkingColorSpace(Fp(this,ri),e),e!==fo?`color(${e} ${ri.r} ${ri.g} ${ri.b})`:`rgb(${ri.r*255|0},${ri.g*255|0},${ri.b*255|0})`}offsetHSL(e,t,n){return this.getHSL(Zr),Zr.h+=e,Zr.s+=t,Zr.l+=n,this.setHSL(Zr.h,Zr.s,Zr.l),this}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(Zr),e.getHSL(Up);const n=_h(Zr.h,Up.h,t),r=_h(Zr.s,Up.s,t),s=_h(Zr.l,Up.l,t);return this.setHSL(n,r,s),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),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}Pe.NAMES=GE;Pe.prototype.isColor=!0;Pe.prototype.r=1;Pe.prototype.g=1;Pe.prototype.b=1;let lc;class xl{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{lc===void 0&&(lc=Uh("canvas")),lc.width=e.width,lc.height=e.height;const n=lc.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=lc}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Uh("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=ul(s[o]/255)*255;return n.putImageData(r,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(ul(t[n]/255)*255):t[n]=ul(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}}class ix{constructor(e=null){this.uuid=kr(),this.data=e,this.version=0}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:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,l=r.length;o<l;o++)r[o].isDataTexture?s.push(X0(r[o].image)):s.push(X0(r[o]))}else s=X0(r);n.url=s}return t||(e.images[this.uuid]=n),n}}function X0(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?xl.getDataURL(i):i.data?{data:Array.prototype.slice.call(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}ix.prototype.isSource=!0;let JI=0;class ti extends Ea{constructor(e=ti.DEFAULT_IMAGE,t=ti.DEFAULT_MAPPING,n=yr,r=yr,s=Hn,o=od,l=Or,h=dl,d=1,f=Ds){super(),Object.defineProperty(this,"id",{value:JI++}),this.uuid=kr(),this.name="",this.source=new ix(e),this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=d,this.format=l,this.internalFormat=null,this.type=h,this.offset=new ae(0,0),this.repeat=new ae(1,1),this.center=new ae(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Gn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=f,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){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)}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.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.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}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.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==zE)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Nh:e.x=e.x-Math.floor(e.x);break;case yr:e.x=e.x<0?0:1;break;case Wy: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 Nh:e.y=e.y-Math.floor(e.y);break;case yr:e.y=e.y<0?0:1;break;case Wy: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)}}ti.DEFAULT_IMAGE=null;ti.DEFAULT_MAPPING=zE;ti.prototype.isTexture=!0;class dn{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}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,r){return this.x=e,this.y=t,this.z=n,this.w=r,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,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,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,r,s;const h=e.elements,d=h[0],f=h[4],g=h[8],y=h[1],_=h[5],w=h[9],S=h[2],b=h[6],T=h[10];if(Math.abs(f-y)<.01&&Math.abs(g-S)<.01&&Math.abs(w-b)<.01){if(Math.abs(f+y)<.1&&Math.abs(g+S)<.1&&Math.abs(w+b)<.1&&Math.abs(d+_+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const C=(d+1)/2,A=(_+1)/2,D=(T+1)/2,I=(f+y)/4,F=(g+S)/4,P=(w+b)/4;return C>A&&C>D?C<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(C),r=I/n,s=F/n):A>D?A<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(A),n=I/r,s=P/r):D<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(D),n=F/s,r=P/s),this.set(n,r,s,t),this}let E=Math.sqrt((b-w)*(b-w)+(g-S)*(g-S)+(y-f)*(y-f));return Math.abs(E)<.001&&(E=1),this.x=(b-w)/E,this.y=(g-S)/E,this.z=(y-f)/E,this.w=Math.acos((d+_+T-1)/2),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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),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}}dn.prototype.isVector4=!0;class Yt extends Ea{constructor(e,t,n={}){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new dn(0,0,e,t),this.scissorTest=!1,this.viewport=new dn(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new ti(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Hn,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,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.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new ix(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}Yt.prototype.isWebGLRenderTarget=!0;class zm extends ti{constructor(e=null,t=1,n=1,r=1){super(null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=Xt,this.minFilter=Xt,this.wrapR=yr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}zm.prototype.isDataArrayTexture=!0;class QI extends Yt{constructor(e,t,n){super(e,t),this.depth=n,this.texture=new zm(null,e,t,n),this.texture.isRenderTargetTexture=!0}}QI.prototype.isWebGLArrayRenderTarget=!0;class rx extends ti{constructor(e=null,t=1,n=1,r=1){super(null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=Xt,this.minFilter=Xt,this.wrapR=yr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}rx.prototype.isData3DTexture=!0;class $I extends Yt{constructor(e,t,n){super(e,t),this.depth=n,this.texture=new rx(null,e,t,n),this.texture.isRenderTargetTexture=!0}}$I.prototype.isWebGL3DRenderTarget=!0;class eO extends Yt{constructor(e,t,n,r={}){super(e,t,r);const s=this.texture;this.texture=[];for(let o=0;o<n;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}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 r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=n;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,n=e.texture.length;t<n;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}eO.prototype.isWebGLMultipleRenderTargets=!0;class ai{constructor(e=0,t=0,n=0,r=1){this._x=e,this._y=t,this._z=n,this._w=r}static slerp(e,t,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,r)}static slerpFlat(e,t,n,r,s,o,l){let h=n[r+0],d=n[r+1],f=n[r+2],g=n[r+3];const y=s[o+0],_=s[o+1],w=s[o+2],S=s[o+3];if(l===0){e[t+0]=h,e[t+1]=d,e[t+2]=f,e[t+3]=g;return}if(l===1){e[t+0]=y,e[t+1]=_,e[t+2]=w,e[t+3]=S;return}if(g!==S||h!==y||d!==_||f!==w){let b=1-l;const T=h*y+d*_+f*w+g*S,E=T>=0?1:-1,C=1-T*T;if(C>Number.EPSILON){const D=Math.sqrt(C),I=Math.atan2(D,T*E);b=Math.sin(b*I)/D,l=Math.sin(l*I)/D}const A=l*E;if(h=h*b+y*A,d=d*b+_*A,f=f*b+w*A,g=g*b+S*A,b===1-l){const D=1/Math.sqrt(h*h+d*d+f*f+g*g);h*=D,d*=D,f*=D,g*=D}}e[t]=h,e[t+1]=d,e[t+2]=f,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,r,s,o){const l=n[r],h=n[r+1],d=n[r+2],f=n[r+3],g=s[o],y=s[o+1],_=s[o+2],w=s[o+3];return e[t]=l*w+f*g+h*_-d*y,e[t+1]=h*w+f*y+d*g-l*_,e[t+2]=d*w+f*_+l*y-h*g,e[t+3]=f*w-l*g-h*y-d*_,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,r=e._y,s=e._z,o=e._order,l=Math.cos,h=Math.sin,d=l(n/2),f=l(r/2),g=l(s/2),y=h(n/2),_=h(r/2),w=h(s/2);switch(o){case"XYZ":this._x=y*f*g+d*_*w,this._y=d*_*g-y*f*w,this._z=d*f*w+y*_*g,this._w=d*f*g-y*_*w;break;case"YXZ":this._x=y*f*g+d*_*w,this._y=d*_*g-y*f*w,this._z=d*f*w-y*_*g,this._w=d*f*g+y*_*w;break;case"ZXY":this._x=y*f*g-d*_*w,this._y=d*_*g+y*f*w,this._z=d*f*w+y*_*g,this._w=d*f*g-y*_*w;break;case"ZYX":this._x=y*f*g-d*_*w,this._y=d*_*g+y*f*w,this._z=d*f*w-y*_*g,this._w=d*f*g+y*_*w;break;case"YZX":this._x=y*f*g+d*_*w,this._y=d*_*g+y*f*w,this._z=d*f*w-y*_*g,this._w=d*f*g-y*_*w;break;case"XZY":this._x=y*f*g-d*_*w,this._y=d*_*g-y*f*w,this._z=d*f*w+y*_*g,this._w=d*f*g+y*_*w;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],l=t[5],h=t[9],d=t[2],f=t[6],g=t[10],y=n+l+g;if(y>0){const _=.5/Math.sqrt(y+1);this._w=.25/_,this._x=(f-h)*_,this._y=(s-d)*_,this._z=(o-r)*_}else if(n>l&&n>g){const _=2*Math.sqrt(1+n-l-g);this._w=(f-h)/_,this._x=.25*_,this._y=(r+o)/_,this._z=(s+d)/_}else if(l>g){const _=2*Math.sqrt(1+l-n-g);this._w=(s-d)/_,this._x=(r+o)/_,this._y=.25*_,this._z=(h+f)/_}else{const _=2*Math.sqrt(1+g-n-l);this._w=(o-r)/_,this._x=(s+d)/_,this._y=(h+f)/_,this._z=.25*_}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(Jn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),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,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,o=e._w,l=t._x,h=t._y,d=t._z,f=t._w;return this._x=n*f+o*l+r*d-s*h,this._y=r*f+o*h+s*l-n*d,this._z=s*f+o*d+n*h-r*l,this._w=o*f-n*l-r*h-s*d,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,r=this._y,s=this._z,o=this._w;let l=o*e._w+n*e._x+r*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=o,this._x=n,this._y=r,this._z=s,this;const h=1-l*l;if(h<=Number.EPSILON){const _=1-t;return this._w=_*o+t*this._w,this._x=_*n+t*this._x,this._y=_*r+t*this._y,this._z=_*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const d=Math.sqrt(h),f=Math.atan2(d,l),g=Math.sin((1-t)*f)/d,y=Math.sin(t*f)/d;return this._w=o*g+this._w*y,this._x=n*g+this._x*y,this._y=r*g+this._y*y,this._z=s*g+this._z*y,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(s),n*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}ai.prototype.isQuaternion=!0;class z{constructor(e=0,t=0,n=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,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(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 e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(I1.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(I1.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,l=e.z,h=e.w,d=h*t+o*r-l*n,f=h*n+l*t-s*r,g=h*r+s*n-o*t,y=-s*t-o*n-l*r;return this.x=d*h+y*-s+f*-l-g*-o,this.y=f*h+y*-o+g*-s-d*-l,this.z=g*h+y*-l+d*-o-f*-s,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,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,o=t.x,l=t.y,h=t.z;return this.x=r*h-s*l,this.y=s*o-n*h,this.z=n*l-r*o,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 q0.copy(this).projectOnVector(e),this.sub(q0)}reflect(e){return this.sub(q0.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(Jn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}z.prototype.isVector3=!0;const q0=new z,I1=new ai;class sr{constructor(e=new z(1/0,1/0,1/0),t=new z(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,l=-1/0;for(let h=0,d=e.length;h<d;h+=3){const f=e[h],g=e[h+1],y=e[h+2];f<t&&(t=f),g<n&&(n=g),y<r&&(r=y),f>s&&(s=f),g>o&&(o=g),y>l&&(l=y)}return this.min.set(t,n,r),this.max.set(s,o,l),this}setFromBufferAttribute(e){let t=1/0,n=1/0,r=1/0,s=-1/0,o=-1/0,l=-1/0;for(let h=0,d=e.count;h<d;h++){const f=e.getX(h),g=e.getY(h),y=e.getZ(h);f<t&&(t=f),g<n&&(n=g),y<r&&(r=y),f>s&&(s=f),g>o&&(o=g),y>l&&(l=y)}return this.min.set(t,n,r),this.max.set(s,o,l),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=Ya.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)if(t&&n.attributes!=null&&n.attributes.position!==void 0){const s=n.attributes.position;for(let o=0,l=s.count;o<l;o++)Ya.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(Ya)}else n.boundingBox===null&&n.computeBoundingBox(),Y0.copy(n.boundingBox),Y0.applyMatrix4(e.matrixWorld),this.union(Y0);const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[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,Ya),Ya.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($u),Vp.subVectors(this.max,$u),cc.subVectors(e.a,$u),uc.subVectors(e.b,$u),hc.subVectors(e.c,$u),ea.subVectors(uc,cc),ta.subVectors(hc,uc),Za.subVectors(cc,hc);let t=[0,-ea.z,ea.y,0,-ta.z,ta.y,0,-Za.z,Za.y,ea.z,0,-ea.x,ta.z,0,-ta.x,Za.z,0,-Za.x,-ea.y,ea.x,0,-ta.y,ta.x,0,-Za.y,Za.x,0];return!Z0(t,cc,uc,hc,Vp)||(t=[1,0,0,0,1,0,0,0,1],!Z0(t,cc,uc,hc,Vp))?!1:(Hp.crossVectors(ea,ta),t=[Hp.x,Hp.y,Hp.z],Z0(t,cc,uc,hc,Vp))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Ya.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Ya).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:(so[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),so[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),so[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),so[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),so[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),so[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),so[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),so[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(so),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)}}sr.prototype.isBox3=!0;const so=[new z,new z,new z,new z,new z,new z,new z,new z],Ya=new z,Y0=new sr,cc=new z,uc=new z,hc=new z,ea=new z,ta=new z,Za=new z,$u=new z,Vp=new z,Hp=new z,Ka=new z;function Z0(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){Ka.fromArray(i,s);const l=r.x*Math.abs(Ka.x)+r.y*Math.abs(Ka.y)+r.z*Math.abs(Ka.z),h=e.dot(Ka),d=t.dot(Ka),f=n.dot(Ka);if(Math.max(-Math.max(h,d,f),Math.min(h,d,f))>l)return!1}return!0}const tO=new sr,O1=new z,Gp=new z,K0=new z;class su{constructor(e=new z,t=-1){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):tO.setFromPoints(e).getCenter(n);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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){K0.subVectors(e,this.center);const t=K0.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.add(K0.multiplyScalar(r/n)),this.radius+=r}return this}union(e){return this.center.equals(e.center)===!0?Gp.set(0,0,1).multiplyScalar(e.radius):Gp.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(O1.copy(e.center).add(Gp)),this.expandByPoint(O1.copy(e.center).sub(Gp)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const oo=new z,J0=new z,Wp=new z,na=new z,Q0=new z,jp=new z,$0=new z;class Mo{constructor(e=new z,t=new z(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,oo)),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.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=oo.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(oo.copy(this.direction).multiplyScalar(t).add(this.origin),oo.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){J0.copy(e).add(t).multiplyScalar(.5),Wp.copy(t).sub(e).normalize(),na.copy(this.origin).sub(J0);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Wp),l=na.dot(this.direction),h=-na.dot(Wp),d=na.lengthSq(),f=Math.abs(1-o*o);let g,y,_,w;if(f>0)if(g=o*h-l,y=o*l-h,w=s*f,g>=0)if(y>=-w)if(y<=w){const S=1/f;g*=S,y*=S,_=g*(g+o*y+2*l)+y*(o*g+y+2*h)+d}else y=s,g=Math.max(0,-(o*y+l)),_=-g*g+y*(y+2*h)+d;else y=-s,g=Math.max(0,-(o*y+l)),_=-g*g+y*(y+2*h)+d;else y<=-w?(g=Math.max(0,-(-o*s+l)),y=g>0?-s:Math.min(Math.max(-s,-h),s),_=-g*g+y*(y+2*h)+d):y<=w?(g=0,y=Math.min(Math.max(-s,-h),s),_=y*(y+2*h)+d):(g=Math.max(0,-(o*s+l)),y=g>0?s:Math.min(Math.max(-s,-h),s),_=-g*g+y*(y+2*h)+d);else y=o>0?-s:s,g=Math.max(0,-(o*y+l)),_=-g*g+y*(y+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(g).add(this.origin),r&&r.copy(Wp).multiplyScalar(y).add(J0),_}intersectSphere(e,t){oo.subVectors(e.center,this.origin);const n=oo.dot(this.direction),r=oo.dot(oo)-n*n,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),l=n-o,h=n+o;return l<0&&h<0?null:l<0?this.at(h,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const 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,r,s,o,l,h;const d=1/this.direction.x,f=1/this.direction.y,g=1/this.direction.z,y=this.origin;return d>=0?(n=(e.min.x-y.x)*d,r=(e.max.x-y.x)*d):(n=(e.max.x-y.x)*d,r=(e.min.x-y.x)*d),f>=0?(s=(e.min.y-y.y)*f,o=(e.max.y-y.y)*f):(s=(e.max.y-y.y)*f,o=(e.min.y-y.y)*f),n>o||s>r||((s>n||n!==n)&&(n=s),(o<r||r!==r)&&(r=o),g>=0?(l=(e.min.z-y.z)*g,h=(e.max.z-y.z)*g):(l=(e.max.z-y.z)*g,h=(e.min.z-y.z)*g),n>h||l>r)||((l>n||n!==n)&&(n=l),(h<r||r!==r)&&(r=h),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,oo)!==null}intersectTriangle(e,t,n,r,s){Q0.subVectors(t,e),jp.subVectors(n,e),$0.crossVectors(Q0,jp);let o=this.direction.dot($0),l;if(o>0){if(r)return null;l=1}else if(o<0)l=-1,o=-o;else return null;na.subVectors(this.origin,e);const h=l*this.direction.dot(jp.crossVectors(na,jp));if(h<0)return null;const d=l*this.direction.dot(Q0.cross(na));if(d<0||h+d>o)return null;const f=-l*na.dot($0);return f<0?null:this.at(f/o,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 Qe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,r,s,o,l,h,d,f,g,y,_,w,S,b){const T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=l,T[13]=h,T[2]=d,T[6]=f,T[10]=g,T[14]=y,T[3]=_,T[7]=w,T[11]=S,T[15]=b,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 Qe().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,r=1/dc.setFromMatrixColumn(e,0).length(),s=1/dc.setFromMatrixColumn(e,1).length(),o=1/dc.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,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]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),d=Math.sin(r),f=Math.cos(s),g=Math.sin(s);if(e.order==="XYZ"){const y=o*f,_=o*g,w=l*f,S=l*g;t[0]=h*f,t[4]=-h*g,t[8]=d,t[1]=_+w*d,t[5]=y-S*d,t[9]=-l*h,t[2]=S-y*d,t[6]=w+_*d,t[10]=o*h}else if(e.order==="YXZ"){const y=h*f,_=h*g,w=d*f,S=d*g;t[0]=y+S*l,t[4]=w*l-_,t[8]=o*d,t[1]=o*g,t[5]=o*f,t[9]=-l,t[2]=_*l-w,t[6]=S+y*l,t[10]=o*h}else if(e.order==="ZXY"){const y=h*f,_=h*g,w=d*f,S=d*g;t[0]=y-S*l,t[4]=-o*g,t[8]=w+_*l,t[1]=_+w*l,t[5]=o*f,t[9]=S-y*l,t[2]=-o*d,t[6]=l,t[10]=o*h}else if(e.order==="ZYX"){const y=o*f,_=o*g,w=l*f,S=l*g;t[0]=h*f,t[4]=w*d-_,t[8]=y*d+S,t[1]=h*g,t[5]=S*d+y,t[9]=_*d-w,t[2]=-d,t[6]=l*h,t[10]=o*h}else if(e.order==="YZX"){const y=o*h,_=o*d,w=l*h,S=l*d;t[0]=h*f,t[4]=S-y*g,t[8]=w*g+_,t[1]=g,t[5]=o*f,t[9]=-l*f,t[2]=-d*f,t[6]=_*g+w,t[10]=y-S*g}else if(e.order==="XZY"){const y=o*h,_=o*d,w=l*h,S=l*d;t[0]=h*f,t[4]=-g,t[8]=d*f,t[1]=y*g+S,t[5]=o*f,t[9]=_*g-w,t[2]=w*g-_,t[6]=l*f,t[10]=S*g+y}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(nO,e,iO)}lookAt(e,t,n){const r=this.elements;return mr.subVectors(e,t),mr.lengthSq()===0&&(mr.z=1),mr.normalize(),ia.crossVectors(n,mr),ia.lengthSq()===0&&(Math.abs(n.z)===1?mr.x+=1e-4:mr.z+=1e-4,mr.normalize(),ia.crossVectors(n,mr)),ia.normalize(),Xp.crossVectors(mr,ia),r[0]=ia.x,r[4]=Xp.x,r[8]=mr.x,r[1]=ia.y,r[5]=Xp.y,r[9]=mr.y,r[2]=ia.z,r[6]=Xp.z,r[10]=mr.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,o=n[0],l=n[4],h=n[8],d=n[12],f=n[1],g=n[5],y=n[9],_=n[13],w=n[2],S=n[6],b=n[10],T=n[14],E=n[3],C=n[7],A=n[11],D=n[15],I=r[0],F=r[4],P=r[8],k=r[12],j=r[1],G=r[5],ne=r[9],ce=r[13],Z=r[2],$=r[6],K=r[10],pe=r[14],re=r[3],se=r[7],ue=r[11],Te=r[15];return s[0]=o*I+l*j+h*Z+d*re,s[4]=o*F+l*G+h*$+d*se,s[8]=o*P+l*ne+h*K+d*ue,s[12]=o*k+l*ce+h*pe+d*Te,s[1]=f*I+g*j+y*Z+_*re,s[5]=f*F+g*G+y*$+_*se,s[9]=f*P+g*ne+y*K+_*ue,s[13]=f*k+g*ce+y*pe+_*Te,s[2]=w*I+S*j+b*Z+T*re,s[6]=w*F+S*G+b*$+T*se,s[10]=w*P+S*ne+b*K+T*ue,s[14]=w*k+S*ce+b*pe+T*Te,s[3]=E*I+C*j+A*Z+D*re,s[7]=E*F+C*G+A*$+D*se,s[11]=E*P+C*ne+A*K+D*ue,s[15]=E*k+C*ce+A*pe+D*Te,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],r=e[8],s=e[12],o=e[1],l=e[5],h=e[9],d=e[13],f=e[2],g=e[6],y=e[10],_=e[14],w=e[3],S=e[7],b=e[11],T=e[15];return w*(+s*h*g-r*d*g-s*l*y+n*d*y+r*l*_-n*h*_)+S*(+t*h*_-t*d*y+s*o*y-r*o*_+r*d*f-s*h*f)+b*(+t*d*g-t*l*_-s*o*g+n*o*_+s*l*f-n*d*f)+T*(-r*l*f-t*h*g+t*l*y+r*o*g-n*o*y+n*h*f)}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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],l=e[5],h=e[6],d=e[7],f=e[8],g=e[9],y=e[10],_=e[11],w=e[12],S=e[13],b=e[14],T=e[15],E=g*b*d-S*y*d+S*h*_-l*b*_-g*h*T+l*y*T,C=w*y*d-f*b*d-w*h*_+o*b*_+f*h*T-o*y*T,A=f*S*d-w*g*d+w*l*_-o*S*_-f*l*T+o*g*T,D=w*g*h-f*S*h-w*l*y+o*S*y+f*l*b-o*g*b,I=t*E+n*C+r*A+s*D;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/I;return e[0]=E*F,e[1]=(S*y*s-g*b*s-S*r*_+n*b*_+g*r*T-n*y*T)*F,e[2]=(l*b*s-S*h*s+S*r*d-n*b*d-l*r*T+n*h*T)*F,e[3]=(g*h*s-l*y*s-g*r*d+n*y*d+l*r*_-n*h*_)*F,e[4]=C*F,e[5]=(f*b*s-w*y*s+w*r*_-t*b*_-f*r*T+t*y*T)*F,e[6]=(w*h*s-o*b*s-w*r*d+t*b*d+o*r*T-t*h*T)*F,e[7]=(o*y*s-f*h*s+f*r*d-t*y*d-o*r*_+t*h*_)*F,e[8]=A*F,e[9]=(w*g*s-f*S*s-w*n*_+t*S*_+f*n*T-t*g*T)*F,e[10]=(o*S*s-w*l*s+w*n*d-t*S*d-o*n*T+t*l*T)*F,e[11]=(f*l*s-o*g*s-f*n*d+t*g*d+o*n*_-t*l*_)*F,e[12]=D*F,e[13]=(f*S*r-w*g*r+w*n*y-t*S*y-f*n*b+t*g*b)*F,e[14]=(w*l*r-o*S*r-w*n*h+t*S*h+o*n*b-t*l*b)*F,e[15]=(o*g*r-f*l*r+f*n*h-t*g*h-o*n*y+t*l*y)*F,this}scale(e){const t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return 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),r=Math.sin(t),s=1-n,o=e.x,l=e.y,h=e.z,d=s*o,f=s*l;return this.set(d*o+n,d*l-r*h,d*h+r*l,0,d*l+r*h,f*l+n,f*h-r*o,0,d*h-r*l,f*h+r*o,s*h*h+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,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,s=t._x,o=t._y,l=t._z,h=t._w,d=s+s,f=o+o,g=l+l,y=s*d,_=s*f,w=s*g,S=o*f,b=o*g,T=l*g,E=h*d,C=h*f,A=h*g,D=n.x,I=n.y,F=n.z;return r[0]=(1-(S+T))*D,r[1]=(_+A)*D,r[2]=(w-C)*D,r[3]=0,r[4]=(_-A)*I,r[5]=(1-(y+T))*I,r[6]=(b+E)*I,r[7]=0,r[8]=(w+C)*F,r[9]=(b-E)*F,r[10]=(1-(y+S))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;let s=dc.set(r[0],r[1],r[2]).length();const o=dc.set(r[4],r[5],r[6]).length(),l=dc.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Kr.copy(this);const d=1/s,f=1/o,g=1/l;return Kr.elements[0]*=d,Kr.elements[1]*=d,Kr.elements[2]*=d,Kr.elements[4]*=f,Kr.elements[5]*=f,Kr.elements[6]*=f,Kr.elements[8]*=g,Kr.elements[9]*=g,Kr.elements[10]*=g,t.setFromRotationMatrix(Kr),n.x=s,n.y=o,n.z=l,this}makePerspective(e,t,n,r,s,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const l=this.elements,h=2*s/(t-e),d=2*s/(n-r),f=(t+e)/(t-e),g=(n+r)/(n-r),y=-(o+s)/(o-s),_=-2*o*s/(o-s);return l[0]=h,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=g,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=_,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,r,s,o){const l=this.elements,h=1/(t-e),d=1/(n-r),f=1/(o-s),g=(t+e)*h,y=(n+r)*d,_=(o+s)*f;return l[0]=2*h,l[4]=0,l[8]=0,l[12]=-g,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=-2*f,l[14]=-_,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])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}}Qe.prototype.isMatrix4=!0;const dc=new z,Kr=new Qe,nO=new z(0,0,0),iO=new z(1,1,1),ia=new z,Xp=new z,mr=new z,k1=new Qe,N1=new ai;class Ta{constructor(e=0,t=0,n=0,r=Ta.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,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 r=e.elements,s=r[0],o=r[4],l=r[8],h=r[1],d=r[5],f=r[9],g=r[2],y=r[6],_=r[10];switch(t){case"XYZ":this._y=Math.asin(Jn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,_),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-Jn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(l,_),this._z=Math.atan2(h,d)):(this._y=Math.atan2(-g,s),this._z=0);break;case"ZXY":this._x=Math.asin(Jn(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-g,_),this._z=Math.atan2(-o,d)):(this._y=0,this._z=Math.atan2(h,s));break;case"ZYX":this._y=Math.asin(-Jn(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(y,_),this._z=Math.atan2(h,s)):(this._x=0,this._z=Math.atan2(-o,d));break;case"YZX":this._z=Math.asin(Jn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-f,d),this._y=Math.atan2(-g,s)):(this._x=0,this._y=Math.atan2(l,_));break;case"XZY":this._z=Math.asin(-Jn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-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 k1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(k1,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return N1.setFromEuler(this),this.setFromQuaternion(N1,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}}Ta.prototype.isEuler=!0;Ta.DefaultOrder="XYZ";Ta.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class sx{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 rO=0;const B1=new z,pc=new ai,ao=new Qe,qp=new z,eh=new z,sO=new z,oO=new ai,z1=new z(1,0,0),U1=new z(0,1,0),F1=new z(0,0,1),aO={type:"added"},V1={type:"removed"};class $t extends Ea{constructor(){super(),Object.defineProperty(this,"id",{value:rO++}),this.uuid=kr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=$t.DefaultUp.clone();const e=new z,t=new Ta,n=new ai,r=new z(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),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:r},modelViewMatrix:{value:new Qe},normalMatrix:{value:new Gn}}),this.matrix=new Qe,this.matrixWorld=new Qe,this.matrixAutoUpdate=$t.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new sx,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 pc.setFromAxisAngle(e,t),this.quaternion.multiply(pc),this}rotateOnWorldAxis(e,t){return pc.setFromAxisAngle(e,t),this.quaternion.premultiply(pc),this}rotateX(e){return this.rotateOnAxis(z1,e)}rotateY(e){return this.rotateOnAxis(U1,e)}rotateZ(e){return this.rotateOnAxis(F1,e)}translateOnAxis(e,t){return B1.copy(e).applyQuaternion(this.quaternion),this.position.add(B1.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(z1,e)}translateY(e){return this.translateOnAxis(U1,e)}translateZ(e){return this.translateOnAxis(F1,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(ao.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?qp.copy(e):qp.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),eh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ao.lookAt(eh,qp,this.up):ao.lookAt(qp,eh,this.up),this.quaternion.setFromRotationMatrix(ao),r&&(ao.extractRotation(r.matrixWorld),pc.setFromRotationMatrix(ao),this.quaternion.premultiply(pc.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.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(aO)):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(V1)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(V1)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),ao.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ao.multiply(e.parent.matrixWorld)),e.applyMatrix4(ao),this.add(e),e.updateWorldMatrix(!1,!0),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,r=this.children.length;n<r;n++){const o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eh,e,sO),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eh,oO,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,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;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.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,r=t.length;n<r;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.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++)r[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.5,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(l,h){return l[h.uuid]===void 0&&(l[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const h=l.shapes;if(Array.isArray(h))for(let d=0,f=h.length;d<f;d++){const g=h[d];s(e.shapes,g)}else s(e.shapes,h)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let h=0,d=this.material.length;h<d;h++)l.push(s(e.materials,this.material[h]));r.material=l}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const h=this.animations[l];r.animations.push(s(e.animations,h))}}if(t){const l=o(e.geometries),h=o(e.materials),d=o(e.textures),f=o(e.images),g=o(e.shapes),y=o(e.skeletons),_=o(e.animations),w=o(e.nodes);l.length>0&&(n.geometries=l),h.length>0&&(n.materials=h),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),g.length>0&&(n.shapes=g),y.length>0&&(n.skeletons=y),_.length>0&&(n.animations=_),w.length>0&&(n.nodes=w)}return n.object=r,n;function o(l){const h=[];for(const d in l){const f=l[d];delete f.metadata,h.push(f)}return h}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}}$t.DefaultUp=new z(0,1,0);$t.DefaultMatrixAutoUpdate=!0;$t.prototype.isObject3D=!0;const Jr=new z,lo=new z,ey=new z,co=new z,fc=new z,mc=new z,H1=new z,ty=new z,ny=new z,iy=new z;class oi{constructor(e=new z,t=new z,n=new z){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Jr.subVectors(e,t),r.cross(Jr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Jr.subVectors(r,t),lo.subVectors(n,t),ey.subVectors(e,t);const o=Jr.dot(Jr),l=Jr.dot(lo),h=Jr.dot(ey),d=lo.dot(lo),f=lo.dot(ey),g=o*d-l*l;if(g===0)return s.set(-2,-1,-1);const y=1/g,_=(d*h-l*f)*y,w=(o*f-l*h)*y;return s.set(1-_-w,w,_)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,co),co.x>=0&&co.y>=0&&co.x+co.y<=1}static getUV(e,t,n,r,s,o,l,h){return this.getBarycoord(e,t,n,r,co),h.set(0,0),h.addScaledVector(s,co.x),h.addScaledVector(o,co.y),h.addScaledVector(l,co.z),h}static isFrontFacing(e,t,n,r){return Jr.subVectors(n,t),lo.subVectors(e,t),Jr.cross(lo).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),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 Jr.subVectors(this.c,this.b),lo.subVectors(this.a,this.b),Jr.cross(lo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,r,s){return oi.getUV(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let o,l;fc.subVectors(r,n),mc.subVectors(s,n),ty.subVectors(e,n);const h=fc.dot(ty),d=mc.dot(ty);if(h<=0&&d<=0)return t.copy(n);ny.subVectors(e,r);const f=fc.dot(ny),g=mc.dot(ny);if(f>=0&&g<=f)return t.copy(r);const y=h*g-f*d;if(y<=0&&h>=0&&f<=0)return o=h/(h-f),t.copy(n).addScaledVector(fc,o);iy.subVectors(e,s);const _=fc.dot(iy),w=mc.dot(iy);if(w>=0&&_<=w)return t.copy(s);const S=_*d-h*w;if(S<=0&&d>=0&&w<=0)return l=d/(d-w),t.copy(n).addScaledVector(mc,l);const b=f*w-_*g;if(b<=0&&g-f>=0&&_-w>=0)return H1.subVectors(s,r),l=(g-f)/(g-f+(_-w)),t.copy(r).addScaledVector(H1,l);const T=1/(b+S+y);return o=S*T,l=y*T,t.copy(n).addScaledVector(fc,o).addScaledVector(mc,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let lO=0;class li extends Ea{constructor(){super(),Object.defineProperty(this,"id",{value:lO++}),this.uuid=kr(),this.name="",this.type="Material",this.blending=yo,this.side=Oh,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=$f,this.blendDst=em,this.blendEquation=Es,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Hy,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kI,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=H0,this.stencilZFail=H0,this.stencilZPass=H0,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===OE;continue}const r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,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&&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.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.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&&(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!==yo&&(n.blending=this.blending),this.side!==Oh&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,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.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),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=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function r(s){const o=[];for(const l in s){const h=s[l];delete h.metadata,o.push(h)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}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.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 r=t.length;n=new Array(r);for(let s=0;s!==r;++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.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}li.prototype.isMaterial=!0;li.fromType=function(){return null};class ss extends li{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=km,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}ss.prototype.isMeshBasicMaterial=!0;const Kn=new z,Yp=new ae;class Wn{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=Bh,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let n=0;for(let r=0,s=e.length;r<s;r++){let o=e[r];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),o=new Pe),t[n++]=o.r,t[n++]=o.g,t[n++]=o.b}return this}copyVector2sArray(e){const t=this.array;let n=0;for(let r=0,s=e.length;r<s;r++){let o=e[r];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),o=new ae),t[n++]=o.x,t[n++]=o.y}return this}copyVector3sArray(e){const t=this.array;let n=0;for(let r=0,s=e.length;r<s;r++){let o=e[r];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),o=new z),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z}return this}copyVector4sArray(e){const t=this.array;let n=0;for(let r=0,s=e.length;r<s;r++){let o=e[r];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),o=new dn),t[n++]=o.x,t[n++]=o.y,t[n++]=o.z,t[n++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Yp.fromBufferAttribute(this,t),Yp.applyMatrix3(e),this.setXY(t,Yp.x,Yp.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Kn.fromBufferAttribute(this,t),Kn.applyMatrix3(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Kn.fromBufferAttribute(this,t),Kn.applyMatrix4(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Kn.fromBufferAttribute(this,t),Kn.applyNormalMatrix(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Kn.fromBufferAttribute(this,t),Kn.transformDirection(e),this.setXYZ(t,Kn.x,Kn.y,Kn.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,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.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Bh&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}Wn.prototype.isBufferAttribute=!0;class WE extends Wn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class jE extends Wn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class cO extends Wn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}cO.prototype.isFloat16BufferAttribute=!0;class xt extends Wn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let uO=0;const Ir=new Qe,ry=new $t,vc=new z,vr=new sr,th=new sr,di=new z;class zt extends Ea{constructor(){super(),Object.defineProperty(this,"id",{value:uO++}),this.uuid=kr(),this.name="",this.type="BufferGeometry",this.index=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(HE(e)?jE:WE)(e,1):this.index=e,this}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 Gn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ir.makeRotationFromQuaternion(e),this.applyMatrix4(Ir),this}rotateX(e){return Ir.makeRotationX(e),this.applyMatrix4(Ir),this}rotateY(e){return Ir.makeRotationY(e),this.applyMatrix4(Ir),this}rotateZ(e){return Ir.makeRotationZ(e),this.applyMatrix4(Ir),this}translate(e,t,n){return Ir.makeTranslation(e,t,n),this.applyMatrix4(Ir),this}scale(e,t,n){return Ir.makeScale(e,t,n),this.applyMatrix4(Ir),this}lookAt(e){return ry.lookAt(e),ry.updateMatrix(),this.applyMatrix4(ry.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vc).negate(),this.translate(vc.x,vc.y,vc.z),this}setFromPoints(e){const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new xt(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new sr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new z(-1/0,-1/0,-1/0),new z(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const s=t[n];vr.setFromBufferAttribute(s),this.morphTargetsRelative?(di.addVectors(this.boundingBox.min,vr.min),this.boundingBox.expandByPoint(di),di.addVectors(this.boundingBox.max,vr.max),this.boundingBox.expandByPoint(di)):(this.boundingBox.expandByPoint(vr.min),this.boundingBox.expandByPoint(vr.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 su);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new z,1/0);return}if(e){const n=this.boundingSphere.center;if(vr.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const l=t[s];th.setFromBufferAttribute(l),this.morphTargetsRelative?(di.addVectors(vr.min,th.min),vr.expandByPoint(di),di.addVectors(vr.max,th.max),vr.expandByPoint(di)):(vr.expandByPoint(th.min),vr.expandByPoint(th.max))}vr.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)di.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(di));if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s],h=this.morphTargetsRelative;for(let d=0,f=l.count;d<f;d++)di.fromBufferAttribute(l,d),h&&(vc.fromBufferAttribute(e,d),di.add(vc)),r=Math.max(r,n.distanceToSquared(di))}this.boundingSphere.radius=Math.sqrt(r),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=e.array,r=t.position.array,s=t.normal.array,o=t.uv.array,l=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Wn(new Float32Array(4*l),4));const h=this.getAttribute("tangent").array,d=[],f=[];for(let j=0;j<l;j++)d[j]=new z,f[j]=new z;const g=new z,y=new z,_=new z,w=new ae,S=new ae,b=new ae,T=new z,E=new z;function C(j,G,ne){g.fromArray(r,j*3),y.fromArray(r,G*3),_.fromArray(r,ne*3),w.fromArray(o,j*2),S.fromArray(o,G*2),b.fromArray(o,ne*2),y.sub(g),_.sub(g),S.sub(w),b.sub(w);const ce=1/(S.x*b.y-b.x*S.y);isFinite(ce)&&(T.copy(y).multiplyScalar(b.y).addScaledVector(_,-S.y).multiplyScalar(ce),E.copy(_).multiplyScalar(S.x).addScaledVector(y,-b.x).multiplyScalar(ce),d[j].add(T),d[G].add(T),d[ne].add(T),f[j].add(E),f[G].add(E),f[ne].add(E))}let A=this.groups;A.length===0&&(A=[{start:0,count:n.length}]);for(let j=0,G=A.length;j<G;++j){const ne=A[j],ce=ne.start,Z=ne.count;for(let $=ce,K=ce+Z;$<K;$+=3)C(n[$+0],n[$+1],n[$+2])}const D=new z,I=new z,F=new z,P=new z;function k(j){F.fromArray(s,j*3),P.copy(F);const G=d[j];D.copy(G),D.sub(F.multiplyScalar(F.dot(G))).normalize(),I.crossVectors(P,G);const ce=I.dot(f[j])<0?-1:1;h[j*4]=D.x,h[j*4+1]=D.y,h[j*4+2]=D.z,h[j*4+3]=ce}for(let j=0,G=A.length;j<G;++j){const ne=A[j],ce=ne.start,Z=ne.count;for(let $=ce,K=ce+Z;$<K;$+=3)k(n[$+0]),k(n[$+1]),k(n[$+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 Wn(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let y=0,_=n.count;y<_;y++)n.setXYZ(y,0,0,0);const r=new z,s=new z,o=new z,l=new z,h=new z,d=new z,f=new z,g=new z;if(e)for(let y=0,_=e.count;y<_;y+=3){const w=e.getX(y+0),S=e.getX(y+1),b=e.getX(y+2);r.fromBufferAttribute(t,w),s.fromBufferAttribute(t,S),o.fromBufferAttribute(t,b),f.subVectors(o,s),g.subVectors(r,s),f.cross(g),l.fromBufferAttribute(n,w),h.fromBufferAttribute(n,S),d.fromBufferAttribute(n,b),l.add(f),h.add(f),d.add(f),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,h.x,h.y,h.z),n.setXYZ(b,d.x,d.y,d.z)}else for(let y=0,_=t.count;y<_;y+=3)r.fromBufferAttribute(t,y+0),s.fromBufferAttribute(t,y+1),o.fromBufferAttribute(t,y+2),f.subVectors(o,s),g.subVectors(r,s),f.cross(g),n.setXYZ(y+0,f.x,f.y,f.z),n.setXYZ(y+1,f.x,f.y,f.z),n.setXYZ(y+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const r in n){if(e.attributes[r]===void 0)continue;const o=n[r].array,l=e.attributes[r],h=l.array,d=l.itemSize*t,f=Math.min(h.length,o.length-d);for(let g=0,y=d;g<f;g++,y++)o[y]=h[g]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)di.fromBufferAttribute(e,t),di.normalize(),e.setXYZ(t,di.x,di.y,di.z)}toNonIndexed(){function e(l,h){const d=l.array,f=l.itemSize,g=l.normalized,y=new d.constructor(h.length*f);let _=0,w=0;for(let S=0,b=h.length;S<b;S++){l.isInterleavedBufferAttribute?_=h[S]*l.data.stride+l.offset:_=h[S]*f;for(let T=0;T<f;T++)y[w++]=d[_++]}return new Wn(y,f,g)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new zt,n=this.index.array,r=this.attributes;for(const l in r){const h=r[l],d=e(h,n);t.setAttribute(l,d)}const s=this.morphAttributes;for(const l in s){const h=[],d=s[l];for(let f=0,g=d.length;f<g;f++){const y=d[f],_=e(y,n);h.push(_)}t.morphAttributes[l]=h}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let l=0,h=o.length;l<h;l++){const d=o[l];t.addGroup(d.start,d.count,d.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,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 h=this.parameters;for(const d in h)h[d]!==void 0&&(e[d]=h[d]);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 h in n){const d=n[h];e.data.attributes[h]=d.toJSON(e.data)}const r={};let s=!1;for(const h in this.morphAttributes){const d=this.morphAttributes[h],f=[];for(let g=0,y=d.length;g<y;g++){const _=d[g];f.push(_.toJSON(e.data))}f.length>0&&(r[h]=f,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const r=e.attributes;for(const d in r){const f=r[d];this.setAttribute(d,f.clone(t))}const s=e.morphAttributes;for(const d in s){const f=[],g=s[d];for(let y=0,_=g.length;y<_;y++)f.push(g[y].clone(t));this.morphAttributes[d]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let d=0,f=o.length;d<f;d++){const g=o[d];this.addGroup(g.start,g.count,g.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}zt.prototype.isBufferGeometry=!0;const G1=new Qe,gc=new Mo,sy=new su,ra=new z,sa=new z,oa=new z,oy=new z,ay=new z,ly=new z,Zp=new z,Kp=new z,Jp=new z,Qp=new ae,$p=new ae,ef=new ae,cy=new z,tf=new z;class In extends $t{constructor(e=new zt,t=new ss){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,r=this.material,s=this.matrixWorld;if(r===void 0||(n.boundingSphere===null&&n.computeBoundingSphere(),sy.copy(n.boundingSphere),sy.applyMatrix4(s),e.ray.intersectsSphere(sy)===!1)||(G1.copy(s).invert(),gc.copy(e.ray).applyMatrix4(G1),n.boundingBox!==null&&gc.intersectsBox(n.boundingBox)===!1))return;let o;if(n.isBufferGeometry){const l=n.index,h=n.attributes.position,d=n.morphAttributes.position,f=n.morphTargetsRelative,g=n.attributes.uv,y=n.attributes.uv2,_=n.groups,w=n.drawRange;if(l!==null)if(Array.isArray(r))for(let S=0,b=_.length;S<b;S++){const T=_[S],E=r[T.materialIndex],C=Math.max(T.start,w.start),A=Math.min(l.count,Math.min(T.start+T.count,w.start+w.count));for(let D=C,I=A;D<I;D+=3){const F=l.getX(D),P=l.getX(D+1),k=l.getX(D+2);o=nf(this,E,e,gc,h,d,f,g,y,F,P,k),o&&(o.faceIndex=Math.floor(D/3),o.face.materialIndex=T.materialIndex,t.push(o))}}else{const S=Math.max(0,w.start),b=Math.min(l.count,w.start+w.count);for(let T=S,E=b;T<E;T+=3){const C=l.getX(T),A=l.getX(T+1),D=l.getX(T+2);o=nf(this,r,e,gc,h,d,f,g,y,C,A,D),o&&(o.faceIndex=Math.floor(T/3),t.push(o))}}else if(h!==void 0)if(Array.isArray(r))for(let S=0,b=_.length;S<b;S++){const T=_[S],E=r[T.materialIndex],C=Math.max(T.start,w.start),A=Math.min(h.count,Math.min(T.start+T.count,w.start+w.count));for(let D=C,I=A;D<I;D+=3){const F=D,P=D+1,k=D+2;o=nf(this,E,e,gc,h,d,f,g,y,F,P,k),o&&(o.faceIndex=Math.floor(D/3),o.face.materialIndex=T.materialIndex,t.push(o))}}else{const S=Math.max(0,w.start),b=Math.min(h.count,w.start+w.count);for(let T=S,E=b;T<E;T+=3){const C=T,A=T+1,D=T+2;o=nf(this,r,e,gc,h,d,f,g,y,C,A,D),o&&(o.faceIndex=Math.floor(T/3),t.push(o))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}In.prototype.isMesh=!0;function hO(i,e,t,n,r,s,o,l){let h;if(e.side===xr?h=n.intersectTriangle(o,s,r,!0,l):h=n.intersectTriangle(r,s,o,e.side!==_a,l),h===null)return null;tf.copy(l),tf.applyMatrix4(i.matrixWorld);const d=t.ray.origin.distanceTo(tf);return d<t.near||d>t.far?null:{distance:d,point:tf.clone(),object:i}}function nf(i,e,t,n,r,s,o,l,h,d,f,g){ra.fromBufferAttribute(r,d),sa.fromBufferAttribute(r,f),oa.fromBufferAttribute(r,g);const y=i.morphTargetInfluences;if(s&&y){Zp.set(0,0,0),Kp.set(0,0,0),Jp.set(0,0,0);for(let w=0,S=s.length;w<S;w++){const b=y[w],T=s[w];b!==0&&(oy.fromBufferAttribute(T,d),ay.fromBufferAttribute(T,f),ly.fromBufferAttribute(T,g),o?(Zp.addScaledVector(oy,b),Kp.addScaledVector(ay,b),Jp.addScaledVector(ly,b)):(Zp.addScaledVector(oy.sub(ra),b),Kp.addScaledVector(ay.sub(sa),b),Jp.addScaledVector(ly.sub(oa),b)))}ra.add(Zp),sa.add(Kp),oa.add(Jp)}i.isSkinnedMesh&&(i.boneTransform(d,ra),i.boneTransform(f,sa),i.boneTransform(g,oa));const _=hO(i,e,t,n,ra,sa,oa,cy);if(_){l&&(Qp.fromBufferAttribute(l,d),$p.fromBufferAttribute(l,f),ef.fromBufferAttribute(l,g),_.uv=oi.getUV(cy,ra,sa,oa,Qp,$p,ef,new ae)),h&&(Qp.fromBufferAttribute(h,d),$p.fromBufferAttribute(h,f),ef.fromBufferAttribute(h,g),_.uv2=oi.getUV(cy,ra,sa,oa,Qp,$p,ef,new ae));const w={a:d,b:f,c:g,normal:new z,materialIndex:0};oi.getNormal(ra,sa,oa,w.normal),_.face=w}return _}class bl extends zt{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};const l=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const h=[],d=[],f=[],g=[];let y=0,_=0;w("z","y","x",-1,-1,n,t,e,o,s,0),w("z","y","x",1,-1,n,t,-e,o,s,1),w("x","z","y",1,1,e,n,t,r,o,2),w("x","z","y",1,-1,e,n,-t,r,o,3),w("x","y","z",1,-1,e,t,n,r,s,4),w("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(h),this.setAttribute("position",new xt(d,3)),this.setAttribute("normal",new xt(f,3)),this.setAttribute("uv",new xt(g,2));function w(S,b,T,E,C,A,D,I,F,P,k){const j=A/F,G=D/P,ne=A/2,ce=D/2,Z=I/2,$=F+1,K=P+1;let pe=0,re=0;const se=new z;for(let ue=0;ue<K;ue++){const Te=ue*G-ce;for(let fe=0;fe<$;fe++){const Ce=fe*j-ne;se[S]=Ce*E,se[b]=Te*C,se[T]=Z,d.push(se.x,se.y,se.z),se[S]=0,se[b]=0,se[T]=I>0?1:-1,f.push(se.x,se.y,se.z),g.push(fe/F),g.push(1-ue/P),pe+=1}}for(let ue=0;ue<P;ue++)for(let Te=0;Te<F;Te++){const fe=y+Te+$*ue,Ce=y+Te+$*(ue+1),qe=y+(Te+1)+$*(ue+1),Ke=y+(Te+1)+$*ue;h.push(fe,Ce,Ke),h.push(Ce,qe,Ke),re+=6}l.addGroup(_,re,k),_+=re,y+=pe}}static fromJSON(e){return new bl(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Wc(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[t][n]=r.clone():Array.isArray(r)?e[t][n]=r.slice():e[t][n]=r}}return e}function Pi(i){const e={};for(let t=0;t<i.length;t++){const n=Wc(i[t]);for(const r in n)e[r]=n[r]}return e}const Qn={clone:Wc,merge:Pi};var dO=`void main() {
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,pO=`void main() {
|
||
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
||
}`;class kt extends li{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=dO,this.fragmentShader=pO,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Wc(e.uniforms),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 r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}kt.prototype.isShaderMaterial=!0;class Um extends $t{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Qe,this.projectionMatrix=new Qe,this.projectionMatrixInverse=new Qe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}Um.prototype.isCamera=!0;class fi extends Um{constructor(e=50,t=1,n=.1,r=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,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=zh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(yh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return zh*2*Math.atan(Math.tan(yh*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(yh*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const h=o.fullWidth,d=o.fullHeight;s+=o.offsetX*r/h,t-=o.offsetY*n/d,r*=o.width/h,n*=o.height/d}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}fi.prototype.isPerspectiveCamera=!0;const yc=90,_c=1;class ox extends $t{constructor(e,t,n){if(super(),this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;const r=new fi(yc,_c,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new z(1,0,0)),this.add(r);const s=new fi(yc,_c,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new z(-1,0,0)),this.add(s);const o=new fi(yc,_c,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new z(0,1,0)),this.add(o);const l=new fi(yc,_c,e,t);l.layers=this.layers,l.up.set(0,0,-1),l.lookAt(new z(0,-1,0)),this.add(l);const h=new fi(yc,_c,e,t);h.layers=this.layers,h.up.set(0,-1,0),h.lookAt(new z(0,0,1)),this.add(h);const d=new fi(yc,_c,e,t);d.layers=this.layers,d.up.set(0,-1,0),d.lookAt(new z(0,0,-1)),this.add(d)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[r,s,o,l,h,d]=this.children,f=e.getRenderTarget(),g=e.toneMapping,y=e.xr.enabled;e.toneMapping=As,e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,l),e.setRenderTarget(n,4),e.render(t,h),n.texture.generateMipmaps=_,e.setRenderTarget(n,5),e.render(t,d),e.setRenderTarget(f),e.toneMapping=g,e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}}class Fm extends ti{constructor(e,t,n,r,s,o,l,h,d,f){e=e!==void 0?e:[],t=t!==void 0?t:Vc,super(e,t,n,r,s,o,l,h,d,f),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Fm.prototype.isCubeTexture=!0;class XE extends Yt{constructor(e,t={}){super(e,e,t);const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new Fm(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Hn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tEquirect;
|
||
|
||
varying vec3 vWorldDirection;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldDirection );
|
||
|
||
vec2 sampleUV = equirectUv( direction );
|
||
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
|
||
}
|
||
`},r=new bl(5,5,5),s=new kt({name:"CubemapFromEquirect",uniforms:Wc(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:xr,blending:rn});s.uniforms.tEquirect.value=t;const o=new In(r,s),l=t.minFilter;return t.minFilter===od&&(t.minFilter=Hn),new ox(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(s)}}XE.prototype.isWebGLCubeRenderTarget=!0;const uy=new z,fO=new z,mO=new Gn;class mo{constructor(e=new z(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=uy.subVectors(n,t).cross(fO.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(uy),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(n).multiplyScalar(s).add(e.start)}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||mO.getNormalMatrix(e),r=this.coplanarPoint(uy).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.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)}}mo.prototype.isPlane=!0;const xc=new su,rf=new z;class ad{constructor(e=new mo,t=new mo,n=new mo,r=new mo,s=new mo,o=new mo){this.planes=[e,t,n,r,s,o]}set(e,t,n,r,s,o){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(r),l[4].copy(s),l[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,r=n[0],s=n[1],o=n[2],l=n[3],h=n[4],d=n[5],f=n[6],g=n[7],y=n[8],_=n[9],w=n[10],S=n[11],b=n[12],T=n[13],E=n[14],C=n[15];return t[0].setComponents(l-r,g-h,S-y,C-b).normalize(),t[1].setComponents(l+r,g+h,S+y,C+b).normalize(),t[2].setComponents(l+s,g+d,S+_,C+T).normalize(),t[3].setComponents(l-s,g-d,S-_,C-T).normalize(),t[4].setComponents(l-o,g-f,S-w,C-E).normalize(),t[5].setComponents(l+o,g+f,S+w,C+E).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),xc.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(xc)}intersectsSprite(e){return xc.center.set(0,0,0),xc.radius=.7071067811865476,xc.applyMatrix4(e.matrixWorld),this.intersectsSphere(xc)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(rf.x=r.normal.x>0?e.max.x:e.min.x,rf.y=r.normal.y>0?e.max.y:e.min.y,rf.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(rf)<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)}}function qE(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function vO(i,e){const t=e.isWebGL2,n=new WeakMap;function r(d,f){const g=d.array,y=d.usage,_=i.createBuffer();i.bindBuffer(f,_),i.bufferData(f,g,y),d.onUploadCallback();let w;if(g instanceof Float32Array)w=5126;else if(g instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(t)w=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else w=5123;else if(g instanceof Int16Array)w=5122;else if(g instanceof Uint32Array)w=5125;else if(g instanceof Int32Array)w=5124;else if(g instanceof Int8Array)w=5120;else if(g instanceof Uint8Array)w=5121;else if(g instanceof Uint8ClampedArray)w=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+g);return{buffer:_,type:w,bytesPerElement:g.BYTES_PER_ELEMENT,version:d.version}}function s(d,f,g){const y=f.array,_=f.updateRange;i.bindBuffer(g,d),_.count===-1?i.bufferSubData(g,0,y):(t?i.bufferSubData(g,_.offset*y.BYTES_PER_ELEMENT,y,_.offset,_.count):i.bufferSubData(g,_.offset*y.BYTES_PER_ELEMENT,y.subarray(_.offset,_.offset+_.count)),_.count=-1)}function o(d){return d.isInterleavedBufferAttribute&&(d=d.data),n.get(d)}function l(d){d.isInterleavedBufferAttribute&&(d=d.data);const f=n.get(d);f&&(i.deleteBuffer(f.buffer),n.delete(d))}function h(d,f){if(d.isGLBufferAttribute){const y=n.get(d);(!y||y.version<d.version)&&n.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);const g=n.get(d);g===void 0?n.set(d,r(d,f)):g.version<d.version&&(s(g.buffer,d,f),g.version=d.version)}return{get:o,remove:l,update:h}}class ld extends zt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const s=e/2,o=t/2,l=Math.floor(n),h=Math.floor(r),d=l+1,f=h+1,g=e/l,y=t/h,_=[],w=[],S=[],b=[];for(let T=0;T<f;T++){const E=T*y-o;for(let C=0;C<d;C++){const A=C*g-s;w.push(A,-E,0),S.push(0,0,1),b.push(C/l),b.push(1-T/h)}}for(let T=0;T<h;T++)for(let E=0;E<l;E++){const C=E+d*T,A=E+d*(T+1),D=E+1+d*(T+1),I=E+1+d*T;_.push(C,A,I),_.push(A,D,I)}this.setIndex(_),this.setAttribute("position",new xt(w,3)),this.setAttribute("normal",new xt(S,3)),this.setAttribute("uv",new xt(b,2))}static fromJSON(e){return new ld(e.width,e.height,e.widthSegments,e.heightSegments)}}var gO=`#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
|
||
#endif`,yO=`#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,_O=`#ifdef USE_ALPHATEST
|
||
if ( diffuseColor.a < alphaTest ) discard;
|
||
#endif`,xO=`#ifdef USE_ALPHATEST
|
||
uniform float alphaTest;
|
||
#endif`,bO=`#ifdef USE_AOMAP
|
||
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
|
||
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
||
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
||
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
||
#endif
|
||
#endif`,wO=`#ifdef USE_AOMAP
|
||
uniform sampler2D aoMap;
|
||
uniform float aoMapIntensity;
|
||
#endif`,SO="vec3 transformed = vec3( position );",MO=`vec3 objectNormal = vec3( normal );
|
||
#ifdef USE_TANGENT
|
||
vec3 objectTangent = vec3( tangent.xyz );
|
||
#endif`,EO=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
||
return RECIPROCAL_PI * diffuseColor;
|
||
}
|
||
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
||
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
||
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
||
}
|
||
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
||
float a2 = pow2( alpha );
|
||
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
||
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
||
return 0.5 / max( gv + gl, EPSILON );
|
||
}
|
||
float D_GGX( const in float alpha, const in float dotNH ) {
|
||
float a2 = pow2( alpha );
|
||
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
||
return RECIPROCAL_PI * a2 / pow2( denom );
|
||
}
|
||
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
|
||
float alpha = pow2( roughness );
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( f0, f90, dotVH );
|
||
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
||
float D = D_GGX( alpha, dotNH );
|
||
return F * ( V * D );
|
||
}
|
||
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
||
const float LUT_SIZE = 64.0;
|
||
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
||
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
||
float dotNV = saturate( dot( N, V ) );
|
||
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
||
uv = uv * LUT_SCALE + LUT_BIAS;
|
||
return uv;
|
||
}
|
||
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
||
float l = length( f );
|
||
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
||
}
|
||
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
||
float x = dot( v1, v2 );
|
||
float y = abs( x );
|
||
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
||
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
||
float v = a / b;
|
||
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
||
return cross( v1, v2 ) * theta_sintheta;
|
||
}
|
||
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
||
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
||
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
||
vec3 lightNormal = cross( v1, v2 );
|
||
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
||
vec3 T1, T2;
|
||
T1 = normalize( V - N * dot( V, N ) );
|
||
T2 = - cross( N, T1 );
|
||
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
|
||
vec3 coords[ 4 ];
|
||
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
||
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
||
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
||
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
||
coords[ 0 ] = normalize( coords[ 0 ] );
|
||
coords[ 1 ] = normalize( coords[ 1 ] );
|
||
coords[ 2 ] = normalize( coords[ 2 ] );
|
||
coords[ 3 ] = normalize( coords[ 3 ] );
|
||
vec3 vectorFormFactor = vec3( 0.0 );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
||
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
||
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
||
return vec3( result );
|
||
}
|
||
float G_BlinnPhong_Implicit( ) {
|
||
return 0.25;
|
||
}
|
||
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
||
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
||
}
|
||
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float dotVH = saturate( dot( viewDir, halfDir ) );
|
||
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
||
float G = G_BlinnPhong_Implicit( );
|
||
float D = D_BlinnPhong( shininess, dotNH );
|
||
return F * ( G * D );
|
||
}
|
||
#if defined( USE_SHEEN )
|
||
float D_Charlie( float roughness, float dotNH ) {
|
||
float alpha = pow2( roughness );
|
||
float invAlpha = 1.0 / alpha;
|
||
float cos2h = dotNH * dotNH;
|
||
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
||
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
||
}
|
||
float V_Neubelt( float dotNV, float dotNL ) {
|
||
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
||
}
|
||
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
||
vec3 halfDir = normalize( lightDir + viewDir );
|
||
float dotNL = saturate( dot( normal, lightDir ) );
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float dotNH = saturate( dot( normal, halfDir ) );
|
||
float D = D_Charlie( sheenRoughness, dotNH );
|
||
float V = V_Neubelt( dotNV, dotNL );
|
||
return sheenColor * ( D * V );
|
||
}
|
||
#endif`,TO=`#ifdef USE_BUMPMAP
|
||
uniform sampler2D bumpMap;
|
||
uniform float bumpScale;
|
||
vec2 dHdxy_fwd() {
|
||
vec2 dSTdx = dFdx( vUv );
|
||
vec2 dSTdy = dFdy( vUv );
|
||
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
|
||
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
|
||
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
|
||
return vec2( dBx, dBy );
|
||
}
|
||
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
||
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
|
||
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
|
||
vec3 vN = surf_norm;
|
||
vec3 R1 = cross( vSigmaY, vN );
|
||
vec3 R2 = cross( vN, vSigmaX );
|
||
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
||
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
||
return normalize( abs( fDet ) * surf_norm - vGrad );
|
||
}
|
||
#endif`,AO=`#if NUM_CLIPPING_PLANES > 0
|
||
vec4 plane;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
||
bool clipped = true;
|
||
#pragma unroll_loop_start
|
||
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
||
plane = clippingPlanes[ i ];
|
||
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
||
}
|
||
#pragma unroll_loop_end
|
||
if ( clipped ) discard;
|
||
#endif
|
||
#endif`,CO=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
||
#endif`,PO=`#if NUM_CLIPPING_PLANES > 0
|
||
varying vec3 vClipPosition;
|
||
#endif`,RO=`#if NUM_CLIPPING_PLANES > 0
|
||
vClipPosition = - mvPosition.xyz;
|
||
#endif`,LO=`#if defined( USE_COLOR_ALPHA )
|
||
diffuseColor *= vColor;
|
||
#elif defined( USE_COLOR )
|
||
diffuseColor.rgb *= vColor;
|
||
#endif`,DO=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,IO=`#if defined( USE_COLOR_ALPHA )
|
||
varying vec4 vColor;
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
||
varying vec3 vColor;
|
||
#endif`,OO=`#if defined( USE_COLOR_ALPHA )
|
||
vColor = vec4( 1.0 );
|
||
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
|
||
vColor = vec3( 1.0 );
|
||
#endif
|
||
#ifdef USE_COLOR
|
||
vColor *= color;
|
||
#endif
|
||
#ifdef USE_INSTANCING_COLOR
|
||
vColor.xyz *= instanceColor.xyz;
|
||
#endif`,kO=`#define PI 3.141592653589793
|
||
#define PI2 6.283185307179586
|
||
#define PI_HALF 1.5707963267948966
|
||
#define RECIPROCAL_PI 0.3183098861837907
|
||
#define RECIPROCAL_PI2 0.15915494309189535
|
||
#define EPSILON 1e-6
|
||
#ifndef saturate
|
||
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
||
#endif
|
||
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
||
float pow2( const in float x ) { return x*x; }
|
||
float pow3( const in float x ) { return x*x*x; }
|
||
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
||
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
||
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
|
||
highp float rand( const in vec2 uv ) {
|
||
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
||
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
||
return fract( sin( sn ) * c );
|
||
}
|
||
#ifdef HIGH_PRECISION
|
||
float precisionSafeLength( vec3 v ) { return length( v ); }
|
||
#else
|
||
float precisionSafeLength( vec3 v ) {
|
||
float maxComponent = max3( abs( v ) );
|
||
return length( v / maxComponent ) * maxComponent;
|
||
}
|
||
#endif
|
||
struct IncidentLight {
|
||
vec3 color;
|
||
vec3 direction;
|
||
bool visible;
|
||
};
|
||
struct ReflectedLight {
|
||
vec3 directDiffuse;
|
||
vec3 directSpecular;
|
||
vec3 indirectDiffuse;
|
||
vec3 indirectSpecular;
|
||
};
|
||
struct GeometricContext {
|
||
vec3 position;
|
||
vec3 normal;
|
||
vec3 viewDir;
|
||
#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal;
|
||
#endif
|
||
};
|
||
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
||
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
||
}
|
||
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
|
||
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
|
||
}
|
||
mat3 transposeMat3( const in mat3 m ) {
|
||
mat3 tmp;
|
||
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
|
||
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
|
||
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
|
||
return tmp;
|
||
}
|
||
float linearToRelativeLuminance( const in vec3 color ) {
|
||
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
|
||
return dot( weights, color.rgb );
|
||
}
|
||
bool isPerspectiveMatrix( mat4 m ) {
|
||
return m[ 2 ][ 3 ] == - 1.0;
|
||
}
|
||
vec2 equirectUv( in vec3 dir ) {
|
||
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
||
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
||
return vec2( u, v );
|
||
}`,NO=`#ifdef ENVMAP_TYPE_CUBE_UV
|
||
#define cubeUV_minMipLevel 4.0
|
||
#define cubeUV_minTileSize 16.0
|
||
float getFace( vec3 direction ) {
|
||
vec3 absDirection = abs( direction );
|
||
float face = - 1.0;
|
||
if ( absDirection.x > absDirection.z ) {
|
||
if ( absDirection.x > absDirection.y )
|
||
face = direction.x > 0.0 ? 0.0 : 3.0;
|
||
else
|
||
face = direction.y > 0.0 ? 1.0 : 4.0;
|
||
} else {
|
||
if ( absDirection.z > absDirection.y )
|
||
face = direction.z > 0.0 ? 2.0 : 5.0;
|
||
else
|
||
face = direction.y > 0.0 ? 1.0 : 4.0;
|
||
}
|
||
return face;
|
||
}
|
||
vec2 getUV( vec3 direction, float face ) {
|
||
vec2 uv;
|
||
if ( face == 0.0 ) {
|
||
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
||
} else if ( face == 1.0 ) {
|
||
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
||
} else if ( face == 2.0 ) {
|
||
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
||
} else if ( face == 3.0 ) {
|
||
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
||
} else if ( face == 4.0 ) {
|
||
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
||
} else {
|
||
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
||
}
|
||
return 0.5 * ( uv + 1.0 );
|
||
}
|
||
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
||
float face = getFace( direction );
|
||
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
||
mipInt = max( mipInt, cubeUV_minMipLevel );
|
||
float faceSize = exp2( mipInt );
|
||
vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
||
if ( face > 2.0 ) {
|
||
uv.y += faceSize;
|
||
face -= 3.0;
|
||
}
|
||
uv.x += face * faceSize;
|
||
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
||
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
||
uv.x *= CUBEUV_TEXEL_WIDTH;
|
||
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
||
#ifdef texture2DGradEXT
|
||
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
||
#else
|
||
return texture2D( envMap, uv ).rgb;
|
||
#endif
|
||
}
|
||
#define r0 1.0
|
||
#define v0 0.339
|
||
#define m0 - 2.0
|
||
#define r1 0.8
|
||
#define v1 0.276
|
||
#define m1 - 1.0
|
||
#define r4 0.4
|
||
#define v4 0.046
|
||
#define m4 2.0
|
||
#define r5 0.305
|
||
#define v5 0.016
|
||
#define m5 3.0
|
||
#define r6 0.21
|
||
#define v6 0.0038
|
||
#define m6 4.0
|
||
float roughnessToMip( float roughness ) {
|
||
float mip = 0.0;
|
||
if ( roughness >= r1 ) {
|
||
mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
|
||
} else if ( roughness >= r4 ) {
|
||
mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
|
||
} else if ( roughness >= r5 ) {
|
||
mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
|
||
} else if ( roughness >= r6 ) {
|
||
mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
|
||
} else {
|
||
mip = - 2.0 * log2( 1.16 * roughness ); }
|
||
return mip;
|
||
}
|
||
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
||
float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );
|
||
float mipF = fract( mip );
|
||
float mipInt = floor( mip );
|
||
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
||
if ( mipF == 0.0 ) {
|
||
return vec4( color0, 1.0 );
|
||
} else {
|
||
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
||
return vec4( mix( color0, color1, mipF ), 1.0 );
|
||
}
|
||
}
|
||
#endif`,BO=`vec3 transformedNormal = objectNormal;
|
||
#ifdef USE_INSTANCING
|
||
mat3 m = mat3( instanceMatrix );
|
||
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
||
transformedNormal = m * transformedNormal;
|
||
#endif
|
||
transformedNormal = normalMatrix * transformedNormal;
|
||
#ifdef FLIP_SIDED
|
||
transformedNormal = - transformedNormal;
|
||
#endif
|
||
#ifdef USE_TANGENT
|
||
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
||
#ifdef FLIP_SIDED
|
||
transformedTangent = - transformedTangent;
|
||
#endif
|
||
#endif`,zO=`#ifdef USE_DISPLACEMENTMAP
|
||
uniform sampler2D displacementMap;
|
||
uniform float displacementScale;
|
||
uniform float displacementBias;
|
||
#endif`,UO=`#ifdef USE_DISPLACEMENTMAP
|
||
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
|
||
#endif`,FO=`#ifdef USE_EMISSIVEMAP
|
||
vec4 emissiveColor = texture2D( emissiveMap, vUv );
|
||
totalEmissiveRadiance *= emissiveColor.rgb;
|
||
#endif`,VO=`#ifdef USE_EMISSIVEMAP
|
||
uniform sampler2D emissiveMap;
|
||
#endif`,HO="gl_FragColor = linearToOutputTexel( gl_FragColor );",GO=`vec4 LinearToLinear( in vec4 value ) {
|
||
return value;
|
||
}
|
||
vec4 LinearTosRGB( in vec4 value ) {
|
||
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
||
}`,WO=`#ifdef USE_ENVMAP
|
||
#ifdef ENV_WORLDPOS
|
||
vec3 cameraToFrag;
|
||
if ( isOrthographic ) {
|
||
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
||
} else {
|
||
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
||
}
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
#ifdef ENVMAP_MODE_REFLECTION
|
||
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
||
#else
|
||
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
||
#endif
|
||
#else
|
||
vec3 reflectVec = vReflect;
|
||
#endif
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
|
||
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
||
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
|
||
#else
|
||
vec4 envColor = vec4( 0.0 );
|
||
#endif
|
||
#ifdef ENVMAP_BLENDING_MULTIPLY
|
||
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
||
#elif defined( ENVMAP_BLENDING_MIX )
|
||
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
||
#elif defined( ENVMAP_BLENDING_ADD )
|
||
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
||
#endif
|
||
#endif`,jO=`#ifdef USE_ENVMAP
|
||
uniform float envMapIntensity;
|
||
uniform float flipEnvMap;
|
||
#ifdef ENVMAP_TYPE_CUBE
|
||
uniform samplerCube envMap;
|
||
#else
|
||
uniform sampler2D envMap;
|
||
#endif
|
||
|
||
#endif`,XO=`#ifdef USE_ENVMAP
|
||
uniform float reflectivity;
|
||
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
|
||
#define ENV_WORLDPOS
|
||
#endif
|
||
#ifdef ENV_WORLDPOS
|
||
varying vec3 vWorldPosition;
|
||
uniform float refractionRatio;
|
||
#else
|
||
varying vec3 vReflect;
|
||
#endif
|
||
#endif`,qO=`#ifdef USE_ENVMAP
|
||
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
|
||
#define ENV_WORLDPOS
|
||
#endif
|
||
#ifdef ENV_WORLDPOS
|
||
|
||
varying vec3 vWorldPosition;
|
||
#else
|
||
varying vec3 vReflect;
|
||
uniform float refractionRatio;
|
||
#endif
|
||
#endif`,YO=`#ifdef USE_ENVMAP
|
||
#ifdef ENV_WORLDPOS
|
||
vWorldPosition = worldPosition.xyz;
|
||
#else
|
||
vec3 cameraToVertex;
|
||
if ( isOrthographic ) {
|
||
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
||
} else {
|
||
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
||
}
|
||
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
#ifdef ENVMAP_MODE_REFLECTION
|
||
vReflect = reflect( cameraToVertex, worldNormal );
|
||
#else
|
||
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
||
#endif
|
||
#endif
|
||
#endif`,ZO=`#ifdef USE_FOG
|
||
vFogDepth = - mvPosition.z;
|
||
#endif`,KO=`#ifdef USE_FOG
|
||
varying float vFogDepth;
|
||
#endif`,JO=`#ifdef USE_FOG
|
||
#ifdef FOG_EXP2
|
||
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
||
#else
|
||
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
||
#endif
|
||
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
||
#endif`,QO=`#ifdef USE_FOG
|
||
uniform vec3 fogColor;
|
||
varying float vFogDepth;
|
||
#ifdef FOG_EXP2
|
||
uniform float fogDensity;
|
||
#else
|
||
uniform float fogNear;
|
||
uniform float fogFar;
|
||
#endif
|
||
#endif`,$O=`#ifdef USE_GRADIENTMAP
|
||
uniform sampler2D gradientMap;
|
||
#endif
|
||
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
||
float dotNL = dot( normal, lightDirection );
|
||
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
||
#ifdef USE_GRADIENTMAP
|
||
return vec3( texture2D( gradientMap, coord ).r );
|
||
#else
|
||
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
|
||
#endif
|
||
}`,e5=`#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
||
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
||
reflectedLight.indirectDiffuse += lightMapIrradiance;
|
||
#endif`,t5=`#ifdef USE_LIGHTMAP
|
||
uniform sampler2D lightMap;
|
||
uniform float lightMapIntensity;
|
||
#endif`,n5=`vec3 diffuse = vec3( 1.0 );
|
||
GeometricContext geometry;
|
||
geometry.position = mvPosition.xyz;
|
||
geometry.normal = normalize( transformedNormal );
|
||
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
|
||
GeometricContext backGeometry;
|
||
backGeometry.position = geometry.position;
|
||
backGeometry.normal = -geometry.normal;
|
||
backGeometry.viewDir = geometry.viewDir;
|
||
vLightFront = vec3( 0.0 );
|
||
vIndirectFront = vec3( 0.0 );
|
||
#ifdef DOUBLE_SIDED
|
||
vLightBack = vec3( 0.0 );
|
||
vIndirectBack = vec3( 0.0 );
|
||
#endif
|
||
IncidentLight directLight;
|
||
float dotNL;
|
||
vec3 directLightColor_Diffuse;
|
||
vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
|
||
vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
|
||
#ifdef DOUBLE_SIDED
|
||
vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
|
||
vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
|
||
#endif
|
||
#if NUM_POINT_LIGHTS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
||
getPointLightInfo( pointLights[ i ], geometry, directLight );
|
||
dotNL = dot( geometry.normal, directLight.direction );
|
||
directLightColor_Diffuse = directLight.color;
|
||
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
||
#ifdef DOUBLE_SIDED
|
||
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
||
#endif
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_SPOT_LIGHTS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
||
getSpotLightInfo( spotLights[ i ], geometry, directLight );
|
||
dotNL = dot( geometry.normal, directLight.direction );
|
||
directLightColor_Diffuse = directLight.color;
|
||
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
||
#ifdef DOUBLE_SIDED
|
||
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
||
#endif
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_DIR_LIGHTS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
||
getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
|
||
dotNL = dot( geometry.normal, directLight.direction );
|
||
directLightColor_Diffuse = directLight.color;
|
||
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
|
||
#ifdef DOUBLE_SIDED
|
||
vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
|
||
#endif
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_HEMI_LIGHTS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
||
#ifdef DOUBLE_SIDED
|
||
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
|
||
#endif
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif`,i5=`uniform bool receiveShadow;
|
||
uniform vec3 ambientLightColor;
|
||
uniform vec3 lightProbe[ 9 ];
|
||
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
||
float x = normal.x, y = normal.y, z = normal.z;
|
||
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
||
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
||
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
||
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
||
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
||
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
||
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
||
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
||
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
||
return result;
|
||
}
|
||
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
||
return irradiance;
|
||
}
|
||
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
||
vec3 irradiance = ambientLightColor;
|
||
return irradiance;
|
||
}
|
||
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
||
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
|
||
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
||
if ( cutoffDistance > 0.0 ) {
|
||
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
||
}
|
||
return distanceFalloff;
|
||
#else
|
||
if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
|
||
return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
|
||
}
|
||
return 1.0;
|
||
#endif
|
||
}
|
||
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
||
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
||
}
|
||
#if NUM_DIR_LIGHTS > 0
|
||
struct DirectionalLight {
|
||
vec3 direction;
|
||
vec3 color;
|
||
};
|
||
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
||
void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
|
||
light.color = directionalLight.color;
|
||
light.direction = directionalLight.direction;
|
||
light.visible = true;
|
||
}
|
||
#endif
|
||
#if NUM_POINT_LIGHTS > 0
|
||
struct PointLight {
|
||
vec3 position;
|
||
vec3 color;
|
||
float distance;
|
||
float decay;
|
||
};
|
||
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
||
void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
|
||
vec3 lVector = pointLight.position - geometry.position;
|
||
light.direction = normalize( lVector );
|
||
float lightDistance = length( lVector );
|
||
light.color = pointLight.color;
|
||
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
||
light.visible = ( light.color != vec3( 0.0 ) );
|
||
}
|
||
#endif
|
||
#if NUM_SPOT_LIGHTS > 0
|
||
struct SpotLight {
|
||
vec3 position;
|
||
vec3 direction;
|
||
vec3 color;
|
||
float distance;
|
||
float decay;
|
||
float coneCos;
|
||
float penumbraCos;
|
||
};
|
||
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
||
void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
|
||
vec3 lVector = spotLight.position - geometry.position;
|
||
light.direction = normalize( lVector );
|
||
float angleCos = dot( light.direction, spotLight.direction );
|
||
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
||
if ( spotAttenuation > 0.0 ) {
|
||
float lightDistance = length( lVector );
|
||
light.color = spotLight.color * spotAttenuation;
|
||
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
||
light.visible = ( light.color != vec3( 0.0 ) );
|
||
} else {
|
||
light.color = vec3( 0.0 );
|
||
light.visible = false;
|
||
}
|
||
}
|
||
#endif
|
||
#if NUM_RECT_AREA_LIGHTS > 0
|
||
struct RectAreaLight {
|
||
vec3 color;
|
||
vec3 position;
|
||
vec3 halfWidth;
|
||
vec3 halfHeight;
|
||
};
|
||
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
||
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
||
#endif
|
||
#if NUM_HEMI_LIGHTS > 0
|
||
struct HemisphereLight {
|
||
vec3 direction;
|
||
vec3 skyColor;
|
||
vec3 groundColor;
|
||
};
|
||
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
||
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
||
float dotNL = dot( normal, hemiLight.direction );
|
||
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
||
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
||
return irradiance;
|
||
}
|
||
#endif`,r5=`#if defined( USE_ENVMAP )
|
||
vec3 getIBLIrradiance( const in vec3 normal ) {
|
||
#if defined( ENVMAP_TYPE_CUBE_UV )
|
||
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
|
||
return PI * envMapColor.rgb * envMapIntensity;
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
||
#if defined( ENVMAP_TYPE_CUBE_UV )
|
||
vec3 reflectVec = reflect( - viewDir, normal );
|
||
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
|
||
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
|
||
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
|
||
return envMapColor.rgb * envMapIntensity;
|
||
#else
|
||
return vec3( 0.0 );
|
||
#endif
|
||
}
|
||
#endif`,s5=`ToonMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;`,o5=`varying vec3 vViewPosition;
|
||
struct ToonMaterial {
|
||
vec3 diffuseColor;
|
||
};
|
||
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_Toon
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
||
#define Material_LightProbeLOD( material ) (0)`,a5=`BlinnPhongMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb;
|
||
material.specularColor = specular;
|
||
material.specularShininess = shininess;
|
||
material.specularStrength = specularStrength;`,l5=`varying vec3 vViewPosition;
|
||
struct BlinnPhongMaterial {
|
||
vec3 diffuseColor;
|
||
vec3 specularColor;
|
||
float specularShininess;
|
||
float specularStrength;
|
||
};
|
||
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
||
}
|
||
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
#define RE_Direct RE_Direct_BlinnPhong
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
|
||
#define Material_LightProbeLOD( material ) (0)`,c5=`PhysicalMaterial material;
|
||
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
||
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
|
||
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
||
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
||
material.roughness = min( material.roughness, 1.0 );
|
||
#ifdef IOR
|
||
#ifdef SPECULAR
|
||
float specularIntensityFactor = specularIntensity;
|
||
vec3 specularColorFactor = specularColor;
|
||
#ifdef USE_SPECULARINTENSITYMAP
|
||
specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
|
||
#endif
|
||
#ifdef USE_SPECULARCOLORMAP
|
||
specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
|
||
#endif
|
||
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
||
#else
|
||
float specularIntensityFactor = 1.0;
|
||
vec3 specularColorFactor = vec3( 1.0 );
|
||
material.specularF90 = 1.0;
|
||
#endif
|
||
material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
|
||
#else
|
||
material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
|
||
material.specularF90 = 1.0;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
material.clearcoat = clearcoat;
|
||
material.clearcoatRoughness = clearcoatRoughness;
|
||
material.clearcoatF0 = vec3( 0.04 );
|
||
material.clearcoatF90 = 1.0;
|
||
#ifdef USE_CLEARCOATMAP
|
||
material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
|
||
#endif
|
||
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
||
material.clearcoatRoughness += geometryRoughness;
|
||
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
material.sheenColor = sheenColor;
|
||
#ifdef USE_SHEENCOLORMAP
|
||
material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
|
||
#endif
|
||
material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
|
||
#ifdef USE_SHEENROUGHNESSMAP
|
||
material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
|
||
#endif
|
||
#endif`,u5=`struct PhysicalMaterial {
|
||
vec3 diffuseColor;
|
||
float roughness;
|
||
vec3 specularColor;
|
||
float specularF90;
|
||
#ifdef USE_CLEARCOAT
|
||
float clearcoat;
|
||
float clearcoatRoughness;
|
||
vec3 clearcoatF0;
|
||
float clearcoatF90;
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
vec3 sheenColor;
|
||
float sheenRoughness;
|
||
#endif
|
||
};
|
||
vec3 clearcoatSpecular = vec3( 0.0 );
|
||
vec3 sheenSpecular = vec3( 0.0 );
|
||
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
float r2 = roughness * roughness;
|
||
float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
|
||
float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
|
||
float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
|
||
return saturate( DG * RECIPROCAL_PI );
|
||
}
|
||
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
||
float dotNV = saturate( dot( normal, viewDir ) );
|
||
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
|
||
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
|
||
vec4 r = roughness * c0 + c1;
|
||
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
|
||
vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
|
||
return fab;
|
||
}
|
||
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
||
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
||
return specularColor * fab.x + specularF90 * fab.y;
|
||
}
|
||
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
||
vec2 fab = DFGApprox( normal, viewDir, roughness );
|
||
vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;
|
||
float Ess = fab.x + fab.y;
|
||
float Ems = 1.0 - Ess;
|
||
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
||
singleScatter += FssEss;
|
||
multiScatter += Fms * Ems;
|
||
}
|
||
#if NUM_RECT_AREA_LIGHTS > 0
|
||
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
vec3 normal = geometry.normal;
|
||
vec3 viewDir = geometry.viewDir;
|
||
vec3 position = geometry.position;
|
||
vec3 lightPos = rectAreaLight.position;
|
||
vec3 halfWidth = rectAreaLight.halfWidth;
|
||
vec3 halfHeight = rectAreaLight.halfHeight;
|
||
vec3 lightColor = rectAreaLight.color;
|
||
float roughness = material.roughness;
|
||
vec3 rectCoords[ 4 ];
|
||
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
||
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
||
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
||
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
||
vec4 t1 = texture2D( ltc_1, uv );
|
||
vec4 t2 = texture2D( ltc_2, uv );
|
||
mat3 mInv = mat3(
|
||
vec3( t1.x, 0, t1.y ),
|
||
vec3( 0, 1, 0 ),
|
||
vec3( t1.z, 0, t1.w )
|
||
);
|
||
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
|
||
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
||
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
||
}
|
||
#endif
|
||
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
|
||
vec3 irradiance = dotNL * directLight.color;
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
|
||
vec3 ccIrradiance = dotNLcc * directLight.color;
|
||
clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
|
||
#endif
|
||
reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
|
||
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
||
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
||
}
|
||
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
|
||
#endif
|
||
vec3 singleScattering = vec3( 0.0 );
|
||
vec3 multiScattering = vec3( 0.0 );
|
||
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
||
computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
|
||
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
|
||
reflectedLight.indirectSpecular += radiance * singleScattering;
|
||
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
||
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
|
||
}
|
||
#define RE_Direct RE_Direct_Physical
|
||
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
||
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
||
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
||
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
||
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
||
}`,h5=`
|
||
GeometricContext geometry;
|
||
geometry.position = - vViewPosition;
|
||
geometry.normal = normal;
|
||
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
||
#ifdef USE_CLEARCOAT
|
||
geometry.clearcoatNormal = clearcoatNormal;
|
||
#endif
|
||
IncidentLight directLight;
|
||
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
PointLight pointLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
||
PointLightShadow pointLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
||
pointLight = pointLights[ i ];
|
||
getPointLightInfo( pointLight, geometry, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
|
||
pointLightShadow = pointLightShadows[ i ];
|
||
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometry, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
||
SpotLight spotLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
||
spotLight = spotLights[ i ];
|
||
getSpotLightInfo( spotLight, geometry, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
||
spotLightShadow = spotLightShadows[ i ];
|
||
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometry, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
||
DirectionalLight directionalLight;
|
||
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLightShadow;
|
||
#endif
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
||
directionalLight = directionalLights[ i ];
|
||
getDirectionalLightInfo( directionalLight, geometry, directLight );
|
||
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
||
directionalLightShadow = directionalLightShadows[ i ];
|
||
directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
#endif
|
||
RE_Direct( directLight, geometry, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
||
RectAreaLight rectAreaLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
||
rectAreaLight = rectAreaLights[ i ];
|
||
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if defined( RE_IndirectDiffuse )
|
||
vec3 iblIrradiance = vec3( 0.0 );
|
||
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
||
irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
|
||
#if ( NUM_HEMI_LIGHTS > 0 )
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
||
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
vec3 radiance = vec3( 0.0 );
|
||
vec3 clearcoatRadiance = vec3( 0.0 );
|
||
#endif`,d5=`#if defined( RE_IndirectDiffuse )
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
||
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
||
irradiance += lightMapIrradiance;
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
|
||
iblIrradiance += getIBLIrradiance( geometry.normal );
|
||
#endif
|
||
#endif
|
||
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
||
radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
|
||
#ifdef USE_CLEARCOAT
|
||
clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
|
||
#endif
|
||
#endif`,p5=`#if defined( RE_IndirectDiffuse )
|
||
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
|
||
#endif
|
||
#if defined( RE_IndirectSpecular )
|
||
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
|
||
#endif`,f5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
||
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
||
#endif`,m5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
|
||
uniform float logDepthBufFC;
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#endif`,v5=`#ifdef USE_LOGDEPTHBUF
|
||
#ifdef USE_LOGDEPTHBUF_EXT
|
||
varying float vFragDepth;
|
||
varying float vIsPerspective;
|
||
#else
|
||
uniform float logDepthBufFC;
|
||
#endif
|
||
#endif`,g5=`#ifdef USE_LOGDEPTHBUF
|
||
#ifdef USE_LOGDEPTHBUF_EXT
|
||
vFragDepth = 1.0 + gl_Position.w;
|
||
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
||
#else
|
||
if ( isPerspectiveMatrix( projectionMatrix ) ) {
|
||
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
|
||
gl_Position.z *= gl_Position.w;
|
||
}
|
||
#endif
|
||
#endif`,y5=`#ifdef USE_MAP
|
||
vec4 sampledDiffuseColor = texture2D( map, vUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
|
||
#endif
|
||
diffuseColor *= sampledDiffuseColor;
|
||
#endif`,_5=`#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif`,x5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
||
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
diffuseColor *= texture2D( map, uv );
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
||
#endif`,b5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
||
uniform mat3 uvTransform;
|
||
#endif
|
||
#ifdef USE_MAP
|
||
uniform sampler2D map;
|
||
#endif
|
||
#ifdef USE_ALPHAMAP
|
||
uniform sampler2D alphaMap;
|
||
#endif`,w5=`float metalnessFactor = metalness;
|
||
#ifdef USE_METALNESSMAP
|
||
vec4 texelMetalness = texture2D( metalnessMap, vUv );
|
||
metalnessFactor *= texelMetalness.b;
|
||
#endif`,S5=`#ifdef USE_METALNESSMAP
|
||
uniform sampler2D metalnessMap;
|
||
#endif`,M5=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
|
||
vColor *= morphTargetBaseInfluence;
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
#if defined( USE_COLOR_ALPHA )
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
||
#elif defined( USE_COLOR )
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
||
#endif
|
||
}
|
||
#endif`,E5=`#ifdef USE_MORPHNORMALS
|
||
objectNormal *= morphTargetBaseInfluence;
|
||
#ifdef MORPHTARGETS_TEXTURE
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#else
|
||
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
|
||
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
|
||
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
|
||
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
|
||
#endif
|
||
#endif`,T5=`#ifdef USE_MORPHTARGETS
|
||
uniform float morphTargetBaseInfluence;
|
||
#ifdef MORPHTARGETS_TEXTURE
|
||
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
||
uniform sampler2DArray morphTargetsTexture;
|
||
uniform ivec2 morphTargetsTextureSize;
|
||
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
||
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
||
int y = texelIndex / morphTargetsTextureSize.x;
|
||
int x = texelIndex - y * morphTargetsTextureSize.x;
|
||
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
||
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
||
}
|
||
#else
|
||
#ifndef USE_MORPHNORMALS
|
||
uniform float morphTargetInfluences[ 8 ];
|
||
#else
|
||
uniform float morphTargetInfluences[ 4 ];
|
||
#endif
|
||
#endif
|
||
#endif`,A5=`#ifdef USE_MORPHTARGETS
|
||
transformed *= morphTargetBaseInfluence;
|
||
#ifdef MORPHTARGETS_TEXTURE
|
||
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
||
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
||
}
|
||
#else
|
||
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
|
||
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
|
||
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
|
||
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
|
||
#ifndef USE_MORPHNORMALS
|
||
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
|
||
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
|
||
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
|
||
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
|
||
#endif
|
||
#endif
|
||
#endif`,C5=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
||
#ifdef FLAT_SHADED
|
||
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
|
||
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
|
||
vec3 normal = normalize( cross( fdx, fdy ) );
|
||
#else
|
||
vec3 normal = normalize( vNormal );
|
||
#ifdef DOUBLE_SIDED
|
||
normal = normal * faceDirection;
|
||
#endif
|
||
#ifdef USE_TANGENT
|
||
vec3 tangent = normalize( vTangent );
|
||
vec3 bitangent = normalize( vBitangent );
|
||
#ifdef DOUBLE_SIDED
|
||
tangent = tangent * faceDirection;
|
||
bitangent = bitangent * faceDirection;
|
||
#endif
|
||
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
|
||
mat3 vTBN = mat3( tangent, bitangent, normal );
|
||
#endif
|
||
#endif
|
||
#endif
|
||
vec3 geometryNormal = normal;`,P5=`#ifdef OBJECTSPACE_NORMALMAP
|
||
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
||
#ifdef FLIP_SIDED
|
||
normal = - normal;
|
||
#endif
|
||
#ifdef DOUBLE_SIDED
|
||
normal = normal * faceDirection;
|
||
#endif
|
||
normal = normalize( normalMatrix * normal );
|
||
#elif defined( TANGENTSPACE_NORMALMAP )
|
||
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
|
||
mapN.xy *= normalScale;
|
||
#ifdef USE_TANGENT
|
||
normal = normalize( vTBN * mapN );
|
||
#else
|
||
normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
|
||
#endif
|
||
#elif defined( USE_BUMPMAP )
|
||
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
||
#endif`,R5=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,L5=`#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#ifdef USE_TANGENT
|
||
varying vec3 vTangent;
|
||
varying vec3 vBitangent;
|
||
#endif
|
||
#endif`,D5=`#ifndef FLAT_SHADED
|
||
vNormal = normalize( transformedNormal );
|
||
#ifdef USE_TANGENT
|
||
vTangent = normalize( transformedTangent );
|
||
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
||
#endif
|
||
#endif`,I5=`#ifdef USE_NORMALMAP
|
||
uniform sampler2D normalMap;
|
||
uniform vec2 normalScale;
|
||
#endif
|
||
#ifdef OBJECTSPACE_NORMALMAP
|
||
uniform mat3 normalMatrix;
|
||
#endif
|
||
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
|
||
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
|
||
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
|
||
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
|
||
vec2 st0 = dFdx( vUv.st );
|
||
vec2 st1 = dFdy( vUv.st );
|
||
vec3 N = surf_norm;
|
||
vec3 q1perp = cross( q1, N );
|
||
vec3 q0perp = cross( N, q0 );
|
||
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
||
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
||
float det = max( dot( T, T ), dot( B, B ) );
|
||
float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
|
||
return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
|
||
}
|
||
#endif`,O5=`#ifdef USE_CLEARCOAT
|
||
vec3 clearcoatNormal = geometryNormal;
|
||
#endif`,k5=`#ifdef USE_CLEARCOAT_NORMALMAP
|
||
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
|
||
clearcoatMapN.xy *= clearcoatNormalScale;
|
||
#ifdef USE_TANGENT
|
||
clearcoatNormal = normalize( vTBN * clearcoatMapN );
|
||
#else
|
||
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
|
||
#endif
|
||
#endif`,N5=`#ifdef USE_CLEARCOATMAP
|
||
uniform sampler2D clearcoatMap;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
||
uniform sampler2D clearcoatRoughnessMap;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT_NORMALMAP
|
||
uniform sampler2D clearcoatNormalMap;
|
||
uniform vec2 clearcoatNormalScale;
|
||
#endif`,B5=`#ifdef OPAQUE
|
||
diffuseColor.a = 1.0;
|
||
#endif
|
||
#ifdef USE_TRANSMISSION
|
||
diffuseColor.a *= transmissionAlpha + 0.1;
|
||
#endif
|
||
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,z5=`vec3 packNormalToRGB( const in vec3 normal ) {
|
||
return normalize( normal ) * 0.5 + 0.5;
|
||
}
|
||
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
||
return 2.0 * rgb.xyz - 1.0;
|
||
}
|
||
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
|
||
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
|
||
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
|
||
const float ShiftRight8 = 1. / 256.;
|
||
vec4 packDepthToRGBA( const in float v ) {
|
||
vec4 r = vec4( fract( v * PackFactors ), v );
|
||
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
|
||
}
|
||
float unpackRGBAToDepth( const in vec4 v ) {
|
||
return dot( v, UnpackFactors );
|
||
}
|
||
vec4 pack2HalfToRGBA( vec2 v ) {
|
||
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
||
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
||
}
|
||
vec2 unpackRGBATo2Half( vec4 v ) {
|
||
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
||
}
|
||
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
||
return ( viewZ + near ) / ( near - far );
|
||
}
|
||
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
|
||
return linearClipZ * ( near - far ) - near;
|
||
}
|
||
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
||
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
||
}
|
||
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
|
||
return ( near * far ) / ( ( far - near ) * invClipZ - far );
|
||
}`,U5=`#ifdef PREMULTIPLIED_ALPHA
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
#endif`,F5=`vec4 mvPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_INSTANCING
|
||
mvPosition = instanceMatrix * mvPosition;
|
||
#endif
|
||
mvPosition = modelViewMatrix * mvPosition;
|
||
gl_Position = projectionMatrix * mvPosition;`,V5=`#ifdef DITHERING
|
||
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
||
#endif`,H5=`#ifdef DITHERING
|
||
vec3 dithering( vec3 color ) {
|
||
float grid_position = rand( gl_FragCoord.xy );
|
||
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
||
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
||
return color + dither_shift_RGB;
|
||
}
|
||
#endif`,G5=`float roughnessFactor = roughness;
|
||
#ifdef USE_ROUGHNESSMAP
|
||
vec4 texelRoughness = texture2D( roughnessMap, vUv );
|
||
roughnessFactor *= texelRoughness.g;
|
||
#endif`,W5=`#ifdef USE_ROUGHNESSMAP
|
||
uniform sampler2D roughnessMap;
|
||
#endif`,j5=`#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
||
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
||
struct DirectionalLightShadow {
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
struct SpotLightShadow {
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
||
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
||
struct PointLightShadow {
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
|
||
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
|
||
}
|
||
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
|
||
return unpackRGBATo2Half( texture2D( shadow, uv ) );
|
||
}
|
||
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
|
||
float occlusion = 1.0;
|
||
vec2 distribution = texture2DDistribution( shadow, uv );
|
||
float hard_shadow = step( compare , distribution.x );
|
||
if (hard_shadow != 1.0 ) {
|
||
float distance = compare - distribution.x ;
|
||
float variance = max( 0.00000, distribution.y * distribution.y );
|
||
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
|
||
}
|
||
return occlusion;
|
||
}
|
||
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
||
float shadow = 1.0;
|
||
shadowCoord.xyz /= shadowCoord.w;
|
||
shadowCoord.z += shadowBias;
|
||
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
|
||
bool inFrustum = all( inFrustumVec );
|
||
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
|
||
bool frustumTest = all( frustumTestVec );
|
||
if ( frustumTest ) {
|
||
#if defined( SHADOWMAP_TYPE_PCF )
|
||
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
||
float dx0 = - texelSize.x * shadowRadius;
|
||
float dy0 = - texelSize.y * shadowRadius;
|
||
float dx1 = + texelSize.x * shadowRadius;
|
||
float dy1 = + texelSize.y * shadowRadius;
|
||
float dx2 = dx0 / 2.0;
|
||
float dy2 = dy0 / 2.0;
|
||
float dx3 = dx1 / 2.0;
|
||
float dy3 = dy1 / 2.0;
|
||
shadow = (
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
|
||
) * ( 1.0 / 17.0 );
|
||
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
|
||
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
||
float dx = texelSize.x;
|
||
float dy = texelSize.y;
|
||
vec2 uv = shadowCoord.xy;
|
||
vec2 f = fract( uv * shadowMapSize + 0.5 );
|
||
uv -= f * texelSize;
|
||
shadow = (
|
||
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
|
||
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
|
||
f.x ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
|
||
f.x ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
|
||
f.y ) +
|
||
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
|
||
f.y ) +
|
||
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
|
||
f.x ),
|
||
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
|
||
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
|
||
f.x ),
|
||
f.y )
|
||
) * ( 1.0 / 9.0 );
|
||
#elif defined( SHADOWMAP_TYPE_VSM )
|
||
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
|
||
#else
|
||
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
|
||
#endif
|
||
}
|
||
return shadow;
|
||
}
|
||
vec2 cubeToUV( vec3 v, float texelSizeY ) {
|
||
vec3 absV = abs( v );
|
||
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
|
||
absV *= scaleToCube;
|
||
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
|
||
vec2 planar = v.xy;
|
||
float almostATexel = 1.5 * texelSizeY;
|
||
float almostOne = 1.0 - almostATexel;
|
||
if ( absV.z >= almostOne ) {
|
||
if ( v.z > 0.0 )
|
||
planar.x = 4.0 - v.x;
|
||
} else if ( absV.x >= almostOne ) {
|
||
float signX = sign( v.x );
|
||
planar.x = v.z * signX + 2.0 * signX;
|
||
} else if ( absV.y >= almostOne ) {
|
||
float signY = sign( v.y );
|
||
planar.x = v.x + 2.0 * signY + 2.0;
|
||
planar.y = v.z * signY - 2.0;
|
||
}
|
||
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
|
||
}
|
||
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
||
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
|
||
vec3 lightToPosition = shadowCoord.xyz;
|
||
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
|
||
vec3 bd3D = normalize( lightToPosition );
|
||
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
|
||
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
|
||
return (
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
|
||
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
|
||
) * ( 1.0 / 9.0 );
|
||
#else
|
||
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
|
||
#endif
|
||
}
|
||
#endif`,X5=`#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
||
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
||
struct DirectionalLightShadow {
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
struct SpotLightShadow {
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
};
|
||
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
||
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
||
struct PointLightShadow {
|
||
float shadowBias;
|
||
float shadowNormalBias;
|
||
float shadowRadius;
|
||
vec2 shadowMapSize;
|
||
float shadowCameraNear;
|
||
float shadowCameraFar;
|
||
};
|
||
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
||
#endif
|
||
#endif`,q5=`#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
|
||
vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
|
||
vec4 shadowWorldPosition;
|
||
#endif
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
||
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
|
||
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
||
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
||
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif`,Y5=`float getShadowMask() {
|
||
float shadow = 1.0;
|
||
#ifdef USE_SHADOWMAP
|
||
#if NUM_DIR_LIGHT_SHADOWS > 0
|
||
DirectionalLightShadow directionalLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
||
directionalLight = directionalLightShadows[ i ];
|
||
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
||
SpotLightShadow spotLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
||
spotLight = spotLightShadows[ i ];
|
||
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#if NUM_POINT_LIGHT_SHADOWS > 0
|
||
PointLightShadow pointLight;
|
||
#pragma unroll_loop_start
|
||
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
||
pointLight = pointLightShadows[ i ];
|
||
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
||
}
|
||
#pragma unroll_loop_end
|
||
#endif
|
||
#endif
|
||
return shadow;
|
||
}`,Z5=`#ifdef USE_SKINNING
|
||
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
||
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
||
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
||
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
||
#endif`,K5=`#ifdef USE_SKINNING
|
||
uniform mat4 bindMatrix;
|
||
uniform mat4 bindMatrixInverse;
|
||
uniform highp sampler2D boneTexture;
|
||
uniform int boneTextureSize;
|
||
mat4 getBoneMatrix( const in float i ) {
|
||
float j = i * 4.0;
|
||
float x = mod( j, float( boneTextureSize ) );
|
||
float y = floor( j / float( boneTextureSize ) );
|
||
float dx = 1.0 / float( boneTextureSize );
|
||
float dy = 1.0 / float( boneTextureSize );
|
||
y = dy * ( y + 0.5 );
|
||
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
|
||
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
|
||
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
|
||
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
|
||
mat4 bone = mat4( v1, v2, v3, v4 );
|
||
return bone;
|
||
}
|
||
#endif`,J5=`#ifdef USE_SKINNING
|
||
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
||
vec4 skinned = vec4( 0.0 );
|
||
skinned += boneMatX * skinVertex * skinWeight.x;
|
||
skinned += boneMatY * skinVertex * skinWeight.y;
|
||
skinned += boneMatZ * skinVertex * skinWeight.z;
|
||
skinned += boneMatW * skinVertex * skinWeight.w;
|
||
transformed = ( bindMatrixInverse * skinned ).xyz;
|
||
#endif`,Q5=`#ifdef USE_SKINNING
|
||
mat4 skinMatrix = mat4( 0.0 );
|
||
skinMatrix += skinWeight.x * boneMatX;
|
||
skinMatrix += skinWeight.y * boneMatY;
|
||
skinMatrix += skinWeight.z * boneMatZ;
|
||
skinMatrix += skinWeight.w * boneMatW;
|
||
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
||
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
||
#ifdef USE_TANGENT
|
||
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
||
#endif
|
||
#endif`,$5=`float specularStrength;
|
||
#ifdef USE_SPECULARMAP
|
||
vec4 texelSpecular = texture2D( specularMap, vUv );
|
||
specularStrength = texelSpecular.r;
|
||
#else
|
||
specularStrength = 1.0;
|
||
#endif`,ek=`#ifdef USE_SPECULARMAP
|
||
uniform sampler2D specularMap;
|
||
#endif`,tk=`#if defined( TONE_MAPPING )
|
||
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
||
#endif`,nk=`#ifndef saturate
|
||
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
||
#endif
|
||
uniform float toneMappingExposure;
|
||
vec3 LinearToneMapping( vec3 color ) {
|
||
return toneMappingExposure * color;
|
||
}
|
||
vec3 ReinhardToneMapping( vec3 color ) {
|
||
color *= toneMappingExposure;
|
||
return saturate( color / ( vec3( 1.0 ) + color ) );
|
||
}
|
||
vec3 OptimizedCineonToneMapping( vec3 color ) {
|
||
color *= toneMappingExposure;
|
||
color = max( vec3( 0.0 ), color - 0.004 );
|
||
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
||
}
|
||
vec3 RRTAndODTFit( vec3 v ) {
|
||
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
||
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
||
return a / b;
|
||
}
|
||
vec3 ACESFilmicToneMapping( vec3 color ) {
|
||
const mat3 ACESInputMat = mat3(
|
||
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
||
vec3( 0.04823, 0.01566, 0.83777 )
|
||
);
|
||
const mat3 ACESOutputMat = mat3(
|
||
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
||
vec3( -0.07367, -0.00605, 1.07602 )
|
||
);
|
||
color *= toneMappingExposure / 0.6;
|
||
color = ACESInputMat * color;
|
||
color = RRTAndODTFit( color );
|
||
color = ACESOutputMat * color;
|
||
return saturate( color );
|
||
}
|
||
vec3 CustomToneMapping( vec3 color ) { return color; }`,ik=`#ifdef USE_TRANSMISSION
|
||
float transmissionAlpha = 1.0;
|
||
float transmissionFactor = transmission;
|
||
float thicknessFactor = thickness;
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
transmissionFactor *= texture2D( transmissionMap, vUv ).r;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
thicknessFactor *= texture2D( thicknessMap, vUv ).g;
|
||
#endif
|
||
vec3 pos = vWorldPosition;
|
||
vec3 v = normalize( cameraPosition - pos );
|
||
vec3 n = inverseTransformDirection( normal, viewMatrix );
|
||
vec4 transmission = getIBLVolumeRefraction(
|
||
n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
|
||
pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
|
||
attenuationColor, attenuationDistance );
|
||
totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
|
||
transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
|
||
#endif`,rk=`#ifdef USE_TRANSMISSION
|
||
uniform float transmission;
|
||
uniform float thickness;
|
||
uniform float attenuationDistance;
|
||
uniform vec3 attenuationColor;
|
||
#ifdef USE_TRANSMISSIONMAP
|
||
uniform sampler2D transmissionMap;
|
||
#endif
|
||
#ifdef USE_THICKNESSMAP
|
||
uniform sampler2D thicknessMap;
|
||
#endif
|
||
uniform vec2 transmissionSamplerSize;
|
||
uniform sampler2D transmissionSamplerMap;
|
||
uniform mat4 modelMatrix;
|
||
uniform mat4 projectionMatrix;
|
||
varying vec3 vWorldPosition;
|
||
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
||
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
||
vec3 modelScale;
|
||
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
||
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
||
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
||
return normalize( refractionVector ) * thickness * modelScale;
|
||
}
|
||
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
||
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
||
}
|
||
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
||
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
||
#ifdef texture2DLodEXT
|
||
return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
||
#else
|
||
return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
|
||
#endif
|
||
}
|
||
vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
if ( attenuationDistance == 0.0 ) {
|
||
return radiance;
|
||
} else {
|
||
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
||
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
|
||
}
|
||
}
|
||
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
||
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
||
const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
|
||
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
||
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
||
vec3 refractedRayExit = position + transmissionRay;
|
||
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
||
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
||
refractionCoords += 1.0;
|
||
refractionCoords /= 2.0;
|
||
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
||
vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
|
||
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
||
return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
|
||
}
|
||
#endif`,sk=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
|
||
varying vec2 vUv;
|
||
#endif`,ok=`#ifdef USE_UV
|
||
#ifdef UVS_VERTEX_ONLY
|
||
vec2 vUv;
|
||
#else
|
||
varying vec2 vUv;
|
||
#endif
|
||
uniform mat3 uvTransform;
|
||
#endif`,ak=`#ifdef USE_UV
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
#endif`,lk=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
varying vec2 vUv2;
|
||
#endif`,ck=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
attribute vec2 uv2;
|
||
varying vec2 vUv2;
|
||
uniform mat3 uv2Transform;
|
||
#endif`,uk=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
|
||
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
|
||
#endif`,hk=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
|
||
vec4 worldPosition = vec4( transformed, 1.0 );
|
||
#ifdef USE_INSTANCING
|
||
worldPosition = instanceMatrix * worldPosition;
|
||
#endif
|
||
worldPosition = modelMatrix * worldPosition;
|
||
#endif`;const dk=`varying vec2 vUv;
|
||
uniform mat3 uvTransform;
|
||
void main() {
|
||
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
||
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
||
}`,pk=`uniform sampler2D t2D;
|
||
varying vec2 vUv;
|
||
void main() {
|
||
gl_FragColor = texture2D( t2D, vUv );
|
||
#ifdef DECODE_VIDEO_TEXTURE
|
||
gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );
|
||
#endif
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
}`,fk=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
gl_Position.z = gl_Position.w;
|
||
}`,mk=`#include <envmap_common_pars_fragment>
|
||
uniform float opacity;
|
||
varying vec3 vWorldDirection;
|
||
#include <cube_uv_reflection_fragment>
|
||
void main() {
|
||
vec3 vReflect = vWorldDirection;
|
||
#include <envmap_fragment>
|
||
gl_FragColor = envColor;
|
||
gl_FragColor.a *= opacity;
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
}`,vk=`#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <skinbase_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vHighPrecisionZW = gl_Position.zw;
|
||
}`,gk=`#if DEPTH_PACKING == 3200
|
||
uniform float opacity;
|
||
#endif
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
varying vec2 vHighPrecisionZW;
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#if DEPTH_PACKING == 3200
|
||
diffuseColor.a = opacity;
|
||
#endif
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
|
||
#if DEPTH_PACKING == 3200
|
||
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
||
#elif DEPTH_PACKING == 3201
|
||
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
||
#endif
|
||
}`,yk=`#define DISTANCE
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <skinbase_vertex>
|
||
#ifdef USE_DISPLACEMENTMAP
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vWorldPosition = worldPosition.xyz;
|
||
}`,_k=`#define DISTANCE
|
||
uniform vec3 referencePosition;
|
||
uniform float nearDistance;
|
||
uniform float farDistance;
|
||
varying vec3 vWorldPosition;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main () {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( 1.0 );
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
float dist = length( vWorldPosition - referencePosition );
|
||
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
||
dist = saturate( dist );
|
||
gl_FragColor = packDepthToRGBA( dist );
|
||
}`,xk=`varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vWorldDirection = transformDirection( position, modelMatrix );
|
||
#include <begin_vertex>
|
||
#include <project_vertex>
|
||
}`,bk=`uniform sampler2D tEquirect;
|
||
varying vec3 vWorldDirection;
|
||
#include <common>
|
||
void main() {
|
||
vec3 direction = normalize( vWorldDirection );
|
||
vec2 sampleUV = equirectUv( direction );
|
||
gl_FragColor = texture2D( tEquirect, sampleUV );
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
}`,wk=`uniform float scale;
|
||
attribute float lineDistance;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
vLineDistance = scale * lineDistance;
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,Sk=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform float dashSize;
|
||
uniform float totalSize;
|
||
varying float vLineDistance;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
||
discard;
|
||
}
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <logdepthbuf_fragment>
|
||
#include <color_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Mk=`#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <uv2_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <uv2_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#endif
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Ek=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#ifndef FLAT_SHADED
|
||
varying vec3 vNormal;
|
||
#endif
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <uv2_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <specularmap_fragment>
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
#ifdef USE_LIGHTMAP
|
||
vec4 lightMapTexel = texture2D( lightMap, vUv2 );
|
||
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
||
#else
|
||
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
||
#endif
|
||
#include <aomap_fragment>
|
||
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
||
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
||
#include <envmap_fragment>
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Tk=`#define LAMBERT
|
||
varying vec3 vLightFront;
|
||
varying vec3 vIndirectFront;
|
||
#ifdef DOUBLE_SIDED
|
||
varying vec3 vLightBack;
|
||
varying vec3 vIndirectBack;
|
||
#endif
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <uv2_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <uv2_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <lights_lambert_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Ak=`uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
varying vec3 vLightFront;
|
||
varying vec3 vIndirectFront;
|
||
#ifdef DOUBLE_SIDED
|
||
varying vec3 vLightBack;
|
||
varying vec3 vIndirectBack;
|
||
#endif
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <uv2_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <fog_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <shadowmask_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <emissivemap_fragment>
|
||
#ifdef DOUBLE_SIDED
|
||
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
|
||
#else
|
||
reflectedLight.indirectDiffuse += vIndirectFront;
|
||
#endif
|
||
#include <lightmap_fragment>
|
||
reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );
|
||
#ifdef DOUBLE_SIDED
|
||
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
|
||
#else
|
||
reflectedLight.directDiffuse = vLightFront;
|
||
#endif
|
||
reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Ck=`#define MATCAP
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
}`,Pk=`#define MATCAP
|
||
uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform sampler2D matcap;
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
vec3 viewDir = normalize( vViewPosition );
|
||
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
||
vec3 y = cross( viewDir, x );
|
||
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
||
#ifdef USE_MATCAP
|
||
vec4 matcapColor = texture2D( matcap, uv );
|
||
#else
|
||
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
||
#endif
|
||
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Rk=`#define NORMAL
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
||
vViewPosition = - mvPosition.xyz;
|
||
#endif
|
||
}`,Lk=`#define NORMAL
|
||
uniform float opacity;
|
||
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
|
||
varying vec3 vViewPosition;
|
||
#endif
|
||
#include <packing>
|
||
#include <uv_pars_fragment>
|
||
#include <normal_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
#include <logdepthbuf_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
|
||
#ifdef OPAQUE
|
||
gl_FragColor.a = 1.0;
|
||
#endif
|
||
}`,Dk=`#define PHONG
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <uv2_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <envmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <uv2_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <envmap_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Ik=`#define PHONG
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform vec3 specular;
|
||
uniform float shininess;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <uv2_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_pars_fragment>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_phong_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <specularmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <specularmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_phong_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
||
#include <envmap_fragment>
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Ok=`#define STANDARD
|
||
varying vec3 vViewPosition;
|
||
#ifdef USE_TRANSMISSION
|
||
varying vec3 vWorldPosition;
|
||
#endif
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <uv2_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <uv2_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
#ifdef USE_TRANSMISSION
|
||
vWorldPosition = worldPosition.xyz;
|
||
#endif
|
||
}`,kk=`#define STANDARD
|
||
#ifdef PHYSICAL
|
||
#define IOR
|
||
#define SPECULAR
|
||
#endif
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float roughness;
|
||
uniform float metalness;
|
||
uniform float opacity;
|
||
#ifdef IOR
|
||
uniform float ior;
|
||
#endif
|
||
#ifdef SPECULAR
|
||
uniform float specularIntensity;
|
||
uniform vec3 specularColor;
|
||
#ifdef USE_SPECULARINTENSITYMAP
|
||
uniform sampler2D specularIntensityMap;
|
||
#endif
|
||
#ifdef USE_SPECULARCOLORMAP
|
||
uniform sampler2D specularColorMap;
|
||
#endif
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
uniform float clearcoat;
|
||
uniform float clearcoatRoughness;
|
||
#endif
|
||
#ifdef USE_SHEEN
|
||
uniform vec3 sheenColor;
|
||
uniform float sheenRoughness;
|
||
#ifdef USE_SHEENCOLORMAP
|
||
uniform sampler2D sheenColorMap;
|
||
#endif
|
||
#ifdef USE_SHEENROUGHNESSMAP
|
||
uniform sampler2D sheenRoughnessMap;
|
||
#endif
|
||
#endif
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <uv2_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <cube_uv_reflection_fragment>
|
||
#include <envmap_common_pars_fragment>
|
||
#include <envmap_physical_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_physical_pars_fragment>
|
||
#include <transmission_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <clearcoat_pars_fragment>
|
||
#include <roughnessmap_pars_fragment>
|
||
#include <metalnessmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <roughnessmap_fragment>
|
||
#include <metalnessmap_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <clearcoat_normal_fragment_begin>
|
||
#include <clearcoat_normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_physical_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
||
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
||
#include <transmission_fragment>
|
||
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
||
#ifdef USE_SHEEN
|
||
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
||
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
|
||
#endif
|
||
#ifdef USE_CLEARCOAT
|
||
float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
|
||
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
||
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
|
||
#endif
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,Nk=`#define TOON
|
||
varying vec3 vViewPosition;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <uv2_pars_vertex>
|
||
#include <displacementmap_pars_vertex>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <normal_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
#include <uv2_vertex>
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <normal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <displacementmap_vertex>
|
||
#include <project_vertex>
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
vViewPosition = - mvPosition.xyz;
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Bk=`#define TOON
|
||
uniform vec3 diffuse;
|
||
uniform vec3 emissive;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <dithering_pars_fragment>
|
||
#include <color_pars_fragment>
|
||
#include <uv_pars_fragment>
|
||
#include <uv2_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <aomap_pars_fragment>
|
||
#include <lightmap_pars_fragment>
|
||
#include <emissivemap_pars_fragment>
|
||
#include <gradientmap_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <normal_pars_fragment>
|
||
#include <lights_toon_pars_fragment>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <bumpmap_pars_fragment>
|
||
#include <normalmap_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
||
vec3 totalEmissiveRadiance = emissive;
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <color_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
#include <normal_fragment_begin>
|
||
#include <normal_fragment_maps>
|
||
#include <emissivemap_fragment>
|
||
#include <lights_toon_fragment>
|
||
#include <lights_fragment_begin>
|
||
#include <lights_fragment_maps>
|
||
#include <lights_fragment_end>
|
||
#include <aomap_fragment>
|
||
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
#include <dithering_fragment>
|
||
}`,zk=`uniform float size;
|
||
uniform float scale;
|
||
#include <common>
|
||
#include <color_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <color_vertex>
|
||
#include <morphcolor_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <project_vertex>
|
||
gl_PointSize = size;
|
||
#ifdef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
||
#endif
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <fog_vertex>
|
||
}`,Uk=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <color_pars_fragment>
|
||
#include <map_particle_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_particle_fragment>
|
||
#include <color_fragment>
|
||
#include <alphatest_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
}`,Fk=`#include <common>
|
||
#include <fog_pars_vertex>
|
||
#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
#include <shadowmap_pars_vertex>
|
||
void main() {
|
||
#include <beginnormal_vertex>
|
||
#include <morphnormal_vertex>
|
||
#include <skinbase_vertex>
|
||
#include <skinnormal_vertex>
|
||
#include <defaultnormal_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
#include <worldpos_vertex>
|
||
#include <shadowmap_vertex>
|
||
#include <fog_vertex>
|
||
}`,Vk=`uniform vec3 color;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <packing>
|
||
#include <fog_pars_fragment>
|
||
#include <bsdfs>
|
||
#include <lights_pars_begin>
|
||
#include <shadowmap_pars_fragment>
|
||
#include <shadowmask_pars_fragment>
|
||
void main() {
|
||
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
}`,Hk=`uniform float rotation;
|
||
uniform vec2 center;
|
||
#include <common>
|
||
#include <uv_pars_vertex>
|
||
#include <fog_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
void main() {
|
||
#include <uv_vertex>
|
||
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
vec2 scale;
|
||
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
||
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
||
#ifndef USE_SIZEATTENUATION
|
||
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
||
if ( isPerspective ) scale *= - mvPosition.z;
|
||
#endif
|
||
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
||
vec2 rotatedPosition;
|
||
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
||
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
||
mvPosition.xy += rotatedPosition;
|
||
gl_Position = projectionMatrix * mvPosition;
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
}`,Gk=`uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
#include <common>
|
||
#include <uv_pars_fragment>
|
||
#include <map_pars_fragment>
|
||
#include <alphamap_pars_fragment>
|
||
#include <alphatest_pars_fragment>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
void main() {
|
||
#include <clipping_planes_fragment>
|
||
vec3 outgoingLight = vec3( 0.0 );
|
||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||
#include <logdepthbuf_fragment>
|
||
#include <map_fragment>
|
||
#include <alphamap_fragment>
|
||
#include <alphatest_fragment>
|
||
outgoingLight = diffuseColor.rgb;
|
||
#include <output_fragment>
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
#include <fog_fragment>
|
||
}`,Gt={alphamap_fragment:gO,alphamap_pars_fragment:yO,alphatest_fragment:_O,alphatest_pars_fragment:xO,aomap_fragment:bO,aomap_pars_fragment:wO,begin_vertex:SO,beginnormal_vertex:MO,bsdfs:EO,bumpmap_pars_fragment:TO,clipping_planes_fragment:AO,clipping_planes_pars_fragment:CO,clipping_planes_pars_vertex:PO,clipping_planes_vertex:RO,color_fragment:LO,color_pars_fragment:DO,color_pars_vertex:IO,color_vertex:OO,common:kO,cube_uv_reflection_fragment:NO,defaultnormal_vertex:BO,displacementmap_pars_vertex:zO,displacementmap_vertex:UO,emissivemap_fragment:FO,emissivemap_pars_fragment:VO,encodings_fragment:HO,encodings_pars_fragment:GO,envmap_fragment:WO,envmap_common_pars_fragment:jO,envmap_pars_fragment:XO,envmap_pars_vertex:qO,envmap_physical_pars_fragment:r5,envmap_vertex:YO,fog_vertex:ZO,fog_pars_vertex:KO,fog_fragment:JO,fog_pars_fragment:QO,gradientmap_pars_fragment:$O,lightmap_fragment:e5,lightmap_pars_fragment:t5,lights_lambert_vertex:n5,lights_pars_begin:i5,lights_toon_fragment:s5,lights_toon_pars_fragment:o5,lights_phong_fragment:a5,lights_phong_pars_fragment:l5,lights_physical_fragment:c5,lights_physical_pars_fragment:u5,lights_fragment_begin:h5,lights_fragment_maps:d5,lights_fragment_end:p5,logdepthbuf_fragment:f5,logdepthbuf_pars_fragment:m5,logdepthbuf_pars_vertex:v5,logdepthbuf_vertex:g5,map_fragment:y5,map_pars_fragment:_5,map_particle_fragment:x5,map_particle_pars_fragment:b5,metalnessmap_fragment:w5,metalnessmap_pars_fragment:S5,morphcolor_vertex:M5,morphnormal_vertex:E5,morphtarget_pars_vertex:T5,morphtarget_vertex:A5,normal_fragment_begin:C5,normal_fragment_maps:P5,normal_pars_fragment:R5,normal_pars_vertex:L5,normal_vertex:D5,normalmap_pars_fragment:I5,clearcoat_normal_fragment_begin:O5,clearcoat_normal_fragment_maps:k5,clearcoat_pars_fragment:N5,output_fragment:B5,packing:z5,premultiplied_alpha_fragment:U5,project_vertex:F5,dithering_fragment:V5,dithering_pars_fragment:H5,roughnessmap_fragment:G5,roughnessmap_pars_fragment:W5,shadowmap_pars_fragment:j5,shadowmap_pars_vertex:X5,shadowmap_vertex:q5,shadowmask_pars_fragment:Y5,skinbase_vertex:Z5,skinning_pars_vertex:K5,skinning_vertex:J5,skinnormal_vertex:Q5,specularmap_fragment:$5,specularmap_pars_fragment:ek,tonemapping_fragment:tk,tonemapping_pars_fragment:nk,transmission_fragment:ik,transmission_pars_fragment:rk,uv_pars_fragment:sk,uv_pars_vertex:ok,uv_vertex:ak,uv2_pars_fragment:lk,uv2_pars_vertex:ck,uv2_vertex:uk,worldpos_vertex:hk,background_vert:dk,background_frag:pk,cube_vert:fk,cube_frag:mk,depth_vert:vk,depth_frag:gk,distanceRGBA_vert:yk,distanceRGBA_frag:_k,equirect_vert:xk,equirect_frag:bk,linedashed_vert:wk,linedashed_frag:Sk,meshbasic_vert:Mk,meshbasic_frag:Ek,meshlambert_vert:Tk,meshlambert_frag:Ak,meshmatcap_vert:Ck,meshmatcap_frag:Pk,meshnormal_vert:Rk,meshnormal_frag:Lk,meshphong_vert:Dk,meshphong_frag:Ik,meshphysical_vert:Ok,meshphysical_frag:kk,meshtoon_vert:Nk,meshtoon_frag:Bk,points_vert:zk,points_frag:Uk,shadow_vert:Fk,shadow_frag:Vk,sprite_vert:Hk,sprite_frag:Gk},He={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Gn},uv2Transform:{value:new Gn},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new ae(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Gn}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new ae(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Gn}}},Ms={basic:{uniforms:Pi([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.fog]),vertexShader:Gt.meshbasic_vert,fragmentShader:Gt.meshbasic_frag},lambert:{uniforms:Pi([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.fog,He.lights,{emissive:{value:new Pe(0)}}]),vertexShader:Gt.meshlambert_vert,fragmentShader:Gt.meshlambert_frag},phong:{uniforms:Pi([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new Pe(0)},specular:{value:new Pe(1118481)},shininess:{value:30}}]),vertexShader:Gt.meshphong_vert,fragmentShader:Gt.meshphong_frag},standard:{uniforms:Pi([He.common,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.roughnessmap,He.metalnessmap,He.fog,He.lights,{emissive:{value:new Pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag},toon:{uniforms:Pi([He.common,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.gradientmap,He.fog,He.lights,{emissive:{value:new Pe(0)}}]),vertexShader:Gt.meshtoon_vert,fragmentShader:Gt.meshtoon_frag},matcap:{uniforms:Pi([He.common,He.bumpmap,He.normalmap,He.displacementmap,He.fog,{matcap:{value:null}}]),vertexShader:Gt.meshmatcap_vert,fragmentShader:Gt.meshmatcap_frag},points:{uniforms:Pi([He.points,He.fog]),vertexShader:Gt.points_vert,fragmentShader:Gt.points_frag},dashed:{uniforms:Pi([He.common,He.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Gt.linedashed_vert,fragmentShader:Gt.linedashed_frag},depth:{uniforms:Pi([He.common,He.displacementmap]),vertexShader:Gt.depth_vert,fragmentShader:Gt.depth_frag},normal:{uniforms:Pi([He.common,He.bumpmap,He.normalmap,He.displacementmap,{opacity:{value:1}}]),vertexShader:Gt.meshnormal_vert,fragmentShader:Gt.meshnormal_frag},sprite:{uniforms:Pi([He.sprite,He.fog]),vertexShader:Gt.sprite_vert,fragmentShader:Gt.sprite_frag},background:{uniforms:{uvTransform:{value:new Gn},t2D:{value:null}},vertexShader:Gt.background_vert,fragmentShader:Gt.background_frag},cube:{uniforms:Pi([He.envmap,{opacity:{value:1}}]),vertexShader:Gt.cube_vert,fragmentShader:Gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Gt.equirect_vert,fragmentShader:Gt.equirect_frag},distanceRGBA:{uniforms:Pi([He.common,He.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Gt.distanceRGBA_vert,fragmentShader:Gt.distanceRGBA_frag},shadow:{uniforms:Pi([He.lights,He.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:Gt.shadow_vert,fragmentShader:Gt.shadow_frag}};Ms.physical={uniforms:Pi([Ms.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ae(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ae},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Gt.meshphysical_vert,fragmentShader:Gt.meshphysical_frag};function Wk(i,e,t,n,r,s){const o=new Pe(0);let l=r===!0?0:1,h,d,f=null,g=0,y=null;function _(S,b){let T=!1,E=b.isScene===!0?b.background:null;E&&E.isTexture&&(E=e.get(E));const C=i.xr,A=C.getSession&&C.getSession();A&&A.environmentBlendMode==="additive"&&(E=null),E===null?w(o,l):E&&E.isColor&&(w(E,1),T=!0),(i.autoClear||T)&&i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil),E&&(E.isCubeTexture||E.mapping===Nm)?(d===void 0&&(d=new In(new bl(1,1,1),new kt({name:"BackgroundCubeMaterial",uniforms:Wc(Ms.cube.uniforms),vertexShader:Ms.cube.vertexShader,fragmentShader:Ms.cube.fragmentShader,side:xr,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(D,I,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(d)),d.material.uniforms.envMap.value=E,d.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,(f!==E||g!==E.version||y!==i.toneMapping)&&(d.material.needsUpdate=!0,f=E,g=E.version,y=i.toneMapping),d.layers.enableAll(),S.unshift(d,d.geometry,d.material,0,0,null)):E&&E.isTexture&&(h===void 0&&(h=new In(new ld(2,2),new kt({name:"BackgroundMaterial",uniforms:Wc(Ms.background.uniforms),vertexShader:Ms.background.vertexShader,fragmentShader:Ms.background.fragmentShader,side:Oh,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=E,E.matrixAutoUpdate===!0&&E.updateMatrix(),h.material.uniforms.uvTransform.value.copy(E.matrix),(f!==E||g!==E.version||y!==i.toneMapping)&&(h.material.needsUpdate=!0,f=E,g=E.version,y=i.toneMapping),h.layers.enableAll(),S.unshift(h,h.geometry,h.material,0,0,null))}function w(S,b){t.buffers.color.setClear(S.r,S.g,S.b,b,s)}return{getClearColor:function(){return o},setClearColor:function(S,b=1){o.set(S),l=b,w(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(S){l=S,w(o,l)},render:_}}function jk(i,e,t,n){const r=i.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,l={},h=b(null);let d=h,f=!1;function g(Z,$,K,pe,re){let se=!1;if(o){const ue=S(pe,K,$);d!==ue&&(d=ue,_(d.object)),se=T(Z,pe,K,re),se&&E(Z,pe,K,re)}else{const ue=$.wireframe===!0;(d.geometry!==pe.id||d.program!==K.id||d.wireframe!==ue)&&(d.geometry=pe.id,d.program=K.id,d.wireframe=ue,se=!0)}re!==null&&t.update(re,34963),(se||f)&&(f=!1,P(Z,$,K,pe),re!==null&&i.bindBuffer(34963,t.get(re).buffer))}function y(){return n.isWebGL2?i.createVertexArray():s.createVertexArrayOES()}function _(Z){return n.isWebGL2?i.bindVertexArray(Z):s.bindVertexArrayOES(Z)}function w(Z){return n.isWebGL2?i.deleteVertexArray(Z):s.deleteVertexArrayOES(Z)}function S(Z,$,K){const pe=K.wireframe===!0;let re=l[Z.id];re===void 0&&(re={},l[Z.id]=re);let se=re[$.id];se===void 0&&(se={},re[$.id]=se);let ue=se[pe];return ue===void 0&&(ue=b(y()),se[pe]=ue),ue}function b(Z){const $=[],K=[],pe=[];for(let re=0;re<r;re++)$[re]=0,K[re]=0,pe[re]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:$,enabledAttributes:K,attributeDivisors:pe,object:Z,attributes:{},index:null}}function T(Z,$,K,pe){const re=d.attributes,se=$.attributes;let ue=0;const Te=K.getAttributes();for(const fe in Te)if(Te[fe].location>=0){const qe=re[fe];let Ke=se[fe];if(Ke===void 0&&(fe==="instanceMatrix"&&Z.instanceMatrix&&(Ke=Z.instanceMatrix),fe==="instanceColor"&&Z.instanceColor&&(Ke=Z.instanceColor)),qe===void 0||qe.attribute!==Ke||Ke&&qe.data!==Ke.data)return!0;ue++}return d.attributesNum!==ue||d.index!==pe}function E(Z,$,K,pe){const re={},se=$.attributes;let ue=0;const Te=K.getAttributes();for(const fe in Te)if(Te[fe].location>=0){let qe=se[fe];qe===void 0&&(fe==="instanceMatrix"&&Z.instanceMatrix&&(qe=Z.instanceMatrix),fe==="instanceColor"&&Z.instanceColor&&(qe=Z.instanceColor));const Ke={};Ke.attribute=qe,qe&&qe.data&&(Ke.data=qe.data),re[fe]=Ke,ue++}d.attributes=re,d.attributesNum=ue,d.index=pe}function C(){const Z=d.newAttributes;for(let $=0,K=Z.length;$<K;$++)Z[$]=0}function A(Z){D(Z,0)}function D(Z,$){const K=d.newAttributes,pe=d.enabledAttributes,re=d.attributeDivisors;K[Z]=1,pe[Z]===0&&(i.enableVertexAttribArray(Z),pe[Z]=1),re[Z]!==$&&((n.isWebGL2?i:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](Z,$),re[Z]=$)}function I(){const Z=d.newAttributes,$=d.enabledAttributes;for(let K=0,pe=$.length;K<pe;K++)$[K]!==Z[K]&&(i.disableVertexAttribArray(K),$[K]=0)}function F(Z,$,K,pe,re,se){n.isWebGL2===!0&&(K===5124||K===5125)?i.vertexAttribIPointer(Z,$,K,re,se):i.vertexAttribPointer(Z,$,K,pe,re,se)}function P(Z,$,K,pe){if(n.isWebGL2===!1&&(Z.isInstancedMesh||pe.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;C();const re=pe.attributes,se=K.getAttributes(),ue=$.defaultAttributeValues;for(const Te in se){const fe=se[Te];if(fe.location>=0){let Ce=re[Te];if(Ce===void 0&&(Te==="instanceMatrix"&&Z.instanceMatrix&&(Ce=Z.instanceMatrix),Te==="instanceColor"&&Z.instanceColor&&(Ce=Z.instanceColor)),Ce!==void 0){const qe=Ce.normalized,Ke=Ce.itemSize,me=t.get(Ce);if(me===void 0)continue;const Ut=me.buffer,nt=me.type,it=me.bytesPerElement;if(Ce.isInterleavedBufferAttribute){const Le=Ce.data,vt=Le.stride,ve=Ce.offset;if(Le.isInstancedInterleavedBuffer){for(let xe=0;xe<fe.locationSize;xe++)D(fe.location+xe,Le.meshPerAttribute);Z.isInstancedMesh!==!0&&pe._maxInstanceCount===void 0&&(pe._maxInstanceCount=Le.meshPerAttribute*Le.count)}else for(let xe=0;xe<fe.locationSize;xe++)A(fe.location+xe);i.bindBuffer(34962,Ut);for(let xe=0;xe<fe.locationSize;xe++)F(fe.location+xe,Ke/fe.locationSize,nt,qe,vt*it,(ve+Ke/fe.locationSize*xe)*it)}else{if(Ce.isInstancedBufferAttribute){for(let Le=0;Le<fe.locationSize;Le++)D(fe.location+Le,Ce.meshPerAttribute);Z.isInstancedMesh!==!0&&pe._maxInstanceCount===void 0&&(pe._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let Le=0;Le<fe.locationSize;Le++)A(fe.location+Le);i.bindBuffer(34962,Ut);for(let Le=0;Le<fe.locationSize;Le++)F(fe.location+Le,Ke/fe.locationSize,nt,qe,Ke*it,Ke/fe.locationSize*Le*it)}}else if(ue!==void 0){const qe=ue[Te];if(qe!==void 0)switch(qe.length){case 2:i.vertexAttrib2fv(fe.location,qe);break;case 3:i.vertexAttrib3fv(fe.location,qe);break;case 4:i.vertexAttrib4fv(fe.location,qe);break;default:i.vertexAttrib1fv(fe.location,qe)}}}}I()}function k(){ne();for(const Z in l){const $=l[Z];for(const K in $){const pe=$[K];for(const re in pe)w(pe[re].object),delete pe[re];delete $[K]}delete l[Z]}}function j(Z){if(l[Z.id]===void 0)return;const $=l[Z.id];for(const K in $){const pe=$[K];for(const re in pe)w(pe[re].object),delete pe[re];delete $[K]}delete l[Z.id]}function G(Z){for(const $ in l){const K=l[$];if(K[Z.id]===void 0)continue;const pe=K[Z.id];for(const re in pe)w(pe[re].object),delete pe[re];delete K[Z.id]}}function ne(){ce(),f=!0,d!==h&&(d=h,_(d.object))}function ce(){h.geometry=null,h.program=null,h.wireframe=!1}return{setup:g,reset:ne,resetDefaultState:ce,dispose:k,releaseStatesOfGeometry:j,releaseStatesOfProgram:G,initAttributes:C,enableAttribute:A,disableUnusedAttributes:I}}function Xk(i,e,t,n){const r=n.isWebGL2;let s;function o(d){s=d}function l(d,f){i.drawArrays(s,d,f),t.update(f,s,1)}function h(d,f,g){if(g===0)return;let y,_;if(r)y=i,_="drawArraysInstanced";else if(y=e.get("ANGLE_instanced_arrays"),_="drawArraysInstancedANGLE",y===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[_](s,d,f,g),t.update(f,s,g)}this.setMode=o,this.render=l,this.renderInstances=h}function qk(i,e,t){let n;function r(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const F=e.get("EXT_texture_filter_anisotropic");n=i.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function s(F){if(F==="highp"){if(i.getShaderPrecisionFormat(35633,36338).precision>0&&i.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";F="mediump"}return F==="mediump"&&i.getShaderPrecisionFormat(35633,36337).precision>0&&i.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&i instanceof WebGL2ComputeRenderingContext;let l=t.precision!==void 0?t.precision:"highp";const h=s(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const d=o||e.has("WEBGL_draw_buffers"),f=t.logarithmicDepthBuffer===!0,g=i.getParameter(34930),y=i.getParameter(35660),_=i.getParameter(3379),w=i.getParameter(34076),S=i.getParameter(34921),b=i.getParameter(36347),T=i.getParameter(36348),E=i.getParameter(36349),C=y>0,A=o||e.has("OES_texture_float"),D=C&&A,I=o?i.getParameter(36183):0;return{isWebGL2:o,drawBuffers:d,getMaxAnisotropy:r,getMaxPrecision:s,precision:l,logarithmicDepthBuffer:f,maxTextures:g,maxVertexTextures:y,maxTextureSize:_,maxCubemapSize:w,maxAttributes:S,maxVertexUniforms:b,maxVaryings:T,maxFragmentUniforms:E,vertexTextures:C,floatFragmentTextures:A,floatVertexTextures:D,maxSamples:I}}function Yk(i){const e=this;let t=null,n=0,r=!1,s=!1;const o=new mo,l=new Gn,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,y,_){const w=g.length!==0||y||n!==0||r;return r=y,t=f(g,_,0),n=g.length,w},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1,d()},this.setState=function(g,y,_){const w=g.clippingPlanes,S=g.clipIntersection,b=g.clipShadows,T=i.get(g);if(!r||w===null||w.length===0||s&&!b)s?f(null):d();else{const E=s?0:n,C=E*4;let A=T.clippingState||null;h.value=A,A=f(w,y,C,_);for(let D=0;D!==C;++D)A[D]=t[D];T.clippingState=A,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function d(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(g,y,_,w){const S=g!==null?g.length:0;let b=null;if(S!==0){if(b=h.value,w!==!0||b===null){const T=_+S*4,E=y.matrixWorldInverse;l.getNormalMatrix(E),(b===null||b.length<T)&&(b=new Float32Array(T));for(let C=0,A=_;C!==S;++C,A+=4)o.copy(g[C]).applyMatrix4(E,l),o.normal.toArray(b,A),b[A+3]=o.constant}h.value=b,h.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,b}}function Zk(i){let e=new WeakMap;function t(o,l){return l===kh?o.mapping=Vc:l===Gy&&(o.mapping=Hc),o}function n(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const l=o.mapping;if(l===kh||l===Gy)if(e.has(o)){const h=e.get(o).texture;return t(h,o.mapping)}else{const h=o.image;if(h&&h.height>0){const d=new XE(h.height/2);return d.fromEquirectangularTexture(i,o),e.set(o,d),o.addEventListener("dispose",r),t(d.texture,o.mapping)}else return null}}return o}function r(o){const l=o.target;l.removeEventListener("dispose",r);const h=e.get(l);h!==void 0&&(e.delete(l),h.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class ou extends Um{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=n-e,o=n+e,l=r+t,h=r-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=d*this.view.offsetX,o=s+d*this.view.width,l-=f*this.view.offsetY,h=l-f*this.view.height}this.projectionMatrix.makeOrthographic(s,o,l,h,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}ou.prototype.isOrthographicCamera=!0;const kc=4,W1=[.125,.215,.35,.446,.526,.582],sl=20,hy=new ou,j1=new Pe;let dy=null;const nl=(1+Math.sqrt(5))/2,bc=1/nl,X1=[new z(1,1,1),new z(-1,1,1),new z(1,1,-1),new z(-1,1,-1),new z(0,nl,bc),new z(0,nl,-bc),new z(bc,0,nl),new z(-bc,0,nl),new z(nl,bc,0),new z(-nl,bc,0)];class q1{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,r=100){dy=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=K1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Z1(),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(dy),e.scissorTest=!1,sf(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Vc||e.mapping===Hc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),dy=this._renderer.getRenderTarget();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:Hn,minFilter:Hn,generateMipmaps:!1,type:Ts,format:Or,encoding:Ds,depthBuffer:!1},r=Y1(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Y1(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Kk(s)),this._blurMaterial=Jk(s,e,t)}return r}_compileMaterial(e){const t=new In(this._lodPlanes[0],e);this._renderer.compile(t,hy)}_sceneToCubeUV(e,t,n,r){const l=new fi(90,1,t,n),h=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],f=this._renderer,g=f.autoClear,y=f.toneMapping;f.getClearColor(j1),f.toneMapping=As,f.autoClear=!1;const _=new ss({name:"PMREM.Background",side:xr,depthWrite:!1,depthTest:!1}),w=new In(new bl,_);let S=!1;const b=e.background;b?b.isColor&&(_.color.copy(b),e.background=null,S=!0):(_.color.copy(j1),S=!0);for(let T=0;T<6;T++){const E=T%3;E===0?(l.up.set(0,h[T],0),l.lookAt(d[T],0,0)):E===1?(l.up.set(0,0,h[T]),l.lookAt(0,d[T],0)):(l.up.set(0,h[T],0),l.lookAt(0,0,d[T]));const C=this._cubeSize;sf(r,E*C,T>2?C:0,C,C),f.setRenderTarget(r),S&&f.render(w,l),f.render(e,l)}w.geometry.dispose(),w.material.dispose(),f.toneMapping=y,f.autoClear=g,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Vc||e.mapping===Hc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=K1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Z1());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new In(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const h=this._cubeSize;sf(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(o,hy)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=X1[(r-1)%X1.length];this._blur(e,r-1,r,s,o)}t.autoClear=n}_blur(e,t,n,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,r,"latitudinal",s),this._halfBlur(o,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,o,l){const h=this._renderer,d=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,g=new In(this._lodPlanes[r],d),y=d.uniforms,_=this._sizeLods[n]-1,w=isFinite(s)?Math.PI/(2*_):2*Math.PI/(2*sl-1),S=s/w,b=isFinite(s)?1+Math.floor(f*S):sl;b>sl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${b} samples when the maximum is set to ${sl}`);const T=[];let E=0;for(let F=0;F<sl;++F){const P=F/S,k=Math.exp(-P*P/2);T.push(k),F===0?E+=k:F<b&&(E+=2*k)}for(let F=0;F<T.length;F++)T[F]=T[F]/E;y.envMap.value=e.texture,y.samples.value=b,y.weights.value=T,y.latitudinal.value=o==="latitudinal",l&&(y.poleAxis.value=l);const{_lodMax:C}=this;y.dTheta.value=w,y.mipInt.value=C-n;const A=this._sizeLods[r],D=3*A*(r>C-kc?r-C+kc:0),I=4*(this._cubeSize-A);sf(t,D,I,3*A,2*A),h.setRenderTarget(t),h.render(g,hy)}}function Kk(i){const e=[],t=[],n=[];let r=i;const s=i-kc+1+W1.length;for(let o=0;o<s;o++){const l=Math.pow(2,r);t.push(l);let h=1/l;o>i-kc?h=W1[o-i+kc-1]:o===0&&(h=0),n.push(h);const d=1/(l-2),f=-d,g=1+d,y=[f,f,g,f,g,g,f,f,g,g,f,g],_=6,w=6,S=3,b=2,T=1,E=new Float32Array(S*w*_),C=new Float32Array(b*w*_),A=new Float32Array(T*w*_);for(let I=0;I<_;I++){const F=I%3*2/3-1,P=I>2?0:-1,k=[F,P,0,F+2/3,P,0,F+2/3,P+1,0,F,P,0,F+2/3,P+1,0,F,P+1,0];E.set(k,S*w*I),C.set(y,b*w*I);const j=[I,I,I,I,I,I];A.set(j,T*w*I)}const D=new zt;D.setAttribute("position",new Wn(E,S)),D.setAttribute("uv",new Wn(C,b)),D.setAttribute("faceIndex",new Wn(A,T)),e.push(D),r>kc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Y1(i,e,t){const n=new Yt(i,e,t);return n.texture.mapping=Nm,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function sf(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Jk(i,e,t){const n=new Float32Array(sl),r=new z(0,1,0);return new kt({name:"SphericalGaussianBlur",defines:{n:sl,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ax(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
uniform int samples;
|
||
uniform float weights[ n ];
|
||
uniform bool latitudinal;
|
||
uniform float dTheta;
|
||
uniform float mipInt;
|
||
uniform vec3 poleAxis;
|
||
|
||
#define ENVMAP_TYPE_CUBE_UV
|
||
#include <cube_uv_reflection_fragment>
|
||
|
||
vec3 getSample( float theta, vec3 axis ) {
|
||
|
||
float cosTheta = cos( theta );
|
||
// Rodrigues' axis-angle rotation
|
||
vec3 sampleDirection = vOutputDirection * cosTheta
|
||
+ cross( axis, vOutputDirection ) * sin( theta )
|
||
+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
|
||
|
||
return bilinearCubeUV( envMap, sampleDirection, mipInt );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
|
||
|
||
if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
|
||
|
||
axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
|
||
|
||
}
|
||
|
||
axis = normalize( axis );
|
||
|
||
gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
||
gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
|
||
|
||
for ( int i = 1; i < n; i++ ) {
|
||
|
||
if ( i >= samples ) {
|
||
|
||
break;
|
||
|
||
}
|
||
|
||
float theta = dTheta * float( i );
|
||
gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
|
||
gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
|
||
|
||
}
|
||
|
||
}
|
||
`,blending:rn,depthTest:!1,depthWrite:!1})}function Z1(){return new kt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ax(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform sampler2D envMap;
|
||
|
||
#include <common>
|
||
|
||
void main() {
|
||
|
||
vec3 outputDirection = normalize( vOutputDirection );
|
||
vec2 uv = equirectUv( outputDirection );
|
||
|
||
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
||
|
||
}
|
||
`,blending:rn,depthTest:!1,depthWrite:!1})}function K1(){return new kt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ax(),fragmentShader:`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
uniform float flipEnvMap;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
uniform samplerCube envMap;
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
||
|
||
}
|
||
`,blending:rn,depthTest:!1,depthWrite:!1})}function ax(){return`
|
||
|
||
precision mediump float;
|
||
precision mediump int;
|
||
|
||
attribute float faceIndex;
|
||
|
||
varying vec3 vOutputDirection;
|
||
|
||
// RH coordinate system; PMREM face-indexing convention
|
||
vec3 getDirection( vec2 uv, float face ) {
|
||
|
||
uv = 2.0 * uv - 1.0;
|
||
|
||
vec3 direction = vec3( uv, 1.0 );
|
||
|
||
if ( face == 0.0 ) {
|
||
|
||
direction = direction.zyx; // ( 1, v, u ) pos x
|
||
|
||
} else if ( face == 1.0 ) {
|
||
|
||
direction = direction.xzy;
|
||
direction.xz *= -1.0; // ( -u, 1, -v ) pos y
|
||
|
||
} else if ( face == 2.0 ) {
|
||
|
||
direction.x *= -1.0; // ( -u, v, 1 ) pos z
|
||
|
||
} else if ( face == 3.0 ) {
|
||
|
||
direction = direction.zyx;
|
||
direction.xz *= -1.0; // ( -1, v, -u ) neg x
|
||
|
||
} else if ( face == 4.0 ) {
|
||
|
||
direction = direction.xzy;
|
||
direction.xy *= -1.0; // ( -u, -1, v ) neg y
|
||
|
||
} else if ( face == 5.0 ) {
|
||
|
||
direction.z *= -1.0; // ( u, v, -1 ) neg z
|
||
|
||
}
|
||
|
||
return direction;
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vOutputDirection = getDirection( uv, faceIndex );
|
||
gl_Position = vec4( position, 1.0 );
|
||
|
||
}
|
||
`}function Qk(i){let e=new WeakMap,t=null;function n(l){if(l&&l.isTexture){const h=l.mapping,d=h===kh||h===Gy,f=h===Vc||h===Hc;if(d||f)if(l.isRenderTargetTexture&&l.needsPMREMUpdate===!0){l.needsPMREMUpdate=!1;let g=e.get(l);return t===null&&(t=new q1(i)),g=d?t.fromEquirectangular(l,g):t.fromCubemap(l,g),e.set(l,g),g.texture}else{if(e.has(l))return e.get(l).texture;{const g=l.image;if(d&&g&&g.height>0||f&&g&&r(g)){t===null&&(t=new q1(i));const y=d?t.fromEquirectangular(l):t.fromCubemap(l);return e.set(l,y),l.addEventListener("dispose",s),y.texture}else return null}}}return l}function r(l){let h=0;const d=6;for(let f=0;f<d;f++)l[f]!==void 0&&h++;return h===d}function s(l){const h=l.target;h.removeEventListener("dispose",s);const d=e.get(h);d!==void 0&&(e.delete(h),d.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function $k(i){const e={};function t(n){if(e[n]!==void 0)return e[n];let r;switch(n){case"WEBGL_depth_texture":r=i.getExtension("WEBGL_depth_texture")||i.getExtension("MOZ_WEBGL_depth_texture")||i.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=i.getExtension("WEBGL_compressed_texture_s3tc")||i.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=i.getExtension("WEBGL_compressed_texture_pvrtc")||i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=i.getExtension(n)}return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(n){n.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(n){const r=t(n);return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),r}}}function eN(i,e,t,n){const r={},s=new WeakMap;function o(g){const y=g.target;y.index!==null&&e.remove(y.index);for(const w in y.attributes)e.remove(y.attributes[w]);y.removeEventListener("dispose",o),delete r[y.id];const _=s.get(y);_&&(e.remove(_),s.delete(y)),n.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,t.memory.geometries--}function l(g,y){return r[y.id]===!0||(y.addEventListener("dispose",o),r[y.id]=!0,t.memory.geometries++),y}function h(g){const y=g.attributes;for(const w in y)e.update(y[w],34962);const _=g.morphAttributes;for(const w in _){const S=_[w];for(let b=0,T=S.length;b<T;b++)e.update(S[b],34962)}}function d(g){const y=[],_=g.index,w=g.attributes.position;let S=0;if(_!==null){const E=_.array;S=_.version;for(let C=0,A=E.length;C<A;C+=3){const D=E[C+0],I=E[C+1],F=E[C+2];y.push(D,I,I,F,F,D)}}else{const E=w.array;S=w.version;for(let C=0,A=E.length/3-1;C<A;C+=3){const D=C+0,I=C+1,F=C+2;y.push(D,I,I,F,F,D)}}const b=new(HE(y)?jE:WE)(y,1);b.version=S;const T=s.get(g);T&&e.remove(T),s.set(g,b)}function f(g){const y=s.get(g);if(y){const _=g.index;_!==null&&y.version<_.version&&d(g)}else d(g);return s.get(g)}return{get:l,update:h,getWireframeAttribute:f}}function tN(i,e,t,n){const r=n.isWebGL2;let s;function o(y){s=y}let l,h;function d(y){l=y.type,h=y.bytesPerElement}function f(y,_){i.drawElements(s,_,l,y*h),t.update(_,s,1)}function g(y,_,w){if(w===0)return;let S,b;if(r)S=i,b="drawElementsInstanced";else if(S=e.get("ANGLE_instanced_arrays"),b="drawElementsInstancedANGLE",S===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}S[b](s,_,l,y*h,w),t.update(_,s,w)}this.setMode=o,this.setIndex=d,this.render=f,this.renderInstances=g}function nN(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,l){switch(t.calls++,o){case 4:t.triangles+=l*(s/3);break;case 1:t.lines+=l*(s/2);break;case 3:t.lines+=l*(s-1);break;case 2:t.lines+=l*s;break;case 0:t.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function iN(i,e){return i[0]-e[0]}function rN(i,e){return Math.abs(e[1])-Math.abs(i[1])}function py(i,e){let t=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?t=127:n instanceof Int16Array?t=32767:n instanceof Int32Array?t=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),i.divideScalar(t)}function sN(i,e,t){const n={},r=new Float32Array(8),s=new WeakMap,o=new dn,l=[];for(let d=0;d<8;d++)l[d]=[d,0];function h(d,f,g,y){const _=d.morphTargetInfluences;if(e.isWebGL2===!0){const w=f.morphAttributes.position||f.morphAttributes.normal||f.morphAttributes.color,S=w!==void 0?w.length:0;let b=s.get(f);if(b===void 0||b.count!==S){let C=function(){Z.dispose(),s.delete(f),f.removeEventListener("dispose",C)};b!==void 0&&b.texture.dispose();const A=f.morphAttributes.position!==void 0,D=f.morphAttributes.normal!==void 0,I=f.morphAttributes.color!==void 0,F=f.morphAttributes.position||[],P=f.morphAttributes.normal||[],k=f.morphAttributes.color||[];let j=0;A===!0&&(j=1),D===!0&&(j=2),I===!0&&(j=3);let G=f.attributes.position.count*j,ne=1;G>e.maxTextureSize&&(ne=Math.ceil(G/e.maxTextureSize),G=e.maxTextureSize);const ce=new Float32Array(G*ne*4*S),Z=new zm(ce,G,ne,S);Z.type=is,Z.needsUpdate=!0;const $=j*4;for(let K=0;K<S;K++){const pe=F[K],re=P[K],se=k[K],ue=G*ne*4*K;for(let Te=0;Te<pe.count;Te++){const fe=Te*$;A===!0&&(o.fromBufferAttribute(pe,Te),pe.normalized===!0&&py(o,pe),ce[ue+fe+0]=o.x,ce[ue+fe+1]=o.y,ce[ue+fe+2]=o.z,ce[ue+fe+3]=0),D===!0&&(o.fromBufferAttribute(re,Te),re.normalized===!0&&py(o,re),ce[ue+fe+4]=o.x,ce[ue+fe+5]=o.y,ce[ue+fe+6]=o.z,ce[ue+fe+7]=0),I===!0&&(o.fromBufferAttribute(se,Te),se.normalized===!0&&py(o,se),ce[ue+fe+8]=o.x,ce[ue+fe+9]=o.y,ce[ue+fe+10]=o.z,ce[ue+fe+11]=se.itemSize===4?o.w:1)}}b={count:S,texture:Z,size:new ae(G,ne)},s.set(f,b),f.addEventListener("dispose",C)}let T=0;for(let C=0;C<_.length;C++)T+=_[C];const E=f.morphTargetsRelative?1:1-T;y.getUniforms().setValue(i,"morphTargetBaseInfluence",E),y.getUniforms().setValue(i,"morphTargetInfluences",_),y.getUniforms().setValue(i,"morphTargetsTexture",b.texture,t),y.getUniforms().setValue(i,"morphTargetsTextureSize",b.size)}else{const w=_===void 0?0:_.length;let S=n[f.id];if(S===void 0||S.length!==w){S=[];for(let A=0;A<w;A++)S[A]=[A,0];n[f.id]=S}for(let A=0;A<w;A++){const D=S[A];D[0]=A,D[1]=_[A]}S.sort(rN);for(let A=0;A<8;A++)A<w&&S[A][1]?(l[A][0]=S[A][0],l[A][1]=S[A][1]):(l[A][0]=Number.MAX_SAFE_INTEGER,l[A][1]=0);l.sort(iN);const b=f.morphAttributes.position,T=f.morphAttributes.normal;let E=0;for(let A=0;A<8;A++){const D=l[A],I=D[0],F=D[1];I!==Number.MAX_SAFE_INTEGER&&F?(b&&f.getAttribute("morphTarget"+A)!==b[I]&&f.setAttribute("morphTarget"+A,b[I]),T&&f.getAttribute("morphNormal"+A)!==T[I]&&f.setAttribute("morphNormal"+A,T[I]),r[A]=F,E+=F):(b&&f.hasAttribute("morphTarget"+A)===!0&&f.deleteAttribute("morphTarget"+A),T&&f.hasAttribute("morphNormal"+A)===!0&&f.deleteAttribute("morphNormal"+A),r[A]=0)}const C=f.morphTargetsRelative?1:1-E;y.getUniforms().setValue(i,"morphTargetBaseInfluence",C),y.getUniforms().setValue(i,"morphTargetInfluences",r)}}return{update:h}}function oN(i,e,t,n){let r=new WeakMap;function s(h){const d=n.render.frame,f=h.geometry,g=e.get(h,f);return r.get(g)!==d&&(e.update(g),r.set(g,d)),h.isInstancedMesh&&(h.hasEventListener("dispose",l)===!1&&h.addEventListener("dispose",l),t.update(h.instanceMatrix,34962),h.instanceColor!==null&&t.update(h.instanceColor,34962)),g}function o(){r=new WeakMap}function l(h){const d=h.target;d.removeEventListener("dispose",l),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:s,dispose:o}}const YE=new ti,ZE=new zm,KE=new rx,JE=new Fm,J1=[],Q1=[],$1=new Float32Array(16),eS=new Float32Array(9),tS=new Float32Array(4);function au(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let s=J1[r];if(s===void 0&&(s=new Float32Array(r),J1[r]=s),e!==0){n.toArray(s,0);for(let o=1,l=0;o!==e;++o)l+=t,i[o].toArray(s,l)}return s}function Xi(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function qi(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Vm(i,e){let t=Q1[e];t===void 0&&(t=new Int32Array(e),Q1[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function aN(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function lN(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Xi(t,e))return;i.uniform2fv(this.addr,e),qi(t,e)}}function cN(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.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)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Xi(t,e))return;i.uniform3fv(this.addr,e),qi(t,e)}}function uN(i,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)&&(i.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(Xi(t,e))return;i.uniform4fv(this.addr,e),qi(t,e)}}function hN(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Xi(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),qi(t,e)}else{if(Xi(t,n))return;tS.set(n),i.uniformMatrix2fv(this.addr,!1,tS),qi(t,n)}}function dN(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Xi(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),qi(t,e)}else{if(Xi(t,n))return;eS.set(n),i.uniformMatrix3fv(this.addr,!1,eS),qi(t,n)}}function pN(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Xi(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),qi(t,e)}else{if(Xi(t,n))return;$1.set(n),i.uniformMatrix4fv(this.addr,!1,$1),qi(t,n)}}function fN(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function mN(i,e){const t=this.cache;Xi(t,e)||(i.uniform2iv(this.addr,e),qi(t,e))}function vN(i,e){const t=this.cache;Xi(t,e)||(i.uniform3iv(this.addr,e),qi(t,e))}function gN(i,e){const t=this.cache;Xi(t,e)||(i.uniform4iv(this.addr,e),qi(t,e))}function yN(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function _N(i,e){const t=this.cache;Xi(t,e)||(i.uniform2uiv(this.addr,e),qi(t,e))}function xN(i,e){const t=this.cache;Xi(t,e)||(i.uniform3uiv(this.addr,e),qi(t,e))}function bN(i,e){const t=this.cache;Xi(t,e)||(i.uniform4uiv(this.addr,e),qi(t,e))}function wN(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2D(e||YE,r)}function SN(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||KE,r)}function MN(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||JE,r)}function EN(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||ZE,r)}function TN(i){switch(i){case 5126:return aN;case 35664:return lN;case 35665:return cN;case 35666:return uN;case 35674:return hN;case 35675:return dN;case 35676:return pN;case 5124:case 35670:return fN;case 35667:case 35671:return mN;case 35668:case 35672:return vN;case 35669:case 35673:return gN;case 5125:return yN;case 36294:return _N;case 36295:return xN;case 36296:return bN;case 35678:case 36198:case 36298:case 36306:case 35682:return wN;case 35679:case 36299:case 36307:return SN;case 35680:case 36300:case 36308:case 36293:return MN;case 36289:case 36303:case 36311:case 36292:return EN}}function AN(i,e){i.uniform1fv(this.addr,e)}function CN(i,e){const t=au(e,this.size,2);i.uniform2fv(this.addr,t)}function PN(i,e){const t=au(e,this.size,3);i.uniform3fv(this.addr,t)}function RN(i,e){const t=au(e,this.size,4);i.uniform4fv(this.addr,t)}function LN(i,e){const t=au(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function DN(i,e){const t=au(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function IN(i,e){const t=au(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function ON(i,e){i.uniform1iv(this.addr,e)}function kN(i,e){i.uniform2iv(this.addr,e)}function NN(i,e){i.uniform3iv(this.addr,e)}function BN(i,e){i.uniform4iv(this.addr,e)}function zN(i,e){i.uniform1uiv(this.addr,e)}function UN(i,e){i.uniform2uiv(this.addr,e)}function FN(i,e){i.uniform3uiv(this.addr,e)}function VN(i,e){i.uniform4uiv(this.addr,e)}function HN(i,e,t){const n=e.length,r=Vm(t,n);i.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)t.setTexture2D(e[s]||YE,r[s])}function GN(i,e,t){const n=e.length,r=Vm(t,n);i.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)t.setTexture3D(e[s]||KE,r[s])}function WN(i,e,t){const n=e.length,r=Vm(t,n);i.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)t.setTextureCube(e[s]||JE,r[s])}function jN(i,e,t){const n=e.length,r=Vm(t,n);i.uniform1iv(this.addr,r);for(let s=0;s!==n;++s)t.setTexture2DArray(e[s]||ZE,r[s])}function XN(i){switch(i){case 5126:return AN;case 35664:return CN;case 35665:return PN;case 35666:return RN;case 35674:return LN;case 35675:return DN;case 35676:return IN;case 5124:case 35670:return ON;case 35667:case 35671:return kN;case 35668:case 35672:return NN;case 35669:case 35673:return BN;case 5125:return zN;case 36294:return UN;case 36295:return FN;case 36296:return VN;case 35678:case 36198:case 36298:case 36306:case 35682:return HN;case 35679:case 36299:case 36307:return GN;case 35680:case 36300:case 36308:case 36293:return WN;case 36289:case 36303:case 36311:case 36292:return jN}}function qN(i,e,t){this.id=i,this.addr=t,this.cache=[],this.setValue=TN(e.type)}function YN(i,e,t){this.id=i,this.addr=t,this.cache=[],this.size=e.size,this.setValue=XN(e.type)}function QE(i){this.id=i,this.seq=[],this.map={}}QE.prototype.setValue=function(i,e,t){const n=this.seq;for(let r=0,s=n.length;r!==s;++r){const o=n[r];o.setValue(i,e[o.id],t)}};const fy=/(\w+)(\])?(\[|\.)?/g;function nS(i,e){i.seq.push(e),i.map[e.id]=e}function ZN(i,e,t){const n=i.name,r=n.length;for(fy.lastIndex=0;;){const s=fy.exec(n),o=fy.lastIndex;let l=s[1];const h=s[2]==="]",d=s[3];if(h&&(l=l|0),d===void 0||d==="["&&o+2===r){nS(t,d===void 0?new qN(l,i,e):new YN(l,i,e));break}else{let g=t.map[l];g===void 0&&(g=new QE(l),nS(t,g)),t=g}}}function ma(i,e){this.seq=[],this.map={};const t=i.getProgramParameter(e,35718);for(let n=0;n<t;++n){const r=i.getActiveUniform(e,n),s=i.getUniformLocation(e,r.name);ZN(r,s,this)}}ma.prototype.setValue=function(i,e,t,n){const r=this.map[e];r!==void 0&&r.setValue(i,t,n)};ma.prototype.setOptional=function(i,e,t){const n=e[t];n!==void 0&&this.setValue(i,t,n)};ma.upload=function(i,e,t,n){for(let r=0,s=e.length;r!==s;++r){const o=e[r],l=t[o.id];l.needsUpdate!==!1&&o.setValue(i,l.value,n)}};ma.seqWithValue=function(i,e){const t=[];for(let n=0,r=i.length;n!==r;++n){const s=i[n];s.id in e&&t.push(s)}return t};function iS(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}let KN=0;function JN(i,e){const t=i.split(`
|
||
`),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++)n.push(o+1+": "+t[o]);return n.join(`
|
||
`)}function QN(i){switch(i){case Ds:return["Linear","( value )"];case Ln:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",i),["Linear","( value )"]}}function rS(i,e,t){const n=i.getShaderParameter(e,35713),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[0]);return t.toUpperCase()+`
|
||
|
||
`+r+`
|
||
|
||
`+JN(i.getShaderSource(e),o)}else return r}function $N(i,e){const t=QN(e);return"vec4 "+i+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function eB(i,e){let t;switch(e){case BE:t="Linear";break;case dI:t="Reinhard";break;case pI:t="OptimizedCineon";break;case fI:t="ACESFilmic";break;case mI:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function tB(i){return[i.extensionDerivatives||i.envMapCubeUVHeight||i.bumpMap||i.tangentSpaceNormalMap||i.clearcoatNormalMap||i.flatShading||i.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(i.extensionFragDepth||i.logarithmicDepthBuffer)&&i.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",i.extensionDrawBuffers&&i.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(i.extensionShaderTextureLOD||i.envMap||i.transmission)&&i.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ph).join(`
|
||
`)}function nB(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
|
||
`)}function iB(i,e){const t={},n=i.getProgramParameter(e,35721);for(let r=0;r<n;r++){const s=i.getActiveAttrib(e,r),o=s.name;let l=1;s.type===35674&&(l=2),s.type===35675&&(l=3),s.type===35676&&(l=4),t[o]={type:s.type,location:i.getAttribLocation(e,o),locationSize:l}}return t}function ph(i){return i!==""}function sS(i,e){return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).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/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function oS(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const rB=/^[ \t]*#include +<([\w\d./]+)>/gm;function Zy(i){return i.replace(rB,sB)}function sB(i,e){const t=Gt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Zy(t)}const oB=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,aB=/#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 aS(i){return i.replace(aB,$E).replace(oB,lB)}function lB(i,e,t,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),$E(i,e,t,n)}function $E(i,e,t,n){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function lS(i){let e="precision "+i.precision+` float;
|
||
precision `+i.precision+" int;";return i.precision==="highp"?e+=`
|
||
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
|
||
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
|
||
#define LOW_PRECISION`),e}function cB(i){let e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===IE?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===Y4?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===dh&&(e="SHADOWMAP_TYPE_VSM"),e}function uB(i){let e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case Vc:case Hc:e="ENVMAP_TYPE_CUBE";break;case Nm:e="ENVMAP_TYPE_CUBE_UV";break}return e}function hB(i){let e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case Hc:e="ENVMAP_MODE_REFRACTION";break}return e}function dB(i){let e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case km:e="ENVMAP_BLENDING_MULTIPLY";break;case uI:e="ENVMAP_BLENDING_MIX";break;case hI:e="ENVMAP_BLENDING_ADD";break}return e}function pB(i){const e=i.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 fB(i,e,t,n){const r=i.getContext(),s=t.defines;let o=t.vertexShader,l=t.fragmentShader;const h=cB(t),d=uB(t),f=hB(t),g=dB(t),y=pB(t),_=t.isWebGL2?"":tB(t),w=nB(s),S=r.createProgram();let b,T,E=t.glslVersion?"#version "+t.glslVersion+`
|
||
`:"";t.isRawShaderMaterial?(b=[w].filter(ph).join(`
|
||
`),b.length>0&&(b+=`
|
||
`),T=[_,w].filter(ph).join(`
|
||
`),T.length>0&&(T+=`
|
||
`)):(b=[lS(t),"#define SHADER_NAME "+t.shaderName,w,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
|
||
`].filter(ph).join(`
|
||
`),T=[_,lS(t),"#define SHADER_NAME "+t.shaderName,w,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.envMap?"#define "+f:"",t.envMap?"#define "+g:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==As?"#define TONE_MAPPING":"",t.toneMapping!==As?Gt.tonemapping_pars_fragment:"",t.toneMapping!==As?eB("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Gt.encodings_pars_fragment,$N("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
|
||
`].filter(ph).join(`
|
||
`)),o=Zy(o),o=sS(o,t),o=oS(o,t),l=Zy(l),l=sS(l,t),l=oS(l,t),o=aS(o),l=aS(l),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(E=`#version 300 es
|
||
`,b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
|
||
`)+`
|
||
`+b,T=["#define varying in",t.glslVersion===L1?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===L1?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
|
||
`)+`
|
||
`+T);const C=E+b+o,A=E+T+l,D=iS(r,35633,C),I=iS(r,35632,A);if(r.attachShader(S,D),r.attachShader(S,I),t.index0AttributeName!==void 0?r.bindAttribLocation(S,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(S,0,"position"),r.linkProgram(S),i.debug.checkShaderErrors){const k=r.getProgramInfoLog(S).trim(),j=r.getShaderInfoLog(D).trim(),G=r.getShaderInfoLog(I).trim();let ne=!0,ce=!0;if(r.getProgramParameter(S,35714)===!1){ne=!1;const Z=rS(r,D,"vertex"),$=rS(r,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(S,35715)+`
|
||
|
||
Program Info Log: `+k+`
|
||
`+Z+`
|
||
`+$)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(j===""||G==="")&&(ce=!1);ce&&(this.diagnostics={runnable:ne,programLog:k,vertexShader:{log:j,prefix:b},fragmentShader:{log:G,prefix:T}})}r.deleteShader(D),r.deleteShader(I);let F;this.getUniforms=function(){return F===void 0&&(F=new ma(r,S)),F};let P;return this.getAttributes=function(){return P===void 0&&(P=iB(r,S)),P},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(S),this.program=void 0},this.name=t.shaderName,this.id=KN++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=D,this.fragmentShader=I,this}let mB=0;class vB{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.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;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const n=new gB(e);t.set(e,n)}return t.get(e)}}class gB{constructor(e){this.id=mB++,this.code=e,this.usedTimes=0}}function yB(i,e,t,n,r,s,o){const l=new sx,h=new vB,d=[],f=r.isWebGL2,g=r.logarithmicDepthBuffer,y=r.vertexTextures;let _=r.precision;const w={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 S(P,k,j,G,ne){const ce=G.fog,Z=ne.geometry,$=P.isMeshStandardMaterial?G.environment:null,K=(P.isMeshStandardMaterial?t:e).get(P.envMap||$),pe=K&&K.mapping===Nm?K.image.height:null,re=w[P.type];P.precision!==null&&(_=r.getMaxPrecision(P.precision),_!==P.precision&&console.warn("THREE.WebGLProgram.getParameters:",P.precision,"not supported, using",_,"instead."));const se=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,ue=se!==void 0?se.length:0;let Te=0;Z.morphAttributes.position!==void 0&&(Te=1),Z.morphAttributes.normal!==void 0&&(Te=2),Z.morphAttributes.color!==void 0&&(Te=3);let fe,Ce,qe,Ke;if(re){const Le=Ms[re];fe=Le.vertexShader,Ce=Le.fragmentShader}else fe=P.vertexShader,Ce=P.fragmentShader,h.update(P),qe=h.getVertexShaderID(P),Ke=h.getFragmentShaderID(P);const me=i.getRenderTarget(),Ut=P.alphaTest>0,nt=P.clearcoat>0;return{isWebGL2:f,shaderID:re,shaderName:P.type,vertexShader:fe,fragmentShader:Ce,defines:P.defines,customVertexShaderID:qe,customFragmentShaderID:Ke,isRawShaderMaterial:P.isRawShaderMaterial===!0,glslVersion:P.glslVersion,precision:_,instancing:ne.isInstancedMesh===!0,instancingColor:ne.isInstancedMesh===!0&&ne.instanceColor!==null,supportsVertexTextures:y,outputEncoding:me===null?i.outputEncoding:me.isXRRenderTarget===!0?me.texture.encoding:Ds,map:!!P.map,matcap:!!P.matcap,envMap:!!K,envMapMode:K&&K.mapping,envMapCubeUVHeight:pe,lightMap:!!P.lightMap,aoMap:!!P.aoMap,emissiveMap:!!P.emissiveMap,bumpMap:!!P.bumpMap,normalMap:!!P.normalMap,objectSpaceNormalMap:P.normalMapType===FE,tangentSpaceNormalMap:P.normalMapType===_l,decodeVideoTexture:!!P.map&&P.map.isVideoTexture===!0&&P.map.encoding===Ln,clearcoat:nt,clearcoatMap:nt&&!!P.clearcoatMap,clearcoatRoughnessMap:nt&&!!P.clearcoatRoughnessMap,clearcoatNormalMap:nt&&!!P.clearcoatNormalMap,displacementMap:!!P.displacementMap,roughnessMap:!!P.roughnessMap,metalnessMap:!!P.metalnessMap,specularMap:!!P.specularMap,specularIntensityMap:!!P.specularIntensityMap,specularColorMap:!!P.specularColorMap,opaque:P.transparent===!1&&P.blending===yo,alphaMap:!!P.alphaMap,alphaTest:Ut,gradientMap:!!P.gradientMap,sheen:P.sheen>0,sheenColorMap:!!P.sheenColorMap,sheenRoughnessMap:!!P.sheenRoughnessMap,transmission:P.transmission>0,transmissionMap:!!P.transmissionMap,thicknessMap:!!P.thicknessMap,combine:P.combine,vertexTangents:!!P.normalMap&&!!Z.attributes.tangent,vertexColors:P.vertexColors,vertexAlphas:P.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,vertexUvs:!!P.map||!!P.bumpMap||!!P.normalMap||!!P.specularMap||!!P.alphaMap||!!P.emissiveMap||!!P.roughnessMap||!!P.metalnessMap||!!P.clearcoatMap||!!P.clearcoatRoughnessMap||!!P.clearcoatNormalMap||!!P.displacementMap||!!P.transmissionMap||!!P.thicknessMap||!!P.specularIntensityMap||!!P.specularColorMap||!!P.sheenColorMap||!!P.sheenRoughnessMap,uvsVertexOnly:!(P.map||P.bumpMap||P.normalMap||P.specularMap||P.alphaMap||P.emissiveMap||P.roughnessMap||P.metalnessMap||P.clearcoatNormalMap||P.transmission>0||P.transmissionMap||P.thicknessMap||P.specularIntensityMap||P.specularColorMap||P.sheen>0||P.sheenColorMap||P.sheenRoughnessMap)&&!!P.displacementMap,fog:!!ce,useFog:P.fog===!0,fogExp2:ce&&ce.isFogExp2,flatShading:!!P.flatShading,sizeAttenuation:P.sizeAttenuation,logarithmicDepthBuffer:g,skinning:ne.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:ue,morphTextureStride:Te,numDirLights:k.directional.length,numPointLights:k.point.length,numSpotLights:k.spot.length,numRectAreaLights:k.rectArea.length,numHemiLights:k.hemi.length,numDirLightShadows:k.directionalShadowMap.length,numPointLightShadows:k.pointShadowMap.length,numSpotLightShadows:k.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:P.dithering,shadowMapEnabled:i.shadowMap.enabled&&j.length>0,shadowMapType:i.shadowMap.type,toneMapping:P.toneMapped?i.toneMapping:As,physicallyCorrectLights:i.physicallyCorrectLights,premultipliedAlpha:P.premultipliedAlpha,doubleSided:P.side===_a,flipSided:P.side===xr,useDepthPacking:!!P.depthPacking,depthPacking:P.depthPacking||0,index0AttributeName:P.index0AttributeName,extensionDerivatives:P.extensions&&P.extensions.derivatives,extensionFragDepth:P.extensions&&P.extensions.fragDepth,extensionDrawBuffers:P.extensions&&P.extensions.drawBuffers,extensionShaderTextureLOD:P.extensions&&P.extensions.shaderTextureLOD,rendererExtensionFragDepth:f||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:f||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:f||n.has("EXT_shader_texture_lod"),customProgramCacheKey:P.customProgramCacheKey()}}function b(P){const k=[];if(P.shaderID?k.push(P.shaderID):(k.push(P.customVertexShaderID),k.push(P.customFragmentShaderID)),P.defines!==void 0)for(const j in P.defines)k.push(j),k.push(P.defines[j]);return P.isRawShaderMaterial===!1&&(T(k,P),E(k,P),k.push(i.outputEncoding)),k.push(P.customProgramCacheKey),k.join()}function T(P,k){P.push(k.precision),P.push(k.outputEncoding),P.push(k.envMapMode),P.push(k.envMapCubeUVHeight),P.push(k.combine),P.push(k.vertexUvs),P.push(k.fogExp2),P.push(k.sizeAttenuation),P.push(k.morphTargetsCount),P.push(k.morphAttributeCount),P.push(k.numDirLights),P.push(k.numPointLights),P.push(k.numSpotLights),P.push(k.numHemiLights),P.push(k.numRectAreaLights),P.push(k.numDirLightShadows),P.push(k.numPointLightShadows),P.push(k.numSpotLightShadows),P.push(k.shadowMapType),P.push(k.toneMapping),P.push(k.numClippingPlanes),P.push(k.numClipIntersection),P.push(k.depthPacking)}function E(P,k){l.disableAll(),k.isWebGL2&&l.enable(0),k.supportsVertexTextures&&l.enable(1),k.instancing&&l.enable(2),k.instancingColor&&l.enable(3),k.map&&l.enable(4),k.matcap&&l.enable(5),k.envMap&&l.enable(6),k.lightMap&&l.enable(7),k.aoMap&&l.enable(8),k.emissiveMap&&l.enable(9),k.bumpMap&&l.enable(10),k.normalMap&&l.enable(11),k.objectSpaceNormalMap&&l.enable(12),k.tangentSpaceNormalMap&&l.enable(13),k.clearcoat&&l.enable(14),k.clearcoatMap&&l.enable(15),k.clearcoatRoughnessMap&&l.enable(16),k.clearcoatNormalMap&&l.enable(17),k.displacementMap&&l.enable(18),k.specularMap&&l.enable(19),k.roughnessMap&&l.enable(20),k.metalnessMap&&l.enable(21),k.gradientMap&&l.enable(22),k.alphaMap&&l.enable(23),k.alphaTest&&l.enable(24),k.vertexColors&&l.enable(25),k.vertexAlphas&&l.enable(26),k.vertexUvs&&l.enable(27),k.vertexTangents&&l.enable(28),k.uvsVertexOnly&&l.enable(29),k.fog&&l.enable(30),P.push(l.mask),l.disableAll(),k.useFog&&l.enable(0),k.flatShading&&l.enable(1),k.logarithmicDepthBuffer&&l.enable(2),k.skinning&&l.enable(3),k.morphTargets&&l.enable(4),k.morphNormals&&l.enable(5),k.morphColors&&l.enable(6),k.premultipliedAlpha&&l.enable(7),k.shadowMapEnabled&&l.enable(8),k.physicallyCorrectLights&&l.enable(9),k.doubleSided&&l.enable(10),k.flipSided&&l.enable(11),k.useDepthPacking&&l.enable(12),k.dithering&&l.enable(13),k.specularIntensityMap&&l.enable(14),k.specularColorMap&&l.enable(15),k.transmission&&l.enable(16),k.transmissionMap&&l.enable(17),k.thicknessMap&&l.enable(18),k.sheen&&l.enable(19),k.sheenColorMap&&l.enable(20),k.sheenRoughnessMap&&l.enable(21),k.decodeVideoTexture&&l.enable(22),k.opaque&&l.enable(23),P.push(l.mask)}function C(P){const k=w[P.type];let j;if(k){const G=Ms[k];j=Qn.clone(G.uniforms)}else j=P.uniforms;return j}function A(P,k){let j;for(let G=0,ne=d.length;G<ne;G++){const ce=d[G];if(ce.cacheKey===k){j=ce,++j.usedTimes;break}}return j===void 0&&(j=new fB(i,k,P,s),d.push(j)),j}function D(P){if(--P.usedTimes===0){const k=d.indexOf(P);d[k]=d[d.length-1],d.pop(),P.destroy()}}function I(P){h.remove(P)}function F(){h.dispose()}return{getParameters:S,getProgramCacheKey:b,getUniforms:C,acquireProgram:A,releaseProgram:D,releaseShaderCache:I,programs:d,dispose:F}}function _B(){let i=new WeakMap;function e(s){let o=i.get(s);return o===void 0&&(o={},i.set(s,o)),o}function t(s){i.delete(s)}function n(s,o,l){i.get(s)[o]=l}function r(){i=new WeakMap}return{get:e,remove:t,update:n,dispose:r}}function xB(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.z!==e.z?i.z-e.z:i.id-e.id}function cS(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function uS(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(g,y,_,w,S,b){let T=i[e];return T===void 0?(T={id:g.id,object:g,geometry:y,material:_,groupOrder:w,renderOrder:g.renderOrder,z:S,group:b},i[e]=T):(T.id=g.id,T.object=g,T.geometry=y,T.material=_,T.groupOrder=w,T.renderOrder=g.renderOrder,T.z=S,T.group=b),e++,T}function l(g,y,_,w,S,b){const T=o(g,y,_,w,S,b);_.transmission>0?n.push(T):_.transparent===!0?r.push(T):t.push(T)}function h(g,y,_,w,S,b){const T=o(g,y,_,w,S,b);_.transmission>0?n.unshift(T):_.transparent===!0?r.unshift(T):t.unshift(T)}function d(g,y){t.length>1&&t.sort(g||xB),n.length>1&&n.sort(y||cS),r.length>1&&r.sort(y||cS)}function f(){for(let g=e,y=i.length;g<y;g++){const _=i[g];if(_.id===null)break;_.id=null,_.object=null,_.geometry=null,_.material=null,_.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:h,finish:f,sort:d}}function bB(){let i=new WeakMap;function e(n,r){let s;return i.has(n)===!1?(s=new uS,i.set(n,[s])):r>=i.get(n).length?(s=new uS,i.get(n).push(s)):s=i.get(n)[r],s}function t(){i=new WeakMap}return{get:e,dispose:t}}function wB(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new z,color:new Pe};break;case"SpotLight":t={position:new z,direction:new z,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new z,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new z,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new z,halfWidth:new z,halfHeight:new z};break}return i[e.id]=t,t}}}function SB(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ae};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ae};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ae,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let MB=0;function EB(i,e){return(e.castShadow?1:0)-(i.castShadow?1:0)}function TB(i,e){const t=new wB,n=SB(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let f=0;f<9;f++)r.probe.push(new z);const s=new z,o=new Qe,l=new Qe;function h(f,g){let y=0,_=0,w=0;for(let k=0;k<9;k++)r.probe[k].set(0,0,0);let S=0,b=0,T=0,E=0,C=0,A=0,D=0,I=0;f.sort(EB);const F=g!==!0?Math.PI:1;for(let k=0,j=f.length;k<j;k++){const G=f[k],ne=G.color,ce=G.intensity,Z=G.distance,$=G.shadow&&G.shadow.map?G.shadow.map.texture:null;if(G.isAmbientLight)y+=ne.r*ce*F,_+=ne.g*ce*F,w+=ne.b*ce*F;else if(G.isLightProbe)for(let K=0;K<9;K++)r.probe[K].addScaledVector(G.sh.coefficients[K],ce);else if(G.isDirectionalLight){const K=t.get(G);if(K.color.copy(G.color).multiplyScalar(G.intensity*F),G.castShadow){const pe=G.shadow,re=n.get(G);re.shadowBias=pe.bias,re.shadowNormalBias=pe.normalBias,re.shadowRadius=pe.radius,re.shadowMapSize=pe.mapSize,r.directionalShadow[S]=re,r.directionalShadowMap[S]=$,r.directionalShadowMatrix[S]=G.shadow.matrix,A++}r.directional[S]=K,S++}else if(G.isSpotLight){const K=t.get(G);if(K.position.setFromMatrixPosition(G.matrixWorld),K.color.copy(ne).multiplyScalar(ce*F),K.distance=Z,K.coneCos=Math.cos(G.angle),K.penumbraCos=Math.cos(G.angle*(1-G.penumbra)),K.decay=G.decay,G.castShadow){const pe=G.shadow,re=n.get(G);re.shadowBias=pe.bias,re.shadowNormalBias=pe.normalBias,re.shadowRadius=pe.radius,re.shadowMapSize=pe.mapSize,r.spotShadow[T]=re,r.spotShadowMap[T]=$,r.spotShadowMatrix[T]=G.shadow.matrix,I++}r.spot[T]=K,T++}else if(G.isRectAreaLight){const K=t.get(G);K.color.copy(ne).multiplyScalar(ce),K.halfWidth.set(G.width*.5,0,0),K.halfHeight.set(0,G.height*.5,0),r.rectArea[E]=K,E++}else if(G.isPointLight){const K=t.get(G);if(K.color.copy(G.color).multiplyScalar(G.intensity*F),K.distance=G.distance,K.decay=G.decay,G.castShadow){const pe=G.shadow,re=n.get(G);re.shadowBias=pe.bias,re.shadowNormalBias=pe.normalBias,re.shadowRadius=pe.radius,re.shadowMapSize=pe.mapSize,re.shadowCameraNear=pe.camera.near,re.shadowCameraFar=pe.camera.far,r.pointShadow[b]=re,r.pointShadowMap[b]=$,r.pointShadowMatrix[b]=G.shadow.matrix,D++}r.point[b]=K,b++}else if(G.isHemisphereLight){const K=t.get(G);K.skyColor.copy(G.color).multiplyScalar(ce*F),K.groundColor.copy(G.groundColor).multiplyScalar(ce*F),r.hemi[C]=K,C++}}E>0&&(e.isWebGL2||i.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=He.LTC_FLOAT_1,r.rectAreaLTC2=He.LTC_FLOAT_2):i.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=He.LTC_HALF_1,r.rectAreaLTC2=He.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=y,r.ambient[1]=_,r.ambient[2]=w;const P=r.hash;(P.directionalLength!==S||P.pointLength!==b||P.spotLength!==T||P.rectAreaLength!==E||P.hemiLength!==C||P.numDirectionalShadows!==A||P.numPointShadows!==D||P.numSpotShadows!==I)&&(r.directional.length=S,r.spot.length=T,r.rectArea.length=E,r.point.length=b,r.hemi.length=C,r.directionalShadow.length=A,r.directionalShadowMap.length=A,r.pointShadow.length=D,r.pointShadowMap.length=D,r.spotShadow.length=I,r.spotShadowMap.length=I,r.directionalShadowMatrix.length=A,r.pointShadowMatrix.length=D,r.spotShadowMatrix.length=I,P.directionalLength=S,P.pointLength=b,P.spotLength=T,P.rectAreaLength=E,P.hemiLength=C,P.numDirectionalShadows=A,P.numPointShadows=D,P.numSpotShadows=I,r.version=MB++)}function d(f,g){let y=0,_=0,w=0,S=0,b=0;const T=g.matrixWorldInverse;for(let E=0,C=f.length;E<C;E++){const A=f[E];if(A.isDirectionalLight){const D=r.directional[y];D.direction.setFromMatrixPosition(A.matrixWorld),s.setFromMatrixPosition(A.target.matrixWorld),D.direction.sub(s),D.direction.transformDirection(T),y++}else if(A.isSpotLight){const D=r.spot[w];D.position.setFromMatrixPosition(A.matrixWorld),D.position.applyMatrix4(T),D.direction.setFromMatrixPosition(A.matrixWorld),s.setFromMatrixPosition(A.target.matrixWorld),D.direction.sub(s),D.direction.transformDirection(T),w++}else if(A.isRectAreaLight){const D=r.rectArea[S];D.position.setFromMatrixPosition(A.matrixWorld),D.position.applyMatrix4(T),l.identity(),o.copy(A.matrixWorld),o.premultiply(T),l.extractRotation(o),D.halfWidth.set(A.width*.5,0,0),D.halfHeight.set(0,A.height*.5,0),D.halfWidth.applyMatrix4(l),D.halfHeight.applyMatrix4(l),S++}else if(A.isPointLight){const D=r.point[_];D.position.setFromMatrixPosition(A.matrixWorld),D.position.applyMatrix4(T),_++}else if(A.isHemisphereLight){const D=r.hemi[b];D.direction.setFromMatrixPosition(A.matrixWorld),D.direction.transformDirection(T),b++}}}return{setup:h,setupView:d,state:r}}function hS(i,e){const t=new TB(i,e),n=[],r=[];function s(){n.length=0,r.length=0}function o(g){n.push(g)}function l(g){r.push(g)}function h(g){t.setup(n,g)}function d(g){t.setupView(n,g)}return{init:s,state:{lightsArray:n,shadowsArray:r,lights:t},setupLights:h,setupLightsView:d,pushLight:o,pushShadow:l}}function AB(i,e){let t=new WeakMap;function n(s,o=0){let l;return t.has(s)===!1?(l=new hS(i,e),t.set(s,[l])):o>=t.get(s).length?(l=new hS(i,e),t.get(s).push(l)):l=t.get(s)[o],l}function r(){t=new WeakMap}return{get:n,dispose:r}}class lu extends li{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=OI,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}}lu.prototype.isMeshDepthMaterial=!0;class lx extends li{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new z,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}lx.prototype.isMeshDistanceMaterial=!0;const CB=`void main() {
|
||
gl_Position = vec4( position, 1.0 );
|
||
}`,PB=`uniform sampler2D shadow_pass;
|
||
uniform vec2 resolution;
|
||
uniform float radius;
|
||
#include <packing>
|
||
void main() {
|
||
const float samples = float( VSM_SAMPLES );
|
||
float mean = 0.0;
|
||
float squared_mean = 0.0;
|
||
float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
|
||
float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
|
||
for ( float i = 0.0; i < samples; i ++ ) {
|
||
float uvOffset = uvStart + i * uvStride;
|
||
#ifdef HORIZONTAL_PASS
|
||
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
|
||
mean += distribution.x;
|
||
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
|
||
#else
|
||
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
|
||
mean += depth;
|
||
squared_mean += depth * depth;
|
||
#endif
|
||
}
|
||
mean = mean / samples;
|
||
squared_mean = squared_mean / samples;
|
||
float std_dev = sqrt( squared_mean - mean * mean );
|
||
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
||
}`;function e2(i,e,t){let n=new ad;const r=new ae,s=new ae,o=new dn,l=new lu({depthPacking:Bm}),h=new lx,d={},f=t.maxTextureSize,g={0:xr,1:Oh,2:_a},y=new kt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ae},radius:{value:4}},vertexShader:CB,fragmentShader:PB}),_=y.clone();_.defines.HORIZONTAL_PASS=1;const w=new zt;w.setAttribute("position",new Wn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new In(w,y),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=IE,this.render=function(A,D,I){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||A.length===0)return;const F=i.getRenderTarget(),P=i.getActiveCubeFace(),k=i.getActiveMipmapLevel(),j=i.state;j.setBlending(rn),j.buffers.color.setClear(1,1,1,1),j.buffers.depth.setTest(!0),j.setScissorTest(!1);for(let G=0,ne=A.length;G<ne;G++){const ce=A[G],Z=ce.shadow;if(Z===void 0){console.warn("THREE.WebGLShadowMap:",ce,"has no shadow.");continue}if(Z.autoUpdate===!1&&Z.needsUpdate===!1)continue;r.copy(Z.mapSize);const $=Z.getFrameExtents();if(r.multiply($),s.copy(Z.mapSize),(r.x>f||r.y>f)&&(r.x>f&&(s.x=Math.floor(f/$.x),r.x=s.x*$.x,Z.mapSize.x=s.x),r.y>f&&(s.y=Math.floor(f/$.y),r.y=s.y*$.y,Z.mapSize.y=s.y)),Z.map===null&&!Z.isPointLightShadow&&this.type===dh&&(Z.map=new Yt(r.x,r.y),Z.map.texture.name=ce.name+".shadowMap",Z.mapPass=new Yt(r.x,r.y),Z.camera.updateProjectionMatrix()),Z.map===null){const pe={minFilter:Xt,magFilter:Xt,format:Or};Z.map=new Yt(r.x,r.y,pe),Z.map.texture.name=ce.name+".shadowMap",Z.camera.updateProjectionMatrix()}i.setRenderTarget(Z.map),i.clear();const K=Z.getViewportCount();for(let pe=0;pe<K;pe++){const re=Z.getViewport(pe);o.set(s.x*re.x,s.y*re.y,s.x*re.z,s.y*re.w),j.viewport(o),Z.updateMatrices(ce,pe),n=Z.getFrustum(),C(D,I,Z.camera,ce,this.type)}!Z.isPointLightShadow&&this.type===dh&&T(Z,I),Z.needsUpdate=!1}b.needsUpdate=!1,i.setRenderTarget(F,P,k)};function T(A,D){const I=e.update(S);y.defines.VSM_SAMPLES!==A.blurSamples&&(y.defines.VSM_SAMPLES=A.blurSamples,_.defines.VSM_SAMPLES=A.blurSamples,y.needsUpdate=!0,_.needsUpdate=!0),y.uniforms.shadow_pass.value=A.map.texture,y.uniforms.resolution.value=A.mapSize,y.uniforms.radius.value=A.radius,i.setRenderTarget(A.mapPass),i.clear(),i.renderBufferDirect(D,null,I,y,S,null),_.uniforms.shadow_pass.value=A.mapPass.texture,_.uniforms.resolution.value=A.mapSize,_.uniforms.radius.value=A.radius,i.setRenderTarget(A.map),i.clear(),i.renderBufferDirect(D,null,I,_,S,null)}function E(A,D,I,F,P,k){let j=null;const G=I.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(G!==void 0?j=G:j=I.isPointLight===!0?h:l,i.localClippingEnabled&&D.clipShadows===!0&&D.clippingPlanes.length!==0||D.displacementMap&&D.displacementScale!==0||D.alphaMap&&D.alphaTest>0){const ne=j.uuid,ce=D.uuid;let Z=d[ne];Z===void 0&&(Z={},d[ne]=Z);let $=Z[ce];$===void 0&&($=j.clone(),Z[ce]=$),j=$}return j.visible=D.visible,j.wireframe=D.wireframe,k===dh?j.side=D.shadowSide!==null?D.shadowSide:D.side:j.side=D.shadowSide!==null?D.shadowSide:g[D.side],j.alphaMap=D.alphaMap,j.alphaTest=D.alphaTest,j.clipShadows=D.clipShadows,j.clippingPlanes=D.clippingPlanes,j.clipIntersection=D.clipIntersection,j.displacementMap=D.displacementMap,j.displacementScale=D.displacementScale,j.displacementBias=D.displacementBias,j.wireframeLinewidth=D.wireframeLinewidth,j.linewidth=D.linewidth,I.isPointLight===!0&&j.isMeshDistanceMaterial===!0&&(j.referencePosition.setFromMatrixPosition(I.matrixWorld),j.nearDistance=F,j.farDistance=P),j}function C(A,D,I,F,P){if(A.visible===!1)return;if(A.layers.test(D.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&P===dh)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,A.matrixWorld);const G=e.update(A),ne=A.material;if(Array.isArray(ne)){const ce=G.groups;for(let Z=0,$=ce.length;Z<$;Z++){const K=ce[Z],pe=ne[K.materialIndex];if(pe&&pe.visible){const re=E(A,pe,F,I.near,I.far,P);i.renderBufferDirect(I,null,G,re,A,K)}}}else if(ne.visible){const ce=E(A,ne,F,I.near,I.far,P);i.renderBufferDirect(I,null,G,ce,A,null)}}const j=A.children;for(let G=0,ne=j.length;G<ne;G++)C(j[G],D,I,F,P)}}function RB(i,e,t){const n=t.isWebGL2;function r(){let X=!1;const Re=new dn;let De=null;const at=new dn(0,0,0,0);return{setMask:function(ze){De!==ze&&!X&&(i.colorMask(ze,ze,ze,ze),De=ze)},setLocked:function(ze){X=ze},setClear:function(ze,et,Ie,ct,wt){wt===!0&&(ze*=ct,et*=ct,Ie*=ct),Re.set(ze,et,Ie,ct),at.equals(Re)===!1&&(i.clearColor(ze,et,Ie,ct),at.copy(Re))},reset:function(){X=!1,De=null,at.set(-1,0,0,0)}}}function s(){let X=!1,Re=null,De=null,at=null;return{setTest:function(ze){ze?Ke(2929):me(2929)},setMask:function(ze){Re!==ze&&!X&&(i.depthMask(ze),Re=ze)},setFunc:function(ze){if(De!==ze){if(ze)switch(ze){case iI:i.depthFunc(512);break;case rI:i.depthFunc(519);break;case sI:i.depthFunc(513);break;case Hy:i.depthFunc(515);break;case oI:i.depthFunc(514);break;case aI:i.depthFunc(518);break;case lI:i.depthFunc(516);break;case cI:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);De=ze}},setLocked:function(ze){X=ze},setClear:function(ze){at!==ze&&(i.clearDepth(ze),at=ze)},reset:function(){X=!1,Re=null,De=null,at=null}}}function o(){let X=!1,Re=null,De=null,at=null,ze=null,et=null,Ie=null,ct=null,wt=null;return{setTest:function(Ct){X||(Ct?Ke(2960):me(2960))},setMask:function(Ct){Re!==Ct&&!X&&(i.stencilMask(Ct),Re=Ct)},setFunc:function(Ct,jn,Yi){(De!==Ct||at!==jn||ze!==Yi)&&(i.stencilFunc(Ct,jn,Yi),De=Ct,at=jn,ze=Yi)},setOp:function(Ct,jn,Yi){(et!==Ct||Ie!==jn||ct!==Yi)&&(i.stencilOp(Ct,jn,Yi),et=Ct,Ie=jn,ct=Yi)},setLocked:function(Ct){X=Ct},setClear:function(Ct){wt!==Ct&&(i.clearStencil(Ct),wt=Ct)},reset:function(){X=!1,Re=null,De=null,at=null,ze=null,et=null,Ie=null,ct=null,wt=null}}}const l=new r,h=new s,d=new o;let f={},g={},y=new WeakMap,_=[],w=null,S=!1,b=null,T=null,E=null,C=null,A=null,D=null,I=null,F=!1,P=null,k=null,j=null,G=null,ne=null;const ce=i.getParameter(35661);let Z=!1,$=0;const K=i.getParameter(7938);K.indexOf("WebGL")!==-1?($=parseFloat(/^WebGL (\d)/.exec(K)[1]),Z=$>=1):K.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),Z=$>=2);let pe=null,re={};const se=i.getParameter(3088),ue=i.getParameter(2978),Te=new dn().fromArray(se),fe=new dn().fromArray(ue);function Ce(X,Re,De){const at=new Uint8Array(4),ze=i.createTexture();i.bindTexture(X,ze),i.texParameteri(X,10241,9728),i.texParameteri(X,10240,9728);for(let et=0;et<De;et++)i.texImage2D(Re+et,0,6408,1,1,0,6408,5121,at);return ze}const qe={};qe[3553]=Ce(3553,3553,1),qe[34067]=Ce(34067,34069,6),l.setClear(0,0,0,1),h.setClear(1),d.setClear(0),Ke(2929),h.setFunc(Hy),Ae(!1),We(i1),Ke(2884),ve(rn);function Ke(X){f[X]!==!0&&(i.enable(X),f[X]=!0)}function me(X){f[X]!==!1&&(i.disable(X),f[X]=!1)}function Ut(X,Re){return g[X]!==Re?(i.bindFramebuffer(X,Re),g[X]=Re,n&&(X===36009&&(g[36160]=Re),X===36160&&(g[36009]=Re)),!0):!1}function nt(X,Re){let De=_,at=!1;if(X)if(De=y.get(Re),De===void 0&&(De=[],y.set(Re,De)),X.isWebGLMultipleRenderTargets){const ze=X.texture;if(De.length!==ze.length||De[0]!==36064){for(let et=0,Ie=ze.length;et<Ie;et++)De[et]=36064+et;De.length=ze.length,at=!0}}else De[0]!==36064&&(De[0]=36064,at=!0);else De[0]!==1029&&(De[0]=1029,at=!0);at&&(t.isWebGL2?i.drawBuffers(De):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(De))}function it(X){return w!==X?(i.useProgram(X),w=X,!0):!1}const Le={[Es]:32774,[Z4]:32778,[K4]:32779};if(n)Le[o1]=32775,Le[a1]=32776;else{const X=e.get("EXT_blend_minmax");X!==null&&(Le[o1]=X.MIN_EXT,Le[a1]=X.MAX_EXT)}const vt={[Vy]:0,[J4]:1,[Q4]:768,[$f]:770,[nI]:776,[NE]:774,[kE]:772,[$4]:769,[em]:771,[tI]:775,[eI]:773};function ve(X,Re,De,at,ze,et,Ie,ct){if(X===rn){S===!0&&(me(3042),S=!1);return}if(S===!1&&(Ke(3042),S=!0),X!==Fy){if(X!==b||ct!==F){if((T!==Es||A!==Es)&&(i.blendEquation(32774),T=Es,A=Es),ct)switch(X){case yo:i.blendFuncSeparate(1,771,1,771);break;case Qf:i.blendFunc(1,1);break;case r1:i.blendFuncSeparate(0,769,0,1);break;case s1:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}else switch(X){case yo:i.blendFuncSeparate(770,771,1,771);break;case Qf:i.blendFunc(770,1);break;case r1:i.blendFuncSeparate(0,769,0,1);break;case s1:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",X);break}E=null,C=null,D=null,I=null,b=X,F=ct}return}ze=ze||Re,et=et||De,Ie=Ie||at,(Re!==T||ze!==A)&&(i.blendEquationSeparate(Le[Re],Le[ze]),T=Re,A=ze),(De!==E||at!==C||et!==D||Ie!==I)&&(i.blendFuncSeparate(vt[De],vt[at],vt[et],vt[Ie]),E=De,C=at,D=et,I=Ie),b=X,F=null}function xe(X,Re){X.side===_a?me(2884):Ke(2884);let De=X.side===xr;Re&&(De=!De),Ae(De),X.blending===yo&&X.transparent===!1?ve(rn):ve(X.blending,X.blendEquation,X.blendSrc,X.blendDst,X.blendEquationAlpha,X.blendSrcAlpha,X.blendDstAlpha,X.premultipliedAlpha),h.setFunc(X.depthFunc),h.setTest(X.depthTest),h.setMask(X.depthWrite),l.setMask(X.colorWrite);const at=X.stencilWrite;d.setTest(at),at&&(d.setMask(X.stencilWriteMask),d.setFunc(X.stencilFunc,X.stencilRef,X.stencilFuncMask),d.setOp(X.stencilFail,X.stencilZFail,X.stencilZPass)),rt(X.polygonOffset,X.polygonOffsetFactor,X.polygonOffsetUnits),X.alphaToCoverage===!0?Ke(32926):me(32926)}function Ae(X){P!==X&&(X?i.frontFace(2304):i.frontFace(2305),P=X)}function We(X){X!==X4?(Ke(2884),X!==k&&(X===i1?i.cullFace(1029):X===q4?i.cullFace(1028):i.cullFace(1032))):me(2884),k=X}function Be(X){X!==j&&(Z&&i.lineWidth(X),j=X)}function rt(X,Re,De){X?(Ke(32823),(G!==Re||ne!==De)&&(i.polygonOffset(Re,De),G=Re,ne=De)):me(32823)}function ot(X){X?Ke(3089):me(3089)}function st(X){X===void 0&&(X=33984+ce-1),pe!==X&&(i.activeTexture(X),pe=X)}function Ft(X,Re){pe===null&&st();let De=re[pe];De===void 0&&(De={type:void 0,texture:void 0},re[pe]=De),(De.type!==X||De.texture!==Re)&&(i.bindTexture(X,Re||qe[X]),De.type=X,De.texture=Re)}function yt(){const X=re[pe];X!==void 0&&X.type!==void 0&&(i.bindTexture(X.type,null),X.type=void 0,X.texture=void 0)}function H(){try{i.compressedTexImage2D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function B(){try{i.texSubImage2D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function he(){try{i.texSubImage3D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function we(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ne(){try{i.texStorage2D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ue(){try{i.texStorage3D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Xe(){try{i.texImage2D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function U(){try{i.texImage3D.apply(i,arguments)}catch(X){console.error("THREE.WebGLState:",X)}}function Ee(X){Te.equals(X)===!1&&(i.scissor(X.x,X.y,X.z,X.w),Te.copy(X))}function Je(X){fe.equals(X)===!1&&(i.viewport(X.x,X.y,X.z,X.w),fe.copy(X))}function ke(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),n===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),f={},pe=null,re={},g={},y=new WeakMap,_=[],w=null,S=!1,b=null,T=null,E=null,C=null,A=null,D=null,I=null,F=!1,P=null,k=null,j=null,G=null,ne=null,Te.set(0,0,i.canvas.width,i.canvas.height),fe.set(0,0,i.canvas.width,i.canvas.height),l.reset(),h.reset(),d.reset()}return{buffers:{color:l,depth:h,stencil:d},enable:Ke,disable:me,bindFramebuffer:Ut,drawBuffers:nt,useProgram:it,setBlending:ve,setMaterial:xe,setFlipSided:Ae,setCullFace:We,setLineWidth:Be,setPolygonOffset:rt,setScissorTest:ot,activeTexture:st,bindTexture:Ft,unbindTexture:yt,compressedTexImage2D:H,texImage2D:Xe,texImage3D:U,texStorage2D:Ne,texStorage3D:Ue,texSubImage2D:B,texSubImage3D:he,compressedTexSubImage2D:we,scissor:Ee,viewport:Je,reset:ke}}function LB(i,e,t,n,r,s,o){const l=r.isWebGL2,h=r.maxTextures,d=r.maxCubemapSize,f=r.maxTextureSize,g=r.maxSamples,y=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,_=/OculusBrowser/g.test(navigator.userAgent),w=new WeakMap;let S;const b=new WeakMap;let T=!1;try{T=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function E(H,B){return T?new OffscreenCanvas(H,B):Uh("canvas")}function C(H,B,he,we){let Ne=1;if((H.width>we||H.height>we)&&(Ne=we/Math.max(H.width,H.height)),Ne<1||B===!0)if(typeof HTMLImageElement<"u"&&H instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&H instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&H instanceof ImageBitmap){const Ue=B?sm:Math.floor,Xe=Ue(Ne*H.width),U=Ue(Ne*H.height);S===void 0&&(S=E(Xe,U));const Ee=he?E(Xe,U):S;return Ee.width=Xe,Ee.height=U,Ee.getContext("2d").drawImage(H,0,0,Xe,U),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+H.width+"x"+H.height+") to ("+Xe+"x"+U+")."),Ee}else return"data"in H&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+H.width+"x"+H.height+")."),H;return H}function A(H){return Yy(H.width)&&Yy(H.height)}function D(H){return l?!1:H.wrapS!==yr||H.wrapT!==yr||H.minFilter!==Xt&&H.minFilter!==Hn}function I(H,B){return H.generateMipmaps&&B&&H.minFilter!==Xt&&H.minFilter!==Hn}function F(H){i.generateMipmap(H)}function P(H,B,he,we,Ne=!1){if(l===!1)return B;if(H!==null){if(i[H]!==void 0)return i[H];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+H+"'")}let Ue=B;return B===6403&&(he===5126&&(Ue=33326),he===5131&&(Ue=33325),he===5121&&(Ue=33321)),B===33319&&(he===5126&&(Ue=33328),he===5131&&(Ue=33327),he===5121&&(Ue=33323)),B===6408&&(he===5126&&(Ue=34836),he===5131&&(Ue=34842),he===5121&&(Ue=we===Ln&&Ne===!1?35907:32856),he===32819&&(Ue=32854),he===32820&&(Ue=32855)),(Ue===33325||Ue===33326||Ue===33327||Ue===33328||Ue===34842||Ue===34836)&&e.get("EXT_color_buffer_float"),Ue}function k(H,B,he){return I(H,he)===!0||H.isFramebufferTexture&&H.minFilter!==Xt&&H.minFilter!==Hn?Math.log2(Math.max(B.width,B.height))+1:H.mipmaps!==void 0&&H.mipmaps.length>0?H.mipmaps.length:H.isCompressedTexture&&Array.isArray(H.image)?B.mipmaps.length:1}function j(H){return H===Xt||H===l1||H===c1?9728:9729}function G(H){const B=H.target;B.removeEventListener("dispose",G),ce(B),B.isVideoTexture&&w.delete(B)}function ne(H){const B=H.target;B.removeEventListener("dispose",ne),$(B)}function ce(H){const B=n.get(H);if(B.__webglInit===void 0)return;const he=H.source,we=b.get(he);if(we){const Ne=we[B.__cacheKey];Ne.usedTimes--,Ne.usedTimes===0&&Z(H),Object.keys(we).length===0&&b.delete(he)}n.remove(H)}function Z(H){const B=n.get(H);i.deleteTexture(B.__webglTexture);const he=H.source,we=b.get(he);delete we[B.__cacheKey],o.memory.textures--}function $(H){const B=H.texture,he=n.get(H),we=n.get(B);if(we.__webglTexture!==void 0&&(i.deleteTexture(we.__webglTexture),o.memory.textures--),H.depthTexture&&H.depthTexture.dispose(),H.isWebGLCubeRenderTarget)for(let Ne=0;Ne<6;Ne++)i.deleteFramebuffer(he.__webglFramebuffer[Ne]),he.__webglDepthbuffer&&i.deleteRenderbuffer(he.__webglDepthbuffer[Ne]);else i.deleteFramebuffer(he.__webglFramebuffer),he.__webglDepthbuffer&&i.deleteRenderbuffer(he.__webglDepthbuffer),he.__webglMultisampledFramebuffer&&i.deleteFramebuffer(he.__webglMultisampledFramebuffer),he.__webglColorRenderbuffer&&i.deleteRenderbuffer(he.__webglColorRenderbuffer),he.__webglDepthRenderbuffer&&i.deleteRenderbuffer(he.__webglDepthRenderbuffer);if(H.isWebGLMultipleRenderTargets)for(let Ne=0,Ue=B.length;Ne<Ue;Ne++){const Xe=n.get(B[Ne]);Xe.__webglTexture&&(i.deleteTexture(Xe.__webglTexture),o.memory.textures--),n.remove(B[Ne])}n.remove(B),n.remove(H)}let K=0;function pe(){K=0}function re(){const H=K;return H>=h&&console.warn("THREE.WebGLTextures: Trying to use "+H+" texture units while this GPU supports only "+h),K+=1,H}function se(H){const B=[];return B.push(H.wrapS),B.push(H.wrapT),B.push(H.magFilter),B.push(H.minFilter),B.push(H.anisotropy),B.push(H.internalFormat),B.push(H.format),B.push(H.type),B.push(H.generateMipmaps),B.push(H.premultiplyAlpha),B.push(H.flipY),B.push(H.unpackAlignment),B.push(H.encoding),B.join()}function ue(H,B){const he=n.get(H);if(H.isVideoTexture&&Ft(H),H.isRenderTargetTexture===!1&&H.version>0&&he.__version!==H.version){const we=H.image;if(we===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(we.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{nt(he,H,B);return}}t.activeTexture(33984+B),t.bindTexture(3553,he.__webglTexture)}function Te(H,B){const he=n.get(H);if(H.version>0&&he.__version!==H.version){nt(he,H,B);return}t.activeTexture(33984+B),t.bindTexture(35866,he.__webglTexture)}function fe(H,B){const he=n.get(H);if(H.version>0&&he.__version!==H.version){nt(he,H,B);return}t.activeTexture(33984+B),t.bindTexture(32879,he.__webglTexture)}function Ce(H,B){const he=n.get(H);if(H.version>0&&he.__version!==H.version){it(he,H,B);return}t.activeTexture(33984+B),t.bindTexture(34067,he.__webglTexture)}const qe={[Nh]:10497,[yr]:33071,[Wy]:33648},Ke={[Xt]:9728,[l1]:9984,[c1]:9986,[Hn]:9729,[vI]:9985,[od]:9987};function me(H,B,he){if(he?(i.texParameteri(H,10242,qe[B.wrapS]),i.texParameteri(H,10243,qe[B.wrapT]),(H===32879||H===35866)&&i.texParameteri(H,32882,qe[B.wrapR]),i.texParameteri(H,10240,Ke[B.magFilter]),i.texParameteri(H,10241,Ke[B.minFilter])):(i.texParameteri(H,10242,33071),i.texParameteri(H,10243,33071),(H===32879||H===35866)&&i.texParameteri(H,32882,33071),(B.wrapS!==yr||B.wrapT!==yr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(H,10240,j(B.magFilter)),i.texParameteri(H,10241,j(B.minFilter)),B.minFilter!==Xt&&B.minFilter!==Hn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const we=e.get("EXT_texture_filter_anisotropic");if(B.type===is&&e.has("OES_texture_float_linear")===!1||l===!1&&B.type===Ts&&e.has("OES_texture_half_float_linear")===!1)return;(B.anisotropy>1||n.get(B).__currentAnisotropy)&&(i.texParameterf(H,we.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,r.getMaxAnisotropy())),n.get(B).__currentAnisotropy=B.anisotropy)}}function Ut(H,B){let he=!1;H.__webglInit===void 0&&(H.__webglInit=!0,B.addEventListener("dispose",G));const we=B.source;let Ne=b.get(we);Ne===void 0&&(Ne={},b.set(we,Ne));const Ue=se(B);if(Ue!==H.__cacheKey){Ne[Ue]===void 0&&(Ne[Ue]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,he=!0),Ne[Ue].usedTimes++;const Xe=Ne[H.__cacheKey];Xe!==void 0&&(Ne[H.__cacheKey].usedTimes--,Xe.usedTimes===0&&Z(B)),H.__cacheKey=Ue,H.__webglTexture=Ne[Ue].texture}return he}function nt(H,B,he){let we=3553;B.isDataArrayTexture&&(we=35866),B.isData3DTexture&&(we=32879);const Ne=Ut(H,B),Ue=B.source;if(t.activeTexture(33984+he),t.bindTexture(we,H.__webglTexture),Ue.version!==Ue.__currentVersion||Ne===!0){i.pixelStorei(37440,B.flipY),i.pixelStorei(37441,B.premultiplyAlpha),i.pixelStorei(3317,B.unpackAlignment),i.pixelStorei(37443,0);const Xe=D(B)&&A(B.image)===!1;let U=C(B.image,Xe,!1,f);U=yt(B,U);const Ee=A(U)||l,Je=s.convert(B.format,B.encoding);let ke=s.convert(B.type),X=P(B.internalFormat,Je,ke,B.encoding,B.isVideoTexture);me(we,B,Ee);let Re;const De=B.mipmaps,at=l&&B.isVideoTexture!==!0,ze=H.__version===void 0||Ne===!0,et=k(B,U,Ee);if(B.isDepthTexture)X=6402,l?B.type===is?X=36012:B.type===Ff?X=33190:B.type===zc?X=35056:X=33189:B.type===is&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),B.format===cl&&X===6402&&B.type!==pl&&B.type!==Ff&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),B.type=pl,ke=s.convert(B.type)),B.format===Gc&&X===6402&&(X=34041,B.type!==zc&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),B.type=zc,ke=s.convert(B.type))),ze&&(at?t.texStorage2D(3553,1,X,U.width,U.height):t.texImage2D(3553,0,X,U.width,U.height,0,Je,ke,null));else if(B.isDataTexture)if(De.length>0&&Ee){at&&ze&&t.texStorage2D(3553,et,X,De[0].width,De[0].height);for(let Ie=0,ct=De.length;Ie<ct;Ie++)Re=De[Ie],at?t.texSubImage2D(3553,Ie,0,0,Re.width,Re.height,Je,ke,Re.data):t.texImage2D(3553,Ie,X,Re.width,Re.height,0,Je,ke,Re.data);B.generateMipmaps=!1}else at?(ze&&t.texStorage2D(3553,et,X,U.width,U.height),t.texSubImage2D(3553,0,0,0,U.width,U.height,Je,ke,U.data)):t.texImage2D(3553,0,X,U.width,U.height,0,Je,ke,U.data);else if(B.isCompressedTexture){at&&ze&&t.texStorage2D(3553,et,X,De[0].width,De[0].height);for(let Ie=0,ct=De.length;Ie<ct;Ie++)Re=De[Ie],B.format!==Or?Je!==null?at?t.compressedTexSubImage2D(3553,Ie,0,0,Re.width,Re.height,Je,Re.data):t.compressedTexImage2D(3553,Ie,X,Re.width,Re.height,0,Re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):at?t.texSubImage2D(3553,Ie,0,0,Re.width,Re.height,Je,ke,Re.data):t.texImage2D(3553,Ie,X,Re.width,Re.height,0,Je,ke,Re.data)}else if(B.isDataArrayTexture)at?(ze&&t.texStorage3D(35866,et,X,U.width,U.height,U.depth),t.texSubImage3D(35866,0,0,0,0,U.width,U.height,U.depth,Je,ke,U.data)):t.texImage3D(35866,0,X,U.width,U.height,U.depth,0,Je,ke,U.data);else if(B.isData3DTexture)at?(ze&&t.texStorage3D(32879,et,X,U.width,U.height,U.depth),t.texSubImage3D(32879,0,0,0,0,U.width,U.height,U.depth,Je,ke,U.data)):t.texImage3D(32879,0,X,U.width,U.height,U.depth,0,Je,ke,U.data);else if(B.isFramebufferTexture){if(ze)if(at)t.texStorage2D(3553,et,X,U.width,U.height);else{let Ie=U.width,ct=U.height;for(let wt=0;wt<et;wt++)t.texImage2D(3553,wt,X,Ie,ct,0,Je,ke,null),Ie>>=1,ct>>=1}}else if(De.length>0&&Ee){at&&ze&&t.texStorage2D(3553,et,X,De[0].width,De[0].height);for(let Ie=0,ct=De.length;Ie<ct;Ie++)Re=De[Ie],at?t.texSubImage2D(3553,Ie,0,0,Je,ke,Re):t.texImage2D(3553,Ie,X,Je,ke,Re);B.generateMipmaps=!1}else at?(ze&&t.texStorage2D(3553,et,X,U.width,U.height),t.texSubImage2D(3553,0,0,0,Je,ke,U)):t.texImage2D(3553,0,X,Je,ke,U);I(B,Ee)&&F(we),Ue.__currentVersion=Ue.version,B.onUpdate&&B.onUpdate(B)}H.__version=B.version}function it(H,B,he){if(B.image.length!==6)return;const we=Ut(H,B),Ne=B.source;if(t.activeTexture(33984+he),t.bindTexture(34067,H.__webglTexture),Ne.version!==Ne.__currentVersion||we===!0){i.pixelStorei(37440,B.flipY),i.pixelStorei(37441,B.premultiplyAlpha),i.pixelStorei(3317,B.unpackAlignment),i.pixelStorei(37443,0);const Ue=B.isCompressedTexture||B.image[0].isCompressedTexture,Xe=B.image[0]&&B.image[0].isDataTexture,U=[];for(let Ie=0;Ie<6;Ie++)!Ue&&!Xe?U[Ie]=C(B.image[Ie],!1,!0,d):U[Ie]=Xe?B.image[Ie].image:B.image[Ie],U[Ie]=yt(B,U[Ie]);const Ee=U[0],Je=A(Ee)||l,ke=s.convert(B.format,B.encoding),X=s.convert(B.type),Re=P(B.internalFormat,ke,X,B.encoding),De=l&&B.isVideoTexture!==!0,at=H.__version===void 0;let ze=k(B,Ee,Je);me(34067,B,Je);let et;if(Ue){De&&at&&t.texStorage2D(34067,ze,Re,Ee.width,Ee.height);for(let Ie=0;Ie<6;Ie++){et=U[Ie].mipmaps;for(let ct=0;ct<et.length;ct++){const wt=et[ct];B.format!==Or?ke!==null?De?t.compressedTexSubImage2D(34069+Ie,ct,0,0,wt.width,wt.height,ke,wt.data):t.compressedTexImage2D(34069+Ie,ct,Re,wt.width,wt.height,0,wt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):De?t.texSubImage2D(34069+Ie,ct,0,0,wt.width,wt.height,ke,X,wt.data):t.texImage2D(34069+Ie,ct,Re,wt.width,wt.height,0,ke,X,wt.data)}}}else{et=B.mipmaps,De&&at&&(et.length>0&&ze++,t.texStorage2D(34067,ze,Re,U[0].width,U[0].height));for(let Ie=0;Ie<6;Ie++)if(Xe){De?t.texSubImage2D(34069+Ie,0,0,0,U[Ie].width,U[Ie].height,ke,X,U[Ie].data):t.texImage2D(34069+Ie,0,Re,U[Ie].width,U[Ie].height,0,ke,X,U[Ie].data);for(let ct=0;ct<et.length;ct++){const Ct=et[ct].image[Ie].image;De?t.texSubImage2D(34069+Ie,ct+1,0,0,Ct.width,Ct.height,ke,X,Ct.data):t.texImage2D(34069+Ie,ct+1,Re,Ct.width,Ct.height,0,ke,X,Ct.data)}}else{De?t.texSubImage2D(34069+Ie,0,0,0,ke,X,U[Ie]):t.texImage2D(34069+Ie,0,Re,ke,X,U[Ie]);for(let ct=0;ct<et.length;ct++){const wt=et[ct];De?t.texSubImage2D(34069+Ie,ct+1,0,0,ke,X,wt.image[Ie]):t.texImage2D(34069+Ie,ct+1,Re,ke,X,wt.image[Ie])}}}I(B,Je)&&F(34067),Ne.__currentVersion=Ne.version,B.onUpdate&&B.onUpdate(B)}H.__version=B.version}function Le(H,B,he,we,Ne){const Ue=s.convert(he.format,he.encoding),Xe=s.convert(he.type),U=P(he.internalFormat,Ue,Xe,he.encoding);n.get(B).__hasExternalTextures||(Ne===32879||Ne===35866?t.texImage3D(Ne,0,U,B.width,B.height,B.depth,0,Ue,Xe,null):t.texImage2D(Ne,0,U,B.width,B.height,0,Ue,Xe,null)),t.bindFramebuffer(36160,H),st(B)?y.framebufferTexture2DMultisampleEXT(36160,we,Ne,n.get(he).__webglTexture,0,ot(B)):i.framebufferTexture2D(36160,we,Ne,n.get(he).__webglTexture,0),t.bindFramebuffer(36160,null)}function vt(H,B,he){if(i.bindRenderbuffer(36161,H),B.depthBuffer&&!B.stencilBuffer){let we=33189;if(he||st(B)){const Ne=B.depthTexture;Ne&&Ne.isDepthTexture&&(Ne.type===is?we=36012:Ne.type===Ff&&(we=33190));const Ue=ot(B);st(B)?y.renderbufferStorageMultisampleEXT(36161,Ue,we,B.width,B.height):i.renderbufferStorageMultisample(36161,Ue,we,B.width,B.height)}else i.renderbufferStorage(36161,we,B.width,B.height);i.framebufferRenderbuffer(36160,36096,36161,H)}else if(B.depthBuffer&&B.stencilBuffer){const we=ot(B);he&&st(B)===!1?i.renderbufferStorageMultisample(36161,we,35056,B.width,B.height):st(B)?y.renderbufferStorageMultisampleEXT(36161,we,35056,B.width,B.height):i.renderbufferStorage(36161,34041,B.width,B.height),i.framebufferRenderbuffer(36160,33306,36161,H)}else{const we=B.isWebGLMultipleRenderTargets===!0?B.texture[0]:B.texture,Ne=s.convert(we.format,we.encoding),Ue=s.convert(we.type),Xe=P(we.internalFormat,Ne,Ue,we.encoding),U=ot(B);he&&st(B)===!1?i.renderbufferStorageMultisample(36161,U,Xe,B.width,B.height):st(B)?y.renderbufferStorageMultisampleEXT(36161,U,Xe,B.width,B.height):i.renderbufferStorage(36161,Xe,B.width,B.height)}i.bindRenderbuffer(36161,null)}function ve(H,B){if(B&&B.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,H),!(B.depthTexture&&B.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(B.depthTexture).__webglTexture||B.depthTexture.image.width!==B.width||B.depthTexture.image.height!==B.height)&&(B.depthTexture.image.width=B.width,B.depthTexture.image.height=B.height,B.depthTexture.needsUpdate=!0),ue(B.depthTexture,0);const we=n.get(B.depthTexture).__webglTexture,Ne=ot(B);if(B.depthTexture.format===cl)st(B)?y.framebufferTexture2DMultisampleEXT(36160,36096,3553,we,0,Ne):i.framebufferTexture2D(36160,36096,3553,we,0);else if(B.depthTexture.format===Gc)st(B)?y.framebufferTexture2DMultisampleEXT(36160,33306,3553,we,0,Ne):i.framebufferTexture2D(36160,33306,3553,we,0);else throw new Error("Unknown depthTexture format")}function xe(H){const B=n.get(H),he=H.isWebGLCubeRenderTarget===!0;if(H.depthTexture&&!B.__autoAllocateDepthBuffer){if(he)throw new Error("target.depthTexture not supported in Cube render targets");ve(B.__webglFramebuffer,H)}else if(he){B.__webglDepthbuffer=[];for(let we=0;we<6;we++)t.bindFramebuffer(36160,B.__webglFramebuffer[we]),B.__webglDepthbuffer[we]=i.createRenderbuffer(),vt(B.__webglDepthbuffer[we],H,!1)}else t.bindFramebuffer(36160,B.__webglFramebuffer),B.__webglDepthbuffer=i.createRenderbuffer(),vt(B.__webglDepthbuffer,H,!1);t.bindFramebuffer(36160,null)}function Ae(H,B,he){const we=n.get(H);B!==void 0&&Le(we.__webglFramebuffer,H,H.texture,36064,3553),he!==void 0&&xe(H)}function We(H){const B=H.texture,he=n.get(H),we=n.get(B);H.addEventListener("dispose",ne),H.isWebGLMultipleRenderTargets!==!0&&(we.__webglTexture===void 0&&(we.__webglTexture=i.createTexture()),we.__version=B.version,o.memory.textures++);const Ne=H.isWebGLCubeRenderTarget===!0,Ue=H.isWebGLMultipleRenderTargets===!0,Xe=A(H)||l;if(Ne){he.__webglFramebuffer=[];for(let U=0;U<6;U++)he.__webglFramebuffer[U]=i.createFramebuffer()}else if(he.__webglFramebuffer=i.createFramebuffer(),Ue)if(r.drawBuffers){const U=H.texture;for(let Ee=0,Je=U.length;Ee<Je;Ee++){const ke=n.get(U[Ee]);ke.__webglTexture===void 0&&(ke.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(l&&H.samples>0&&st(H)===!1){he.__webglMultisampledFramebuffer=i.createFramebuffer(),he.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,he.__webglColorRenderbuffer);const U=s.convert(B.format,B.encoding),Ee=s.convert(B.type),Je=P(B.internalFormat,U,Ee,B.encoding),ke=ot(H);i.renderbufferStorageMultisample(36161,ke,Je,H.width,H.height),t.bindFramebuffer(36160,he.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,he.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),H.depthBuffer&&(he.__webglDepthRenderbuffer=i.createRenderbuffer(),vt(he.__webglDepthRenderbuffer,H,!0)),t.bindFramebuffer(36160,null)}if(Ne){t.bindTexture(34067,we.__webglTexture),me(34067,B,Xe);for(let U=0;U<6;U++)Le(he.__webglFramebuffer[U],H,B,36064,34069+U);I(B,Xe)&&F(34067),t.unbindTexture()}else if(Ue){const U=H.texture;for(let Ee=0,Je=U.length;Ee<Je;Ee++){const ke=U[Ee],X=n.get(ke);t.bindTexture(3553,X.__webglTexture),me(3553,ke,Xe),Le(he.__webglFramebuffer,H,ke,36064+Ee,3553),I(ke,Xe)&&F(3553)}t.unbindTexture()}else{let U=3553;(H.isWebGL3DRenderTarget||H.isWebGLArrayRenderTarget)&&(l?U=H.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(U,we.__webglTexture),me(U,B,Xe),Le(he.__webglFramebuffer,H,B,36064,U),I(B,Xe)&&F(U),t.unbindTexture()}H.depthBuffer&&xe(H)}function Be(H){const B=A(H)||l,he=H.isWebGLMultipleRenderTargets===!0?H.texture:[H.texture];for(let we=0,Ne=he.length;we<Ne;we++){const Ue=he[we];if(I(Ue,B)){const Xe=H.isWebGLCubeRenderTarget?34067:3553,U=n.get(Ue).__webglTexture;t.bindTexture(Xe,U),F(Xe),t.unbindTexture()}}}function rt(H){if(l&&H.samples>0&&st(H)===!1){const B=H.width,he=H.height;let we=16384;const Ne=[36064],Ue=H.stencilBuffer?33306:36096;H.depthBuffer&&Ne.push(Ue);const Xe=n.get(H),U=Xe.__ignoreDepthValues!==void 0?Xe.__ignoreDepthValues:!1;U===!1&&(H.depthBuffer&&(we|=256),H.stencilBuffer&&(we|=1024)),t.bindFramebuffer(36008,Xe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Xe.__webglFramebuffer),U===!0&&(i.invalidateFramebuffer(36008,[Ue]),i.invalidateFramebuffer(36009,[Ue])),i.blitFramebuffer(0,0,B,he,0,0,B,he,we,9728),_&&i.invalidateFramebuffer(36008,Ne),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Xe.__webglMultisampledFramebuffer)}}function ot(H){return Math.min(g,H.samples)}function st(H){const B=n.get(H);return l&&H.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function Ft(H){const B=o.render.frame;w.get(H)!==B&&(w.set(H,B),H.update())}function yt(H,B){const he=H.encoding,we=H.format,Ne=H.type;return H.isCompressedTexture===!0||H.isVideoTexture===!0||H.format===qy||he!==Ds&&(he===Ln?l===!1?e.has("EXT_sRGB")===!0&&we===Or?(H.format=qy,H.minFilter=Hn,H.generateMipmaps=!1):B=xl.sRGBToLinear(B):(we!==Or||Ne!==dl)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",he)),B}this.allocateTextureUnit=re,this.resetTextureUnits=pe,this.setTexture2D=ue,this.setTexture2DArray=Te,this.setTexture3D=fe,this.setTextureCube=Ce,this.rebindTextures=Ae,this.setupRenderTarget=We,this.updateRenderTargetMipmap=Be,this.updateMultisampleRenderTarget=rt,this.setupDepthRenderbuffer=xe,this.setupFrameBufferTexture=Le,this.useMultisampledRTT=st}function DB(i,e,t){const n=t.isWebGL2;function r(s,o=null){let l;if(s===dl)return 5121;if(s===xI)return 32819;if(s===bI)return 32820;if(s===gI)return 5120;if(s===yI)return 5122;if(s===pl)return 5123;if(s===_I)return 5124;if(s===Ff)return 5125;if(s===is)return 5126;if(s===Ts)return n?5131:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(s===wI)return 6406;if(s===Or)return 6408;if(s===MI)return 6409;if(s===EI)return 6410;if(s===cl)return 6402;if(s===Gc)return 34041;if(s===TI)return 6403;if(s===SI)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===qy)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(s===AI)return 36244;if(s===CI)return 33319;if(s===PI)return 33320;if(s===RI)return 36249;if(s===B0||s===z0||s===U0||s===F0)if(o===Ln)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(s===B0)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===z0)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===U0)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===F0)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(s===B0)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===z0)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===U0)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===F0)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===u1||s===h1||s===d1||s===p1)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(s===u1)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===h1)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===d1)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===p1)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===LI)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===f1||s===m1)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(s===f1)return o===Ln?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(s===m1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===v1||s===g1||s===y1||s===_1||s===x1||s===b1||s===w1||s===S1||s===M1||s===E1||s===T1||s===A1||s===C1||s===P1)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(s===v1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===g1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===y1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===_1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===x1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===b1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===w1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===S1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===M1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===E1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===T1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===A1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===C1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===P1)return o===Ln?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===R1)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(s===R1)return o===Ln?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===zc?n?34042:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:r}}class t2 extends fi{constructor(e=[]){super(),this.cameras=e}}t2.prototype.isArrayCamera=!0;class ei extends $t{constructor(){super(),this.type="Group"}}ei.prototype.isGroup=!0;const IB={type:"move"};class my{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ei,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 ei,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ei,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new z),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null;const l=this._targetRay,h=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(l!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(IB))),d&&e.hand){o=!0;for(const S of e.hand.values()){const b=t.getJointPose(S,n);if(d.joints[S.jointName]===void 0){const E=new ei;E.matrixAutoUpdate=!1,E.visible=!1,d.joints[S.jointName]=E,d.add(E)}const T=d.joints[S.jointName];b!==null&&(T.matrix.fromArray(b.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.jointRadius=b.radius),T.visible=b!==null}const f=d.joints["index-finger-tip"],g=d.joints["thumb-tip"],y=f.position.distanceTo(g.position),_=.02,w=.005;d.inputState.pinching&&y>_+w?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&y<=_-w&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(h.matrix.fromArray(s.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),s.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(s.linearVelocity)):h.hasLinearVelocity=!1,s.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(s.angularVelocity)):h.hasAngularVelocity=!1));return l!==null&&(l.visible=r!==null),h!==null&&(h.visible=s!==null),d!==null&&(d.visible=o!==null),this}}class Hm extends ti{constructor(e,t,n,r,s,o,l,h,d,f){if(f=f!==void 0?f:cl,f!==cl&&f!==Gc)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&f===cl&&(n=pl),n===void 0&&f===Gc&&(n=zc),super(null,r,s,o,l,h,f,n,d),this.image={width:e,height:t},this.magFilter=l!==void 0?l:Xt,this.minFilter=h!==void 0?h:Xt,this.flipY=!1,this.generateMipmaps=!1}}Hm.prototype.isDepthTexture=!0;class OB extends Ea{constructor(e,t){super();const n=this;let r=null,s=1,o=null,l="local-floor",h=null,d=null,f=null,g=null,y=null,_=null;const w=t.getContextAttributes();let S=null,b=null;const T=[],E=new Map,C=new fi;C.layers.enable(1),C.viewport=new dn;const A=new fi;A.layers.enable(2),A.viewport=new dn;const D=[C,A],I=new t2;I.layers.enable(1),I.layers.enable(2);let F=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let ue=T[se];return ue===void 0&&(ue=new my,T[se]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(se){let ue=T[se];return ue===void 0&&(ue=new my,T[se]=ue),ue.getGripSpace()},this.getHand=function(se){let ue=T[se];return ue===void 0&&(ue=new my,T[se]=ue),ue.getHandSpace()};function k(se){const ue=E.get(se.inputSource);ue&&ue.dispatchEvent({type:se.type,data:se.inputSource})}function j(){E.forEach(function(se,ue){se.disconnect(ue)}),E.clear(),F=null,P=null,e.setRenderTarget(S),y=null,g=null,f=null,r=null,b=null,re.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(se){s=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(se){l=se,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||o},this.setReferenceSpace=function(se){h=se},this.getBaseLayer=function(){return g!==null?g:y},this.getBinding=function(){return f},this.getFrame=function(){return _},this.getSession=function(){return r},this.setSession=async function(se){if(r=se,r!==null){if(S=e.getRenderTarget(),r.addEventListener("select",k),r.addEventListener("selectstart",k),r.addEventListener("selectend",k),r.addEventListener("squeeze",k),r.addEventListener("squeezestart",k),r.addEventListener("squeezeend",k),r.addEventListener("end",j),r.addEventListener("inputsourceschange",G),w.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const ue={antialias:r.renderState.layers===void 0?w.antialias:!0,alpha:w.alpha,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};y=new XRWebGLLayer(r,t,ue),r.updateRenderState({baseLayer:y}),b=new Yt(y.framebufferWidth,y.framebufferHeight,{format:Or,type:dl,encoding:e.outputEncoding})}else{let ue=null,Te=null,fe=null;w.depth&&(fe=w.stencil?35056:33190,ue=w.stencil?Gc:cl,Te=w.stencil?zc:pl);const Ce={colorFormat:e.outputEncoding===Ln?35907:32856,depthFormat:fe,scaleFactor:s};f=new XRWebGLBinding(r,t),g=f.createProjectionLayer(Ce),r.updateRenderState({layers:[g]}),b=new Yt(g.textureWidth,g.textureHeight,{format:Or,type:dl,depthTexture:new Hm(g.textureWidth,g.textureHeight,Te,void 0,void 0,void 0,void 0,void 0,void 0,ue),stencilBuffer:w.stencil,encoding:e.outputEncoding,samples:w.antialias?4:0});const qe=e.properties.get(b);qe.__ignoreDepthValues=g.ignoreDepthValues}b.isXRRenderTarget=!0,this.setFoveation(1),o=await r.requestReferenceSpace(l),re.setContext(r),re.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};function G(se){const ue=r.inputSources;for(let Te=0;Te<ue.length;Te++){const fe=ue[Te].handedness==="right"?1:0;E.set(ue[Te],T[fe])}for(let Te=0;Te<se.removed.length;Te++){const fe=se.removed[Te],Ce=E.get(fe);Ce&&(Ce.dispatchEvent({type:"disconnected",data:fe}),E.delete(fe))}for(let Te=0;Te<se.added.length;Te++){const fe=se.added[Te],Ce=E.get(fe);Ce&&Ce.dispatchEvent({type:"connected",data:fe})}}const ne=new z,ce=new z;function Z(se,ue,Te){ne.setFromMatrixPosition(ue.matrixWorld),ce.setFromMatrixPosition(Te.matrixWorld);const fe=ne.distanceTo(ce),Ce=ue.projectionMatrix.elements,qe=Te.projectionMatrix.elements,Ke=Ce[14]/(Ce[10]-1),me=Ce[14]/(Ce[10]+1),Ut=(Ce[9]+1)/Ce[5],nt=(Ce[9]-1)/Ce[5],it=(Ce[8]-1)/Ce[0],Le=(qe[8]+1)/qe[0],vt=Ke*it,ve=Ke*Le,xe=fe/(-it+Le),Ae=xe*-it;ue.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Ae),se.translateZ(xe),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert();const We=Ke+xe,Be=me+xe,rt=vt-Ae,ot=ve+(fe-Ae),st=Ut*me/Be*We,Ft=nt*me/Be*We;se.projectionMatrix.makePerspective(rt,ot,st,Ft,We,Be)}function $(se,ue){ue===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(ue.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(r===null)return;I.near=A.near=C.near=se.near,I.far=A.far=C.far=se.far,(F!==I.near||P!==I.far)&&(r.updateRenderState({depthNear:I.near,depthFar:I.far}),F=I.near,P=I.far);const ue=se.parent,Te=I.cameras;$(I,ue);for(let Ce=0;Ce<Te.length;Ce++)$(Te[Ce],ue);I.matrixWorld.decompose(I.position,I.quaternion,I.scale),se.position.copy(I.position),se.quaternion.copy(I.quaternion),se.scale.copy(I.scale),se.matrix.copy(I.matrix),se.matrixWorld.copy(I.matrixWorld);const fe=se.children;for(let Ce=0,qe=fe.length;Ce<qe;Ce++)fe[Ce].updateMatrixWorld(!0);Te.length===2?Z(I,C,A):I.projectionMatrix.copy(C.projectionMatrix)},this.getCamera=function(){return I},this.getFoveation=function(){if(g!==null)return g.fixedFoveation;if(y!==null)return y.fixedFoveation},this.setFoveation=function(se){g!==null&&(g.fixedFoveation=se),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=se)};let K=null;function pe(se,ue){if(d=ue.getViewerPose(h||o),_=ue,d!==null){const fe=d.views;y!==null&&(e.setRenderTargetFramebuffer(b,y.framebuffer),e.setRenderTarget(b));let Ce=!1;fe.length!==I.cameras.length&&(I.cameras.length=0,Ce=!0);for(let qe=0;qe<fe.length;qe++){const Ke=fe[qe];let me=null;if(y!==null)me=y.getViewport(Ke);else{const nt=f.getViewSubImage(g,Ke);me=nt.viewport,qe===0&&(e.setRenderTargetTextures(b,nt.colorTexture,g.ignoreDepthValues?void 0:nt.depthStencilTexture),e.setRenderTarget(b))}const Ut=D[qe];Ut.matrix.fromArray(Ke.transform.matrix),Ut.projectionMatrix.fromArray(Ke.projectionMatrix),Ut.viewport.set(me.x,me.y,me.width,me.height),qe===0&&I.matrix.copy(Ut.matrix),Ce===!0&&I.cameras.push(Ut)}}const Te=r.inputSources;for(let fe=0;fe<T.length;fe++){const Ce=Te[fe],qe=E.get(Ce);qe!==void 0&&qe.update(Ce,ue,h||o)}K&&K(se,ue),_=null}const re=new qE;re.setAnimationLoop(pe),this.setAnimationLoop=function(se){K=se},this.dispose=function(){}}}function kB(i,e){function t(S,b){S.fogColor.value.copy(b.color),b.isFog?(S.fogNear.value=b.near,S.fogFar.value=b.far):b.isFogExp2&&(S.fogDensity.value=b.density)}function n(S,b,T,E,C){b.isMeshBasicMaterial||b.isMeshLambertMaterial?r(S,b):b.isMeshToonMaterial?(r(S,b),f(S,b)):b.isMeshPhongMaterial?(r(S,b),d(S,b)):b.isMeshStandardMaterial?(r(S,b),g(S,b),b.isMeshPhysicalMaterial&&y(S,b,C)):b.isMeshMatcapMaterial?(r(S,b),_(S,b)):b.isMeshDepthMaterial?r(S,b):b.isMeshDistanceMaterial?(r(S,b),w(S,b)):b.isMeshNormalMaterial?r(S,b):b.isLineBasicMaterial?(s(S,b),b.isLineDashedMaterial&&o(S,b)):b.isPointsMaterial?l(S,b,T,E):b.isSpriteMaterial?h(S,b):b.isShadowMaterial?(S.color.value.copy(b.color),S.opacity.value=b.opacity):b.isShaderMaterial&&(b.uniformsNeedUpdate=!1)}function r(S,b){S.opacity.value=b.opacity,b.color&&S.diffuse.value.copy(b.color),b.emissive&&S.emissive.value.copy(b.emissive).multiplyScalar(b.emissiveIntensity),b.map&&(S.map.value=b.map),b.alphaMap&&(S.alphaMap.value=b.alphaMap),b.bumpMap&&(S.bumpMap.value=b.bumpMap,S.bumpScale.value=b.bumpScale,b.side===xr&&(S.bumpScale.value*=-1)),b.displacementMap&&(S.displacementMap.value=b.displacementMap,S.displacementScale.value=b.displacementScale,S.displacementBias.value=b.displacementBias),b.emissiveMap&&(S.emissiveMap.value=b.emissiveMap),b.normalMap&&(S.normalMap.value=b.normalMap,S.normalScale.value.copy(b.normalScale),b.side===xr&&S.normalScale.value.negate()),b.specularMap&&(S.specularMap.value=b.specularMap),b.alphaTest>0&&(S.alphaTest.value=b.alphaTest);const T=e.get(b).envMap;if(T&&(S.envMap.value=T,S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=b.reflectivity,S.ior.value=b.ior,S.refractionRatio.value=b.refractionRatio),b.lightMap){S.lightMap.value=b.lightMap;const A=i.physicallyCorrectLights!==!0?Math.PI:1;S.lightMapIntensity.value=b.lightMapIntensity*A}b.aoMap&&(S.aoMap.value=b.aoMap,S.aoMapIntensity.value=b.aoMapIntensity);let E;b.map?E=b.map:b.specularMap?E=b.specularMap:b.displacementMap?E=b.displacementMap:b.normalMap?E=b.normalMap:b.bumpMap?E=b.bumpMap:b.roughnessMap?E=b.roughnessMap:b.metalnessMap?E=b.metalnessMap:b.alphaMap?E=b.alphaMap:b.emissiveMap?E=b.emissiveMap:b.clearcoatMap?E=b.clearcoatMap:b.clearcoatNormalMap?E=b.clearcoatNormalMap:b.clearcoatRoughnessMap?E=b.clearcoatRoughnessMap:b.specularIntensityMap?E=b.specularIntensityMap:b.specularColorMap?E=b.specularColorMap:b.transmissionMap?E=b.transmissionMap:b.thicknessMap?E=b.thicknessMap:b.sheenColorMap?E=b.sheenColorMap:b.sheenRoughnessMap&&(E=b.sheenRoughnessMap),E!==void 0&&(E.isWebGLRenderTarget&&(E=E.texture),E.matrixAutoUpdate===!0&&E.updateMatrix(),S.uvTransform.value.copy(E.matrix));let C;b.aoMap?C=b.aoMap:b.lightMap&&(C=b.lightMap),C!==void 0&&(C.isWebGLRenderTarget&&(C=C.texture),C.matrixAutoUpdate===!0&&C.updateMatrix(),S.uv2Transform.value.copy(C.matrix))}function s(S,b){S.diffuse.value.copy(b.color),S.opacity.value=b.opacity}function o(S,b){S.dashSize.value=b.dashSize,S.totalSize.value=b.dashSize+b.gapSize,S.scale.value=b.scale}function l(S,b,T,E){S.diffuse.value.copy(b.color),S.opacity.value=b.opacity,S.size.value=b.size*T,S.scale.value=E*.5,b.map&&(S.map.value=b.map),b.alphaMap&&(S.alphaMap.value=b.alphaMap),b.alphaTest>0&&(S.alphaTest.value=b.alphaTest);let C;b.map?C=b.map:b.alphaMap&&(C=b.alphaMap),C!==void 0&&(C.matrixAutoUpdate===!0&&C.updateMatrix(),S.uvTransform.value.copy(C.matrix))}function h(S,b){S.diffuse.value.copy(b.color),S.opacity.value=b.opacity,S.rotation.value=b.rotation,b.map&&(S.map.value=b.map),b.alphaMap&&(S.alphaMap.value=b.alphaMap),b.alphaTest>0&&(S.alphaTest.value=b.alphaTest);let T;b.map?T=b.map:b.alphaMap&&(T=b.alphaMap),T!==void 0&&(T.matrixAutoUpdate===!0&&T.updateMatrix(),S.uvTransform.value.copy(T.matrix))}function d(S,b){S.specular.value.copy(b.specular),S.shininess.value=Math.max(b.shininess,1e-4)}function f(S,b){b.gradientMap&&(S.gradientMap.value=b.gradientMap)}function g(S,b){S.roughness.value=b.roughness,S.metalness.value=b.metalness,b.roughnessMap&&(S.roughnessMap.value=b.roughnessMap),b.metalnessMap&&(S.metalnessMap.value=b.metalnessMap),e.get(b).envMap&&(S.envMapIntensity.value=b.envMapIntensity)}function y(S,b,T){S.ior.value=b.ior,b.sheen>0&&(S.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),S.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(S.sheenColorMap.value=b.sheenColorMap),b.sheenRoughnessMap&&(S.sheenRoughnessMap.value=b.sheenRoughnessMap)),b.clearcoat>0&&(S.clearcoat.value=b.clearcoat,S.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(S.clearcoatMap.value=b.clearcoatMap),b.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap),b.clearcoatNormalMap&&(S.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),S.clearcoatNormalMap.value=b.clearcoatNormalMap,b.side===xr&&S.clearcoatNormalScale.value.negate())),b.transmission>0&&(S.transmission.value=b.transmission,S.transmissionSamplerMap.value=T.texture,S.transmissionSamplerSize.value.set(T.width,T.height),b.transmissionMap&&(S.transmissionMap.value=b.transmissionMap),S.thickness.value=b.thickness,b.thicknessMap&&(S.thicknessMap.value=b.thicknessMap),S.attenuationDistance.value=b.attenuationDistance,S.attenuationColor.value.copy(b.attenuationColor)),S.specularIntensity.value=b.specularIntensity,S.specularColor.value.copy(b.specularColor),b.specularIntensityMap&&(S.specularIntensityMap.value=b.specularIntensityMap),b.specularColorMap&&(S.specularColorMap.value=b.specularColorMap)}function _(S,b){b.matcap&&(S.matcap.value=b.matcap)}function w(S,b){S.referencePosition.value.copy(b.referencePosition),S.nearDistance.value=b.nearDistance,S.farDistance.value=b.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function NB(){const i=Uh("canvas");return i.style.display="block",i}function cn(i={}){const e=i.canvas!==void 0?i.canvas:NB(),t=i.context!==void 0?i.context:null,n=i.depth!==void 0?i.depth:!0,r=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,l=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,h=i.powerPreference!==void 0?i.powerPreference:"default",d=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1;let f;t!==null?f=t.getContextAttributes().alpha:f=i.alpha!==void 0?i.alpha:!1;let g=null,y=null;const _=[],w=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Ds,this.physicallyCorrectLights=!1,this.toneMapping=As,this.toneMappingExposure=1;const S=this;let b=!1,T=0,E=0,C=null,A=-1,D=null;const I=new dn,F=new dn;let P=null,k=e.width,j=e.height,G=1,ne=null,ce=null;const Z=new dn(0,0,k,j),$=new dn(0,0,k,j);let K=!1;const pe=new ad;let re=!1,se=!1,ue=null;const Te=new Qe,fe=new ae,Ce=new z,qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ke(){return C===null?G:1}let me=t;function Ut(V,te){for(let de=0;de<V.length;de++){const oe=V[de],ge=e.getContext(oe,te);if(ge!==null)return ge}return null}try{const V={alpha:!0,depth:n,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${ex}`),e.addEventListener("webglcontextlost",X,!1),e.addEventListener("webglcontextrestored",Re,!1),me===null){const te=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&te.shift(),me=Ut(te,V),me===null)throw Ut(te)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}me.getShaderPrecisionFormat===void 0&&(me.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(V){throw console.error("THREE.WebGLRenderer: "+V.message),V}let nt,it,Le,vt,ve,xe,Ae,We,Be,rt,ot,st,Ft,yt,H,B,he,we,Ne,Ue,Xe,U,Ee;function Je(){nt=new $k(me),it=new qk(me,nt,i),nt.init(it),U=new DB(me,nt,it),Le=new RB(me,nt,it),vt=new nN,ve=new _B,xe=new LB(me,nt,Le,ve,it,U,vt),Ae=new Zk(S),We=new Qk(S),Be=new vO(me,it),Ee=new jk(me,nt,Be,it),rt=new eN(me,Be,vt,Ee),ot=new oN(me,rt,Be,vt),Ne=new sN(me,it,xe),B=new Yk(ve),st=new yB(S,Ae,We,nt,it,Ee,B),Ft=new kB(S,ve),yt=new bB,H=new AB(nt,it),we=new Wk(S,Ae,Le,ot,f,o),he=new e2(S,ot,it),Ue=new Xk(me,nt,vt,it),Xe=new tN(me,nt,vt,it),vt.programs=st.programs,S.capabilities=it,S.extensions=nt,S.properties=ve,S.renderLists=yt,S.shadowMap=he,S.state=Le,S.info=vt}Je();const ke=new OB(S,me);this.xr=ke,this.getContext=function(){return me},this.getContextAttributes=function(){return me.getContextAttributes()},this.forceContextLoss=function(){const V=nt.get("WEBGL_lose_context");V&&V.loseContext()},this.forceContextRestore=function(){const V=nt.get("WEBGL_lose_context");V&&V.restoreContext()},this.getPixelRatio=function(){return G},this.setPixelRatio=function(V){V!==void 0&&(G=V,this.setSize(k,j,!1))},this.getSize=function(V){return V.set(k,j)},this.setSize=function(V,te,de){if(ke.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}k=V,j=te,e.width=Math.floor(V*G),e.height=Math.floor(te*G),de!==!1&&(e.style.width=V+"px",e.style.height=te+"px"),this.setViewport(0,0,V,te)},this.getDrawingBufferSize=function(V){return V.set(k*G,j*G).floor()},this.setDrawingBufferSize=function(V,te,de){k=V,j=te,G=de,e.width=Math.floor(V*de),e.height=Math.floor(te*de),this.setViewport(0,0,V,te)},this.getCurrentViewport=function(V){return V.copy(I)},this.getViewport=function(V){return V.copy(Z)},this.setViewport=function(V,te,de,oe){V.isVector4?Z.set(V.x,V.y,V.z,V.w):Z.set(V,te,de,oe),Le.viewport(I.copy(Z).multiplyScalar(G).floor())},this.getScissor=function(V){return V.copy($)},this.setScissor=function(V,te,de,oe){V.isVector4?$.set(V.x,V.y,V.z,V.w):$.set(V,te,de,oe),Le.scissor(F.copy($).multiplyScalar(G).floor())},this.getScissorTest=function(){return K},this.setScissorTest=function(V){Le.setScissorTest(K=V)},this.setOpaqueSort=function(V){ne=V},this.setTransparentSort=function(V){ce=V},this.getClearColor=function(V){return V.copy(we.getClearColor())},this.setClearColor=function(){we.setClearColor.apply(we,arguments)},this.getClearAlpha=function(){return we.getClearAlpha()},this.setClearAlpha=function(){we.setClearAlpha.apply(we,arguments)},this.clear=function(V=!0,te=!0,de=!0){let oe=0;V&&(oe|=16384),te&&(oe|=256),de&&(oe|=1024),me.clear(oe)},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(){e.removeEventListener("webglcontextlost",X,!1),e.removeEventListener("webglcontextrestored",Re,!1),yt.dispose(),H.dispose(),ve.dispose(),Ae.dispose(),We.dispose(),ot.dispose(),Ee.dispose(),st.dispose(),ke.dispose(),ke.removeEventListener("sessionstart",ct),ke.removeEventListener("sessionend",wt),ue&&(ue.dispose(),ue=null),Ct.stop()};function X(V){V.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const V=vt.autoReset,te=he.enabled,de=he.autoUpdate,oe=he.needsUpdate,ge=he.type;Je(),vt.autoReset=V,he.enabled=te,he.autoUpdate=de,he.needsUpdate=oe,he.type=ge}function De(V){const te=V.target;te.removeEventListener("dispose",De),at(te)}function at(V){ze(V),ve.remove(V)}function ze(V){const te=ve.get(V).programs;te!==void 0&&(te.forEach(function(de){st.releaseProgram(de)}),V.isShaderMaterial&&st.releaseShaderCache(V))}this.renderBufferDirect=function(V,te,de,oe,ge,ht){te===null&&(te=qe);const gt=ge.isMesh&&ge.matrixWorld.determinant()<0,_t=gu(V,te,de,oe,ge);Le.setMaterial(oe,gt);let St=de.index;const Dt=de.attributes.position;if(St===null){if(Dt===void 0||Dt.count===0)return}else if(St.count===0)return;let Nt=1;oe.wireframe===!0&&(St=rt.getWireframeAttribute(de),Nt=2),Ee.setup(ge,oe,_t,de,St);let Vt,yn=Ue;St!==null&&(Vt=Be.get(St),yn=Xe,yn.setIndex(Vt));const Tr=St!==null?St.count:Dt.count,ls=de.drawRange.start*Nt,cs=de.drawRange.count*Nt,ci=ht!==null?ht.start*Nt:0,Pt=ht!==null?ht.count*Nt:1/0,gi=Math.max(ls,ci),Cn=Math.min(Tr,ls+cs,ci+Pt)-1,Zi=Math.max(0,Cn-gi+1);if(Zi!==0){if(ge.isMesh)oe.wireframe===!0?(Le.setLineWidth(oe.wireframeLinewidth*Ke()),yn.setMode(1)):yn.setMode(4);else if(ge.isLine){let or=oe.linewidth;or===void 0&&(or=1),Le.setLineWidth(or*Ke()),ge.isLineSegments?yn.setMode(1):ge.isLineLoop?yn.setMode(2):yn.setMode(3)}else ge.isPoints?yn.setMode(0):ge.isSprite&&yn.setMode(4);if(ge.isInstancedMesh)yn.renderInstances(gi,Zi,ge.count);else if(de.isInstancedBufferGeometry){const or=Math.min(de.instanceCount,de._maxInstanceCount);yn.renderInstances(gi,Zi,or)}else yn.render(gi,Zi)}},this.compile=function(V,te){y=H.get(V),y.init(),w.push(y),V.traverseVisible(function(de){de.isLight&&de.layers.test(te.layers)&&(y.pushLight(de),de.castShadow&&y.pushShadow(de))}),y.setupLights(S.physicallyCorrectLights),V.traverse(function(de){const oe=de.material;if(oe)if(Array.isArray(oe))for(let ge=0;ge<oe.length;ge++){const ht=oe[ge];Hs(ht,V,de)}else Hs(oe,V,de)}),w.pop(),y=null};let et=null;function Ie(V){et&&et(V)}function ct(){Ct.stop()}function wt(){Ct.start()}const Ct=new qE;Ct.setAnimationLoop(Ie),typeof self<"u"&&Ct.setContext(self),this.setAnimationLoop=function(V){et=V,ke.setAnimationLoop(V),V===null?Ct.stop():Ct.start()},ke.addEventListener("sessionstart",ct),ke.addEventListener("sessionend",wt),this.render=function(V,te){if(te!==void 0&&te.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;V.autoUpdate===!0&&V.updateMatrixWorld(),te.parent===null&&te.updateMatrixWorld(),ke.enabled===!0&&ke.isPresenting===!0&&(ke.cameraAutoUpdate===!0&&ke.updateCamera(te),te=ke.getCamera()),V.isScene===!0&&V.onBeforeRender(S,V,te,C),y=H.get(V,w.length),y.init(),w.push(y),Te.multiplyMatrices(te.projectionMatrix,te.matrixWorldInverse),pe.setFromProjectionMatrix(Te),se=this.localClippingEnabled,re=B.init(this.clippingPlanes,se,te),g=yt.get(V,_.length),g.init(),_.push(g),jn(V,te,0,S.sortObjects),g.finish(),S.sortObjects===!0&&g.sort(ne,ce),re===!0&&B.beginShadows();const de=y.state.shadowsArray;if(he.render(de,V,te),re===!0&&B.endShadows(),this.info.autoReset===!0&&this.info.reset(),we.render(g,V),y.setupLights(S.physicallyCorrectLights),te.isArrayCamera){const oe=te.cameras;for(let ge=0,ht=oe.length;ge<ht;ge++){const gt=oe[ge];Yi(g,V,gt,gt.viewport)}}else Yi(g,V,te);C!==null&&(xe.updateMultisampleRenderTarget(C),xe.updateRenderTargetMipmap(C)),V.isScene===!0&&V.onAfterRender(S,V,te),Ee.resetDefaultState(),A=-1,D=null,w.pop(),w.length>0?y=w[w.length-1]:y=null,_.pop(),_.length>0?g=_[_.length-1]:g=null};function jn(V,te,de,oe){if(V.visible===!1)return;if(V.layers.test(te.layers)){if(V.isGroup)de=V.renderOrder;else if(V.isLOD)V.autoUpdate===!0&&V.update(te);else if(V.isLight)y.pushLight(V),V.castShadow&&y.pushShadow(V);else if(V.isSprite){if(!V.frustumCulled||pe.intersectsSprite(V)){oe&&Ce.setFromMatrixPosition(V.matrixWorld).applyMatrix4(Te);const gt=ot.update(V),_t=V.material;_t.visible&&g.push(V,gt,_t,de,Ce.z,null)}}else if((V.isMesh||V.isLine||V.isPoints)&&(V.isSkinnedMesh&&V.skeleton.frame!==vt.render.frame&&(V.skeleton.update(),V.skeleton.frame=vt.render.frame),!V.frustumCulled||pe.intersectsObject(V))){oe&&Ce.setFromMatrixPosition(V.matrixWorld).applyMatrix4(Te);const gt=ot.update(V),_t=V.material;if(Array.isArray(_t)){const St=gt.groups;for(let Dt=0,Nt=St.length;Dt<Nt;Dt++){const Vt=St[Dt],yn=_t[Vt.materialIndex];yn&&yn.visible&&g.push(V,gt,yn,de,Ce.z,Vt)}}else _t.visible&&g.push(V,gt,_t,de,Ce.z,null)}}const ht=V.children;for(let gt=0,_t=ht.length;gt<_t;gt++)jn(ht[gt],te,de,oe)}function Yi(V,te,de,oe){const ge=V.opaque,ht=V.transmissive,gt=V.transparent;y.setupLightsView(de),ht.length>0&&Us(ge,te,de),oe&&Le.viewport(I.copy(oe)),ge.length>0&&Fs(ge,te,de),ht.length>0&&Fs(ht,te,de),gt.length>0&&Fs(gt,te,de),Le.buffers.depth.setTest(!0),Le.buffers.depth.setMask(!0),Le.buffers.color.setMask(!0),Le.setPolygonOffset(!1)}function Us(V,te,de){const oe=it.isWebGL2;ue===null&&(ue=new Yt(1,1,{generateMipmaps:!0,type:nt.has("EXT_color_buffer_half_float")?Ts:dl,minFilter:od,samples:oe&&s===!0?4:0})),S.getDrawingBufferSize(fe),oe?ue.setSize(fe.x,fe.y):ue.setSize(sm(fe.x),sm(fe.y));const ge=S.getRenderTarget();S.setRenderTarget(ue),S.clear();const ht=S.toneMapping;S.toneMapping=As,Fs(V,te,de),S.toneMapping=ht,xe.updateMultisampleRenderTarget(ue),xe.updateRenderTargetMipmap(ue),S.setRenderTarget(ge)}function Fs(V,te,de){const oe=te.isScene===!0?te.overrideMaterial:null;for(let ge=0,ht=V.length;ge<ht;ge++){const gt=V[ge],_t=gt.object,St=gt.geometry,Dt=oe===null?gt.material:oe,Nt=gt.group;_t.layers.test(de.layers)&&Vs(_t,te,de,St,Dt,Nt)}}function Vs(V,te,de,oe,ge,ht){V.onBeforeRender(S,te,de,oe,ge,ht),V.modelViewMatrix.multiplyMatrices(de.matrixWorldInverse,V.matrixWorld),V.normalMatrix.getNormalMatrix(V.modelViewMatrix),ge.onBeforeRender(S,te,de,oe,V,ht),ge.transparent===!0&&ge.side===_a?(ge.side=xr,ge.needsUpdate=!0,S.renderBufferDirect(de,te,oe,ge,V,ht),ge.side=Oh,ge.needsUpdate=!0,S.renderBufferDirect(de,te,oe,ge,V,ht),ge.side=_a):S.renderBufferDirect(de,te,oe,ge,V,ht),V.onAfterRender(S,te,de,oe,ge,ht)}function Hs(V,te,de){te.isScene!==!0&&(te=qe);const oe=ve.get(V),ge=y.state.lights,ht=y.state.shadowsArray,gt=ge.state.version,_t=st.getParameters(V,ge.state,ht,te,de),St=st.getProgramCacheKey(_t);let Dt=oe.programs;oe.environment=V.isMeshStandardMaterial?te.environment:null,oe.fog=te.fog,oe.envMap=(V.isMeshStandardMaterial?We:Ae).get(V.envMap||oe.environment),Dt===void 0&&(V.addEventListener("dispose",De),Dt=new Map,oe.programs=Dt);let Nt=Dt.get(St);if(Nt!==void 0){if(oe.currentProgram===Nt&&oe.lightsStateVersion===gt)return Co(V,_t),Nt}else _t.uniforms=st.getUniforms(V),V.onBuild(de,_t,S),V.onBeforeCompile(_t,S),Nt=st.acquireProgram(_t,St),Dt.set(St,Nt),oe.uniforms=_t.uniforms;const Vt=oe.uniforms;(!V.isShaderMaterial&&!V.isRawShaderMaterial||V.clipping===!0)&&(Vt.clippingPlanes=B.uniform),Co(V,_t),oe.needsLights=yu(V),oe.lightsStateVersion=gt,oe.needsLights&&(Vt.ambientLightColor.value=ge.state.ambient,Vt.lightProbe.value=ge.state.probe,Vt.directionalLights.value=ge.state.directional,Vt.directionalLightShadows.value=ge.state.directionalShadow,Vt.spotLights.value=ge.state.spot,Vt.spotLightShadows.value=ge.state.spotShadow,Vt.rectAreaLights.value=ge.state.rectArea,Vt.ltc_1.value=ge.state.rectAreaLTC1,Vt.ltc_2.value=ge.state.rectAreaLTC2,Vt.pointLights.value=ge.state.point,Vt.pointLightShadows.value=ge.state.pointShadow,Vt.hemisphereLights.value=ge.state.hemi,Vt.directionalShadowMap.value=ge.state.directionalShadowMap,Vt.directionalShadowMatrix.value=ge.state.directionalShadowMatrix,Vt.spotShadowMap.value=ge.state.spotShadowMap,Vt.spotShadowMatrix.value=ge.state.spotShadowMatrix,Vt.pointShadowMap.value=ge.state.pointShadowMap,Vt.pointShadowMatrix.value=ge.state.pointShadowMatrix);const yn=Nt.getUniforms(),Tr=ma.seqWithValue(yn.seq,Vt);return oe.currentProgram=Nt,oe.uniformsList=Tr,Nt}function Co(V,te){const de=ve.get(V);de.outputEncoding=te.outputEncoding,de.instancing=te.instancing,de.skinning=te.skinning,de.morphTargets=te.morphTargets,de.morphNormals=te.morphNormals,de.morphColors=te.morphColors,de.morphTargetsCount=te.morphTargetsCount,de.numClippingPlanes=te.numClippingPlanes,de.numIntersection=te.numClipIntersection,de.vertexAlphas=te.vertexAlphas,de.vertexTangents=te.vertexTangents,de.toneMapping=te.toneMapping}function gu(V,te,de,oe,ge){te.isScene!==!0&&(te=qe),xe.resetTextureUnits();const ht=te.fog,gt=oe.isMeshStandardMaterial?te.environment:null,_t=C===null?S.outputEncoding:C.isXRRenderTarget===!0?C.texture.encoding:Ds,St=(oe.isMeshStandardMaterial?We:Ae).get(oe.envMap||gt),Dt=oe.vertexColors===!0&&!!de.attributes.color&&de.attributes.color.itemSize===4,Nt=!!oe.normalMap&&!!de.attributes.tangent,Vt=!!de.morphAttributes.position,yn=!!de.morphAttributes.normal,Tr=!!de.morphAttributes.color,ls=oe.toneMapped?S.toneMapping:As,cs=de.morphAttributes.position||de.morphAttributes.normal||de.morphAttributes.color,ci=cs!==void 0?cs.length:0,Pt=ve.get(oe),gi=y.state.lights;if(re===!0&&(se===!0||V!==D)){const Ii=V===D&&oe.id===A;B.setState(oe,V,Ii)}let Cn=!1;oe.version===Pt.__version?(Pt.needsLights&&Pt.lightsStateVersion!==gi.state.version||Pt.outputEncoding!==_t||ge.isInstancedMesh&&Pt.instancing===!1||!ge.isInstancedMesh&&Pt.instancing===!0||ge.isSkinnedMesh&&Pt.skinning===!1||!ge.isSkinnedMesh&&Pt.skinning===!0||Pt.envMap!==St||oe.fog===!0&&Pt.fog!==ht||Pt.numClippingPlanes!==void 0&&(Pt.numClippingPlanes!==B.numPlanes||Pt.numIntersection!==B.numIntersection)||Pt.vertexAlphas!==Dt||Pt.vertexTangents!==Nt||Pt.morphTargets!==Vt||Pt.morphNormals!==yn||Pt.morphColors!==Tr||Pt.toneMapping!==ls||it.isWebGL2===!0&&Pt.morphTargetsCount!==ci)&&(Cn=!0):(Cn=!0,Pt.__version=oe.version);let Zi=Pt.currentProgram;Cn===!0&&(Zi=Hs(oe,te,ge));let or=!1,zr=!1,Gs=!1;const On=Zi.getUniforms(),Ws=Pt.uniforms;if(Le.useProgram(Zi.program)&&(or=!0,zr=!0,Gs=!0),oe.id!==A&&(A=oe.id,zr=!0),or||D!==V){if(On.setValue(me,"projectionMatrix",V.projectionMatrix),it.logarithmicDepthBuffer&&On.setValue(me,"logDepthBufFC",2/(Math.log(V.far+1)/Math.LN2)),D!==V&&(D=V,zr=!0,Gs=!0),oe.isShaderMaterial||oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshStandardMaterial||oe.envMap){const Ii=On.map.cameraPosition;Ii!==void 0&&Ii.setValue(me,Ce.setFromMatrixPosition(V.matrixWorld))}(oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshLambertMaterial||oe.isMeshBasicMaterial||oe.isMeshStandardMaterial||oe.isShaderMaterial)&&On.setValue(me,"isOrthographic",V.isOrthographicCamera===!0),(oe.isMeshPhongMaterial||oe.isMeshToonMaterial||oe.isMeshLambertMaterial||oe.isMeshBasicMaterial||oe.isMeshStandardMaterial||oe.isShaderMaterial||oe.isShadowMaterial||ge.isSkinnedMesh)&&On.setValue(me,"viewMatrix",V.matrixWorldInverse)}if(ge.isSkinnedMesh){On.setOptional(me,ge,"bindMatrix"),On.setOptional(me,ge,"bindMatrixInverse");const Ii=ge.skeleton;Ii&&(it.floatVertexTextures?(Ii.boneTexture===null&&Ii.computeBoneTexture(),On.setValue(me,"boneTexture",Ii.boneTexture,xe),On.setValue(me,"boneTextureSize",Ii.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Po=de.morphAttributes;return(Po.position!==void 0||Po.normal!==void 0||Po.color!==void 0&&it.isWebGL2===!0)&&Ne.update(ge,de,oe,Zi),(zr||Pt.receiveShadow!==ge.receiveShadow)&&(Pt.receiveShadow=ge.receiveShadow,On.setValue(me,"receiveShadow",ge.receiveShadow)),zr&&(On.setValue(me,"toneMappingExposure",S.toneMappingExposure),Pt.needsLights&&Aa(Ws,Gs),ht&&oe.fog===!0&&Ft.refreshFogUniforms(Ws,ht),Ft.refreshMaterialUniforms(Ws,oe,G,j,ue),ma.upload(me,Pt.uniformsList,Ws,xe)),oe.isShaderMaterial&&oe.uniformsNeedUpdate===!0&&(ma.upload(me,Pt.uniformsList,Ws,xe),oe.uniformsNeedUpdate=!1),oe.isSpriteMaterial&&On.setValue(me,"center",ge.center),On.setValue(me,"modelViewMatrix",ge.modelViewMatrix),On.setValue(me,"normalMatrix",ge.normalMatrix),On.setValue(me,"modelMatrix",ge.matrixWorld),Zi}function Aa(V,te){V.ambientLightColor.needsUpdate=te,V.lightProbe.needsUpdate=te,V.directionalLights.needsUpdate=te,V.directionalLightShadows.needsUpdate=te,V.pointLights.needsUpdate=te,V.pointLightShadows.needsUpdate=te,V.spotLights.needsUpdate=te,V.spotLightShadows.needsUpdate=te,V.rectAreaLights.needsUpdate=te,V.hemisphereLights.needsUpdate=te}function yu(V){return V.isMeshLambertMaterial||V.isMeshToonMaterial||V.isMeshPhongMaterial||V.isMeshStandardMaterial||V.isShadowMaterial||V.isShaderMaterial&&V.lights===!0}this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(V,te,de){ve.get(V.texture).__webglTexture=te,ve.get(V.depthTexture).__webglTexture=de;const oe=ve.get(V);oe.__hasExternalTextures=!0,oe.__hasExternalTextures&&(oe.__autoAllocateDepthBuffer=de===void 0,oe.__autoAllocateDepthBuffer||nt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),oe.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(V,te){const de=ve.get(V);de.__webglFramebuffer=te,de.__useDefaultFramebuffer=te===void 0},this.setRenderTarget=function(V,te=0,de=0){C=V,T=te,E=de;let oe=!0;if(V){const St=ve.get(V);St.__useDefaultFramebuffer!==void 0?(Le.bindFramebuffer(36160,null),oe=!1):St.__webglFramebuffer===void 0?xe.setupRenderTarget(V):St.__hasExternalTextures&&xe.rebindTextures(V,ve.get(V.texture).__webglTexture,ve.get(V.depthTexture).__webglTexture)}let ge=null,ht=!1,gt=!1;if(V){const St=V.texture;(St.isData3DTexture||St.isDataArrayTexture)&&(gt=!0);const Dt=ve.get(V).__webglFramebuffer;V.isWebGLCubeRenderTarget?(ge=Dt[te],ht=!0):it.isWebGL2&&V.samples>0&&xe.useMultisampledRTT(V)===!1?ge=ve.get(V).__webglMultisampledFramebuffer:ge=Dt,I.copy(V.viewport),F.copy(V.scissor),P=V.scissorTest}else I.copy(Z).multiplyScalar(G).floor(),F.copy($).multiplyScalar(G).floor(),P=K;if(Le.bindFramebuffer(36160,ge)&&it.drawBuffers&&oe&&Le.drawBuffers(V,ge),Le.viewport(I),Le.scissor(F),Le.setScissorTest(P),ht){const St=ve.get(V.texture);me.framebufferTexture2D(36160,36064,34069+te,St.__webglTexture,de)}else if(gt){const St=ve.get(V.texture),Dt=te||0;me.framebufferTextureLayer(36160,36064,St.__webglTexture,de||0,Dt)}A=-1},this.readRenderTargetPixels=function(V,te,de,oe,ge,ht,gt){if(!(V&&V.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _t=ve.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&>!==void 0&&(_t=_t[gt]),_t){Le.bindFramebuffer(36160,_t);try{const St=V.texture,Dt=St.format,Nt=St.type;if(Dt!==Or&&U.convert(Dt)!==me.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Vt=Nt===Ts&&(nt.has("EXT_color_buffer_half_float")||it.isWebGL2&&nt.has("EXT_color_buffer_float"));if(Nt!==dl&&U.convert(Nt)!==me.getParameter(35738)&&!(Nt===is&&(it.isWebGL2||nt.has("OES_texture_float")||nt.has("WEBGL_color_buffer_float")))&&!Vt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}te>=0&&te<=V.width-oe&&de>=0&&de<=V.height-ge&&me.readPixels(te,de,oe,ge,U.convert(Dt),U.convert(Nt),ht)}finally{const St=C!==null?ve.get(C).__webglFramebuffer:null;Le.bindFramebuffer(36160,St)}}},this.copyFramebufferToTexture=function(V,te,de=0){if(te.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}const oe=Math.pow(2,-de),ge=Math.floor(te.image.width*oe),ht=Math.floor(te.image.height*oe);xe.setTexture2D(te,0),me.copyTexSubImage2D(3553,de,0,0,V.x,V.y,ge,ht),Le.unbindTexture()},this.copyTextureToTexture=function(V,te,de,oe=0){const ge=te.image.width,ht=te.image.height,gt=U.convert(de.format),_t=U.convert(de.type);xe.setTexture2D(de,0),me.pixelStorei(37440,de.flipY),me.pixelStorei(37441,de.premultiplyAlpha),me.pixelStorei(3317,de.unpackAlignment),te.isDataTexture?me.texSubImage2D(3553,oe,V.x,V.y,ge,ht,gt,_t,te.image.data):te.isCompressedTexture?me.compressedTexSubImage2D(3553,oe,V.x,V.y,te.mipmaps[0].width,te.mipmaps[0].height,gt,te.mipmaps[0].data):me.texSubImage2D(3553,oe,V.x,V.y,gt,_t,te.image),oe===0&&de.generateMipmaps&&me.generateMipmap(3553),Le.unbindTexture()},this.copyTextureToTexture3D=function(V,te,de,oe,ge=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ht=V.max.x-V.min.x+1,gt=V.max.y-V.min.y+1,_t=V.max.z-V.min.z+1,St=U.convert(oe.format),Dt=U.convert(oe.type);let Nt;if(oe.isData3DTexture)xe.setTexture3D(oe,0),Nt=32879;else if(oe.isDataArrayTexture)xe.setTexture2DArray(oe,0),Nt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}me.pixelStorei(37440,oe.flipY),me.pixelStorei(37441,oe.premultiplyAlpha),me.pixelStorei(3317,oe.unpackAlignment);const Vt=me.getParameter(3314),yn=me.getParameter(32878),Tr=me.getParameter(3316),ls=me.getParameter(3315),cs=me.getParameter(32877),ci=de.isCompressedTexture?de.mipmaps[0]:de.image;me.pixelStorei(3314,ci.width),me.pixelStorei(32878,ci.height),me.pixelStorei(3316,V.min.x),me.pixelStorei(3315,V.min.y),me.pixelStorei(32877,V.min.z),de.isDataTexture||de.isData3DTexture?me.texSubImage3D(Nt,ge,te.x,te.y,te.z,ht,gt,_t,St,Dt,ci.data):de.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),me.compressedTexSubImage3D(Nt,ge,te.x,te.y,te.z,ht,gt,_t,St,ci.data)):me.texSubImage3D(Nt,ge,te.x,te.y,te.z,ht,gt,_t,St,Dt,ci),me.pixelStorei(3314,Vt),me.pixelStorei(32878,yn),me.pixelStorei(3316,Tr),me.pixelStorei(3315,ls),me.pixelStorei(32877,cs),ge===0&&oe.generateMipmaps&&me.generateMipmap(Nt),Le.unbindTexture()},this.initTexture=function(V){xe.setTexture2D(V,0),Le.unbindTexture()},this.resetState=function(){T=0,E=0,C=null,Le.reset(),Ee.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}cn.prototype.isWebGLRenderer=!0;class BB extends cn{}BB.prototype.isWebGL1Renderer=!0;class Gm{constructor(e,t=1,n=1e3){this.name="",this.color=new Pe(e),this.near=t,this.far=n}clone(){return new Gm(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Gm.prototype.isFog=!0;class cx extends $t{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}cx.prototype.isScene=!0;class cd{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Bh,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=kr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[n+r];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=kr()),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=kr()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}cd.prototype.isInterleavedBuffer=!0;const Fi=new z;class Fh{constructor(e,t,n,r=!1){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}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++)Fi.fromBufferAttribute(this,t),Fi.applyMatrix4(e),this.setXYZ(t,Fi.x,Fi.y,Fi.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Fi.fromBufferAttribute(this,t),Fi.applyNormalMatrix(e),this.setXYZ(t,Fi.x,Fi.y,Fi.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Fi.fromBufferAttribute(this,t),Fi.transformDirection(e),this.setXYZ(t,Fi.x,Fi.y,Fi.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Wn(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 Fh(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+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}}}Fh.prototype.isInterleavedBufferAttribute=!0;class ud extends li{constructor(e){super(),this.type="SpriteMaterial",this.color=new Pe(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}}ud.prototype.isSpriteMaterial=!0;let wc;const nh=new z,Sc=new z,Mc=new z,Ec=new ae,ih=new ae,n2=new Qe,of=new z,rh=new z,af=new z,dS=new ae,vy=new ae,pS=new ae;class ux extends $t{constructor(e){if(super(),this.type="Sprite",wc===void 0){wc=new zt;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 cd(t,5);wc.setIndex([0,1,2,0,2,3]),wc.setAttribute("position",new Fh(n,3,0,!1)),wc.setAttribute("uv",new Fh(n,2,3,!1))}this.geometry=wc,this.material=e!==void 0?e:new ud,this.center=new ae(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Sc.setFromMatrixScale(this.matrixWorld),n2.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Mc.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Sc.multiplyScalar(-Mc.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const o=this.center;lf(of.set(-.5,-.5,0),Mc,o,Sc,r,s),lf(rh.set(.5,-.5,0),Mc,o,Sc,r,s),lf(af.set(.5,.5,0),Mc,o,Sc,r,s),dS.set(0,0),vy.set(1,0),pS.set(1,1);let l=e.ray.intersectTriangle(of,rh,af,!1,nh);if(l===null&&(lf(rh.set(-.5,.5,0),Mc,o,Sc,r,s),vy.set(0,1),l=e.ray.intersectTriangle(of,af,rh,!1,nh),l===null))return;const h=e.ray.origin.distanceTo(nh);h<e.near||h>e.far||t.push({distance:h,point:nh.clone(),uv:oi.getUV(nh,of,rh,af,dS,vy,pS,new ae),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}ux.prototype.isSprite=!0;function lf(i,e,t,n,r,s){Ec.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ih.x=s*Ec.x-r*Ec.y,ih.y=r*Ec.x+s*Ec.y):ih.copy(Ec),i.copy(e),i.x+=ih.x,i.y+=ih.y,i.applyMatrix4(n2)}const fS=new z,mS=new dn,vS=new dn,zB=new z,gS=new Qe;class i2 extends In{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Qe,this.bindMatrixInverse=new Qe}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}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 dn,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;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==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const n=this.skeleton,r=this.geometry;mS.fromBufferAttribute(r.attributes.skinIndex,e),vS.fromBufferAttribute(r.attributes.skinWeight,e),fS.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=vS.getComponent(s);if(o!==0){const l=mS.getComponent(s);gS.multiplyMatrices(n.bones[l].matrixWorld,n.boneInverses[l]),t.addScaledVector(zB.copy(fS).applyMatrix4(gS),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}i2.prototype.isSkinnedMesh=!0;class hx extends $t{constructor(){super(),this.type="Bone"}}hx.prototype.isBone=!0;class dx extends ti{constructor(e=null,t=1,n=1,r,s,o,l,h,d=Xt,f=Xt,g,y){super(null,o,l,h,d,f,r,s,g,y),this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}dx.prototype.isDataTexture=!0;const yS=new Qe,UB=new Qe;class r2{constructor(e=[],t=[]){this.uuid=kr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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,r=this.bones.length;n<r;n++)this.boneInverses.push(new Qe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Qe;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,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const l=e[s]?e[s].matrixWorld:UB;yS.multiplyMatrices(l,t[s]),yS.toArray(n,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new r2(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=VE(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new dx(t,e,e,Or,is);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new hx),this.bones.push(o),this.boneInverses.push(new Qe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const l=n[r];e.boneInverses.push(l.toArray())}return e}}class Ky extends Wn{constructor(e,t,n,r=1){typeof n=="number"&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,n),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}Ky.prototype.isInstancedBufferAttribute=!0;const _S=new Qe,xS=new Qe,cf=[],sh=new In;class FB extends In{constructor(e,t,n){super(e,t),this.instanceMatrix=new Ky(new Float32Array(n*16),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const n=this.matrixWorld,r=this.count;if(sh.geometry=this.geometry,sh.material=this.material,sh.material!==void 0)for(let s=0;s<r;s++){this.getMatrixAt(s,_S),xS.multiplyMatrices(n,_S),sh.matrixWorld=xS,sh.raycast(e,cf);for(let o=0,l=cf.length;o<l;o++){const h=cf[o];h.instanceId=s,h.object=this,t.push(h)}cf.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ky(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}FB.prototype.isInstancedMesh=!0;class os extends li{constructor(e){super(),this.type="LineBasicMaterial",this.color=new Pe(16777215),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.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}os.prototype.isLineBasicMaterial=!0;const bS=new z,wS=new z,SS=new Qe,gy=new Mo,uf=new su;class jc extends $t{constructor(e=new zt,t=new os){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)bS.fromBufferAttribute(t,r-1),wS.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=bS.distanceTo(wS);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),uf.copy(n.boundingSphere),uf.applyMatrix4(r),uf.radius+=s,e.ray.intersectsSphere(uf)===!1)return;SS.copy(r).invert(),gy.copy(e.ray).applyMatrix4(SS);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),h=l*l,d=new z,f=new z,g=new z,y=new z,_=this.isLineSegments?2:1;if(n.isBufferGeometry){const w=n.index,b=n.attributes.position;if(w!==null){const T=Math.max(0,o.start),E=Math.min(w.count,o.start+o.count);for(let C=T,A=E-1;C<A;C+=_){const D=w.getX(C),I=w.getX(C+1);if(d.fromBufferAttribute(b,D),f.fromBufferAttribute(b,I),gy.distanceSqToSegment(d,f,y,g)>h)continue;y.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(y);P<e.near||P>e.far||t.push({distance:P,point:g.clone().applyMatrix4(this.matrixWorld),index:C,face:null,faceIndex:null,object:this})}}else{const T=Math.max(0,o.start),E=Math.min(b.count,o.start+o.count);for(let C=T,A=E-1;C<A;C+=_){if(d.fromBufferAttribute(b,C),f.fromBufferAttribute(b,C+1),gy.distanceSqToSegment(d,f,y,g)>h)continue;y.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(y);I<e.near||I>e.far||t.push({distance:I,point:g.clone().applyMatrix4(this.matrixWorld),index:C,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}jc.prototype.isLine=!0;const MS=new z,ES=new z;class fl extends jc{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)MS.fromBufferAttribute(t,r),ES.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+MS.distanceTo(ES);e.setAttribute("lineDistance",new xt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}fl.prototype.isLineSegments=!0;class VB extends jc{constructor(e,t){super(e,t),this.type="LineLoop"}}VB.prototype.isLineLoop=!0;class px extends li{constructor(e){super(),this.type="PointsMaterial",this.color=new Pe(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}}px.prototype.isPointsMaterial=!0;const TS=new Qe,Jy=new Mo,hf=new su,df=new z;class HB extends $t{constructor(e=new zt,t=new px){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),hf.copy(n.boundingSphere),hf.applyMatrix4(r),hf.radius+=s,e.ray.intersectsSphere(hf)===!1)return;TS.copy(r).invert(),Jy.copy(e.ray).applyMatrix4(TS);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),h=l*l;if(n.isBufferGeometry){const d=n.index,g=n.attributes.position;if(d!==null){const y=Math.max(0,o.start),_=Math.min(d.count,o.start+o.count);for(let w=y,S=_;w<S;w++){const b=d.getX(w);df.fromBufferAttribute(g,b),AS(df,b,h,r,e,t,this)}}else{const y=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let w=y,S=_;w<S;w++)df.fromBufferAttribute(g,w),AS(df,w,h,r,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}HB.prototype.isPoints=!0;function AS(i,e,t,n,r,s,o){const l=Jy.distanceSqToPoint(i);if(l<t){const h=new z;Jy.closestPointToPoint(i,h),h.applyMatrix4(n);const d=r.ray.origin.distanceTo(h);if(d<r.near||d>r.far)return;s.push({distance:d,distanceToRay:Math.sqrt(l),point:h,index:e,face:null,object:o})}}class s2 extends ti{constructor(e,t,n,r,s,o,l,h,d){super(e,t,n,r,s,o,l,h,d),this.minFilter=o!==void 0?o:Hn,this.magFilter=s!==void 0?s:Hn,this.generateMipmaps=!1;const f=this;function g(){f.needsUpdate=!0,e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(g)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}s2.prototype.isVideoTexture=!0;class GB extends ti{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=Xt,this.minFilter=Xt,this.generateMipmaps=!1,this.needsUpdate=!0}}GB.prototype.isFramebufferTexture=!0;class WB extends ti{constructor(e,t,n,r,s,o,l,h,d,f,g,y){super(null,o,l,h,d,f,r,s,g,y),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}WB.prototype.isCompressedTexture=!0;class jB extends ti{constructor(e,t,n,r,s,o,l,h,d){super(e,t,n,r,s,o,l,h,d),this.needsUpdate=!0}}jB.prototype.isCanvasTexture=!0;class Nr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let r=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let l=0,h=s-1,d;for(;l<=h;)if(r=Math.floor(l+(h-l)/2),d=n[r]-o,d<0)l=r+1;else if(d>0)h=r-1;else{h=r;break}if(r=h,n[r]===o)return r/(s-1);const f=n[r],y=n[r+1]-f,_=(o-f)/y;return(r+_)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),l=this.getPoint(s),h=t||(o.isVector2?new ae:new z);return h.copy(l).sub(o).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new z,r=[],s=[],o=[],l=new z,h=new Qe;for(let _=0;_<=e;_++){const w=_/e;r[_]=this.getTangentAt(w,new z)}s[0]=new z,o[0]=new z;let d=Number.MAX_VALUE;const f=Math.abs(r[0].x),g=Math.abs(r[0].y),y=Math.abs(r[0].z);f<=d&&(d=f,n.set(1,0,0)),g<=d&&(d=g,n.set(0,1,0)),y<=d&&n.set(0,0,1),l.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],l),o[0].crossVectors(r[0],s[0]);for(let _=1;_<=e;_++){if(s[_]=s[_-1].clone(),o[_]=o[_-1].clone(),l.crossVectors(r[_-1],r[_]),l.length()>Number.EPSILON){l.normalize();const w=Math.acos(Jn(r[_-1].dot(r[_]),-1,1));s[_].applyMatrix4(h.makeRotationAxis(l,w))}o[_].crossVectors(r[_],s[_])}if(t===!0){let _=Math.acos(Jn(s[0].dot(s[e]),-1,1));_/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(_=-_);for(let w=1;w<=e;w++)s[w].applyMatrix4(h.makeRotationAxis(r[w],_*w)),o[w].crossVectors(r[w],s[w])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Wm extends Nr{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,l=!1,h=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=l,this.aRotation=h}getPoint(e,t){const n=t||new ae,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const l=this.aStartAngle+e*s;let h=this.aX+this.xRadius*Math.cos(l),d=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const f=Math.cos(this.aRotation),g=Math.sin(this.aRotation),y=h-this.aX,_=d-this.aY;h=y*f-_*g+this.aX,d=y*g+_*f+this.aY}return n.set(h,d)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}Wm.prototype.isEllipseCurve=!0;class o2 extends Wm{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.type="ArcCurve"}}o2.prototype.isArcCurve=!0;function fx(){let i=0,e=0,t=0,n=0;function r(s,o,l,h){i=s,e=l,t=-3*s+3*o-2*l-h,n=2*s-2*o+l+h}return{initCatmullRom:function(s,o,l,h,d){r(o,l,d*(l-s),d*(h-o))},initNonuniformCatmullRom:function(s,o,l,h,d,f,g){let y=(o-s)/d-(l-s)/(d+f)+(l-o)/f,_=(l-o)/f-(h-o)/(f+g)+(h-l)/g;y*=f,_*=f,r(o,l,y,_)},calc:function(s){const o=s*s,l=o*s;return i+e*s+t*o+n*l}}}const pf=new z,yy=new fx,_y=new fx,xy=new fx;class a2 extends Nr{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new z){const n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let l=Math.floor(o),h=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/s)+1)*s:h===0&&l===s-1&&(l=s-2,h=1);let d,f;this.closed||l>0?d=r[(l-1)%s]:(pf.subVectors(r[0],r[1]).add(r[0]),d=pf);const g=r[l%s],y=r[(l+1)%s];if(this.closed||l+2<s?f=r[(l+2)%s]:(pf.subVectors(r[s-1],r[s-2]).add(r[s-1]),f=pf),this.curveType==="centripetal"||this.curveType==="chordal"){const _=this.curveType==="chordal"?.5:.25;let w=Math.pow(d.distanceToSquared(g),_),S=Math.pow(g.distanceToSquared(y),_),b=Math.pow(y.distanceToSquared(f),_);S<1e-4&&(S=1),w<1e-4&&(w=S),b<1e-4&&(b=S),yy.initNonuniformCatmullRom(d.x,g.x,y.x,f.x,w,S,b),_y.initNonuniformCatmullRom(d.y,g.y,y.y,f.y,w,S,b),xy.initNonuniformCatmullRom(d.z,g.z,y.z,f.z,w,S,b)}else this.curveType==="catmullrom"&&(yy.initCatmullRom(d.x,g.x,y.x,f.x,this.tension),_y.initCatmullRom(d.y,g.y,y.y,f.y,this.tension),xy.initCatmullRom(d.z,g.z,y.z,f.z,this.tension));return n.set(yy.calc(h),_y.calc(h),xy.calc(h)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new z().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}a2.prototype.isCatmullRomCurve3=!0;function CS(i,e,t,n,r){const s=(n-e)*.5,o=(r-t)*.5,l=i*i,h=i*l;return(2*t-2*n+s+o)*h+(-3*t+3*n-2*s-o)*l+s*i+t}function XB(i,e){const t=1-i;return t*t*e}function qB(i,e){return 2*(1-i)*i*e}function YB(i,e){return i*i*e}function xh(i,e,t,n){return XB(i,e)+qB(i,t)+YB(i,n)}function ZB(i,e){const t=1-i;return t*t*t*e}function KB(i,e){const t=1-i;return 3*t*t*i*e}function JB(i,e){return 3*(1-i)*i*i*e}function QB(i,e){return i*i*i*e}function bh(i,e,t,n,r){return ZB(i,e)+KB(i,t)+JB(i,n)+QB(i,r)}class mx extends Nr{constructor(e=new ae,t=new ae,n=new ae,r=new ae){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ae){const n=t,r=this.v0,s=this.v1,o=this.v2,l=this.v3;return n.set(bh(e,r.x,s.x,o.x,l.x),bh(e,r.y,s.y,o.y,l.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}mx.prototype.isCubicBezierCurve=!0;class l2 extends Nr{constructor(e=new z,t=new z,n=new z,r=new z){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new z){const n=t,r=this.v0,s=this.v1,o=this.v2,l=this.v3;return n.set(bh(e,r.x,s.x,o.x,l.x),bh(e,r.y,s.y,o.y,l.y),bh(e,r.z,s.z,o.z,l.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}l2.prototype.isCubicBezierCurve3=!0;class jm extends Nr{constructor(e=new ae,t=new ae){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ae){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const n=t||new ae;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}jm.prototype.isLineCurve=!0;class $B extends Nr{constructor(e=new z,t=new z){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new z){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class vx extends Nr{constructor(e=new ae,t=new ae,n=new ae){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ae){const n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(xh(e,r.x,s.x,o.x),xh(e,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}vx.prototype.isQuadraticBezierCurve=!0;class c2 extends Nr{constructor(e=new z,t=new z,n=new z){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new z){const n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(xh(e,r.x,s.x,o.x),xh(e,r.y,s.y,o.y),xh(e,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}c2.prototype.isQuadraticBezierCurve3=!0;class gx extends Nr{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new ae){const n=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),l=s-o,h=r[o===0?o:o-1],d=r[o],f=r[o>r.length-2?r.length-1:o+1],g=r[o>r.length-3?r.length-1:o+2];return n.set(CS(l,h.x,d.x,f.x,g.x),CS(l,h.y,d.y,f.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ae().fromArray(r))}return this}}gx.prototype.isSplineCurve=!0;var u2=Object.freeze({__proto__:null,ArcCurve:o2,CatmullRomCurve3:a2,CubicBezierCurve:mx,CubicBezierCurve3:l2,EllipseCurve:Wm,LineCurve:jm,LineCurve3:$B,QuadraticBezierCurve:vx,QuadraticBezierCurve3:c2,SplineCurve:gx});class e6 extends Nr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new jm(t,e))}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=n){const o=r[s]-n,l=this.curves[s],h=l.getLength(),d=h===0?0:1-o/h;return l.getPointAt(d,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],l=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,h=o.getPoints(l);for(let d=0;d<h.length;d++){const f=h[d];n&&n.equals(f)||(t.push(f),n=f)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(new u2[r.type]().fromJSON(r))}return this}}class om extends e6{constructor(e){super(),this.type="Path",this.currentPoint=new ae,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new jm(this.currentPoint.clone(),new ae(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const s=new vx(this.currentPoint.clone(),new ae(e,t),new ae(n,r));return this.curves.push(s),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,s,o){const l=new mx(this.currentPoint.clone(),new ae(e,t),new ae(n,r),new ae(s,o));return this.curves.push(l),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new gx(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(e+l,t+h,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,l,h){const d=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+d,t+f,n,r,s,o,l,h),this}absellipse(e,t,n,r,s,o,l,h){const d=new Wm(e,t,n,r,s,o,l,h);if(this.curves.length>0){const g=d.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(d);const f=d.getPoint(1);return this.currentPoint.copy(f),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class yx extends zt{constructor(e=1,t=8,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const s=[],o=[],l=[],h=[],d=new z,f=new ae;o.push(0,0,0),l.push(0,0,1),h.push(.5,.5);for(let g=0,y=3;g<=t;g++,y+=3){const _=n+g/t*r;d.x=e*Math.cos(_),d.y=e*Math.sin(_),o.push(d.x,d.y,d.z),l.push(0,0,1),f.x=(o[y]/e+1)/2,f.y=(o[y+1]/e+1)/2,h.push(f.x,f.y)}for(let g=1;g<=t;g++)s.push(g,g+1,0);this.setIndex(s),this.setAttribute("position",new xt(o,3)),this.setAttribute("normal",new xt(l,3)),this.setAttribute("uv",new xt(h,2))}static fromJSON(e){return new yx(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Xm extends zt{constructor(e=1,t=1,n=1,r=8,s=1,o=!1,l=0,h=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:h};const d=this;r=Math.floor(r),s=Math.floor(s);const f=[],g=[],y=[],_=[];let w=0;const S=[],b=n/2;let T=0;E(),o===!1&&(e>0&&C(!0),t>0&&C(!1)),this.setIndex(f),this.setAttribute("position",new xt(g,3)),this.setAttribute("normal",new xt(y,3)),this.setAttribute("uv",new xt(_,2));function E(){const A=new z,D=new z;let I=0;const F=(t-e)/n;for(let P=0;P<=s;P++){const k=[],j=P/s,G=j*(t-e)+e;for(let ne=0;ne<=r;ne++){const ce=ne/r,Z=ce*h+l,$=Math.sin(Z),K=Math.cos(Z);D.x=G*$,D.y=-j*n+b,D.z=G*K,g.push(D.x,D.y,D.z),A.set($,F,K).normalize(),y.push(A.x,A.y,A.z),_.push(ce,1-j),k.push(w++)}S.push(k)}for(let P=0;P<r;P++)for(let k=0;k<s;k++){const j=S[k][P],G=S[k+1][P],ne=S[k+1][P+1],ce=S[k][P+1];f.push(j,G,ce),f.push(G,ne,ce),I+=6}d.addGroup(T,I,0),T+=I}function C(A){const D=w,I=new ae,F=new z;let P=0;const k=A===!0?e:t,j=A===!0?1:-1;for(let ne=1;ne<=r;ne++)g.push(0,b*j,0),y.push(0,j,0),_.push(.5,.5),w++;const G=w;for(let ne=0;ne<=r;ne++){const Z=ne/r*h+l,$=Math.cos(Z),K=Math.sin(Z);F.x=k*K,F.y=b*j,F.z=k*$,g.push(F.x,F.y,F.z),y.push(0,j,0),I.x=$*.5+.5,I.y=K*.5*j+.5,_.push(I.x,I.y),w++}for(let ne=0;ne<r;ne++){const ce=D+ne,Z=G+ne;A===!0?f.push(Z,Z+1,ce):f.push(Z+1,Z,ce),P+=3}d.addGroup(T,P,A===!0?1:2),T+=P}}static fromJSON(e){return new Xm(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class _x extends Xm{constructor(e=1,t=1,n=8,r=1,s=!1,o=0,l=Math.PI*2){super(0,e,t,n,r,s,o,l),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:l}}static fromJSON(e){return new _x(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class qm extends zt{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const s=[],o=[];l(r),d(n),f(),this.setAttribute("position",new xt(s,3)),this.setAttribute("normal",new xt(s.slice(),3)),this.setAttribute("uv",new xt(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function l(E){const C=new z,A=new z,D=new z;for(let I=0;I<t.length;I+=3)_(t[I+0],C),_(t[I+1],A),_(t[I+2],D),h(C,A,D,E)}function h(E,C,A,D){const I=D+1,F=[];for(let P=0;P<=I;P++){F[P]=[];const k=E.clone().lerp(A,P/I),j=C.clone().lerp(A,P/I),G=I-P;for(let ne=0;ne<=G;ne++)ne===0&&P===I?F[P][ne]=k:F[P][ne]=k.clone().lerp(j,ne/G)}for(let P=0;P<I;P++)for(let k=0;k<2*(I-P)-1;k++){const j=Math.floor(k/2);k%2===0?(y(F[P][j+1]),y(F[P+1][j]),y(F[P][j])):(y(F[P][j+1]),y(F[P+1][j+1]),y(F[P+1][j]))}}function d(E){const C=new z;for(let A=0;A<s.length;A+=3)C.x=s[A+0],C.y=s[A+1],C.z=s[A+2],C.normalize().multiplyScalar(E),s[A+0]=C.x,s[A+1]=C.y,s[A+2]=C.z}function f(){const E=new z;for(let C=0;C<s.length;C+=3){E.x=s[C+0],E.y=s[C+1],E.z=s[C+2];const A=b(E)/2/Math.PI+.5,D=T(E)/Math.PI+.5;o.push(A,1-D)}w(),g()}function g(){for(let E=0;E<o.length;E+=6){const C=o[E+0],A=o[E+2],D=o[E+4],I=Math.max(C,A,D),F=Math.min(C,A,D);I>.9&&F<.1&&(C<.2&&(o[E+0]+=1),A<.2&&(o[E+2]+=1),D<.2&&(o[E+4]+=1))}}function y(E){s.push(E.x,E.y,E.z)}function _(E,C){const A=E*3;C.x=e[A+0],C.y=e[A+1],C.z=e[A+2]}function w(){const E=new z,C=new z,A=new z,D=new z,I=new ae,F=new ae,P=new ae;for(let k=0,j=0;k<s.length;k+=9,j+=6){E.set(s[k+0],s[k+1],s[k+2]),C.set(s[k+3],s[k+4],s[k+5]),A.set(s[k+6],s[k+7],s[k+8]),I.set(o[j+0],o[j+1]),F.set(o[j+2],o[j+3]),P.set(o[j+4],o[j+5]),D.copy(E).add(C).add(A).divideScalar(3);const G=b(D);S(I,j+0,E,G),S(F,j+2,C,G),S(P,j+4,A,G)}}function S(E,C,A,D){D<0&&E.x===1&&(o[C]=E.x-1),A.x===0&&A.z===0&&(o[C]=D/2/Math.PI+.5)}function b(E){return Math.atan2(E.z,-E.x)}function T(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}static fromJSON(e){return new qm(e.vertices,e.indices,e.radius,e.details)}}class va extends om{constructor(e){super(e),this.uuid=kr(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(new om().fromJSON(r))}return this}}const t6={triangulate:function(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let s=h2(i,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let l,h,d,f,g,y,_;if(n&&(s=o6(i,e,s,t)),i.length>80*t){l=d=i[0],h=f=i[1];for(let w=t;w<r;w+=t)g=i[w],y=i[w+1],g<l&&(l=g),y<h&&(h=y),g>d&&(d=g),y>f&&(f=y);_=Math.max(d-l,f-h),_=_!==0?1/_:0}return Vh(s,o,t,l,h,_),o}};function h2(i,e,t,n,r){let s,o;if(r===g6(i,e,t,n)>0)for(s=e;s<t;s+=n)o=PS(s,i[s],i[s+1],o);else for(s=t-n;s>=e;s-=n)o=PS(s,i[s],i[s+1],o);return o&&Ym(o,o.next)&&(Gh(o),o=o.next),o}function xa(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Ym(t,t.next)||zn(t.prev,t,t.next)===0)){if(Gh(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Vh(i,e,t,n,r,s,o){if(!i)return;!o&&s&&h6(i,n,r,s);let l=i,h,d;for(;i.prev!==i.next;){if(h=i.prev,d=i.next,s?i6(i,n,r,s):n6(i)){e.push(h.i/t),e.push(i.i/t),e.push(d.i/t),Gh(i),i=d.next,l=d.next;continue}if(i=d,i===l){o?o===1?(i=r6(xa(i),e,t),Vh(i,e,t,n,r,s,2)):o===2&&s6(i,e,t,n,r,s):Vh(xa(i),e,t,n,r,s,1);break}}}function n6(i){const e=i.prev,t=i,n=i.next;if(zn(e,t,n)>=0)return!1;let r=i.next.next;for(;r!==i.prev;){if(Nc(e.x,e.y,t.x,t.y,n.x,n.y,r.x,r.y)&&zn(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function i6(i,e,t,n){const r=i.prev,s=i,o=i.next;if(zn(r,s,o)>=0)return!1;const l=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,d=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,f=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,g=Qy(l,h,e,t,n),y=Qy(d,f,e,t,n);let _=i.prevZ,w=i.nextZ;for(;_&&_.z>=g&&w&&w.z<=y;){if(_!==i.prev&&_!==i.next&&Nc(r.x,r.y,s.x,s.y,o.x,o.y,_.x,_.y)&&zn(_.prev,_,_.next)>=0||(_=_.prevZ,w!==i.prev&&w!==i.next&&Nc(r.x,r.y,s.x,s.y,o.x,o.y,w.x,w.y)&&zn(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;_&&_.z>=g;){if(_!==i.prev&&_!==i.next&&Nc(r.x,r.y,s.x,s.y,o.x,o.y,_.x,_.y)&&zn(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;w&&w.z<=y;){if(w!==i.prev&&w!==i.next&&Nc(r.x,r.y,s.x,s.y,o.x,o.y,w.x,w.y)&&zn(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function r6(i,e,t){let n=i;do{const r=n.prev,s=n.next.next;!Ym(r,s)&&d2(r,n,n.next,s)&&Hh(r,s)&&Hh(s,r)&&(e.push(r.i/t),e.push(n.i/t),e.push(s.i/t),Gh(n),Gh(n.next),n=i=s),n=n.next}while(n!==i);return xa(n)}function s6(i,e,t,n,r,s){let o=i;do{let l=o.next.next;for(;l!==o.prev;){if(o.i!==l.i&&f6(o,l)){let h=p2(o,l);o=xa(o,o.next),h=xa(h,h.next),Vh(o,e,t,n,r,s),Vh(h,e,t,n,r,s);return}l=l.next}o=o.next}while(o!==i)}function o6(i,e,t,n){const r=[];let s,o,l,h,d;for(s=0,o=e.length;s<o;s++)l=e[s]*n,h=s<o-1?e[s+1]*n:i.length,d=h2(i,l,h,n,!1),d===d.next&&(d.steiner=!0),r.push(p6(d));for(r.sort(a6),s=0;s<r.length;s++)l6(r[s],t),t=xa(t,t.next);return t}function a6(i,e){return i.x-e.x}function l6(i,e){if(e=c6(i,e),e){const t=p2(e,i);xa(e,e.next),xa(t,t.next)}}function c6(i,e){let t=e;const n=i.x,r=i.y;let s=-1/0,o;do{if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const y=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(y<=n&&y>s){if(s=y,y===n){if(r===t.y)return t;if(r===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(n===s)return o;const l=o,h=o.x,d=o.y;let f=1/0,g;t=o;do n>=t.x&&t.x>=h&&n!==t.x&&Nc(r<d?n:s,r,h,d,r<d?s:n,r,t.x,t.y)&&(g=Math.abs(r-t.y)/(n-t.x),Hh(t,i)&&(g<f||g===f&&(t.x>o.x||t.x===o.x&&u6(o,t)))&&(o=t,f=g)),t=t.next;while(t!==l);return o}function u6(i,e){return zn(i.prev,i,e.prev)<0&&zn(e.next,i,i.next)<0}function h6(i,e,t,n){let r=i;do r.z===null&&(r.z=Qy(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,d6(r)}function d6(i){let e,t,n,r,s,o,l,h,d=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,n=t,l=0,e=0;e<d&&(l++,n=n.nextZ,!!n);e++);for(h=d;l>0||h>0&&n;)l!==0&&(h===0||!n||t.z<=n.z)?(r=t,t=t.nextZ,l--):(r=n,n=n.nextZ,h--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;t=n}s.nextZ=null,d*=2}while(o>1);return i}function Qy(i,e,t,n,r){return i=32767*(i-t)*r,e=32767*(e-n)*r,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function p6(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Nc(i,e,t,n,r,s,o,l){return(r-o)*(e-l)-(i-o)*(s-l)>=0&&(i-o)*(n-l)-(t-o)*(e-l)>=0&&(t-o)*(s-l)-(r-o)*(n-l)>=0}function f6(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!m6(i,e)&&(Hh(i,e)&&Hh(e,i)&&v6(i,e)&&(zn(i.prev,i,e.prev)||zn(i,e.prev,e))||Ym(i,e)&&zn(i.prev,i,i.next)>0&&zn(e.prev,e,e.next)>0)}function zn(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Ym(i,e){return i.x===e.x&&i.y===e.y}function d2(i,e,t,n){const r=mf(zn(i,e,t)),s=mf(zn(i,e,n)),o=mf(zn(t,n,i)),l=mf(zn(t,n,e));return!!(r!==s&&o!==l||r===0&&ff(i,t,e)||s===0&&ff(i,n,e)||o===0&&ff(t,i,n)||l===0&&ff(t,e,n))}function ff(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function mf(i){return i>0?1:i<0?-1:0}function m6(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&d2(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Hh(i,e){return zn(i.prev,i,i.next)<0?zn(i,e,i.next)>=0&&zn(i,i.prev,e)>=0:zn(i,e,i.prev)<0||zn(i,i.next,e)<0}function v6(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function p2(i,e){const t=new $y(i.i,i.x,i.y),n=new $y(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function PS(i,e,t,n){const r=new $y(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Gh(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function $y(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function g6(i,e,t,n){let r=0;for(let s=e,o=t-n;s<t;s+=n)r+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return r}class _o{static area(e){const t=e.length;let n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return _o.area(e)<0}static triangulateShape(e,t){const n=[],r=[],s=[];RS(e),LS(n,e);let o=e.length;t.forEach(RS);for(let h=0;h<t.length;h++)r.push(o),o+=t[h].length,LS(n,t[h]);const l=t6.triangulate(n,r);for(let h=0;h<l.length;h+=3)s.push(l.slice(h,h+3));return s}}function RS(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function LS(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class ba extends zt{constructor(e=new va([new ae(.5,.5),new ae(-.5,.5),new ae(-.5,-.5),new ae(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],s=[];for(let l=0,h=e.length;l<h;l++){const d=e[l];o(d)}this.setAttribute("position",new xt(r,3)),this.setAttribute("uv",new xt(s,2)),this.computeVertexNormals();function o(l){const h=[],d=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1;let g=t.depth!==void 0?t.depth:1,y=t.bevelEnabled!==void 0?t.bevelEnabled:!0,_=t.bevelThickness!==void 0?t.bevelThickness:.2,w=t.bevelSize!==void 0?t.bevelSize:_-.1,S=t.bevelOffset!==void 0?t.bevelOffset:0,b=t.bevelSegments!==void 0?t.bevelSegments:3;const T=t.extrudePath,E=t.UVGenerator!==void 0?t.UVGenerator:y6;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),g=t.amount);let C,A=!1,D,I,F,P;T&&(C=T.getSpacedPoints(f),A=!0,y=!1,D=T.computeFrenetFrames(f,!1),I=new z,F=new z,P=new z),y||(b=0,_=0,w=0,S=0);const k=l.extractPoints(d);let j=k.shape;const G=k.holes;if(!_o.isClockWise(j)){j=j.reverse();for(let ve=0,xe=G.length;ve<xe;ve++){const Ae=G[ve];_o.isClockWise(Ae)&&(G[ve]=Ae.reverse())}}const ce=_o.triangulateShape(j,G),Z=j;for(let ve=0,xe=G.length;ve<xe;ve++){const Ae=G[ve];j=j.concat(Ae)}function $(ve,xe,Ae){return xe||console.error("THREE.ExtrudeGeometry: vec does not exist"),xe.clone().multiplyScalar(Ae).add(ve)}const K=j.length,pe=ce.length;function re(ve,xe,Ae){let We,Be,rt;const ot=ve.x-xe.x,st=ve.y-xe.y,Ft=Ae.x-ve.x,yt=Ae.y-ve.y,H=ot*ot+st*st,B=ot*yt-st*Ft;if(Math.abs(B)>Number.EPSILON){const he=Math.sqrt(H),we=Math.sqrt(Ft*Ft+yt*yt),Ne=xe.x-st/he,Ue=xe.y+ot/he,Xe=Ae.x-yt/we,U=Ae.y+Ft/we,Ee=((Xe-Ne)*yt-(U-Ue)*Ft)/(ot*yt-st*Ft);We=Ne+ot*Ee-ve.x,Be=Ue+st*Ee-ve.y;const Je=We*We+Be*Be;if(Je<=2)return new ae(We,Be);rt=Math.sqrt(Je/2)}else{let he=!1;ot>Number.EPSILON?Ft>Number.EPSILON&&(he=!0):ot<-Number.EPSILON?Ft<-Number.EPSILON&&(he=!0):Math.sign(st)===Math.sign(yt)&&(he=!0),he?(We=-st,Be=ot,rt=Math.sqrt(H)):(We=ot,Be=st,rt=Math.sqrt(H/2))}return new ae(We/rt,Be/rt)}const se=[];for(let ve=0,xe=Z.length,Ae=xe-1,We=ve+1;ve<xe;ve++,Ae++,We++)Ae===xe&&(Ae=0),We===xe&&(We=0),se[ve]=re(Z[ve],Z[Ae],Z[We]);const ue=[];let Te,fe=se.concat();for(let ve=0,xe=G.length;ve<xe;ve++){const Ae=G[ve];Te=[];for(let We=0,Be=Ae.length,rt=Be-1,ot=We+1;We<Be;We++,rt++,ot++)rt===Be&&(rt=0),ot===Be&&(ot=0),Te[We]=re(Ae[We],Ae[rt],Ae[ot]);ue.push(Te),fe=fe.concat(Te)}for(let ve=0;ve<b;ve++){const xe=ve/b,Ae=_*Math.cos(xe*Math.PI/2),We=w*Math.sin(xe*Math.PI/2)+S;for(let Be=0,rt=Z.length;Be<rt;Be++){const ot=$(Z[Be],se[Be],We);Ut(ot.x,ot.y,-Ae)}for(let Be=0,rt=G.length;Be<rt;Be++){const ot=G[Be];Te=ue[Be];for(let st=0,Ft=ot.length;st<Ft;st++){const yt=$(ot[st],Te[st],We);Ut(yt.x,yt.y,-Ae)}}}const Ce=w+S;for(let ve=0;ve<K;ve++){const xe=y?$(j[ve],fe[ve],Ce):j[ve];A?(F.copy(D.normals[0]).multiplyScalar(xe.x),I.copy(D.binormals[0]).multiplyScalar(xe.y),P.copy(C[0]).add(F).add(I),Ut(P.x,P.y,P.z)):Ut(xe.x,xe.y,0)}for(let ve=1;ve<=f;ve++)for(let xe=0;xe<K;xe++){const Ae=y?$(j[xe],fe[xe],Ce):j[xe];A?(F.copy(D.normals[ve]).multiplyScalar(Ae.x),I.copy(D.binormals[ve]).multiplyScalar(Ae.y),P.copy(C[ve]).add(F).add(I),Ut(P.x,P.y,P.z)):Ut(Ae.x,Ae.y,g/f*ve)}for(let ve=b-1;ve>=0;ve--){const xe=ve/b,Ae=_*Math.cos(xe*Math.PI/2),We=w*Math.sin(xe*Math.PI/2)+S;for(let Be=0,rt=Z.length;Be<rt;Be++){const ot=$(Z[Be],se[Be],We);Ut(ot.x,ot.y,g+Ae)}for(let Be=0,rt=G.length;Be<rt;Be++){const ot=G[Be];Te=ue[Be];for(let st=0,Ft=ot.length;st<Ft;st++){const yt=$(ot[st],Te[st],We);A?Ut(yt.x,yt.y+C[f-1].y,C[f-1].x+Ae):Ut(yt.x,yt.y,g+Ae)}}}qe(),Ke();function qe(){const ve=r.length/3;if(y){let xe=0,Ae=K*xe;for(let We=0;We<pe;We++){const Be=ce[We];nt(Be[2]+Ae,Be[1]+Ae,Be[0]+Ae)}xe=f+b*2,Ae=K*xe;for(let We=0;We<pe;We++){const Be=ce[We];nt(Be[0]+Ae,Be[1]+Ae,Be[2]+Ae)}}else{for(let xe=0;xe<pe;xe++){const Ae=ce[xe];nt(Ae[2],Ae[1],Ae[0])}for(let xe=0;xe<pe;xe++){const Ae=ce[xe];nt(Ae[0]+K*f,Ae[1]+K*f,Ae[2]+K*f)}}n.addGroup(ve,r.length/3-ve,0)}function Ke(){const ve=r.length/3;let xe=0;me(Z,xe),xe+=Z.length;for(let Ae=0,We=G.length;Ae<We;Ae++){const Be=G[Ae];me(Be,xe),xe+=Be.length}n.addGroup(ve,r.length/3-ve,1)}function me(ve,xe){let Ae=ve.length;for(;--Ae>=0;){const We=Ae;let Be=Ae-1;Be<0&&(Be=ve.length-1);for(let rt=0,ot=f+b*2;rt<ot;rt++){const st=K*rt,Ft=K*(rt+1),yt=xe+We+st,H=xe+Be+st,B=xe+Be+Ft,he=xe+We+Ft;it(yt,H,B,he)}}}function Ut(ve,xe,Ae){h.push(ve),h.push(xe),h.push(Ae)}function nt(ve,xe,Ae){Le(ve),Le(xe),Le(Ae);const We=r.length/3,Be=E.generateTopUV(n,r,We-3,We-2,We-1);vt(Be[0]),vt(Be[1]),vt(Be[2])}function it(ve,xe,Ae,We){Le(ve),Le(xe),Le(We),Le(xe),Le(Ae),Le(We);const Be=r.length/3,rt=E.generateSideWallUV(n,r,Be-6,Be-3,Be-2,Be-1);vt(rt[0]),vt(rt[1]),vt(rt[3]),vt(rt[1]),vt(rt[2]),vt(rt[3])}function Le(ve){r.push(h[ve*3+0]),r.push(h[ve*3+1]),r.push(h[ve*3+2])}function vt(ve){s.push(ve.x),s.push(ve.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return _6(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const l=t[e.shapes[s]];n.push(l)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new u2[r.type]().fromJSON(r)),new ba(n,e.options)}}const y6={generateTopUV:function(i,e,t,n,r){const s=e[t*3],o=e[t*3+1],l=e[n*3],h=e[n*3+1],d=e[r*3],f=e[r*3+1];return[new ae(s,o),new ae(l,h),new ae(d,f)]},generateSideWallUV:function(i,e,t,n,r,s){const o=e[t*3],l=e[t*3+1],h=e[t*3+2],d=e[n*3],f=e[n*3+1],g=e[n*3+2],y=e[r*3],_=e[r*3+1],w=e[r*3+2],S=e[s*3],b=e[s*3+1],T=e[s*3+2];return Math.abs(l-f)<Math.abs(o-d)?[new ae(o,1-h),new ae(d,1-g),new ae(y,1-w),new ae(S,1-T)]:[new ae(l,1-h),new ae(f,1-g),new ae(_,1-w),new ae(b,1-T)]}};function _6(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const s=i[n];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Zm extends qm{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zm(e.radius,e.detail)}}class xx extends zt{constructor(e=new va([new ae(0,.5),new ae(-.5,-.5),new ae(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],s=[],o=[];let l=0,h=0;if(Array.isArray(e)===!1)d(e);else for(let f=0;f<e.length;f++)d(e[f]),this.addGroup(l,h,f),l+=h,h=0;this.setIndex(n),this.setAttribute("position",new xt(r,3)),this.setAttribute("normal",new xt(s,3)),this.setAttribute("uv",new xt(o,2));function d(f){const g=r.length/3,y=f.extractPoints(t);let _=y.shape;const w=y.holes;_o.isClockWise(_)===!1&&(_=_.reverse());for(let b=0,T=w.length;b<T;b++){const E=w[b];_o.isClockWise(E)===!0&&(w[b]=E.reverse())}const S=_o.triangulateShape(_,w);for(let b=0,T=w.length;b<T;b++){const E=w[b];_=_.concat(E)}for(let b=0,T=_.length;b<T;b++){const E=_[b];r.push(E.x,E.y,0),s.push(0,0,1),o.push(E.x,E.y)}for(let b=0,T=S.length;b<T;b++){const E=S[b],C=E[0]+g,A=E[1]+g,D=E[2]+g;n.push(C,A,D),h+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return x6(t,e)}static fromJSON(e,t){const n=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];n.push(o)}return new xx(n,e.curveSegments)}}function x6(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const r=i[t];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e}class Km extends zt{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:l},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const h=Math.min(o+l,Math.PI);let d=0;const f=[],g=new z,y=new z,_=[],w=[],S=[],b=[];for(let T=0;T<=n;T++){const E=[],C=T/n;let A=0;T==0&&o==0?A=.5/t:T==n&&h==Math.PI&&(A=-.5/t);for(let D=0;D<=t;D++){const I=D/t;g.x=-e*Math.cos(r+I*s)*Math.sin(o+C*l),g.y=e*Math.cos(o+C*l),g.z=e*Math.sin(r+I*s)*Math.sin(o+C*l),w.push(g.x,g.y,g.z),y.copy(g).normalize(),S.push(y.x,y.y,y.z),b.push(I+A,1-C),E.push(d++)}f.push(E)}for(let T=0;T<n;T++)for(let E=0;E<t;E++){const C=f[T][E+1],A=f[T][E],D=f[T+1][E],I=f[T+1][E+1];(T!==0||o>0)&&_.push(C,A,I),(T!==n-1||h<Math.PI)&&_.push(A,D,I)}this.setIndex(_),this.setAttribute("position",new xt(w,3)),this.setAttribute("normal",new xt(S,3)),this.setAttribute("uv",new xt(b,2))}static fromJSON(e){return new Km(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class bx extends qm{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bx(e.radius,e.detail)}}class wx extends zt{constructor(e=1,t=.4,n=8,r=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:s},n=Math.floor(n),r=Math.floor(r);const o=[],l=[],h=[],d=[],f=new z,g=new z,y=new z;for(let _=0;_<=n;_++)for(let w=0;w<=r;w++){const S=w/r*s,b=_/n*Math.PI*2;g.x=(e+t*Math.cos(b))*Math.cos(S),g.y=(e+t*Math.cos(b))*Math.sin(S),g.z=t*Math.sin(b),l.push(g.x,g.y,g.z),f.x=e*Math.cos(S),f.y=e*Math.sin(S),y.subVectors(g,f).normalize(),h.push(y.x,y.y,y.z),d.push(w/r),d.push(_/n)}for(let _=1;_<=n;_++)for(let w=1;w<=r;w++){const S=(r+1)*_+w-1,b=(r+1)*(_-1)+w-1,T=(r+1)*(_-1)+w,E=(r+1)*_+w;o.push(S,b,E),o.push(b,T,E)}this.setIndex(o),this.setAttribute("position",new xt(l,3)),this.setAttribute("normal",new xt(h,3)),this.setAttribute("uv",new xt(d,2))}static fromJSON(e){return new wx(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class f2 extends li{constructor(e){super(),this.type="ShadowMaterial",this.color=new Pe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}f2.prototype.isShadowMaterial=!0;class m2 extends kt{constructor(e){super(e),this.type="RawShaderMaterial"}}m2.prototype.isRawShaderMaterial=!0;class wl extends li{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Pe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,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}}wl.prototype.isMeshStandardMaterial=!0;class v2 extends wl{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ae(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Jn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new Pe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new Pe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Pe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}v2.prototype.isMeshPhysicalMaterial=!0;class g2 extends li{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Pe(16777215),this.specular=new Pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=km,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}g2.prototype.isMeshPhongMaterial=!0;class Sx extends li{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}Sx.prototype.isMeshToonMaterial=!0;class Jm extends li{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}Jm.prototype.isMeshNormalMaterial=!0;class y2 extends li{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=km,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}y2.prototype.isMeshLambertMaterial=!0;class _2 extends li{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new ae(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}_2.prototype.isMeshMatcapMaterial=!0;class x2 extends os{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}x2.prototype.isLineDashedMaterial=!0;const b6={ShadowMaterial:f2,SpriteMaterial:ud,RawShaderMaterial:m2,ShaderMaterial:kt,PointsMaterial:px,MeshPhysicalMaterial:v2,MeshStandardMaterial:wl,MeshPhongMaterial:g2,MeshToonMaterial:Sx,MeshNormalMaterial:Jm,MeshLambertMaterial:y2,MeshDepthMaterial:lu,MeshDistanceMaterial:lx,MeshBasicMaterial:ss,MeshMatcapMaterial:_2,LineDashedMaterial:x2,LineBasicMaterial:os,Material:li};li.fromType=function(i){return new b6[i]};const Dn={arraySlice:function(i,e,t){return Dn.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n},sortedArray:function(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,o=0;o!==n;++s){const l=t[s]*e;for(let h=0;h!==e;++h)r[o++]=i[l+h]}return r},flattenJSON:function(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=i[r++];while(s!==void 0)},subclip:function(i,e,t,n,r=30){const s=i.clone();s.name=e;const o=[];for(let h=0;h<s.tracks.length;++h){const d=s.tracks[h],f=d.getValueSize(),g=[],y=[];for(let _=0;_<d.times.length;++_){const w=d.times[_]*r;if(!(w<t||w>=n)){g.push(d.times[_]);for(let S=0;S<f;++S)y.push(d.values[_*f+S])}}g.length!==0&&(d.times=Dn.convertArray(g,d.times.constructor),d.values=Dn.convertArray(y,d.values.constructor),o.push(d))}s.tracks=o;let l=1/0;for(let h=0;h<s.tracks.length;++h)l>s.tracks[h].times[0]&&(l=s.tracks[h].times[0]);for(let h=0;h<s.tracks.length;++h)s.tracks[h].shift(-1*l);return s.resetDuration(),s},makeClipAdditive:function(i,e=0,t=i,n=30){n<=0&&(n=30);const r=t.tracks.length,s=e/n;for(let o=0;o<r;++o){const l=t.tracks[o],h=l.ValueTypeName;if(h==="bool"||h==="string")continue;const d=i.tracks.find(function(T){return T.name===l.name&&T.ValueTypeName===h});if(d===void 0)continue;let f=0;const g=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=g/3);let y=0;const _=d.getValueSize();d.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(y=_/3);const w=l.times.length-1;let S;if(s<=l.times[0]){const T=f,E=g-f;S=Dn.arraySlice(l.values,T,E)}else if(s>=l.times[w]){const T=w*g+f,E=T+g-f;S=Dn.arraySlice(l.values,T,E)}else{const T=l.createInterpolant(),E=f,C=g-f;T.evaluate(s),S=Dn.arraySlice(T.resultBuffer,E,C)}h==="quaternion"&&new ai().fromArray(S).normalize().conjugate().toArray(S);const b=d.times.length;for(let T=0;T<b;++T){const E=T*_+y;if(h==="quaternion")ai.multiplyQuaternionsFlat(d.values,E,S,0,d.values,E);else{const C=_-y*2;for(let A=0;A<C;++A)d.values[E+A]-=S[A]}}}return i.blendMode=UE,i}};class wa{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r: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,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let l=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,s)}if(n===l)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){const l=t[1];e<l&&(n=2,s=l);for(let h=n-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===h)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const l=n+o>>>1;e<t[l]?o=l:n=l+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,s,e)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}wa.prototype.beforeStart_=wa.prototype.copySampleValue_;wa.prototype.afterEnd_=wa.prototype.copySampleValue_;class w6 extends wa{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ic,endingEnd:Ic}}intervalChanged_(e,t,n){const r=this.parameterPositions;let s=e-2,o=e+1,l=r[s],h=r[o];if(l===void 0)switch(this.getSettings_().endingStart){case Oc:s=e,l=2*t-n;break;case im:s=r.length-2,l=t+r[s]-r[s+1];break;default:s=e,l=n}if(h===void 0)switch(this.getSettings_().endingEnd){case Oc:o=e,h=2*n-t;break;case im:o=1,h=n+r[1]-r[0];break;default:o=e-1,h=t}const d=(n-t)*.5,f=this.valueSize;this._weightPrev=d/(t-l),this._weightNext=d/(h-n),this._offsetPrev=s*f,this._offsetNext=o*f}interpolate_(e,t,n,r){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,h=e*l,d=h-l,f=this._offsetPrev,g=this._offsetNext,y=this._weightPrev,_=this._weightNext,w=(n-t)/(r-t),S=w*w,b=S*w,T=-y*b+2*y*S-y*w,E=(1+y)*b+(-1.5-2*y)*S+(-.5+y)*w+1,C=(-1-_)*b+(1.5+_)*S+.5*w,A=_*b-_*S;for(let D=0;D!==l;++D)s[D]=T*o[f+D]+E*o[d+D]+C*o[h+D]+A*o[g+D];return s}}class b2 extends wa{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,h=e*l,d=h-l,f=(n-t)/(r-t),g=1-f;for(let y=0;y!==l;++y)s[y]=o[d+y]*g+o[h+y]*f;return s}}class S6 extends wa{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ns{constructor(e,t,n,r){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=Dn.convertArray(t,this.TimeBufferType),this.values=Dn.convertArray(n,this.ValueBufferType),this.setInterpolation(r||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:Dn.convertArray(e.times,Array),values:Dn.convertArray(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new S6(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new b2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new w6(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case tm:t=this.InterpolantFactoryMethodDiscrete;break;case nm:t=this.InterpolantFactoryMethodLinear;break;case V0: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 tm;case this.InterpolantFactoryMethodLinear:return nm;case this.InterpolantFactoryMethodSmooth:return V0}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){const n=this.times,r=n.length;let s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const l=this.getValueSize();this.times=Dn.arraySlice(n,s,o),this.values=Dn.arraySlice(this.values,s*l,o*l)}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,r=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let l=0;l!==s;l++){const h=n[l];if(typeof h=="number"&&isNaN(h)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,h),e=!1;break}if(o!==null&&o>h){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,h,o),e=!1;break}o=h}if(r!==void 0&&Dn.isTypedArray(r))for(let l=0,h=r.length;l!==h;++l){const d=r[l];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,d),e=!1;break}}return e}optimize(){const e=Dn.arraySlice(this.times),t=Dn.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===V0,s=e.length-1;let o=1;for(let l=1;l<s;++l){let h=!1;const d=e[l],f=e[l+1];if(d!==f&&(l!==1||d!==e[0]))if(r)h=!0;else{const g=l*n,y=g-n,_=g+n;for(let w=0;w!==n;++w){const S=t[g+w];if(S!==t[y+w]||S!==t[_+w]){h=!0;break}}}if(h){if(l!==o){e[o]=e[l];const g=l*n,y=o*n;for(let _=0;_!==n;++_)t[y+_]=t[g+_]}++o}}if(s>0){e[o]=e[s];for(let l=s*n,h=o*n,d=0;d!==n;++d)t[h+d]=t[l+d];++o}return o!==e.length?(this.times=Dn.arraySlice(e,0,o),this.values=Dn.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=Dn.arraySlice(this.times,0),t=Dn.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Ns.prototype.TimeBufferType=Float32Array;Ns.prototype.ValueBufferType=Float32Array;Ns.prototype.DefaultInterpolation=nm;class cu extends Ns{}cu.prototype.ValueTypeName="bool";cu.prototype.ValueBufferType=Array;cu.prototype.DefaultInterpolation=tm;cu.prototype.InterpolantFactoryMethodLinear=void 0;cu.prototype.InterpolantFactoryMethodSmooth=void 0;class w2 extends Ns{}w2.prototype.ValueTypeName="color";class Wh extends Ns{}Wh.prototype.ValueTypeName="number";class M6 extends wa{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,h=(n-t)/(r-t);let d=e*l;for(let f=d+l;d!==f;d+=4)ai.slerpFlat(s,0,o,d-l,o,d,h);return s}}class hd extends Ns{InterpolantFactoryMethodLinear(e){return new M6(this.times,this.values,this.getValueSize(),e)}}hd.prototype.ValueTypeName="quaternion";hd.prototype.DefaultInterpolation=nm;hd.prototype.InterpolantFactoryMethodSmooth=void 0;class uu extends Ns{}uu.prototype.ValueTypeName="string";uu.prototype.ValueBufferType=Array;uu.prototype.DefaultInterpolation=tm;uu.prototype.InterpolantFactoryMethodLinear=void 0;uu.prototype.InterpolantFactoryMethodSmooth=void 0;class am extends Ns{}am.prototype.ValueTypeName="vector";class e_{constructor(e,t=-1,n,r=tx){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=kr(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let o=0,l=n.length;o!==l;++o)t.push(T6(n[o]).scale(r));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,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Ns.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,o=[];for(let l=0;l<s;l++){let h=[],d=[];h.push((l+s-1)%s,l,(l+1)%s),d.push(0,1,0);const f=Dn.getKeyframeOrder(h);h=Dn.sortedArray(h,1,f),d=Dn.sortedArray(d,1,f),!r&&h[0]===0&&(h.push(s),d.push(d[0])),o.push(new Wh(".morphTargetInfluences["+t[l].name+"]",h,d).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},s=/^([\w-]*?)([\d]+)$/;for(let l=0,h=e.length;l<h;l++){const d=e[l],f=d.name.match(s);if(f&&f.length>1){const g=f[1];let y=r[g];y||(r[g]=y=[]),y.push(d)}}const o=[];for(const l in r)o.push(this.CreateFromMorphTargetSequence(l,r[l],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(g,y,_,w,S){if(_.length!==0){const b=[],T=[];Dn.flattenJSON(_,b,T,w),b.length!==0&&S.push(new g(y,b,T))}},r=[],s=e.name||"default",o=e.fps||30,l=e.blendMode;let h=e.length||-1;const d=e.hierarchy||[];for(let g=0;g<d.length;g++){const y=d[g].keys;if(!(!y||y.length===0))if(y[0].morphTargets){const _={};let w;for(w=0;w<y.length;w++)if(y[w].morphTargets)for(let S=0;S<y[w].morphTargets.length;S++)_[y[w].morphTargets[S]]=-1;for(const S in _){const b=[],T=[];for(let E=0;E!==y[w].morphTargets.length;++E){const C=y[w];b.push(C.time),T.push(C.morphTarget===S?1:0)}r.push(new Wh(".morphTargetInfluence["+S+"]",b,T))}h=_.length*o}else{const _=".bones["+t[g].name+"]";n(am,_+".position",y,"pos",r),n(hd,_+".quaternion",y,"rot",r),n(am,_+".scale",y,"scl",r)}}return r.length===0?null:new this(s,h,r,l)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++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 E6(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Wh;case"vector":case"vector2":case"vector3":case"vector4":return am;case"color":return w2;case"quaternion":return hd;case"bool":case"boolean":return cu;case"string":return uu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function T6(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=E6(i.type);if(i.times===void 0){const t=[],n=[];Dn.flattenJSON(i.keys,t,n,"value"),i.times=t,i.values=n}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}const Xc={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};class A6{constructor(e,t,n){const r=this;let s=!1,o=0,l=0,h;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(f){l++,s===!1&&r.onStart!==void 0&&r.onStart(f,o,l),s=!0},this.itemEnd=function(f){o++,r.onProgress!==void 0&&r.onProgress(f,o,l),o===l&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(f){r.onError!==void 0&&r.onError(f)},this.resolveURL=function(f){return h?h(f):f},this.setURLModifier=function(f){return h=f,this},this.addHandler=function(f,g){return d.push(f,g),this},this.removeHandler=function(f){const g=d.indexOf(f);return g!==-1&&d.splice(g,2),this},this.getHandler=function(f){for(let g=0,y=d.length;g<y;g+=2){const _=d[g],w=d[g+1];if(_.global&&(_.lastIndex=0),_.test(f))return w}return null}}}const C6=new A6;class Eo{constructor(e){this.manager=e!==void 0?e:C6,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,s){n.load(e,r,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}}const uo={};class S2 extends Eo{constructor(e){super(e)}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Xc.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(uo[e]!==void 0){uo[e].push({onLoad:t,onProgress:n,onError:r});return}uo[e]=[],uo[e].push({onLoad:t,onProgress:n,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,h=this.responseType;fetch(o).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const f=uo[e],g=d.body.getReader(),y=d.headers.get("Content-Length"),_=y?parseInt(y):0,w=_!==0;let S=0;const b=new ReadableStream({start(T){E();function E(){g.read().then(({done:C,value:A})=>{if(C)T.close();else{S+=A.byteLength;const D=new ProgressEvent("progress",{lengthComputable:w,loaded:S,total:_});for(let I=0,F=f.length;I<F;I++){const P=f[I];P.onProgress&&P.onProgress(D)}T.enqueue(A),E()}})}}});return new Response(b)}else throw Error(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`)}).then(d=>{switch(h){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(f=>new DOMParser().parseFromString(f,l));case"json":return d.json();default:if(l===void 0)return d.text();{const g=/charset="?([^;"\s]*)"?/i.exec(l),y=g&&g[1]?g[1].toLowerCase():void 0,_=new TextDecoder(y);return d.arrayBuffer().then(w=>_.decode(w))}}}).then(d=>{Xc.add(e,d);const f=uo[e];delete uo[e];for(let g=0,y=f.length;g<y;g++){const _=f[g];_.onLoad&&_.onLoad(d)}}).catch(d=>{const f=uo[e];if(f===void 0)throw this.manager.itemError(e),d;delete uo[e];for(let g=0,y=f.length;g<y;g++){const _=f[g];_.onError&&_.onError(d)}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 M2 extends Eo{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Xc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const l=Uh("img");function h(){f(),Xc.add(e,this),t&&t(this),s.manager.itemEnd(e)}function d(g){f(),r&&r(g),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){l.removeEventListener("load",h,!1),l.removeEventListener("error",d,!1)}return l.addEventListener("load",h,!1),l.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class E2 extends Eo{constructor(e){super(e)}load(e,t,n,r){const s=new Fm,o=new M2(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let l=0;function h(d){o.load(e[d],function(f){s.images[d]=f,l++,l===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let d=0;d<e.length;++d)h(d);return s}}class P6 extends Eo{constructor(e){super(e)}load(e,t,n,r){const s=this,o=new dx,l=new S2(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(s.withCredentials),l.load(e,function(h){const d=s.parse(h);d&&(d.image!==void 0?o.image=d.image:d.data!==void 0&&(o.image.width=d.width,o.image.height=d.height,o.image.data=d.data),o.wrapS=d.wrapS!==void 0?d.wrapS:yr,o.wrapT=d.wrapT!==void 0?d.wrapT:yr,o.magFilter=d.magFilter!==void 0?d.magFilter:Hn,o.minFilter=d.minFilter!==void 0?d.minFilter:Hn,o.anisotropy=d.anisotropy!==void 0?d.anisotropy:1,d.encoding!==void 0&&(o.encoding=d.encoding),d.flipY!==void 0&&(o.flipY=d.flipY),d.format!==void 0&&(o.format=d.format),d.type!==void 0&&(o.type=d.type),d.mipmaps!==void 0&&(o.mipmaps=d.mipmaps,o.minFilter=od),d.mipmapCount===1&&(o.minFilter=Hn),d.generateMipmaps!==void 0&&(o.generateMipmaps=d.generateMipmaps),o.needsUpdate=!0,t&&t(o,d))},n,r),o}}class T2 extends Eo{constructor(e){super(e)}load(e,t,n,r){const s=new ti,o=new M2(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},n,r),s}}class Is extends $t{constructor(e,t=1){super(),this.type="Light",this.color=new Pe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}Is.prototype.isLight=!0;class Mx extends Is{constructor(e,t,n){super(e,n),this.type="HemisphereLight",this.position.copy($t.DefaultUp),this.updateMatrix(),this.groundColor=new Pe(t)}copy(e){return Is.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Mx.prototype.isHemisphereLight=!0;const DS=new Qe,IS=new z,OS=new z;class Ex{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ae(512,512),this.map=null,this.mapPass=null,this.matrix=new Qe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ad,this._frameExtents=new ae(1,1),this._viewportCount=1,this._viewports=[new dn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;IS.setFromMatrixPosition(e.matrixWorld),t.position.copy(IS),OS.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(OS),t.updateMatrixWorld(),DS.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(DS),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class A2 extends Ex{constructor(){super(new fi(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,n=zh*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}A2.prototype.isSpotLightShadow=!0;class C2 extends Is{constructor(e,t,n=0,r=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy($t.DefaultUp),this.updateMatrix(),this.target=new $t,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.shadow=new A2}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),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}}C2.prototype.isSpotLight=!0;const kS=new Qe,oh=new z,by=new z;class P2 extends Ex{constructor(){super(new fi(90,1,.5,500)),this._frameExtents=new ae(4,2),this._viewportCount=6,this._viewports=[new dn(2,1,1,1),new dn(0,1,1,1),new dn(3,1,1,1),new dn(1,1,1,1),new dn(3,0,1,1),new dn(1,0,1,1)],this._cubeDirections=[new z(1,0,0),new z(-1,0,0),new z(0,0,1),new z(0,0,-1),new z(0,1,0),new z(0,-1,0)],this._cubeUps=[new z(0,1,0),new z(0,1,0),new z(0,1,0),new z(0,1,0),new z(0,0,1),new z(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,r=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),oh.setFromMatrixPosition(e.matrixWorld),n.position.copy(oh),by.copy(n.position),by.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(by),n.updateMatrixWorld(),r.makeTranslation(-oh.x,-oh.y,-oh.z),kS.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kS)}}P2.prototype.isPointLightShadow=!0;class R2 extends Is{constructor(e,t,n=0,r=1){super(e,t),this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new P2}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}R2.prototype.isPointLight=!0;class L2 extends Ex{constructor(){super(new ou(-5,5,5,-5,.5,500))}}L2.prototype.isDirectionalLightShadow=!0;class Tx extends Is{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy($t.DefaultUp),this.updateMatrix(),this.target=new $t,this.shadow=new L2}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Tx.prototype.isDirectionalLight=!0;class D2 extends Is{constructor(e,t){super(e,t),this.type="AmbientLight"}}D2.prototype.isAmbientLight=!0;class I2 extends Is{constructor(e,t,n=10,r=10){super(e,t),this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}I2.prototype.isRectAreaLight=!0;class O2{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new z)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}}O2.prototype.isSphericalHarmonics3=!0;class Ax extends Is{constructor(e=new O2,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Ax.prototype.isLightProbe=!0;class R6{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}}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 L6 extends zt{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}L6.prototype.isInstancedBufferGeometry=!0;class D6 extends Eo{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Xc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){Xc.add(e,h),t&&t(h),s.manager.itemEnd(e)}).catch(function(h){r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}D6.prototype.isImageBitmapLoader=!0;let vf;const I6={getContext:function(){return vf===void 0&&(vf=new(window.AudioContext||window.webkitAudioContext)),vf},setContext:function(i){vf=i}};class O6 extends Eo{constructor(e){super(e)}load(e,t,n,r){const s=this,o=new S2(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const h=l.slice(0);I6.getContext().decodeAudioData(h,function(f){t(f)})}catch(h){r?r(h):console.error(h),s.manager.itemError(e)}},n,r)}}class k6 extends Ax{constructor(e,t,n=1){super(void 0,n);const r=new Pe().set(e),s=new Pe().set(t),o=new z(r.r,r.g,r.b),l=new z(s.r,s.g,s.b),h=Math.sqrt(Math.PI),d=h*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(l).multiplyScalar(h),this.sh.coefficients[1].copy(o).sub(l).multiplyScalar(d)}}k6.prototype.isHemisphereLightProbe=!0;class N6 extends Ax{constructor(e,t=1){super(void 0,t);const n=new Pe().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}N6.prototype.isAmbientLightProbe=!0;class k2{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=NS(),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=NS();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function NS(){return(typeof performance>"u"?Date:performance).now()}class B6 extends $t{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}class z6{constructor(e,t,n){this.binding=e,this.valueSize=n;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let l=0;l!==r;++l)n[s+l]=n[l];o=t}else{o+=t;const l=t/o;this._mixBufferRegion(n,s,0,l,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const h=t*this._origIndex;this._mixBufferRegion(n,r,h,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let h=t,d=t+t;h!==d;++h)if(n[h]!==n[h+t]){l.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let s=n,o=r;s!==o;++s)t[s]=t[r+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,r){ai.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,s){const o=this._workIndex*s;ai.multiplyQuaternionsFlat(e,o,e,t,e,n),ai.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,n,r,s){const o=1-r;for(let l=0;l!==s;++l){const h=t+l;e[h]=e[h]*o+e[n+l]*r}}_lerpAdditive(e,t,n,r,s){for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]+e[n+o]*r}}}const Cx="\\[\\]\\.:\\/",U6=new RegExp("["+Cx+"]","g"),Px="[^"+Cx+"]",F6="[^"+Cx.replace("\\.","")+"]",V6=/((?:WC+[\/:])*)/.source.replace("WC",Px),H6=/(WCOD+)?/.source.replace("WCOD",F6),G6=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Px),W6=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Px),j6=new RegExp("^"+V6+H6+G6+W6+"$"),X6=["material","materials","bones"];class q6{constructor(e,t,n){const r=n||nn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class nn{constructor(e,t,n){this.path=t,this.parsedPath=n||nn.parseTrackName(t),this.node=nn.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new nn.Composite(e,t,n):new nn(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(U6,"")}static parseTrackName(e){const t=j6.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);X6.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const l=s[o];if(l.name===t||l.uuid===t)return l;const h=n(l.children);if(h)return h}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=nn.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){let d=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let f=0;f<e.length;f++)if(e[f].name===d){d=f;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(d!==void 0){if(e[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[d]}}const o=e[r];if(o===void 0){const d=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+r+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}h=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(h=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nn.Composite=q6;nn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};nn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};nn.prototype.GetterByBindingType=[nn.prototype._getValue_direct,nn.prototype._getValue_array,nn.prototype._getValue_arrayElement,nn.prototype._getValue_toArray];nn.prototype.SetterByBindingTypeAndVersioning=[[nn.prototype._setValue_direct,nn.prototype._setValue_direct_setNeedsUpdate,nn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nn.prototype._setValue_array,nn.prototype._setValue_array_setNeedsUpdate,nn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nn.prototype._setValue_arrayElement,nn.prototype._setValue_arrayElement_setNeedsUpdate,nn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nn.prototype._setValue_fromArray,nn.prototype._setValue_fromArray_setNeedsUpdate,nn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Y6{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const s=t.tracks,o=s.length,l=new Array(o),h={endingStart:Ic,endingEnd:Ic};for(let d=0;d!==o;++d){const f=s[d].createInterpolant(null);l[d]=f,f.settings=h}this._interpolantSettings=h,this._interpolants=l,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Xy,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const r=this._clip.duration,s=e._clip.duration,o=s/r,l=r/s;e.warp(1,o,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,s=r.time,o=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const h=l.parameterPositions,d=l.sampleValues;return h[0]=s,h[1]=s+n,d[0]=e/o,d[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const h=(e-s)*n;if(h<0||n===0)return;this._startTime=null,t=n*h}t*=this._updateTimeScale(e);const o=this._updateTime(t),l=this._updateWeight(e);if(l>0){const h=this._interpolants,d=this._propertyBindings;switch(this.blendMode){case UE:for(let f=0,g=h.length;f!==g;++f)h[f].evaluate(o),d[f].accumulateAdditive(l);break;case tx:default:for(let f=0,g=h.length;f!==g;++f)h[f].evaluate(o),d[f].accumulate(r,l)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,s=this._loopCount;const o=n===DI;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(n===jy){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const l=Math.floor(r/t);r-=t*l,s+=Math.abs(l);const h=this.repetitions-s;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const d=e<0;this._setEndings(d,!d,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=Oc,r.endingEnd=Oc):(e?r.endingStart=this.zeroSlopeAtStart?Oc:Ic:r.endingStart=im,t?r.endingEnd=this.zeroSlopeAtEnd?Oc:Ic:r.endingEnd=im)}_scheduleFading(e,t,n){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const l=o.parameterPositions,h=o.sampleValues;return l[0]=s,h[0]=t,l[1]=s+e,h[1]=n,this}}class N2 extends Ea{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,l=e._interpolants,h=n.uuid,d=this._bindingsByRootAndName;let f=d[h];f===void 0&&(f={},d[h]=f);for(let g=0;g!==s;++g){const y=r[g],_=y.name;let w=f[_];if(w!==void 0)++w.referenceCount,o[g]=w;else{if(w=o[g],w!==void 0){w._cacheIndex===null&&(++w.referenceCount,this._addInactiveBinding(w,h,_));continue}const S=t&&t._propertyBindings[g].binding.parsedPath;w=new z6(nn.create(n,_,S),y.ValueTypeName,y.getValueSize()),++w.referenceCount,this._addInactiveBinding(w,h,_),o[g]=w}l[g].resultBuffer=w.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,n)}const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const l=o.knownActions;e._byClipCacheIndex=l.length,l.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,l=o[s],h=l.knownActions,d=h[h.length-1],f=e._byClipCacheIndex;d._byClipCacheIndex=f,h[f]=d,h.pop(),e._byClipCacheIndex=null;const g=l.actionByRoot,y=(e._localRoot||this._root).uuid;delete g[y],h.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,l=o[r],h=t[t.length-1],d=e._cacheIndex;h._cacheIndex=d,t[d]=h,t.pop(),delete l[s],Object.keys(l).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new b2(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?e_.findByName(r,e):e;const l=o!==null?o.uuid:e,h=this._actionsByClip[l];let d=null;if(n===void 0&&(o!==null?n=o.blendMode:n=tx),h!==void 0){const g=h.actionByRoot[s];if(g!==void 0&&g.blendMode===n)return g;d=h.knownActions[0],o===null&&(o=d._clip)}if(o===null)return null;const f=new Y6(this,o,t,n);return this._bindAction(f,d),this._addInactiveAction(f,l,s),f}existingAction(e,t){const n=t||this._root,r=n.uuid,s=typeof e=="string"?e_.findByName(n,e):e,o=s?s.uuid:e,l=this._actionsByClip[o];return l!==void 0&&l.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let d=0;d!==n;++d)t[d]._update(r,e,s,o);const l=this._bindings,h=this._nActiveBindings;for(let d=0;d!==h;++d)l[d].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,s=r[n];if(s!==void 0){const o=s.knownActions;for(let l=0,h=o.length;l!==h;++l){const d=o[l];this._deactivateAction(d);const f=d._cacheIndex,g=t[t.length-1];d._cacheIndex=null,d._byClipCacheIndex=null,g._cacheIndex=f,t[f]=g,t.pop(),this._removeInactiveBindingsForAction(d)}delete r[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const l=n[o].actionByRoot,h=l[t];h!==void 0&&(this._deactivateAction(h),this._removeInactiveAction(h))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const l=s[o];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}N2.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class Rx{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Rx(this.value.clone===void 0?this.value:this.value.clone())}}class Z6 extends cd{constructor(e,t,n=1){super(e,t),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}}Z6.prototype.isInstancedInterleavedBuffer=!0;class K6{constructor(e,t,n=0,r=1/0){this.ray=new Mo(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new sx,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)}intersectObject(e,t=!0,n=[]){return t_(e,this,n,t),n.sort(BS),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)t_(e[r],this,n,t);return n.sort(BS),n}}function BS(i,e){return i.distance-e.distance}function t_(i,e,t,n){if(i.layers.test(e.layers)&&i.raycast(e,t),n===!0){const r=i.children;for(let s=0,o=r.length;s<o;s++)t_(r[s],e,t,!0)}}class zS{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}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=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),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(Jn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}const US=new ae;class dd{constructor(e=new ae(1/0,1/0),t=new ae(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),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=US.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}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}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))}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)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return US.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),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)}}dd.prototype.isBox2=!0;const FS=new z,gf=new z;class B2{constructor(e=new z,t=new z){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){FS.subVectors(e,this.start),gf.subVectors(this.end,this.start);const n=gf.dot(gf);let s=gf.dot(FS)/n;return t&&(s=Jn(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).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)}}const VS=new z;class J6 extends $t{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new zt,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,l=1,h=32;o<h;o++,l++){const d=o/h*Math.PI*2,f=l/h*Math.PI*2;r.push(Math.cos(d),Math.sin(d),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new xt(r,3));const s=new os({fog:!1,toneMapped:!1});this.cone=new fl(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),VS.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(VS),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const aa=new z,yf=new Qe,wy=new Qe;class z2 extends fl{constructor(e){const t=U2(e),n=new zt,r=[],s=[],o=new Pe(0,0,1),l=new Pe(0,1,0);for(let d=0;d<t.length;d++){const f=t[d];f.parent&&f.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(l.r,l.g,l.b))}n.setAttribute("position",new xt(r,3)),n.setAttribute("color",new xt(s,3));const h=new os({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,h),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");wy.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const l=t[s];l.parent&&l.parent.isBone&&(yf.multiplyMatrices(wy,l.matrixWorld),aa.setFromMatrixPosition(yf),r.setXYZ(o,aa.x,aa.y,aa.z),yf.multiplyMatrices(wy,l.parent.matrixWorld),aa.setFromMatrixPosition(yf),r.setXYZ(o+1,aa.x,aa.y,aa.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function U2(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,U2(i.children[t]));return e}class Q6 extends In{constructor(e,t,n){const r=new Km(t,4,2),s=new ss({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const $6=new z,HS=new Pe,GS=new Pe;class ez extends $t{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const r=new Zm(t);r.rotateY(Math.PI*.5),this.material=new ss({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new Wn(o,3)),this.add(new In(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");HS.copy(this.light.color),GS.copy(this.light.groundColor);for(let n=0,r=t.count;n<r;n++){const s=n<r/2?HS:GS;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt($6.setFromMatrixPosition(this.light.matrixWorld).negate())}}class F2 extends fl{constructor(e=10,t=10,n=4473924,r=8947848){n=new Pe(n),r=new Pe(r);const s=t/2,o=e/t,l=e/2,h=[],d=[];for(let y=0,_=0,w=-l;y<=t;y++,w+=o){h.push(-l,0,w,l,0,w),h.push(w,0,-l,w,0,l);const S=y===s?n:r;S.toArray(d,_),_+=3,S.toArray(d,_),_+=3,S.toArray(d,_),_+=3,S.toArray(d,_),_+=3}const f=new zt;f.setAttribute("position",new xt(h,3)),f.setAttribute("color",new xt(d,3));const g=new os({vertexColors:!0,toneMapped:!1});super(f,g),this.type="GridHelper"}}const WS=new z,_f=new z,jS=new z;class tz extends $t{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);let r=new zt;r.setAttribute("position",new xt([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new os({fog:!1,toneMapped:!1});this.lightPlane=new jc(r,s),this.add(this.lightPlane),r=new zt,r.setAttribute("position",new xt([0,0,0,0,0,1],3)),this.targetLine=new jc(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){WS.setFromMatrixPosition(this.light.matrixWorld),_f.setFromMatrixPosition(this.light.target.matrixWorld),jS.subVectors(_f,WS),this.lightPlane.lookAt(_f),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(_f),this.targetLine.scale.z=jS.length()}}const xf=new z,Fn=new Um;class nz extends fl{constructor(e){const t=new zt,n=new os({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={},l=new Pe(16755200),h=new Pe(16711680),d=new Pe(43775),f=new Pe(16777215),g=new Pe(3355443);y("n1","n2",l),y("n2","n4",l),y("n4","n3",l),y("n3","n1",l),y("f1","f2",l),y("f2","f4",l),y("f4","f3",l),y("f3","f1",l),y("n1","f1",l),y("n2","f2",l),y("n3","f3",l),y("n4","f4",l),y("p","n1",h),y("p","n2",h),y("p","n3",h),y("p","n4",h),y("u1","u2",d),y("u2","u3",d),y("u3","u1",d),y("c","t",f),y("p","c",g),y("cn1","cn2",g),y("cn3","cn4",g),y("cf1","cf2",g),y("cf3","cf4",g);function y(w,S,b){_(w,b),_(S,b)}function _(w,S){r.push(0,0,0),s.push(S.r,S.g,S.b),o[w]===void 0&&(o[w]=[]),o[w].push(r.length/3-1)}t.setAttribute("position",new xt(r,3)),t.setAttribute("color",new xt(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){const e=this.geometry,t=this.pointMap,n=1,r=1;Fn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Zn("c",t,e,Fn,0,0,-1),Zn("t",t,e,Fn,0,0,1),Zn("n1",t,e,Fn,-n,-r,-1),Zn("n2",t,e,Fn,n,-r,-1),Zn("n3",t,e,Fn,-n,r,-1),Zn("n4",t,e,Fn,n,r,-1),Zn("f1",t,e,Fn,-n,-r,1),Zn("f2",t,e,Fn,n,-r,1),Zn("f3",t,e,Fn,-n,r,1),Zn("f4",t,e,Fn,n,r,1),Zn("u1",t,e,Fn,n*.7,r*1.1,-1),Zn("u2",t,e,Fn,-n*.7,r*1.1,-1),Zn("u3",t,e,Fn,0,r*2,-1),Zn("cf1",t,e,Fn,-n,0,1),Zn("cf2",t,e,Fn,n,0,1),Zn("cf3",t,e,Fn,0,-r,1),Zn("cf4",t,e,Fn,0,r,1),Zn("cn1",t,e,Fn,-n,0,-1),Zn("cn2",t,e,Fn,n,0,-1),Zn("cn3",t,e,Fn,0,-r,-1),Zn("cn4",t,e,Fn,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Zn(i,e,t,n,r,s,o){xf.set(r,s,o).unproject(n);const l=e[i];if(l!==void 0){const h=t.getAttribute("position");for(let d=0,f=l.length;d<f;d++)h.setXYZ(l[d],xf.x,xf.y,xf.z)}}const bf=new sr;class V2 extends fl{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new zt;s.setIndex(new Wn(n,1)),s.setAttribute("position",new Wn(r,3)),super(s,new os({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&bf.setFromObject(this.object),bf.isEmpty())return;const t=bf.min,n=bf.max,r=this.geometry.attributes.position,s=r.array;s[0]=n.x,s[1]=n.y,s[2]=n.z,s[3]=t.x,s[4]=n.y,s[5]=n.z,s[6]=t.x,s[7]=t.y,s[8]=n.z,s[9]=n.x,s[10]=t.y,s[11]=n.z,s[12]=n.x,s[13]=n.y,s[14]=t.z,s[15]=t.x,s[16]=n.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=n.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e){return fl.prototype.copy.call(this,e),this.object=e.object,this}}class m9{constructor(){this.type="ShapePath",this.color=new Pe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new om,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function n(E){const C=[];for(let A=0,D=E.length;A<D;A++){const I=E[A],F=new va;F.curves=I.curves,C.push(F)}return C}function r(E,C){const A=C.length;let D=!1;for(let I=A-1,F=0;F<A;I=F++){let P=C[I],k=C[F],j=k.x-P.x,G=k.y-P.y;if(Math.abs(G)>Number.EPSILON){if(G<0&&(P=C[F],j=-j,k=C[I],G=-G),E.y<P.y||E.y>k.y)continue;if(E.y===P.y){if(E.x===P.x)return!0}else{const ne=G*(E.x-P.x)-j*(E.y-P.y);if(ne===0)return!0;if(ne<0)continue;D=!D}}else{if(E.y!==P.y)continue;if(k.x<=E.x&&E.x<=P.x||P.x<=E.x&&E.x<=k.x)return!0}}return D}const s=_o.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return n(o);let l,h,d;const f=[];if(o.length===1)return h=o[0],d=new va,d.curves=h.curves,f.push(d),f;let g=!s(o[0].getPoints());g=e?!g:g;const y=[],_=[];let w=[],S=0,b;_[S]=void 0,w[S]=[];for(let E=0,C=o.length;E<C;E++)h=o[E],b=h.getPoints(),l=s(b),l=e?!l:l,l?(!g&&_[S]&&S++,_[S]={s:new va,p:b},_[S].s.curves=h.curves,g&&S++,w[S]=[]):w[S].push({h,p:b[0]});if(!_[0])return n(o);if(_.length>1){let E=!1,C=0;for(let A=0,D=_.length;A<D;A++)y[A]=[];for(let A=0,D=_.length;A<D;A++){const I=w[A];for(let F=0;F<I.length;F++){const P=I[F];let k=!0;for(let j=0;j<_.length;j++)r(P.p,_[j].p)&&(A!==j&&C++,k?(k=!1,y[j].push(P)):E=!0);k&&y[A].push(P)}}C>0&&E===!1&&(w=y)}let T;for(let E=0,C=_.length;E<C;E++){d=_[E].s,f.push(d),T=w[E];for(let A=0,D=T.length;A<D;A++)d.holes.push(T[A].h)}return f}}class wf{static toHalfFloat(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Jn(e,-65504,65504),XS[0]=e;const t=qS[0],n=t>>23&511;return es[n]+((t&8388607)>>ts[n])}static fromHalfFloat(e){const t=e>>10;return qS[0]=Lx[G2[t]+(e&1023)]+hu[t],XS[0]}}const H2=new ArrayBuffer(4),XS=new Float32Array(H2),qS=new Uint32Array(H2),es=new Uint32Array(512),ts=new Uint32Array(512);for(let i=0;i<256;++i){const e=i-127;e<-27?(es[i]=0,es[i|256]=32768,ts[i]=24,ts[i|256]=24):e<-14?(es[i]=1024>>-e-14,es[i|256]=1024>>-e-14|32768,ts[i]=-e-1,ts[i|256]=-e-1):e<=15?(es[i]=e+15<<10,es[i|256]=e+15<<10|32768,ts[i]=13,ts[i|256]=13):e<128?(es[i]=31744,es[i|256]=64512,ts[i]=24,ts[i|256]=24):(es[i]=31744,es[i|256]=64512,ts[i]=13,ts[i|256]=13)}const Lx=new Uint32Array(2048),hu=new Uint32Array(64),G2=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;!(e&8388608);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Lx[i]=e|t}for(let i=1024;i<2048;++i)Lx[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)hu[i]=i<<23;hu[31]=1199570944;hu[32]=2147483648;for(let i=33;i<63;++i)hu[i]=2147483648+(i-32<<23);hu[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(G2[i]=1024);Nr.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(Nr.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};om.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};F2.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};z2.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Eo.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),R6.extractUrlBase(i)};Eo.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};dd.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};dd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};dd.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};dd.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};sr.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};sr.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};sr.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};sr.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};sr.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};Ta.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};su.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};ad.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};B2.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Gn.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Gn.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Gn.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Gn.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Gn.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Gn.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Qe.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Qe.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Qe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new z().setFromMatrixColumn(this,3)};Qe.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Qe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Qe.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Qe.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Qe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Qe.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Qe.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Qe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Qe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Qe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Qe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Qe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Qe.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Qe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Qe.prototype.makeFrustum=function(i,e,t,n,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,n,t,r,s)};Qe.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};mo.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};ai.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};ai.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};Mo.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Mo.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};Mo.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};oi.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};oi.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};oi.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};oi.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};oi.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};oi.barycoordFromPoint=function(i,e,t,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),oi.getBarycoord(i,e,t,n,r)};oi.normal=function(i,e,t,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),oi.getNormal(i,e,t,n)};va.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};va.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ba(this,i)};va.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new xx(this,i)};ae.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};ae.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};ae.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};z.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};z.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};z.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};z.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};z.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};z.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};z.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};z.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};z.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};dn.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};dn.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};$t.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};$t.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};$t.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};$t.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};$t.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties($t.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});In.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(In.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),II},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});i2.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};fi.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(Is.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Wn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===rm},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(rm)}}});Wn.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?rm:Bh),this};Wn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Wn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};zt.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};zt.prototype.addAttribute=function(i,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(i,new Wn(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};zt.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};zt.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};zt.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};zt.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};zt.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(zt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});cd.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?rm:Bh),this};cd.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};ba.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};ba.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};ba.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};cx.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Rx.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(li.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Pe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===OE}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(kt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});cn.prototype.clearTarget=function(i,e,t,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,n)};cn.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};cn.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};cn.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};cn.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};cn.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};cn.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};cn.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};cn.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};cn.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};cn.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};cn.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};cn.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};cn.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};cn.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};cn.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};cn.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};cn.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};cn.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};cn.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};cn.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};cn.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};cn.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};cn.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};cn.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(cn.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?Ln:Ds}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(e2.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(Yt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});B6.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new O6().load(i,function(n){e.setBuffer(n)}),this};ox.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};ox.prototype.clear=function(i,e,t,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,n)};xl.crossOrigin=void 0;xl.loadTexture=function(i,e,t,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new T2;r.setCrossOrigin(this.crossOrigin);const s=r.load(i,t,void 0,n);return e&&(s.mapping=e),s};xl.loadTextureCube=function(i,e,t,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new E2;r.setCrossOrigin(this.crossOrigin);const s=r.load(i,t,void 0,n);return e&&(s.mapping=e),s};xl.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};xl.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ex}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ex);const W2=100,Ye=1/W2,pn=W2,Qm=.1,$m=1e4,j2=Number.EPSILON,br=100*Ye,xo=br*.5;var bn=new fi(75,1,Qm,$m);const[hl,Ze]=Ge(bn),[ev,Os]=Ge([]),YS=Im(ev,Os),iz=Om(ev,Os),ZS=G4(ev,Os),X2=new WeakSet,[jh,vi]=Ge(void 0),Dx=[0],rz=new k2,q2=()=>{requestAnimationFrame(q2),Dx[0]=rz.getDelta()};q2();const[v9,Y2]=Ge(!1);var sz=!!window.chrome;const[oz,Xh]=Ge("#000000"),[az,Ix]=Ge(!1),Z2=()=>{const i=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(i)?!0:!!/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(i)},[lz,K2]=Ge(Z2()),cz=Mr(()=>lz(Z2()),100,"trailing");window.addEventListener("resize",cz);const J2=()=>new cn({powerPreference:"high-performance",alpha:Xh()==="transparent",logarithmicDepthBuffer:sz&&!K2()?Ix():!1,antialias:!0});let fh;const[uz,Sn]=Ge(fh=J2());Kt(()=>{const i=fh??J2();return uz(i),()=>{i.dispose(),fh=void 0}},[Xh,Ix,K2]);let Ox=Y2();Y2(i=>Ox=i);const Q2=(i,e,t)=>{let n=0;const r=setInterval(()=>{document.hidden||Ox||(t(),e!==-1&&++n>=e&&clearInterval(r))},i);return new En(()=>clearInterval(r))};let KS=0,Tc=[];const hz=(i,e)=>e-i,n_=new Set;Sn(i=>{i.setAnimationLoop(()=>{const e=1/Dx[0];if(Tc.push(e),Tc.length===60&&(Tc.sort(hz),Tc[Math.floor(Tc.length*.5)],Tc=[]),!(Ox||++KS<Math.round(e/60))){KS=0;for(const t of n_)t()}})});const wi=i=>(n_.add(i),new En(()=>n_.delete(i))),[dz,tv]=Er(),wh=Mr(dz,0,"trailing"),Li=new Set;class $2 extends $_{constructor(e){super(),this.outerObject3d=e,e.userData.manager=this,Li.add(this),wh()}get uuid(){return this.outerObject3d.uuid}_append(e){var t,n,r;Li.delete(e),wh(),(n=(t=e.parent)===null||t===void 0?void 0:t.children)===null||n===void 0||n.delete(e),e.parent=this,((r=this.children)!==null&&r!==void 0?r:this.children=new Set).add(e)}append(e){this._append(e),this.outerObject3d.add(e.outerObject3d)}attach(e){this._append(e),this.outerObject3d.attach(e.outerObject3d)}dispose(){var e,t,n;if(super.dispose(),Li.delete(this),wh(),(t=(e=this.parent)===null||e===void 0?void 0:e.children)===null||t===void 0||t.delete(this),this.parent=void 0,(n=this.outerObject3d.parent)===null||n===void 0||n.remove(this.outerObject3d),this.children)for(const r of this.children)r.dispose();return this}}const[kx,qh]=Ge([]),pz=Im(kx,qh),fz=Om(kx,qh),du={onLoop:Function,proxy:Object},Sl={},eT=bt(Me({},du),{texture:String}),tT=Me({},Sl);class Bs extends $2{get proxy(){return this._proxy}set proxy(e){this._proxy!==e&&(this._proxy&&(this._proxy.__target=void 0),this._proxy=e,e&&(e.__target=this))}timer(e,t,n){return this.watch(Q2(e,t,n))}loop(e){return this.watch(wi(e))}queueMicrotask(e){queueMicrotask(()=>!this.done&&e())}cancellable(e){return this.watch(new En(e))}createEffect(e,t){return this.watch(Kt(e,t))}get onLoop(){return this._onLoop}set onLoop(e){var t;this._onLoop=e,(t=this._loopHandle)===null||t===void 0||t.cancel(),e&&(this._loopHandle=this.loop(e))}}class pd extends Bs{constructor(){super(new ei),pz(this)}dispose(){return super.dispose(),fz(this),this}get texture(){return this._texture}set texture(e){this._texture=e,kx([...qh()])}}pd.componentName="environment";pd.defaults=tT;pd.schema=eT;const[nT,iT]=Ge(0),rT=()=>nT(iT()+1),lm=()=>nT(iT()-1),mz=[0],sT=i=>mz[0]+=i.loaded;class vz extends P6{constructor(e){super(e),this.type=Ts}parse(e){const l=function(C,A){switch(C){case 1:console.error("THREE.RGBELoader Read Error: "+(A||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(A||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(A||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(A||""))}return-1},g=`
|
||
`,y=function(C,A,D){A=A||1024;let F=C.pos,P=-1,k=0,j="",G=String.fromCharCode.apply(null,new Uint16Array(C.subarray(F,F+128)));for(;0>(P=G.indexOf(g))&&k<A&&F<C.byteLength;)j+=G,k+=G.length,F+=128,G+=String.fromCharCode.apply(null,new Uint16Array(C.subarray(F,F+128)));return-1<P?(D!==!1&&(C.pos+=k+P+1),j+G.slice(0,P)):!1},_=function(C){const A=/^#\?(\S+)/,D=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,I=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,F=/^\s*FORMAT=(\S+)\s*$/,P=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,k={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let j,G;if(C.pos>=C.byteLength||!(j=y(C)))return l(1,"no header found");if(!(G=j.match(A)))return l(3,"bad initial token");for(k.valid|=1,k.programtype=G[1],k.string+=j+`
|
||
`;j=y(C),j!==!1;){if(k.string+=j+`
|
||
`,j.charAt(0)==="#"){k.comments+=j+`
|
||
`;continue}if((G=j.match(D))&&(k.gamma=parseFloat(G[1])),(G=j.match(I))&&(k.exposure=parseFloat(G[1])),(G=j.match(F))&&(k.valid|=2,k.format=G[1]),(G=j.match(P))&&(k.valid|=4,k.height=parseInt(G[1],10),k.width=parseInt(G[2],10)),k.valid&2&&k.valid&4)break}return k.valid&2?k.valid&4?k:l(3,"missing image size specifier"):l(3,"missing format specifier")},w=function(C,A,D){const I=A;if(I<8||I>32767||C[0]!==2||C[1]!==2||C[2]&128)return new Uint8Array(C);if(I!==(C[2]<<8|C[3]))return l(3,"wrong scanline width");const F=new Uint8Array(4*A*D);if(!F.length)return l(4,"unable to allocate buffer space");let P=0,k=0;const j=4*I,G=new Uint8Array(4),ne=new Uint8Array(j);let ce=D;for(;ce>0&&k<C.byteLength;){if(k+4>C.byteLength)return l(1);if(G[0]=C[k++],G[1]=C[k++],G[2]=C[k++],G[3]=C[k++],G[0]!=2||G[1]!=2||(G[2]<<8|G[3])!=I)return l(3,"bad rgbe scanline format");let Z=0,$;for(;Z<j&&k<C.byteLength;){$=C[k++];const pe=$>128;if(pe&&($-=128),$===0||Z+$>j)return l(3,"bad scanline data");if(pe){const re=C[k++];for(let se=0;se<$;se++)ne[Z++]=re}else ne.set(C.subarray(k,k+$),Z),Z+=$,k+=$}const K=I;for(let pe=0;pe<K;pe++){let re=0;F[P]=ne[pe+re],re+=I,F[P+1]=ne[pe+re],re+=I,F[P+2]=ne[pe+re],re+=I,F[P+3]=ne[pe+re],P+=4}ce--}return F},S=function(C,A,D,I){const F=C[A+3],P=Math.pow(2,F-128)/255;D[I+0]=C[A+0]*P,D[I+1]=C[A+1]*P,D[I+2]=C[A+2]*P,D[I+3]=1},b=function(C,A,D,I){const F=C[A+3],P=Math.pow(2,F-128)/255;D[I+0]=wf.toHalfFloat(Math.min(C[A+0]*P,65504)),D[I+1]=wf.toHalfFloat(Math.min(C[A+1]*P,65504)),D[I+2]=wf.toHalfFloat(Math.min(C[A+2]*P,65504)),D[I+3]=wf.toHalfFloat(1)},T=new Uint8Array(e);T.pos=0;const E=_(T);if(E!==-1){const C=E.width,A=E.height,D=w(T.subarray(T.pos),C,A);if(D!==-1){let I,F,P,k;switch(this.type){case is:k=D.length/4;const j=new Float32Array(k*4);for(let ne=0;ne<k;ne++)S(D,ne*4,j,ne*4);I=j,P=is;break;case Ts:k=D.length/4;const G=new Uint16Array(k*4);for(let ne=0;ne<k;ne++)b(D,ne*4,G,ne*4);I=G,P=Ts;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:C,height:A,data:I,header:E.string,gamma:E.gamma,exposure:E.exposure,format:F,type:P}}}return null}setDataType(e){return this.type=e,this}load(e,t,n,r){function s(o,l){switch(o.type){case is:o.encoding=Ds,o.minFilter=Hn,o.magFilter=Hn,o.generateMipmaps=!1,o.flipY=!0;break;case Ts:o.encoding=Ds,o.minFilter=Hn,o.magFilter=Hn,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,l)}return super.load(e,s,n,r)}}const gz=new Map,oT=new T2,yz=new vz,Sy=new LE;var Gi=(i,e)=>(e&&Sy.once(i,()=>queueMicrotask(e)),Ma(gz,i,()=>(rT(),(i.toLowerCase().toLowerCase().endsWith(".hdr")?yz:oT).load(i,r=>{r.wrapS=r.wrapT=Nh,Sy.setState(i),lm()},sT,()=>{Sy.setState(i),lm()}))));const[aT,qc]=Ge("default"),[_z,cm]=Ge(1);var $e=new cx;const Hf=new pd;Li.delete(Hf);Kt(()=>{var i;const e=(i=RE(qh()))===null||i===void 0?void 0:i.texture;if(!e)return;const t=Gi(e);return t.mapping=kh,$e.environment=t,()=>{$e.environment=null}},[qh]);Kt(()=>{const i=qc();if(!i)return;if(typeof i=="string"&&i!=="default")return i==="studio"?Hf.texture="https://unpkg.com/lingo3d-textures@1.0.0/assets/studio.jpg":Hf.texture=i,()=>{Hf.texture=void 0};const e=new Mx(16777215,6710886);$e.add(e);const t=new Tx(16777215,.5);t.position.set(0,1,1),$e.add(t);const n=cm(r=>{e.intensity=r,t.intensity=r*.5});return()=>{e.dispose(),$e.remove(e),t.dispose(),$e.remove(t),n.cancel()}},[qc]);const[lT,um]=Ge(void 0);Kt(()=>{const i=um();if(i)return $e.fog=new Gm(i,0,100),()=>{$e.fog=null}},[um]);const xz=new Map,bz=new E2;var wz=i=>Ma(xz,i.join(","),()=>(rT(),bz.load(i,lm,sT,lm)));const[Sz,i_]=Ge(void 0),[Nx,Yh]=Ge([]),Mz=Im(Nx,Yh),Ez=Om(Nx,Yh);Kt(()=>{var i;const e=i_(),t=Xh(),n=(i=RE(Yh()))===null||i===void 0?void 0:i.texture;if(n)if(Array.isArray(n))$e.background=wz(n);else{const r=Gi(n);r.mapping=kh,$e.background=r}else e?$e.background=Gi(e):t?t==="transparent"?$e.background=null:$e.background=new Pe(t):$e.background=new Pe("black")},[Xh,i_,Yh]);Kt(()=>{var i;const e=vi();if(!e||Ze()!==bn)return;const t=new V2((i=e.object3d)!==null&&i!==void 0?i:e.outerObject3d),n=requestAnimationFrame(()=>$e.add(t)),r=wi(()=>t.update());return()=>{cancelAnimationFrame(n),$e.remove(t),r.cancel()}},[vi,Ze]);Kt(()=>{const i=Os();if(!i.length||Ze()!==bn)return;const e=[];for(const n of i){const r=new V2(n.outerObject3d);$e.add(r),e.push(r)}const t=wi(()=>{for(const n of e)n.update()});return()=>{for(const n of e)$e.remove(n);t.cancel()}},[Os,Ze]);class cT{constructor(e,t){this.x=e,this.y=t}}class Sh{constructor(e,t,n){this.x=e,this.y=t,this.z=n}}const pi=180/Math.PI,xn=Math.PI/180,uT=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2),Tz=(i,e,t)=>{const n=t*xn,r=i.x-e.x,s=i.y-e.y,o=r*Math.cos(n)-s*Math.sin(n),l=r*Math.sin(n)+s*Math.cos(n);return new cT(o+e.x,l+e.y)},Az=(i,e,t,n)=>{const r=t*=xn;return new cT(i+n*Math.cos(r),e+n*Math.sin(r))},Ot=new z,bo=new z,Cz=new z,hm=new ai,Pz=new ai,r_=new z(br,br,br);Object.freeze(r_);const hT=new z(xo,xo,xo);Object.freeze(hT);const Yc=new sr,dT=new Mo,Wi=new Ta(0,0,0,"YXZ"),g9=new B2,pT=new ss({wireframe:!0}),fT=new ad,Rz=new Qe,Zh=i=>new Sh(i.x*pn,i.y*pn,i.z*pn),Mh=i=>new z(i.x*Ye,i.y*Ye,i.z*Ye);var fd=i=>i instanceof hx?i.getWorldPosition(Ot):Yc.setFromObject(i).getCenter(Ot);class nv extends Bs{get x(){return this.outerObject3d.position.x*pn}set x(e){this.outerObject3d.position.x=e*Ye}get y(){return this.outerObject3d.position.y*pn}set y(e){this.outerObject3d.position.y=e*Ye}get z(){return this.outerObject3d.position.z*pn}set z(e){this.outerObject3d.position.z=e*Ye}getWorldPosition(){var e;return Zh(((e=this.object3d)!==null&&e!==void 0?e:this.outerObject3d).getWorldPosition(bo))}getCenter(){var e;return Zh(fd((e=this.object3d)!==null&&e!==void 0?e:this.outerObject3d))}}const ml=i=>i instanceof Bs&&"getWorldPosition"in i,[Lz,Gf]=Ge(1),iv=375,rv=667,Bx=5,zx=175,[Dz,mi]=Ge([iv,rv]),s_=([i,e])=>Dz([Math.max(i,1),Math.max(e,1)]),[Iz,Kh]=Ge("balanced"),[y9,Zc]=Ge(1),[_9,Kc]=Ge(!1),[o_,vl]=Ge(!1),[Oz,mT]=Ge(20),[kz,Nz]=Ge(0),[a_,l_]=Ge(!1),[Bz,c_]=Ge(10),[zz,dm]=Ge(!1),[Uz,u_]=Ge(!1),[Fz,vT]=Ge(0),[Vz,gT]=Ge(1.5),[Hz,yT]=Ge(0),[Gz,_T]=Ge(.01),[Wz,h_]=Ge(!1),[jz,xT]=Ge(.8),[Xz,d_]=Ge("#ffffff"),[qz,p_]=Ge(void 0),[Yz,f_]=Ge(void 0),[Zz,bT]=Ge(0),[Kz,wT]=Ge(3),[Jz,ST]=Ge(1),[Qz,m_]=Ge(!1),MT=bt(Me({},du),{texture:[String,Array]}),ET=Me({},Sl);class md extends Bs{constructor(){super(new ei),Mz(this)}dispose(){return super.dispose(),Ez(this),this}get texture(){return this._texture}set texture(e){this._texture=e,Nx([...Yh()])}}md.componentName="skybox";md.defaults=ET;md.schema=MT;const v_=new md;Li.delete(v_);var Cs={get performance(){return Kh()},set performance(i){Iz(i)},get defaultFog(){return um()},set defaultFog(i){lT(i)},get defaultLight(){return qc()},set defaultLight(i){aT(i)},get defaultLightScale(){return cm()},set defaultLightScale(i){_z(i)},get skybox(){return v_.texture},set skybox(i){v_.texture=i},get defaultOrbitControls(){return vl()},set defaultOrbitControls(i){o_(i)},get gridHelper(){return l_()},set gridHelper(i){a_(i)},get gridHelperSize(){return c_()},set gridHelperSize(i){Bz(i)},get gravity(){return mT()},set gravity(i){Oz(i)},get repulsion(){return Nz()},set repulsion(i){kz(i)},wasmPath:"https://unpkg.com/lingo3d-wasm@1.0.0/assets/",autoMount:!1,get logarithmicDepth(){return Ix()},set logarithmicDepth(i){az(i)},get exposure(){return Gf()},set exposure(i){Lz(i)},get pbr(){return m_()},set pbr(i){Qz(i)},get bloom(){return u_()},set bloom(i){Uz(i)},get bloomStrength(){return gT()},set bloomStrength(i){Vz(i)},get bloomRadius(){return vT()},set bloomRadius(i){Fz(i)},get bloomThreshold(){return yT()},set bloomThreshold(i){Hz(i)},get ambientOcclusion(){return dm()},set ambientOcclusion(i){zz(i)},get outlineColor(){return d_()},set outlineColor(i){Xz(i)},get outlineHiddenColor(){return p_()},set outlineHiddenColor(i){qz(i)},get outlinePattern(){return f_()},set outlinePattern(i){Yz(i)},get outlinePulse(){return bT()},set outlinePulse(i){Zz(i)},get outlineStrength(){return wT()},set outlineStrength(i){Kz(i)},get outlineThickness(){return ST()},set outlineThickness(i){Jz(i)},get lensDistortion(){return h_()},set lensDistortion(i){Wz(i)},get lensIor(){return xT()},set lensIor(i){jz(i)},get lensBand(){return _T()},set lensBand(i){Gz(i)},get texture(){return i_()},set texture(i){Sz(i)},get color(){return Xh()},set color(i){oz(i)}};const[$z,Jc]=Ge(void 0),[eU,Qc]=Ge(void 0),pm={createButton(i,e){e&&console.error('THREE.VRButton: The "options" parameter has been removed. Please set the reference space type via renderer.xr.setReferenceSpaceType() instead.');const t=document.createElement("button");function n(){let h=null;async function d(g){g.addEventListener("end",f),await i.xr.setSession(g),t.textContent="EXIT VR",h=g}function f(){h.removeEventListener("end",f),t.textContent="ENTER VR",h=null}t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR",t.onmouseenter=function(){t.style.opacity="1.0"},t.onmouseleave=function(){t.style.opacity="0.5"},t.onclick=function(){if(h===null){const g={optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"]};navigator.xr.requestSession("immersive-vr",g).then(d)}else h.end()}}function r(){t.style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function s(){r(),t.textContent="VR NOT SUPPORTED"}function o(h){r(),console.warn("Exception when trying to call xr.isSessionSupported",h),t.textContent="VR NOT ALLOWED"}function l(h){h.style.position="absolute",h.style.bottom="20px",h.style.padding="12px 6px",h.style.border="1px solid #fff",h.style.borderRadius="4px",h.style.background="rgba(0,0,0,0.1)",h.style.color="#fff",h.style.font="normal 13px sans-serif",h.style.textAlign="center",h.style.opacity="0.5",h.style.outline="none",h.style.zIndex="999"}if("xr"in navigator)return t.id="VRButton",t.style.display="none",l(t),navigator.xr.isSessionSupported("immersive-vr").then(function(h){h?n():s(),h&&pm.xrSessionIsGranted&&t.click()}).catch(o),t;{const h=document.createElement("a");return window.isSecureContext===!1?(h.href=document.location.href.replace(/^http:/,"https:"),h.innerHTML="WEBXR NEEDS HTTPS"):(h.href="https://immersiveweb.dev/",h.innerHTML="WEBXR NOT AVAILABLE"),h.style.left="calc(50% - 90px)",h.style.width="180px",h.style.textDecoration="none",l(h),h}},xrSessionIsGranted:!1,registerSessionGrantedListener(){if("xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent))return;navigator.xr.addEventListener("sessiongranted",()=>{pm.xrSessionIsGranted=!0})}}};pm.registerSessionGrantedListener();const ga=document.createElement("div");Object.assign(ga.style,{position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%"});const wn=document.createElement("div");Object.assign(wn.style,{position:"absolute",left:"0px",top:"0px",width:"100%",zIndex:"10"});ga.appendChild(wn);Qc(i=>wn.style.height=i?"50%":"100%");const TT=[wn.getBoundingClientRect()],tU=new ResizeObserver(()=>TT[0]=wn.getBoundingClientRect());tU.observe(wn);queueMicrotask(()=>{if(!(!Cs.autoMount||ga.parentElement)){if(typeof Cs.autoMount=="string"){const i=document.querySelector(Cs.autoMount);if(!i)return;i.appendChild(ga),new ResizeObserver(()=>{const t=[i.clientWidth,i.clientHeight];s_(t)}).observe(i);return}window.addEventListener("resize",()=>{s_([window.innerWidth,window.innerHeight])}),document.body.appendChild(ga)}});const Jh=document.createElement("div");Object.assign(Jh.style,{border:"1px solid blue",position:"absolute",left:"50%",top:"50%",transform:"translateX(-50%) translateY(-50%)",pointerEvents:"none"});wn.appendChild(Jh);Kt(()=>{var i;const[e,t]=(i=Jc())!==null&&i!==void 0?i:mi(),[n,r]=mi();Jh.style.display=Qc()||n===e&&r===t?"none":"block"},[mi,Jc,Qc]);Kt(()=>{const i=Sn().domElement;return ga.appendChild(i),Object.assign(i.style,{position:"absolute",left:"0px",top:"0px"}),()=>{ga.removeChild(i)}},[Sn]);Kt(()=>{const i=Sn(),[e,t]=mi();i.setSize(e,t),i.setPixelRatio(Zc())},[Sn,mi,Zc]);Kt(()=>{const i=Sn();i.shadowMap.enabled=Kh()!=="speed"},[Sn,Kh]);Kt(()=>{const i=Sn();i.physicallyCorrectLights=m_()},[Sn,m_]);Kt(()=>{const i=Sn(),e=qc(),t=typeof e=="string"&&e!=="default"?Gf()*cm()*(e==="studio"?2:1):Gf();i.toneMapping=t!==1?BE:As,i.toneMappingExposure=t},[Gf,Sn,qc,cm]);Kt(()=>{if(Kc()!=="webxr")return;const i=Sn();i.xr.enabled=!0;const e=pm.createButton(i);return wn.appendChild(e),e.ontouchstart=()=>{var t;return(t=e.onclick)===null||t===void 0?void 0:t.call(e,new MouseEvent("click"))},()=>{i.xr.enabled=!1,wn.removeChild(e)}},[Kc,Sn]);class fm{constructor(e=0,t=0,n=0,r=0,s=0,o=0,l=0){this.x=e,this.y=t,this.z=n,this.clientX=r,this.clientY=s,this.xNorm=o,this.yNorm=l}}class nU extends fm{constructor(e=0,t=0,n=0,r=0,s=0,o=0,l=0,h,d){super(e,t,n,r,s,o,l),this.point=h,this.distance=d}}const AT=bt(Me({},du),{onClick:Function,onMouseMove:Function,onMouseDown:Function,onMouseUp:Function,onMousePress:Function}),CT=Me({},Sl),[JS,mm]=Ge(!0),[x9,iU]=Ge("mouse");var PT=(i,e)=>{const t=TT[0],n=i.clientX-t.x,r=i.clientY-t.y;if(iU()==="camera"&&!e)return new fm;const s=n/t.width*2-1,o=-(r/t.height)*2+1,l=Ze();Ot.set(s,o,.5),Ot.unproject(l),Ot.sub(l.position).normalize();const{x:h,y:d,z:f}=l.position.clone().add(Ot.multiplyScalar(5));return new fm(h,d,f,n,r,s,o)};const[QS,Qh]=Ge(!1),[rU,$c]=Ge(!1);Kt(()=>{rU(Qh()&&Ze()===bn)},[Qh,Ze]);const ji=new LE;let g_=0,y_=0,__=0,x_=!1;wn.addEventListener("contextmenu",i=>{i.preventDefault(),x_=!0});ji.on("down",i=>{g_=Date.now(),y_=i.clientX,__=i.clientY});ji.on("up",i=>{const e=Date.now(),t=e-g_,n=Math.abs(i.clientX-y_),r=Math.abs(i.clientY-__);g_=e,y_=i.clientX,__=i.clientY,t<300&&n<5&&r<5&&ji.emit(x_?"rightClick":"click",i),x_=!1});const Ux=J_(PT,0,"leading");wn.addEventListener("pointermove",i=>{ji.emit("move",Ux(i))});let b_=!1;wn.addEventListener("pointerdown",i=>{b_=!0;const e=Ux(i);ji.emit("down",e),ji.emit("move",e)});const Fx=i=>{b_&&ji.emit("up",Ux(i)),b_=!1};wn.addEventListener("pointerup",Fx);wn.addEventListener("pointercancel",Fx);wn.addEventListener("pointerleave",Fx);class sv extends Bs{constructor(){super(new ei);let e=new fm;const[t,n]=Ge(!1);this.createEffect(()=>{const r=this.onMousePress;if(!n()||!r)return;const s=wi(()=>r(e));return()=>{s.cancel()}},[n]),this.createEffect(()=>{if($c()&&mm())return;const r=ji.on("move",h=>{var d;(d=this.onMouseMove)===null||d===void 0||d.call(this,h),e=h}),s=ji.on("click",h=>{var d;(d=this.onClick)===null||d===void 0||d.call(this,h),e=h}),o=ji.on("down",h=>{var d;(d=this.onMouseDown)===null||d===void 0||d.call(this,h),e=h,t(!0)}),l=ji.on("up",h=>{var d;(d=this.onMouseUp)===null||d===void 0||d.call(this,h),e=h,t(!1)});return()=>{r.cancel(),s.cancel(),o.cancel(),l.cancel()}},[$c,mm])}}sv.componentName="mouse";sv.defaults=CT;sv.schema=AT;const sU=new sv;Li.delete(sU);const[My,$S]=Ge(!1),[oU,vd]=Er(),Di=Mr((i,e)=>oU({target:i,rightClick:e}),0,"trailing");Ze(()=>Di());const[aU,So]=Ge(!1),eM=new K6,w_=new Set,tM=Mr(()=>{w_.clear(),$e.traverse(i=>{var e;const{manager:t}=i.userData;t&&w_.add((e=t.object3d)!==null&&e!==void 0?e:i)})},0,"trailing"),lU=(i,e,t)=>(eM.setFromCamera({x:i,y:e},Ze()),eM.intersectObjects([...t])[0]),il=(i,e,t)=>ji.on(i,n=>{const r=lU(n.xNorm,n.yNorm,e);if(!r)return;const s=Zh(r.point),o=r.distance*pn;t(r.object.userData.manager,new nU(n.x,n.y,n.z,n.clientX,n.clientY,n.xNorm,n.yNorm,s,o))}),RT=new Set,LT=new Set,DT=new Set,IT=new Set,OT=new Set,kT=new Set,nM=()=>{const i=new En;i.watch(il("click",RT,(n,r)=>{var s;return(s=n.onClick)===null||s===void 0?void 0:s.call(n,r)})),i.watch(il("down",LT,(n,r)=>{var s;return(s=n.onMouseDown)===null||s===void 0?void 0:s.call(n,r)})),i.watch(il("up",DT,(n,r)=>{var s;return(s=n.onMouseUp)===null||s===void 0?void 0:s.call(n,r)}));let e=new Set,t=new Set;return i.watch(il("move",IT,(n,r)=>{e.add(n),n.outerObject3d.userData.eMove=r})),i.watch(il("move",OT,(n,r)=>{e.add(n),n.outerObject3d.userData.eMove=r})),i.watch(il("move",kT,(n,r)=>{e.add(n),n.outerObject3d.userData.eMove=r})),i.watch(ji.on("move",()=>{var n,r,s;for(const o of e)t.has(o)||(n=o.onMouseOver)===null||n===void 0||n.call(o,o.outerObject3d.userData.eMove),(r=o.onMouseMove)===null||r===void 0||r.call(o,o.outerObject3d.userData.eMove);for(const o of t)e.has(o)||(s=o.onMouseOut)===null||s===void 0||s.call(o,o.outerObject3d.userData.eMove);t=e,e=new Set})),i};Kt(()=>{const i=Qh(),e=$S(),t=j4(!0);if(W4(()=>{!e&&(t.current=!0)},[e]),i&&!So()&&Ze()===bn){const r=new En;tM(),r.watch(tv(tM)),r.watch(ji.on("click",()=>Di()));let s=!1;return r.watch(ji.on("rightClick",()=>s=!0)),r.watch(il(["click","rightClick"],w_,o=>{Di(o,s),s=!1})),r.watch(vd(({target:o,rightClick:l})=>{if(e){if(!ml(o)||l)return;if(t.current){const h=vi();ml(h)&&YS(h)}t.current=!1,Os().includes(o)?iz(o):YS(o);return}ZS(),jh(l?o:o===vi()?void 0:o)})),!e&&!mm()&&r.watch(nM()),()=>{r.cancel()}}if(i)return;ZS(),jh(void 0);const n=nM();return()=>{n.cancel()}},[Qh,mm,So,Ze,$S]);const Zt={c:null,u:[new z,new z,new z],e:[]},tn={c:null,u:[new z,new z,new z],e:[]},Bn=[[],[],[]],Tt=[[],[],[]],Mn=[],Ja=new z,Qa=new z,$a=new z,si=new z,iM=new z,rM=new z,Qr=new Gn,sM=new sr,Sf=new Qe,oM=new Qe,aM=new Mo;class Vx{constructor(e=new z,t=new z,n=new Gn){this.center=e,this.halfSize=t,this.rotation=n}set(e,t,n){return this.center=e,this.halfSize=t,this.rotation=n,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new this.constructor().copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,t){const n=this.halfSize;si.subVectors(e,this.center),this.rotation.extractBasis(Ja,Qa,$a),t.copy(this.center);const r=G0.clamp(si.dot(Ja),-n.x,n.x);t.add(Ja.multiplyScalar(r));const s=G0.clamp(si.dot(Qa),-n.y,n.y);t.add(Qa.multiplyScalar(s));const o=G0.clamp(si.dot($a),-n.z,n.z);return t.add($a.multiplyScalar(o)),t}containsPoint(e){return si.subVectors(e,this.center),this.rotation.extractBasis(Ja,Qa,$a),Math.abs(si.dot(Ja))<=this.halfSize.x&&Math.abs(si.dot(Qa))<=this.halfSize.y&&Math.abs(si.dot($a))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(cU.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,rM),rM.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,t=Number.EPSILON){Zt.c=this.center,Zt.e[0]=this.halfSize.x,Zt.e[1]=this.halfSize.y,Zt.e[2]=this.halfSize.z,this.rotation.extractBasis(Zt.u[0],Zt.u[1],Zt.u[2]),tn.c=e.center,tn.e[0]=e.halfSize.x,tn.e[1]=e.halfSize.y,tn.e[2]=e.halfSize.z,e.rotation.extractBasis(tn.u[0],tn.u[1],tn.u[2]);for(let s=0;s<3;s++)for(let o=0;o<3;o++)Bn[s][o]=Zt.u[s].dot(tn.u[o]);si.subVectors(tn.c,Zt.c),Mn[0]=si.dot(Zt.u[0]),Mn[1]=si.dot(Zt.u[1]),Mn[2]=si.dot(Zt.u[2]);for(let s=0;s<3;s++)for(let o=0;o<3;o++)Tt[s][o]=Math.abs(Bn[s][o])+t;let n,r;for(let s=0;s<3;s++)if(n=Zt.e[s],r=tn.e[0]*Tt[s][0]+tn.e[1]*Tt[s][1]+tn.e[2]*Tt[s][2],Math.abs(Mn[s])>n+r)return!1;for(let s=0;s<3;s++)if(n=Zt.e[0]*Tt[0][s]+Zt.e[1]*Tt[1][s]+Zt.e[2]*Tt[2][s],r=tn.e[s],Math.abs(Mn[0]*Bn[0][s]+Mn[1]*Bn[1][s]+Mn[2]*Bn[2][s])>n+r)return!1;return n=Zt.e[1]*Tt[2][0]+Zt.e[2]*Tt[1][0],r=tn.e[1]*Tt[0][2]+tn.e[2]*Tt[0][1],!(Math.abs(Mn[2]*Bn[1][0]-Mn[1]*Bn[2][0])>n+r||(n=Zt.e[1]*Tt[2][1]+Zt.e[2]*Tt[1][1],r=tn.e[0]*Tt[0][2]+tn.e[2]*Tt[0][0],Math.abs(Mn[2]*Bn[1][1]-Mn[1]*Bn[2][1])>n+r)||(n=Zt.e[1]*Tt[2][2]+Zt.e[2]*Tt[1][2],r=tn.e[0]*Tt[0][1]+tn.e[1]*Tt[0][0],Math.abs(Mn[2]*Bn[1][2]-Mn[1]*Bn[2][2])>n+r)||(n=Zt.e[0]*Tt[2][0]+Zt.e[2]*Tt[0][0],r=tn.e[1]*Tt[1][2]+tn.e[2]*Tt[1][1],Math.abs(Mn[0]*Bn[2][0]-Mn[2]*Bn[0][0])>n+r)||(n=Zt.e[0]*Tt[2][1]+Zt.e[2]*Tt[0][1],r=tn.e[0]*Tt[1][2]+tn.e[2]*Tt[1][0],Math.abs(Mn[0]*Bn[2][1]-Mn[2]*Bn[0][1])>n+r)||(n=Zt.e[0]*Tt[2][2]+Zt.e[2]*Tt[0][2],r=tn.e[0]*Tt[1][1]+tn.e[1]*Tt[1][0],Math.abs(Mn[0]*Bn[2][2]-Mn[2]*Bn[0][2])>n+r)||(n=Zt.e[0]*Tt[1][0]+Zt.e[1]*Tt[0][0],r=tn.e[1]*Tt[2][2]+tn.e[2]*Tt[2][1],Math.abs(Mn[1]*Bn[0][0]-Mn[0]*Bn[1][0])>n+r)||(n=Zt.e[0]*Tt[1][1]+Zt.e[1]*Tt[0][1],r=tn.e[0]*Tt[2][2]+tn.e[2]*Tt[2][0],Math.abs(Mn[1]*Bn[0][1]-Mn[0]*Bn[1][1])>n+r)||(n=Zt.e[0]*Tt[1][2]+Zt.e[1]*Tt[0][2],r=tn.e[0]*Tt[2][1]+tn.e[1]*Tt[2][0],Math.abs(Mn[1]*Bn[0][2]-Mn[0]*Bn[1][2])>n+r))}intersectsPlane(e){this.rotation.extractBasis(Ja,Qa,$a);const t=this.halfSize.x*Math.abs(e.normal.dot(Ja))+this.halfSize.y*Math.abs(e.normal.dot(Qa))+this.halfSize.z*Math.abs(e.normal.dot($a)),n=e.normal.dot(this.center)-e.constant;return Math.abs(n)<=t}intersectRay(e,t){return this.getSize(iM),sM.setFromCenterAndSize(si.set(0,0,0),iM),Sf.setFromMatrix3(this.rotation),Sf.setPosition(this.center),oM.copy(Sf).invert(),aM.copy(e).applyMatrix4(oM),aM.intersectBox(sM,t)?t.applyMatrix4(Sf):null}intersectsRay(e){return this.intersectRay(e,si)!==null}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const t=e.elements;let n=si.set(t[0],t[1],t[2]).length();const r=si.set(t[4],t[5],t[6]).length(),s=si.set(t[8],t[9],t[10]).length();e.determinant()<0&&(n=-n),Qr.setFromMatrix4(e);const l=1/n,h=1/r,d=1/s;return Qr.elements[0]*=l,Qr.elements[1]*=l,Qr.elements[2]*=l,Qr.elements[3]*=h,Qr.elements[4]*=h,Qr.elements[5]*=h,Qr.elements[6]*=d,Qr.elements[7]*=d,Qr.elements[8]*=d,this.rotation.multiply(Qr),this.halfSize.x*=n,this.halfSize.y*=r,this.halfSize.z*=s,si.setFromMatrixPosition(e),this.center.add(si),this}}const cU=new Vx,_r={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform float opacity;
|
||
|
||
uniform sampler2D tDiffuse;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = texture2D( tDiffuse, vUv );
|
||
gl_FragColor.a *= opacity;
|
||
|
||
|
||
}`};class zs{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}const uU=new ou(-1,1,1,-1,0,1),Hx=new zt;Hx.setAttribute("position",new xt([-1,3,0,-1,-1,0,3,-1,0],3));Hx.setAttribute("uv",new xt([0,2,0,0,2,0],2));class Ml{constructor(e){this._mesh=new In(Hx,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,uU)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class vm extends zs{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof kt?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Qn.clone(e.uniforms),this.material=new kt({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Ml(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class lM extends zs{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,l;this.inverse?(o=0,l=1):(o=1,l=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),s.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),s.buffers.stencil.setClear(l),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(r.EQUAL,1,4294967295),s.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),s.buffers.stencil.setLocked(!0)}}class hU extends zs{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class S_{constructor(e,t){if(this.renderer=e,t===void 0){const n=e.getSize(new ae);this._pixelRatio=e.getPixelRatio(),this._width=n.width,this._height=n.height,t=new Yt(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],_r===void 0&&console.error("THREE.EffectComposer relies on CopyShader"),vm===void 0&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new vm(_r),this.clock=new k2}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let n=!1;for(let r=0,s=this.passes.length;r<s;r++){const o=this.passes[r];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap){if(n){const l=this.renderer.getContext(),h=this.renderer.state.buffers.stencil;h.setFunc(l.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),h.setFunc(l.EQUAL,1,4294967295)}this.swapBuffers()}lM!==void 0&&(o instanceof lM?n=!0:o instanceof hU&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new ae);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let s=0;s<this.passes.length;s++)this.passes[s].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}new ou(-1,1,1,-1,0,1);const NT=new zt;NT.setAttribute("position",new xt([-1,3,0,-1,-1,0,3,-1,0],3));NT.setAttribute("uv",new xt([0,2,0,0,2,0],2));class dU extends zs{constructor(e,t,n,r,s){super(),this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=s!==void 0?s:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new Pe}render(e,t,n){const r=e.autoClear;e.autoClear=!1;let s,o;this.overrideMaterial!==void 0&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),s=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,s),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=o),e.autoClear=r}}const Gx=new dU($e,Ze());Ze(i=>Gx.camera=i);const cM={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new Pe(0)},defaultOpacity:{value:0}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform vec3 defaultColor;
|
||
uniform float defaultOpacity;
|
||
uniform float luminosityThreshold;
|
||
uniform float smoothWidth;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vec4 texel = texture2D( tDiffuse, vUv );
|
||
|
||
vec3 luma = vec3( 0.299, 0.587, 0.114 );
|
||
|
||
float v = dot( texel.xyz, luma );
|
||
|
||
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
|
||
|
||
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
|
||
|
||
gl_FragColor = mix( outputColor, texel, alpha );
|
||
|
||
}`};class eu extends zs{constructor(e,t,n,r){super(),this.strength=t!==void 0?t:1,this.radius=n,this.threshold=r,this.resolution=e!==void 0?new ae(e.x,e.y):new ae(256,256),this.clearColor=new Pe(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let s=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new Yt(s,o),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let g=0;g<this.nMips;g++){const y=new Yt(s,o);y.texture.name="UnrealBloomPass.h"+g,y.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(y);const _=new Yt(s,o);_.texture.name="UnrealBloomPass.v"+g,_.texture.generateMipmaps=!1,this.renderTargetsVertical.push(_),s=Math.round(s/2),o=Math.round(o/2)}cM===void 0&&console.error("THREE.UnrealBloomPass relies on LuminosityHighPassShader");const l=cM;this.highPassUniforms=Qn.clone(l.uniforms),this.highPassUniforms.luminosityThreshold.value=r,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new kt({uniforms:this.highPassUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const h=[3,5,7,9,11];s=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);for(let g=0;g<this.nMips;g++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(h[g])),this.separableBlurMaterials[g].uniforms.texSize.value=new ae(s,o),s=Math.round(s/2),o=Math.round(o/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const d=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=d,this.bloomTintColors=[new z(1,1,1),new z(1,1,1),new z(1,1,1),new z(1,1,1),new z(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,_r===void 0&&console.error("THREE.UnrealBloomPass relies on CopyShader");const f=_r;this.copyUniforms=Qn.clone(f.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new kt({uniforms:this.copyUniforms,vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:Qf,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Pe,this.oldClearAlpha=1,this.basic=new ss,this.fsQuad=new Ml(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose()}setSize(e,t){let n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(let s=0;s<this.nMips;s++)this.renderTargetsHorizontal[s].setSize(n,r),this.renderTargetsVertical[s].setSize(n,r),this.separableBlurMaterials[s].uniforms.texSize.value=new ae(n,r),n=Math.round(n/2),r=Math.round(r/2)}render(e,t,n,r,s){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const o=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),s&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let l=this.renderTargetBright;for(let h=0;h<this.nMips;h++)this.fsQuad.material=this.separableBlurMaterials[h],this.separableBlurMaterials[h].uniforms.colorTexture.value=l.texture,this.separableBlurMaterials[h].uniforms.direction.value=eu.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[h]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[h].uniforms.colorTexture.value=this.renderTargetsHorizontal[h].texture,this.separableBlurMaterials[h].uniforms.direction.value=eu.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[h]),e.clear(),this.fsQuad.render(e),l=this.renderTargetsVertical[h];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,s&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(n),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o}getSeperableBlurMaterial(e){return new kt({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new ae(.5,.5)},direction:{value:new ae(.5,.5)}},vertexShader:`varying vec2 vUv;
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`#include <common>
|
||
varying vec2 vUv;
|
||
uniform sampler2D colorTexture;
|
||
uniform vec2 texSize;
|
||
uniform vec2 direction;
|
||
|
||
float gaussianPdf(in float x, in float sigma) {
|
||
return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
|
||
}
|
||
void main() {
|
||
vec2 invSize = 1.0 / texSize;
|
||
float fSigma = float(SIGMA);
|
||
float weightSum = gaussianPdf(0.0, fSigma);
|
||
vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;
|
||
for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
|
||
float x = float(i);
|
||
float w = gaussianPdf(x, fSigma);
|
||
vec2 uvOffset = direction * invSize * x;
|
||
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;
|
||
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;
|
||
diffuseSum += (sample1 + sample2) * w;
|
||
weightSum += 2.0 * w;
|
||
}
|
||
gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
|
||
}`})}getCompositeMaterial(e){return new kt({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`varying vec2 vUv;
|
||
uniform sampler2D blurTexture1;
|
||
uniform sampler2D blurTexture2;
|
||
uniform sampler2D blurTexture3;
|
||
uniform sampler2D blurTexture4;
|
||
uniform sampler2D blurTexture5;
|
||
uniform float bloomStrength;
|
||
uniform float bloomRadius;
|
||
uniform float bloomFactors[NUM_MIPS];
|
||
uniform vec3 bloomTintColors[NUM_MIPS];
|
||
|
||
float lerpBloomFactor(const in float factor) {
|
||
float mirrorFactor = 1.2 - factor;
|
||
return mix(factor, mirrorFactor, bloomRadius);
|
||
}
|
||
|
||
void main() {
|
||
gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
|
||
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
|
||
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
|
||
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
|
||
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
|
||
}`})}}eu.BlurDirectionX=new ae(1,0);eu.BlurDirectionY=new ae(0,1);const gd=new eu(new ae,1.5,0,0);vT(i=>gd.radius=i);gT(i=>gd.strength=i);yT(i=>gd.threshold=i);const ya=new S_(Sn());ya.renderToScreen=!1;Kt(()=>{ya.renderer=Sn();const[i,e]=mi();ya.setSize(i,e),ya.setPixelRatio(Zc())},[Sn,mi,Zc]);ya.addPass(Gx);ya.addPass(gd);const BT=[!1],Wx=i=>{i.userData.bloom=!0,BT[0]=!0},jx=i=>{i.userData.bloom=!1};let M_;const zT=i=>{for(const e of i){if(e.userData.bloom){e.renderOrder=1;continue}e.visible&&(zT(e.children),e.material&&(e.material.colorWrite=!1),e.renderOrder=0)}},pU=()=>{zT($e.children),$e.background&&(M_=$e.background,$e.background=null)},fU=i=>i.material&&(i.material.colorWrite=!0),mU=()=>{$e.traverse(fU),M_&&($e.background=M_)};var vU=()=>{pU(),ya.render(),mU()};const Mf=new WeakMap;var uM=i=>{if(Mf.has(i))return Mf.get(i);fd(i);const e=Ze();Ot.project(e);const t=(Ot.x*.5+.5)*wn.clientWidth,n=(Ot.y*-.5+.5)*wn.clientHeight,r={x:t,y:n};return Mf.set(i,r),setTimeout(()=>Mf.delete(i)),r};const $r={defines:{MAX_STEP:0,PERSPECTIVE_CAMERA:!0,DISTANCE_ATTENUATION:!0,FRESNEL:!0,INFINITE_THICK:!1,SELECTIVE:!1},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tMetalness:{value:null},tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new ae},cameraProjectionMatrix:{value:new Qe},cameraInverseProjectionMatrix:{value:new Qe},opacity:{value:.5},maxDistance:{value:180},cameraRange:{value:0},thickness:{value:.018}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}
|
||
|
||
`,fragmentShader:`
|
||
// precision highp float;
|
||
precision highp sampler2D;
|
||
varying vec2 vUv;
|
||
uniform sampler2D tDepth;
|
||
uniform sampler2D tNormal;
|
||
uniform sampler2D tMetalness;
|
||
uniform sampler2D tDiffuse;
|
||
uniform float cameraRange;
|
||
uniform vec2 resolution;
|
||
uniform float opacity;
|
||
uniform float cameraNear;
|
||
uniform float cameraFar;
|
||
uniform float maxDistance;
|
||
uniform float thickness;
|
||
uniform mat4 cameraProjectionMatrix;
|
||
uniform mat4 cameraInverseProjectionMatrix;
|
||
#include <packing>
|
||
float pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) {
|
||
//x0: point, x1: linePointA, x2: linePointB
|
||
//https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html
|
||
return length(cross(x0-x1,x0-x2))/length(x2-x1);
|
||
}
|
||
float pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){
|
||
// https://mathworld.wolfram.com/Point-PlaneDistance.html
|
||
//// https://en.wikipedia.org/wiki/Plane_(geometry)
|
||
//// http://paulbourke.net/geometry/pointlineplane/
|
||
float a=planeNormal.x,b=planeNormal.y,c=planeNormal.z;
|
||
float x0=point.x,y0=point.y,z0=point.z;
|
||
float x=planePoint.x,y=planePoint.y,z=planePoint.z;
|
||
float d=-(a*x+b*y+c*z);
|
||
float distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c);
|
||
return distance;
|
||
}
|
||
float getDepth( const in vec2 uv ) {
|
||
return texture2D( tDepth, uv ).x;
|
||
}
|
||
float getViewZ( const in float depth ) {
|
||
#ifdef PERSPECTIVE_CAMERA
|
||
return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
|
||
#else
|
||
return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
|
||
#endif
|
||
}
|
||
vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) {
|
||
vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc
|
||
clipPosition *= clipW; //clip
|
||
return ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view
|
||
}
|
||
vec3 getViewNormal( const in vec2 uv ) {
|
||
return unpackRGBToNormal( texture2D( tNormal, uv ).xyz );
|
||
}
|
||
vec2 viewPositionToXY(vec3 viewPosition){
|
||
vec2 xy;
|
||
vec4 clip=cameraProjectionMatrix*vec4(viewPosition,1);
|
||
xy=clip.xy;//clip
|
||
float clipW=clip.w;
|
||
xy/=clipW;//NDC
|
||
xy=(xy+1.)/2.;//uv
|
||
xy*=resolution;//screen
|
||
return xy;
|
||
}
|
||
void main(){
|
||
#ifdef SELECTIVE
|
||
float metalness=texture2D(tMetalness,vUv).r;
|
||
if(metalness==0.) return;
|
||
#endif
|
||
|
||
float depth = getDepth( vUv );
|
||
float viewZ = getViewZ( depth );
|
||
if(-viewZ>=cameraFar) return;
|
||
|
||
float clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3];
|
||
vec3 viewPosition=getViewPosition( vUv, depth, clipW );
|
||
|
||
vec2 d0=gl_FragCoord.xy;
|
||
vec2 d1;
|
||
|
||
vec3 viewNormal=getViewNormal( vUv );
|
||
|
||
#ifdef PERSPECTIVE_CAMERA
|
||
vec3 viewIncidentDir=normalize(viewPosition);
|
||
vec3 viewReflectDir=reflect(viewIncidentDir,viewNormal);
|
||
#else
|
||
vec3 viewIncidentDir=vec3(0,0,-1);
|
||
vec3 viewReflectDir=reflect(viewIncidentDir,viewNormal);
|
||
#endif
|
||
|
||
float maxReflectRayLen=maxDistance/dot(-viewIncidentDir,viewNormal);
|
||
// dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html
|
||
// if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta)
|
||
// maxDistance/maxReflectRayLen=cos(theta)
|
||
// maxDistance/maxReflectRayLen==dot(a,b)
|
||
// maxReflectRayLen==maxDistance/dot(a,b)
|
||
|
||
vec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen;
|
||
#ifdef PERSPECTIVE_CAMERA
|
||
if(d1viewPosition.z>-cameraNear){
|
||
//https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx
|
||
float t=(-cameraNear-viewPosition.z)/viewReflectDir.z;
|
||
d1viewPosition=viewPosition+viewReflectDir*t;
|
||
}
|
||
#endif
|
||
d1=viewPositionToXY(d1viewPosition);
|
||
|
||
float totalLen=length(d1-d0);
|
||
float xLen=d1.x-d0.x;
|
||
float yLen=d1.y-d0.y;
|
||
float totalStep=max(abs(xLen),abs(yLen));
|
||
float xSpan=xLen/totalStep;
|
||
float ySpan=yLen/totalStep;
|
||
for(float i=0.;i<float(MAX_STEP);i++){
|
||
if(i>=totalStep) break;
|
||
vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);
|
||
if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;
|
||
float s=length(xy-d0)/totalLen;
|
||
vec2 uv=xy/resolution;
|
||
|
||
float d = getDepth(uv);
|
||
float vZ = getViewZ( d );
|
||
if(-vZ>=cameraFar) continue;
|
||
float cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3];
|
||
vec3 vP=getViewPosition( uv, d, cW );
|
||
|
||
#ifdef PERSPECTIVE_CAMERA
|
||
// https://comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf
|
||
float recipVPZ=1./viewPosition.z;
|
||
float viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ));
|
||
#else
|
||
float viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z);
|
||
#endif
|
||
|
||
// if(viewReflectRayZ>vZ) continue; // will cause "npm run make-screenshot webgl_postprocessing_ssr" high probability hang.
|
||
// https://github.com/mrdoob/three.js/pull/21539#issuecomment-821061164
|
||
if(viewReflectRayZ<=vZ){
|
||
|
||
bool hit;
|
||
#ifdef INFINITE_THICK
|
||
hit=true;
|
||
#else
|
||
float away=pointToLineDistance(vP,viewPosition,d1viewPosition);
|
||
|
||
float minThickness;
|
||
vec2 xyNeighbor=xy;
|
||
xyNeighbor.x+=1.;
|
||
vec2 uvNeighbor=xyNeighbor/resolution;
|
||
vec3 vPNeighbor=getViewPosition(uvNeighbor,d,cW);
|
||
minThickness=vPNeighbor.x-vP.x;
|
||
minThickness*=3.;
|
||
float tk=max(minThickness,thickness);
|
||
|
||
hit=away<=tk;
|
||
#endif
|
||
|
||
if(hit){
|
||
vec3 vN=getViewNormal( uv );
|
||
if(dot(viewReflectDir,vN)>=0.) continue;
|
||
float distance=pointPlaneDistance(vP,viewPosition,viewNormal);
|
||
if(distance>maxDistance) break;
|
||
float op=opacity;
|
||
#ifdef DISTANCE_ATTENUATION
|
||
float ratio=1.-(distance/maxDistance);
|
||
float attenuation=ratio*ratio;
|
||
op=opacity*attenuation;
|
||
#endif
|
||
#ifdef FRESNEL
|
||
float fresnelCoe=(dot(viewIncidentDir,viewReflectDir)+1.)/2.;
|
||
op*=fresnelCoe;
|
||
#endif
|
||
vec4 reflectColor=texture2D(tDiffuse,uv);
|
||
gl_FragColor.xyz=reflectColor.xyz;
|
||
gl_FragColor.a=op;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
`},Ef={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}
|
||
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tDepth;
|
||
|
||
uniform float cameraNear;
|
||
uniform float cameraFar;
|
||
|
||
varying vec2 vUv;
|
||
|
||
#include <packing>
|
||
|
||
float getLinearDepth( const in vec2 uv ) {
|
||
|
||
#if PERSPECTIVE_CAMERA == 1
|
||
|
||
float fragCoordZ = texture2D( tDepth, uv ).x;
|
||
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
|
||
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
|
||
|
||
#else
|
||
|
||
return texture2D( tDepth, uv ).x;
|
||
|
||
#endif
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
float depth = getLinearDepth( vUv );
|
||
float d = 1.0 - depth;
|
||
// d=(d-.999)*1000.;
|
||
gl_FragColor = vec4( vec3( d ), 1.0 );
|
||
|
||
}
|
||
|
||
`},la={uniforms:{tDiffuse:{value:null},resolution:{value:new ae},opacity:{value:.5}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}
|
||
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform vec2 resolution;
|
||
varying vec2 vUv;
|
||
void main() {
|
||
//reverse engineering from PhotoShop blur filter, then change coefficient
|
||
|
||
vec2 texelSize = ( 1.0 / resolution );
|
||
|
||
vec4 c=texture2D(tDiffuse,vUv);
|
||
|
||
vec2 offset;
|
||
|
||
offset=(vec2(-1,0))*texelSize;
|
||
vec4 cl=texture2D(tDiffuse,vUv+offset);
|
||
|
||
offset=(vec2(1,0))*texelSize;
|
||
vec4 cr=texture2D(tDiffuse,vUv+offset);
|
||
|
||
offset=(vec2(0,-1))*texelSize;
|
||
vec4 cb=texture2D(tDiffuse,vUv+offset);
|
||
|
||
offset=(vec2(0,1))*texelSize;
|
||
vec4 ct=texture2D(tDiffuse,vUv+offset);
|
||
|
||
// float coeCenter=.5;
|
||
// float coeSide=.125;
|
||
float coeCenter=.2;
|
||
float coeSide=.2;
|
||
float a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide;
|
||
vec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a;
|
||
gl_FragColor=vec4(rgb,a);
|
||
|
||
}
|
||
`};class vo extends zs{constructor({renderer:e,scene:t,camera:n,width:r,height:s,selects:o,bouncing:l=!1,groundReflector:h}){super(),this.width=r!==void 0?r:512,this.height=s!==void 0?s:512,this.clear=!0,this.renderer=e,this.scene=t,this.camera=n,this.groundReflector=h,this.opacity=$r.uniforms.opacity.value,this.output=0,this.maxDistance=$r.uniforms.maxDistance.value,this.thickness=$r.uniforms.thickness.value,this.tempColor=new Pe,this._selects=o,this.selective=Array.isArray(this._selects),Object.defineProperty(this,"selects",{get(){return this._selects},set(f){this._selects!==f&&(this._selects=f,Array.isArray(f)?(this.selective=!0,this.ssrMaterial.defines.SELECTIVE=!0,this.ssrMaterial.needsUpdate=!0):(this.selective=!1,this.ssrMaterial.defines.SELECTIVE=!1,this.ssrMaterial.needsUpdate=!0))}}),this._bouncing=l,Object.defineProperty(this,"bouncing",{get(){return this._bouncing},set(f){this._bouncing!==f&&(this._bouncing=f,f?this.ssrMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture:this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture)}}),this.blur=!0,this._distanceAttenuation=$r.defines.DISTANCE_ATTENUATION,Object.defineProperty(this,"distanceAttenuation",{get(){return this._distanceAttenuation},set(f){this._distanceAttenuation!==f&&(this._distanceAttenuation=f,this.ssrMaterial.defines.DISTANCE_ATTENUATION=f,this.ssrMaterial.needsUpdate=!0)}}),this._fresnel=$r.defines.FRESNEL,Object.defineProperty(this,"fresnel",{get(){return this._fresnel},set(f){this._fresnel!==f&&(this._fresnel=f,this.ssrMaterial.defines.FRESNEL=f,this.ssrMaterial.needsUpdate=!0)}}),this._infiniteThick=$r.defines.INFINITE_THICK,Object.defineProperty(this,"infiniteThick",{get(){return this._infiniteThick},set(f){this._infiniteThick!==f&&(this._infiniteThick=f,this.ssrMaterial.defines.INFINITE_THICK=f,this.ssrMaterial.needsUpdate=!0)}});const d=new Hm;d.type=pl,d.minFilter=Xt,d.magFilter=Xt,this.beautyRenderTarget=new Yt(this.width,this.height,{minFilter:Xt,magFilter:Xt,depthTexture:d,depthBuffer:!0}),this.prevRenderTarget=new Yt(this.width,this.height,{minFilter:Xt,magFilter:Xt}),this.normalRenderTarget=new Yt(this.width,this.height,{minFilter:Xt,magFilter:Xt,type:Ts}),this.metalnessRenderTarget=new Yt(this.width,this.height,{minFilter:Xt,magFilter:Xt}),this.ssrRenderTarget=new Yt(this.width,this.height,{minFilter:Xt,magFilter:Xt}),this.blurRenderTarget=this.ssrRenderTarget.clone(),this.blurRenderTarget2=this.ssrRenderTarget.clone(),$r===void 0&&console.error("THREE.SSRPass: The pass relies on SSRShader."),this.ssrMaterial=new kt({defines:Object.assign({},$r.defines,{MAX_STEP:Math.sqrt(this.width*this.width+this.height*this.height)}),uniforms:Qn.clone($r.uniforms),vertexShader:$r.vertexShader,fragmentShader:$r.fragmentShader,blending:rn}),this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssrMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssrMaterial.defines.SELECTIVE=this.selective,this.ssrMaterial.needsUpdate=!0,this.ssrMaterial.uniforms.tMetalness.value=this.metalnessRenderTarget.texture,this.ssrMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssrMaterial.uniforms.cameraNear.value=this.camera.near,this.ssrMaterial.uniforms.cameraFar.value=this.camera.far,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.ssrMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new Jm,this.normalMaterial.blending=rn,this.metalnessOnMaterial=new ss({color:"white"}),this.metalnessOffMaterial=new ss({color:"black"}),this.blurMaterial=new kt({defines:Object.assign({},la.defines),uniforms:Qn.clone(la.uniforms),vertexShader:la.vertexShader,fragmentShader:la.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.blurMaterial2=new kt({defines:Object.assign({},la.defines),uniforms:Qn.clone(la.uniforms),vertexShader:la.vertexShader,fragmentShader:la.fragmentShader}),this.blurMaterial2.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.blurMaterial2.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new kt({defines:Object.assign({},Ef.defines),uniforms:Qn.clone(Ef.uniforms),vertexShader:Ef.vertexShader,fragmentShader:Ef.fragmentShader,blending:rn}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new kt({uniforms:Qn.clone(_r.uniforms),vertexShader:_r.vertexShader,fragmentShader:_r.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:$f,blendDst:em,blendEquation:Es,blendSrcAlpha:$f,blendDstAlpha:em,blendEquationAlpha:Es}),this.fsQuad=new Ml(null),this.originalClearColor=new Pe}dispose(){this.beautyRenderTarget.dispose(),this.prevRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.metalnessRenderTarget.dispose(),this.ssrRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.blurRenderTarget2.dispose(),this.normalMaterial.dispose(),this.metalnessOnMaterial.dispose(),this.metalnessOffMaterial.dispose(),this.blurMaterial.dispose(),this.blurMaterial2.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(e,t){switch(e.setRenderTarget(this.beautyRenderTarget),e.clear(),this.groundReflector&&(this.groundReflector.visible=!1,this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.groundReflector.visible=!0),e.render(this.scene,this.camera),this.groundReflector&&(this.groundReflector.visible=!1),this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,0,0),this.selective&&this.renderMetalness(e,this.metalnessOnMaterial,this.metalnessRenderTarget,0,0),this.ssrMaterial.uniforms.opacity.value=this.opacity,this.ssrMaterial.uniforms.maxDistance.value=this.maxDistance,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.renderPass(e,this.ssrMaterial,this.ssrRenderTarget),this.blur&&(this.renderPass(e,this.blurMaterial,this.blurRenderTarget),this.renderPass(e,this.blurMaterial2,this.blurRenderTarget2)),this.output){case vo.OUTPUT.Default:this.bouncing?(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.prevRenderTarget),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=yo,this.renderPass(e,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t)):(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=yo,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t));break;case vo.OUTPUT.SSR:this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t),this.bouncing&&(this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=yo,this.renderPass(e,this.copyMaterial,this.prevRenderTarget));break;case vo.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case vo.OUTPUT.Depth:this.renderPass(e,this.depthRenderMaterial,this.renderToScreen?null:t);break;case vo.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;case vo.OUTPUT.Metalness:this.copyMaterial.uniforms.tDiffuse.value=this.metalnessRenderTarget.texture,this.copyMaterial.blending=rn,this.renderPass(e,this.copyMaterial,this.renderToScreen?null:t);break;default:console.warn("THREE.SSRPass: Unknown output type.")}}renderPass(e,t,n,r,s){this.originalClearColor.copy(e.getClearColor(this.tempColor));const o=e.getClearAlpha(this.tempColor),l=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=l,e.setClearColor(this.originalClearColor),e.setClearAlpha(o)}renderOverride(e,t,n,r,s){this.originalClearColor.copy(e.getClearColor(this.tempColor));const o=e.getClearAlpha(this.tempColor),l=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=l,e.setClearColor(this.originalClearColor),e.setClearAlpha(o)}renderMetalness(e,t,n,r,s){this.originalClearColor.copy(e.getClearColor(this.tempColor));const o=e.getClearAlpha(this.tempColor),l=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.traverseVisible(h=>{h._SSRPassBackupMaterial=h.material,this._selects.includes(h)?h.material=this.metalnessOnMaterial:h.material=this.metalnessOffMaterial}),e.render(this.scene,this.camera),this.scene.traverseVisible(h=>{h.material=h._SSRPassBackupMaterial}),e.autoClear=l,e.setClearColor(this.originalClearColor),e.setClearAlpha(o)}setSize(e,t){this.width=e,this.height=t,this.ssrMaterial.defines.MAX_STEP=Math.sqrt(e*e+t*t),this.ssrMaterial.needsUpdate=!0,this.beautyRenderTarget.setSize(e,t),this.prevRenderTarget.setSize(e,t),this.ssrRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.metalnessRenderTarget.setSize(e,t),this.blurRenderTarget.setSize(e,t),this.blurRenderTarget2.setSize(e,t),this.ssrMaterial.uniforms.resolution.value.set(e,t),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(e,t),this.blurMaterial2.uniforms.resolution.value.set(e,t)}}vo.OUTPUT={Default:0,SSR:1,Beauty:3,Depth:4,Normal:5,Metalness:7};const UT=[!1],Xx=[],FT=i=>{i.userData.ssr||(i.userData.ssr=!0,Xx.push(i),UT[0]=!0)},E_=i=>{i.userData.ssr&&(i.userData.ssr=!1,PE(Xx,i))},qx=new vo({renderer:Sn(),scene:$e,camera:Ze(),width:iv,height:rv,groundReflector:null,selects:Xx});Sn(i=>qx.renderer=i);Ze(i=>qx.camera=i);class pa extends zs{constructor(e,t,n,r){super(),this.renderScene=t,this.renderCamera=n,this.selectedObjects=r!==void 0?r:[],this.visibleEdgeColor=new Pe(1,1,1),this.hiddenEdgeColor=new Pe(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this._visibilityCache=new Map,this.resolution=e!==void 0?new ae(e.x,e.y):new ae(256,256);const s=Math.round(this.resolution.x/this.downSampleRatio),o=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetMaskBuffer=new Yt(this.resolution.x,this.resolution.y),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.depthMaterial=new lu,this.depthMaterial.side=_a,this.depthMaterial.depthPacking=Bm,this.depthMaterial.blending=rn,this.prepareMaskMaterial=this.getPrepareMaskMaterial(),this.prepareMaskMaterial.side=_a,this.prepareMaskMaterial.fragmentShader=f(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.renderTargetDepthBuffer=new Yt(this.resolution.x,this.resolution.y),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new Yt(s,o),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new Yt(s,o),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new Yt(Math.round(s/2),Math.round(o/2)),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new Yt(s,o),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new Yt(Math.round(s/2),Math.round(o/2)),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;const l=4,h=4;this.separableBlurMaterial1=this.getSeperableBlurMaterial(l),this.separableBlurMaterial1.uniforms.texSize.value.set(s,o),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(h),this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(s/2),Math.round(o/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=h,this.overlayMaterial=this.getOverlayMaterial(),_r===void 0&&console.error("THREE.OutlinePass relies on CopyShader");const d=_r;this.copyUniforms=Qn.clone(d.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new kt({uniforms:this.copyUniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,blending:rn,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new Pe,this.oldClearAlpha=1,this.fsQuad=new Ml(null),this.tempPulseColor1=new Pe,this.tempPulseColor2=new Pe,this.textureMatrix=new Qe;function f(g,y){const _=y.isPerspectiveCamera?"perspective":"orthographic";return g.replace(/DEPTH_TO_VIEW_Z/g,_+"DepthToViewZ")}}dispose(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()}setSize(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t);let n=Math.round(e/this.downSampleRatio),r=Math.round(t/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(n,r),this.renderTargetBlurBuffer1.setSize(n,r),this.renderTargetEdgeBuffer1.setSize(n,r),this.separableBlurMaterial1.uniforms.texSize.value.set(n,r),n=Math.round(n/2),r=Math.round(r/2),this.renderTargetBlurBuffer2.setSize(n,r),this.renderTargetEdgeBuffer2.setSize(n,r),this.separableBlurMaterial2.uniforms.texSize.value.set(n,r)}changeVisibilityOfSelectedObjects(e){const t=this._visibilityCache;function n(r){r.isMesh&&(e===!0?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(let r=0;r<this.selectedObjects.length;r++)this.selectedObjects[r].traverse(n)}changeVisibilityOfNonSelectedObjects(e){const t=this._visibilityCache,n=[];function r(o){o.isMesh&&n.push(o)}for(let o=0;o<this.selectedObjects.length;o++)this.selectedObjects[o].traverse(r);function s(o){if(o.isMesh||o.isSprite){let l=!1;for(let h=0;h<n.length;h++)if(n[h].id===o.id){l=!0;break}if(l===!1){const h=o.visible;(e===!1||t.get(o)===!0)&&(o.visible=e),t.set(o,h)}}else(o.isPoints||o.isLine)&&(e===!0?o.visible=t.get(o):(t.set(o,o.visible),o.visible=e))}this.renderScene.traverse(s)}updateTextureMatrix(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}render(e,t,n,r,s){if(this.selectedObjects.length>0){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const o=e.autoClear;e.autoClear=!1,s&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1);const l=this.renderScene.background;if(this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=l,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){const h=.625+Math.cos(performance.now()*.01/this.pulsePeriod)*.75/2;this.tempPulseColor1.multiplyScalar(h),this.tempPulseColor2.multiplyScalar(h)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=pa.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=pa.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=pa.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=pa.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,s&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o}this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}getPrepareMaskMaterial(){return new kt({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new ae(.5,.5)},textureMatrix:{value:null}},vertexShader:`#include <morphtarget_pars_vertex>
|
||
#include <skinning_pars_vertex>
|
||
|
||
varying vec4 projTexCoord;
|
||
varying vec4 vPosition;
|
||
uniform mat4 textureMatrix;
|
||
|
||
void main() {
|
||
|
||
#include <skinbase_vertex>
|
||
#include <begin_vertex>
|
||
#include <morphtarget_vertex>
|
||
#include <skinning_vertex>
|
||
#include <project_vertex>
|
||
|
||
vPosition = mvPosition;
|
||
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
|
||
projTexCoord = textureMatrix * worldPosition;
|
||
|
||
}`,fragmentShader:`#include <packing>
|
||
varying vec4 vPosition;
|
||
varying vec4 projTexCoord;
|
||
uniform sampler2D depthTexture;
|
||
uniform vec2 cameraNearFar;
|
||
|
||
void main() {
|
||
|
||
float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));
|
||
float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );
|
||
float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;
|
||
gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);
|
||
|
||
}`})}getEdgeDetectionMaterial(){return new kt({uniforms:{maskTexture:{value:null},texSize:{value:new ae(.5,.5)},visibleEdgeColor:{value:new z(1,1,1)},hiddenEdgeColor:{value:new z(1,1,1)}},vertexShader:`varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`varying vec2 vUv;
|
||
|
||
uniform sampler2D maskTexture;
|
||
uniform vec2 texSize;
|
||
uniform vec3 visibleEdgeColor;
|
||
uniform vec3 hiddenEdgeColor;
|
||
|
||
void main() {
|
||
vec2 invSize = 1.0 / texSize;
|
||
vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);
|
||
vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);
|
||
vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);
|
||
vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);
|
||
vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);
|
||
float diff1 = (c1.r - c2.r)*0.5;
|
||
float diff2 = (c3.r - c4.r)*0.5;
|
||
float d = length( vec2(diff1, diff2) );
|
||
float a1 = min(c1.g, c2.g);
|
||
float a2 = min(c3.g, c4.g);
|
||
float visibilityFactor = min(a1, a2);
|
||
vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;
|
||
gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);
|
||
}`})}getSeperableBlurMaterial(e){return new kt({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new ae(.5,.5)},direction:{value:new ae(.5,.5)},kernelRadius:{value:1}},vertexShader:`varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`#include <common>
|
||
varying vec2 vUv;
|
||
uniform sampler2D colorTexture;
|
||
uniform vec2 texSize;
|
||
uniform vec2 direction;
|
||
uniform float kernelRadius;
|
||
|
||
float gaussianPdf(in float x, in float sigma) {
|
||
return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
|
||
}
|
||
|
||
void main() {
|
||
vec2 invSize = 1.0 / texSize;
|
||
float weightSum = gaussianPdf(0.0, kernelRadius);
|
||
vec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;
|
||
vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);
|
||
vec2 uvOffset = delta;
|
||
for( int i = 1; i <= MAX_RADIUS; i ++ ) {
|
||
float w = gaussianPdf(uvOffset.x, kernelRadius);
|
||
vec4 sample1 = texture2D( colorTexture, vUv + uvOffset);
|
||
vec4 sample2 = texture2D( colorTexture, vUv - uvOffset);
|
||
diffuseSum += ((sample1 + sample2) * w);
|
||
weightSum += (2.0 * w);
|
||
uvOffset += delta;
|
||
}
|
||
gl_FragColor = diffuseSum/weightSum;
|
||
}`})}getOverlayMaterial(){return new kt({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:`varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`varying vec2 vUv;
|
||
|
||
uniform sampler2D maskTexture;
|
||
uniform sampler2D edgeTexture1;
|
||
uniform sampler2D edgeTexture2;
|
||
uniform sampler2D patternTexture;
|
||
uniform float edgeStrength;
|
||
uniform float edgeGlow;
|
||
uniform bool usePatternTexture;
|
||
|
||
void main() {
|
||
vec4 edgeValue1 = texture2D(edgeTexture1, vUv);
|
||
vec4 edgeValue2 = texture2D(edgeTexture2, vUv);
|
||
vec4 maskColor = texture2D(maskTexture, vUv);
|
||
vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);
|
||
float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;
|
||
vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;
|
||
vec4 finalColor = edgeStrength * maskColor.r * edgeValue;
|
||
if(usePatternTexture)
|
||
finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);
|
||
gl_FragColor = finalColor;
|
||
}`,blending:Qf,depthTest:!1,depthWrite:!1,transparent:!0})}}pa.BlurDirectionX=new ae(1,0);pa.BlurDirectionY=new ae(0,1);const VT=[!1],Yx=[],HT=i=>{i.userData.outline||(i.userData.outline=!0,Yx.push(i),VT[0]=!0)},GT=i=>{i.userData.outline&&(i.userData.outline=!1,PE(Yx,i))},Ps=new pa(new ae,$e,Ze(),Yx);Ze(i=>Ps.renderCamera=i);Kt(()=>{var i;const e=d_(),t=(i=p_())!==null&&i!==void 0?i:e;Ps.visibleEdgeColor=new Pe(e),Ps.hiddenEdgeColor=new Pe(t)},[d_,p_]);Kt(()=>{const i=f_();if(i)return Ps.patternTexture=Gi(i),Ps.usePatternTexture=!0,()=>{Ps.usePatternTexture=!1}},[f_]);bT(i=>Ps.pulsePeriod=i*.001);wT(i=>Ps.edgeStrength=i);ST(i=>Ps.edgeThickness=i);const gU=new WeakMap,hM=new WeakMap,Ey=new WeakMap;class $h extends $_{constructor(e,t){super(),this.mixer=Ma(gU,t,()=>new N2(t)),typeof e=="string"?this.name=e:(this.name=e.name,this.loadClip(e))}retarget(e){const t=this.clip.clone(),n=e.name+".";return t.tracks=t.tracks.filter(r=>r.name.startsWith(n)),new $h(t,e)}dispose(){return super.dispose(),this.stop(),this}get duration(){var e,t;return(t=(e=this.clip)===null||e===void 0?void 0:e.duration)!==null&&t!==void 0?t:0}loadClip(e){this.clip=e,this.action=this.mixer.clipAction(e)}setTracks(e){const t=Object.entries(e).map(([n,r])=>new Wh("."+n,Object.keys(r).map(s=>Number(s)),Object.values(r)));this.clip&&this.mixer.uncacheClip(this.clip),this.loadClip(new e_(this.name,-1,t))}play({crossFade:e=.25,repeat:t=!0,onFinish:n}={}){var r,s;const[o,l]=(r=hM.get(this.mixer))!==null&&r!==void 0?r:[];if(o!=null&&o.isRunning()&&this.action===o){t!==l&&o.setLoop(t?Xy:jy,1/0);return}(s=Ey.get(this.mixer))===null||s===void 0||s.cancel();const h=this.watch(wi(()=>this.mixer.update(Dx[0])));Ey.set(this.mixer,h);const{action:d}=this;if(!d)return;o&&e?(d.time=0,d.enabled=!0,d.crossFadeFrom(o,e,!0)):this.mixer.stopAllAction(),hM.set(this.mixer,[d,t]),d.setLoop(t?Xy:jy,1/0),d.clampWhenFinished=!0;const f=()=>n==null?void 0:n();this.mixer.addEventListener("finished",f),h.then(()=>this.mixer.removeEventListener("finished",f)),d.paused&&d.stop(),d.play()}stop(){var e;this.action&&(this.action.paused=!0),(e=Ey.get(this.mixer))===null||e===void 0||e.cancel()}getPaused(){var e;return(e=this.action)===null||e===void 0?void 0:e.paused}setPaused(e){this.action&&(this.action.paused=e)}update(e){this.mixer.time=0,this.action&&(this.action.time=0),this.mixer.update(e)}}const yU=Mr(i=>{const e=Object.entries(i);let t=0;for(const[,{length:o}]of e)o>t&&(t=o);const r=1e3*.001/t,s={};for(const[o,l]of e)s[o]=Object.fromEntries(l.map((h,d)=>[(d*r).toFixed(2),h]));return s},0,"trailingPromise");class _U extends Bs{get animations(){var e;return(e=this.animationManagers)!==null&&e!==void 0?e:this.animationManagers={}}set animations(e){this.animationManagers=e}createAnimation(e){if(e in this.animations){const n=this.animations[e];if(typeof n!="string")return n}const t=this.watch(new $h(e,this));return this.animations[e]=t,t}buildAnimation(e){yU(e).then(t=>{const n="lingo3d-animation";this.createAnimation(n).setTracks(t),this.playAnimation(n)})}makeAnimationProxy(e){return new Proxy(e,{get:(t,n)=>t[n],set:(t,n,r)=>(t[n]=r,this.buildAnimation(t),!0)})}async playAnimation(e,t){var n;await Promise.resolve(),this.loadingAnims&&(await Promise.all(this.loadingAnims),this.loadingAnims=void 0),!this.done&&(this.animationManager=typeof e=="string"?this.animations[e]:Object.values(this.animations)[e??0],(n=this.animationManager)===null||n===void 0||n.play(t))}stopAnimation(){var e;(e=this.animationManager)===null||e===void 0||e.stop()}get animationPaused(){var e;return!!(!((e=this.animationManager)===null||e===void 0)&&e.getPaused())}set animationPaused(e){(async()=>{var t;await Promise.resolve(),this.loadingAnims&&await Promise.all(this.loadingAnims),!this.done&&((t=this.animationManager)===null||t===void 0||t.setPaused(e))})()}setAnimation(e,t){if(this._animation=e,typeof e=="string"||typeof e=="number"){this.animationName=e,this.playAnimation(e,t);return}if(typeof e=="boolean"){e?this.playAnimation(void 0,t):this.stopAnimation();return}if(!e){this.stopAnimation();return}this._animation=this.makeAnimationProxy(e),this.buildAnimation(e)}get animation(){return this._animation}set animation(e){if(Array.isArray(e)){let t=0;const n={onFinish:()=>{++t>=e.length&&(t=0),this.setAnimation(e[t],n)},repeat:!1};this.setAnimation(e[0],n);return}this.queueMicrotask(()=>this.setAnimation(e))}}const xU=["name","blending","side","vertexColors","opacity","transparent","blendSrc","blendDst","blendEquation","blendSrcAlpha","blendDstAlpha","blendEquationAlpha","depthFunc","depthTest","depthWrite","stencilWriteMask","stencilFunc","stencilRef","stencilFuncMask","stencilFail","stencilZFail","stencilZPass","stencilWrite","clipIntersection","clipShadows","shadowSide","colorWrite","precision","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","dithering","alphaTest","alphaToCoverage","premultipliedAlpha","visible","toneMapped"];var WT=(i,e)=>{for(const r of xU){const s=i[r];s!=null&&(e[r]=s)}const t=i.clippingPlanes;let n=null;if(t){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}e.clippingPlanes=n};const bU=["roughness","metalness","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissiveMap","emissiveIntensity","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","roughnessMap","metalnessMap","alphaMap","envMap","envMapIntensity","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","flatShading","fog"];var jT=(i,e)=>{WT(i,e);for(const t of bU){const n=i[t];n!=null&&(e[t]=n)}e.defines={STANDARD:""},i.color&&e.color.copy(i.color),i.emissive&&e.emissive.copy(i.emissive),i.normalScale&&e.normalScale.copy(i.normalScale)};const wU=["map","gradientMap","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissiveMap","emissiveIntensity","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","alphaMap","wireframe","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","fog"];var SU=(i,e)=>{WT(i,e);for(const t of wU){const n=i[t];n!=null&&(e[t]=n)}i.color&&e.color.copy(i.color),i.emissive&&e.emissive.copy(i.emissive),i.normalScale&&e.normalScale.copy(i.normalScale)};const Ty=new Vx,ah=new Vx,MU=J_(()=>{const i=Ze();fT.setFromProjectionMatrix(Rz.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse))},200,"leading"),XT=new WeakSet,Ac=(i,e,t)=>{var n,r;const s=(n=(r=i.userData)[e])!==null&&n!==void 0?n:r[e]=i.material[e];i.material[e]=t===void 0?s:(s||(XT.has(i.material)?1:0))*t},dM=(i,e,t)=>{var n,r;const s=(n=(r=i.userData)[e])!==null&&n!==void 0?n:r[e]=i.material[e];i.material[e]=t===void 0?s:t};class ov extends Bs{constructor(e){super(e),this.object3d=e}dispose(){return super.dispose(),E_(this.object3d),this}addToRaycastSet(e,t){e.add(this.object3d),t.then(()=>e.delete(this.object3d))}get onClick(){return this._onClick}set onClick(e){var t;(t=this.clickHandle)===null||t===void 0||t.cancel(),this._onClick=e,e&&this.addToRaycastSet(RT,this.clickHandle=new En)}get onMouseDown(){return this._onMouseDown}set onMouseDown(e){var t;(t=this.mouseDownHandle)===null||t===void 0||t.cancel(),this._onMouseDown=e,e&&this.addToRaycastSet(LT,this.mouseDownHandle=new En)}get onMouseUp(){return this._onMouseUp}set onMouseUp(e){var t;(t=this.mouseUpHandle)===null||t===void 0||t.cancel(),this._onMouseUp=e,e&&this.addToRaycastSet(DT,this.mouseUpHandle=new En)}get onMouseOver(){return this._onMouseOver}set onMouseOver(e){var t;(t=this.mouseOverHandle)===null||t===void 0||t.cancel(),this._onMouseOver=e,e&&this.addToRaycastSet(IT,this.mouseOverHandle=new En)}get onMouseOut(){return this._onMouseOut}set onMouseOut(e){var t;(t=this.mouseOutHandle)===null||t===void 0||t.cancel(),this._onMouseOut=e,e&&this.addToRaycastSet(OT,this.mouseOutHandle=new En)}get onMouseMove(){return this._onMouseMove}set onMouseMove(e){var t;(t=this.mouseMoveHandle)===null||t===void 0||t.cancel(),this._onMouseMove=e,e&&this.addToRaycastSet(kT,this.mouseMoveHandle=new En)}get name(){return this.outerObject3d.name}set name(e){this.outerObject3d.name=nn.sanitizeNodeName(e)}getRay(){return dT.set(this.object3d.getWorldPosition(bo),this.object3d.getWorldDirection(Ot))}pointAt(e){return Zh(this.getRay().at(e*Ye,Ot))}rayIntersectsAt(e,t){if(this.done||e.done||this===e)return;ah.set(e.object3d.getWorldPosition(Cz),hT,new Gn().setFromMatrix4(e.object3d.matrixWorld));const n=ah.intersectRay(this.getRay(),Ot);if(n){if(t){const{x:r,y:s,z:o}=this.object3d.getWorldPosition(bo);if(uT(n.x,n.y,n.z,r,s,o)*pn>t)return}return Zh(n)}}rayIntersects(e){return!!this.rayIntersectsAt(e)}intersects(e){return this.done||e.done||this===e?!1:(Ty.set(this.object3d.getWorldPosition(Ot),r_.clone(),new Gn),Ty.applyMatrix4(this.object3d.matrixWorld),ah.set(e.object3d.getWorldPosition(bo),r_.clone(),new Gn),ah.applyMatrix4(e.object3d.matrixWorld),Ty.intersectsOBB(ah,0))}get clientX(){return uM(this.object3d).x}get clientY(){return uM(this.object3d).y}get reflection(){return!!this.object3d.userData.ssr}set reflection(e){e?FT(this.object3d):E_(this.object3d)}get bloom(){return!!this.outerObject3d.userData.bloom}set bloom(e){e?Wx(this.outerObject3d):jx(this.outerObject3d)}get outline(){return!!this.object3d.userData.outline}set outline(e){e?HT(this.object3d):GT(this.object3d)}get visible(){return this._visible!==!1}set visible(e){this._visible=e,this.outerObject3d.visible=e}get frustumCulled(){return this.outerObject3d.frustumCulled}set frustumCulled(e){this.outerObject3d.traverse(t=>t.frustumCulled=e)}refreshFactors(){if(this._refreshFactors){this._refreshFactors.set({});return}this._refreshFactors=new Tn({}),this.createEffect(()=>{const e=new En,{_toon:t,_pbr:n,_metalnessFactor:r,_roughnessFactor:s,_opacityFactor:o}=this;return this.outerObject3d.traverse(l=>{let{material:h}=l;h&&(Array.isArray(h)&&(h=h[0]),t?(l.material=new Sx,SU(h,l.material)):n&&(XT.add(l.material=new wl),jT(h,l.material)),r!==void 0&&r!==0&&Ac(l,"metalness",r),s!==void 0&&s!==1&&Ac(l,"roughness",s),o!==void 0&&o!==1&&(Ac(l,"opacity",o),dM(l,"transparent",o<1)),e.then(()=>{if(l.material===h){Ac(l,"metalness",void 0),Ac(l,"roughness",void 0),Ac(l,"opacity",void 0),dM(l,"transparent",void 0);return}l.material.dispose(),l.material=h}))}),()=>{e.cancel()}},[this._refreshFactors.get])}get metalnessFactor(){var e;return(e=this._metalnessFactor)!==null&&e!==void 0?e:0}set metalnessFactor(e){this._metalnessFactor=e,this.refreshFactors()}get roughnessFactor(){var e;return(e=this._roughnessFactor)!==null&&e!==void 0?e:1}set roughnessFactor(e){this._roughnessFactor=e,this.refreshFactors()}get opacityFactor(){var e;return(e=this._opacityFactor)!==null&&e!==void 0?e:1}set opacityFactor(e){this._opacityFactor=e,this.refreshFactors()}get toon(){var e;return(e=this._toon)!==null&&e!==void 0?e:!1}set toon(e){this._toon=e,this.refreshFactors()}get pbr(){var e;return(e=this._pbr)!==null&&e!==void 0?e:!1}set pbr(e){this._pbr=e,this.refreshFactors()}get frustumVisible(){return MU(),fT.containsPoint(fd(this.object3d))}lookAt(e){var t;"outerObject3d"in e?this.outerObject3d.lookAt(((t=e.object3d)!==null&&t!==void 0?t:e.outerObject3d).getWorldPosition(Ot)):this.outerObject3d.lookAt(Mh(e))}}ks(ov,[_U]);const Tf=new WeakMap;var El=i=>{var e;if(Tf.has(i))return Tf.get(i);const t=((e=i.object3d)!==null&&e!==void 0?e:i.outerObject3d).scale.clone().multiply(i.outerObject3d.scale);return Tf.set(i,t),setTimeout(()=>Tf.delete(i)),t};const[EU,pM]=Ge(void 0);var pu=yl(async()=>{const{World:i,GSSolver:e,SplitSolver:t,NaiveBroadphase:n,Material:r,ContactMaterial:s,Body:o,Vec3:l,Box:h,Sphere:d,Cylinder:f}=await $n(()=>import("./cannon-es.73300c7b.js"),[],import.meta.url),g=new i;mT(S=>g.gravity.set(0,-S,0)),g.quatNormalizeSkip=0,g.quatNormalizeFast=!1;const y=new e;g.defaultContactMaterial.contactEquationStiffness=1e9,g.defaultContactMaterial.contactEquationRelaxation=4,y.iterations=7,y.tolerance=.1,g.solver=new t(y),g.broadphase=new n;const[_]=g.defaultContactMaterial.materials,w=new r("slipperyMaterial");return g.addContactMaterial(new s(w,w,{friction:0,restitution:0})),g.addContactMaterial(new s(w,_,{friction:.001,restitution:0})),EU(g),{world:g,defaultMaterial:_,slipperyMaterial:w,Body:o,Vec3:l,Box:h,Sphere:d,Cylinder:f}});async function qT(){const{Box:i}=await pu();this.cannonBody.addShape(new i(El(this).multiplyScalar(.5)))}class TU extends nv{getMAV(){var e;return(e=this._mAV)!==null&&e!==void 0?e:this._mAV=new Sh(1/0,1/0,1/0)}get maxAngularVelocityX(){var e,t;return(t=(e=this._mAV)===null||e===void 0?void 0:e.x)!==null&&t!==void 0?t:1/0}set maxAngularVelocityX(e){this.getMAV().x=e}get maxAngularVelocityY(){var e,t;return(t=(e=this._mAV)===null||e===void 0?void 0:e.y)!==null&&t!==void 0?t:1/0}set maxAngularVelocityY(e){this.getMAV().y=e}get maxAngularVelocityZ(){var e,t;return(t=(e=this._mAV)===null||e===void 0?void 0:e.z)!==null&&t!==void 0?t:1/0}set maxAngularVelocityZ(e){this.getMAV().z=e}getMV(){var e;return(e=this._mV)!==null&&e!==void 0?e:this._mV=new Sh(1/0,1/0,1/0)}get maxVelocityX(){var e,t;return(t=(e=this._mV)===null||e===void 0?void 0:e.x)!==null&&t!==void 0?t:1/0}set maxVelocityX(e){this.getMV().x=e}get maxVelocityY(){var e,t;return(t=(e=this._mV)===null||e===void 0?void 0:e.y)!==null&&t!==void 0?t:1/0}set maxVelocityY(e){this.getMV().y=e}get maxVelocityZ(){var e,t;return(t=(e=this._mV)===null||e===void 0?void 0:e.z)!==null&&t!==void 0?t:1/0}set maxVelocityZ(e){this.getMV().z=e}physicsRotate(){var e,t;if(!this.physicsUpdate)return;const n=(e=(t=this.physicsUpdate).rotation)!==null&&e!==void 0?e:t.rotation={};n.x=!0,n.y=!0,n.z=!0}physicsMove(){var e,t;if(!this.physicsUpdate)return;const n=(e=(t=this.physicsUpdate).position)!==null&&e!==void 0?e:t.position={};n.x=!0,n.y=!0,n.z=!0}physicsMoveXZ(){var e,t;if(!this.physicsUpdate)return;const n=(e=(t=this.physicsUpdate).position)!==null&&e!==void 0?e:t.position={};n.x=!0,n.z=!0}applyForce(e,t,n){setTimeout(()=>{var r;return(r=this.cannonBody)===null||r===void 0?void 0:r.applyForce({x:e,y:t,z:n})})}applyImpulse(e,t,n){setTimeout(()=>{var r;return(r=this.cannonBody)===null||r===void 0?void 0:r.applyImpulse({x:e,y:t,z:n})})}applyLocalForce(e,t,n){setTimeout(()=>{var r;return(r=this.cannonBody)===null||r===void 0?void 0:r.applyLocalForce({x:e,y:t,z:n})})}applyLocalImpulse(e,t,n){setTimeout(()=>{var r;return(r=this.cannonBody)===null||r===void 0?void 0:r.applyLocalImpulse({x:e,y:t,z:n})})}applyTorque(e,t,n){setTimeout(()=>{var r;return(r=this.cannonBody)===null||r===void 0?void 0:r.applyTorque({x:e,y:t,z:n})})}get velocity(){return this.bvhVelocity?this.bvhVelocity:this.cannonBody?this.cannonBody.velocity:new Sh(0,0,0)}set velocity(e){this.bvhVelocity?Object.assign(this.bvhVelocity,e):this.cannonBody&&Object.assign(this.cannonBody.velocity,e)}refreshCannon(){var e;this.physicsUpdate&&(this.physics=(e=this._physics)!==null&&e!==void 0?e:!1)}get noTumble(){return this._noTumble}set noTumble(e){this._noTumble=e,this.refreshCannon()}get slippery(){return this._slippery}set slippery(e){this._slippery=e,this.refreshCannon()}get mass(){return this._mass}set mass(e){this._mass=e,this.refreshCannon()}get physicsGroup(){return this._physicsGroup}set physicsGroup(e){this._physicsGroup=e,this.refreshCannon()}get ignorePhysicsGroups(){return this._ignorePhysicsGroups}set ignorePhysicsGroups(e){this._ignorePhysicsGroups=e,this.refreshCannon()}get physicsShape(){var e;return(e=this._physicsShape)!==null&&e!==void 0?e:this._physicsShape=qT}set physicsShape(e){this._physicsShape=e,this.refreshCannon()}initPhysics(e,t){if(!(!e||t.done))switch(e){case!0:case"2d":$n(()=>import("./enableCannon.8b778931.js"),["./enableCannon.8b778931.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(n=>n.default.call(this,t));break;case"map":this.bvhMap=!0,$n(()=>import("./enableBVHMap.0cbe0578.js"),["./enableBVHMap.0cbe0578.js","./computeBVH.34667499.js","./useBVHMap.71c1a414.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(n=>n.default.call(this,t,!1));break;case"map-debug":this.bvhMap=!0,$n(()=>import("./enableBVHMap.0cbe0578.js"),["./enableBVHMap.0cbe0578.js","./computeBVH.34667499.js","./useBVHMap.71c1a414.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(n=>n.default.call(this,t,!0));break;case"character":this.bvhCharacter=!0,$n(()=>import("./enableBVHCharacter.4e7bdf3c.js"),["./enableBVHCharacter.4e7bdf3c.js","./useBVHMap.71c1a414.js","./computeBVH.34667499.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(n=>n.default.call(this,t));break;default:z4(e)}}get physics(){var e;return(e=this._physics)!==null&&e!==void 0?e:!1}set physics(e){var t;if(this._physics===e)return;this._physics=e,(t=this.physicsHandle)===null||t===void 0||t.cancel();const n=this.physicsHandle=this.cancellable();this.initPhysics(e,n)}}var fM=new Map;const AU=new Set,gm=new Map,mM=new WeakSet,CU=()=>new WeakSet,PU=1/60;Kt(function(){if($c())return;const i=pM();if(!i)return;const e=wi(()=>{for(const t of AU){const n=t.cannonBody;if("_mAV"in t){const{x:o,y:l,z:h}=t._mAV,{angularVelocity:d}=n;d.x>o?d.x=o:d.x<-o&&(d.x=-o),d.y>l?d.y=l:d.y<-l&&(d.y=-l),d.z>h?d.z=h:d.z<-h&&(d.z=-h)}if("_mV"in t){const{x:o,y:l,z:h}=t._mV,{velocity:d}=n;d.x>o?d.x=o:d.x<-o&&(d.x=-o),d.y>l?d.y=l:d.y<-l&&(d.y=-l),d.z>h?d.z=h:d.z<-h&&(d.z=-h)}const{position:r,rotation:s}=t.physicsUpdate;t.physicsUpdate={},r&&(r.x&&(n.position.x=t.outerObject3d.position.x,n.velocity.x=0,n.force.x=0),r.y&&(n.position.y=t.outerObject3d.position.y,n.velocity.y=0,n.force.y=0),r.z&&(n.position.z=t.outerObject3d.position.z,n.velocity.z=0,n.force.z=0)),t.outerObject3d.position.copy(n.position),s?(s.x&&(n.angularVelocity.x=0,n.torque.x=0),s.y&&(n.angularVelocity.y=0,n.torque.y=0),s.z&&(n.angularVelocity.z=0,n.torque.z=0),n.quaternion.copy(t.outerObject3d.quaternion)):t.outerObject3d.quaternion.copy(n.quaternion)}i.step(PU),gm.clear();for(const t of i.contacts)Ma(gm,t.bi,CU).add(t.bj)});return()=>{e.cancel()}},[pM,$c]);const Lc=new Map,RU=()=>new Set,vM=new WeakMap,gM=(i,e)=>{const t=vM.get(i);if(t)return t;const n=uT(i.x,i.y,i.z,e.x*pn,e.y*pn,e.z*pn);return vM.set(i,n),n};class Sa extends ov{get id(){return this._id}set id(e){this._id!==void 0&&Lc.get(this._id).delete(this),this._id=e,e!==void 0&&Ma(Lc,e,RU).add(this)}getRayIntersectionsAt(e,t){var n;const r=[];for(const s of(n=Lc.get(e))!==null&&n!==void 0?n:[]){if(s===this)continue;const o=this.rayIntersectsAt(s,t);o&&r.push([s,o])}return this.object3d.getWorldPosition(bo),r.sort((s,o)=>gM(s[1],bo)-gM(o[1],bo))}getRayIntersections(e,t){return this.getRayIntersectionsAt(e,t).map(n=>n[0])}listenToRayIntersection(e,t,n){return this.loop(()=>{for(const[r,s]of this.getRayIntersectionsAt(e,n))t(r,s)})}getIntersections(e){var t;const n=[];for(const r of(t=Lc.get(e))!==null&&t!==void 0?t:[])r!==this&&this.intersects(r)&&n.push(r);return n}listenToIntersection(e,t,n){let r=[];return this.loop(()=>{const s=this.getIntersections(e);if(t)for(const o of s)r.includes(o)||t(o);if(n)for(const o of r)s.includes(o)||n(o);r=s})}initIntersect(){this.onIntersectState||(this.onIntersectState=new Tn(void 0),this.onIntersectOutState=new Tn(void 0),this.intersectIdsState=new Tn(void 0),this.createEffect(()=>{const{onIntersect:e,onIntersectOut:t,intersectIds:n}=this;if(!n||!e&&!t)return;const r=[];for(const s of n)r.push(this.listenToIntersection(s,e,t));return()=>{for(const s of r)s.cancel()}},[this.onIntersectState.get,this.onIntersectOutState.get,this.intersectIdsState.get]))}get onIntersect(){var e;return(e=this.onIntersectState)===null||e===void 0?void 0:e.get()}set onIntersect(e){var t;this.initIntersect(),(t=this.onIntersectState)===null||t===void 0||t.set(e)}get onIntersectOut(){var e;return(e=this.onIntersectOutState)===null||e===void 0?void 0:e.get()}set onIntersectOut(e){var t;this.initIntersect(),(t=this.onIntersectOutState)===null||t===void 0||t.set(e)}get intersectIds(){var e;return(e=this.intersectIdsState)===null||e===void 0?void 0:e.get()}set intersectIds(e){var t;this.initIntersect(),(t=this.intersectIdsState)===null||t===void 0||t.set(e)}dispose(){return super.dispose(),this._id!==void 0&&Lc.get(this._id).delete(this),this}intersects(e){var t,n,r,s;return this.done||e.done||this===e?!1:this.bvhMap&&e.bvhCharacter||this.bvhCharacter&&e.bvhMap?((t=fM.get(this))===null||t===void 0?void 0:t.has(e))||((n=fM.get(e))===null||n===void 0?void 0:n.has(this))||!1:this.cannonBody&&e.cannonBody?(mM.add(this.cannonBody),mM.add(e.cannonBody),((r=gm.get(this.cannonBody))===null||r===void 0?void 0:r.has(e.cannonBody))||((s=gm.get(e.cannonBody))===null||s===void 0?void 0:s.has(this.cannonBody))||!1):super.intersects(e)}get width(){return this.object3d.scale.x*pn}set width(e){this.object3d.scale.x=e*Ye}get height(){return this.object3d.scale.y*pn}set height(e){this.object3d.scale.y=e*Ye}get depth(){return this.object3d.scale.z*pn}set depth(e){this.object3d.scale.z=e*Ye}get x(){return this.outerObject3d.position.x*pn}set x(e){var t,n;this.outerObject3d.position.x=e*Ye,this.physicsUpdate&&(((t=(n=this.physicsUpdate).position)!==null&&t!==void 0?t:n.position={}).x=!0)}get y(){return this.outerObject3d.position.y*pn}set y(e){var t,n;this.outerObject3d.position.y=e*Ye,this.physicsUpdate&&(((t=(n=this.physicsUpdate).position)!==null&&t!==void 0?t:n.position={}).y=!0)}get z(){return this.outerObject3d.position.z*pn}set z(e){var t,n;this.outerObject3d.position.z=e*Ye,this.physicsUpdate&&(((t=(n=this.physicsUpdate).position)!==null&&t!==void 0?t:n.position={}).z=!0)}get scaleX(){return this.outerObject3d.scale.x}set scaleX(e){this.outerObject3d.scale.x=e}get scaleY(){return this.outerObject3d.scale.y}set scaleY(e){this.outerObject3d.scale.y=e}get scaleZ(){return this.outerObject3d.scale.z}set scaleZ(e){this.outerObject3d.scale.z=e}get scale(){return this.scaleX}set scale(e){this.scaleX=e,this.scaleY=e,this.scaleZ=e}get rotationX(){return this.outerObject3d.rotation.x*pi}set rotationX(e){var t,n;this.outerObject3d.rotation.x=e*xn,this.physicsUpdate&&(((t=(n=this.physicsUpdate).rotation)!==null&&t!==void 0?t:n.rotation={}).x=!0)}get rotationY(){return this.outerObject3d.rotation.y*pi}set rotationY(e){var t,n,r;this.outerObject3d.rotation.y=e*xn,this.physicsUpdate&&(((t=(r=this.physicsUpdate).rotation)!==null&&t!==void 0?t:r.rotation={}).y=!0),(n=this.onRotationY)===null||n===void 0||n.call(this)}get rotationZ(){return this.outerObject3d.rotation.z*pi}set rotationZ(e){var t,n;this.outerObject3d.rotation.z=e*xn,this.physicsUpdate&&(((t=(n=this.physicsUpdate).rotation)!==null&&t!==void 0?t:n.rotation={}).z=!0)}get rotation(){return this.rotationZ}set rotation(e){this.rotationZ=e}get innerVisible(){return this.object3d.visible}set innerVisible(e){this.object3d.visible=e}lookAt(e){var t;super.lookAt(e),this.physicsRotate(),(t=this.onRotationY)===null||t===void 0||t.call(this)}translateX(e){this.outerObject3d.translateX(e*Ye),this.physicsMove()}translateY(e){this.outerObject3d.translateY(e*Ye),this.physicsMove()}translateZ(e){this.outerObject3d.translateZ(e*Ye),this.physicsMove()}placeAt(e){var t,n;"object3d"in e?(this.outerObject3d.position.copy(fd((t=e.object3d)!==null&&t!==void 0?t:e.outerObject3d)),this.outerObject3d.quaternion.copy(e.outerObject3d.getWorldQuaternion(hm))):this.outerObject3d.position.copy(Mh(e)),this.physicsMove(),this.physicsRotate(),(n=this.onRotationY)===null||n===void 0||n.call(this)}moveForward(e){e!==0&&(Ot.setFromMatrixColumn(this.outerObject3d.matrix,0),Ot.crossVectors(this.outerObject3d.up,Ot),this.outerObject3d.position.addScaledVector(Ot,e*Ye),this.physicsMoveXZ())}moveRight(e){e!==0&&(Ot.setFromMatrixColumn(this.outerObject3d.matrix,0),this.outerObject3d.position.addScaledVector(Ot,e*Ye),this.physicsMoveXZ())}}ks(Sa,[nv,TU]);const LU={animations:Object,animation:[String,Number,Array,Boolean,Object],animationPaused:Boolean},DU={animations:{},animationPaused:!1},YT=bt(Me(Me({},du),LU),{onClick:Function,onMouseDown:Function,onMouseUp:Function,onMouseOver:Function,onMouseOut:Function,onMouseMove:Function,name:String,bloom:Boolean,reflection:Boolean,outline:Boolean,visible:Boolean,frustumCulled:Boolean,metalnessFactor:Number,roughnessFactor:Number,opacityFactor:Number,toon:Boolean,pbr:Boolean}),ZT=bt(Me(Me({},Sl),DU),{name:"",bloom:!1,reflection:!1,outline:!1,visible:!0,frustumCulled:!0,metalnessFactor:0,roughnessFactor:1,opacityFactor:1,toon:!1,pbr:!1}),av={color:String,vertexColors:Boolean,fog:Boolean,opacity:Number,texture:[String,Object],videoTexture:[String,Object],alphaMap:String,textureRepeat:[Object,Number]},lv={color:"#ffffff",vertexColors:!1,fog:!0,opacity:1},Zx={color:String,flatShading:Boolean,wireframe:Boolean,envMap:String,aoMap:String,aoMapIntensity:Number,bumpMap:String,bumpScale:Number,displacementMap:String,displacementScale:Number,displacementBias:Number,emissiveColor:String,emissiveMap:String,emissiveIntensity:Number,lightMap:String,lightMapIntensity:Number,metalnessMap:String,metalness:Number,roughnessMap:String,roughness:Number,normalMap:String,normalScale:[Object,Number],normalMapType:String},Kx={color:"#ffffff",flatShading:!1,wireframe:!1,aoMapIntensity:1,bumpScale:1,displacementScale:1,displacementBias:0,emissiveColor:"#000000",emissiveIntensity:1,lightMapIntensity:1,metalness:0,roughness:1,normalScale:{x:1,y:1}},KT=Me(Me(Me({},YT),av),Zx),ym=Me(Me(Me({},ZT),lv),Kx),JT=[i=>i],IU=["map","alphaMap"],T_=new Map,OU=Mr(function(){for(const[i,e]of T_)for(const t of IU){const n=i.material[t];n&&(n.repeat=e)}T_.clear()},0,"trailing");class cv{get color(){return"#"+this.material.color.getHexString()}set color(e){this.material.color=new Pe(e)}get vertexColors(){return this.material.vertexColors}set vertexColors(e){this.material.vertexColors=e}get fog(){return this.material.fog}set fog(e){this.material.fog=e}get opacity(){var e;return(e=this._opacity)!==null&&e!==void 0?e:this._opacity=1}set opacity(e){var t;this._opacity=e,this.material.opacity=e,this.material.transparent=(t=this.transparent)!==null&&t!==void 0?t:e<1,this.object3d.visible=!!e}basicTextureRepeat(){this.material.needsUpdate=!0,this._textureRepeat&&(T_.set(this,this._textureRepeat),OU())}initTexture(){var e,t;if(this.textureState)return;const n=(e=this.videoTextureState)!==null&&e!==void 0?e:this.videoTextureState=new Tn(void 0),r=(t=this.textureState)!==null&&t!==void 0?t:this.textureState=new Tn(void 0);this.createEffect(()=>{const s=r.get();let o=n.get();if(!o&&(typeof s=="string"&&JT[0](s).toLowerCase().endsWith(".mp4")||s&&s instanceof HTMLVideoElement)&&(o=s),o){let d;o instanceof HTMLVideoElement?d=o:(d=document.createElement("video"),d.crossOrigin="anonymous",d.src=o,d.loop=!0,d.autoplay=!0,d.muted=!0,d.playsInline=!0,d.play());const f=new s2(d);f.wrapS=f.wrapT=Nh;const{material:g}=this,{map:y}=g;return g.map=f,g.needsUpdate=!0,this.basicTextureRepeat(),()=>{d.pause(),f.dispose(),g.map=y,g.needsUpdate=!0}}if(!s)return;const{material:l}=this,{map:h}=l;return l.map=Gi(s),this.basicTextureRepeat(),()=>{l.map=h,this.material.needsUpdate=!0}},[n.get,r.get])}get videoTexture(){var e;return(e=this.videoTextureState)===null||e===void 0?void 0:e.get()}set videoTexture(e){this.initTexture(),this.videoTextureState.set(e)}get texture(){var e;return(e=this.textureState)===null||e===void 0?void 0:e.get()}set texture(e){this.initTexture(),this.textureState.set(e)}get alphaMap(){return this._alphaMap}set alphaMap(e){this._alphaMap=e,this.material.alphaMap=e?Gi(e):null,this.basicTextureRepeat()}get textureRepeat(){return this._textureRepeat}set textureRepeat(e){typeof e=="number"&&(e=new ae(e,e)),this._textureRepeat=e,this.basicTextureRepeat()}}const kU=["map","alphaMap","envMap","aoMap","bumpMap","displacementMap","emissiveMap","lightMap","metalnessMap","roughnessMap","normalMap"],A_=new Map,NU=Mr(function(){for(const[i,e]of A_)for(const t of kU){const n=i.material[t];n&&(n.repeat=e)}A_.clear()},0,"trailing");class Jx{get color(){return"#"+this.material.color.getHexString()}set color(e){this.material.color=new Pe(e)}get flatShading(){return this.material.flatShading}set flatShading(e){this.material.flatShading=e}get wireframe(){return this.material.wireframe}set wireframe(e){this.material.wireframe=e}standardTextureRepeat(){this.material.needsUpdate=!0,this._textureRepeat&&(A_.set(this,this._textureRepeat),NU())}get envMap(){return this._envMap}set envMap(e){this._envMap=e,this.material.envMap=e?Gi(e):null,this.standardTextureRepeat()}get aoMap(){return this._aoMap}set aoMap(e){this._aoMap=e,this.material.aoMap=e?Gi(e):null,this.standardTextureRepeat()}get aoMapIntensity(){return this.material.aoMapIntensity}set aoMapIntensity(e){this.material.aoMapIntensity=e}get bumpMap(){return this._bumpMap}set bumpMap(e){this._bumpMap=e,this.material.bumpMap=e?Gi(e):null,this.standardTextureRepeat()}get bumpScale(){return this.material.bumpScale}set bumpScale(e){this.material.bumpScale=e}get displacementMap(){return this._displacementMap}set displacementMap(e){this._displacementMap=e,this.material.displacementMap=e?Gi(e):null,this.standardTextureRepeat()}get displacementScale(){return this.material.displacementScale}set displacementScale(e){this.material.displacementScale=e}get displacementBias(){return this.material.displacementBias}set displacementBias(e){this.material.displacementBias=e}get emissiveColor(){return"#"+this.material.emissive.getHexString()}set emissiveColor(e){this.material.emissive=new Pe(e)}get emissiveMap(){return this._emissiveMap}set emissiveMap(e){this._emissiveMap=e,this.material.emissiveMap=e?Gi(e):null,this.standardTextureRepeat()}get emissiveIntensity(){return this.material.emissiveIntensity}set emissiveIntensity(e){this.material.emissiveIntensity=e}get lightMap(){return this._lightMap}set lightMap(e){this._lightMap=e,this.material.lightMap=e?Gi(e):null,this.standardTextureRepeat()}get lightMapIntensity(){return this.material.lightMapIntensity}set lightMapIntensity(e){this.material.lightMapIntensity=e}get metalnessMap(){return this._metalnessMap}set metalnessMap(e){this._metalnessMap=e,this.material.metalnessMap=e?Gi(e):null,this.standardTextureRepeat()}get metalness(){return this.material.metalness}set metalness(e){this.material.metalness=e}get roughnessMap(){return this._roughnessMap}set roughnessMap(e){this._roughnessMap=e,this.material.roughnessMap=e?Gi(e):null,this.standardTextureRepeat()}get roughness(){return this.material.roughness}set roughness(e){this.material.roughness=e}get normalMap(){return this._normalMap}set normalMap(e){this._normalMap=e,this.material.normalMap=e?Gi(e):null,this.standardTextureRepeat()}get normalScale(){return this.material.normalScale}set normalScale(e){typeof e=="number"?this.material.normalScale=new ae(e,e):this.material.normalScale=e}get normalMapType(){return this._normalMapType}set normalMapType(e){this._normalMapType=e,this.material.normalMapType=e==="objectSpace"?FE:_l}}class tu extends ov{constructor(e){var t;super(e),this.material=(t=e.material)!==null&&t!==void 0?t:e.material=new wl,Li.delete(this)}retargetAnimations(){var e;if(!((e=this.model)===null||e===void 0)&&e.animationManagers){for(const t of Object.values(this.model.animationManagers))this.animations[t.name]=this.watch(t.retarget(this.object3d));this.model=void 0}}get animation(){return super.animation}set animation(e){this.retargetAnimations(),super.animation=e}dispose(){return super.dispose(),this.material.dispose(),this}addToRaycastSet(e,t){this.managerSet||(this.managerSet=!0,this.object3d.traverse(n=>n.userData.manager=this)),e.add(this.object3d),t.then(()=>e.delete(this.object3d))}}tu.componentName="find";tu.defaults=ym;tu.schema=KT;ks(tu,[Jx,cv]);class To extends Sa{constructor(e){super(e);const t=this.outerObject3d=new ei;t.userData.manager=this,$e.add(t),t.add(e)}get innerRotationX(){return this.object3d.rotation.x*pi}set innerRotationX(e){this.object3d.rotation.x=e*xn}get innerRotationY(){return this.object3d.rotation.y*pi}set innerRotationY(e){this.object3d.rotation.y=e*xn}get innerRotationZ(){return this.object3d.rotation.z*pi}set innerRotationZ(e){this.object3d.rotation.z=e*xn}get innerRotation(){return this.innerRotationZ}set innerRotation(e){this.innerRotationZ=e}get innerX(){return this.object3d.position.x*pn}set innerX(e){this.object3d.position.x=e*Ye}get innerY(){return this.object3d.position.y*pn}set innerY(e){this.object3d.position.y=e*Ye}get innerZ(){return this.object3d.position.z*pn}set innerZ(e){this.object3d.position.z=e*Ye}find(e,t){var n,r;const s=this.outerObject3d.getObjectByName(nn.sanitizeNodeName(e));if(!s)return;const o=(n=(r=s.userData).manager)!==null&&n!==void 0?n:r.manager=new tu(s);return!t&&this._append(o),o}findAll(e){const t=[];return this.outerObject3d.traverse(n=>{var r,s;n.name===e&&t.push((r=(s=n.userData).manager)!==null&&r!==void 0?r:s.manager=new tu(n))}),t}}const BU={maxAngularVelocityX:Number,maxAngularVelocityY:Number,maxAngularVelocityZ:Number,maxVelocityX:Number,maxVelocityY:Number,maxVelocityZ:Number,velocity:Object,noTumble:Boolean,slippery:Boolean,mass:Number,physicsGroup:Number,ignorePhysicsGroups:Array,physics:[String,Boolean],physicsShape:Function},zU={maxAngularVelocityX:1/0,maxAngularVelocityY:1/0,maxAngularVelocityZ:1/0,maxVelocityX:1/0,maxVelocityY:1/0,maxVelocityZ:1/0,velocity:{x:0,y:0,z:0},physics:!1,physicsShape:qT},Qx=bt(Me({},du),{x:Number,y:Number,z:Number}),$x=bt(Me({},Sl),{x:0,y:0,z:0}),UU=bt(Me(Me(Me({},YT),Qx),BU),{onIntersect:Function,onIntersectOut:Function,id:String,intersectIds:Array,width:Number,height:Number,depth:Number,scaleX:Number,scaleY:Number,scaleZ:Number,scale:Number,rotationX:Number,rotationY:Number,rotationZ:Number,rotation:Number,innerVisible:Boolean}),FU=bt(Me(Me(Me({},ZT),$x),zU),{width:100,height:100,depth:100,scaleX:1,scaleY:1,scaleZ:1,scale:1,rotationX:0,rotationY:0,rotationZ:0,rotation:0,innerVisible:!0}),Tl=bt(Me({},UU),{innerRotationX:Number,innerRotationY:Number,innerRotationZ:Number,innerRotation:Number,innerX:Number,innerY:Number,innerZ:Number}),fu=bt(Me({},FU),{innerRotationX:0,innerRotationY:0,innerRotationZ:0,innerRotation:0,innerX:0,innerY:0,innerZ:0}),uv=Me(Me(Me({},Tl),av),Zx),hv=Me(Me(Me({},fu),lv),Kx);class Br extends To{constructor(e,t){const n=new wl(t?{transparent:!0}:void 0),r=new In(e,n);super(r),this.material=n,this.transparent=t}dispose(){return super.dispose(),this.material.dispose(),this}}Br.defaults=hv;Br.schema=uv;ks(Br,[Jx,cv]);const QT=new bl(br,br,br,1,1,1);class dv extends Br{constructor(){super(QT)}}dv.componentName="cube";class pv extends To{constructor(){super(new In(QT,pT)),this.loadedGroup=new ei,this.loadedResolvable=new Fc,this.outerObject3d.add(this.loadedGroup)}get src(){return this._src}set src(e){this._src!==e&&(this._src=e,e&&(this.loadedResolvable.done&&(this.loadedResolvable=new Fc,this.loadedGroup.clear()),this.load(e).then(t=>{this.done||this._src!==e||(this.object3d.visible=!!this._boxVisible,this.resolveLoaded(t))})))}get onLoad(){return this._onLoad}set onLoad(e){var t;this._onLoad=e,(t=this.loadedHandle)===null||t===void 0||t.cancel(),e&&(this.loadedHandle=this.loadedResolvable.then(e))}get width(){return super.width}set width(e){super.width=e,this.widthSet=!0}get height(){return super.height}set height(e){super.height=e,this.heightSet=!0}get depth(){return super.depth}set depth(e){super.depth=e,this.depthSet=!0}get innerRotationX(){return super.innerRotationX}set innerRotationX(e){super.innerRotationX=e,this.loadedGroup.rotation.x=this.object3d.rotation.x}get innerRotationY(){return super.innerRotationY}set innerRotationY(e){super.innerRotationY=e,this.loadedGroup.rotation.y=this.object3d.rotation.y}get innerRotationZ(){return super.innerRotationZ}set innerRotationZ(e){super.innerRotationZ=e,this.loadedGroup.rotation.z=this.object3d.rotation.z}get innerX(){return super.innerX}set innerX(e){super.innerX=e,this.loadedGroup.position.x=this.object3d.position.x}get innerY(){return super.innerY}set innerY(e){super.innerY=e,this.loadedGroup.position.y=this.object3d.position.y}get innerZ(){return super.innerZ}set innerZ(e){super.innerZ=e,this.loadedGroup.position.z=this.object3d.position.z}get innerVisible(){return this.loadedGroup.visible}set innerVisible(e){this.loadedGroup.visible=e}get frustumCulled(){return this.outerObject3d.frustumCulled}set frustumCulled(e){this.outerObject3d.frustumCulled!==e&&(this.outerObject3d.frustumCulled=e,this.loadedResolvable.then(()=>super.frustumCulled=e))}get physics(){var e;return(e=this._physics)!==null&&e!==void 0?e:!1}set physics(e){var t;if(this._physics===e)return;this._physics=e,(t=this.physicsHandle)===null||t===void 0||t.cancel();const n=this.physicsHandle=this.cancellable();this.loadedResolvable.then(()=>this.initPhysics(e,n))}get boxVisible(){var e;return(e=this._boxVisible)!==null&&e!==void 0?e:this.object3d.visible}set boxVisible(e){this._boxVisible=e,this.object3d.visible=e}get outline(){return!!this._outline}set outline(e){var t;this._outline!==e&&(this._outline=e,(t=this._outlineHandle)===null||t===void 0||t.cancel(),this._outlineHandle=this.loadedResolvable.then(n=>{e?HT(n):GT(n)}))}get bloom(){return!!this._bloom}set bloom(e){var t;this._bloom!==e&&(this._bloom=e,(t=this._bloomHandle)===null||t===void 0||t.cancel(),this._bloomHandle=this.loadedResolvable.then(n=>{e?Wx(n):jx(n)}))}get reflection(){return!!this._reflection}set reflection(e){var t;this._reflection!==e&&(this._reflection=e,(t=this._reflectionHandle)===null||t===void 0||t.cancel(),this._reflectionHandle=this.loadedResolvable.then(n=>{e?FT(n):E_(n)}))}addToRaycastSet(e,t){t.watch(this.loadedResolvable.then(n=>{this.managerSet||(this.managerSet=!0,n.traverse(r=>{var s,o;return(s=(o=r.userData).manager)!==null&&s!==void 0?s:o.manager=this})),e.add(n),t.then(()=>e.delete(n))}))}refreshFactors(){this.loadedResolvable.then(()=>super.refreshFactors())}}function VU(i){const e=new Map,t=new Map,n=i.clone();return $T(i,n,function(r,s){e.set(s,r),t.set(r,s)}),n.traverse(function(r){if(!r.isSkinnedMesh)return;const s=r,o=e.get(r),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map(function(h){return t.get(h)}),s.bind(s.skeleton,s.bindMatrix)}),n}function $T(i,e,t){t(i,e);for(let n=0;n<i.children.length;n++)$T(i.children[n],e.children[n],t)}const eA=new WeakSet;var b9=(i,e,t=i.animations)=>{const n=e?i.clone():VU(i);return!e&&eA.add(n),n.animations=t,n};Kt(()=>{const i=vi();if(!(i instanceof pv)||Ze()!==bn)return;const e=i.loadedGroup.children[0];if(!eA.has(e))return;const t=new z2(e);return $e.add(t),()=>{$e.remove(t)}},[vi,Ze]);const[w9,HU]=Ge(!0),yM={type:"change"},Ay={type:"start"},_M={type:"end"};class GU extends Ea{constructor(e,t){super(),t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new z,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:oc.ROTATE,MIDDLE:oc.DOLLY,RIGHT:oc.PAN},this.touches={ONE:ac.ROTATE,TWO:ac.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(U){U.addEventListener("keydown",yt),this._domElementKeyEvents=U},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(yM),n.update(),s=r.NONE},this.update=function(){const U=new z,Ee=new ai().setFromUnitVectors(e.up,new z(0,1,0)),Je=Ee.clone().invert(),ke=new z,X=new ai,Re=2*Math.PI;return function(){const at=n.object.position;U.copy(at).sub(n.target),U.applyQuaternion(Ee),l.setFromVector3(U),n.autoRotate&&s===r.NONE&&k(F()),n.enableDamping?(l.theta+=h.theta*n.dampingFactor,l.phi+=h.phi*n.dampingFactor):(l.theta+=h.theta,l.phi+=h.phi);let ze=n.minAzimuthAngle,et=n.maxAzimuthAngle;return isFinite(ze)&&isFinite(et)&&(ze<-Math.PI?ze+=Re:ze>Math.PI&&(ze-=Re),et<-Math.PI?et+=Re:et>Math.PI&&(et-=Re),ze<=et?l.theta=Math.max(ze,Math.min(et,l.theta)):l.theta=l.theta>(ze+et)/2?Math.max(ze,l.theta):Math.min(et,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=d,l.radius=Math.max(n.minDistance,Math.min(n.maxDistance,l.radius)),n.enableDamping===!0?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),U.setFromSpherical(l),U.applyQuaternion(Je),at.copy(n.target).add(U),n.object.lookAt(n.target),n.enableDamping===!0?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(h.set(0,0,0),f.set(0,0,0)),d=1,g||ke.distanceToSquared(n.object.position)>o||8*(1-X.dot(n.object.quaternion))>o?(n.dispatchEvent(yM),ke.copy(n.object.position),X.copy(n.object.quaternion),g=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",he),n.domElement.removeEventListener("pointerdown",Ae),n.domElement.removeEventListener("pointercancel",rt),n.domElement.removeEventListener("wheel",Ft),n.domElement.removeEventListener("pointermove",We),n.domElement.removeEventListener("pointerup",Be),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",yt)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,l=new zS,h=new zS;let d=1;const f=new z;let g=!1;const y=new ae,_=new ae,w=new ae,S=new ae,b=new ae,T=new ae,E=new ae,C=new ae,A=new ae,D=[],I={};function F(){return 2*Math.PI/60/60*n.autoRotateSpeed}function P(){return Math.pow(.95,n.zoomSpeed)}function k(U){h.theta-=U}function j(U){h.phi-=U}const G=function(){const U=new z;return function(Je,ke){U.setFromMatrixColumn(ke,0),U.multiplyScalar(-Je),f.add(U)}}(),ne=function(){const U=new z;return function(Je,ke){n.screenSpacePanning===!0?U.setFromMatrixColumn(ke,1):(U.setFromMatrixColumn(ke,0),U.crossVectors(n.object.up,U)),U.multiplyScalar(Je),f.add(U)}}(),ce=function(){const U=new z;return function(Je,ke){const X=n.domElement;if(n.object.isPerspectiveCamera){const Re=n.object.position;U.copy(Re).sub(n.target);let De=U.length();De*=Math.tan(n.object.fov/2*Math.PI/180),G(2*Je*De/X.clientHeight,n.object.matrix),ne(2*ke*De/X.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(G(Je*(n.object.right-n.object.left)/n.object.zoom/X.clientWidth,n.object.matrix),ne(ke*(n.object.top-n.object.bottom)/n.object.zoom/X.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Z(U){n.object.isPerspectiveCamera?d/=U:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*U)),n.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function $(U){n.object.isPerspectiveCamera?d*=U:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/U)),n.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function K(U){y.set(U.clientX,U.clientY)}function pe(U){E.set(U.clientX,U.clientY)}function re(U){S.set(U.clientX,U.clientY)}function se(U){_.set(U.clientX,U.clientY),w.subVectors(_,y).multiplyScalar(n.rotateSpeed);const Ee=n.domElement;k(2*Math.PI*w.x/Ee.clientHeight),j(2*Math.PI*w.y/Ee.clientHeight),y.copy(_),n.update()}function ue(U){C.set(U.clientX,U.clientY),A.subVectors(C,E),A.y>0?Z(P()):A.y<0&&$(P()),E.copy(C),n.update()}function Te(U){b.set(U.clientX,U.clientY),T.subVectors(b,S).multiplyScalar(n.panSpeed),ce(T.x,T.y),S.copy(b),n.update()}function fe(U){U.deltaY<0?$(P()):U.deltaY>0&&Z(P()),n.update()}function Ce(U){let Ee=!1;switch(U.code){case n.keys.UP:ce(0,n.keyPanSpeed),Ee=!0;break;case n.keys.BOTTOM:ce(0,-n.keyPanSpeed),Ee=!0;break;case n.keys.LEFT:ce(n.keyPanSpeed,0),Ee=!0;break;case n.keys.RIGHT:ce(-n.keyPanSpeed,0),Ee=!0;break}Ee&&(U.preventDefault(),n.update())}function qe(){if(D.length===1)y.set(D[0].pageX,D[0].pageY);else{const U=.5*(D[0].pageX+D[1].pageX),Ee=.5*(D[0].pageY+D[1].pageY);y.set(U,Ee)}}function Ke(){if(D.length===1)S.set(D[0].pageX,D[0].pageY);else{const U=.5*(D[0].pageX+D[1].pageX),Ee=.5*(D[0].pageY+D[1].pageY);S.set(U,Ee)}}function me(){const U=D[0].pageX-D[1].pageX,Ee=D[0].pageY-D[1].pageY,Je=Math.sqrt(U*U+Ee*Ee);E.set(0,Je)}function Ut(){n.enableZoom&&me(),n.enablePan&&Ke()}function nt(){n.enableZoom&&me(),n.enableRotate&&qe()}function it(U){if(D.length==1)_.set(U.pageX,U.pageY);else{const Je=Xe(U),ke=.5*(U.pageX+Je.x),X=.5*(U.pageY+Je.y);_.set(ke,X)}w.subVectors(_,y).multiplyScalar(n.rotateSpeed);const Ee=n.domElement;k(2*Math.PI*w.x/Ee.clientHeight),j(2*Math.PI*w.y/Ee.clientHeight),y.copy(_)}function Le(U){if(D.length===1)b.set(U.pageX,U.pageY);else{const Ee=Xe(U),Je=.5*(U.pageX+Ee.x),ke=.5*(U.pageY+Ee.y);b.set(Je,ke)}T.subVectors(b,S).multiplyScalar(n.panSpeed),ce(T.x,T.y),S.copy(b)}function vt(U){const Ee=Xe(U),Je=U.pageX-Ee.x,ke=U.pageY-Ee.y,X=Math.sqrt(Je*Je+ke*ke);C.set(0,X),A.set(0,Math.pow(C.y/E.y,n.zoomSpeed)),Z(A.y),E.copy(C)}function ve(U){n.enableZoom&&vt(U),n.enablePan&&Le(U)}function xe(U){n.enableZoom&&vt(U),n.enableRotate&&it(U)}function Ae(U){n.enabled!==!1&&(D.length===0&&(n.domElement.setPointerCapture(U.pointerId),n.domElement.addEventListener("pointermove",We),n.domElement.addEventListener("pointerup",Be)),we(U),U.pointerType==="touch"?H(U):ot(U))}function We(U){n.enabled!==!1&&(U.pointerType==="touch"?B(U):st(U))}function Be(U){Ne(U),D.length===0&&(n.domElement.releasePointerCapture(U.pointerId),n.domElement.removeEventListener("pointermove",We),n.domElement.removeEventListener("pointerup",Be)),n.dispatchEvent(_M),s=r.NONE}function rt(U){Ne(U)}function ot(U){let Ee;switch(U.button){case 0:Ee=n.mouseButtons.LEFT;break;case 1:Ee=n.mouseButtons.MIDDLE;break;case 2:Ee=n.mouseButtons.RIGHT;break;default:Ee=-1}switch(Ee){case oc.DOLLY:if(n.enableZoom===!1)return;pe(U),s=r.DOLLY;break;case oc.ROTATE:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enablePan===!1)return;re(U),s=r.PAN}else{if(n.enableRotate===!1)return;K(U),s=r.ROTATE}break;case oc.PAN:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enableRotate===!1)return;K(U),s=r.ROTATE}else{if(n.enablePan===!1)return;re(U),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ay)}function st(U){if(n.enabled!==!1)switch(s){case r.ROTATE:if(n.enableRotate===!1)return;se(U);break;case r.DOLLY:if(n.enableZoom===!1)return;ue(U);break;case r.PAN:if(n.enablePan===!1)return;Te(U);break}}function Ft(U){n.enabled===!1||n.enableZoom===!1||s!==r.NONE||(U.preventDefault(),n.dispatchEvent(Ay),fe(U),n.dispatchEvent(_M))}function yt(U){n.enabled===!1||n.enablePan===!1||Ce(U)}function H(U){switch(Ue(U),D.length){case 1:switch(n.touches.ONE){case ac.ROTATE:if(n.enableRotate===!1)return;qe(),s=r.TOUCH_ROTATE;break;case ac.PAN:if(n.enablePan===!1)return;Ke(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(n.touches.TWO){case ac.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ut(),s=r.TOUCH_DOLLY_PAN;break;case ac.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nt(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&n.dispatchEvent(Ay)}function B(U){switch(Ue(U),s){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;it(U),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;Le(U),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;ve(U),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(U),n.update();break;default:s=r.NONE}}function he(U){n.enabled!==!1&&U.preventDefault()}function we(U){D.push(U)}function Ne(U){delete I[U.pointerId];for(let Ee=0;Ee<D.length;Ee++)if(D[Ee].pointerId==U.pointerId){D.splice(Ee,1);return}}function Ue(U){let Ee=I[U.pointerId];Ee===void 0&&(Ee=new ae,I[U.pointerId]=Ee),Ee.set(U.pageX,U.pageY)}function Xe(U){const Ee=U.pointerId===D[0].pointerId?D[1]:D[0];return I[Ee.pointerId]}n.domElement.addEventListener("contextmenu",he),n.domElement.addEventListener("pointerdown",Ae),n.domElement.addEventListener("pointercancel",rt),n.domElement.addEventListener("wheel",Ft,{passive:!1}),this.update()}}const fv=!1,[tA,xM]=Ge(fv);Ze(i=>{var e;return tA((e=i.userData.bokeh)!==null&&e!==void 0?e:fv)});const mv=.025,[nA,WU]=Ge(mv);Ze(i=>{var e;return nA((e=i.userData.bokehAperture)!==null&&e!==void 0?e:mv)});const vv=1,[iA,jU]=Ge(vv);Ze(i=>{var e;return iA((e=i.userData.bokehFocus)!==null&&e!==void 0?e:vv)});const gv=.01,[rA,XU]=Ge(gv);Ze(i=>{var e;return rA((e=i.userData.bokehMaxBlur)!==null&&e!==void 0?e:gv)});const[eb,tb]=Ge([]),qU=Im(eb,tb),YU=Om(eb,tb),sA=Me(Me({},Tl),av),oA=bt(Me(Me({},fu),lv),{scaleZ:0,depth:0});class Al extends To{constructor(){const e=new ud({transparent:!0});super(new ux(e)),this.material=e}dispose(){return super.dispose(),this.material.dispose(),this}get depth(){return 0}set depth(e){}get scaleZ(){return 0}set scaleZ(e){}}Al.componentName="sprite";Al.defaults=oA;Al.schema=sA;ks(Al,[cv]);var ZU=()=>{const i=new Al;return i.texture="data:image/png;base64,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",Li.delete(i),i.scale=.5,i};class aA extends Bs{initCamera(){qU(this.camera),this.then(()=>{this.active&&hl(bn),YU(this.camera)}),this.createEffect(()=>{if(Ze()!==bn||Ze()===this.camera)return;const e=new nz(this.camera);$e.add(e);const t=ZU();e.add(t.outerObject3d);const n=vd(({target:r})=>{r===t&&Di(this)});return()=>{e.dispose(),$e.remove(e),t.dispose(),n.cancel()}},[Ze])}get fov(){return this.camera.fov}set fov(e){var t,n;this.camera.fov=e,(n=(t=this.camera).updateProjectionMatrix)===null||n===void 0||n.call(t)}get zoom(){return this.camera.zoom}set zoom(e){var t,n;this.camera.zoom=e,(n=(t=this.camera).updateProjectionMatrix)===null||n===void 0||n.call(t)}get near(){return this.camera.near}set near(e){var t,n;this.camera.near=e,(n=(t=this.camera).updateProjectionMatrix)===null||n===void 0||n.call(t)}get far(){return this.camera.far}set far(e){var t,n;this.camera.far=e,(n=(t=this.camera).updateProjectionMatrix)===null||n===void 0||n.call(t)}activate(){hl(this.camera)}get active(){return Ze()===this.camera}set active(e){e&&this.activate()}get bokeh(){var e;return(e=this.camera.userData.bokeh)!==null&&e!==void 0?e:fv}set bokeh(e){Ze()===this.camera&&tA(e),this.camera.userData.bokeh=e}get bokehFocus(){var e;return(e=this.camera.userData.bokehFocus)!==null&&e!==void 0?e:vv}set bokehFocus(e){Ze()===this.camera&&iA(e),this.camera.userData.bokehFocus=e}get bokehMaxBlur(){var e;return(e=this.camera.userData.bokehMaxBlur)!==null&&e!==void 0?e:gv}set bokehMaxBlur(e){Ze()===this.camera&&rA(e),this.camera.userData.bokehMaxBlur=e}get bokehAperture(){var e;return(e=this.camera.userData.bokehAperture)!==null&&e!==void 0?e:mv}set bokehAperture(e){Ze()===this.camera&&nA(e),this.camera.userData.bokehAperture=e}}const lA={fov:Number,zoom:Number,near:Number,far:Number,active:Boolean,bokeh:Boolean,bokehFocus:Number,bokehMaxBlur:Number,bokehAperture:Number,minPolarAngle:Number,maxPolarAngle:Number},cA={fov:75,zoom:1,near:Qm,far:$m,active:!1,bokeh:fv,bokehFocus:vv,bokehMaxBlur:gv,bokehAperture:mv,minPolarAngle:Bx,maxPolarAngle:zx},uA=bt(Me(Me({},Qx),lA),{targetX:Number,targetY:Number,targetZ:Number,enableDamping:Boolean,enablePan:Boolean,enableZoom:Boolean,autoRotate:Boolean,autoRotateSpeed:Number,minAzimuthAngle:Number,maxAzimuthAngle:Number,azimuthAngle:Number,polarAngle:Number}),hA=bt(Me(Me({},$x),cA),{targetX:0,targetY:0,targetZ:0,z:500,enableDamping:!1,enablePan:!1,enableZoom:!1,autoRotate:!1,autoRotateSpeed:2,minAzimuthAngle:-1/0,maxAzimuthAngle:1/0,azimuthAngle:0,polarAngle:0}),[yd,yv]=Er();window.addEventListener("blur",()=>yd());window.addEventListener("focus",()=>yd());document.addEventListener("visibilitychange",()=>yd());const Eh=new Set;yv(()=>Eh.clear());let C_=!1;document.addEventListener("keydown",i=>{(i.key==="Shift"||i.key==="Meta")&&Eh.add(i.key),Eh.has("Meta")&&Eh.has("Shift")&&(yd(),C_=!0)});document.addEventListener("keyup",i=>{(i.key==="Shift"||i.key==="Meta")&&Eh.delete(i.key)});document.addEventListener("mousedown",()=>{C_&&(C_=!1,yd())});class Cl extends nv{constructor(e=new fi(75,1,Qm,$m)){super(e),this.camera=e,this.updateDebounced=Mr(()=>this.controls.update(),0,"trailing"),this.targetState=new Tn(void 0),this.enableZoomState=new Tn(!1),this.enableFlyState=new Tn(!1),this.enabledState=new Tn(!0),this._minPolarAngle=Bx*xn,this._maxPolarAngle=zx*xn,this._minAzimuthAngle=-1/0,this._maxAzimuthAngle=1/0,$e.add(e),this.initCamera(),this.createEffect(()=>{const n=this.targetState.get();if(!n)return;this.controls.target=n.outerObject3d.position;const r=tv(()=>n.parent!==this&&this.targetState.set(void 0));return()=>{this.controls.target=new z,r.cancel()}},[this.targetState.get]);const t=this.controls=new GU(e,wn);t.enabled=!1,t.enablePan=!1,t.enableZoom=!1,t.minPolarAngle=this._minPolarAngle,t.maxPolarAngle=this._maxPolarAngle,t.minAzimuthAngle=this._minAzimuthAngle,t.maxAzimuthAngle=this._maxAzimuthAngle,e.position.z=5,this.updateDebounced(),this.createEffect(()=>{if(So()||Ze()!==e||!this.enabledState.get())return;t.enabled=!0;const n=wi(this.updateDebounced);if(this.enableZoomState.get()){const r=s=>{s.preventDefault();const o=e.getWorldDirection(Ot);let l=e.position.clone().add(o.clone().multiplyScalar(-s.deltaY*Ye));const h=e.worldToLocal(l.clone()),d=e.worldToLocal(t.target.clone());h.z-d.z<=1&&(l=t.target.clone().add(o.multiplyScalar(-1))),e.position.copy(l),this.updateDebounced()};wn.addEventListener("wheel",r),n.then(()=>wn.removeEventListener("wheel",r))}if(this.enableFlyState.get()){const r=new Set,s=f=>{const g=e.getWorldDirection(Ot);e.position.add(g.clone().multiplyScalar(f*Ye)),this.controls.target.copy(e.position).add(g),this.updateDebounced()},o=f=>{Ot.setFromMatrixColumn(this.outerObject3d.matrix,0),e.position.addScaledVector(Ot,f*Ye),this.controls.target.addScaledVector(Ot,f*Ye),this.updateDebounced()},l=f=>{const g=f*Ye;e.position.y+=g,this.controls.target.y+=g,this.updateDebounced()};n.watch(wi(()=>{r.has("w")?s(r.has("Shift")?50:10):r.has("s")&&s(r.has("Shift")?-50:-10),r.has("a")?o(-10):r.has("d")&&o(10),r.has("ArrowDown")?l(-10):r.has("ArrowUp")&&l(10)}));const h=f=>{r.add(f.key.length===1?f.key.toLocaleLowerCase():f.key)},d=f=>{r.delete(f.key.length===1?f.key.toLowerCase():f.key)};document.addEventListener("keydown",h),document.addEventListener("keyup",d),n.watch(yv(()=>r.clear())),n.then(()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",d)})}return()=>{t.enabled=!1,n.cancel()}},[Ze,So,this.enableZoomState.get,this.enableFlyState.get,this.enabledState.get]),this.then(()=>t.dispose())}get targetX(){var e;return(e=this._targetX)!==null&&e!==void 0?e:this._targetX=0}set targetX(e){this._targetX=e,this.controls.target.x=e*Ye}get targetY(){var e;return(e=this._targetY)!==null&&e!==void 0?e:this._targetY=0}set targetY(e){this._targetY=e,this.controls.target.y=e*Ye}get targetZ(){var e;return(e=this._targetZ)!==null&&e!==void 0?e:this._targetZ=0}set targetZ(e){this._targetZ=e,this.controls.target.z=e*Ye}append(e){var t;if(this.targetState.get()){super.append(e);return}this._append(e),(t=this.outerObject3d.parent)===null||t===void 0||t.add(e.outerObject3d),this.targetState.set(e)}attach(e){var t;if(this.targetState.get()){super.attach(e);return}this._append(e),(t=this.outerObject3d.parent)===null||t===void 0||t.attach(e.outerObject3d),this.targetState.set(e)}get x(){return this.camera.position.x*pn}set x(e){this.camera.position.x=e*Ye}get y(){return this.camera.position.y*pn}set y(e){this.camera.position.y=e*Ye}get z(){return this.camera.position.z*pn}set z(e){this.camera.position.z=e*Ye}get rotationX(){return this.camera.rotation.x*pi}get rotationY(){return this.camera.rotation.y*pi}get rotationZ(){return this.camera.rotation.z*pi}get enableDamping(){return this.controls.enableDamping}set enableDamping(e){this.controls.enableDamping=e}get enablePan(){return this.controls.enablePan}set enablePan(e){this.controls.enablePan=e}get enableZoom(){return this.enableZoomState.get()}set enableZoom(e){this.enableZoomState.set(e)}get enableFly(){return this.enableFlyState.get()}set enableFly(e){this.enableFlyState.set(e)}get enabled(){return this.enabledState.get()}set enabled(e){this.enabledState.set(e)}get autoRotate(){return this.controls.autoRotate}set autoRotate(e){this.controls.autoRotate=e}get autoRotateSpeed(){return this.controls.autoRotateSpeed}set autoRotateSpeed(e){this.controls.autoRotateSpeed=e}get minPolarAngle(){return this._minPolarAngle*pi}set minPolarAngle(e){this.controls.minPolarAngle=this._minPolarAngle=e*xn}get maxPolarAngle(){return this._maxPolarAngle*pi}set maxPolarAngle(e){this.controls.maxPolarAngle=this._maxPolarAngle=e*xn}get minAzimuthAngle(){return this._minAzimuthAngle*pi}set minAzimuthAngle(e){this.controls.minAzimuthAngle=this._minAzimuthAngle=e*xn}get maxAzimuthAngle(){return this._maxAzimuthAngle*pi}set maxAzimuthAngle(e){this.controls.maxAzimuthAngle=this._maxAzimuthAngle=e*xn}get azimuthAngle(){return this.controls.getAzimuthalAngle()*pi}set azimuthAngle(e){this.controls.minAzimuthAngle=this.controls.maxAzimuthAngle=e*xn,this.controls.update(),this.queueMicrotask(()=>{this.controls.minAzimuthAngle=this._minAzimuthAngle,this.controls.maxAzimuthAngle=this._maxAzimuthAngle})}get polarAngle(){return this.controls.getPolarAngle()*pi}set polarAngle(e){this.controls.minPolarAngle=this.controls.maxPolarAngle=e*xn,this.controls.update(),this.queueMicrotask(()=>{this.controls.minPolarAngle=this._minPolarAngle,this.controls.maxPolarAngle=this._maxPolarAngle})}get distance(){return this.controls.getDistance()*pn}set distance(e){this.controls.minDistance=this.controls.maxDistance=e*Ye,this.controls.update(),this.queueMicrotask(()=>{this.controls.minDistance=-1/0,this.controls.maxDistance=1/0})}getCenter(){return this.getWorldPosition()}}Cl.componentName="orbitCamera";Cl.defaults=hA;Cl.schema=uA;ks(Cl,[aA]);const[dA,KU]=Er(),[bM,JU]=Ge(0),rr=new Cl(bn);rr.enablePan=!0;rr.enableZoom=!0;rr.enableFly=!0;rr.enabled=!1;Li.delete(rr);KU(i=>{const e=i.getCenter();rr.targetX=e.x,rr.targetY=e.y,rr.targetZ=e.z});const{controls:pA}=rr;HU(i=>pA.screenSpacePanning=i);Kt(()=>{if(!(!vl()||Ze()!==bn||So()))return rr.enabled=!0,wn.style.cursor="grab",()=>{rr.enabled=!1,wn.style.cursor="auto"}},[vl,So,Ze]);Kt(()=>{if(!vl())return;let i=!0;return queueMicrotask(()=>i&&(rr.polarAngle=60)),()=>{i=!1,pA.reset(),rr.polarAngle=90,rr.azimuthAngle=0}},[vl]);Kt(()=>{if(Ze()!==bn||vl())return;const i=JU(e=>bn.position.z=e);return()=>{i.cancel()}},[Ze,vl]);const[wM,P_]=Er(),[QU,gl]=Ge("translate"),[$U,R_]=Ge("world"),[S9,SM]=Ge(null),eF=yl(async()=>{const{TransformControls:i}=await $n(()=>import("./TransformControls.78c211b5.js"),["./TransformControls.78c211b5.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url),e=new i(Ze(),wn);Ze(n=>e.camera=n),e.enabled=!1;let t=!1;return e.addEventListener("dragging-changed",({value:n})=>{t=n,aU(t),wM(t?"start":"stop")}),e.addEventListener("change",()=>t&&wM("move")),e});Kt(()=>{const i=vi(),e=gl(),t=R_(),n=SM();if(!i||Ze()!==bn)return;const r=new En;return eF().then(s=>{if(e==="select"){s.enabled=!1;return}s.setMode(e),s.setSpace(t),s.setScaleSnap(n),s.setRotationSnap(n),s.setTranslationSnap(n),$e.add(s),s.attach(i.outerObject3d),s.enabled=!0,r.then(()=>{$e.remove(s),s.detach(),s.enabled=!1})}),()=>{r.cancel()}},[vi,gl,R_,SM,Ze]);Kt(()=>{if(!l_())return;const i=c_(),e=new F2(i,i);return $e.add(e),()=>{$e.remove(e)}},[l_,c_]);const[M9,MM]=Ge(!1),[Af,nb]=Er(),el=new In(new ld(br,br,4,4),pT);Kt(()=>{var i;if(!MM()||Ze()!==bn)return;$e.add(el);const[e,t]=(i=Jc())!==null&&i!==void 0?i:mi();el.scale.x=e*Ye,el.scale.y=t*Ye;const n=nb(()=>{el.quaternion.copy(bn.quaternion),el.position.copy(bn.position),el.translateZ(-4.9)});return()=>{n.cancel(),$e.remove(el)}},[MM,Jc,mi(),Ze]);const[E9,tF]=Ge({turbidity:10,rayleigh:3,mieCoefficient:.005,mieDirectionalG:.5,inclination:.49,azimuth:.25});class _d extends In{constructor(){const e=_d.SkyShader,t=new kt({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:Qn.clone(e.uniforms),side:xr,depthWrite:!1});super(new bl(1,1,1),t)}}_d.prototype.isSky=!0;_d.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new z},up:{value:new z(0,1,0)}},vertexShader:`
|
||
uniform vec3 sunPosition;
|
||
uniform float rayleigh;
|
||
uniform float turbidity;
|
||
uniform float mieCoefficient;
|
||
uniform vec3 up;
|
||
|
||
varying vec3 vWorldPosition;
|
||
varying vec3 vSunDirection;
|
||
varying float vSunfade;
|
||
varying vec3 vBetaR;
|
||
varying vec3 vBetaM;
|
||
varying float vSunE;
|
||
|
||
// constants for atmospheric scattering
|
||
const float e = 2.71828182845904523536028747135266249775724709369995957;
|
||
const float pi = 3.141592653589793238462643383279502884197169;
|
||
|
||
// wavelength of used primaries, according to preetham
|
||
const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
|
||
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
|
||
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
|
||
const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
|
||
|
||
// mie stuff
|
||
// K coefficient for the primaries
|
||
const float v = 4.0;
|
||
const vec3 K = vec3( 0.686, 0.678, 0.666 );
|
||
// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
|
||
const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );
|
||
|
||
// earth shadow hack
|
||
// cutoffAngle = pi / 1.95;
|
||
const float cutoffAngle = 1.6110731556870734;
|
||
const float steepness = 1.5;
|
||
const float EE = 1000.0;
|
||
|
||
float sunIntensity( float zenithAngleCos ) {
|
||
zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );
|
||
return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );
|
||
}
|
||
|
||
vec3 totalMie( float T ) {
|
||
float c = ( 0.2 * T ) * 10E-18;
|
||
return 0.434 * c * MieConst;
|
||
}
|
||
|
||
void main() {
|
||
|
||
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
||
vWorldPosition = worldPosition.xyz;
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
gl_Position.z = gl_Position.w; // set z to camera.far
|
||
|
||
vSunDirection = normalize( sunPosition );
|
||
|
||
vSunE = sunIntensity( dot( vSunDirection, up ) );
|
||
|
||
vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );
|
||
|
||
float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
|
||
|
||
// extinction (absorbtion + out scattering)
|
||
// rayleigh coefficients
|
||
vBetaR = totalRayleigh * rayleighCoefficient;
|
||
|
||
// mie coefficients
|
||
vBetaM = totalMie( turbidity ) * mieCoefficient;
|
||
|
||
}`,fragmentShader:`
|
||
varying vec3 vWorldPosition;
|
||
varying vec3 vSunDirection;
|
||
varying float vSunfade;
|
||
varying vec3 vBetaR;
|
||
varying vec3 vBetaM;
|
||
varying float vSunE;
|
||
|
||
uniform float mieDirectionalG;
|
||
uniform vec3 up;
|
||
|
||
const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );
|
||
|
||
// constants for atmospheric scattering
|
||
const float pi = 3.141592653589793238462643383279502884197169;
|
||
|
||
const float n = 1.0003; // refractive index of air
|
||
const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
|
||
|
||
// optical length at zenith for molecules
|
||
const float rayleighZenithLength = 8.4E3;
|
||
const float mieZenithLength = 1.25E3;
|
||
// 66 arc seconds -> degrees, and the cosine of that
|
||
const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;
|
||
|
||
// 3.0 / ( 16.0 * pi )
|
||
const float THREE_OVER_SIXTEENPI = 0.05968310365946075;
|
||
// 1.0 / ( 4.0 * pi )
|
||
const float ONE_OVER_FOURPI = 0.07957747154594767;
|
||
|
||
float rayleighPhase( float cosTheta ) {
|
||
return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );
|
||
}
|
||
|
||
float hgPhase( float cosTheta, float g ) {
|
||
float g2 = pow( g, 2.0 );
|
||
float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );
|
||
return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );
|
||
}
|
||
|
||
void main() {
|
||
|
||
vec3 direction = normalize( vWorldPosition - cameraPos );
|
||
|
||
// optical length
|
||
// cutoff angle at 90 to avoid singularity in next formula.
|
||
float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );
|
||
float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );
|
||
float sR = rayleighZenithLength * inverse;
|
||
float sM = mieZenithLength * inverse;
|
||
|
||
// combined extinction factor
|
||
vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );
|
||
|
||
// in scattering
|
||
float cosTheta = dot( direction, vSunDirection );
|
||
|
||
float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );
|
||
vec3 betaRTheta = vBetaR * rPhase;
|
||
|
||
float mPhase = hgPhase( cosTheta, mieDirectionalG );
|
||
vec3 betaMTheta = vBetaM * mPhase;
|
||
|
||
vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );
|
||
Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );
|
||
|
||
// nightsky
|
||
float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]
|
||
float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]
|
||
vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );
|
||
vec3 L0 = vec3( 0.1 ) * Fex;
|
||
|
||
// composition + solar disc
|
||
float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );
|
||
L0 += ( vSunE * 19000.0 * Fex ) * sundisk;
|
||
|
||
vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );
|
||
|
||
vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );
|
||
|
||
gl_FragColor = vec4( retColor, 1.0 );
|
||
|
||
#include <tonemapping_fragment>
|
||
#include <encodings_fragment>
|
||
|
||
}`};const[nF,iF]=Ge(!1),EM=yl(()=>{const i=new _d;return i.scale.setScalar(45e4),tF(e=>{const{uniforms:t}=i.material;t.turbidity.value=e.turbidity,t.rayleigh.value=e.rayleigh,t.mieCoefficient.value=e.mieCoefficient,t.mieDirectionalG.value=e.mieDirectionalG;const n=Math.PI*(e.inclination-.5),r=2*Math.PI*(e.azimuth-.5);Ot.x=Math.cos(r),Ot.y=Math.sin(r)*Math.sin(n),Ot.z=Math.sin(r)*Math.cos(n),t.sunPosition.value.copy(Ot)}),i});let TM=!1;iF(i=>{TM!==i&&(TM=i,i?$e.add(EM()):$e.remove(EM()))});const[Cf,T9]=Er(),[rF,AM]=Ge(!1),[sF,CM]=Ge(!1),[oF,PM]=Ge(!1),RM={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:.01},nearClip:{value:1},farClip:{value:1e3}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
#include <common>
|
||
|
||
varying vec2 vUv;
|
||
|
||
uniform sampler2D tColor;
|
||
uniform sampler2D tDepth;
|
||
|
||
uniform float maxblur; // max blur amount
|
||
uniform float aperture; // aperture - bigger values for shallower depth of field
|
||
|
||
uniform float nearClip;
|
||
uniform float farClip;
|
||
|
||
uniform float focus;
|
||
uniform float aspect;
|
||
|
||
#include <packing>
|
||
|
||
float getDepth( const in vec2 screenPosition ) {
|
||
#if DEPTH_PACKING == 1
|
||
return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );
|
||
#else
|
||
return texture2D( tDepth, screenPosition ).x;
|
||
#endif
|
||
}
|
||
|
||
float getViewZ( const in float depth ) {
|
||
#if PERSPECTIVE_CAMERA == 1
|
||
return perspectiveDepthToViewZ( depth, nearClip, farClip );
|
||
#else
|
||
return orthographicDepthToViewZ( depth, nearClip, farClip );
|
||
#endif
|
||
}
|
||
|
||
|
||
void main() {
|
||
|
||
vec2 aspectcorrect = vec2( 1.0, aspect );
|
||
|
||
float viewZ = getViewZ( getDepth( vUv ) );
|
||
|
||
float factor = ( focus + viewZ ); // viewZ is <= 0, so this is a difference equation
|
||
|
||
vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );
|
||
|
||
vec2 dofblur9 = dofblur * 0.9;
|
||
vec2 dofblur7 = dofblur * 0.7;
|
||
vec2 dofblur4 = dofblur * 0.4;
|
||
|
||
vec4 col = vec4( 0.0 );
|
||
|
||
col += texture2D( tColor, vUv.xy );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );
|
||
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );
|
||
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );
|
||
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );
|
||
col += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );
|
||
|
||
gl_FragColor = col / 41.0;
|
||
gl_FragColor.a = 1.0;
|
||
|
||
}`};class aF extends zs{constructor(e,t,n){super(),this.scene=e,this.camera=t;const r=n.focus!==void 0?n.focus:1,s=n.aspect!==void 0?n.aspect:t.aspect,o=n.aperture!==void 0?n.aperture:.025,l=n.maxblur!==void 0?n.maxblur:1,h=n.width||window.innerWidth||1,d=n.height||window.innerHeight||1;this.renderTargetDepth=new Yt(h,d,{minFilter:Xt,magFilter:Xt}),this.renderTargetDepth.texture.name="BokehPass.depth",this.materialDepth=new lu,this.materialDepth.depthPacking=Bm,this.materialDepth.blending=rn,RM===void 0&&console.error("THREE.BokehPass relies on BokehShader");const f=RM,g=Qn.clone(f.uniforms);g.tDepth.value=this.renderTargetDepth.texture,g.focus.value=r,g.aspect.value=s,g.aperture.value=o,g.maxblur.value=l,g.nearClip.value=t.near,g.farClip.value=t.far,this.materialBokeh=new kt({defines:Object.assign({},f.defines),uniforms:g,vertexShader:f.vertexShader,fragmentShader:f.fragmentShader}),this.uniforms=g,this.needsSwap=!1,this.fsQuad=new Ml(this.materialBokeh),this._oldClearColor=new Pe}render(e,t,n){this.scene.overrideMaterial=this.materialDepth,e.getClearColor(this._oldClearColor);const r=e.getClearAlpha(),s=e.autoClear;e.autoClear=!1,e.setClearColor(16777215),e.setClearAlpha(1),e.setRenderTarget(this.renderTargetDepth),e.clear(),e.render(this.scene,this.camera),this.uniforms.tColor.value=n.texture,this.uniforms.nearClip.value=this.camera.near,this.uniforms.farClip.value=this.camera.far,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),this.scene.overrideMaterial=null,e.setClearColor(this._oldClearColor),e.setClearAlpha(r),e.autoClear=s}}const ib=new aF($e,Ze(),{});Ze(i=>ib.camera=i);const rb=ib.uniforms;jU(i=>rb.focus.value=i);WU(i=>rb.aperture.value=i);XU(i=>rb.maxblur.value=i);const lF=new vm(new kt({uniforms:{baseTexture:{value:null},bloomTexture:{value:ya.renderTarget2.texture}},vertexShader:`
|
||
varying vec2 vUv;
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||
}
|
||
`,fragmentShader:`
|
||
uniform sampler2D baseTexture;
|
||
uniform sampler2D bloomTexture;
|
||
varying vec2 vUv;
|
||
void main() {
|
||
gl_FragColor = texture2D(baseTexture, vUv) + texture2D(bloomTexture, vUv);
|
||
}
|
||
`,defines:{}}),"baseTexture"),lh={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new ae(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new Qe},cameraInverseProjectionMatrix:{value:new Qe},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
|
||
#include <common>
|
||
|
||
varying vec2 vUv;
|
||
|
||
#if DIFFUSE_TEXTURE == 1
|
||
uniform sampler2D tDiffuse;
|
||
#endif
|
||
|
||
uniform sampler2D tDepth;
|
||
|
||
#if NORMAL_TEXTURE == 1
|
||
uniform sampler2D tNormal;
|
||
#endif
|
||
|
||
uniform float cameraNear;
|
||
uniform float cameraFar;
|
||
uniform mat4 cameraProjectionMatrix;
|
||
uniform mat4 cameraInverseProjectionMatrix;
|
||
|
||
uniform float scale;
|
||
uniform float intensity;
|
||
uniform float bias;
|
||
uniform float kernelRadius;
|
||
uniform float minResolution;
|
||
uniform vec2 size;
|
||
uniform float randomSeed;
|
||
|
||
// RGBA depth
|
||
|
||
#include <packing>
|
||
|
||
vec4 getDefaultColor( const in vec2 screenPosition ) {
|
||
#if DIFFUSE_TEXTURE == 1
|
||
return texture2D( tDiffuse, vUv );
|
||
#else
|
||
return vec4( 1.0 );
|
||
#endif
|
||
}
|
||
|
||
float getDepth( const in vec2 screenPosition ) {
|
||
#if DEPTH_PACKING == 1
|
||
return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );
|
||
#else
|
||
return texture2D( tDepth, screenPosition ).x;
|
||
#endif
|
||
}
|
||
|
||
float getViewZ( const in float depth ) {
|
||
#if PERSPECTIVE_CAMERA == 1
|
||
return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
|
||
#else
|
||
return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
|
||
#endif
|
||
}
|
||
|
||
vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {
|
||
float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];
|
||
vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );
|
||
clipPosition *= clipW; // unprojection.
|
||
|
||
return ( cameraInverseProjectionMatrix * clipPosition ).xyz;
|
||
}
|
||
|
||
vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {
|
||
#if NORMAL_TEXTURE == 1
|
||
return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );
|
||
#else
|
||
return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );
|
||
#endif
|
||
}
|
||
|
||
float scaleDividedByCameraFar;
|
||
float minResolutionMultipliedByCameraFar;
|
||
|
||
float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {
|
||
vec3 viewDelta = sampleViewPosition - centerViewPosition;
|
||
float viewDistance = length( viewDelta );
|
||
float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;
|
||
|
||
return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );
|
||
}
|
||
|
||
// moving costly divides into consts
|
||
const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );
|
||
const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );
|
||
|
||
float getAmbientOcclusion( const in vec3 centerViewPosition ) {
|
||
// precompute some variables require in getOcclusion.
|
||
scaleDividedByCameraFar = scale / cameraFar;
|
||
minResolutionMultipliedByCameraFar = minResolution * cameraFar;
|
||
vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );
|
||
|
||
// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/
|
||
float angle = rand( vUv + randomSeed ) * PI2;
|
||
vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;
|
||
vec2 radiusStep = radius;
|
||
|
||
float occlusionSum = 0.0;
|
||
float weightSum = 0.0;
|
||
|
||
for( int i = 0; i < NUM_SAMPLES; i ++ ) {
|
||
vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;
|
||
radius += radiusStep;
|
||
angle += ANGLE_STEP;
|
||
|
||
float sampleDepth = getDepth( sampleUv );
|
||
if( sampleDepth >= ( 1.0 - EPSILON ) ) {
|
||
continue;
|
||
}
|
||
|
||
float sampleViewZ = getViewZ( sampleDepth );
|
||
vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );
|
||
occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );
|
||
weightSum += 1.0;
|
||
}
|
||
|
||
if( weightSum == 0.0 ) discard;
|
||
|
||
return occlusionSum * ( intensity / weightSum );
|
||
}
|
||
|
||
void main() {
|
||
float centerDepth = getDepth( vUv );
|
||
if( centerDepth >= ( 1.0 - EPSILON ) ) {
|
||
discard;
|
||
}
|
||
|
||
float centerViewZ = getViewZ( centerDepth );
|
||
vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );
|
||
|
||
float ambientOcclusion = getAmbientOcclusion( viewPosition );
|
||
|
||
gl_FragColor = getDefaultColor( vUv );
|
||
gl_FragColor.xyz *= 1.0 - ambientOcclusion;
|
||
}`},ho={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new ae(512,512)},sampleUvOffsets:{value:[new ae(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:`
|
||
|
||
#include <common>
|
||
|
||
uniform vec2 size;
|
||
|
||
varying vec2 vUv;
|
||
varying vec2 vInvSize;
|
||
|
||
void main() {
|
||
vUv = uv;
|
||
vInvSize = 1.0 / size;
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
}`,fragmentShader:`
|
||
|
||
#include <common>
|
||
#include <packing>
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform sampler2D tDepth;
|
||
|
||
uniform float cameraNear;
|
||
uniform float cameraFar;
|
||
uniform float depthCutoff;
|
||
|
||
uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];
|
||
uniform float sampleWeights[ KERNEL_RADIUS + 1 ];
|
||
|
||
varying vec2 vUv;
|
||
varying vec2 vInvSize;
|
||
|
||
float getDepth( const in vec2 screenPosition ) {
|
||
#if DEPTH_PACKING == 1
|
||
return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );
|
||
#else
|
||
return texture2D( tDepth, screenPosition ).x;
|
||
#endif
|
||
}
|
||
|
||
float getViewZ( const in float depth ) {
|
||
#if PERSPECTIVE_CAMERA == 1
|
||
return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );
|
||
#else
|
||
return orthographicDepthToViewZ( depth, cameraNear, cameraFar );
|
||
#endif
|
||
}
|
||
|
||
void main() {
|
||
float depth = getDepth( vUv );
|
||
if( depth >= ( 1.0 - EPSILON ) ) {
|
||
discard;
|
||
}
|
||
|
||
float centerViewZ = -getViewZ( depth );
|
||
bool rBreak = false, lBreak = false;
|
||
|
||
float weightSum = sampleWeights[0];
|
||
vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;
|
||
|
||
for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {
|
||
|
||
float sampleWeight = sampleWeights[i];
|
||
vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;
|
||
|
||
vec2 sampleUv = vUv + sampleUvOffset;
|
||
float viewZ = -getViewZ( getDepth( sampleUv ) );
|
||
|
||
if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;
|
||
|
||
if( ! rBreak ) {
|
||
diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;
|
||
weightSum += sampleWeight;
|
||
}
|
||
|
||
sampleUv = vUv - sampleUvOffset;
|
||
viewZ = -getViewZ( getDepth( sampleUv ) );
|
||
|
||
if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;
|
||
|
||
if( ! lBreak ) {
|
||
diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;
|
||
weightSum += sampleWeight;
|
||
}
|
||
|
||
}
|
||
|
||
gl_FragColor = diffuseSum / weightSum;
|
||
}`},_m={createSampleWeights:function(i,e){const t=[];for(let n=0;n<=i;n++)t.push(cF(n,e));return t},createSampleOffsets:function(i,e){const t=[];for(let n=0;n<=i;n++)t.push(e.clone().multiplyScalar(n));return t},configure:function(i,e,t,n){i.defines.KERNEL_RADIUS=e,i.uniforms.sampleUvOffsets.value=_m.createSampleOffsets(e,n),i.uniforms.sampleWeights.value=_m.createSampleWeights(e,t),i.needsUpdate=!0}};function cF(i,e){return Math.exp(-(i*i)/(2*(e*e)))/(Math.sqrt(2*Math.PI)*e)}const Pf={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform float opacity;
|
||
|
||
uniform sampler2D tDiffuse;
|
||
|
||
varying vec2 vUv;
|
||
|
||
#include <packing>
|
||
|
||
void main() {
|
||
|
||
float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );
|
||
gl_FragColor = vec4( vec3( depth ), opacity );
|
||
|
||
}`};class fA extends zs{constructor(e,t,n=!1,r=!1,s=new ae(256,256)){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=n,this.supportsNormalTexture=r,this.originalClearColor=new Pe,this._oldClearColor=new Pe,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=new ae(s.x,s.y),this.saoRenderTarget=new Yt(this.resolution.x,this.resolution.y),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new Yt(this.resolution.x,this.resolution.y,{minFilter:Xt,magFilter:Xt}),this.depthRenderTarget=this.normalRenderTarget.clone();let o;this.supportsDepthTextureExtension&&(o=new Hm,o.type=pl,this.beautyRenderTarget.depthTexture=o,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new lu,this.depthMaterial.depthPacking=Bm,this.depthMaterial.blending=rn,this.normalMaterial=new Jm,this.normalMaterial.blending=rn,lh===void 0&&console.error("THREE.SAOPass relies on SAOShader"),this.saoMaterial=new kt({defines:Object.assign({},lh.defines),fragmentShader:lh.fragmentShader,vertexShader:lh.vertexShader,uniforms:Qn.clone(lh.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?o:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=rn,ho===void 0&&console.error("THREE.SAOPass relies on DepthLimitedBlurShader"),this.vBlurMaterial=new kt({uniforms:Qn.clone(ho.uniforms),defines:Object.assign({},ho.defines),vertexShader:ho.vertexShader,fragmentShader:ho.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?o:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=rn,this.hBlurMaterial=new kt({uniforms:Qn.clone(ho.uniforms),defines:Object.assign({},ho.defines),vertexShader:ho.vertexShader,fragmentShader:ho.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?o:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=rn,_r===void 0&&console.error("THREE.SAOPass relies on CopyShader"),this.materialCopy=new kt({uniforms:Qn.clone(_r.uniforms),vertexShader:_r.vertexShader,fragmentShader:_r.fragmentShader,blending:rn}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=Fy,this.materialCopy.blendSrc=NE,this.materialCopy.blendDst=Vy,this.materialCopy.blendEquation=Es,this.materialCopy.blendSrcAlpha=kE,this.materialCopy.blendDstAlpha=Vy,this.materialCopy.blendEquationAlpha=Es,Pf===void 0&&console.error("THREE.SAOPass relies on UnpackDepthRGBAShader"),this.depthCopy=new kt({uniforms:Qn.clone(Pf.uniforms),vertexShader:Pf.vertexShader,fragmentShader:Pf.fragmentShader,blending:rn}),this.fsQuad=new Ml(null)}render(e,t,n){if(this.renderToScreen&&(this.materialCopy.blending=rn,this.materialCopy.uniforms.tDiffuse.value=n.texture,this.materialCopy.needsUpdate=!0,this.renderPass(e,this.materialCopy,null)),this.params.output===1)return;e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const r=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.depthRenderTarget),e.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;const s=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=s,this.hBlurMaterial.uniforms.depthCutoff.value=s,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),(this.prevStdDev!==this.params.saoBlurStdDev||this.prevNumSamples!==this.params.saoBlurRadius)&&(_m.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new ae(0,1)),_m.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new ae(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),e.setClearColor(0),e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(e,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(e,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(e,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(e,this.hBlurMaterial,this.saoRenderTarget,16777215,1));let o=this.materialCopy;this.params.output===3?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,o=this.depthCopy):this.params.output===4?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),this.params.output===0?o.blending=Fy:o.blending=rn,this.renderPass(e,o,this.renderToScreen?null:n),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=r}renderPass(e,t,n,r,s){e.getClearColor(this.originalClearColor);const o=e.getClearAlpha(),l=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=l,e.setClearColor(this.originalClearColor),e.setClearAlpha(o)}renderOverride(e,t,n,r,s){e.getClearColor(this.originalClearColor);const o=e.getClearAlpha(),l=e.autoClear;e.setRenderTarget(n),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=l,e.setClearColor(this.originalClearColor),e.setClearAlpha(o)}setSize(e,t){this.beautyRenderTarget.setSize(e,t),this.saoRenderTarget.setSize(e,t),this.blurIntermediateRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.depthRenderTarget.setSize(e,t),this.saoMaterial.uniforms.size.value.set(e,t),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,t),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,t),this.hBlurMaterial.needsUpdate=!0}}fA.OUTPUT={Beauty:1,Default:0,SAO:2,Depth:3,Normal:4};const xd=new fA($e,Ze(),!1,!0);xd.params.saoKernelRadius=80;xd.params.saoBlurStdDev=5;dm(i=>xd.params.saoScale=i==="light"?3e3:2e3);Ze(i=>xd.camera=i);const ch={defines:{SMAA_THRESHOLD:"0.1"},uniforms:{tDiffuse:{value:null},resolution:{value:new ae(1/1024,1/512)}},vertexShader:`
|
||
|
||
uniform vec2 resolution;
|
||
|
||
varying vec2 vUv;
|
||
varying vec4 vOffset[ 3 ];
|
||
|
||
void SMAAEdgeDetectionVS( vec2 texcoord ) {
|
||
vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 ); // WebGL port note: Changed sign in W component
|
||
vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component
|
||
vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0, 2.0 ); // WebGL port note: Changed sign in W component
|
||
}
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
|
||
SMAAEdgeDetectionVS( vUv );
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
|
||
varying vec2 vUv;
|
||
varying vec4 vOffset[ 3 ];
|
||
|
||
vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {
|
||
vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );
|
||
|
||
// Calculate color deltas:
|
||
vec4 delta;
|
||
vec3 C = texture2D( colorTex, texcoord ).rgb;
|
||
|
||
vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;
|
||
vec3 t = abs( C - Cleft );
|
||
delta.x = max( max( t.r, t.g ), t.b );
|
||
|
||
vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;
|
||
t = abs( C - Ctop );
|
||
delta.y = max( max( t.r, t.g ), t.b );
|
||
|
||
// We do the usual threshold:
|
||
vec2 edges = step( threshold, delta.xy );
|
||
|
||
// Then discard if there is no edge:
|
||
if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )
|
||
discard;
|
||
|
||
// Calculate right and bottom deltas:
|
||
vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;
|
||
t = abs( C - Cright );
|
||
delta.z = max( max( t.r, t.g ), t.b );
|
||
|
||
vec3 Cbottom = texture2D( colorTex, offset[1].zw ).rgb;
|
||
t = abs( C - Cbottom );
|
||
delta.w = max( max( t.r, t.g ), t.b );
|
||
|
||
// Calculate the maximum delta in the direct neighborhood:
|
||
float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );
|
||
|
||
// Calculate left-left and top-top deltas:
|
||
vec3 Cleftleft = texture2D( colorTex, offset[2].xy ).rgb;
|
||
t = abs( C - Cleftleft );
|
||
delta.z = max( max( t.r, t.g ), t.b );
|
||
|
||
vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;
|
||
t = abs( C - Ctoptop );
|
||
delta.w = max( max( t.r, t.g ), t.b );
|
||
|
||
// Calculate the final maximum delta:
|
||
maxDelta = max( max( maxDelta, delta.z ), delta.w );
|
||
|
||
// Local contrast adaptation in action:
|
||
edges.xy *= step( 0.5 * maxDelta, delta.xy );
|
||
|
||
return vec4( edges, 0.0, 0.0 );
|
||
}
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );
|
||
|
||
}`},Rf={defines:{SMAA_MAX_SEARCH_STEPS:"8",SMAA_AREATEX_MAX_DISTANCE:"16",SMAA_AREATEX_PIXEL_SIZE:"( 1.0 / vec2( 160.0, 560.0 ) )",SMAA_AREATEX_SUBTEX_SIZE:"( 1.0 / 7.0 )"},uniforms:{tDiffuse:{value:null},tArea:{value:null},tSearch:{value:null},resolution:{value:new ae(1/1024,1/512)}},vertexShader:`
|
||
|
||
uniform vec2 resolution;
|
||
|
||
varying vec2 vUv;
|
||
varying vec4 vOffset[ 3 ];
|
||
varying vec2 vPixcoord;
|
||
|
||
void SMAABlendingWeightCalculationVS( vec2 texcoord ) {
|
||
vPixcoord = texcoord / resolution;
|
||
|
||
// We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
|
||
vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 ); // WebGL port note: Changed sign in Y and W components
|
||
vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 ); // WebGL port note: Changed sign in Y and W components
|
||
|
||
// And these for the searches, they indicate the ends of the loops:
|
||
vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
|
||
SMAABlendingWeightCalculationVS( vUv );
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform sampler2D tArea;
|
||
uniform sampler2D tSearch;
|
||
uniform vec2 resolution;
|
||
|
||
varying vec2 vUv;
|
||
varying vec4 vOffset[3];
|
||
varying vec2 vPixcoord;
|
||
|
||
#if __VERSION__ == 100
|
||
vec2 round( vec2 x ) {
|
||
return sign( x ) * floor( abs( x ) + 0.5 );
|
||
}
|
||
#endif
|
||
|
||
float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {
|
||
// Not required if searchTex accesses are set to point:
|
||
// float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
|
||
// e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +
|
||
// e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
|
||
e.r = bias + e.r * scale;
|
||
return 255.0 * texture2D( searchTex, e, 0.0 ).r;
|
||
}
|
||
|
||
float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
|
||
/**
|
||
* @PSEUDO_GATHER4
|
||
* This texcoord has been offset by (-0.25, -0.125) in the vertex shader to
|
||
* sample between edge, thus fetching four edges in a row.
|
||
* Sampling with different offsets in each direction allows to disambiguate
|
||
* which edges are active from the four fetched ones.
|
||
*/
|
||
vec2 e = vec2( 0.0, 1.0 );
|
||
|
||
for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
|
||
e = texture2D( edgesTex, texcoord, 0.0 ).rg;
|
||
texcoord -= vec2( 2.0, 0.0 ) * resolution;
|
||
if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;
|
||
}
|
||
|
||
// We correct the previous (-0.25, -0.125) offset we applied:
|
||
texcoord.x += 0.25 * resolution.x;
|
||
|
||
// The searches are bias by 1, so adjust the coords accordingly:
|
||
texcoord.x += resolution.x;
|
||
|
||
// Disambiguate the length added by the last step:
|
||
texcoord.x += 2.0 * resolution.x; // Undo last step
|
||
texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);
|
||
|
||
return texcoord.x;
|
||
}
|
||
|
||
float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
|
||
vec2 e = vec2( 0.0, 1.0 );
|
||
|
||
for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
|
||
e = texture2D( edgesTex, texcoord, 0.0 ).rg;
|
||
texcoord += vec2( 2.0, 0.0 ) * resolution;
|
||
if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;
|
||
}
|
||
|
||
texcoord.x -= 0.25 * resolution.x;
|
||
texcoord.x -= resolution.x;
|
||
texcoord.x -= 2.0 * resolution.x;
|
||
texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );
|
||
|
||
return texcoord.x;
|
||
}
|
||
|
||
float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
|
||
vec2 e = vec2( 1.0, 0.0 );
|
||
|
||
for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
|
||
e = texture2D( edgesTex, texcoord, 0.0 ).rg;
|
||
texcoord += vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign
|
||
if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;
|
||
}
|
||
|
||
texcoord.y -= 0.25 * resolution.y; // WebGL port note: Changed sign
|
||
texcoord.y -= resolution.y; // WebGL port note: Changed sign
|
||
texcoord.y -= 2.0 * resolution.y; // WebGL port note: Changed sign
|
||
texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 ); // WebGL port note: Changed sign
|
||
|
||
return texcoord.y;
|
||
}
|
||
|
||
float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
|
||
vec2 e = vec2( 1.0, 0.0 );
|
||
|
||
for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
|
||
e = texture2D( edgesTex, texcoord, 0.0 ).rg;
|
||
texcoord -= vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign
|
||
if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;
|
||
}
|
||
|
||
texcoord.y += 0.25 * resolution.y; // WebGL port note: Changed sign
|
||
texcoord.y += resolution.y; // WebGL port note: Changed sign
|
||
texcoord.y += 2.0 * resolution.y; // WebGL port note: Changed sign
|
||
texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 ); // WebGL port note: Changed sign
|
||
|
||
return texcoord.y;
|
||
}
|
||
|
||
vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {
|
||
// Rounding prevents precision errors of bilinear filtering:
|
||
vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;
|
||
|
||
// We do a scale and bias for mapping to texel space:
|
||
texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );
|
||
|
||
// Move to proper place, according to the subpixel offset:
|
||
texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;
|
||
|
||
return texture2D( areaTex, texcoord, 0.0 ).rg;
|
||
}
|
||
|
||
vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {
|
||
vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );
|
||
|
||
vec2 e = texture2D( edgesTex, texcoord ).rg;
|
||
|
||
if ( e.g > 0.0 ) { // Edge at north
|
||
vec2 d;
|
||
|
||
// Find the distance to the left:
|
||
vec2 coords;
|
||
coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );
|
||
coords.y = offset[ 1 ].y; // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)
|
||
d.x = coords.x;
|
||
|
||
// Now fetch the left crossing edges, two at a time using bilinear
|
||
// filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
|
||
// discern what value each edge has:
|
||
float e1 = texture2D( edgesTex, coords, 0.0 ).r;
|
||
|
||
// Find the distance to the right:
|
||
coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );
|
||
d.y = coords.x;
|
||
|
||
// We want the distances to be in pixel units (doing this here allow to
|
||
// better interleave arithmetic and memory accesses):
|
||
d = d / resolution.x - pixcoord.x;
|
||
|
||
// SMAAArea below needs a sqrt, as the areas texture is compressed
|
||
// quadratically:
|
||
vec2 sqrt_d = sqrt( abs( d ) );
|
||
|
||
// Fetch the right crossing edges:
|
||
coords.y -= 1.0 * resolution.y; // WebGL port note: Added
|
||
float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;
|
||
|
||
// Ok, we know how this pattern looks like, now it is time for getting
|
||
// the actual area:
|
||
weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );
|
||
}
|
||
|
||
if ( e.r > 0.0 ) { // Edge at west
|
||
vec2 d;
|
||
|
||
// Find the distance to the top:
|
||
vec2 coords;
|
||
|
||
coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );
|
||
coords.x = offset[ 0 ].x; // offset[1].x = texcoord.x - 0.25 * resolution.x;
|
||
d.x = coords.y;
|
||
|
||
// Fetch the top crossing edges:
|
||
float e1 = texture2D( edgesTex, coords, 0.0 ).g;
|
||
|
||
// Find the distance to the bottom:
|
||
coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );
|
||
d.y = coords.y;
|
||
|
||
// We want the distances to be in pixel units:
|
||
d = d / resolution.y - pixcoord.y;
|
||
|
||
// SMAAArea below needs a sqrt, as the areas texture is compressed
|
||
// quadratically:
|
||
vec2 sqrt_d = sqrt( abs( d ) );
|
||
|
||
// Fetch the bottom crossing edges:
|
||
coords.y -= 1.0 * resolution.y; // WebGL port note: Added
|
||
float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;
|
||
|
||
// Get the area for this direction:
|
||
weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );
|
||
}
|
||
|
||
return weights;
|
||
}
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );
|
||
|
||
}`},Cy={uniforms:{tDiffuse:{value:null},tColor:{value:null},resolution:{value:new ae(1/1024,1/512)}},vertexShader:`
|
||
|
||
uniform vec2 resolution;
|
||
|
||
varying vec2 vUv;
|
||
varying vec4 vOffset[ 2 ];
|
||
|
||
void SMAANeighborhoodBlendingVS( vec2 texcoord ) {
|
||
vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 ); // WebGL port note: Changed sign in W component
|
||
vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component
|
||
}
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
|
||
SMAANeighborhoodBlendingVS( vUv );
|
||
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform sampler2D tColor;
|
||
uniform vec2 resolution;
|
||
|
||
varying vec2 vUv;
|
||
varying vec4 vOffset[ 2 ];
|
||
|
||
vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {
|
||
// Fetch the blending weights for current pixel:
|
||
vec4 a;
|
||
a.xz = texture2D( blendTex, texcoord ).xz;
|
||
a.y = texture2D( blendTex, offset[ 1 ].zw ).g;
|
||
a.w = texture2D( blendTex, offset[ 1 ].xy ).a;
|
||
|
||
// Is there any blending weight with a value greater than 0.0?
|
||
if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {
|
||
return texture2D( colorTex, texcoord, 0.0 );
|
||
} else {
|
||
// Up to 4 lines can be crossing a pixel (one through each edge). We
|
||
// favor blending by choosing the line with the maximum weight for each
|
||
// direction:
|
||
vec2 offset;
|
||
offset.x = a.a > a.b ? a.a : -a.b; // left vs. right
|
||
offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs
|
||
|
||
// Then we go in the direction that has the maximum weight:
|
||
if ( abs( offset.x ) > abs( offset.y )) { // horizontal vs. vertical
|
||
offset.y = 0.0;
|
||
} else {
|
||
offset.x = 0.0;
|
||
}
|
||
|
||
// Fetch the opposite color and lerp by hand:
|
||
vec4 C = texture2D( colorTex, texcoord, 0.0 );
|
||
texcoord += sign( offset ) * resolution;
|
||
vec4 Cop = texture2D( colorTex, texcoord, 0.0 );
|
||
float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );
|
||
|
||
// WebGL port note: Added gamma correction
|
||
C.xyz = pow(C.xyz, vec3(2.2));
|
||
Cop.xyz = pow(Cop.xyz, vec3(2.2));
|
||
vec4 mixed = mix(C, Cop, s);
|
||
mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));
|
||
|
||
return mixed;
|
||
}
|
||
}
|
||
|
||
void main() {
|
||
|
||
gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );
|
||
|
||
}`};class uF extends zs{constructor(e,t){super(),this.edgesRT=new Yt(e,t,{depthBuffer:!1}),this.edgesRT.texture.name="SMAAPass.edges",this.weightsRT=new Yt(e,t,{depthBuffer:!1}),this.weightsRT.texture.name="SMAAPass.weights";const n=this,r=new Image;r.src=this.getAreaTexture(),r.onload=function(){n.areaTexture.needsUpdate=!0},this.areaTexture=new ti,this.areaTexture.name="SMAAPass.area",this.areaTexture.image=r,this.areaTexture.minFilter=Hn,this.areaTexture.generateMipmaps=!1,this.areaTexture.flipY=!1;const s=new Image;s.src=this.getSearchTexture(),s.onload=function(){n.searchTexture.needsUpdate=!0},this.searchTexture=new ti,this.searchTexture.name="SMAAPass.search",this.searchTexture.image=s,this.searchTexture.magFilter=Xt,this.searchTexture.minFilter=Xt,this.searchTexture.generateMipmaps=!1,this.searchTexture.flipY=!1,ch===void 0&&console.error("THREE.SMAAPass relies on SMAAShader"),this.uniformsEdges=Qn.clone(ch.uniforms),this.uniformsEdges.resolution.value.set(1/e,1/t),this.materialEdges=new kt({defines:Object.assign({},ch.defines),uniforms:this.uniformsEdges,vertexShader:ch.vertexShader,fragmentShader:ch.fragmentShader}),this.uniformsWeights=Qn.clone(Rf.uniforms),this.uniformsWeights.resolution.value.set(1/e,1/t),this.uniformsWeights.tDiffuse.value=this.edgesRT.texture,this.uniformsWeights.tArea.value=this.areaTexture,this.uniformsWeights.tSearch.value=this.searchTexture,this.materialWeights=new kt({defines:Object.assign({},Rf.defines),uniforms:this.uniformsWeights,vertexShader:Rf.vertexShader,fragmentShader:Rf.fragmentShader}),this.uniformsBlend=Qn.clone(Cy.uniforms),this.uniformsBlend.resolution.value.set(1/e,1/t),this.uniformsBlend.tDiffuse.value=this.weightsRT.texture,this.materialBlend=new kt({uniforms:this.uniformsBlend,vertexShader:Cy.vertexShader,fragmentShader:Cy.fragmentShader}),this.needsSwap=!1,this.fsQuad=new Ml(null)}render(e,t,n){this.uniformsEdges.tDiffuse.value=n.texture,this.fsQuad.material=this.materialEdges,e.setRenderTarget(this.edgesRT),this.clear&&e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialWeights,e.setRenderTarget(this.weightsRT),this.clear&&e.clear(),this.fsQuad.render(e),this.uniformsBlend.tColor.value=n.texture,this.fsQuad.material=this.materialBlend,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}setSize(e,t){this.edgesRT.setSize(e,t),this.weightsRT.setSize(e,t),this.materialEdges.uniforms.resolution.value.set(1/e,1/t),this.materialWeights.uniforms.resolution.value.set(1/e,1/t),this.materialBlend.uniforms.resolution.value.set(1/e,1/t)}getAreaTexture(){return"data:image/png;base64,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"}getSearchTexture(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII="}}var hF=new uF(iv,rv);const mA=new vm(new kt({defines:{BAND_MODE:2,CHROMA_SAMPLES:1},uniforms:{tDiffuse:{value:null},baseIor:{value:.8},bandOffset:{value:.01},jitterIntensity:{value:1},jitterOffset:{value:0}},vertexShader:`
|
||
|
||
varying vec2 vUv;
|
||
varying vec3 viewDir;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
viewDir = normalize( ( modelViewMatrix * vec4( position, 1.0 ) ).xyz );
|
||
|
||
}
|
||
|
||
`,fragmentShader:`
|
||
|
||
varying vec2 vUv;
|
||
varying vec3 viewDir;
|
||
uniform float baseIor;
|
||
uniform float bandOffset;
|
||
uniform float jitterIntensity;
|
||
uniform float jitterOffset;
|
||
uniform sampler2D tDiffuse;
|
||
|
||
#include <common>
|
||
void main() {
|
||
|
||
vec3 normal = vec3( ( 2.0 * vUv - vec2( 1.0 ) ), 1.0 );
|
||
normal.z = 1.0;
|
||
normal = normalize( normal );
|
||
|
||
vec3 color;
|
||
|
||
// if NO BANDS
|
||
#if BAND_MODE == 0
|
||
|
||
vec3 refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor );
|
||
color = texture2D( tDiffuse, vUv + refracted.xy ).rgb;
|
||
|
||
// if RGB or RYGCBV BANDS
|
||
#else
|
||
|
||
float index, randValue, offsetValue;
|
||
float r, g, b, r_ior, g_ior, b_ior;
|
||
vec3 r_refracted, g_refracted, b_refracted;
|
||
vec4 r_sample, g_sample, b_sample;
|
||
|
||
#if BAND_MODE == 2
|
||
float y, c, v, y_ior, c_ior, v_ior;
|
||
vec3 y_refracted, c_refracted, v_refracted;
|
||
vec4 y_sample, c_sample, v_sample;
|
||
#endif
|
||
|
||
for ( int i = 0; i < CHROMA_SAMPLES; i ++ ) {
|
||
|
||
index = float( i );
|
||
randValue = rand( sin( index + 1. ) * gl_FragCoord.xy + vec2( jitterOffset, - jitterOffset ) ) - 0.5;
|
||
offsetValue = index / float( CHROMA_SAMPLES ) + randValue * jitterIntensity;
|
||
#if BAND_MODE == 1
|
||
randValue *= 2.0;
|
||
#endif
|
||
|
||
// Paper describing functions for creating yellow, cyan, and violet bands and reforming
|
||
// them into RGB:
|
||
// https://web.archive.org/web/20061108181225/http://home.iitk.ac.in/~shankars/reports/dispersionraytrace.pdf
|
||
r_ior = 1.0 + bandOffset * ( 0.0 + offsetValue );
|
||
g_ior = 1.0 + bandOffset * ( 2.0 + offsetValue );
|
||
b_ior = 1.0 + bandOffset * ( 4.0 + offsetValue );
|
||
|
||
r_refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor / r_ior );
|
||
g_refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor / g_ior );
|
||
b_refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor / b_ior );
|
||
|
||
r_sample = texture2D( tDiffuse, vUv + r_refracted.xy );
|
||
g_sample = texture2D( tDiffuse, vUv + g_refracted.xy );
|
||
b_sample = texture2D( tDiffuse, vUv + b_refracted.xy );
|
||
|
||
#if BAND_MODE == 2
|
||
y_ior = 1.0 + bandOffset * ( 1.0 + offsetValue );
|
||
c_ior = 1.0 + bandOffset * ( 3.0 + offsetValue );
|
||
v_ior = 1.0 + bandOffset * ( 5.0 + offsetValue );
|
||
|
||
y_refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor / y_ior );
|
||
c_refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor / c_ior );
|
||
v_refracted = refract( vec3( 0.0, 0.0, - 1.0 ), normal, baseIor / v_ior );
|
||
|
||
y_sample = texture2D( tDiffuse, vUv + y_refracted.xy );
|
||
c_sample = texture2D( tDiffuse, vUv + c_refracted.xy );
|
||
v_sample = texture2D( tDiffuse, vUv + v_refracted.xy );
|
||
|
||
r = r_sample.r / 2.0;
|
||
y = ( 2.0 * y_sample.r + 2.0 * y_sample.g - y_sample.b ) / 6.0;
|
||
g = g_sample.g / 2.0;
|
||
c = ( 2.0 * c_sample.g + 2.0 * c_sample.b - c_sample.r ) / 6.0;
|
||
b = b_sample.b / 2.0;
|
||
v = ( 2.0 * v_sample.b + 2.0 * v_sample.r - v_sample.g ) / 6.0;
|
||
|
||
color.r += r + ( 2.0 * v + 2.0 * y - c ) / 3.0;
|
||
color.g += g + ( 2.0 * y + 2.0 * c - v ) / 3.0;
|
||
color.b += b + ( 2.0 * c + 2.0 * v - y ) / 3.0;
|
||
#else
|
||
color.r += r_sample.r;
|
||
color.g += g_sample.g;
|
||
color.b += b_sample.b;
|
||
#endif
|
||
|
||
}
|
||
|
||
color /= float( CHROMA_SAMPLES );
|
||
|
||
#endif
|
||
|
||
gl_FragColor = vec4( color, 1.0 );
|
||
|
||
}
|
||
|
||
`})),{uniforms:vA}=mA;xT(i=>vA.baseIor.value=i);_T(i=>vA.bandOffset.value=i);var dF=!!window.safari;const gA=dF,Uc=(()=>{if(gA)return new S_(Sn());const i=new Yt(iv,rv,{samples:4});return mi(([e,t])=>i.setSize(e,t)),new S_(Sn(),i)})();Kt(()=>{Uc.renderer=Sn();const[i,e]=mi();Uc.setSize(i,e),Uc.setPixelRatio(Zc())},[Sn,mi,Zc]);Kt(()=>{const i=[Gx];PM()&&i.push(qx),dm()&&i.push(xd),u_()&&i.push(gd),CM()&&i.push(lF),xM()&&i.push(ib),AM()&&i.push(Ps),h_()&&i.push(mA),gA&&i.push(hF);for(const e of i)Uc.addPass(e);return()=>{for(const e of i)Uc.removePass(e)}},[PM,dm,u_,CM,xM,AM,h_]);async function pF(){const{Sphere:i,Cylinder:e,Vec3:t}=await pu(),{x:n,y:r}=El(this),s=n*.5,o=r*.5,l=new i(s),h=new i(s),d=new e(s,s,Math.abs(r-n));this.cannonBody.addShape(l,new t(0,-o+s,0)),this.cannonBody.addShape(h,new t(0,o-s,0)),this.cannonBody.addShape(d)}const LM=Math.PI*.5;class yA extends To{constructor(e){super(new ei),this._physicsShape=pF,this.updatePolarAngle=Mr(()=>this.gyrate(0,0),0,"trailing"),this._minPolarAngle=Bx*xn,this._maxPolarAngle=zx*xn,this.mouseControlState=new Tn(!1),this.camera=e,this.object3d.add(e),this.initCamera()}getRay(){return dT.set(this.camera.getWorldPosition(bo),this.camera.getWorldDirection(Ot))}append(e){this._append(e),this.camera.add(e.outerObject3d)}attach(e){this._append(e),this.camera.attach(e.outerObject3d)}get width(){return this.object3d.scale.x*pn}set width(e){const t=e*Ye;this.object3d.scale.x=t,this.camera.scale.x=1/t}get height(){return this.object3d.scale.y*pn}set height(e){const t=e*Ye;this.object3d.scale.y=t,this.camera.scale.y=1/t}get depth(){return this.object3d.scale.z*pn}set depth(e){const t=e*Ye;this.object3d.scale.z=t,this.camera.scale.z=1/t}lookAt(e){super.lookAt(e),this.rotationY+=180}_gyrate(e,t,n){const r=n?this.object3d:this.outerObject3d;Wi.setFromQuaternion(r.quaternion),Wi.y-=e*.002,Wi.x-=t*.002,Wi.x=Math.max(LM-this._maxPolarAngle,Math.min(LM-this._minPolarAngle,Wi.x)),r.setRotationFromEuler(Wi),!n&&this.physicsRotate()}gyrate(e,t){this.mouseControlMode==="orbit"?this._gyrate(e,t):(this._gyrate(e,0),this._gyrate(0,t,!0))}get minPolarAngle(){return this._minPolarAngle*pi}set minPolarAngle(e){this._minPolarAngle=e*xn,this.updatePolarAngle()}get maxPolarAngle(){return this._maxPolarAngle*pi}set maxPolarAngle(e){this._maxPolarAngle=e*xn,this.updatePolarAngle()}get mouseControl(){return this.mouseControlState.get()}set mouseControl(e){this.mouseControlState.set(e),!(!e||this.mouseControlInit)&&(this.mouseControlInit=!0,$n(()=>import("./enableMouseControl.d1106616.js"),["./enableMouseControl.d1106616.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(t=>t.default.call(this)))}getCenter(){return this.getWorldPosition()}}ks(yA,[aA]);const Lf=5.7,DM=(i,e)=>Math.abs(i*.5/Math.cos(e.fov*.6*xn));Kt(()=>{var i;const[e,t]=mi(),[n,r]=(i=Jc())!==null&&i!==void 0?i:mi(),s=Ze(),o=e/t;s instanceof fi&&!Kc()?(s.aspect=o,s.updateProjectionMatrix()):s instanceof ou&&([s.left,s.right,s.top,s.bottom]=[o*Lf*-.5,o*Lf*.5,Lf*.5,Lf*-.5],s.updateProjectionMatrix());const l={width:e,height:r-(n-e)*r/n},h={width:n-(r-t)*n/r,height:t},d=Math.min(e-l.width,t-l.height),f=Math.min(e-h.width,t-h.height);d>f?(bM(DM(n/o,bn)*Ye),Object.assign(Jh.style,{width:l.width+"px",height:l.height+"px"})):(bM(DM(r,bn)*Ye),Object.assign(Jh.style,{width:h.width+"px",height:h.height+"px"}))},[mi,Jc,Ze,Kc]);Kt(()=>{const i=Kc(),e=Ze(),t=Qc(),n=Sn();if(t){const[h,d]=mi(),f=h*1,g=d*.5;t.aspect=e.aspect=f/g,e.updateProjectionMatrix(),t.updateProjectionMatrix();const y=wi(()=>{Af(),n.setViewport(0,0,f,g),n.setScissor(0,0,f,g),n.setScissorTest(!0),n.render($e,t),n.setViewport(0,g,f,g),n.setScissor(0,g,f,g),n.render($e,e),Cf()});return()=>{y.cancel(),n.setViewport(0,0,h,d),n.setScissor(0,0,h,d),n.setScissorTest(!1),e.aspect=h/d,e.updateProjectionMatrix()}}if(Kh()==="speed"||i==="webxr"){const h=wi(()=>{Af(),n.render($e,e),Cf()});return()=>{h.cancel()}}if(i){const h=new dv;h.scale=.5,h.visible=!1;const d=1e3,f=-d*.5,[g,y]=mi(),_=g*.5,w=y*1;e.aspect=_/w,e.updateProjectionMatrix();const S=new Sa(e),b=wi(()=>{Af(),n.setViewport(0,0,_,w),n.setScissor(0,0,_,w),n.setScissorTest(!0),h.outerObject3d.position.copy(e.getWorldPosition(Ot)),h.outerObject3d.quaternion.copy(e.quaternion),h.translateZ(-d);const T=h.outerObject3d.position.clone(),E=e.quaternion.clone(),C=e.position.clone();h.moveRight(f),S.moveRight(-3),e.lookAt(h.outerObject3d.position),n.render($e,e),h.outerObject3d.position.copy(T),e.quaternion.copy(E),e.position.copy(C),n.setViewport(_,0,_,w),n.setScissor(_,0,_,w),h.moveRight(-f),S.moveRight(3),e.lookAt(h.outerObject3d.position),n.render($e,e),h.outerObject3d.position.copy(T),e.quaternion.copy(E),e.position.copy(C),Cf()});return()=>{h.dispose(),b.cancel(),n.setViewport(0,0,g,y),n.setScissor(0,0,g,y),n.setScissorTest(!1),e.aspect=g/y,e.updateProjectionMatrix()}}let r=!1,s=!1,o=!1;const l=wi(()=>{Af(),BT[0]&&(r||(sF(!0),r=!0),vU()),UT[0]&&!s&&(oF(!0),s=!0),VT[0]&&!o&&(rF(!0),o=!0),Uc.render(),Cf()});return()=>{l.cancel()}},[Kh,Kc,Ze,Qc,mi,Sn]);async function fF(){const{Sphere:i}=await pu(),e=new i(El(this).x*.5);this.cannonBody.addShape(e)}const mF=new Km(xo,16,16);class sb extends Br{constructor(){super(mF),this._physicsShape=fF}}sb.componentName="sphere";const vF=new _x(xo,br,16);class _A extends Br{constructor(){super(vF)}}_A.componentName="cone";async function gF(){const{Cylinder:i}=await pu(),{x:e,y:t}=El(this),n=e*.5,r=new i(n,n,t);this.cannonBody.addShape(r)}const yF=new Xm(xo,xo,br,16);class ob extends Br{constructor(){super(yF),this._physicsShape=gF}}ob.componentName="cylinder";const _F=new Zm(xo);class xA extends Br{constructor(){super(_F)}}xA.componentName="octahedron";const _v=new bx(61*Ye);_v.rotateY(45*xn);_v.rotateX(125*xn);_v.translate(0,-.2,.2);class bA extends Br{constructor(){super(_v)}}bA.componentName="tetrahedron";async function xF(){const{Box:i,Vec3:e}=await pu(),t=El(this),n=t.clone().multiply(Ot.set(.15,.5,.1)),r=t.clone().multiply(bo.set(.5,.15,.1)),s=new i(n),o=new i(r);this.cannonBody.addShape(s,new e(-r.x,0,0)),this.cannonBody.addShape(s,new e(r.x,0,0)),this.cannonBody.addShape(o,new e(0,-n.y,0)),this.cannonBody.addShape(o,new e(0,n.y,0))}const bF=new wx(40*Ye,10*Ye,8,16);class wA extends Br{constructor(){super(bF),this._physicsShape=xF}}wA.componentName="torus";const SA=Me({},uv),MA=bt(Me({},hv),{scaleZ:0,depth:0}),wF=new ld(br,br,1,1);class bd extends Br{constructor(){super(wF,!0),this.object3d.scale.z=j2}get depth(){return 0}set depth(e){}get scaleZ(){return 0}set scaleZ(e){}}bd.componentName="plane";bd.defaults=MA;bd.schema=SA;async function SF(){const{Sphere:i}=await pu();this.cannonBody.addShape(new i(El(this).x*.5))}const MF=Me({},uv),EF=bt(Me({},hv),{scaleZ:0,depth:0}),TF=new yx(xo,32);class xv extends Br{constructor(){super(TF,!0),this._physicsShape=SF,this.object3d.scale.z=j2}get depth(){return 0}set depth(e){}get scaleZ(){return 0}set scaleZ(e){}}xv.componentName="circle";xv.defaults=EF;xv.schema=MF;const EA=[],tl=new Pe,Df=new Pe;let IM="",OM="";const AF=()=>{var i;return(i=EA.pop())!==null&&i!==void 0?i:new CF},L_=new Set;wi(()=>{for(const i of L_)i.update()});class CF{constructor(){this.material=new ud,this.sprite=new ux(this.material)}init(e,t,n,r=n,s,o=s,l,h=l,d,f,g,y,_,w,S,b,T,E){L_.add(this),this.material.map=e,t?Wx(this.sprite):jx(this.sprite),this.accelX=y*Ye,this.accelY=_*Ye,this.accelZ=w*Ye,this.speedX=S*Ye,this.speedY=b*Ye,this.speedZ=T*Ye,this.lifeTime=E,this.startTime=Date.now(),$e.add(this.sprite),this.scaleStart=this.sprite.scale.x=this.sprite.scale.y=n*Ye,this.sizeRange=(r-n)*Ye,this.opacityStart=this.material.opacity=s,this.opacityRange=o-s,l!==IM&&(IM=l,tl.set(l)),OM!==h&&(OM=h,Df.set(h)),this.rStart=this.material.color.r=tl.r,this.rRange=Df.r-tl.r,this.gStart=this.material.color.g=tl.g,this.gRange=Df.g-tl.g,this.bStart=this.material.color.b=tl.b,this.bRange=Df.b-tl.b,this.sprite.position.set(d,f,g)}update(){const e=Date.now()-this.startTime;if(e>this.lifeTime){this.dispose();return}this.sprite.position.x+=this.speedX+=this.accelX,this.sprite.position.y+=this.speedY+=this.accelY,this.sprite.position.z+=this.speedZ+=this.accelZ;const t=e/this.lifeTime,n=t*this.sizeRange;this.sprite.scale.x=this.sprite.scale.y=this.scaleStart+n;const r=t*this.opacityRange;this.material.opacity=this.opacityStart+r;const s=t*this.rRange;this.material.color.r=this.rStart+s;const o=t*this.gRange;this.material.color.g=this.gStart+o;const l=t*this.bRange;this.material.color.b=this.bStart+l}dispose(){$e.remove(this.sprite),L_.delete(this),EA.push(this)}}var PF="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAErklEQVRoQ92aiZNUNRDGu9NJRgUKESguFZQVEFg5ZAWLv9+SZZH7dhEQQSxEpcDjJem09Y1vqGFh2cNZljepSqVezZskv/elO52DacTJzISIekMZz0hKRM0gMzOeR5Z4FDWZ2Xoi2kRE60opa4noXWYGTCAi17ZRiSibGWD+9t4/I6KnRPQrMz/5v/1YNoiZRSLaTkSbSykba63vA6jWutbM3oMizPwCiJllKMLMfznnngHAOfeH9/4xET0iogfMnJYDtWQQM0PnPi6lbKu1bjWzzaq6ycw2ENF6M1tba10DEMAyc18RM6ttJxvn3J/MDEWeMPPvIgJVHjnnHnrvfyaiH5kZ0ItOSwIxs22ASCl9ZGbbVRUgW2qtAPmgVWWdma0xs3faoTVsI5mZ/2FmgDyFGsz8m3MOIL+IyENmfhBjvNfCAGpRaVEgrQFPlFI+UdWdqgqQHaq6vda6BarUWjeaGexi0YmZoc7jVg2AYGjdF5F7InLXe3+biGYX4xgWBGm/7L6U0oSZAWRXKWVnrfXDWusOqLHonr/mRajinLvvnPvJe39XRO4w8+0Y4ywRXYeSr2vntSAYIkS0P6W0p9Y6kXPeDZhSyi6AjAJgbh0tSB8ihHDLOTcbY7xJRFcxJOdrc16QVonJnPO+nPNeVd2jqhO11k9rrXC3K5acc/BmP4jIrIjcDCHcCCFcJ6JL8ynzSpDWJiZTSgdKKZ+r6j5VBcxnS7WD5dLCfkTkexG5ISLXvffXYoxXWpiXJtP5QPamlCZrrQdyzgdUtQ9jZn65HVvO/5i5AEJEroUQrjjnrsQYocqNufW9BAIXW0o5pKpQZFJVD6rq/jelxEsd/E+ZqyJyGRAicsl7f4GZX3DNL4C0k93RpmkOq+oXpRRkKLOiNrGQWrAZ7z0ALorIxV6vd56Izg5PmnNBdqeUjpRSDrf50Ep5p4U6P483u+C9P48cYzzHzLcG7z0HQThRSvlKVY+WUo7knAF0aKkNruT7GFIhhHPe+3MictZ7f3oQmw2D7EopHSulAORLlKOa7EYFh0nTew+A71DGGM8w8x3UPwwy1TQNQI7lnAHyVqkx+BitKgA50+v1ADLzHAThdynl65TSlKr2YRBHjepLjrIexGOAEJEzMcYZ7/23WA70FTEzGPlUzhk2gnJqtdztQtCYKEMIMyIyE0I4DRgY/QDkcNM0x2HsgCmlHFyowtX83Xt/GRAw9l6vN83M5xnhCIZVzvm4qgIE5c7V7OhCbSPEDyFMi8hplP3hhWVpKeVkSulEKQWqHH/bvNUr5hR4LwBMxxhPee+/AcgGVT3ZNE0fJOd8AsvVhb7Kav6OZXIIAQDTvV7vlIj0QbaqKjzWiYEqb6uhP5/FmZuBGlBERPpDC0vWPgTUaBV5o1HuUtVFVAxFkFuQU2MFMjZDa2yMfWzc73hMiG2s1f0QZdyCxvEI41tVur+wakHGZqk7HpsPQ0bf7e2gFgSnUd3foGthur9lOginzaz7m9itKjj36/6xQguDw8xuH/QMDbHuH70NwUCZbh+GDsHAZrp9PD28MdD5CwNzYLp/hWMOULcv1bxqD6rT15zm21RbrYtn/wLboDECn0+AWAAAAABJRU5ErkJggg==";const RF=oT.load(PF),uh=(i,e)=>Uy(i-e,i+e);class LF extends dv{constructor(){super(),this.speed=0,this.speedRange=.5,this.accel=0,this.accelRange=0,this.lifeTime=500,this.lifeTimeRange=0,this.spread=0,this.size=20,this.sizeRange=0,this.opacityRange=0,this._frequency=50,this.width=this.height=this.depth=20,this.object3d.visible=!1,this.start()}get frequency(){return this._frequency}set frequency(e){this._frequency=e,this.handle&&this.start()}start(){var e;(e=this.handle)===null||e===void 0||e.cancel(),this.handle=this.timer(1e3/this._frequency,-1,()=>{const[,,,,t,n,r]=this.outerObject3d.matrixWorld.elements,s=uh(this.speed,this.speedRange),[o,l,h]=[s*t,s*n,s*r],d=uh(this.accel,this.accelRange),[f,g,y]=[d*t,d*n,d*r],_=uh(this.size,this.sizeRange),w=uh(this.opacity,this.opacityRange);this.outerObject3d.getWorldPosition(Ot),AF().init(RF,this.bloom,_,this.sizeEnd,w,this.opacityEnd,this.color,this.colorEnd,Ot.x,Ot.y,Ot.z,f,g,y,o+Uy(-this.spread,this.spread),l,h+Uy(-this.spread,this.spread),uh(this.lifeTime,this.lifeTimeRange))})}stop(){var e;(e=this.handle)===null||e===void 0||e.cancel(),this.handle=void 0}}LF.componentName="particleSystem";var TA=i=>{const e=new z;return Yc.setFromObject(i).getSize(e),e};const kM=new Map;var AA=(i,e)=>{const t=kM.get(e);if(t){const[l,h,d]=t;return i.scale.multiplyScalar(l),i.position.copy(h).multiplyScalar(-1),d}const n=TA(i),r=1/n.y;i.scale.multiplyScalar(r);const s=fd(i);i.position.copy(s).multiplyScalar(-1);const o=n.multiplyScalar(r);return kM.set(e,[r,s.clone(),o.clone()]),o};const CA=bt(Me({},Tl),{src:String,onLoad:Function,boxVisible:Boolean}),PA=bt(Me({},fu),{boxVisible:!1}),ab=bt(Me({},CA),{loadedScale:Number,loadedX:Number,loadedY:Number,loadedZ:Number}),lb=Me({},PA),DF=yl(()=>$n(()=>import("./loadFBX.48a4f065.js"),["./loadFBX.48a4f065.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url)),IF=yl(()=>$n(()=>import("./loadGLTF.b3d28cab.js"),["./loadGLTF.b3d28cab.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url));class Ao extends pv{async loadAnimation(e,t=e){var n,r;((n=this.loadedAnims)!==null&&n!==void 0?n:this.loadedAnims={})[t]=e;const s=new Fc;((r=this.loadingAnims)!==null&&r!==void 0?r:this.loadingAnims=[]).push(s);let o;try{o=await this.load(e)}catch{s.resolve();return}const l=o.animations[0];l&&(this.animations[t]=this.watch(new $h(l,await this.loadedResolvable))),s.resolve()}get animations(){var e;return(e=this.animationManagers)!==null&&e!==void 0?e:this.animationManagers={}}set animations(e){for(const[t,n]of Object.entries(e))typeof n=="string"?this.loadAnimation(n,t):this.animations[t]=n}async load(e){var t;const n=new Fc;((t=this.loadingAnims)!==null&&t!==void 0?t:this.loadingAnims=[]).push(n);let r;try{JT[0](e).toLowerCase().endsWith(".fbx")?r=await(await DF()).default(e,!0):r=await(await IF()).default(e,!0)}catch{return n.resolve(),new ei}return n.resolve(),r}get loadedScale(){return this._loadedScale}set loadedScale(e){this._loadedScale=e}get loadedX(){return this._loadedX}set loadedX(e){this._loadedX=e,this._loadedPos=!0}get loadedY(){return this._loadedY}set loadedY(e){this._loadedY=e,this._loadedPos=!0}get loadedZ(){return this._loadedZ}set loadedZ(e){this._loadedZ=e,this._loadedPos=!0}resolveLoaded(e){for(const t of e.animations)this.animations[t.name]=this.watch(new $h(t,e));if(this._loadedScale)e.scale.multiplyScalar(this._loadedScale);else{const t=AA(e,this._src);!this.widthSet&&(this.object3d.scale.x=t.x),!this.heightSet&&(this.object3d.scale.y=t.y),!this.depthSet&&(this.object3d.scale.z=t.z)}if(this._loadedPos){let{x:t,y:n,z:r}=e.position;this._loadedX&&(t=this._loadedX*Ye),this._loadedY&&(n=this._loadedY*Ye),this._loadedZ&&(r=this._loadedZ*Ye),e.position.set(t,n,r)}this.loadedGroup.add(e),this.loadedResolvable.resolve(e)}find(e,t){const n=super.find(e,t);return n&&(n.model=this),n}findAll(e){const t=super.findAll(e);for(const n of t)n.model=this;return t}}Ao.componentName="model";Ao.defaults=lb;Ao.schema=ab;/*! *****************************************************************************
|
||
Copyright (c) Microsoft Corporation.
|
||
|
||
Permission to use, copy, modify, and/or distribute this software for any
|
||
purpose with or without fee is hereby granted.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
PERFORMANCE OF THIS SOFTWARE.
|
||
***************************************************************************** */var Fe=function(){return Fe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Fe.apply(this,arguments)};function cb(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t}function Qt(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],n=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function on(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var n=t.call(i),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)s.push(r.value)}catch(l){o={error:l}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return s}function Vn(i,e,t){if(t||arguments.length===2)for(var n=0,r=e.length,s;n<r;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return i.concat(s||Array.prototype.slice.call(e))}var mn;(function(i){i.Start="xstate.start",i.Stop="xstate.stop",i.Raise="xstate.raise",i.Send="xstate.send",i.Cancel="xstate.cancel",i.NullEvent="",i.Assign="xstate.assign",i.After="xstate.after",i.DoneState="done.state",i.DoneInvoke="done.invoke",i.Log="xstate.log",i.Init="xstate.init",i.Invoke="xstate.invoke",i.ErrorExecution="error.execution",i.ErrorCommunication="error.communication",i.ErrorPlatform="error.platform",i.ErrorCustom="xstate.error",i.Update="xstate.update",i.Pure="xstate.pure",i.Choose="xstate.choose"})(mn||(mn={}));var ed;(function(i){i.Parent="#_parent",i.Internal="#_internal"})(ed||(ed={}));var D_=mn.Start,ub=mn.Stop,bv=mn.Raise,wv=mn.Send,RA=mn.Cancel,OF=mn.NullEvent,NM=mn.Assign;mn.After;mn.DoneState;var LA=mn.Log,kF=mn.Init,I_=mn.Invoke;mn.ErrorExecution;var BM=mn.ErrorPlatform,NF=mn.ErrorCustom,DA=mn.Update,BF=mn.Choose,zF=mn.Pure,IA=".",zM={},O_="xstate.guard",UF="",Py;function hb(i,e,t){t===void 0&&(t=IA);var n=Th(i,t),r=Th(e,t);return an(r)?an(n)?r===n:!1:an(n)?n in r:Object.keys(n).every(function(s){return s in r?hb(n[s],r[s]):!1})}function OA(i){try{return an(i)||typeof i=="number"?"".concat(i):i.type}catch{throw new Error("Events must be strings or objects with a string event.type property.")}}function k_(i,e){try{return mu(i)?i:i.toString().split(e)}catch{throw new Error("'".concat(i,"' is not a valid state path."))}}function FF(i){return typeof i=="object"&&"value"in i&&"context"in i&&"event"in i&&"_event"in i}function Th(i,e){if(FF(i))return i.value;if(mu(i))return xm(i);if(typeof i!="string")return i;var t=k_(i,e);return xm(t)}function xm(i){if(i.length===1)return i[0];for(var e={},t=e,n=0;n<i.length-1;n++)n===i.length-2?t[i[n]]=i[n+1]:(t[i[n]]={},t=t[i[n]]);return e}function mh(i,e){for(var t={},n=Object.keys(i),r=0;r<n.length;r++){var s=n[r];t[s]=e(i[s],s,i,r)}return t}function UM(i,e,t){var n,r,s={};try{for(var o=Qt(Object.keys(i)),l=o.next();!l.done;l=o.next()){var h=l.value,d=i[h];t(d)&&(s[h]=e(d,h,i))}}catch(f){n={error:f}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}var VF=function(i){return function(e){var t,n,r=e;try{for(var s=Qt(i),o=s.next();!o.done;o=s.next()){var l=o.value;r=r[l]}}catch(h){t={error:h}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r}};function HF(i,e){return function(t){var n,r,s=t;try{for(var o=Qt(i),l=o.next();!l.done;l=o.next()){var h=l.value;s=s[e][h]}}catch(d){n={error:d}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}}function Wf(i){if(!i)return[[]];if(an(i))return[[i]];var e=Rn(Object.keys(i).map(function(t){var n=i[t];return typeof n!="string"&&(!n||!Object.keys(n).length)?[[t]]:Wf(i[t]).map(function(r){return[t].concat(r)})}));return e}function Rn(i){var e;return(e=[]).concat.apply(e,Vn([],on(i),!1))}function kA(i){return mu(i)?i:[i]}function ns(i){return i===void 0?[]:kA(i)}function bm(i,e,t){var n,r;if(fn(i))return i(e,t.data);var s={};try{for(var o=Qt(Object.keys(i)),l=o.next();!l.done;l=o.next()){var h=l.value,d=i[h];fn(d)?s[h]=d(e,t.data):s[h]=d}}catch(f){n={error:f}}finally{try{l&&!l.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}function GF(i){return/^(done|error)\./.test(i)}function FM(i){return!!(i instanceof Promise||i!==null&&(fn(i)||typeof i=="object")&&fn(i.then))}function WF(i){return i!==null&&typeof i=="object"&&"transition"in i&&typeof i.transition=="function"}function NA(i,e){var t,n,r=on([[],[]],2),s=r[0],o=r[1];try{for(var l=Qt(i),h=l.next();!h.done;h=l.next()){var d=h.value;e(d)?s.push(d):o.push(d)}}catch(f){t={error:f}}finally{try{h&&!h.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}return[s,o]}function BA(i,e){return mh(i.states,function(t,n){if(t){var r=(an(e)?void 0:e[n])||(t?t.current:void 0);if(r)return{current:r,states:BA(t,r)}}})}function jF(i,e){return{current:e,states:BA(i,e)}}function VM(i,e,t,n){var r=i&&t.reduce(function(s,o){var l,h,d=o.assignment,f={state:n,action:o,_event:e},g={};if(fn(d))g=d(s,e.data,f);else try{for(var y=Qt(Object.keys(d)),_=y.next();!_.done;_=y.next()){var w=_.value,S=d[w];g[w]=fn(S)?S(s,e.data,f):S}}catch(b){l={error:b}}finally{try{_&&!_.done&&(h=y.return)&&h.call(y)}finally{if(l)throw l.error}}return Object.assign({},s,g)},i);return r}var XF=function(){};function mu(i){return Array.isArray(i)}function fn(i){return typeof i=="function"}function an(i){return typeof i=="string"}function zA(i,e){if(i)return an(i)?{type:O_,name:i,predicate:e?e[i]:void 0}:fn(i)?{type:O_,name:i.name,predicate:i}:i}function qF(i){try{return"subscribe"in i&&fn(i.subscribe)}catch{return!1}}var da=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();Py={},Py[da]=function(){return this},Py[Symbol.observable]=function(){return this};function nu(i){return!!i&&"__xstatenode"in i}function YF(i){return!!i&&typeof i.send=="function"}function db(i,e){return an(i)||typeof i=="number"?Fe({type:i},e):i}function Ri(i,e){if(!an(i)&&"$$type"in i&&i.$$type==="scxml")return i;var t=db(i);return Fe({name:t.type,data:t,$$type:"scxml",type:"external"},e)}function Cc(i,e){var t=kA(e).map(function(n){return typeof n>"u"||typeof n=="string"||nu(n)?{target:n,event:i}:Fe(Fe({},n),{event:i})});return t}function ZF(i){if(!(i===void 0||i===UF))return ns(i)}function UA(i,e,t,n,r){var s=i.options.guards,o={state:r,cond:e,_event:n};if(e.type===O_)return((s==null?void 0:s[e.name])||e.predicate)(t,n.data,o);var l=s==null?void 0:s[e.type];if(!l)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(i.id,"'."));return l(t,n.data,o)}function FA(i){return typeof i=="string"?{type:i}:i}function N_(i,e,t){if(typeof i=="object")return i;var n=function(){};return{next:i,error:e||n,complete:t||n}}function If(i,e){return"".concat(i,":invocation[").concat(e,"]")}var wm=Ri({type:kF});function B_(i,e){return e&&e[i]||void 0}function td(i,e){var t;if(an(i)||typeof i=="number"){var n=B_(i,e);fn(n)?t={type:i,exec:n}:n?t=n:t={type:i,exec:void 0}}else if(fn(i))t={type:i.name||i.toString(),exec:i};else{var n=B_(i.type,e);if(fn(n))t=Fe(Fe({},i),{exec:n});else if(n){var r=n.type||i.type;t=Fe(Fe(Fe({},n),i),{type:r})}else t=i}return t}var Sm=function(i,e){if(!i)return[];var t=mu(i)?i:[i];return t.map(function(n){return td(n,e)})};function pb(i){var e=td(i);return Fe(Fe({id:an(i)?i:e.id},e),{type:e.type})}function KF(i){return an(i)?{type:bv,event:i}:VA(i,{to:ed.Internal})}function JF(i){return{type:bv,_event:Ri(i.event)}}function VA(i,e){return{to:e?e.to:void 0,type:wv,event:fn(i)?i:db(i),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:fn(i)?i.name:OA(i)}}function QF(i,e,t,n){var r={_event:t},s=Ri(fn(i.event)?i.event(e,t.data,r):i.event),o;if(an(i.delay)){var l=n&&n[i.delay];o=fn(l)?l(e,t.data,r):l}else o=fn(i.delay)?i.delay(e,t.data,r):i.delay;var h=fn(i.to)?i.to(e,t.data,r):i.to;return Fe(Fe({},i),{to:h,_event:s,event:s.data,delay:o})}var $F=function(i,e,t){return Fe(Fe({},i),{value:an(i.expr)?i.expr:i.expr(e,t.data,{_event:t})})},eV=function(i){return{type:RA,sendId:i}};function tV(i){var e=pb(i);return{type:mn.Start,activity:e,exec:void 0}}function nV(i){var e=fn(i)?i:pb(i);return{type:mn.Stop,activity:e,exec:void 0}}function iV(i,e,t){var n=fn(i.activity)?i.activity(e,t.data):i.activity,r=typeof n=="string"?{id:n}:n,s={type:mn.Stop,activity:r};return s}function rV(i,e){var t=e?"#".concat(e):"";return"".concat(mn.After,"(").concat(i,")").concat(t)}function Of(i,e){var t="".concat(mn.DoneState,".").concat(i),n={type:t,data:e};return n.toString=function(){return t},n}function jf(i,e){var t="".concat(mn.DoneInvoke,".").concat(i),n={type:t,data:e};return n.toString=function(){return t},n}function vh(i,e){var t="".concat(mn.ErrorPlatform,".").concat(i),n={type:t,data:e};return n.toString=function(){return t},n}function z_(i,e,t,n,r,s){s===void 0&&(s=!1);var o=on(s?[[],r]:NA(r,function(y){return y.type===NM}),2),l=o[0],h=o[1],d=l.length?VM(t,n,l,e):t,f=s?[t]:void 0,g=Rn(h.map(function(y){var _;switch(y.type){case bv:return JF(y);case wv:var w=QF(y,d,n,i.options.delays);return w;case LA:return $F(y,d,n);case BF:{var S=y,b=(_=S.conds.find(function(j){var G=zA(j.cond,i.options.guards);return!G||UA(i,G,d,n,e)}))===null||_===void 0?void 0:_.actions;if(!b)return[];var T=on(z_(i,e,d,n,Sm(ns(b),i.options.actions),s),2),E=T[0],C=T[1];return d=C,f==null||f.push(d),E}case zF:{var b=y.get(d,n.data);if(!b)return[];var A=on(z_(i,e,d,n,Sm(ns(b),i.options.actions),s),2),D=A[0],I=A[1];return d=I,f==null||f.push(d),D}case ub:return iV(y,d,n);case NM:{d=VM(d,n,[y],e),f==null||f.push(d);break}default:var F=td(y,i.options.actions),P=F.exec;if(P&&f){var k=f.length-1;F=Fe(Fe({},F),{exec:function(j){for(var G=[],ne=1;ne<arguments.length;ne++)G[ne-1]=arguments[ne];P.apply(void 0,Vn([f[k]],on(G),!1))}})}return F}}).filter(function(y){return!!y}));return[g,d]}var gh=function(i,e){var t=e(i);return t};function HA(i){var e;return e={id:i,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},getSnapshot:function(){},toJSON:function(){return{id:i}}},e[da]=function(){return this},e}function sV(i,e,t,n){var r,s=FA(i.src),o=(r=e==null?void 0:e.options.services)===null||r===void 0?void 0:r[s.type],l=i.data?bm(i.data,t,n):void 0,h=o?oV(o,i.id,l):HA(i.id);return h.meta=i,h}function oV(i,e,t){var n=HA(e);if(n.deferred=!0,nu(i)){var r=n.state=gh(void 0,function(){return(t?i.withContext(t):i).initialState});n.getSnapshot=function(){return r}}return n}function aV(i){try{return typeof i.send=="function"}catch{return!1}}function lV(i){return aV(i)&&"id"in i}function cV(i){var e;return Fe((e={subscribe:function(){return{unsubscribe:function(){}}},id:"anonymous",getSnapshot:function(){}},e[da]=function(){return this},e),i)}var Mm=function(i){return i.type==="atomic"||i.type==="final"};function iu(i){return Object.keys(i.states).map(function(e){return i.states[e]}).filter(function(e){return e.type!=="history"})}function GA(i){var e=[i];return Mm(i)?e:e.concat(Rn(iu(i).map(GA)))}function Dc(i,e){var t,n,r,s,o,l,h,d,f=new Set(i),g=U_(f),y=new Set(e);try{for(var _=Qt(y),w=_.next();!w.done;w=_.next())for(var S=w.value,b=S.parent;b&&!y.has(b);)y.add(b),b=b.parent}catch(k){t={error:k}}finally{try{w&&!w.done&&(n=_.return)&&n.call(_)}finally{if(t)throw t.error}}var T=U_(y);try{for(var E=Qt(y),C=E.next();!C.done;C=E.next()){var S=C.value;if(S.type==="compound"&&(!T.get(S)||!T.get(S).length))g.get(S)?g.get(S).forEach(function(j){return y.add(j)}):S.initialStateNodes.forEach(function(j){return y.add(j)});else if(S.type==="parallel")try{for(var A=(o=void 0,Qt(iu(S))),D=A.next();!D.done;D=A.next()){var I=D.value;y.has(I)||(y.add(I),g.get(I)?g.get(I).forEach(function(j){return y.add(j)}):I.initialStateNodes.forEach(function(j){return y.add(j)}))}}catch(j){o={error:j}}finally{try{D&&!D.done&&(l=A.return)&&l.call(A)}finally{if(o)throw o.error}}}}catch(k){r={error:k}}finally{try{C&&!C.done&&(s=E.return)&&s.call(E)}finally{if(r)throw r.error}}try{for(var F=Qt(y),P=F.next();!P.done;P=F.next())for(var S=P.value,b=S.parent;b&&!y.has(b);)y.add(b),b=b.parent}catch(k){h={error:k}}finally{try{P&&!P.done&&(d=F.return)&&d.call(F)}finally{if(h)throw h.error}}return y}function WA(i,e){var t=e.get(i);if(!t)return{};if(i.type==="compound"){var n=t[0];if(n){if(Mm(n))return n.key}else return{}}var r={};return t.forEach(function(s){r[s.key]=WA(s,e)}),r}function U_(i){var e,t,n=new Map;try{for(var r=Qt(i),s=r.next();!s.done;s=r.next()){var o=s.value;n.has(o)||n.set(o,[]),o.parent&&(n.has(o.parent)||n.set(o.parent,[]),n.get(o.parent).push(o))}}catch(l){e={error:l}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n}function uV(i,e){var t=Dc([i],e);return WA(i,U_(t))}function Xf(i,e){return Array.isArray(i)?i.some(function(t){return t===e}):i instanceof Set?i.has(e):!1}function hV(i){return Vn([],on(new Set(Rn(Vn([],on(i.map(function(e){return e.ownEvents})),!1)))),!1)}function Ah(i,e){return e.type==="compound"?iu(e).some(function(t){return t.type==="final"&&Xf(i,t)}):e.type==="parallel"?iu(e).every(function(t){return Ah(i,t)}):!1}function dV(i){return i===void 0&&(i=[]),i.reduce(function(e,t){return t.meta!==void 0&&(e[t.id]=t.meta),e},{})}function HM(i){return new Set(Rn(i.map(function(e){return e.tags})))}function jA(i,e){if(i===e)return!0;if(i===void 0||e===void 0)return!1;if(an(i)||an(e))return i===e;var t=Object.keys(i),n=Object.keys(e);return t.length===n.length&&t.every(function(r){return jA(i[r],e[r])})}function pV(i){return typeof i!="object"||i===null?!1:"value"in i&&"_event"in i}function fV(i,e){var t=i.exec,n=Fe(Fe({},i),{exec:t!==void 0?function(){return t(e.context,e.event,{action:i,state:e,_event:e._event})}:void 0});return n}var po=function(){function i(e){var t=this,n;this.actions=[],this.activities=zM,this.meta={},this.events=[],this.value=e.value,this.context=e.context,this._event=e._event,this._sessionid=e._sessionid,this.event=this._event.data,this.historyValue=e.historyValue,this.history=e.history,this.actions=e.actions||[],this.activities=e.activities||zM,this.meta=dV(e.configuration),this.events=e.events||[],this.matches=this.matches.bind(this),this.toStrings=this.toStrings.bind(this),this.configuration=e.configuration,this.transitions=e.transitions,this.children=e.children,this.done=!!e.done,this.tags=(n=Array.isArray(e.tags)?new Set(e.tags):e.tags)!==null&&n!==void 0?n:new Set,this.machine=e.machine,Object.defineProperty(this,"nextEvents",{get:function(){return hV(t.configuration)}})}return i.from=function(e,t){if(e instanceof i)return e.context!==t?new i({value:e.value,context:t,_event:e._event,_sessionid:null,historyValue:e.historyValue,history:e.history,actions:[],activities:e.activities,meta:{},events:[],configuration:[],transitions:[],children:{}}):e;var n=wm;return new i({value:e,context:t,_event:n,_sessionid:null,historyValue:void 0,history:void 0,actions:[],activities:void 0,meta:void 0,events:[],configuration:[],transitions:[],children:{}})},i.create=function(e){return new i(e)},i.inert=function(e,t){if(e instanceof i){if(!e.actions.length)return e;var n=wm;return new i({value:e.value,context:t,_event:n,_sessionid:null,historyValue:e.historyValue,history:e.history,activities:e.activities,configuration:e.configuration,transitions:[],children:{}})}return i.from(e,t)},i.prototype.toStrings=function(e,t){var n=this;if(e===void 0&&(e=this.value),t===void 0&&(t="."),an(e))return[e];var r=Object.keys(e);return r.concat.apply(r,Vn([],on(r.map(function(s){return n.toStrings(e[s],t).map(function(o){return s+t+o})})),!1))},i.prototype.toJSON=function(){var e=this;e.configuration,e.transitions;var t=e.tags;e.machine;var n=cb(e,["configuration","transitions","tags","machine"]);return Fe(Fe({},n),{tags:Array.from(t)})},i.prototype.matches=function(e){return hb(e,this.value)},i.prototype.hasTag=function(e){return this.tags.has(e)},i.prototype.can=function(e){var t;XF(!!this.machine);var n=(t=this.machine)===null||t===void 0?void 0:t.getTransitionData(this,e);return!!(n!=null&&n.transitions.length)&&n.transitions.some(function(r){return r.target!==void 0||r.actions.length})},i}(),mV={deferEvents:!1},GM=function(){function i(e){this.processingEvent=!1,this.queue=[],this.initialized=!1,this.options=Fe(Fe({},mV),e)}return i.prototype.initialize=function(e){if(this.initialized=!0,e){if(!this.options.deferEvents){this.schedule(e);return}this.process(e)}this.flushEvents()},i.prototype.schedule=function(e){if(!this.initialized||this.processingEvent){this.queue.push(e);return}if(this.queue.length!==0)throw new Error("Event queue should be empty when it is not processing events");this.process(e),this.flushEvents()},i.prototype.clear=function(){this.queue=[]},i.prototype.flushEvents=function(){for(var e=this.queue.shift();e;)this.process(e),e=this.queue.shift()},i.prototype.process=function(e){this.processingEvent=!0;try{e()}catch(t){throw this.clear(),t}finally{this.processingEvent=!1}},i}(),Ry=new Map,vV=0,kf={bookId:function(){return"x:".concat(vV++)},register:function(i,e){return Ry.set(i,e),i},get:function(i){return Ry.get(i)},free:function(i){Ry.delete(i)}};function fb(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function gV(){var i=fb();if(i&&"__xstate__"in i)return i.__xstate__}function yV(i){if(fb()){var e=gV();e&&e.register(i)}}function _V(i,e){e===void 0&&(e={});var t=i.initialState,n=new Set,r=[],s=!1,o=function(){if(!s){for(s=!0;r.length>0;){var d=r.shift();t=i.transition(t,d,h),n.forEach(function(f){return f.next(t)})}s=!1}},l=cV({id:e.id,send:function(d){r.push(d),o()},getSnapshot:function(){return t},subscribe:function(d,f,g){var y=N_(d,f,g);return n.add(y),y.next(t),{unsubscribe:function(){n.delete(y)}}}}),h={parent:e.parent,self:l,id:e.id||"anonymous",observers:n};return t=i.start?i.start(h):t,l}var xV={sync:!1,autoForward:!1},Vi;(function(i){i[i.NotStarted=0]="NotStarted",i[i.Running=1]="Running",i[i.Stopped=2]="Stopped"})(Vi||(Vi={}));var bV=function(){function i(e,t){var n=this;t===void 0&&(t=i.defaultOptions),this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=Vi.NotStarted,this.children=new Map,this.forwardTo=new Set,this.init=this.start,this.send=function(f,g){if(mu(f))return n.batch(f),n.state;var y=Ri(db(f,g));if(n.status===Vi.Stopped)return n.state;if(n.status!==Vi.Running&&!n.options.deferEvents)throw new Error('Event "'.concat(y.name,'" was sent to uninitialized service "').concat(n.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.
|
||
Event: `).concat(JSON.stringify(y.data)));return n.scheduler.schedule(function(){n.forward(y);var _=n.nextState(y);n.update(_,y)}),n._state},this.sendTo=function(f,g){var y=n.parent&&(g===ed.Parent||n.parent.id===g),_=y?n.parent:an(g)?n.children.get(g)||kf.get(g):YF(g)?g:void 0;if(!_){if(!y)throw new Error("Unable to send event to child '".concat(g,"' from service '").concat(n.id,"'."));return}"machine"in _?_.send(Fe(Fe({},f),{name:f.name===NF?"".concat(vh(n.id)):f.name,origin:n.sessionId})):_.send(f.data)};var r=Fe(Fe({},i.defaultOptions),t),s=r.clock,o=r.logger,l=r.parent,h=r.id,d=h!==void 0?h:e.id;this.id=d,this.logger=o,this.clock=s,this.parent=l,this.options=r,this.scheduler=new GM({deferEvents:this.options.deferEvents}),this.sessionId=kf.bookId()}return Object.defineProperty(i.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:gh(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),i.prototype.execute=function(e,t){var n,r;try{for(var s=Qt(e.actions),o=s.next();!o.done;o=s.next()){var l=o.value;this.exec(l,e,t)}}catch(h){n={error:h}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},i.prototype.update=function(e,t){var n,r,s,o,l,h,d,f,g=this;if(e._sessionid=this.sessionId,this._state=e,this.options.execute&&this.execute(this.state),this.children.forEach(function(k){g.state.children[k.id]=k}),this.devTools&&this.devTools.send(t.data,e),e.event)try{for(var y=Qt(this.eventListeners),_=y.next();!_.done;_=y.next()){var w=_.value;w(e.event)}}catch(k){n={error:k}}finally{try{_&&!_.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}try{for(var S=Qt(this.listeners),b=S.next();!b.done;b=S.next()){var w=b.value;w(e,e.event)}}catch(k){s={error:k}}finally{try{b&&!b.done&&(o=S.return)&&o.call(S)}finally{if(s)throw s.error}}try{for(var T=Qt(this.contextListeners),E=T.next();!E.done;E=T.next()){var C=E.value;C(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(k){l={error:k}}finally{try{E&&!E.done&&(h=T.return)&&h.call(T)}finally{if(l)throw l.error}}var A=Ah(e.configuration||[],this.machine);if(this.state.configuration&&A){var D=e.configuration.find(function(k){return k.type==="final"&&k.parent===g.machine}),I=D&&D.doneData?bm(D.doneData,e.context,t):void 0;try{for(var F=Qt(this.doneListeners),P=F.next();!P.done;P=F.next()){var w=P.value;w(jf(this.id,I))}}catch(k){d={error:k}}finally{try{P&&!P.done&&(f=F.return)&&f.call(F)}finally{if(d)throw d.error}}this.stop()}},i.prototype.onTransition=function(e){return this.listeners.add(e),this.status===Vi.Running&&e(this.state,this.state.event),this},i.prototype.subscribe=function(e,t,n){var r=this;if(!e)return{unsubscribe:function(){}};var s,o=n;return typeof e=="function"?s=e:(s=e.next.bind(e),o=e.complete.bind(e)),this.listeners.add(s),this.status!==Vi.NotStarted&&s(this.state),o&&(this.status===Vi.Stopped?o():this.onDone(o)),{unsubscribe:function(){s&&r.listeners.delete(s),o&&r.doneListeners.delete(o)}}},i.prototype.onEvent=function(e){return this.eventListeners.add(e),this},i.prototype.onSend=function(e){return this.sendListeners.add(e),this},i.prototype.onChange=function(e){return this.contextListeners.add(e),this},i.prototype.onStop=function(e){return this.stopListeners.add(e),this},i.prototype.onDone=function(e){return this.doneListeners.add(e),this},i.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},i.prototype.start=function(e){var t=this;if(this.status===Vi.Running)return this;this.machine._init(),kf.register(this.sessionId,this),this.initialized=!0,this.status=Vi.Running;var n=e===void 0?this.initialState:gh(this,function(){return pV(e)?t.machine.resolveState(e):t.machine.resolveState(po.from(e,t.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){t.update(n,wm)}),this},i.prototype.stop=function(){var e,t,n,r,s,o,l,h,d,f,g=this;try{for(var y=Qt(this.listeners),_=y.next();!_.done;_=y.next()){var w=_.value;this.listeners.delete(w)}}catch(P){e={error:P}}finally{try{_&&!_.done&&(t=y.return)&&t.call(y)}finally{if(e)throw e.error}}try{for(var S=Qt(this.stopListeners),b=S.next();!b.done;b=S.next()){var w=b.value;w(),this.stopListeners.delete(w)}}catch(P){n={error:P}}finally{try{b&&!b.done&&(r=S.return)&&r.call(S)}finally{if(n)throw n.error}}try{for(var T=Qt(this.contextListeners),E=T.next();!E.done;E=T.next()){var w=E.value;this.contextListeners.delete(w)}}catch(P){s={error:P}}finally{try{E&&!E.done&&(o=T.return)&&o.call(T)}finally{if(s)throw s.error}}try{for(var C=Qt(this.doneListeners),A=C.next();!A.done;A=C.next()){var w=A.value;this.doneListeners.delete(w)}}catch(P){l={error:P}}finally{try{A&&!A.done&&(h=C.return)&&h.call(C)}finally{if(l)throw l.error}}if(!this.initialized)return this;Vn([],on(this.state.configuration),!1).sort(function(P,k){return k.order-P.order}).forEach(function(P){var k,j;try{for(var G=Qt(P.definition.exit),ne=G.next();!ne.done;ne=G.next()){var ce=ne.value;g.exec(ce,g.state)}}catch(Z){k={error:Z}}finally{try{ne&&!ne.done&&(j=G.return)&&j.call(G)}finally{if(k)throw k.error}}}),this.children.forEach(function(P){fn(P.stop)&&P.stop()}),this.children.clear();try{for(var D=Qt(Object.keys(this.delayedEventsMap)),I=D.next();!I.done;I=D.next()){var F=I.value;this.clock.clearTimeout(this.delayedEventsMap[F])}}catch(P){d={error:P}}finally{try{I&&!I.done&&(f=D.return)&&f.call(D)}finally{if(d)throw d.error}}return this.scheduler.clear(),this.scheduler=new GM({deferEvents:this.options.deferEvents}),this.initialized=!1,this.status=Vi.Stopped,this._initialState=void 0,kf.free(this.sessionId),this},i.prototype.batch=function(e){var t=this;if(!(this.status===Vi.NotStarted&&this.options.deferEvents)){if(this.status!==Vi.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'))}this.scheduler.schedule(function(){var n,r,s=t.state,o=!1,l=[],h=function(y){var _=Ri(y);t.forward(_),s=gh(t,function(){return t.machine.transition(s,_)}),l.push.apply(l,Vn([],on(s.actions.map(function(w){return fV(w,s)})),!1)),o=o||!!s.changed};try{for(var d=Qt(e),f=d.next();!f.done;f=d.next()){var g=f.value;h(g)}}catch(y){n={error:y}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}s.changed=o,s.actions=l,t.update(s,Ri(e[e.length-1]))})},i.prototype.sender=function(e){return this.send.bind(this,e)},i.prototype.nextState=function(e){var t=this,n=Ri(e);if(n.name.indexOf(BM)===0&&!this.state.nextEvents.some(function(s){return s.indexOf(BM)===0}))throw n.data.data;var r=gh(this,function(){return t.machine.transition(t.state,n)});return r},i.prototype.forward=function(e){var t,n;try{for(var r=Qt(this.forwardTo),s=r.next();!s.done;s=r.next()){var o=s.value,l=this.children.get(o);if(!l)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(o,"'."));l.send(e)}}catch(h){t={error:h}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},i.prototype.defer=function(e){var t=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?t.sendTo(e._event,e.to):t.send(e._event)},e.delay)},i.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},i.prototype.exec=function(e,t,n){n===void 0&&(n=this.machine.options.actions);var r=t.context,s=t._event,o=e.exec||B_(e.type,n),l=fn(o)?o:o?o.exec:e.exec;if(l)try{return l(r,s.data,{action:e,state:this.state,_event:s})}catch(A){throw this.parent&&this.parent.send({type:"xstate.error",data:A}),A}switch(e.type){case wv:var h=e;if(typeof h.delay=="number"){this.defer(h);return}else h.to?this.sendTo(h._event,h.to):this.send(h._event);break;case RA:this.cancel(e.sendId);break;case D_:{if(this.status!==Vi.Running)return;var d=e.activity;if(!this.state.activities[d.id||d.type])break;if(d.type===mn.Invoke){var f=FA(d.src),g=this.machine.options.services?this.machine.options.services[f.type]:void 0,y=d.id,_=d.data,w="autoForward"in d?d.autoForward:!!d.forward;if(!g)return;var S=_?bm(_,r,s):void 0;if(typeof g=="string")return;var b=fn(g)?g(r,s.data,{data:S,src:f,meta:d.meta}):g;if(!b)return;var T=void 0;nu(b)&&(b=S?b.withContext(S):b,T={autoForward:w}),this.spawn(b,y,T)}else this.spawnActivity(d);break}case ub:{this.stopChild(e.activity.id);break}case LA:var E=e.label,C=e.value;E?this.logger(E,C):this.logger(C);break}},i.prototype.removeChild=function(e){var t;this.children.delete(e),this.forwardTo.delete(e),(t=this.state)===null||t===void 0||delete t.children[e]},i.prototype.stopChild=function(e){var t=this.children.get(e);t&&(this.removeChild(e),fn(t.stop)&&t.stop())},i.prototype.spawn=function(e,t,n){if(FM(e))return this.spawnPromise(Promise.resolve(e),t);if(fn(e))return this.spawnCallback(e,t);if(lV(e))return this.spawnActor(e,t);if(qF(e))return this.spawnObservable(e,t);if(nu(e))return this.spawnMachine(e,Fe(Fe({},n),{id:t}));if(WF(e))return this.spawnBehavior(e,t);throw new Error('Unable to spawn entity "'.concat(t,'" of type "').concat(typeof e,'".'))},i.prototype.spawnMachine=function(e,t){var n=this;t===void 0&&(t={});var r=new i(e,Fe(Fe({},this.options),{parent:this,id:t.id||e.id})),s=Fe(Fe({},xV),t);s.sync&&r.onTransition(function(l){n.send(DA,{state:l,id:r.id})});var o=r;return this.children.set(r.id,o),s.autoForward&&this.forwardTo.add(r.id),r.onDone(function(l){n.removeChild(r.id),n.send(Ri(l,{origin:r.id}))}).start(),o},i.prototype.spawnBehavior=function(e,t){var n=_V(e,{id:t,parent:this});return this.children.set(t,n),n},i.prototype.spawnPromise=function(e,t){var n,r=this,s=!1,o;e.then(function(h){s||(o=h,r.removeChild(t),r.send(Ri(jf(t,h),{origin:t})))},function(h){if(!s){r.removeChild(t);var d=vh(t,h);try{r.send(Ri(d,{origin:t}))}catch{r.devTools&&r.devTools.send(d,r.state),r.machine.strict&&r.stop()}}});var l=(n={id:t,send:function(){},subscribe:function(h,d,f){var g=N_(h,d,f),y=!1;return e.then(function(_){y||(g.next(_),!y&&g.complete())},function(_){y||g.error(_)}),{unsubscribe:function(){return y=!0}}},stop:function(){s=!0},toJSON:function(){return{id:t}},getSnapshot:function(){return o}},n[da]=function(){return this},n);return this.children.set(t,l),l},i.prototype.spawnCallback=function(e,t){var n,r=this,s=!1,o=new Set,l=new Set,h,d=function(y){h=y,l.forEach(function(_){return _(y)}),!s&&r.send(Ri(y,{origin:t}))},f;try{f=e(d,function(y){o.add(y)})}catch(y){this.send(vh(t,y))}if(FM(f))return this.spawnPromise(f,t);var g=(n={id:t,send:function(y){return o.forEach(function(_){return _(y)})},subscribe:function(y){var _=N_(y);return l.add(_.next),{unsubscribe:function(){l.delete(_.next)}}},stop:function(){s=!0,fn(f)&&f()},toJSON:function(){return{id:t}},getSnapshot:function(){return h}},n[da]=function(){return this},n);return this.children.set(t,g),g},i.prototype.spawnObservable=function(e,t){var n,r=this,s,o=e.subscribe(function(h){s=h,r.send(Ri(h,{origin:t}))},function(h){r.removeChild(t),r.send(Ri(vh(t,h),{origin:t}))},function(){r.removeChild(t),r.send(Ri(jf(t),{origin:t}))}),l=(n={id:t,send:function(){},subscribe:function(h,d,f){return e.subscribe(h,d,f)},stop:function(){return o.unsubscribe()},getSnapshot:function(){return s},toJSON:function(){return{id:t}}},n[da]=function(){return this},n);return this.children.set(t,l),l},i.prototype.spawnActor=function(e,t){return this.children.set(t,e),e},i.prototype.spawnActivity=function(e){var t=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(t){var n=t(this.state.context,e);this.spawnEffect(e.id,n)}},i.prototype.spawnEffect=function(e,t){var n;this.children.set(e,(n={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:t||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},n[da]=function(){return this},n))},i.prototype.attachDev=function(){var e=fb();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var t=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(Fe(Fe({name:this.id,autoPause:!0,stateSanitizer:function(n){return{value:n.value,context:n.context,actions:n.actions}}},t),{features:Fe({jump:!1,skip:!1},t?t.features:void 0)}),this.machine),this.devTools.init(this.state)}yV(this)}},i.prototype.toJSON=function(){return{id:this.id}},i.prototype[da]=function(){return this},i.prototype.getSnapshot=function(){return this.status===Vi.NotStarted?this.initialState:this._state},i.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,t){return setTimeout(e,t)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},i.interpret=XA,i}();function XA(i,e){var t=new bV(i,e);return t}function wV(i){if(typeof i=="string"){var e={type:i};return e.toString=function(){return i},e}return i}function Nf(i){return Fe(Fe({type:I_},i),{toJSON:function(){i.onDone,i.onError;var e=cb(i,["onDone","onError"]);return Fe(Fe({},e),{type:I_,src:wV(i.src)})}})}var Bf="",F_="#",Ly="*",Pc={},Rc=function(i){return i[0]===F_},SV=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},MV=function(){function i(e,t,n,r){var s=this;n===void 0&&(n="context"in e?e.context:void 0);var o;this.config=e,this._context=n,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(SV(),t),this.parent=r==null?void 0:r.parent,this.key=this.config.key||(r==null?void 0:r.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:IA),this.id=this.config.id||Vn([this.machine.key],on(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(o=this.config.schema)!==null&&o!==void 0?o:{},this.description=this.config.description,this.initial=this.config.initial,this.states=this.config.states?mh(this.config.states,function(d,f){var g,y=new i(d,{},void 0,{parent:s,key:f});return Object.assign(s.idMap,Fe((g={},g[y.id]=y,g),y.idMap)),y}):Pc;var l=0;function h(d){var f,g;d.order=l++;try{for(var y=Qt(iu(d)),_=y.next();!_.done;_=y.next()){var w=_.value;h(w)}}catch(S){f={error:S}}finally{try{_&&!_.done&&(g=y.return)&&g.call(y)}finally{if(f)throw f.error}}}h(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(d){var f=d.event;return f===Bf}):Bf in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=ns(this.config.entry||this.config.onEntry).map(function(d){return td(d)}),this.onExit=ns(this.config.exit||this.config.onExit).map(function(d){return td(d)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=ns(this.config.invoke).map(function(d,f){var g,y;if(nu(d)){var _=If(s.id,f);return s.machine.options.services=Fe((g={},g[_]=d,g),s.machine.options.services),Nf({src:_,id:_})}else if(an(d.src)){var _=d.id||If(s.id,f);return Nf(Fe(Fe({},d),{id:_,src:d.src}))}else if(nu(d.src)||fn(d.src)){var _=d.id||If(s.id,f);return s.machine.options.services=Fe((y={},y[_]=d.src,y),s.machine.options.services),Nf(Fe(Fe({id:_},d),{src:_}))}else{var w=d.src;return Nf(Fe(Fe({id:If(s.id,f)},d),{src:w}))}}),this.activities=ns(this.config.activities).concat(this.invoke).map(function(d){return pb(d)}),this.transition=this.transition.bind(this),this.tags=ns(this.config.tags)}return i.prototype._init=function(){this.__cache.transitions||GA(this).forEach(function(e){return e.on})},i.prototype.withConfig=function(e,t){var n=this.options,r=n.actions,s=n.activities,o=n.guards,l=n.services,h=n.delays;return new i(this.config,{actions:Fe(Fe({},r),e.actions),activities:Fe(Fe({},s),e.activities),guards:Fe(Fe({},o),e.guards),services:Fe(Fe({},l),e.services),delays:Fe(Fe({},h),e.delays)},t??this.context)},i.prototype.withContext=function(e){return new i(this.config,this.options,e)},Object.defineProperty(i.prototype,"context",{get:function(){return fn(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:mh(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),i.prototype.toJSON=function(){return this.definition},Object.defineProperty(i.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(t,n){return t[n.eventType]=t[n.eventType]||[],t[n.eventType].push(n),t},{})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),i.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var t=e===Bf,n=this.transitions.filter(function(r){var s=r.eventType===e;return t?s:s||r.eventType===Ly});return this.__cache.candidates[e]=n,n},i.prototype.getDelayedTransitions=function(){var e=this,t=this.config.after;if(!t)return[];var n=function(s,o){var l=fn(s)?"".concat(e.id,":delay[").concat(o,"]"):s,h=rV(l,e.id);return e.onEntry.push(VA(h,{delay:s})),e.onExit.push(eV(h)),h},r=mu(t)?t.map(function(s,o){var l=n(s.delay,o);return Fe(Fe({},s),{event:l})}):Rn(Object.keys(t).map(function(s,o){var l=t[s],h=an(l)?{target:l}:l,d=isNaN(+s)?s:+s,f=n(d,o);return ns(h).map(function(g){return Fe(Fe({},g),{event:f,delay:d})})}));return r.map(function(s){var o=s.delay;return Fe(Fe({},e.formatTransition(s)),{delay:o})})},i.prototype.getStateNodes=function(e){var t,n=this;if(!e)return[];var r=e instanceof po?e.value:Th(e,this.delimiter);if(an(r)){var s=this.getStateNode(r).initial;return s!==void 0?this.getStateNodes((t={},t[r]=s,t)):[this,this.states[r]]}var o=Object.keys(r),l=[this];return l.push.apply(l,Vn([],on(Rn(o.map(function(h){return n.getStateNode(h).getStateNodes(r[h])}))),!1)),l},i.prototype.handles=function(e){var t=OA(e);return this.events.includes(t)},i.prototype.resolveState=function(e){var t=e instanceof po?e:po.create(e),n=Array.from(Dc([],this.getStateNodes(t.value)));return new po(Fe(Fe({},t),{value:this.resolve(t.value),configuration:n,done:Ah(n,this),tags:HM(n),machine:this.machine}))},i.prototype.transitionLeafNode=function(e,t,n){var r=this.getStateNode(e),s=r.next(t,n);return!s||!s.transitions.length?this.next(t,n):s},i.prototype.transitionCompoundNode=function(e,t,n){var r=Object.keys(e),s=this.getStateNode(r[0]),o=s._transition(e[r[0]],t,n);return!o||!o.transitions.length?this.next(t,n):o},i.prototype.transitionParallelNode=function(e,t,n){var r,s,o={};try{for(var l=Qt(Object.keys(e)),h=l.next();!h.done;h=l.next()){var d=h.value,f=e[d];if(f){var g=this.getStateNode(d),y=g._transition(f,t,n);y&&(o[d]=y)}}}catch(E){r={error:E}}finally{try{h&&!h.done&&(s=l.return)&&s.call(l)}finally{if(r)throw r.error}}var _=Object.keys(o).map(function(E){return o[E]}),w=Rn(_.map(function(E){return E.transitions})),S=_.some(function(E){return E.transitions.length>0});if(!S)return this.next(t,n);var b=Rn(_.map(function(E){return E.entrySet})),T=Rn(Object.keys(o).map(function(E){return o[E].configuration}));return{transitions:w,entrySet:b,exitSet:Rn(_.map(function(E){return E.exitSet})),configuration:T,source:t,actions:Rn(Object.keys(o).map(function(E){return o[E].actions}))}},i.prototype._transition=function(e,t,n){return an(e)?this.transitionLeafNode(e,t,n):Object.keys(e).length===1?this.transitionCompoundNode(e,t,n):this.transitionParallelNode(e,t,n)},i.prototype.getTransitionData=function(e,t){return this._transition(e.value,e,Ri(t))},i.prototype.next=function(e,t){var n,r,s=this,o=t.name,l=[],h=[],d;try{for(var f=Qt(this.getCandidates(o)),g=f.next();!g.done;g=f.next()){var y=g.value,_=y.cond,w=y.in,S=e.context,b=w?an(w)&&Rc(w)?e.matches(Th(this.getStateNodeById(w).path,this.delimiter)):hb(Th(w,this.delimiter),VF(this.path.slice(0,-2))(e.value)):!0,T=!1;try{T=!_||UA(this.machine,_,S,t,e)}catch(D){throw new Error("Unable to evaluate guard '".concat(_.name||_.type,"' in transition for event '").concat(o,"' in state node '").concat(this.id,`':
|
||
`).concat(D.message))}if(T&&b){y.target!==void 0&&(h=y.target),l.push.apply(l,Vn([],on(y.actions),!1)),d=y;break}}}catch(D){n={error:D}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}if(d){if(!h.length)return{transitions:[d],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:l};var E=Rn(h.map(function(D){return s.getRelativeStateNodes(D,e.historyValue)})),C=!!d.internal,A=C?[]:Rn(E.map(function(D){return s.nodesFromChild(D)}));return{transitions:[d],entrySet:A,exitSet:C?[]:[this],configuration:E,source:e,actions:l}}},i.prototype.nodesFromChild=function(e){if(e.escapes(this))return[];for(var t=[],n=e;n&&n!==this;)t.push(n),n=n.parent;return t.push(this),t},i.prototype.escapes=function(e){if(this===e)return!1;for(var t=this.parent;t;){if(t===e)return!1;t=t.parent}return!0},i.prototype.getActions=function(e,t,n,r){var s,o,l,h,d=Dc([],r?this.getStateNodes(r.value):[this]),f=e.configuration.length?Dc(d,e.configuration):d;try{for(var g=Qt(f),y=g.next();!y.done;y=g.next()){var _=y.value;Xf(d,_)||e.entrySet.push(_)}}catch(F){s={error:F}}finally{try{y&&!y.done&&(o=g.return)&&o.call(g)}finally{if(s)throw s.error}}try{for(var w=Qt(d),S=w.next();!S.done;S=w.next()){var _=S.value;(!Xf(f,_)||Xf(e.exitSet,_.parent))&&e.exitSet.push(_)}}catch(F){l={error:F}}finally{try{S&&!S.done&&(h=w.return)&&h.call(w)}finally{if(l)throw l.error}}var b=Rn(e.entrySet.map(function(F){var P=[];if(F.type!=="final")return P;var k=F.parent;if(!k.parent)return P;P.push(Of(F.id,F.doneData),Of(k.id,F.doneData?bm(F.doneData,t,n):void 0));var j=k.parent;return j.type==="parallel"&&iu(j).every(function(G){return Ah(e.configuration,G)})&&P.push(Of(j.id)),P}));e.exitSet.sort(function(F,P){return P.order-F.order}),e.entrySet.sort(function(F,P){return F.order-P.order});var T=new Set(e.entrySet),E=new Set(e.exitSet),C=on([Rn(Array.from(T).map(function(F){return Vn(Vn([],on(F.activities.map(function(P){return tV(P)})),!1),on(F.onEntry),!1)})).concat(b.map(KF)),Rn(Array.from(E).map(function(F){return Vn(Vn([],on(F.onExit),!1),on(F.activities.map(function(P){return nV(P)})),!1)}))],2),A=C[0],D=C[1],I=Sm(D.concat(e.actions).concat(A),this.machine.options.actions);return I},i.prototype.transition=function(e,t,n){e===void 0&&(e=this.initialState);var r=Ri(t),s;if(e instanceof po)s=n===void 0?e:this.resolveState(po.from(e,n));else{var o=an(e)?this.resolve(xm(this.getResolvedPath(e))):this.resolve(e),l=n??this.machine.context;s=this.resolveState(po.from(o,l))}if(this.strict&&!this.events.includes(r.name)&&!GF(r.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(r.name,"'"));var h=this._transition(s.value,s,r)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:s,actions:[]},d=Dc([],this.getStateNodes(s.value)),f=h.configuration.length?Dc(d,h.configuration):d;return h.configuration=Vn([],on(f),!1),this.resolveTransition(h,s,s.context,r)},i.prototype.resolveRaisedTransition=function(e,t,n){var r,s=e.actions;return e=this.transition(e,t),e._event=n,e.event=n.data,(r=e.actions).unshift.apply(r,Vn([],on(s),!1)),e},i.prototype.resolveTransition=function(e,t,n,r){var s,o,l=this;r===void 0&&(r=wm);var h=e.configuration,d=!t||e.transitions.length>0,f=d?uV(this.machine,h):void 0,g=t?t.historyValue?t.historyValue:e.source?this.machine.historyValue(t.value):void 0:void 0,y=this.getActions(e,n,r,t),_=t?Fe({},t.activities):{};try{for(var w=Qt(y),S=w.next();!S.done;S=w.next()){var b=S.value;b.type===D_?_[b.activity.id||b.activity.type]=b:b.type===ub&&(_[b.activity.id||b.activity.type]=!1)}}catch(re){s={error:re}}finally{try{S&&!S.done&&(o=w.return)&&o.call(w)}finally{if(s)throw s.error}}var T=on(z_(this,t,n,r,y,this.machine.config.preserveActionOrder),2),E=T[0],C=T[1],A=on(NA(E,function(re){return re.type===bv||re.type===wv&&re.to===ed.Internal}),2),D=A[0],I=A[1],F=E.filter(function(re){var se;return re.type===D_&&((se=re.activity)===null||se===void 0?void 0:se.type)===I_}),P=F.reduce(function(re,se){return re[se.activity.id]=sV(se.activity,l.machine,C,r),re},t?Fe({},t.children):{}),k=d?e.configuration:t?t.configuration:[],j=Ah(k,this),G=new po({value:f||t.value,context:C,_event:r,_sessionid:t?t._sessionid:null,historyValue:f?g?jF(g,f):void 0:t?t.historyValue:void 0,history:!f||e.source?t:void 0,actions:f?I:[],activities:f?_:t?t.activities:{},events:[],configuration:k,transitions:e.transitions,children:P,done:j,tags:HM(k),machine:this}),ne=n!==C;G.changed=r.name===DA||ne;var ce=G.history;ce&&delete ce.history;var Z=!j&&(this._transient||h.some(function(re){return re._transient}));if(!d&&(!Z||r.name===Bf))return G;var $=G;if(!j)for(Z&&($=this.resolveRaisedTransition($,{type:OF},r));D.length;){var K=D.shift();$=this.resolveRaisedTransition($,K._event,r)}var pe=$.changed||(ce?!!$.actions.length||ne||typeof ce.value!=typeof $.value||!jA($.value,ce.value):void 0);return $.changed=pe,$.history=ce,$},i.prototype.getStateNode=function(e){if(Rc(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var t=this.states[e];if(!t)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return t},i.prototype.getStateNodeById=function(e){var t=Rc(e)?e.slice(F_.length):e;if(t===this.id)return this;var n=this.machine.idMap[t];if(!n)throw new Error("Child state node '#".concat(t,"' does not exist on machine '").concat(this.id,"'"));return n},i.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&Rc(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var t=k_(e,this.delimiter).slice(),n=this;t.length;){var r=t.shift();if(!r.length)break;n=n.getStateNode(r)}return n},i.prototype.resolve=function(e){var t,n=this;if(!e)return this.initialStateValue||Pc;switch(this.type){case"parallel":return mh(this.initialStateValue,function(s,o){return s?n.getStateNode(o).resolve(e[o]||s):Pc});case"compound":if(an(e)){var r=this.getStateNode(e);return r.type==="parallel"||r.type==="compound"?(t={},t[e]=r.initialStateValue,t):e}return Object.keys(e).length?mh(e,function(s,o){return s?n.getStateNode(o).resolve(s):Pc}):this.initialStateValue||{};default:return e||Pc}},i.prototype.getResolvedPath=function(e){if(Rc(e)){var t=this.machine.idMap[e.slice(F_.length)];if(!t)throw new Error("Unable to find state node '".concat(e,"'"));return t.path}return k_(e,this.delimiter)},Object.defineProperty(i.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var t;if(this.type==="parallel")t=UM(this.states,function(n){return n.initialStateValue||Pc},function(n){return n.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));t=Mm(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else t={};return this.__cache.initialStateValue=t,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),i.prototype.getInitialState=function(e,t){this._init();var n=this.getStateNodes(e);return this.resolveTransition({configuration:n,entrySet:n,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,t??this.machine.context,void 0)},Object.defineProperty(i.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"target",{get:function(){var e;if(this.type==="history"){var t=this.config;an(t.target)?e=Rc(t.target)?xm(this.machine.getStateNodeById(t.target).path.slice(this.path.length-1)):t.target:e=t.target}return e},enumerable:!1,configurable:!0}),i.prototype.getRelativeStateNodes=function(e,t,n){return n===void 0&&(n=!0),n?e.type==="history"?e.resolveHistory(t):e.initialStateNodes:[e]},Object.defineProperty(i.prototype,"initialStateNodes",{get:function(){var e=this;if(Mm(this))return[this];if(this.type==="compound"&&!this.initial)return[this];var t=Wf(this.initialStateValue);return Rn(t.map(function(n){return e.getFromRelativePath(n)}))},enumerable:!1,configurable:!0}),i.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var t=on(e),n=t[0],r=t.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(n,"' from node with no states"));var s=this.getStateNode(n);if(s.type==="history")return s.resolveHistory();if(!this.states[n])throw new Error("Child state '".concat(n,"' does not exist on '").concat(this.id,"'"));return this.states[n].getFromRelativePath(r)},i.prototype.historyValue=function(e){if(Object.keys(this.states).length)return{current:e||this.initialStateValue,states:UM(this.states,function(t,n){if(!e)return t.historyValue();var r=an(e)?void 0:e[n];return t.historyValue(r||t.initialStateValue)},function(t){return!t.history})}},i.prototype.resolveHistory=function(e){var t=this;if(this.type!=="history")return[this];var n=this.parent;if(!e){var r=this.target;return r?Rn(Wf(r).map(function(o){return n.getFromRelativePath(o)})):n.initialStateNodes}var s=HF(n.path,"states")(e).current;return an(s)?[n.getStateNode(s)]:Rn(Wf(s).map(function(o){return t.history==="deep"?n.getFromRelativePath(o):[n.states[o[0]]]}))},Object.defineProperty(i.prototype,"stateIds",{get:function(){var e=this,t=Rn(Object.keys(this.states).map(function(n){return e.states[n].stateIds}));return[this.id].concat(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"events",{get:function(){var e,t,n,r;if(this.__cache.events)return this.__cache.events;var s=this.states,o=new Set(this.ownEvents);if(s)try{for(var l=Qt(Object.keys(s)),h=l.next();!h.done;h=l.next()){var d=h.value,f=s[d];if(f.states)try{for(var g=(n=void 0,Qt(f.events)),y=g.next();!y.done;y=g.next()){var _=y.value;o.add("".concat(_))}}catch(w){n={error:w}}finally{try{y&&!y.done&&(r=g.return)&&r.call(g)}finally{if(n)throw n.error}}}}catch(w){e={error:w}}finally{try{h&&!h.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(o)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(t){return!(!t.target&&!t.actions.length&&t.internal)}).map(function(t){return t.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),i.prototype.resolveTarget=function(e){var t=this;if(e!==void 0)return e.map(function(n){if(!an(n))return n;var r=n[0]===t.delimiter;if(r&&!t.parent)return t.getStateNodeByPath(n.slice(1));var s=r?t.key+n:n;if(t.parent)try{var o=t.parent.getStateNodeByPath(s);return o}catch(l){throw new Error("Invalid transition definition for state node '".concat(t.id,`':
|
||
`).concat(l.message))}else return t.getStateNodeByPath(s)})},i.prototype.formatTransition=function(e){var t=this,n=ZF(e.target),r="internal"in e?e.internal:n?n.some(function(h){return an(h)&&h[0]===t.delimiter}):!0,s=this.machine.options.guards,o=this.resolveTarget(n),l=Fe(Fe({},e),{actions:Sm(ns(e.actions)),cond:zA(e.cond,s),target:o,source:this,internal:r,eventType:e.event,toJSON:function(){return Fe(Fe({},l),{target:l.target?l.target.map(function(h){return"#".concat(h.id)}):void 0,source:"#".concat(t.id)})}});return l},i.prototype.formatTransitions=function(){var e,t,n=this,r;if(!this.config.on)r=[];else if(Array.isArray(this.config.on))r=this.config.on;else{var s=this.config.on,o=Ly,l=s[o],h=l===void 0?[]:l,d=cb(s,[typeof o=="symbol"?o:o+""]);r=Rn(Object.keys(d).map(function(E){var C=Cc(E,d[E]);return C}).concat(Cc(Ly,h)))}var f=this.config.always?Cc("",this.config.always):[],g=this.config.onDone?Cc(String(Of(this.id)),this.config.onDone):[],y=Rn(this.invoke.map(function(E){var C=[];return E.onDone&&C.push.apply(C,Vn([],on(Cc(String(jf(E.id)),E.onDone)),!1)),E.onError&&C.push.apply(C,Vn([],on(Cc(String(vh(E.id)),E.onError)),!1)),C})),_=this.after,w=Rn(Vn(Vn(Vn(Vn([],on(g),!1),on(y),!1),on(r),!1),on(f),!1).map(function(E){return ns(E).map(function(C){return n.formatTransition(C)})}));try{for(var S=Qt(_),b=S.next();!b.done;b=S.next()){var T=b.value;w.push(T)}}catch(E){e={error:E}}finally{try{b&&!b.done&&(t=S.return)&&t.call(S)}finally{if(e)throw e.error}}return w},i}();function EV(i,e){return new MV(i,e)}const mb=bt(Me({},ab),{preset:String,strideForward:Number,strideRight:Number,strideMove:Boolean}),qA=bt(Me({},lb),{preset:"default",strideForward:0,strideRight:0,strideMove:!1});var TV=EV({states:{idle:{on:{RUN_START:"running",RUN_BACKWARDS_START:"runningBackwards",JUMP_START:"jumping"}},running:{on:{RUN_STOP:"idle",RUN_BACKWARDS_START:"runningBackwards",JUMP_START:"jumping"}},runningBackwards:{on:{RUN_STOP:"idle",RUN_START:"running",JUMP_START:"jumping"}},jumping:{on:{JUMP_STOP:"idle"}}},initial:"idle"});const hh="https://unpkg.com/lingo3d-dummy@1.0.1/assets/";class Sv extends Ao{constructor(){super(),this.poseService=XA(TV),this.srcState=new Tn(hh+"ybot.fbx"),this.presetState=new Tn("default"),this.strideForwardState=new Tn(0),this.strideRightState=new Tn(0),this.strideMoveState=new Tn(!1),this.jumpHeight=10,this.width=20,this.depth=20,this.pbr=!0,this.createEffect(()=>{super.src=this.srcState.get();const l=this.presetState.get()==="rifle"?"rifle-":"";this.animations={idle:hh+l+"idle.fbx",running:hh+l+"running.fbx",runningBackwards:hh+l+"running-backwards.fbx",jumping:hh+l+"falling.fbx"},this.animation="idle"},[this.presetState.get,this.srcState.get]);const{poseService:e}=this,[t,n]=Ge("idle");this.createEffect(()=>{if((this.animation=n())!=="jumping")return;this.velocity.y=this.jumpHeight;const l=wi(()=>{this.velocity.y===0&&e.send("JUMP_STOP")});return()=>{l.cancel()}},[n]),e.onTransition(o=>o.changed&&t(o.value)).start(),this.then(()=>e.stop());const[r,s]=Ge(void 0);this.loadedResolvable.then(()=>r({spine:this.find("mixamorigSpine",!0)})),this.createEffect(()=>{const o=s();if(!o)return;const{spine:l}=o,{strideForward:h,strideRight:d,strideMove:f}=this;if(!h&&!d){const b=this.pointAt(1e3);this.loadedGroup.lookAt(Mh(b)),e.send("RUN_STOP");return}const g=h>0,y=g?-h:h,_=g?-d:d,w=90-Math.atan2(-y,-_)*pi,S=nb(()=>{e.send(g?"RUN_BACKWARDS_START":"RUN_START");const b=this.pointAt(1e3);this.loadedGroup.lookAt(Mh(b));const T=l.pointAt(1e3),E=this.getWorldPosition(),C=Tz({x:b.x,y:b.z},{x:E.x,y:E.z},w),A=new Sh(C.x,b.y,C.y);if(this.loadedGroup.lookAt(Mh(A)),l.lookAt(T),!f)return;const{x:D,y:I}=Az(0,0,w+90,Math.max(Math.abs(h),Math.abs(d)));this.moveForward(g?I:-I),this.moveRight(g?-D:D)});return()=>{S.cancel()}},[this.strideMoveState.get,this.strideForwardState.get,this.strideRightState.get,s])}get src(){return this.srcState.get()}set src(e){this.srcState.set(e)}get preset(){return this.presetState.get()}set preset(e){this.presetState.set(e)}get strideForward(){return this.strideForwardState.get()}set strideForward(e){this.strideForwardState.set(e)}get strideRight(){return this.strideRightState.get()}set strideRight(e){this.strideRightState.set(e)}get strideMove(){return this.strideMoveState.get()}set strideMove(e){this.strideMoveState.set(e)}jump(e=10){this.jumpHeight=e,this.poseService.send("JUMP_START")}}Sv.componentName="dummy";Sv.defaults=qA;Sv.schema=mb;const YA=Me(Me(Me({},CA),av),Zx),ZA=Me(Me(Me({},PA),lv),Kx),AV=yl(()=>$n(()=>import("./loadSVG.14aea335.js"),["./loadSVG.14aea335.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url)),CV=new WeakMap;class wd extends pv{constructor(){super(...arguments),this.material=new wl}dispose(){return super.dispose(),this.material.dispose(),this}load(e){return AV().then(t=>t.default(e))}resolveLoaded(e){const t=new ei;t.scale.y*=-1;const n=Ma(CV,e,()=>{const s=[];for(const d of e.paths)for(const f of d.toShapes(!0))s.push(f);if(!s.length)return[];const o=new ei;for(const d of s){const f=new ba(d,{depth:0,bevelEnabled:!1});f.dispose(),o.add(new In(f))}const l=TA(o),h=[];for(const d of s)h.push(new ba(d,{depth:l.y,bevelEnabled:!1}));return h});for(const s of n){const o=new In(s,this.material);t.add(o)}const r=AA(t,this._src);!this.widthSet&&(this.object3d.scale.x=r.x),!this.heightSet&&(this.object3d.scale.y=r.y),!this.depthSet&&(this.object3d.scale.z=r.z),this.loadedGroup.add(t),this.loadedResolvable.resolve(t)}}wd.componentName="svgMesh";wd.defaults=ZA;wd.schema=YA;ks(wd,[Jx,cv]);const KA=bt(Me({},SA),{resolution:Number,blur:Number,contrast:Number,mirror:Number}),JA=bt(Me({},MA),{resolution:512,blur:1024,contrast:1.5,mirror:1});class Mv extends bd{constructor(){super(),this.resolutionState=new Tn(512),this.blurState=new Tn(1024),this.contrastState=new Tn(1.5),this.mirrorState=new Tn(1),this.rotationX=-90;const[e,t]=Ge(void 0);$n(()=>import("./MeshReflectorMaterial.71ee11df.js"),["./MeshReflectorMaterial.71ee11df.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(n=>e(n.default)),this.createEffect(()=>{if(this.done)return;const n=t();if(!n)return;const r=new n(Sn(),Ze(),$e,this.object3d,{resolution:this.resolutionState.get(),blur:[this.blurState.get(),this.blurState.get()],mixBlur:2.5,mixContrast:this.contrastState.get(),mirror:this.mirrorState.get()});jT(this.material,r),this.material.dispose(),this.material=this.object3d.material=r;const s=nb(()=>{r.update()});return()=>{r.dispose(),s.cancel()}},[Sn,t,Ze,this.resolutionState.get,this.blurState.get,this.contrastState.get,this.mirrorState.get])}get resolution(){return this.resolutionState.get()}set resolution(e){this.resolutionState.set(e)}get blur(){return this.blurState.get()}set blur(e){this.blurState.set(e)}get contrast(){return this.contrastState.get()}set contrast(e){this.contrastState.set(e)}get mirror(){return this.mirrorState.get()}set mirror(e){this.mirrorState.set(e)}}Mv.componentName="reflector";Mv.defaults=JA;Mv.schema=KA;const[PV,RV]=Er(),QA=Me({},Tl),$A=Me({},fu),[A9,WM]=Ge(!0),V_=new Set,LV=J_(()=>{for(const i of V_){const{parent:e}=i.outerObject3d;e==null||e.remove(i.outerObject3d),Yc.setFromObject(i.outerObject3d),i.object3d.scale.copy(Yc.getSize(Ot)),e==null||e.add(i.outerObject3d)}V_.clear()},0,"trailing");var jM=i=>{V_.add(i),LV()};class Sd extends To{constructor(){super(new ei)}append(e){super.append(e),jM(this)}attach(e){super.attach(e),jM(this)}}Sd.componentName="group";Sd.defaults=$A;Sd.schema=QA;Kt(()=>{const i=WM(),e=Os();if(!e.length||!i)return;const t=new ei;$e.add(t);const n=new Sa(t);X2.add(n),jh(n);const r=[];for(const{outerObject3d:l}of e)l.parent&&(r.push([l,l.parent]),t.attach(l));Yc.setFromObject(t);for(const[l,h]of r)h.attach(l);t.position.copy(Yc.getCenter(Ot));for(const[l]of r)t.attach(l);let s=!1;const o=RV(()=>{if(!e.length||s)return;s=!0;const l=new Sd;l.outerObject3d.position.copy(t.position);for(const h of e)l.attach(h);Di(l)});return()=>{if(Di(),!n.done&&!s)for(const[l,h]of r)h.attach(l);jh(void 0),n.dispose(),$e.remove(t),o.cancel()}},[Os,WM]);const DV=Me({},Sl);class eC extends Bs{constructor(){super(new ei),nF(!0)}}eC.componentName="sky";eC.defaults=DV;const IV=bt(Me(Me({},Tl),lA),{mouseControl:[Boolean,String],mouseControlMode:String}),OV=bt(Me(Me({},fu),cA),{mouseControl:!1}),vb=Me({},IV),gb=Me({},OV);class Md extends yA{constructor(e=new fi(75,1,Qm,$m)){super(e)}}Md.componentName="camera";Md.defaults=gb;Md.schema=vb;const yb=bt(Me({},vb),{target:Object,lockTargetRotation:[Boolean,String]}),_b=bt(Me({},gb),{lockTargetRotation:!0}),kV=i=>!!i&&(ml(i)||i instanceof ov),zf=new WeakSet;class Ev extends Md{constructor(){super(),this.lockTargetRotation=!0,this.targetState=new Tn(void 0),this.retarget=Mr(()=>{var r;let s;for(const o of(r=this.children)!==null&&r!==void 0?r:[])if(s)o.outerObject3d.parent!==this.camera&&this.camera[zf.has(o)?"attach":"add"](o.outerObject3d);else if(kV(o)){s=o;const{parent:l}=this.outerObject3d;l&&o.outerObject3d.parent!==l&&l[zf.has(s)?"attach":"add"](s.outerObject3d)}this.targetState.set(s)},0,"trailing");const e=this.camera;$e.attach(e),this.then(()=>$e.remove(e)),this.createEffect(()=>{const r=this.targetState.get();if(!r)return;"frustumCulled"in r&&(r.frustumCulled=!1);const s=tv(()=>r.parent!==this&&this.retarget());return()=>{s.cancel()}},[this.targetState.get]);const t=r=>{Wi.setFromQuaternion(r.outerObject3d.quaternion),Wi.y+=Math.PI,this.outerObject3d.setRotationFromEuler(Wi),this.updatePolarAngle()};let n=!1;this.createEffect(()=>{const r=this.targetState.get();if(!r)return;t(r);let s=!1;r.onRotationY=()=>s=!0;const o=wi(()=>{if(this.outerObject3d.position.copy(r.outerObject3d.position),!!this.lockTargetRotation){if(this.lockTargetRotation==="follow"||n||s){s=!1,t(r);return}Wi.setFromQuaternion(this.outerObject3d.quaternion),Wi.x=0,Wi.z=0,Wi.y+=Math.PI,r.outerObject3d.setRotationFromEuler(Wi)}});return()=>{o.cancel(),r.onRotationY=void 0}},[this.targetState.get]),this.createEffect(()=>{const r=this.targetState.get(),s=vi(),o=So(),l=gl();if(r&&r===s&&o&&l==="rotate")return n=!0,()=>{n=!1}},[this.targetState.get,vi,So,gl])}append(e){this._append(e),zf.delete(e),this.retarget()}attach(e){this._append(e),zf.add(e),this.retarget()}get gyroControl(){return!!this._gyroControl}set gyroControl(e){var t;if(this._gyroControl===e)return;this._gyroControl,(t=this.gyroControlHandle)===null||t===void 0||t.cancel();const n=Wi,r=hm,s=Pz,o=new ai(-Math.sqrt(.5),0,0,Math.sqrt(.5)),l=this.object3d.getWorldQuaternion(hm).clone(),h=0,d=f=>{var g,y,_;this.object3d.quaternion.copy(l),n.set(((g=f.beta)!==null&&g!==void 0?g:0)*xn,((y=f.alpha)!==null&&y!==void 0?y:0)*xn,-((_=f.gamma)!==null&&_!==void 0?_:0)*xn,"YXZ"),this.object3d.quaternion.multiply(r.setFromEuler(n));const w=-h*.5;s.set(0,Math.sin(w),0,Math.cos(w)),this.object3d.quaternion.multiply(s),this.object3d.quaternion.multiply(o)};window.addEventListener("deviceorientation",d),this.gyroControlHandle=this.cancellable(()=>window.removeEventListener("deviceorientation",d))}}Ev.defaults=_b;Ev.schema=yb;class tC extends Ev{constructor(){super(),this.innerZ=200,this.mouseControlMode="orbit",$n(()=>import("./enableBVHCamera.908a562a.js"),["./enableBVHCamera.908a562a.js","./useBVHMap.71c1a414.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(e=>e.default.call(this))}}tC.componentName="thirdPersonCamera";class nC extends Ev{constructor(){super();const e=this.camera;this.loop(()=>{e.position.copy(this.object3d.getWorldPosition(Ot)),e.quaternion.copy(this.object3d.getWorldQuaternion(hm))}),this.createEffect(()=>{const t=this.targetState.get();if(!(!t||!(t instanceof Sa)||this._innerY!==void 0))return this.innerY=t.height*.4,()=>{this.innerY=0}},[this.targetState.get])}get innerY(){return this.object3d.position.y*pn}set innerY(e){this._innerY=this.object3d.position.y=e*Ye}}nC.componentName="firstPersonCamera";var NV=()=>{const i=new Al;return i.texture="data:image/png;base64,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",Li.delete(i),i.scale=.5,i};class Ed extends To{constructor(e,t){super(e),t&&this.createEffect(()=>{if(Ze()!==bn)return;const n=new t(this.object3d);$e.add(n);const r=NV();n.add(r.outerObject3d);const s=vd(({target:o})=>{o===r&&Di(this)});return()=>{n.dispose(),$e.remove(n),r.dispose(),s.cancel()}},[Ze])}dispose(){return super.dispose(),this.object3d.dispose(),this}lookAt(e){super.lookAt(e),this.rotationY+=180}get color(){return"#"+this.object3d.color.getHexString()}set color(e){this.object3d.color=new Pe(e)}get intensity(){return this.object3d.intensity}set intensity(e){this.object3d.intensity=e}getCenter(){return this.getWorldPosition()}}const Td=bt(Me({},Tl),{color:String,intensity:Number}),Ad=bt(Me({},fu),{color:"#ffffff",intensity:1}),iC=Me({},Td),rC=Me({},Ad),sC=Me({},iC),oC=Me({},rC);class Tv extends Ed{constructor(){super(new D2)}}Tv.componentName="ambientLight";Tv.defaults=oC;Tv.schema=sC;class BV extends jc{constructor(e,t){const n=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],r=new zt;r.setAttribute("position",new xt(n,3)),r.computeBoundingSphere();const s=new os({fog:!1});super(r,s),this.light=e,this.color=t,this.type="RectAreaLightHelper";const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new zt;l.setAttribute("position",new xt(o,3)),l.computeBoundingSphere(),this.add(new In(l,new ss({side:xr,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),this.color!==void 0)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const aC=bt(Me({},Td),{helper:Boolean}),ha=bt(Me({},Ad),{depth:0,scaleZ:0,helper:!0}),zV=yl(async()=>{const{RectAreaLightUniformsLib:i}=await $n(()=>import("./RectAreaLightUniformsLib.b3ae5e7d.js"),["./RectAreaLightUniformsLib.b3ae5e7d.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url);i.init()});class Av extends To{constructor(){super(new ei),this.helperState=new Tn(!0),(async()=>{if(await zV(),this.done)return;const e=this.light=new I2(this._color,this._intensity,this.width*this.scaleX*Ye,this.height*this.scaleY*Ye);this.object3d.add(e),this.then(()=>e.dispose()),this.createEffect(()=>{if(gl()!=="scale"||vi()!==this)return;const t=P_(()=>{const{x:n,y:r}=this.outerObject3d.scale;console.log(n,r),this.scaleX=n,this.scaleY=r});return()=>{t.cancel()}},[gl,vi]),this.createEffect(()=>{if(Ze()!==bn||!this.helperState.get())return;const t=new BV(e);return $e.add(t),()=>{t.dispose(),$e.remove(t)}},[Ze,this.helperState.get])})()}get helper(){return this.helperState.get()}set helper(e){this.helperState.set(e)}lookAt(e){super.lookAt(e),this.rotationY+=180}get color(){var e;return(e=this._color)!==null&&e!==void 0?e:ha.color}set color(e){this._color=e,this.light&&(this.light.color=new Pe(e))}get intensity(){var e;return(e=this._intensity)!==null&&e!==void 0?e:ha.intensity}set intensity(e){this._intensity=e,this.light&&(this.light.intensity=e)}get width(){var e;return(e=this._width)!==null&&e!==void 0?e:ha.width}set width(e){this._width=e,this.light&&(this.light.width=e*this.scaleX*Ye)}get height(){var e;return(e=this._height)!==null&&e!==void 0?e:ha.height}set height(e){this._height=e,this.light&&(this.light.height=e*this.scaleY*Ye)}get scaleX(){var e;return(e=this._scaleX)!==null&&e!==void 0?e:ha.scaleX}set scaleX(e){this._scaleX=e,this.light&&(this.light.width=e*this.width*Ye)}get scaleY(){var e;return(e=this._scaleY)!==null&&e!==void 0?e:ha.scaleY}set scaleY(e){this._scaleY=e,this.light&&(this.light.height=e*this.height*Ye)}get depth(){return 0}set depth(e){}get scaleZ(){return 0}set scaleZ(e){}getCenter(){return this.getWorldPosition()}}Av.componentName="areaLight";Av.defaults=ha;Av.schema=aC;const lC=Me({},iC),cC=Me({},rC);class Cv extends Ed{constructor(){super(new Tx,tz)}}Cv.componentName="directionalLight";Cv.defaults=cC;Cv.schema=lC;const uC=bt(Me({},Td),{groundColor:String}),hC=bt(Me({},Ad),{groundColor:"#ffffff"});class Pv extends Ed{constructor(){super(new Mx,ez)}get groundColor(){return"#"+this.object3d.groundColor.getHexString()}set groundColor(e){this.object3d.groundColor=new Pe(e)}}Pv.componentName="skyLight";Pv.defaults=hC;Pv.schema=uC;const dC=bt(Me({},Td),{decay:Number,distance:Number}),pC=bt(Me({},Ad),{decay:1,distance:0});class fC{get decay(){return this.object3d.decay}set decay(e){this.object3d.decay=e}get distance(){return this.object3d.distance}set distance(e){this.object3d.distance=e}}class Cd extends Ed{constructor(){super(new R2,Q6)}}Cd.componentName="pointLight";Cd.defaults=pC;Cd.schema=dC;ks(Cd,[fC]);const mC=bt(Me({},Td),{angle:Number,penumbra:Number}),vC=bt(Me({},Ad),{angle:1,penumbra:0});class Pd extends Ed{constructor(){super(new C2,J6)}get angle(){return this.object3d.angle}set angle(e){this.object3d.angle=e}get penumbra(){return this.object3d.penumbra}set penumbra(e){this.object3d.penumbra=e}}Pd.componentName="spotLight";Pd.defaults=vC;Pd.schema=mC;ks(Pd,[fC]);const Uf=new WeakMap;var XM=i=>{if(Uf.has(i))return Uf.get(i);const e=i.getWorldPosition(new z);return Uf.set(i,e),setTimeout(()=>Uf.delete(i)),e};const gC=bt(Me({},Qx),{onEnter:Function,onExit:Function,targetIds:[String,Array],pad:Boolean,radius:Number,interval:Number,helper:Boolean}),ol=bt(Me({},$x),{onEnter:void 0,onExit:void 0,pad:!1,radius:50,interval:300,helper:!0}),qM=i=>{var e;return[...(e=Lc.get(i))!==null&&e!==void 0?e:[]]};class Rv extends nv{constructor(){const e=new ei;super(e),this.refresh=new Tn({}),this._pad=ol.pad,this._radius=ol.radius,this._interval=ol.interval,this._helper=ol.helper,this._targetIds=ol.targetIds,$e.add(e);let t;this.createEffect(()=>{const{_radius:n,_interval:r,_targetIds:s,_pad:o}=this;if(!s)return;const l=n*Ye,h=l*.2;let d=!1;const f=Q2(r,-1,()=>{var g,y;const{x:_,y:w,z:S}=XM(this.outerObject3d),b=typeof s=="string"?qM(s):s.map(qM).flat();let T=!1;for(const E of b){const{x:C,y:A,z:D}=XM(E.object3d);if(o){const{y:I}=El(E);T=Math.abs(_-C)<l&&Math.abs(w-(A-I*.5))<h&&Math.abs(S-D)<l}else T=Math.abs(_-C)<l&&Math.abs(w-A)<l&&Math.abs(S-D)<l;if(T)break}d!==T&&(T?((g=this.onEnter)===null||g===void 0||g.call(this),t&&(t.color="blue")):((y=this.onExit)===null||y===void 0||y.call(this),t&&(t.color="white"))),d=T});return()=>{f.cancel()}},[this.refresh.get]),this.createEffect(()=>{const{_radius:n,_helper:r,_pad:s}=this;if(!r||Ze()!==bn)return;const o=t=s?new ob:new sb;Li.delete(o),e.add(o.outerObject3d),o.scale=n*Ye*2,o.opacity=.5,o.height=s?10:100;const l=vd(({target:h})=>h===o&&Di(this));return()=>{o.dispose(),t=void 0,l.cancel()}},[this.refresh.get,Ze])}get pad(){return this._pad}set pad(e){this._pad=e,this.refresh.set({})}get radius(){return this._radius}set radius(e){this._radius=e,this.refresh.set({})}get interval(){return this._interval}set interval(e){this._interval=e,this.refresh.set({})}get helper(){return this._helper}set helper(e){this._helper=e,this.refresh.set({})}get targetIds(){return this._targetIds}set targetIds(e){this._targetIds=e,this.refresh.set({})}}Rv.componentName="trigger";Rv.defaults=ol;Rv.schema=gC;const yC=bt(Me({},du),{onKeyPress:Function,onKeyUp:Function,onKeyDown:Function}),_C=Me({},Sl),[YM,ZM]=Ge(!0),[UV,FV]=Er(),[KM,VV]=Er(),[JM,HV]=Er(),gr=new Set,QM=i=>(i=i.length===1?i.toLowerCase():i,i===" "&&(i="Space"),i);Kt(()=>{if($c()&&ZM())return;const i=wi(()=>gr.size>0&&JM()),e=n=>{const r=QM(n.key);gr.add(r),UV(r)},t=n=>{const r=QM(n.key);gr.delete(r),KM(r),!gr.size&&JM()};return i.watch(yv(()=>{if(!gr.size)return;const n=[...gr];gr.clear();for(const r of n)KM(r)})),document.addEventListener("keydown",e),document.addEventListener("keyup",t),()=>{i.cancel(),document.removeEventListener("keydown",e),document.removeEventListener("keyup",t)}},[$c,ZM]);class Lv extends Bs{constructor(){super(new ei),this.watch(HV(()=>{if(this.onKeyPress){if(!gr.size){this.onKeyPress("",gr);return}for(const e of gr)this.onKeyPress(e,gr)}})),this.watch(VV(e=>{var t;return(t=this.onKeyUp)===null||t===void 0?void 0:t.call(this,e,gr)})),this.watch(FV(e=>{var t;return(t=this.onKeyDown)===null||t===void 0?void 0:t.call(this,e,gr)}))}}Lv.componentName="keyboard";Lv.defaults=_C;Lv.schema=yC;const GV=new Lv;Li.delete(GV);"getGamepads"in navigator&&wi(()=>{for(const i of navigator.getGamepads())if(i){for(let e=0;e<i.buttons.length;e++){const t=i.buttons[e],n=Math.round(t.value*100)+"%";t.pressed&&console.log(e,t.value,t.pressed,n)}for(let e=0;e<i.axes.length;e++){const t=Number(i.axes[e].toFixed(2));t!==0&&console.log(e,t)}}});const WV=new Map,Rd=(i,e)=>{for(const t of e)WV.set(t,i);return e};Rd("image",["jpg","jpeg","gif","png","svg","tiff","webp","hdr"]);Rd("audio",["m4a","mp3","wav","wma","ogg","flax","flac","aac"]);Rd("plainText",["ls","js","ts","jsx","tsx","py","txt","md","json","yaml","c","cpp","h","hpp","css","scss","sass","html"]);Rd("model",["gltf","glb","fbx"]);Rd("scene",["l3d"]);const xC={onPlay:Function,onPause:Function,onEnded:Function,stream:Boolean,src:String,loop:Boolean,autoplay:Boolean,muted:Boolean,playbackRate:Number,volume:Number,paused:Boolean},bC={paused:!0};class xb extends $_{constructor(){super(...arguments),this._paused=!0,this.soundResolvable=new Fc}dispose(){var e,t;return super.dispose(),(e=this.sound)===null||e===void 0||e.stop(),(t=this.sound)===null||t===void 0||t.unload(),this}get paused(){return this._paused}set paused(e){this._paused=e,e?this.play():this.pause()}get src(){return this._src}set src(e){var t;this._src=e,(t=this.sound)===null||t===void 0||t.stop(),this.sound=void 0,this.soundResolvable.done&&(this.soundResolvable=new Fc),e&&$n(()=>import("./howler.9d4b360b.js"),["./howler.9d4b360b.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.h}).then(n=>{this.done||e!==this.src||(this.sound=new n.default.Howl({src:e,onplay:this.onPlay,onpause:this.onPause,onend:this.onEnded,loop:this._loop,autoplay:this._autoplay,mute:this._muted,rate:this._playbackRate,volume:this._volume,html5:this.stream}),this.soundResolvable.resolve(this.sound))})}get loop(){return this._loop}set loop(e){var t;this._loop=e,(t=this.sound)===null||t===void 0||t.loop(!!e)}get autoplay(){return this._autoplay}set autoplay(e){this._autoplay=e,e&&this.play()}get muted(){return this._muted}set muted(e){var t;this._muted=e,(t=this.sound)===null||t===void 0||t.mute(!!e)}get playbackRate(){return this._playbackRate}set playbackRate(e){var t;this._playbackRate=e,(t=this.sound)===null||t===void 0||t.rate(e??1)}get volume(){return this._volume}set volume(e){var t;this._volume=e,(t=this.sound)===null||t===void 0||t.volume(e??1)}get duration(){var e;return(e=this.sound)===null||e===void 0?void 0:e.duration()}fade(e,t,n=1e3){this.soundResolvable.then(r=>r.fade(e,t,n))}play(){this.soundResolvable.then(e=>e.play()),this._paused=!1}pause(){this.soundResolvable.then(e=>e.pause()),this._paused=!0}stop(){this.soundResolvable.then(e=>e.stop()),this._paused=!0}}xb.componentName="sound";xb.defaults=bC;xb.schema=xC;const[jV,XV]=Er(),qV={performance:String,skybox:[String,Array],defaultLight:[String,Boolean],defaultLightScale:Number,defaultOrbitControls:Boolean,defaultFog:String,gridHelper:Boolean,gridHelperSize:Number,gravity:Number,repulsion:Number,wasmPath:String,autoMount:[Boolean,String],logarithmicDepth:Boolean,exposure:Number,pbr:Boolean,bloom:Boolean,bloomStrength:Number,bloomRadius:Number,bloomThreshold:Number,ambientOcclusion:[Boolean,String],outlineColor:String,outlineHiddenColor:String,outlinePattern:String,outlinePulse:Number,outlineStrength:Number,outlineThickness:Number,lensDistortion:Boolean,lensIor:Number,lensBand:Number,texture:String,color:String},bb=Me({},Cs);var H_=Mr(i=>{var e;for(const t of Object.keys(Cs))Cs[t]=(e=i[t])!==null&&e!==void 0?e:bb[t];jV()},0,"trailing");const wC=["type","children","scale","velocity","target"],SC=["performance","defaultOrbitControls","wasmPath","autoMount","texture","color","gridHelper","gridHelperSize"],MC=i=>{const e=[];for(const t of i){const{componentName:n,schema:r,defaults:s}=t.constructor,o={type:n};for(const l of Object.keys(r)){if(wC.includes(l))continue;let h;if(l==="animations"){if(h=t.loadedAnims,!h)continue}else if(l==="animation"){if(h=t.animationName,h===void 0)continue}else h=t[l];h===s[l]||typeof h=="function"||(typeof h=="number"&&(h=Number(h.toFixed(2))),o[l]=h)}t.children&&(o.children=MC(t.children)),e.push(o)}return e};var Dv=(i=Li)=>{const e=MC(i instanceof $2?[i]:i),t={type:"setup"};for(const[n,r]of Object.entries(rs.exports.omit(Cs,SC)))bb[n]!==r&&(t[n]=r);return Object.keys(t).length&&e.push(t),e};const YV=F4({group:()=>new Sd,trigger:()=>new Rv,model:()=>new Ao,svgMesh:()=>new wd,dummy:()=>new Sv,reflector:()=>new Mv,sprite:()=>new Al,camera:()=>new Md,thirdPersonCamera:()=>new tC,firstPersonCamera:()=>new nC,orbitCamera:()=>new Cl,ambientLight:()=>new Tv,areaLight:()=>new Av,directionalLight:()=>new Cv,skyLight:()=>new Pv,pointLight:()=>new Cd,spotLight:()=>new Pd,circle:()=>new xv,cone:()=>new _A,cube:()=>new dv,cylinder:()=>new ob,octahedron:()=>new xA,plane:()=>new bd,sphere:()=>new sb,tetrahedron:()=>new bA,torus:()=>new wA,skybox:()=>new md,environment:()=>new pd});var EC=i=>YV[i]();const TC=(i,e)=>{var t;if(i.type==="setup"){H_(i);return}if(i.type==="animation")return;const n=EC(i.type);return e&&n instanceof pv&&e.push(n.loadedResolvable),Object.assign(n,rs.exports.omit(i,wC)),(t=i.children)===null||t===void 0||t.map(r=>TC(r,e)).forEach(r=>r&&n.append(r)),n};var AC=(i,e)=>i.map(t=>TC(t,e)),An=(i,e)=>Object.fromEntries(Object.entries(i).map(([t,n])=>[t,{type:n===Number?[Number,Object]:n,default:e[t]}])),ZV=An(qV,bb);const CC=document.createElement("div");Object.assign(CC.style,{position:"absolute",left:"0px",top:"0px",width:"100%",height:"100%",pointerEvents:"none",userSelect:"none"});const KV={style:{height:"100%"}},JV=rd({name:"World",props:bt(Me({},ZV),{position:String}),setup(i){const e=i,t=sd();Rs(r=>{const s=Ih(t.value);if(!s)return;s.appendChild(ga),s.appendChild(CC);const o=new ResizeObserver(()=>{const l=[s.clientWidth,s.clientHeight];s_(l),$z(l)});o.observe(s),r(()=>{o.disconnect()})}),Rs(r=>{H_(e),r(()=>{H_({})})});const n=document.createElement("style");return n.innerHTML=`.lingo3d {
|
||
position: absolute;
|
||
width: 100%;
|
||
height: 100%;
|
||
top: 0px;
|
||
left: 0px;
|
||
display: flex;
|
||
}`,document.head.appendChild(n),(r,s)=>(SE(),ME("div",{class:"lingo3d",style:P4({position:e.position})},[e1("div",KV,[Dm(r.$slots,"default")]),e1("div",{ref_key:"divRef",ref:t,style:{height:"100%","flex-grow":"1",position:"relative","z-index":"0"}},null,512)],4))}});var Ld,At,PC,Ch,RC,$M,Em={},LC=[],QV=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function go(i,e){for(var t in e)i[t]=e[t];return i}function DC(i){var e=i.parentNode;e&&e.removeChild(i)}function Bc(i,e,t){var n,r,s,o={};for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?Ld.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(s in i.defaultProps)o[s]===void 0&&(o[s]=i.defaultProps[s]);return Ph(i,o,n,r,null)}function Ph(i,e,t,n,r){var s={type:i,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:r??++PC};return r==null&&At.vnode!=null&&At.vnode(s),s}function vu(i){return i.children}function qf(i,e){this.props=i,this.context=e}function ru(i,e){if(e==null)return i.__?ru(i.__,i.__.__k.indexOf(i)+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?ru(i):null}function IC(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return IC(i)}}function eE(i){(!i.__d&&(i.__d=!0)&&Ch.push(i)&&!Tm.__r++||$M!==At.debounceRendering)&&(($M=At.debounceRendering)||RC)(Tm)}function Tm(){for(var i;Tm.__r=Ch.length;)i=Ch.sort(function(e,t){return e.__v.__b-t.__v.__b}),Ch=[],i.some(function(e){var t,n,r,s,o,l;e.__d&&(o=(s=(t=e).__v).__e,(l=t.__P)&&(n=[],(r=go({},s)).__v=s.__v+1,wb(l,s,r,t.__n,l.ownerSVGElement!==void 0,s.__h!=null?[o]:null,n,o??ru(s),s.__h),BC(n,s),s.__e!=o&&IC(s)))})}function OC(i,e,t,n,r,s,o,l,h,d){var f,g,y,_,w,S,b,T=n&&n.__k||LC,E=T.length;for(t.__k=[],f=0;f<e.length;f++)if((_=t.__k[f]=(_=e[f])==null||typeof _=="boolean"?null:typeof _=="string"||typeof _=="number"||typeof _=="bigint"?Ph(null,_,null,null,_):Array.isArray(_)?Ph(vu,{children:_},null,null,null):_.__b>0?Ph(_.type,_.props,_.key,null,_.__v):_)!=null){if(_.__=t,_.__b=t.__b+1,(y=T[f])===null||y&&_.key==y.key&&_.type===y.type)T[f]=void 0;else for(g=0;g<E;g++){if((y=T[g])&&_.key==y.key&&_.type===y.type){T[g]=void 0;break}y=null}wb(i,_,y=y||Em,r,s,o,l,h,d),w=_.__e,(g=_.ref)&&y.ref!=g&&(b||(b=[]),y.ref&&b.push(y.ref,null,_),b.push(g,_.__c||w,_)),w!=null?(S==null&&(S=w),typeof _.type=="function"&&_.__k===y.__k?_.__d=h=kC(_,h,i):h=NC(i,_,y,T,w,h),typeof t.type=="function"&&(t.__d=h)):h&&y.__e==h&&h.parentNode!=i&&(h=ru(y))}for(t.__e=S,f=E;f--;)T[f]!=null&&(typeof t.type=="function"&&T[f].__e!=null&&T[f].__e==t.__d&&(t.__d=ru(n,f+1)),UC(T[f],T[f]));if(b)for(f=0;f<b.length;f++)zC(b[f],b[++f],b[++f])}function kC(i,e,t){for(var n,r=i.__k,s=0;r&&s<r.length;s++)(n=r[s])&&(n.__=i,e=typeof n.type=="function"?kC(n,e,t):NC(t,n,n,r,n.__e,e));return e}function NC(i,e,t,n,r,s){var o,l,h;if(e.__d!==void 0)o=e.__d,e.__d=void 0;else if(t==null||r!=s||r.parentNode==null)e:if(s==null||s.parentNode!==i)i.appendChild(r),o=null;else{for(l=s,h=0;(l=l.nextSibling)&&h<n.length;h+=2)if(l==r)break e;i.insertBefore(r,s),o=s}return o!==void 0?o:r.nextSibling}function $V(i,e,t,n,r){var s;for(s in t)s==="children"||s==="key"||s in e||Am(i,s,null,t[s],n);for(s in e)r&&typeof e[s]!="function"||s==="children"||s==="key"||s==="value"||s==="checked"||t[s]===e[s]||Am(i,s,e[s],t[s],n)}function tE(i,e,t){e[0]==="-"?i.setProperty(e,t):i[e]=t==null?"":typeof t!="number"||QV.test(e)?t:t+"px"}function Am(i,e,t,n,r){var s;e:if(e==="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof n=="string"&&(i.style.cssText=n=""),n)for(e in n)t&&e in t||tE(i.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||tE(i.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")s=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in i?e.toLowerCase().slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?n||i.addEventListener(e,s?iE:nE,s):i.removeEventListener(e,s?iE:nE,s);else if(e!=="dangerouslySetInnerHTML"){if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t!=null&&(t!==!1||e[0]==="a"&&e[1]==="r")?i.setAttribute(e,t):i.removeAttribute(e))}}function nE(i){this.l[i.type+!1](At.event?At.event(i):i)}function iE(i){this.l[i.type+!0](At.event?At.event(i):i)}function wb(i,e,t,n,r,s,o,l,h){var d,f,g,y,_,w,S,b,T,E,C,A=e.type;if(e.constructor!==void 0)return null;t.__h!=null&&(h=t.__h,l=e.__e=t.__e,e.__h=null,s=[l]),(d=At.__b)&&d(e);try{e:if(typeof A=="function"){if(b=e.props,T=(d=A.contextType)&&n[d.__c],E=d?T?T.props.value:d.__:n,t.__c?S=(f=e.__c=t.__c).__=f.__E:("prototype"in A&&A.prototype.render?e.__c=f=new A(b,E):(e.__c=f=new qf(b,E),f.constructor=A,f.render=t8),T&&T.sub(f),f.props=b,f.state||(f.state={}),f.context=E,f.__n=n,g=f.__d=!0,f.__h=[]),f.__s==null&&(f.__s=f.state),A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=go({},f.__s)),go(f.__s,A.getDerivedStateFromProps(b,f.__s))),y=f.props,_=f.state,g)A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(A.getDerivedStateFromProps==null&&b!==y&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,E),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,E)===!1||e.__v===t.__v){f.props=b,f.state=f.__s,e.__v!==t.__v&&(f.__d=!1),f.__v=e,e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(D){D&&(D.__=e)}),f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,E),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(y,_,w)})}f.context=E,f.props=b,f.state=f.__s,(d=At.__r)&&d(e),f.__d=!1,f.__v=e,f.__P=i,d=f.render(f.props,f.state,f.context),f.state=f.__s,f.getChildContext!=null&&(n=go(go({},n),f.getChildContext())),g||f.getSnapshotBeforeUpdate==null||(w=f.getSnapshotBeforeUpdate(y,_)),C=d!=null&&d.type===vu&&d.key==null?d.props.children:d,OC(i,Array.isArray(C)?C:[C],e,t,n,r,s,o,l,h),f.base=e.__e,e.__h=null,f.__h.length&&o.push(f),S&&(f.__E=f.__=null),f.__e=!1}else s==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=e8(t.__e,e,t,n,r,s,o,h);(d=At.diffed)&&d(e)}catch(D){e.__v=null,(h||s!=null)&&(e.__e=l,e.__h=!!h,s[s.indexOf(l)]=null),At.__e(D,e,t)}}function BC(i,e){At.__c&&At.__c(e,i),i.some(function(t){try{i=t.__h,t.__h=[],i.some(function(n){n.call(t)})}catch(n){At.__e(n,t.__v)}})}function e8(i,e,t,n,r,s,o,l){var h,d,f,g=t.props,y=e.props,_=e.type,w=0;if(_==="svg"&&(r=!0),s!=null){for(;w<s.length;w++)if((h=s[w])&&"setAttribute"in h==!!_&&(_?h.localName===_:h.nodeType===3)){i=h,s[w]=null;break}}if(i==null){if(_===null)return document.createTextNode(y);i=r?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,y.is&&y),s=null,l=!1}if(_===null)g===y||l&&i.data===y||(i.data=y);else{if(s=s&&Ld.call(i.childNodes),d=(g=t.props||Em).dangerouslySetInnerHTML,f=y.dangerouslySetInnerHTML,!l){if(s!=null)for(g={},w=0;w<i.attributes.length;w++)g[i.attributes[w].name]=i.attributes[w].value;(f||d)&&(f&&(d&&f.__html==d.__html||f.__html===i.innerHTML)||(i.innerHTML=f&&f.__html||""))}if($V(i,y,g,r,l),f)e.__k=[];else if(w=e.props.children,OC(i,Array.isArray(w)?w:[w],e,t,n,r&&_!=="foreignObject",s,o,s?s[0]:t.__k&&ru(t,0),l),s!=null)for(w=s.length;w--;)s[w]!=null&&DC(s[w]);l||("value"in y&&(w=y.value)!==void 0&&(w!==i.value||_==="progress"&&!w||_==="option"&&w!==g.value)&&Am(i,"value",w,g.value,!1),"checked"in y&&(w=y.checked)!==void 0&&w!==i.checked&&Am(i,"checked",w,g.checked,!1))}return i}function zC(i,e,t){try{typeof i=="function"?i(e):i.current=e}catch(n){At.__e(n,t)}}function UC(i,e,t){var n,r;if(At.unmount&&At.unmount(i),(n=i.ref)&&(n.current&&n.current!==i.__e||zC(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){At.__e(s,e)}n.base=n.__P=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&UC(n[r],e,typeof i.type!="function");t||i.__e==null||DC(i.__e),i.__e=i.__d=void 0}function t8(i,e,t){return this.constructor(i,t)}function Iv(i,e,t){var n,r,s;At.__&&At.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],wb(e,i=(!n&&t||e).__k=Bc(vu,null,[i]),r||Em,Em,e.ownerSVGElement!==void 0,!n&&t?[t]:r?null:e.firstChild?Ld.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n),BC(s,i)}function FC(i,e){Iv(i,e,FC)}function VC(i,e,t){var n,r,s,o=go({},i.props);for(s in e)s=="key"?n=e[s]:s=="ref"?r=e[s]:o[s]=e[s];return arguments.length>2&&(o.children=arguments.length>3?Ld.call(arguments,2):t),Ph(i.type,o,n||i.key,r||i.ref,null)}Ld=LC.slice,At={__e:function(i,e,t,n){for(var r,s,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((s=r.constructor)&&s.getDerivedStateFromError!=null&&(r.setState(s.getDerivedStateFromError(i)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(i,n||{}),o=r.__d),o)return r.__E=r}catch(l){i=l}throw i}},PC=0,qf.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=go({},this.state),typeof i=="function"&&(i=i(go({},t),this.props)),i&&go(t,i),i!=null&&this.__v&&(e&&this.__h.push(e),eE(this))},qf.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),eE(this))},qf.prototype.render=vu,Ch=[],RC=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Tm.__r=0;var n8=0;function ye(i,e,t,n,r){var s,o,l={};for(o in e)o=="ref"?s=e[o]:l[o]=e[o];var h={type:i,props:l,key:t,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--n8,__source:r,__self:n};if(typeof i=="function"&&(s=i.defaultProps))for(o in s)l[o]===void 0&&(l[o]=s[o]);return At.vnode&&At.vnode(h),h}var G_={exports:{}};/*! Tweakpane 3.0.8 (c) 2016 cocopon, licensed under the MIT license. */(function(i,e){(function(t,n){n(e)})(rl,function(t){class n{constructor(c){const[p,x]=c.split("-"),L=p.split(".");this.major=parseInt(L[0],10),this.minor=parseInt(L[1],10),this.patch=parseInt(L[2],10),this.prerelease=x??null}toString(){const c=[this.major,this.minor,this.patch].join(".");return this.prerelease!==null?[c,this.prerelease].join("-"):c}}class r{constructor(c){this.controller_=c}get disabled(){return this.controller_.viewProps.get("disabled")}set disabled(c){this.controller_.viewProps.set("disabled",c)}get hidden(){return this.controller_.viewProps.get("hidden")}set hidden(c){this.controller_.viewProps.set("hidden",c)}dispose(){this.controller_.viewProps.set("disposed",!0)}}class s{constructor(c){this.target=c}}class o extends s{constructor(c,p,x,L){super(c),this.value=p,this.presetKey=x,this.last=L??!0}}class l extends s{constructor(c,p,x){super(c),this.value=p,this.presetKey=x}}class h extends s{constructor(c,p){super(c),this.expanded=p}}function d(m){return m}function f(m){return m==null}function g(m,c){if(m.length!==c.length)return!1;for(let p=0;p<m.length;p++)if(m[p]!==c[p])return!1;return!0}const y={alreadydisposed:()=>"View has been already disposed",invalidparams:m=>`Invalid parameters for '${m.name}'`,nomatchingcontroller:m=>`No matching controller for '${m.key}'`,nomatchingview:m=>`No matching view for '${JSON.stringify(m.params)}'`,notbindable:()=>"Value is not bindable",propertynotfound:m=>`Property '${m.name}' not found`,shouldneverhappen:()=>"This error should never happen"};class _{constructor(c){var p;this.message=(p=y[c.type](c.context))!==null&&p!==void 0?p:"Unexpected error",this.name=this.constructor.name,this.stack=new Error(this.message).stack,this.type=c.type}static alreadyDisposed(){return new _({type:"alreadydisposed"})}static notBindable(){return new _({type:"notbindable"})}static propertyNotFound(c){return new _({type:"propertynotfound",context:{name:c}})}static shouldNeverHappen(){return new _({type:"shouldneverhappen"})}}class w{constructor(c,p,x){this.obj_=c,this.key_=p,this.presetKey_=x??p}static isBindable(c){return!(c===null||typeof c!="object")}get key(){return this.key_}get presetKey(){return this.presetKey_}read(){return this.obj_[this.key_]}write(c){this.obj_[this.key_]=c}writeProperty(c,p){const x=this.read();if(!w.isBindable(x))throw _.notBindable();if(!(c in x))throw _.propertyNotFound(c);x[c]=p}}class S extends r{get label(){return this.controller_.props.get("label")}set label(c){this.controller_.props.set("label",c)}get title(){var c;return(c=this.controller_.valueController.props.get("title"))!==null&&c!==void 0?c:""}set title(c){this.controller_.valueController.props.set("title",c)}on(c,p){const x=p.bind(this);return this.controller_.valueController.emitter.on(c,()=>{x(new s(this))}),this}}class b{constructor(){this.observers_={}}on(c,p){let x=this.observers_[c];return x||(x=this.observers_[c]=[]),x.push({handler:p}),this}off(c,p){const x=this.observers_[c];return x&&(this.observers_[c]=x.filter(L=>L.handler!==p)),this}emit(c,p){const x=this.observers_[c];x&&x.forEach(L=>{L.handler(p)})}}const T="tp";function E(m){return(p,x)=>[T,"-",m,"v",p?`_${p}`:"",x?`-${x}`:""].join("")}function C(m,c){return p=>c(m(p))}function A(m){return m.rawValue}function D(m,c){m.emitter.on("change",C(A,c)),c(m.rawValue)}function I(m,c,p){D(m.value(c),p)}function F(m,c,p){p?m.classList.add(c):m.classList.remove(c)}function P(m,c){return p=>{F(m,c,p)}}function k(m,c){D(m,p=>{c.textContent=p??""})}const j=E("btn");class G{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(j()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("button");x.classList.add(j("b")),p.viewProps.bindDisabled(x),this.element.appendChild(x),this.buttonElement=x;const L=c.createElement("div");L.classList.add(j("t")),k(p.props.value("title"),L),this.buttonElement.appendChild(L)}}class ne{constructor(c,p){this.emitter=new b,this.onClick_=this.onClick_.bind(this),this.props=p.props,this.viewProps=p.viewProps,this.view=new G(c,{props:this.props,viewProps:this.viewProps}),this.view.buttonElement.addEventListener("click",this.onClick_)}onClick_(){this.emitter.emit("click",{sender:this})}}class ce{constructor(c,p){var x;this.constraint_=p==null?void 0:p.constraint,this.equals_=(x=p==null?void 0:p.equals)!==null&&x!==void 0?x:(L,q)=>L===q,this.emitter=new b,this.rawValue_=c}get constraint(){return this.constraint_}get rawValue(){return this.rawValue_}set rawValue(c){this.setRawValue(c,{forceEmit:!1,last:!0})}setRawValue(c,p){const x=p??{forceEmit:!1,last:!0},L=this.constraint_?this.constraint_.constrain(c):c;this.equals_(this.rawValue_,L)&&!x.forceEmit||(this.emitter.emit("beforechange",{sender:this}),this.rawValue_=L,this.emitter.emit("change",{options:x,rawValue:L,sender:this}))}}class Z{constructor(c){this.emitter=new b,this.value_=c}get rawValue(){return this.value_}set rawValue(c){this.setRawValue(c,{forceEmit:!1,last:!0})}setRawValue(c,p){const x=p??{forceEmit:!1,last:!0};this.value_===c&&!x.forceEmit||(this.emitter.emit("beforechange",{sender:this}),this.value_=c,this.emitter.emit("change",{options:x,rawValue:this.value_,sender:this}))}}function $(m,c){const p=c==null?void 0:c.constraint,x=c==null?void 0:c.equals;return!p&&!x?new Z(m):new ce(m,c)}class K{constructor(c){this.emitter=new b,this.valMap_=c;for(const p in this.valMap_)this.valMap_[p].emitter.on("change",()=>{this.emitter.emit("change",{key:p,sender:this})})}static createCore(c){return Object.keys(c).reduce((x,L)=>Object.assign(x,{[L]:$(c[L])}),{})}static fromObject(c){const p=this.createCore(c);return new K(p)}get(c){return this.valMap_[c].rawValue}set(c,p){this.valMap_[c].rawValue=p}value(c){return this.valMap_[c]}}function pe(m,c){const x=Object.keys(c).reduce((L,q)=>{if(L===void 0)return;const ee=c[q],Oe=ee(m[q]);return Oe.succeeded?Object.assign(Object.assign({},L),{[q]:Oe.value}):void 0},{});return x}function re(m,c){return m.reduce((p,x)=>{if(p===void 0)return;const L=c(x);if(!(!L.succeeded||L.value===void 0))return[...p,L.value]},[])}function se(m){return m===null?!1:typeof m=="object"}function ue(m){return c=>p=>{if(!c&&p===void 0)return{succeeded:!1,value:void 0};if(c&&p===void 0)return{succeeded:!0,value:void 0};const x=m(p);return x!==void 0?{succeeded:!0,value:x}:{succeeded:!1,value:void 0}}}function Te(m){return{custom:c=>ue(c)(m),boolean:ue(c=>typeof c=="boolean"?c:void 0)(m),number:ue(c=>typeof c=="number"?c:void 0)(m),string:ue(c=>typeof c=="string"?c:void 0)(m),function:ue(c=>typeof c=="function"?c:void 0)(m),constant:c=>ue(p=>p===c?c:void 0)(m),raw:ue(c=>c)(m),object:c=>ue(p=>{if(se(p))return pe(p,c)})(m),array:c=>ue(p=>{if(Array.isArray(p))return re(p,c)})(m)}}const fe={optional:Te(!0),required:Te(!1)};function Ce(m,c){const p=fe.required.object(c)(m);return p.succeeded?p.value:void 0}function qe(m){return m&&m.parentElement&&m.parentElement.removeChild(m),null}function Ke(){return["veryfirst","first","last","verylast"]}const me=E(""),Ut={veryfirst:"vfst",first:"fst",last:"lst",verylast:"vlst"};class nt{constructor(c){this.parent_=null,this.blade=c.blade,this.view=c.view,this.viewProps=c.viewProps;const p=this.view.element;this.blade.value("positions").emitter.on("change",()=>{Ke().forEach(x=>{p.classList.remove(me(void 0,Ut[x]))}),this.blade.get("positions").forEach(x=>{p.classList.add(me(void 0,Ut[x]))})}),this.viewProps.handleDispose(()=>{qe(p)})}get parent(){return this.parent_}}const it="http://www.w3.org/2000/svg";function Le(m){m.offsetHeight}function vt(m,c){const p=m.style.transition;m.style.transition="none",c(),m.style.transition=p}function ve(m){return m.ontouchstart!==void 0}function xe(){return new Function("return this")()}function Ae(){return xe().document}function We(m){const c=m.ownerDocument.defaultView;return c&&"document"in c?m.getContext("2d"):null}const Be={check:'<path d="M2 8l4 4l8 -8"/>',dropdown:'<path d="M5 7h6l-3 3 z"/>',p2dpad:'<path d="M8 4v8"/><path d="M4 8h8"/><circle cx="12" cy="12" r="1.2"/>'};function rt(m,c){const p=m.createElementNS(it,"svg");return p.innerHTML=Be[c],p}function ot(m,c,p){m.insertBefore(c,m.children[p])}function st(m){m.parentElement&&m.parentElement.removeChild(m)}function Ft(m){for(;m.children.length>0;)m.removeChild(m.children[0])}function yt(m){for(;m.childNodes.length>0;)m.removeChild(m.childNodes[0])}function H(m){return m.relatedTarget?m.relatedTarget:"explicitOriginalTarget"in m?m.explicitOriginalTarget:null}const B=E("lbl");function he(m,c){const p=m.createDocumentFragment();return c.split(`
|
||
`).map(L=>m.createTextNode(L)).forEach((L,q)=>{q>0&&p.appendChild(m.createElement("br")),p.appendChild(L)}),p}class we{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(B()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("div");x.classList.add(B("l")),I(p.props,"label",q=>{f(q)?this.element.classList.add(B(void 0,"nol")):(this.element.classList.remove(B(void 0,"nol")),yt(x),x.appendChild(he(c,q)))}),this.element.appendChild(x),this.labelElement=x;const L=c.createElement("div");L.classList.add(B("v")),this.element.appendChild(L),this.valueElement=L}}class Ne extends nt{constructor(c,p){const x=p.valueController.viewProps;super(Object.assign(Object.assign({},p),{view:new we(c,{props:p.props,viewProps:x}),viewProps:x})),this.props=p.props,this.valueController=p.valueController,this.view.valueElement.appendChild(this.valueController.view.element)}}const Ue={id:"button",type:"blade",accept(m){const c=fe,p=Ce(m,{title:c.required.string,view:c.required.constant("button"),label:c.optional.string});return p?{params:p}:null},controller(m){return new Ne(m.document,{blade:m.blade,props:K.fromObject({label:m.params.label}),valueController:new ne(m.document,{props:K.fromObject({title:m.params.title}),viewProps:m.viewProps})})},api(m){return!(m.controller instanceof Ne)||!(m.controller.valueController instanceof ne)?null:new S(m.controller)}};class Xe extends nt{constructor(c){super(c),this.value=c.value}}function U(){return new K({positions:$([],{equals:g})})}class Ee extends K{constructor(c){super(c)}static create(c){const p={completed:!0,expanded:c,expandedHeight:null,shouldFixHeight:!1,temporaryExpanded:null},x=K.createCore(p);return new Ee(x)}get styleExpanded(){var c;return(c=this.get("temporaryExpanded"))!==null&&c!==void 0?c:this.get("expanded")}get styleHeight(){if(!this.styleExpanded)return"0";const c=this.get("expandedHeight");return this.get("shouldFixHeight")&&!f(c)?`${c}px`:"auto"}bindExpandedClass(c,p){const x=()=>{this.styleExpanded?c.classList.add(p):c.classList.remove(p)};I(this,"expanded",x),I(this,"temporaryExpanded",x)}cleanUpTransition(){this.set("shouldFixHeight",!1),this.set("expandedHeight",null),this.set("completed",!0)}}function Je(m,c){let p=0;return vt(c,()=>{m.set("expandedHeight",null),m.set("temporaryExpanded",!0),Le(c),p=c.clientHeight,m.set("temporaryExpanded",null),Le(c)}),p}function ke(m,c){c.style.height=m.styleHeight}function X(m,c){m.value("expanded").emitter.on("beforechange",()=>{m.set("completed",!1),f(m.get("expandedHeight"))&&m.set("expandedHeight",Je(m,c)),m.set("shouldFixHeight",!0),Le(c)}),m.emitter.on("change",()=>{ke(m,c)}),ke(m,c),c.addEventListener("transitionend",p=>{p.propertyName==="height"&&m.cleanUpTransition()})}class Re extends r{constructor(c,p){super(c),this.rackApi_=p}}function De(m,c){return m.addBlade(Object.assign(Object.assign({},c),{view:"button"}))}function at(m,c){return m.addBlade(Object.assign(Object.assign({},c),{view:"folder"}))}function ze(m,c){const p=c||{};return m.addBlade(Object.assign(Object.assign({},p),{view:"separator"}))}function et(m,c){return m.addBlade(Object.assign(Object.assign({},c),{view:"tab"}))}class Ie{constructor(c){this.emitter=new b,this.items_=[],this.cache_=new Set,this.onSubListAdd_=this.onSubListAdd_.bind(this),this.onSubListRemove_=this.onSubListRemove_.bind(this),this.extract_=c}get items(){return this.items_}allItems(){return Array.from(this.cache_)}find(c){for(const p of this.allItems())if(c(p))return p;return null}includes(c){return this.cache_.has(c)}add(c,p){if(this.includes(c))throw _.shouldNeverHappen();const x=p!==void 0?p:this.items_.length;this.items_.splice(x,0,c),this.cache_.add(c);const L=this.extract_(c);L&&(L.emitter.on("add",this.onSubListAdd_),L.emitter.on("remove",this.onSubListRemove_),L.allItems().forEach(q=>{this.cache_.add(q)})),this.emitter.emit("add",{index:x,item:c,root:this,target:this})}remove(c){const p=this.items_.indexOf(c);if(p<0)return;this.items_.splice(p,1),this.cache_.delete(c);const x=this.extract_(c);x&&(x.emitter.off("add",this.onSubListAdd_),x.emitter.off("remove",this.onSubListRemove_)),this.emitter.emit("remove",{index:p,item:c,root:this,target:this})}onSubListAdd_(c){this.cache_.add(c.item),this.emitter.emit("add",{index:c.index,item:c.item,root:this,target:c.target})}onSubListRemove_(c){this.cache_.delete(c.item),this.emitter.emit("remove",{index:c.index,item:c.item,root:this,target:c.target})}}class ct extends r{constructor(c){super(c),this.onBindingChange_=this.onBindingChange_.bind(this),this.emitter_=new b,this.controller_.binding.emitter.on("change",this.onBindingChange_)}get label(){return this.controller_.props.get("label")}set label(c){this.controller_.props.set("label",c)}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}refresh(){this.controller_.binding.read()}onBindingChange_(c){const p=c.sender.target.read();this.emitter_.emit("change",{event:new o(this,p,this.controller_.binding.target.presetKey,c.options.last)})}}class wt extends Ne{constructor(c,p){super(c,p),this.binding=p.binding}}class Ct extends r{constructor(c){super(c),this.onBindingUpdate_=this.onBindingUpdate_.bind(this),this.emitter_=new b,this.controller_.binding.emitter.on("update",this.onBindingUpdate_)}get label(){return this.controller_.props.get("label")}set label(c){this.controller_.props.set("label",c)}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}refresh(){this.controller_.binding.read()}onBindingUpdate_(c){const p=c.sender.target.read();this.emitter_.emit("update",{event:new l(this,p,this.controller_.binding.target.presetKey)})}}class jn extends Ne{constructor(c,p){super(c,p),this.binding=p.binding,this.viewProps.bindDisabled(this.binding.ticker),this.viewProps.handleDispose(()=>{this.binding.dispose()})}}function Yi(m){return m instanceof Vs?m.apiSet_:m instanceof Re?m.rackApi_.apiSet_:null}function Us(m,c){const p=m.find(x=>x.controller_===c);if(!p)throw _.shouldNeverHappen();return p}function Fs(m,c,p){if(!w.isBindable(m))throw _.notBindable();return new w(m,c,p)}class Vs extends r{constructor(c,p){super(c),this.onRackAdd_=this.onRackAdd_.bind(this),this.onRackRemove_=this.onRackRemove_.bind(this),this.onRackInputChange_=this.onRackInputChange_.bind(this),this.onRackMonitorUpdate_=this.onRackMonitorUpdate_.bind(this),this.emitter_=new b,this.apiSet_=new Ie(Yi),this.pool_=p;const x=this.controller_.rack;x.emitter.on("add",this.onRackAdd_),x.emitter.on("remove",this.onRackRemove_),x.emitter.on("inputchange",this.onRackInputChange_),x.emitter.on("monitorupdate",this.onRackMonitorUpdate_),x.children.forEach(L=>{this.setUpApi_(L)})}get children(){return this.controller_.rack.children.map(c=>Us(this.apiSet_,c))}addInput(c,p,x){const L=x||{},q=this.controller_.view.element.ownerDocument,ee=this.pool_.createInput(q,Fs(c,p,L.presetKey),L),Oe=new ct(ee);return this.add(Oe,L.index)}addMonitor(c,p,x){const L=x||{},q=this.controller_.view.element.ownerDocument,ee=this.pool_.createMonitor(q,Fs(c,p),L),Oe=new Ct(ee);return this.add(Oe,L.index)}addFolder(c){return at(this,c)}addButton(c){return De(this,c)}addSeparator(c){return ze(this,c)}addTab(c){return et(this,c)}add(c,p){this.controller_.rack.add(c.controller_,p);const x=this.apiSet_.find(L=>L.controller_===c.controller_);return x&&this.apiSet_.remove(x),this.apiSet_.add(c),c}remove(c){this.controller_.rack.remove(c.controller_)}addBlade(c){const p=this.controller_.view.element.ownerDocument,x=this.pool_.createBlade(p,c),L=this.pool_.createBladeApi(x);return this.add(L,c.index)}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}setUpApi_(c){this.apiSet_.find(x=>x.controller_===c)||this.apiSet_.add(this.pool_.createBladeApi(c))}onRackAdd_(c){this.setUpApi_(c.bladeController)}onRackRemove_(c){if(c.isRoot){const p=Us(this.apiSet_,c.bladeController);this.apiSet_.remove(p)}}onRackInputChange_(c){const p=c.bladeController;if(p instanceof wt){const x=Us(this.apiSet_,p),L=p.binding;this.emitter_.emit("change",{event:new o(x,L.target.read(),L.target.presetKey,c.options.last)})}else if(p instanceof Xe){const x=Us(this.apiSet_,p);this.emitter_.emit("change",{event:new o(x,p.value.rawValue,void 0,c.options.last)})}}onRackMonitorUpdate_(c){if(!(c.bladeController instanceof jn))throw _.shouldNeverHappen();const p=Us(this.apiSet_,c.bladeController),x=c.bladeController.binding;this.emitter_.emit("update",{event:new l(p,x.target.read(),x.target.presetKey)})}}class Hs extends Re{constructor(c,p){super(c,new Vs(c.rackController,p)),this.emitter_=new b,this.controller_.foldable.value("expanded").emitter.on("change",x=>{this.emitter_.emit("fold",{event:new h(this,x.sender.rawValue)})}),this.rackApi_.on("change",x=>{this.emitter_.emit("change",{event:x})}),this.rackApi_.on("update",x=>{this.emitter_.emit("update",{event:x})})}get expanded(){return this.controller_.foldable.get("expanded")}set expanded(c){this.controller_.foldable.set("expanded",c)}get title(){return this.controller_.props.get("title")}set title(c){this.controller_.props.set("title",c)}get children(){return this.rackApi_.children}addInput(c,p,x){return this.rackApi_.addInput(c,p,x)}addMonitor(c,p,x){return this.rackApi_.addMonitor(c,p,x)}addFolder(c){return this.rackApi_.addFolder(c)}addButton(c){return this.rackApi_.addButton(c)}addSeparator(c){return this.rackApi_.addSeparator(c)}addTab(c){return this.rackApi_.addTab(c)}add(c,p){return this.rackApi_.add(c,p)}remove(c){this.rackApi_.remove(c)}addBlade(c){return this.rackApi_.addBlade(c)}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}}class Co extends nt{constructor(c){super({blade:c.blade,view:c.view,viewProps:c.rackController.viewProps}),this.rackController=c.rackController}}class gu{constructor(c,p){const x=E(p.viewName);this.element=c.createElement("div"),this.element.classList.add(x()),p.viewProps.bindClassModifiers(this.element)}}function Aa(m,c){for(let p=0;p<m.length;p++){const x=m[p];if(x instanceof wt&&x.binding===c)return x}return null}function yu(m,c){for(let p=0;p<m.length;p++){const x=m[p];if(x instanceof jn&&x.binding===c)return x}return null}function V(m,c){for(let p=0;p<m.length;p++){const x=m[p];if(x instanceof Xe&&x.value===c)return x}return null}function te(m){return m instanceof ge?m.rack:m instanceof Co?m.rackController.rack:null}function de(m){const c=te(m);return c?c.bcSet_:null}class oe{constructor(c){var p;this.onBladePositionsChange_=this.onBladePositionsChange_.bind(this),this.onSetAdd_=this.onSetAdd_.bind(this),this.onSetRemove_=this.onSetRemove_.bind(this),this.onChildDispose_=this.onChildDispose_.bind(this),this.onChildPositionsChange_=this.onChildPositionsChange_.bind(this),this.onChildInputChange_=this.onChildInputChange_.bind(this),this.onChildMonitorUpdate_=this.onChildMonitorUpdate_.bind(this),this.onChildValueChange_=this.onChildValueChange_.bind(this),this.onChildViewPropsChange_=this.onChildViewPropsChange_.bind(this),this.onDescendantLayout_=this.onDescendantLayout_.bind(this),this.onDescendantInputChange_=this.onDescendantInputChange_.bind(this),this.onDescendantMonitorUpdate_=this.onDescendantMonitorUpdate_.bind(this),this.emitter=new b,this.blade_=c??null,(p=this.blade_)===null||p===void 0||p.value("positions").emitter.on("change",this.onBladePositionsChange_),this.bcSet_=new Ie(de),this.bcSet_.emitter.on("add",this.onSetAdd_),this.bcSet_.emitter.on("remove",this.onSetRemove_)}get children(){return this.bcSet_.items}add(c,p){c.parent&&c.parent.remove(c),c.parent_=this,this.bcSet_.add(c,p)}remove(c){c.parent_=null,this.bcSet_.remove(c)}find(c){return this.bcSet_.allItems().filter(p=>p instanceof c)}onSetAdd_(c){this.updatePositions_();const p=c.target===c.root;if(this.emitter.emit("add",{bladeController:c.item,index:c.index,isRoot:p,sender:this}),!p)return;const x=c.item;if(x.viewProps.emitter.on("change",this.onChildViewPropsChange_),x.blade.value("positions").emitter.on("change",this.onChildPositionsChange_),x.viewProps.handleDispose(this.onChildDispose_),x instanceof wt)x.binding.emitter.on("change",this.onChildInputChange_);else if(x instanceof jn)x.binding.emitter.on("update",this.onChildMonitorUpdate_);else if(x instanceof Xe)x.value.emitter.on("change",this.onChildValueChange_);else{const L=te(x);if(L){const q=L.emitter;q.on("layout",this.onDescendantLayout_),q.on("inputchange",this.onDescendantInputChange_),q.on("monitorupdate",this.onDescendantMonitorUpdate_)}}}onSetRemove_(c){this.updatePositions_();const p=c.target===c.root;if(this.emitter.emit("remove",{bladeController:c.item,isRoot:p,sender:this}),!p)return;const x=c.item;if(x instanceof wt)x.binding.emitter.off("change",this.onChildInputChange_);else if(x instanceof jn)x.binding.emitter.off("update",this.onChildMonitorUpdate_);else if(x instanceof Xe)x.value.emitter.off("change",this.onChildValueChange_);else{const L=te(x);if(L){const q=L.emitter;q.off("layout",this.onDescendantLayout_),q.off("inputchange",this.onDescendantInputChange_),q.off("monitorupdate",this.onDescendantMonitorUpdate_)}}}updatePositions_(){const c=this.bcSet_.items.filter(L=>!L.viewProps.get("hidden")),p=c[0],x=c[c.length-1];this.bcSet_.items.forEach(L=>{const q=[];L===p&&(q.push("first"),(!this.blade_||this.blade_.get("positions").includes("veryfirst"))&&q.push("veryfirst")),L===x&&(q.push("last"),(!this.blade_||this.blade_.get("positions").includes("verylast"))&&q.push("verylast")),L.blade.set("positions",q)})}onChildPositionsChange_(){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onChildViewPropsChange_(c){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onChildDispose_(){this.bcSet_.items.filter(p=>p.viewProps.get("disposed")).forEach(p=>{this.bcSet_.remove(p)})}onChildInputChange_(c){const p=Aa(this.find(wt),c.sender);if(!p)throw _.shouldNeverHappen();this.emitter.emit("inputchange",{bladeController:p,options:c.options,sender:this})}onChildMonitorUpdate_(c){const p=yu(this.find(jn),c.sender);if(!p)throw _.shouldNeverHappen();this.emitter.emit("monitorupdate",{bladeController:p,sender:this})}onChildValueChange_(c){const p=V(this.find(Xe),c.sender);if(!p)throw _.shouldNeverHappen();this.emitter.emit("inputchange",{bladeController:p,options:c.options,sender:this})}onDescendantLayout_(c){this.updatePositions_(),this.emitter.emit("layout",{sender:this})}onDescendantInputChange_(c){this.emitter.emit("inputchange",{bladeController:c.bladeController,options:c.options,sender:this})}onDescendantMonitorUpdate_(c){this.emitter.emit("monitorupdate",{bladeController:c.bladeController,sender:this})}onBladePositionsChange_(){this.updatePositions_()}}class ge extends nt{constructor(c,p){super(Object.assign(Object.assign({},p),{view:new gu(c,{viewName:"brk",viewProps:p.viewProps})})),this.onRackAdd_=this.onRackAdd_.bind(this),this.onRackRemove_=this.onRackRemove_.bind(this);const x=new oe(p.root?void 0:p.blade);x.emitter.on("add",this.onRackAdd_),x.emitter.on("remove",this.onRackRemove_),this.rack=x,this.viewProps.handleDispose(()=>{for(let L=this.rack.children.length-1;L>=0;L--)this.rack.children[L].viewProps.set("disposed",!0)})}onRackAdd_(c){c.isRoot&&ot(this.view.element,c.bladeController.view.element,c.index)}onRackRemove_(c){c.isRoot&&st(c.bladeController.view.element)}}const ht=E("cnt");class gt{constructor(c,p){this.className_=E(p.viewName||"fld"),this.element=c.createElement("div"),this.element.classList.add(this.className_(),ht()),p.viewProps.bindClassModifiers(this.element),this.foldable_=p.foldable,this.foldable_.bindExpandedClass(this.element,this.className_(void 0,"expanded")),I(this.foldable_,"completed",P(this.element,this.className_(void 0,"cpl")));const x=c.createElement("button");x.classList.add(this.className_("b")),I(p.props,"title",Oe=>{f(Oe)?this.element.classList.add(this.className_(void 0,"not")):this.element.classList.remove(this.className_(void 0,"not"))}),p.viewProps.bindDisabled(x),this.element.appendChild(x),this.buttonElement=x;const L=c.createElement("div");L.classList.add(this.className_("t")),k(p.props.value("title"),L),this.buttonElement.appendChild(L),this.titleElement=L;const q=c.createElement("div");q.classList.add(this.className_("m")),this.buttonElement.appendChild(q);const ee=p.containerElement;ee.classList.add(this.className_("c")),this.element.appendChild(ee),this.containerElement=ee}}class _t extends Co{constructor(c,p){var x;const L=Ee.create((x=p.expanded)!==null&&x!==void 0?x:!0),q=new ge(c,{blade:p.blade,root:p.root,viewProps:p.viewProps});super(Object.assign(Object.assign({},p),{rackController:q,view:new gt(c,{containerElement:q.view.element,foldable:L,props:p.props,viewName:p.root?"rot":void 0,viewProps:p.viewProps})})),this.onTitleClick_=this.onTitleClick_.bind(this),this.props=p.props,this.foldable=L,X(this.foldable,this.view.containerElement),this.rackController.rack.emitter.on("add",()=>{this.foldable.cleanUpTransition()}),this.rackController.rack.emitter.on("remove",()=>{this.foldable.cleanUpTransition()}),this.view.buttonElement.addEventListener("click",this.onTitleClick_)}get document(){return this.view.element.ownerDocument}onTitleClick_(){this.foldable.set("expanded",!this.foldable.get("expanded"))}}const St={id:"folder",type:"blade",accept(m){const c=fe,p=Ce(m,{title:c.required.string,view:c.required.constant("folder"),expanded:c.optional.boolean});return p?{params:p}:null},controller(m){return new _t(m.document,{blade:m.blade,expanded:m.params.expanded,props:K.fromObject({title:m.params.title}),viewProps:m.viewProps})},api(m){return m.controller instanceof _t?new Hs(m.controller,m.pool):null}};class Dt extends Xe{constructor(c,p){const x=p.valueController.viewProps;super(Object.assign(Object.assign({},p),{value:p.valueController.value,view:new we(c,{props:p.props,viewProps:x}),viewProps:x})),this.props=p.props,this.valueController=p.valueController,this.view.valueElement.appendChild(this.valueController.view.element)}}class Nt extends r{}const Vt=E("spr");class yn{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(Vt()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("hr");x.classList.add(Vt("r")),this.element.appendChild(x)}}class Tr extends nt{constructor(c,p){super(Object.assign(Object.assign({},p),{view:new yn(c,{viewProps:p.viewProps})}))}}const ls={id:"separator",type:"blade",accept(m){const p=Ce(m,{view:fe.required.constant("separator")});return p?{params:p}:null},controller(m){return new Tr(m.document,{blade:m.blade,viewProps:m.viewProps})},api(m){return m.controller instanceof Tr?new Nt(m.controller):null}},cs=E("");function ci(m,c){return P(m,cs(void 0,c))}class Pt extends K{constructor(c){super(c)}static create(c){var p,x;const L=c??{},q={disabled:(p=L.disabled)!==null&&p!==void 0?p:!1,disposed:!1,hidden:(x=L.hidden)!==null&&x!==void 0?x:!1},ee=K.createCore(q);return new Pt(ee)}bindClassModifiers(c){I(this,"disabled",ci(c,"disabled")),I(this,"hidden",ci(c,"hidden"))}bindDisabled(c){I(this,"disabled",p=>{c.disabled=p})}bindTabIndex(c){I(this,"disabled",p=>{c.tabIndex=p?-1:0})}handleDispose(c){this.value("disposed").emitter.on("change",p=>{p&&c()})}}const gi=E("tbi");class Cn{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(gi()),p.viewProps.bindClassModifiers(this.element),I(p.props,"selected",q=>{q?this.element.classList.add(gi(void 0,"sel")):this.element.classList.remove(gi(void 0,"sel"))});const x=c.createElement("button");x.classList.add(gi("b")),p.viewProps.bindDisabled(x),this.element.appendChild(x),this.buttonElement=x;const L=c.createElement("div");L.classList.add(gi("t")),k(p.props.value("title"),L),this.buttonElement.appendChild(L),this.titleElement=L}}class Zi{constructor(c,p){this.emitter=new b,this.onClick_=this.onClick_.bind(this),this.props=p.props,this.viewProps=p.viewProps,this.view=new Cn(c,{props:p.props,viewProps:p.viewProps}),this.view.buttonElement.addEventListener("click",this.onClick_)}onClick_(){this.emitter.emit("click",{sender:this})}}class or{constructor(c,p){this.onItemClick_=this.onItemClick_.bind(this),this.ic_=new Zi(c,{props:p.itemProps,viewProps:Pt.create()}),this.ic_.emitter.on("click",this.onItemClick_),this.cc_=new ge(c,{blade:U(),viewProps:Pt.create()}),this.props=p.props,I(this.props,"selected",x=>{this.itemController.props.set("selected",x),this.contentController.viewProps.set("hidden",!x)})}get itemController(){return this.ic_}get contentController(){return this.cc_}onItemClick_(){this.props.set("selected",!0)}}class zr{constructor(c,p){this.controller_=c,this.rackApi_=p}get title(){var c;return(c=this.controller_.itemController.props.get("title"))!==null&&c!==void 0?c:""}set title(c){this.controller_.itemController.props.set("title",c)}get selected(){return this.controller_.props.get("selected")}set selected(c){this.controller_.props.set("selected",c)}get children(){return this.rackApi_.children}addButton(c){return this.rackApi_.addButton(c)}addFolder(c){return this.rackApi_.addFolder(c)}addSeparator(c){return this.rackApi_.addSeparator(c)}addTab(c){return this.rackApi_.addTab(c)}add(c,p){this.rackApi_.add(c,p)}remove(c){this.rackApi_.remove(c)}addInput(c,p,x){return this.rackApi_.addInput(c,p,x)}addMonitor(c,p,x){return this.rackApi_.addMonitor(c,p,x)}addBlade(c){return this.rackApi_.addBlade(c)}}class Gs extends Re{constructor(c,p){super(c,new Vs(c.rackController,p)),this.onPageAdd_=this.onPageAdd_.bind(this),this.onPageRemove_=this.onPageRemove_.bind(this),this.emitter_=new b,this.pageApiMap_=new Map,this.rackApi_.on("change",x=>{this.emitter_.emit("change",{event:x})}),this.rackApi_.on("update",x=>{this.emitter_.emit("update",{event:x})}),this.controller_.pageSet.emitter.on("add",this.onPageAdd_),this.controller_.pageSet.emitter.on("remove",this.onPageRemove_),this.controller_.pageSet.items.forEach(x=>{this.setUpPageApi_(x)})}get pages(){return this.controller_.pageSet.items.map(c=>{const p=this.pageApiMap_.get(c);if(!p)throw _.shouldNeverHappen();return p})}addPage(c){const p=this.controller_.view.element.ownerDocument,x=new or(p,{itemProps:K.fromObject({selected:!1,title:c.title}),props:K.fromObject({selected:!1})});this.controller_.add(x,c.index);const L=this.pageApiMap_.get(x);if(!L)throw _.shouldNeverHappen();return L}removePage(c){this.controller_.remove(c)}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}setUpPageApi_(c){const p=this.rackApi_.apiSet_.find(L=>L.controller_===c.contentController);if(!p)throw _.shouldNeverHappen();const x=new zr(c,p);this.pageApiMap_.set(c,x)}onPageAdd_(c){this.setUpPageApi_(c.item)}onPageRemove_(c){if(!this.pageApiMap_.get(c.item))throw _.shouldNeverHappen();this.pageApiMap_.delete(c.item)}}const On=E("tab");class Ws{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(On(),ht()),p.viewProps.bindClassModifiers(this.element),D(p.empty,P(this.element,On(void 0,"nop")));const x=c.createElement("div");x.classList.add(On("i")),this.element.appendChild(x),this.itemsElement=x;const L=p.contentsElement;L.classList.add(On("c")),this.element.appendChild(L),this.contentsElement=L}}class Po extends Co{constructor(c,p){const x=new ge(c,{blade:p.blade,viewProps:p.viewProps}),L=$(!0);super({blade:p.blade,rackController:x,view:new Ws(c,{contentsElement:x.view.element,empty:L,viewProps:p.viewProps})}),this.onPageAdd_=this.onPageAdd_.bind(this),this.onPageRemove_=this.onPageRemove_.bind(this),this.onPageSelectedChange_=this.onPageSelectedChange_.bind(this),this.pageSet_=new Ie(()=>null),this.pageSet_.emitter.on("add",this.onPageAdd_),this.pageSet_.emitter.on("remove",this.onPageRemove_),this.empty_=L,this.applyPages_()}get pageSet(){return this.pageSet_}add(c,p){this.pageSet_.add(c,p??this.pageSet_.items.length)}remove(c){this.pageSet_.remove(this.pageSet_.items[c])}applyPages_(){this.keepSelection_(),this.empty_.rawValue=this.pageSet_.items.length===0}onPageAdd_(c){const p=c.item;ot(this.view.itemsElement,p.itemController.view.element,c.index),this.rackController.rack.add(p.contentController,c.index),p.props.value("selected").emitter.on("change",this.onPageSelectedChange_),this.applyPages_()}onPageRemove_(c){const p=c.item;st(p.itemController.view.element),this.rackController.rack.remove(p.contentController),p.props.value("selected").emitter.off("change",this.onPageSelectedChange_),this.applyPages_()}keepSelection_(){if(this.pageSet_.items.length===0)return;const c=this.pageSet_.items.findIndex(p=>p.props.get("selected"));c<0?this.pageSet_.items.forEach((p,x)=>{p.props.set("selected",x===0)}):this.pageSet_.items.forEach((p,x)=>{p.props.set("selected",x===c)})}onPageSelectedChange_(c){if(c.rawValue){const p=this.pageSet_.items.findIndex(x=>x.props.value("selected")===c.sender);this.pageSet_.items.forEach((x,L)=>{x.props.set("selected",L===p)})}else this.keepSelection_()}}const Ii={id:"tab",type:"blade",accept(m){const c=fe,p=Ce(m,{pages:c.required.array(c.required.object({title:c.required.string})),view:c.required.constant("tab")});return!p||p.pages.length===0?null:{params:p}},controller(m){const c=new Po(m.document,{blade:m.blade,viewProps:m.viewProps});return m.params.pages.forEach(p=>{const x=new or(m.document,{itemProps:K.fromObject({selected:!1,title:p.title}),props:K.fromObject({selected:!1})});c.add(x)}),c},api(m){return m.controller instanceof Po?new Gs(m.controller,m.pool):null}};function Hv(m,c){const p=m.accept(c.params);if(!p)return null;const x=fe.optional.boolean(c.params.disabled).value,L=fe.optional.boolean(c.params.hidden).value;return m.controller({blade:U(),document:c.document,params:Object.assign(Object.assign({},p.params),{disabled:x,hidden:L}),viewProps:Pt.create({disabled:x,hidden:L})})}class kd{constructor(){this.disabled=!1,this.emitter=new b}dispose(){}tick(){this.disabled||this.emitter.emit("tick",{sender:this})}}class Nd{constructor(c,p){this.disabled_=!1,this.timerId_=null,this.onTick_=this.onTick_.bind(this),this.doc_=c,this.emitter=new b,this.interval_=p,this.setTimer_()}get disabled(){return this.disabled_}set disabled(c){this.disabled_=c,this.disabled_?this.clearTimer_():this.setTimer_()}dispose(){this.clearTimer_()}clearTimer_(){if(this.timerId_===null)return;const c=this.doc_.defaultView;c&&c.clearInterval(this.timerId_),this.timerId_=null}setTimer_(){if(this.clearTimer_(),this.interval_<=0)return;const c=this.doc_.defaultView;c&&(this.timerId_=c.setInterval(this.onTick_,this.interval_))}onTick_(){this.disabled_||this.emitter.emit("tick",{sender:this})}}class us{constructor(c){this.constraints=c}constrain(c){return this.constraints.reduce((p,x)=>x.constrain(p),c)}}function Ki(m,c){if(m instanceof c)return m;if(m instanceof us){const p=m.constraints.reduce((x,L)=>x||(L instanceof c?L:null),null);if(p)return p}return null}class Ca{constructor(c){this.options=c}constrain(c){const p=this.options;return p.length===0||p.filter(L=>L.value===c).length>0?c:p[0].value}}class Si{constructor(c){this.maxValue=c.max,this.minValue=c.min}constrain(c){let p=c;return f(this.minValue)||(p=Math.max(p,this.minValue)),f(this.maxValue)||(p=Math.min(p,this.maxValue)),p}}class Ar{constructor(c){this.step=c}constrain(c){return(c<0?-Math.round(-c/this.step):Math.round(c/this.step))*this.step}}const Pl=E("lst");class Gv{constructor(c,p){this.onValueChange_=this.onValueChange_.bind(this),this.props_=p.props,this.element=c.createElement("div"),this.element.classList.add(Pl()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("select");x.classList.add(Pl("s")),I(this.props_,"options",q=>{Ft(x),q.forEach((ee,Oe)=>{const lt=c.createElement("option");lt.dataset.index=String(Oe),lt.textContent=ee.text,lt.value=String(ee.value),x.appendChild(lt)})}),p.viewProps.bindDisabled(x),this.element.appendChild(x),this.selectElement=x;const L=c.createElement("div");L.classList.add(Pl("m")),L.appendChild(rt(c,"dropdown")),this.element.appendChild(L),p.value.emitter.on("change",this.onValueChange_),this.value_=p.value,this.update_()}update_(){this.selectElement.value=String(this.value_.rawValue)}onValueChange_(){this.update_()}}class Ro{constructor(c,p){this.onSelectChange_=this.onSelectChange_.bind(this),this.props=p.props,this.value=p.value,this.viewProps=p.viewProps,this.view=new Gv(c,{props:this.props,value:this.value,viewProps:this.viewProps}),this.view.selectElement.addEventListener("change",this.onSelectChange_)}onSelectChange_(c){const x=c.currentTarget.selectedOptions.item(0);if(!x)return;const L=Number(x.dataset.index);this.value.rawValue=this.props.get("options")[L].value}}const _u=E("pop");class xu{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(_u()),p.viewProps.bindClassModifiers(this.element),D(p.shows,P(this.element,_u(void 0,"v")))}}class Bd{constructor(c,p){this.shows=$(!1),this.viewProps=p.viewProps,this.view=new xu(c,{shows:this.shows,viewProps:this.viewProps})}}const bu=E("txt");class wu{constructor(c,p){this.onChange_=this.onChange_.bind(this),this.element=c.createElement("div"),this.element.classList.add(bu()),p.viewProps.bindClassModifiers(this.element),this.props_=p.props,this.props_.emitter.on("change",this.onChange_);const x=c.createElement("input");x.classList.add(bu("i")),x.type="text",p.viewProps.bindDisabled(x),this.element.appendChild(x),this.inputElement=x,p.value.emitter.on("change",this.onChange_),this.value_=p.value,this.refresh()}refresh(){const c=this.props_.get("formatter");this.inputElement.value=c(this.value_.rawValue)}onChange_(){this.refresh()}}class Lo{constructor(c,p){this.onInputChange_=this.onInputChange_.bind(this),this.parser_=p.parser,this.props=p.props,this.value=p.value,this.viewProps=p.viewProps,this.view=new wu(c,{props:p.props,value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_)}onInputChange_(c){const x=c.currentTarget.value,L=this.parser_(x);f(L)||(this.value.rawValue=L),this.view.refresh()}}function Do(m){return String(m)}function Su(m){return m==="false"?!1:!!m}function Mu(m){return Do(m)}class Wv{constructor(c){this.text=c}evaluate(){return Number(this.text)}toString(){return this.text}}const zd={"**":(m,c)=>Math.pow(m,c),"*":(m,c)=>m*c,"/":(m,c)=>m/c,"%":(m,c)=>m%c,"+":(m,c)=>m+c,"-":(m,c)=>m-c,"<<":(m,c)=>m<<c,">>":(m,c)=>m>>c,">>>":(m,c)=>m>>>c,"&":(m,c)=>m&c,"^":(m,c)=>m^c,"|":(m,c)=>m|c};class Ud{constructor(c,p,x){this.left=p,this.operator=c,this.right=x}evaluate(){const c=zd[this.operator];if(!c)throw new Error(`unexpected binary operator: '${this.operator}`);return c(this.left.evaluate(),this.right.evaluate())}toString(){return["b(",this.left.toString(),this.operator,this.right.toString(),")"].join(" ")}}const Fd={"+":m=>m,"-":m=>-m,"~":m=>~m};class Vd{constructor(c,p){this.operator=c,this.expression=p}evaluate(){const c=Fd[this.operator];if(!c)throw new Error(`unexpected unary operator: '${this.operator}`);return c(this.expression.evaluate())}toString(){return["u(",this.operator,this.expression.toString(),")"].join(" ")}}function Eu(m){return(c,p)=>{for(let x=0;x<m.length;x++){const L=m[x](c,p);if(L!=="")return L}return""}}function Pa(m,c){var p;const x=m.substr(c).match(/^\s+/);return(p=x&&x[0])!==null&&p!==void 0?p:""}function jv(m,c){const p=m.substr(c,1);return p.match(/^[1-9]$/)?p:""}function Io(m,c){var p;const x=m.substr(c).match(/^[0-9]+/);return(p=x&&x[0])!==null&&p!==void 0?p:""}function Xv(m,c){const p=Io(m,c);if(p!=="")return p;const x=m.substr(c,1);if(c+=1,x!=="-"&&x!=="+")return"";const L=Io(m,c);return L===""?"":x+L}function Tu(m,c){const p=m.substr(c,1);if(c+=1,p.toLowerCase()!=="e")return"";const x=Xv(m,c);return x===""?"":p+x}function Hd(m,c){const p=m.substr(c,1);if(p==="0")return p;const x=jv(m,c);return c+=x.length,x===""?"":x+Io(m,c)}function qv(m,c){const p=Hd(m,c);if(c+=p.length,p==="")return"";const x=m.substr(c,1);if(c+=x.length,x!==".")return"";const L=Io(m,c);return c+=L.length,p+x+L+Tu(m,c)}function Au(m,c){const p=m.substr(c,1);if(c+=p.length,p!==".")return"";const x=Io(m,c);return c+=x.length,x===""?"":p+x+Tu(m,c)}function Yv(m,c){const p=Hd(m,c);return c+=p.length,p===""?"":p+Tu(m,c)}const Zv=Eu([qv,Au,Yv]);function Kv(m,c){var p;const x=m.substr(c).match(/^[01]+/);return(p=x&&x[0])!==null&&p!==void 0?p:""}function Jv(m,c){const p=m.substr(c,2);if(c+=p.length,p.toLowerCase()!=="0b")return"";const x=Kv(m,c);return x===""?"":p+x}function Qv(m,c){var p;const x=m.substr(c).match(/^[0-7]+/);return(p=x&&x[0])!==null&&p!==void 0?p:""}function vn(m,c){const p=m.substr(c,2);if(c+=p.length,p.toLowerCase()!=="0o")return"";const x=Qv(m,c);return x===""?"":p+x}function un(m,c){var p;const x=m.substr(c).match(/^[0-9a-f]+/i);return(p=x&&x[0])!==null&&p!==void 0?p:""}function $v(m,c){const p=m.substr(c,2);if(c+=p.length,p.toLowerCase()!=="0x")return"";const x=un(m,c);return x===""?"":p+x}const eg=Eu([Jv,vn,$v]),tg=Eu([eg,Zv]);function ng(m,c){const p=tg(m,c);return c+=p.length,p===""?null:{evaluable:new Wv(p),cursor:c}}function ig(m,c){const p=m.substr(c,1);if(c+=p.length,p!=="(")return null;const x=hs(m,c);if(!x)return null;c=x.cursor,c+=Pa(m,c).length;const L=m.substr(c,1);return c+=L.length,L!==")"?null:{evaluable:x.evaluable,cursor:c}}function rg(m,c){return ng(m,c)||ig(m,c)}function Cu(m,c){const p=rg(m,c);if(p)return p;const x=m.substr(c,1);if(c+=x.length,x!=="+"&&x!=="-"&&x!=="~")return null;const L=Cu(m,c);return L?(c=L.cursor,{cursor:c,evaluable:new Vd(x,L.evaluable)}):null}function sg(m,c,p){p+=Pa(c,p).length;const x=m.filter(L=>c.startsWith(L,p))[0];return x?(p+=x.length,p+=Pa(c,p).length,{cursor:p,operator:x}):null}function ni(m,c){return(p,x)=>{const L=m(p,x);if(!L)return null;x=L.cursor;let q=L.evaluable;for(;;){const ee=sg(c,p,x);if(!ee)break;x=ee.cursor;const Oe=m(p,x);if(!Oe)return null;x=Oe.cursor,q=new Ud(ee.operator,q,Oe.evaluable)}return q?{cursor:x,evaluable:q}:null}}const Pu=[["**"],["*","/","%"],["+","-"],["<<",">>>",">>"],["&"],["^"],["|"]].reduce((m,c)=>ni(m,c),Cu);function hs(m,c){return c+=Pa(m,c).length,Pu(m,c)}function Gd(m){const c=hs(m,0);return!c||c.cursor+Pa(m,c.cursor).length!==m.length?null:c.evaluable}function ar(m){var c;const p=Gd(m);return(c=p==null?void 0:p.evaluate())!==null&&c!==void 0?c:null}function Oi(m){if(typeof m=="number")return m;if(typeof m=="string"){const c=ar(m);if(!f(c))return c}return 0}function Wd(m){return String(m)}function yi(m){return c=>c.toFixed(Math.max(Math.min(m,20),0))}const jd=yi(0);function Ra(m){return jd(m)+"%"}function Ru(m){return String(m)}function Rl(m){return m}function Mi(m,c){for(;m.length<c;)m.push(void 0)}function og(m){const c=[];return Mi(c,m),$(c)}function Ji(m){const c=m.indexOf(void 0);return c<0?m:m.slice(0,c)}function ag(m,c){const p=[...Ji(m),c];return p.length>m.length?p.splice(0,p.length-m.length):Mi(p,m.length),p}function Oo({primary:m,secondary:c,forward:p,backward:x}){let L=!1;function q(ee){L||(L=!0,ee(),L=!1)}m.emitter.on("change",ee=>{q(()=>{c.setRawValue(p(m,c),ee.options)})}),c.emitter.on("change",ee=>{q(()=>{m.setRawValue(x(m,c),ee.options)}),q(()=>{c.setRawValue(p(m,c),ee.options)})}),q(()=>{c.setRawValue(p(m,c),{forceEmit:!1,last:!0})})}function kn(m,c){const p=m*(c.altKey?.1:1)*(c.shiftKey?10:1);return c.upKey?+p:c.downKey?-p:0}function ds(m){return{altKey:m.altKey,downKey:m.key==="ArrowDown",shiftKey:m.shiftKey,upKey:m.key==="ArrowUp"}}function lr(m){return{altKey:m.altKey,downKey:m.key==="ArrowLeft",shiftKey:m.shiftKey,upKey:m.key==="ArrowRight"}}function _n(m){return m==="ArrowUp"||m==="ArrowDown"}function Ur(m){return _n(m)||m==="ArrowLeft"||m==="ArrowRight"}function La(m,c){const p=c.ownerDocument.defaultView,x=c.getBoundingClientRect();return{x:m.pageX-((p&&p.scrollX||0)+x.left),y:m.pageY-((p&&p.scrollY||0)+x.top)}}class js{constructor(c){this.lastTouch_=null,this.onDocumentMouseMove_=this.onDocumentMouseMove_.bind(this),this.onDocumentMouseUp_=this.onDocumentMouseUp_.bind(this),this.onMouseDown_=this.onMouseDown_.bind(this),this.onTouchEnd_=this.onTouchEnd_.bind(this),this.onTouchMove_=this.onTouchMove_.bind(this),this.onTouchStart_=this.onTouchStart_.bind(this),this.elem_=c,this.emitter=new b,c.addEventListener("touchstart",this.onTouchStart_,{passive:!1}),c.addEventListener("touchmove",this.onTouchMove_,{passive:!0}),c.addEventListener("touchend",this.onTouchEnd_),c.addEventListener("mousedown",this.onMouseDown_)}computePosition_(c){const p=this.elem_.getBoundingClientRect();return{bounds:{width:p.width,height:p.height},point:c?{x:c.x,y:c.y}:null}}onMouseDown_(c){var p;c.preventDefault(),(p=c.currentTarget)===null||p===void 0||p.focus();const x=this.elem_.ownerDocument;x.addEventListener("mousemove",this.onDocumentMouseMove_),x.addEventListener("mouseup",this.onDocumentMouseUp_),this.emitter.emit("down",{altKey:c.altKey,data:this.computePosition_(La(c,this.elem_)),sender:this,shiftKey:c.shiftKey})}onDocumentMouseMove_(c){this.emitter.emit("move",{altKey:c.altKey,data:this.computePosition_(La(c,this.elem_)),sender:this,shiftKey:c.shiftKey})}onDocumentMouseUp_(c){const p=this.elem_.ownerDocument;p.removeEventListener("mousemove",this.onDocumentMouseMove_),p.removeEventListener("mouseup",this.onDocumentMouseUp_),this.emitter.emit("up",{altKey:c.altKey,data:this.computePosition_(La(c,this.elem_)),sender:this,shiftKey:c.shiftKey})}onTouchStart_(c){c.preventDefault();const p=c.targetTouches.item(0),x=this.elem_.getBoundingClientRect();this.emitter.emit("down",{altKey:c.altKey,data:this.computePosition_(p?{x:p.clientX-x.left,y:p.clientY-x.top}:void 0),sender:this,shiftKey:c.shiftKey}),this.lastTouch_=p}onTouchMove_(c){const p=c.targetTouches.item(0),x=this.elem_.getBoundingClientRect();this.emitter.emit("move",{altKey:c.altKey,data:this.computePosition_(p?{x:p.clientX-x.left,y:p.clientY-x.top}:void 0),sender:this,shiftKey:c.shiftKey}),this.lastTouch_=p}onTouchEnd_(c){var p;const x=(p=c.targetTouches.item(0))!==null&&p!==void 0?p:this.lastTouch_,L=this.elem_.getBoundingClientRect();this.emitter.emit("up",{altKey:c.altKey,data:this.computePosition_(x?{x:x.clientX-L.left,y:x.clientY-L.top}:void 0),sender:this,shiftKey:c.shiftKey})}}function hn(m,c,p,x,L){const q=(m-c)/(p-c);return x+q*(L-x)}function Xd(m){return String(m.toFixed(10)).split(".")[1].replace(/0+$/,"").length}function gn(m,c,p){return Math.min(Math.max(m,c),p)}function Lu(m,c){return(m%c+c)%c}const ki=E("txt");class Ll{constructor(c,p){this.onChange_=this.onChange_.bind(this),this.props_=p.props,this.props_.emitter.on("change",this.onChange_),this.element=c.createElement("div"),this.element.classList.add(ki(),ki(void 0,"num")),p.arrayPosition&&this.element.classList.add(ki(void 0,p.arrayPosition)),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("input");x.classList.add(ki("i")),x.type="text",p.viewProps.bindDisabled(x),this.element.appendChild(x),this.inputElement=x,this.onDraggingChange_=this.onDraggingChange_.bind(this),this.dragging_=p.dragging,this.dragging_.emitter.on("change",this.onDraggingChange_),this.element.classList.add(ki()),this.inputElement.classList.add(ki("i"));const L=c.createElement("div");L.classList.add(ki("k")),this.element.appendChild(L),this.knobElement=L;const q=c.createElementNS(it,"svg");q.classList.add(ki("g")),this.knobElement.appendChild(q);const ee=c.createElementNS(it,"path");ee.classList.add(ki("gb")),q.appendChild(ee),this.guideBodyElem_=ee;const Oe=c.createElementNS(it,"path");Oe.classList.add(ki("gh")),q.appendChild(Oe),this.guideHeadElem_=Oe;const lt=c.createElement("div");lt.classList.add(E("tt")()),this.knobElement.appendChild(lt),this.tooltipElem_=lt,p.value.emitter.on("change",this.onChange_),this.value=p.value,this.refresh()}onDraggingChange_(c){if(c.rawValue===null){this.element.classList.remove(ki(void 0,"drg"));return}this.element.classList.add(ki(void 0,"drg"));const p=c.rawValue/this.props_.get("draggingScale"),x=p+(p>0?-1:p<0?1:0),L=gn(-x,-4,4);this.guideHeadElem_.setAttributeNS(null,"d",[`M ${x+L},0 L${x},4 L${x+L},8`,`M ${p},-1 L${p},9`].join(" ")),this.guideBodyElem_.setAttributeNS(null,"d",`M 0,4 L${p},4`);const q=this.props_.get("formatter");this.tooltipElem_.textContent=q(this.value.rawValue),this.tooltipElem_.style.left=`${p}px`}refresh(){const c=this.props_.get("formatter");this.inputElement.value=c(this.value.rawValue)}onChange_(){this.refresh()}}class Cr{constructor(c,p){this.originRawValue_=0,this.onInputChange_=this.onInputChange_.bind(this),this.onInputKeyDown_=this.onInputKeyDown_.bind(this),this.onInputKeyUp_=this.onInputKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.baseStep_=p.baseStep,this.parser_=p.parser,this.props=p.props,this.value=p.value,this.viewProps=p.viewProps,this.dragging_=$(null),this.view=new Ll(c,{arrayPosition:p.arrayPosition,dragging:this.dragging_,props:this.props,value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_),this.view.inputElement.addEventListener("keydown",this.onInputKeyDown_),this.view.inputElement.addEventListener("keyup",this.onInputKeyUp_);const x=new js(this.view.knobElement);x.emitter.on("down",this.onPointerDown_),x.emitter.on("move",this.onPointerMove_),x.emitter.on("up",this.onPointerUp_)}onInputChange_(c){const x=c.currentTarget.value,L=this.parser_(x);f(L)||(this.value.rawValue=L),this.view.refresh()}onInputKeyDown_(c){const p=kn(this.baseStep_,ds(c));p!==0&&this.value.setRawValue(this.value.rawValue+p,{forceEmit:!1,last:!1})}onInputKeyUp_(c){kn(this.baseStep_,ds(c))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}onPointerDown_(){this.originRawValue_=this.value.rawValue,this.dragging_.rawValue=0}computeDraggingValue_(c){if(!c.point)return null;const p=c.point.x-c.bounds.width/2;return this.originRawValue_+p*this.props.get("draggingScale")}onPointerMove_(c){const p=this.computeDraggingValue_(c.data);p!==null&&(this.value.setRawValue(p,{forceEmit:!1,last:!1}),this.dragging_.rawValue=this.value.rawValue-this.originRawValue_)}onPointerUp_(c){const p=this.computeDraggingValue_(c.data);p!==null&&(this.value.setRawValue(p,{forceEmit:!0,last:!0}),this.dragging_.rawValue=null)}}const Du=E("sld");class qd{constructor(c,p){this.onChange_=this.onChange_.bind(this),this.props_=p.props,this.props_.emitter.on("change",this.onChange_),this.element=c.createElement("div"),this.element.classList.add(Du()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("div");x.classList.add(Du("t")),p.viewProps.bindTabIndex(x),this.element.appendChild(x),this.trackElement=x;const L=c.createElement("div");L.classList.add(Du("k")),this.trackElement.appendChild(L),this.knobElement=L,p.value.emitter.on("change",this.onChange_),this.value=p.value,this.update_()}update_(){const c=gn(hn(this.value.rawValue,this.props_.get("minValue"),this.props_.get("maxValue"),0,100),0,100);this.knobElement.style.width=`${c}%`}onChange_(){this.update_()}}class Yd{constructor(c,p){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDownOrMove_=this.onPointerDownOrMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.baseStep_=p.baseStep,this.value=p.value,this.viewProps=p.viewProps,this.props=p.props,this.view=new qd(c,{props:this.props,value:this.value,viewProps:this.viewProps}),this.ptHandler_=new js(this.view.trackElement),this.ptHandler_.emitter.on("down",this.onPointerDownOrMove_),this.ptHandler_.emitter.on("move",this.onPointerDownOrMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.trackElement.addEventListener("keydown",this.onKeyDown_),this.view.trackElement.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(c,p){c.point&&this.value.setRawValue(hn(gn(c.point.x,0,c.bounds.width),0,c.bounds.width,this.props.get("minValue"),this.props.get("maxValue")),p)}onPointerDownOrMove_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerUp_(c){this.handlePointerEvent_(c.data,{forceEmit:!0,last:!0})}onKeyDown_(c){const p=kn(this.baseStep_,lr(c));p!==0&&this.value.setRawValue(this.value.rawValue+p,{forceEmit:!1,last:!1})}onKeyUp_(c){kn(this.baseStep_,lr(c))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const Da=E("sldtxt");class Iu{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(Da());const x=c.createElement("div");x.classList.add(Da("s")),this.sliderView_=p.sliderView,x.appendChild(this.sliderView_.element),this.element.appendChild(x);const L=c.createElement("div");L.classList.add(Da("t")),this.textView_=p.textView,L.appendChild(this.textView_.element),this.element.appendChild(L)}}class Dl{constructor(c,p){this.value=p.value,this.viewProps=p.viewProps,this.sliderC_=new Yd(c,{baseStep:p.baseStep,props:p.sliderProps,value:p.value,viewProps:this.viewProps}),this.textC_=new Cr(c,{baseStep:p.baseStep,parser:p.parser,props:p.textProps,value:p.value,viewProps:p.viewProps}),this.view=new Iu(c,{sliderView:this.sliderC_.view,textView:this.textC_.view})}get sliderController(){return this.sliderC_}get textController(){return this.textC_}}function Ia(m,c){m.write(c)}function ko(m){const c=fe;if(Array.isArray(m))return c.required.array(c.required.object({text:c.required.string,value:c.required.raw}))(m).value;if(typeof m=="object")return c.required.raw(m).value}function Il(m){if(m==="inline"||m==="popup")return m}function ps(m){const c=fe;return c.required.object({max:c.optional.number,min:c.optional.number,step:c.optional.number})(m).value}function Ou(m){if(Array.isArray(m))return m;const c=[];return Object.keys(m).forEach(p=>{c.push({text:p,value:m[p]})}),c}function _i(m){return f(m)?null:new Ca(Ou(m))}function Oa(m){const c=m?Ki(m,Ca):null;return c?c.options:null}function ka(m){const c=m?Ki(m,Ar):null;return c?c.step:null}function Na(m,c){const p=m&&Ki(m,Ar);return p?Xd(p.step):Math.max(Xd(c),2)}function Xs(m){const c=ka(m);return c??1}function No(m,c){var p;const x=m&&Ki(m,Ar),L=Math.abs((p=x==null?void 0:x.step)!==null&&p!==void 0?p:c);return L===0?.1:Math.pow(10,Math.floor(Math.log10(L))-1)}const Ol=E("ckb");class lg{constructor(c,p){this.onValueChange_=this.onValueChange_.bind(this),this.element=c.createElement("div"),this.element.classList.add(Ol()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("label");x.classList.add(Ol("l")),this.element.appendChild(x);const L=c.createElement("input");L.classList.add(Ol("i")),L.type="checkbox",x.appendChild(L),this.inputElement=L,p.viewProps.bindDisabled(this.inputElement);const q=c.createElement("div");q.classList.add(Ol("w")),x.appendChild(q);const ee=rt(c,"check");q.appendChild(ee),p.value.emitter.on("change",this.onValueChange_),this.value=p.value,this.update_()}update_(){this.inputElement.checked=this.value.rawValue}onValueChange_(){this.update_()}}class cg{constructor(c,p){this.onInputChange_=this.onInputChange_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.view=new lg(c,{value:this.value,viewProps:this.viewProps}),this.view.inputElement.addEventListener("change",this.onInputChange_)}onInputChange_(c){const p=c.currentTarget;this.value.rawValue=p.checked}}function ug(m){const c=[],p=_i(m.options);return p&&c.push(p),new us(c)}const Bo={id:"input-bool",type:"input",accept:(m,c)=>{if(typeof m!="boolean")return null;const x=Ce(c,{options:fe.optional.custom(ko)});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Su,constraint:m=>ug(m.params),writer:m=>Ia},controller:m=>{var c;const p=m.document,x=m.value,L=m.constraint;return L&&Ki(L,Ca)?new Ro(p,{props:K.fromObject({options:(c=Oa(L))!==null&&c!==void 0?c:[]}),value:x,viewProps:m.viewProps}):new cg(p,{value:x,viewProps:m.viewProps})}},qs=E("col");class hg{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(qs()),p.foldable.bindExpandedClass(this.element,qs(void 0,"expanded")),I(p.foldable,"completed",P(this.element,qs(void 0,"cpl")));const x=c.createElement("div");x.classList.add(qs("h")),this.element.appendChild(x);const L=c.createElement("div");L.classList.add(qs("s")),x.appendChild(L),this.swatchElement=L;const q=c.createElement("div");if(q.classList.add(qs("t")),x.appendChild(q),this.textElement=q,p.pickerLayout==="inline"){const ee=c.createElement("div");ee.classList.add(qs("p")),this.element.appendChild(ee),this.pickerElement=ee}else this.pickerElement=null}}function ku(m,c,p){const x=gn(m/255,0,1),L=gn(c/255,0,1),q=gn(p/255,0,1),ee=Math.max(x,L,q),Oe=Math.min(x,L,q),lt=ee-Oe;let mt=0,jt=0;const Jt=(Oe+ee)/2;return lt!==0&&(jt=lt/(1-Math.abs(ee+Oe-1)),x===ee?mt=(L-q)/lt:L===ee?mt=2+(q-x)/lt:mt=4+(x-L)/lt,mt=mt/6+(mt<0?1:0)),[mt*360,jt*100,Jt*100]}function Zd(m,c,p){const x=(m%360+360)%360,L=gn(c/100,0,1),q=gn(p/100,0,1),ee=(1-Math.abs(2*q-1))*L,Oe=ee*(1-Math.abs(x/60%2-1)),lt=q-ee/2;let mt,jt,Jt;return x>=0&&x<60?[mt,jt,Jt]=[ee,Oe,0]:x>=60&&x<120?[mt,jt,Jt]=[Oe,ee,0]:x>=120&&x<180?[mt,jt,Jt]=[0,ee,Oe]:x>=180&&x<240?[mt,jt,Jt]=[0,Oe,ee]:x>=240&&x<300?[mt,jt,Jt]=[Oe,0,ee]:[mt,jt,Jt]=[ee,0,Oe],[(mt+lt)*255,(jt+lt)*255,(Jt+lt)*255]}function fs(m,c,p){const x=gn(m/255,0,1),L=gn(c/255,0,1),q=gn(p/255,0,1),ee=Math.max(x,L,q),Oe=Math.min(x,L,q),lt=ee-Oe;let mt;lt===0?mt=0:ee===x?mt=60*(((L-q)/lt%6+6)%6):ee===L?mt=60*((q-x)/lt+2):mt=60*((x-L)/lt+4);const jt=ee===0?0:lt/ee,Jt=ee;return[mt,jt*100,Jt*100]}function Ba(m,c,p){const x=Lu(m,360),L=gn(c/100,0,1),q=gn(p/100,0,1),ee=q*L,Oe=ee*(1-Math.abs(x/60%2-1)),lt=q-ee;let mt,jt,Jt;return x>=0&&x<60?[mt,jt,Jt]=[ee,Oe,0]:x>=60&&x<120?[mt,jt,Jt]=[Oe,ee,0]:x>=120&&x<180?[mt,jt,Jt]=[0,ee,Oe]:x>=180&&x<240?[mt,jt,Jt]=[0,Oe,ee]:x>=240&&x<300?[mt,jt,Jt]=[Oe,0,ee]:[mt,jt,Jt]=[ee,0,Oe],[(mt+lt)*255,(jt+lt)*255,(Jt+lt)*255]}function dg(m,c,p){const x=p+c*(100-Math.abs(2*p-100))/200;return[m,x!==0?c*(100-Math.abs(2*p-100))/x:0,p+c*(100-Math.abs(2*p-100))/(2*100)]}function pg(m,c,p){const x=100-Math.abs(p*(200-c)/100-100);return[m,x!==0?c*p/x:0,p*(200-c)/(2*100)]}function zo(m){return[m[0],m[1],m[2]]}function Ys(m,c){return[m[0],m[1],m[2],c]}const cr={hsl:{hsl:(m,c,p)=>[m,c,p],hsv:dg,rgb:Zd},hsv:{hsl:pg,hsv:(m,c,p)=>[m,c,p],rgb:Ba},rgb:{hsl:ku,hsv:fs,rgb:(m,c,p)=>[m,c,p]}};function Kd(m,c,p){return cr[c][p](...m)}const fg={hsl:m=>{var c;return[Lu(m[0],360),gn(m[1],0,100),gn(m[2],0,100),gn((c=m[3])!==null&&c!==void 0?c:1,0,1)]},hsv:m=>{var c;return[Lu(m[0],360),gn(m[1],0,100),gn(m[2],0,100),gn((c=m[3])!==null&&c!==void 0?c:1,0,1)]},rgb:m=>{var c;return[gn(m[0],0,255),gn(m[1],0,255),gn(m[2],0,255),gn((c=m[3])!==null&&c!==void 0?c:1,0,1)]}};function kl(m,c){return typeof m!="object"||f(m)?!1:c in m&&typeof m[c]=="number"}class Bt{constructor(c,p){this.mode_=p,this.comps_=fg[p](c)}static black(){return new Bt([0,0,0],"rgb")}static fromObject(c){const p="a"in c?[c.r,c.g,c.b,c.a]:[c.r,c.g,c.b];return new Bt(p,"rgb")}static toRgbaObject(c){return c.toRgbaObject()}static isRgbColorObject(c){return kl(c,"r")&&kl(c,"g")&&kl(c,"b")}static isRgbaColorObject(c){return this.isRgbColorObject(c)&&kl(c,"a")}static isColorObject(c){return this.isRgbColorObject(c)}static equals(c,p){if(c.mode_!==p.mode_)return!1;const x=c.comps_,L=p.comps_;for(let q=0;q<x.length;q++)if(x[q]!==L[q])return!1;return!0}get mode(){return this.mode_}getComponents(c){return Ys(Kd(zo(this.comps_),this.mode_,c||this.mode_),this.comps_[3])}toRgbaObject(){const c=this.getComponents("rgb");return{r:c[0],g:c[1],b:c[2],a:c[3]}}}const ms=E("colp");class mg{constructor(c,p){this.alphaViews_=null,this.element=c.createElement("div"),this.element.classList.add(ms());const x=c.createElement("div");x.classList.add(ms("hsv"));const L=c.createElement("div");L.classList.add(ms("sv")),this.svPaletteView_=p.svPaletteView,L.appendChild(this.svPaletteView_.element),x.appendChild(L);const q=c.createElement("div");q.classList.add(ms("h")),this.hPaletteView_=p.hPaletteView,q.appendChild(this.hPaletteView_.element),x.appendChild(q),this.element.appendChild(x);const ee=c.createElement("div");if(ee.classList.add(ms("rgb")),this.textView_=p.textView,ee.appendChild(this.textView_.element),this.element.appendChild(ee),p.alphaViews){this.alphaViews_={palette:p.alphaViews.palette,text:p.alphaViews.text};const Oe=c.createElement("div");Oe.classList.add(ms("a"));const lt=c.createElement("div");lt.classList.add(ms("ap")),lt.appendChild(this.alphaViews_.palette.element),Oe.appendChild(lt);const mt=c.createElement("div");mt.classList.add(ms("at")),mt.appendChild(this.alphaViews_.text.element),Oe.appendChild(mt),this.element.appendChild(Oe)}}get allFocusableElements(){const c=[this.svPaletteView_.element,this.hPaletteView_.element,this.textView_.modeSelectElement,...this.textView_.textViews.map(p=>p.inputElement)];return this.alphaViews_&&c.push(this.alphaViews_.palette.element,this.alphaViews_.text.inputElement),c}}function vs(m){const c=fe;return Ce(m,{alpha:c.optional.boolean,expanded:c.optional.boolean,picker:c.optional.custom(Il)})}function J(m){return m?.1:1}function le(m,c){const p=m.match(/^(.+)%$/);return Math.min(p?parseFloat(p[1])*.01*c:parseFloat(m),c)}const ie={deg:m=>m,grad:m=>m*360/400,rad:m=>m*360/(2*Math.PI),turn:m=>m*360};function je(m){const c=m.match(/^([0-9.]+?)(deg|grad|rad|turn)$/);if(!c)return parseFloat(m);const p=parseFloat(c[1]),x=c[2];return ie[x](p)}const ft={"func.rgb":m=>{const c=m.match(/^rgb\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!c)return null;const p=[le(c[1],255),le(c[2],255),le(c[3],255)];return isNaN(p[0])||isNaN(p[1])||isNaN(p[2])?null:new Bt(p,"rgb")},"func.rgba":m=>{const c=m.match(/^rgba\(\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!c)return null;const p=[le(c[1],255),le(c[2],255),le(c[3],255),le(c[4],1)];return isNaN(p[0])||isNaN(p[1])||isNaN(p[2])||isNaN(p[3])?null:new Bt(p,"rgb")},"func.hsl":m=>{const c=m.match(/^hsl\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!c)return null;const p=[je(c[1]),le(c[2],100),le(c[3],100)];return isNaN(p[0])||isNaN(p[1])||isNaN(p[2])?null:new Bt(p,"hsl")},"func.hsla":m=>{const c=m.match(/^hsla\(\s*([0-9A-Fa-f.]+(?:deg|grad|rad|turn)?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*,\s*([0-9A-Fa-f.]+%?)\s*\)$/);if(!c)return null;const p=[je(c[1]),le(c[2],100),le(c[3],100),le(c[4],1)];return isNaN(p[0])||isNaN(p[1])||isNaN(p[2])||isNaN(p[3])?null:new Bt(p,"hsl")},"hex.rgb":m=>{const c=m.match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);if(c)return new Bt([parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)],"rgb");const p=m.match(/^(?:#|0x)([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);return p?new Bt([parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16)],"rgb"):null},"hex.rgba":m=>{const c=m.match(/^#?([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/);if(c)return new Bt([parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16),hn(parseInt(c[4]+c[4],16),0,255,0,1)],"rgb");const p=m.match(/^(?:#|0x)?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/);return p?new Bt([parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16),hn(parseInt(p[4],16),0,255,0,1)],"rgb"):null}};function Wt(m){return Object.keys(ft).reduce((p,x)=>{if(p)return p;const L=ft[x];return L(m)?x:null},null)}const Pn=m=>{const c=Wt(m);return c?ft[c](m):null};function ln(m){return m==="func.hsla"||m==="func.rgba"||m==="hex.rgba"}function Nu(m){if(typeof m=="string"){const c=Pn(m);if(c)return c}return Bt.black()}function Jd(m){const c=gn(Math.floor(m),0,255).toString(16);return c.length===1?`0${c}`:c}function Ei(m,c="#"){const p=zo(m.getComponents("rgb")).map(Jd).join("");return`${c}${p}`}function Zs(m,c="#"){const p=m.getComponents("rgb"),x=[p[0],p[1],p[2],p[3]*255].map(Jd).join("");return`${c}${x}`}function Qd(m){const c=yi(0);return`rgb(${zo(m.getComponents("rgb")).map(x=>c(x)).join(", ")})`}function Fr(m){const c=yi(2),p=yi(0);return`rgba(${m.getComponents("rgb").map((L,q)=>(q===3?c:p)(L)).join(", ")})`}function Nl(m){const c=[yi(0),Ra,Ra];return`hsl(${zo(m.getComponents("hsl")).map((x,L)=>c[L](x)).join(", ")})`}function Bl(m){const c=[yi(0),Ra,Ra,yi(2)];return`hsla(${m.getComponents("hsl").map((x,L)=>c[L](x)).join(", ")})`}const en={"func.hsl":Nl,"func.hsla":Bl,"func.rgb":Qd,"func.rgba":Fr,"hex.rgb":Ei,"hex.rgba":Zs};function $d(m){return en[m]}const Uo=E("apl");class zl{constructor(c,p){this.onValueChange_=this.onValueChange_.bind(this),this.value=p.value,this.value.emitter.on("change",this.onValueChange_),this.element=c.createElement("div"),this.element.classList.add(Uo()),p.viewProps.bindTabIndex(this.element);const x=c.createElement("div");x.classList.add(Uo("b")),this.element.appendChild(x);const L=c.createElement("div");L.classList.add(Uo("c")),x.appendChild(L),this.colorElem_=L;const q=c.createElement("div");q.classList.add(Uo("m")),this.element.appendChild(q),this.markerElem_=q;const ee=c.createElement("div");ee.classList.add(Uo("p")),this.markerElem_.appendChild(ee),this.previewElem_=ee,this.update_()}update_(){const c=this.value.rawValue,p=c.getComponents("rgb"),x=new Bt([p[0],p[1],p[2],0],"rgb"),L=new Bt([p[0],p[1],p[2],255],"rgb"),q=["to right",Fr(x),Fr(L)];this.colorElem_.style.background=`linear-gradient(${q.join(",")})`,this.previewElem_.style.backgroundColor=Fr(c);const ee=hn(p[3],0,1,0,100);this.markerElem_.style.left=`${ee}%`}onValueChange_(){this.update_()}}class vg{constructor(c,p){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.view=new zl(c,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new js(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(c,p){if(!c.point)return;const x=c.point.x/c.bounds.width,L=this.value.rawValue,[q,ee,Oe]=L.getComponents("hsv");this.value.setRawValue(new Bt([q,ee,Oe,x],"hsv"),p)}onPointerDown_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerMove_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerUp_(c){this.handlePointerEvent_(c.data,{forceEmit:!0,last:!0})}onKeyDown_(c){const p=kn(J(!0),lr(c));if(p===0)return;const x=this.value.rawValue,[L,q,ee,Oe]=x.getComponents("hsv");this.value.setRawValue(new Bt([L,q,ee,Oe+p],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(c){kn(J(!0),lr(c))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const Fo=E("coltxt");function gg(m){const c=m.createElement("select"),p=[{text:"RGB",value:"rgb"},{text:"HSL",value:"hsl"},{text:"HSV",value:"hsv"}];return c.appendChild(p.reduce((x,L)=>{const q=m.createElement("option");return q.textContent=L.text,q.value=L.value,x.appendChild(q),x},m.createDocumentFragment())),c}class Ul{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(Fo());const x=c.createElement("div");x.classList.add(Fo("m")),this.modeElem_=gg(c),this.modeElem_.classList.add(Fo("ms")),x.appendChild(this.modeSelectElement);const L=c.createElement("div");L.classList.add(Fo("mm")),L.appendChild(rt(c,"dropdown")),x.appendChild(L),this.element.appendChild(x);const q=c.createElement("div");q.classList.add(Fo("w")),this.element.appendChild(q),this.textsElem_=q,this.textViews_=p.textViews,this.applyTextViews_(),D(p.colorMode,ee=>{this.modeElem_.value=ee})}get modeSelectElement(){return this.modeElem_}get textViews(){return this.textViews_}set textViews(c){this.textViews_=c,this.applyTextViews_()}applyTextViews_(){Ft(this.textsElem_);const c=this.element.ownerDocument;this.textViews_.forEach(p=>{const x=c.createElement("div");x.classList.add(Fo("c")),x.appendChild(p.element),this.textsElem_.appendChild(x)})}}const gs=yi(0),Fl={rgb:()=>new Si({min:0,max:255}),hsl:m=>m===0?new Si({min:0,max:360}):new Si({min:0,max:100}),hsv:m=>m===0?new Si({min:0,max:360}):new Si({min:0,max:100})};function Vl(m,c,p){return new Cr(m,{arrayPosition:p===0?"fst":p===3-1?"lst":"mid",baseStep:J(!1),parser:c.parser,props:K.fromObject({draggingScale:1,formatter:gs}),value:$(0,{constraint:Fl[c.colorMode](p)}),viewProps:c.viewProps})}class Hl{constructor(c,p){this.onModeSelectChange_=this.onModeSelectChange_.bind(this),this.parser_=p.parser,this.value=p.value,this.viewProps=p.viewProps,this.colorMode=$(this.value.rawValue.mode),this.ccs_=this.createComponentControllers_(c),this.view=new Ul(c,{colorMode:this.colorMode,textViews:[this.ccs_[0].view,this.ccs_[1].view,this.ccs_[2].view]}),this.view.modeSelectElement.addEventListener("change",this.onModeSelectChange_)}createComponentControllers_(c){const p={colorMode:this.colorMode.rawValue,parser:this.parser_,viewProps:this.viewProps},x=[Vl(c,p,0),Vl(c,p,1),Vl(c,p,2)];return x.forEach((L,q)=>{Oo({primary:this.value,secondary:L.value,forward:ee=>ee.rawValue.getComponents(this.colorMode.rawValue)[q],backward:(ee,Oe)=>{const lt=this.colorMode.rawValue,mt=ee.rawValue.getComponents(lt);return mt[q]=Oe.rawValue,new Bt(Ys(zo(mt),mt[3]),lt)}})}),x}onModeSelectChange_(c){const p=c.currentTarget;this.colorMode.rawValue=p.value,this.ccs_=this.createComponentControllers_(this.view.element.ownerDocument),this.view.textViews=[this.ccs_[0].view,this.ccs_[1].view,this.ccs_[2].view]}}const Gl=E("hpl");class ep{constructor(c,p){this.onValueChange_=this.onValueChange_.bind(this),this.value=p.value,this.value.emitter.on("change",this.onValueChange_),this.element=c.createElement("div"),this.element.classList.add(Gl()),p.viewProps.bindTabIndex(this.element);const x=c.createElement("div");x.classList.add(Gl("c")),this.element.appendChild(x);const L=c.createElement("div");L.classList.add(Gl("m")),this.element.appendChild(L),this.markerElem_=L,this.update_()}update_(){const c=this.value.rawValue,[p]=c.getComponents("hsv");this.markerElem_.style.backgroundColor=Qd(new Bt([p,100,100],"hsv"));const x=hn(p,0,360,0,100);this.markerElem_.style.left=`${x}%`}onValueChange_(){this.update_()}}class Wl{constructor(c,p){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.view=new ep(c,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new js(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(c,p){if(!c.point)return;const x=hn(gn(c.point.x,0,c.bounds.width),0,c.bounds.width,0,359),L=this.value.rawValue,[,q,ee,Oe]=L.getComponents("hsv");this.value.setRawValue(new Bt([x,q,ee,Oe],"hsv"),p)}onPointerDown_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerMove_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerUp_(c){this.handlePointerEvent_(c.data,{forceEmit:!0,last:!0})}onKeyDown_(c){const p=kn(J(!1),lr(c));if(p===0)return;const x=this.value.rawValue,[L,q,ee,Oe]=x.getComponents("hsv");this.value.setRawValue(new Bt([L+p,q,ee,Oe],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(c){kn(J(!1),lr(c))!==0&&this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}const jl=E("svp"),Vo=64;class Ks{constructor(c,p){this.onValueChange_=this.onValueChange_.bind(this),this.value=p.value,this.value.emitter.on("change",this.onValueChange_),this.element=c.createElement("div"),this.element.classList.add(jl()),p.viewProps.bindTabIndex(this.element);const x=c.createElement("canvas");x.height=Vo,x.width=Vo,x.classList.add(jl("c")),this.element.appendChild(x),this.canvasElement=x;const L=c.createElement("div");L.classList.add(jl("m")),this.element.appendChild(L),this.markerElem_=L,this.update_()}update_(){const c=We(this.canvasElement);if(!c)return;const x=this.value.rawValue.getComponents("hsv"),L=this.canvasElement.width,q=this.canvasElement.height,ee=c.getImageData(0,0,L,q),Oe=ee.data;for(let jt=0;jt<q;jt++)for(let Jt=0;Jt<L;Jt++){const jr=hn(Jt,0,L,0,100),Yo=hn(jt,0,q,100,0),Zo=Ba(x[0],jr,Yo),Qs=(jt*L+Jt)*4;Oe[Qs]=Zo[0],Oe[Qs+1]=Zo[1],Oe[Qs+2]=Zo[2],Oe[Qs+3]=255}c.putImageData(ee,0,0);const lt=hn(x[1],0,100,0,100);this.markerElem_.style.left=`${lt}%`;const mt=hn(x[2],0,100,100,0);this.markerElem_.style.top=`${mt}%`}onValueChange_(){this.update_()}}class Xl{constructor(c,p){this.onKeyDown_=this.onKeyDown_.bind(this),this.onKeyUp_=this.onKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.view=new Ks(c,{value:this.value,viewProps:this.viewProps}),this.ptHandler_=new js(this.view.element),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.element.addEventListener("keydown",this.onKeyDown_),this.view.element.addEventListener("keyup",this.onKeyUp_)}handlePointerEvent_(c,p){if(!c.point)return;const x=hn(c.point.x,0,c.bounds.width,0,100),L=hn(c.point.y,0,c.bounds.height,100,0),[q,,,ee]=this.value.rawValue.getComponents("hsv");this.value.setRawValue(new Bt([q,x,L,ee],"hsv"),p)}onPointerDown_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerMove_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerUp_(c){this.handlePointerEvent_(c.data,{forceEmit:!0,last:!0})}onKeyDown_(c){Ur(c.key)&&c.preventDefault();const[p,x,L,q]=this.value.rawValue.getComponents("hsv"),ee=J(!1),Oe=kn(ee,lr(c)),lt=kn(ee,ds(c));Oe===0&<===0||this.value.setRawValue(new Bt([p,x+Oe,L+lt,q],"hsv"),{forceEmit:!1,last:!1})}onKeyUp_(c){const p=J(!1),x=kn(p,lr(c)),L=kn(p,ds(c));x===0&&L===0||this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}class yg{constructor(c,p){this.value=p.value,this.viewProps=p.viewProps,this.hPaletteC_=new Wl(c,{value:this.value,viewProps:this.viewProps}),this.svPaletteC_=new Xl(c,{value:this.value,viewProps:this.viewProps}),this.alphaIcs_=p.supportsAlpha?{palette:new vg(c,{value:this.value,viewProps:this.viewProps}),text:new Cr(c,{parser:ar,baseStep:.1,props:K.fromObject({draggingScale:.01,formatter:yi(2)}),value:$(0,{constraint:new Si({min:0,max:1})}),viewProps:this.viewProps})}:null,this.alphaIcs_&&Oo({primary:this.value,secondary:this.alphaIcs_.text.value,forward:x=>x.rawValue.getComponents()[3],backward:(x,L)=>{const q=x.rawValue.getComponents();return q[3]=L.rawValue,new Bt(q,x.rawValue.mode)}}),this.textC_=new Hl(c,{parser:ar,value:this.value,viewProps:this.viewProps}),this.view=new mg(c,{alphaViews:this.alphaIcs_?{palette:this.alphaIcs_.palette.view,text:this.alphaIcs_.text.view}:null,hPaletteView:this.hPaletteC_.view,supportsAlpha:p.supportsAlpha,svPaletteView:this.svPaletteC_.view,textView:this.textC_.view})}get textController(){return this.textC_}}const Bu=E("colsw");class _g{constructor(c,p){this.onValueChange_=this.onValueChange_.bind(this),p.value.emitter.on("change",this.onValueChange_),this.value=p.value,this.element=c.createElement("div"),this.element.classList.add(Bu()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("div");x.classList.add(Bu("sw")),this.element.appendChild(x),this.swatchElem_=x;const L=c.createElement("button");L.classList.add(Bu("b")),p.viewProps.bindDisabled(L),this.element.appendChild(L),this.buttonElement=L,this.update_()}update_(){const c=this.value.rawValue;this.swatchElem_.style.backgroundColor=Zs(c)}onValueChange_(){this.update_()}}class ql{constructor(c,p){this.value=p.value,this.viewProps=p.viewProps,this.view=new _g(c,{value:this.value,viewProps:this.viewProps})}}class Ho{constructor(c,p){this.onButtonBlur_=this.onButtonBlur_.bind(this),this.onButtonClick_=this.onButtonClick_.bind(this),this.onPopupChildBlur_=this.onPopupChildBlur_.bind(this),this.onPopupChildKeydown_=this.onPopupChildKeydown_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.foldable_=Ee.create(p.expanded),this.swatchC_=new ql(c,{value:this.value,viewProps:this.viewProps});const x=this.swatchC_.view.buttonElement;x.addEventListener("blur",this.onButtonBlur_),x.addEventListener("click",this.onButtonClick_),this.textC_=new Lo(c,{parser:p.parser,props:K.fromObject({formatter:p.formatter}),value:this.value,viewProps:this.viewProps}),this.view=new hg(c,{foldable:this.foldable_,pickerLayout:p.pickerLayout}),this.view.swatchElement.appendChild(this.swatchC_.view.element),this.view.textElement.appendChild(this.textC_.view.element),this.popC_=p.pickerLayout==="popup"?new Bd(c,{viewProps:this.viewProps}):null;const L=new yg(c,{supportsAlpha:p.supportsAlpha,value:this.value,viewProps:this.viewProps});L.view.allFocusableElements.forEach(q=>{q.addEventListener("blur",this.onPopupChildBlur_),q.addEventListener("keydown",this.onPopupChildKeydown_)}),this.pickerC_=L,this.popC_?(this.view.element.appendChild(this.popC_.view.element),this.popC_.view.element.appendChild(L.view.element),Oo({primary:this.foldable_.value("expanded"),secondary:this.popC_.shows,forward:q=>q.rawValue,backward:(q,ee)=>ee.rawValue})):this.view.pickerElement&&(this.view.pickerElement.appendChild(this.pickerC_.view.element),X(this.foldable_,this.view.pickerElement))}get textController(){return this.textC_}onButtonBlur_(c){if(!this.popC_)return;const p=this.view.element,x=c.relatedTarget;(!x||!p.contains(x))&&(this.popC_.shows.rawValue=!1)}onButtonClick_(){this.foldable_.set("expanded",!this.foldable_.get("expanded")),this.foldable_.get("expanded")&&this.pickerC_.view.allFocusableElements[0].focus()}onPopupChildBlur_(c){if(!this.popC_)return;const p=this.popC_.view.element,x=H(c);x&&p.contains(x)||x&&x===this.swatchC_.view.buttonElement&&!ve(p.ownerDocument)||(this.popC_.shows.rawValue=!1)}onPopupChildKeydown_(c){this.popC_?c.key==="Escape"&&(this.popC_.shows.rawValue=!1):this.view.pickerElement&&c.key==="Escape"&&this.swatchC_.view.buttonElement.focus()}}function zu(m){return Bt.isColorObject(m)?Bt.fromObject(m):Bt.black()}function xg(m){return zo(m.getComponents("rgb")).reduce((c,p)=>c<<8|Math.floor(p)&255,0)}function tp(m){return m.getComponents("rgb").reduce((c,p,x)=>{const L=Math.floor(x===3?p*255:p)&255;return c<<8|L},0)>>>0}function bg(m){return new Bt([m>>16&255,m>>8&255,m&255],"rgb")}function wg(m){return new Bt([m>>24&255,m>>16&255,m>>8&255,hn(m&255,0,255,0,1)],"rgb")}function Xn(m){return typeof m!="number"?Bt.black():bg(m)}function ui(m){return typeof m!="number"?Bt.black():wg(m)}function Sg(m){const c=$d(m);return(p,x)=>{Ia(p,c(x))}}function Mg(m){const c=m?tp:xg;return(p,x)=>{Ia(p,c(x))}}function np(m,c){const p=c.toRgbaObject();m.writeProperty("r",p.r),m.writeProperty("g",p.g),m.writeProperty("b",p.b),m.writeProperty("a",p.a)}function Eg(m,c){const p=c.toRgbaObject();m.writeProperty("r",p.r),m.writeProperty("g",p.g),m.writeProperty("b",p.b)}function Uu(m){return m?np:Eg}function Js(m){return"alpha"in m&&m.alpha===!0}function Fu(m){return m?c=>Zs(c,"0x"):c=>Ei(c,"0x")}const Go={id:"input-color-number",type:"input",accept:(m,c)=>{if(typeof m!="number"||!("view"in c)||c.view!=="color")return null;const p=vs(c);return p?{initialValue:m,params:p}:null},binding:{reader:m=>Js(m.params)?ui:Xn,equals:Bt.equals,writer:m=>Mg(Js(m.params))},controller:m=>{const c=Js(m.params),p="expanded"in m.params?m.params.expanded:void 0,x="picker"in m.params?m.params.picker:void 0;return new Ho(m.document,{expanded:p??!1,formatter:Fu(c),parser:Pn,pickerLayout:x??"popup",supportsAlpha:c,value:m.value,viewProps:m.viewProps})}};function za(m){return Bt.isRgbaColorObject(m)}const Ua={id:"input-color-object",type:"input",accept:(m,c)=>{if(!Bt.isColorObject(m))return null;const p=vs(c);return p?{initialValue:m,params:p}:null},binding:{reader:m=>zu,equals:Bt.equals,writer:m=>Uu(za(m.initialValue))},controller:m=>{const c=Bt.isRgbaColorObject(m.initialValue),p="expanded"in m.params?m.params.expanded:void 0,x="picker"in m.params?m.params.picker:void 0,L=c?Zs:Ei;return new Ho(m.document,{expanded:p??!1,formatter:L,parser:Pn,pickerLayout:x??"popup",supportsAlpha:c,value:m.value,viewProps:m.viewProps})}},Yl={id:"input-color-string",type:"input",accept:(m,c)=>{if(typeof m!="string"||"view"in c&&c.view==="text"||!Wt(m))return null;const x=vs(c);return x?{initialValue:m,params:x}:null},binding:{reader:m=>Nu,equals:Bt.equals,writer:m=>{const c=Wt(m.initialValue);if(!c)throw _.shouldNeverHappen();return Sg(c)}},controller:m=>{const c=Wt(m.initialValue);if(!c)throw _.shouldNeverHappen();const p=$d(c),x="expanded"in m.params?m.params.expanded:void 0,L="picker"in m.params?m.params.picker:void 0;return new Ho(m.document,{expanded:x??!1,formatter:p,parser:Pn,pickerLayout:L??"popup",supportsAlpha:ln(c),value:m.value,viewProps:m.viewProps})}};class Ni{constructor(c){this.components=c.components,this.asm_=c.assembly}constrain(c){const p=this.asm_.toComponents(c).map((x,L)=>{var q,ee;return(ee=(q=this.components[L])===null||q===void 0?void 0:q.constrain(x))!==null&&ee!==void 0?ee:x});return this.asm_.fromComponents(p)}}const ip=E("pndtxt");class Tg{constructor(c,p){this.textViews=p.textViews,this.element=c.createElement("div"),this.element.classList.add(ip()),this.textViews.forEach(x=>{const L=c.createElement("div");L.classList.add(ip("a")),L.appendChild(x.element),this.element.appendChild(L)})}}function Ag(m,c,p){return new Cr(m,{arrayPosition:p===0?"fst":p===c.axes.length-1?"lst":"mid",baseStep:c.axes[p].baseStep,parser:c.parser,props:c.axes[p].textProps,value:$(0,{constraint:c.axes[p].constraint}),viewProps:c.viewProps})}class Vu{constructor(c,p){this.value=p.value,this.viewProps=p.viewProps,this.acs_=p.axes.map((x,L)=>Ag(c,p,L)),this.acs_.forEach((x,L)=>{Oo({primary:this.value,secondary:x.value,forward:q=>p.assembly.toComponents(q.rawValue)[L],backward:(q,ee)=>{const Oe=p.assembly.toComponents(q.rawValue);return Oe[L]=ee.rawValue,p.assembly.fromComponents(Oe)}})}),this.view=new Tg(c,{textViews:this.acs_.map(x=>x.view)})}}function Cg(m){return"step"in m&&!f(m.step)?new Ar(m.step):null}function Zl(m){return"max"in m&&!f(m.max)||"min"in m&&!f(m.min)?new Si({max:m.max,min:m.min}):null}function Fa(m){const c=[],p=Cg(m);p&&c.push(p);const x=Zl(m);x&&c.push(x);const L=_i(m.options);return L&&c.push(L),new us(c)}function rp(m){const c=m?Ki(m,Si):null;return c?[c.minValue,c.maxValue]:[void 0,void 0]}function O(m){const[c,p]=rp(m);return[c??0,p??100]}const Wo={id:"input-number",type:"input",accept:(m,c)=>{if(typeof m!="number")return null;const p=fe,x=Ce(c,{format:p.optional.function,max:p.optional.number,min:p.optional.number,options:p.optional.custom(ko),step:p.optional.number});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Oi,constraint:m=>Fa(m.params),writer:m=>Ia},controller:m=>{var c,p;const x=m.value,L=m.constraint;if(L&&Ki(L,Ca))return new Ro(m.document,{props:K.fromObject({options:(c=Oa(L))!==null&&c!==void 0?c:[]}),value:x,viewProps:m.viewProps});const q=(p="format"in m.params?m.params.format:void 0)!==null&&p!==void 0?p:yi(Na(L,x.rawValue));if(L&&Ki(L,Si)){const[ee,Oe]=O(L);return new Dl(m.document,{baseStep:Xs(L),parser:ar,sliderProps:K.fromObject({maxValue:Oe,minValue:ee}),textProps:K.fromObject({draggingScale:No(L,x.rawValue),formatter:q}),value:x,viewProps:m.viewProps})}return new Cr(m.document,{baseStep:Xs(L),parser:ar,props:K.fromObject({draggingScale:No(L,x.rawValue),formatter:q}),value:x,viewProps:m.viewProps})}};class ur{constructor(c=0,p=0){this.x=c,this.y=p}getComponents(){return[this.x,this.y]}static isObject(c){if(f(c))return!1;const p=c.x,x=c.y;return!(typeof p!="number"||typeof x!="number")}static equals(c,p){return c.x===p.x&&c.y===p.y}toObject(){return{x:this.x,y:this.y}}}const Bi={toComponents:m=>m.getComponents(),fromComponents:m=>new ur(...m)},Mt=E("p2d");class Pg{constructor(c,p){this.element=c.createElement("div"),this.element.classList.add(Mt()),p.viewProps.bindClassModifiers(this.element),D(p.expanded,P(this.element,Mt(void 0,"expanded")));const x=c.createElement("div");x.classList.add(Mt("h")),this.element.appendChild(x);const L=c.createElement("button");L.classList.add(Mt("b")),L.appendChild(rt(c,"p2dpad")),p.viewProps.bindDisabled(L),x.appendChild(L),this.buttonElement=L;const q=c.createElement("div");if(q.classList.add(Mt("t")),x.appendChild(q),this.textElement=q,p.pickerLayout==="inline"){const ee=c.createElement("div");ee.classList.add(Mt("p")),this.element.appendChild(ee),this.pickerElement=ee}else this.pickerElement=null}}const ys=E("p2dp");class Rg{constructor(c,p){this.onFoldableChange_=this.onFoldableChange_.bind(this),this.onValueChange_=this.onValueChange_.bind(this),this.invertsY_=p.invertsY,this.maxValue_=p.maxValue,this.element=c.createElement("div"),this.element.classList.add(ys()),p.layout==="popup"&&this.element.classList.add(ys(void 0,"p"));const x=c.createElement("div");x.classList.add(ys("p")),p.viewProps.bindTabIndex(x),this.element.appendChild(x),this.padElement=x;const L=c.createElementNS(it,"svg");L.classList.add(ys("g")),this.padElement.appendChild(L),this.svgElem_=L;const q=c.createElementNS(it,"line");q.classList.add(ys("ax")),q.setAttributeNS(null,"x1","0"),q.setAttributeNS(null,"y1","50%"),q.setAttributeNS(null,"x2","100%"),q.setAttributeNS(null,"y2","50%"),this.svgElem_.appendChild(q);const ee=c.createElementNS(it,"line");ee.classList.add(ys("ax")),ee.setAttributeNS(null,"x1","50%"),ee.setAttributeNS(null,"y1","0"),ee.setAttributeNS(null,"x2","50%"),ee.setAttributeNS(null,"y2","100%"),this.svgElem_.appendChild(ee);const Oe=c.createElementNS(it,"line");Oe.classList.add(ys("l")),Oe.setAttributeNS(null,"x1","50%"),Oe.setAttributeNS(null,"y1","50%"),this.svgElem_.appendChild(Oe),this.lineElem_=Oe;const lt=c.createElement("div");lt.classList.add(ys("m")),this.padElement.appendChild(lt),this.markerElem_=lt,p.value.emitter.on("change",this.onValueChange_),this.value=p.value,this.update_()}get allFocusableElements(){return[this.padElement]}update_(){const[c,p]=this.value.rawValue.getComponents(),x=this.maxValue_,L=hn(c,-x,+x,0,100),q=hn(p,-x,+x,0,100),ee=this.invertsY_?100-q:q;this.lineElem_.setAttributeNS(null,"x2",`${L}%`),this.lineElem_.setAttributeNS(null,"y2",`${ee}%`),this.markerElem_.style.left=`${L}%`,this.markerElem_.style.top=`${ee}%`}onValueChange_(){this.update_()}onFoldableChange_(){this.update_()}}function _s(m,c,p){return[kn(c[0],lr(m)),kn(c[1],ds(m))*(p?1:-1)]}class Lg{constructor(c,p){this.onPadKeyDown_=this.onPadKeyDown_.bind(this),this.onPadKeyUp_=this.onPadKeyUp_.bind(this),this.onPointerDown_=this.onPointerDown_.bind(this),this.onPointerMove_=this.onPointerMove_.bind(this),this.onPointerUp_=this.onPointerUp_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.baseSteps_=p.baseSteps,this.maxValue_=p.maxValue,this.invertsY_=p.invertsY,this.view=new Rg(c,{invertsY:this.invertsY_,layout:p.layout,maxValue:this.maxValue_,value:this.value,viewProps:this.viewProps}),this.ptHandler_=new js(this.view.padElement),this.ptHandler_.emitter.on("down",this.onPointerDown_),this.ptHandler_.emitter.on("move",this.onPointerMove_),this.ptHandler_.emitter.on("up",this.onPointerUp_),this.view.padElement.addEventListener("keydown",this.onPadKeyDown_),this.view.padElement.addEventListener("keyup",this.onPadKeyUp_)}handlePointerEvent_(c,p){if(!c.point)return;const x=this.maxValue_,L=hn(c.point.x,0,c.bounds.width,-x,+x),q=hn(this.invertsY_?c.bounds.height-c.point.y:c.point.y,0,c.bounds.height,-x,+x);this.value.setRawValue(new ur(L,q),p)}onPointerDown_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerMove_(c){this.handlePointerEvent_(c.data,{forceEmit:!1,last:!1})}onPointerUp_(c){this.handlePointerEvent_(c.data,{forceEmit:!0,last:!0})}onPadKeyDown_(c){Ur(c.key)&&c.preventDefault();const[p,x]=_s(c,this.baseSteps_,this.invertsY_);p===0&&x===0||this.value.setRawValue(new ur(this.value.rawValue.x+p,this.value.rawValue.y+x),{forceEmit:!1,last:!1})}onPadKeyUp_(c){const[p,x]=_s(c,this.baseSteps_,this.invertsY_);p===0&&x===0||this.value.setRawValue(this.value.rawValue,{forceEmit:!0,last:!0})}}class Dg{constructor(c,p){var x,L;this.onPopupChildBlur_=this.onPopupChildBlur_.bind(this),this.onPopupChildKeydown_=this.onPopupChildKeydown_.bind(this),this.onPadButtonBlur_=this.onPadButtonBlur_.bind(this),this.onPadButtonClick_=this.onPadButtonClick_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.foldable_=Ee.create(p.expanded),this.popC_=p.pickerLayout==="popup"?new Bd(c,{viewProps:this.viewProps}):null;const q=new Lg(c,{baseSteps:[p.axes[0].baseStep,p.axes[1].baseStep],invertsY:p.invertsY,layout:p.pickerLayout,maxValue:p.maxValue,value:this.value,viewProps:this.viewProps});q.view.allFocusableElements.forEach(ee=>{ee.addEventListener("blur",this.onPopupChildBlur_),ee.addEventListener("keydown",this.onPopupChildKeydown_)}),this.pickerC_=q,this.textC_=new Vu(c,{assembly:Bi,axes:p.axes,parser:p.parser,value:this.value,viewProps:this.viewProps}),this.view=new Pg(c,{expanded:this.foldable_.value("expanded"),pickerLayout:p.pickerLayout,viewProps:this.viewProps}),this.view.textElement.appendChild(this.textC_.view.element),(x=this.view.buttonElement)===null||x===void 0||x.addEventListener("blur",this.onPadButtonBlur_),(L=this.view.buttonElement)===null||L===void 0||L.addEventListener("click",this.onPadButtonClick_),this.popC_?(this.view.element.appendChild(this.popC_.view.element),this.popC_.view.element.appendChild(this.pickerC_.view.element),Oo({primary:this.foldable_.value("expanded"),secondary:this.popC_.shows,forward:ee=>ee.rawValue,backward:(ee,Oe)=>Oe.rawValue})):this.view.pickerElement&&(this.view.pickerElement.appendChild(this.pickerC_.view.element),X(this.foldable_,this.view.pickerElement))}onPadButtonBlur_(c){if(!this.popC_)return;const p=this.view.element,x=c.relatedTarget;(!x||!p.contains(x))&&(this.popC_.shows.rawValue=!1)}onPadButtonClick_(){this.foldable_.set("expanded",!this.foldable_.get("expanded")),this.foldable_.get("expanded")&&this.pickerC_.view.allFocusableElements[0].focus()}onPopupChildBlur_(c){if(!this.popC_)return;const p=this.popC_.view.element,x=H(c);x&&p.contains(x)||x&&x===this.view.buttonElement&&!ve(p.ownerDocument)||(this.popC_.shows.rawValue=!1)}onPopupChildKeydown_(c){this.popC_?c.key==="Escape"&&(this.popC_.shows.rawValue=!1):this.view.pickerElement&&c.key==="Escape"&&this.view.buttonElement.focus()}}function Ig(m){return ur.isObject(m)?new ur(m.x,m.y):new ur}function Og(m,c){m.writeProperty("x",c.x),m.writeProperty("y",c.y)}function sp(m){if(!m)return;const c=[];return f(m.step)||c.push(new Ar(m.step)),(!f(m.max)||!f(m.min))&&c.push(new Si({max:m.max,min:m.min})),new us(c)}function Vr(m){return new Ni({assembly:Bi,components:[sp("x"in m?m.x:void 0),sp("y"in m?m.y:void 0)]})}function op(m,c){const p=m&&Ki(m,Si);if(p)return Math.max(Math.abs(p.minValue||0),Math.abs(p.maxValue||0));const x=Xs(m);return Math.max(Math.abs(x)*10,Math.abs(c)*10)}function kg(m,c){const p=c instanceof Ni?c.components[0]:void 0,x=c instanceof Ni?c.components[1]:void 0,L=op(p,m.x),q=op(x,m.y);return Math.max(L,q)}function ap(m,c){return{baseStep:Xs(c),constraint:c,textProps:K.fromObject({draggingScale:No(c,m),formatter:yi(Na(c,m))})}}function Ng(m){if(!("y"in m))return!1;const c=m.y;return c&&"inverted"in c?!!c.inverted:!1}const Bg={id:"input-point2d",type:"input",accept:(m,c)=>{if(!ur.isObject(m))return null;const p=fe,x=Ce(c,{expanded:p.optional.boolean,picker:p.optional.custom(Il),x:p.optional.custom(ps),y:p.optional.object({inverted:p.optional.boolean,max:p.optional.number,min:p.optional.number,step:p.optional.number})});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Ig,constraint:m=>Vr(m.params),equals:ur.equals,writer:m=>Og},controller:m=>{const c=m.document,p=m.value,x=m.constraint;if(!(x instanceof Ni))throw _.shouldNeverHappen();const L="expanded"in m.params?m.params.expanded:void 0,q="picker"in m.params?m.params.picker:void 0;return new Dg(c,{axes:[ap(p.rawValue.x,x.components[0]),ap(p.rawValue.y,x.components[1])],expanded:L??!1,invertsY:Ng(m.params),maxValue:kg(p.rawValue,x),parser:ar,pickerLayout:q??"popup",value:p,viewProps:m.viewProps})}};class Ti{constructor(c=0,p=0,x=0){this.x=c,this.y=p,this.z=x}getComponents(){return[this.x,this.y,this.z]}static isObject(c){if(f(c))return!1;const p=c.x,x=c.y,L=c.z;return!(typeof p!="number"||typeof x!="number"||typeof L!="number")}static equals(c,p){return c.x===p.x&&c.y===p.y&&c.z===p.z}toObject(){return{x:this.x,y:this.y,z:this.z}}}const lp={toComponents:m=>m.getComponents(),fromComponents:m=>new Ti(...m)};function zg(m){return Ti.isObject(m)?new Ti(m.x,m.y,m.z):new Ti}function Ug(m,c){m.writeProperty("x",c.x),m.writeProperty("y",c.y),m.writeProperty("z",c.z)}function Hu(m){if(!m)return;const c=[];return f(m.step)||c.push(new Ar(m.step)),(!f(m.max)||!f(m.min))&&c.push(new Si({max:m.max,min:m.min})),new us(c)}function Fg(m){return new Ni({assembly:lp,components:[Hu("x"in m?m.x:void 0),Hu("y"in m?m.y:void 0),Hu("z"in m?m.z:void 0)]})}function Hr(m,c){return{baseStep:Xs(c),constraint:c,textProps:K.fromObject({draggingScale:No(c,m),formatter:yi(Na(c,m))})}}const Vg={id:"input-point3d",type:"input",accept:(m,c)=>{if(!Ti.isObject(m))return null;const p=fe,x=Ce(c,{x:p.optional.custom(ps),y:p.optional.custom(ps),z:p.optional.custom(ps)});return x?{initialValue:m,params:x}:null},binding:{reader:m=>zg,constraint:m=>Fg(m.params),equals:Ti.equals,writer:m=>Ug},controller:m=>{const c=m.value,p=m.constraint;if(!(p instanceof Ni))throw _.shouldNeverHappen();return new Vu(m.document,{assembly:lp,axes:[Hr(c.rawValue.x,p.components[0]),Hr(c.rawValue.y,p.components[1]),Hr(c.rawValue.z,p.components[2])],parser:ar,value:c,viewProps:m.viewProps})}};class jo{constructor(c=0,p=0,x=0,L=0){this.x=c,this.y=p,this.z=x,this.w=L}getComponents(){return[this.x,this.y,this.z,this.w]}static isObject(c){if(f(c))return!1;const p=c.x,x=c.y,L=c.z,q=c.w;return!(typeof p!="number"||typeof x!="number"||typeof L!="number"||typeof q!="number")}static equals(c,p){return c.x===p.x&&c.y===p.y&&c.z===p.z&&c.w===p.w}toObject(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const Qi={toComponents:m=>m.getComponents(),fromComponents:m=>new jo(...m)};function Hg(m){return jo.isObject(m)?new jo(m.x,m.y,m.z,m.w):new jo}function Gg(m,c){m.writeProperty("x",c.x),m.writeProperty("y",c.y),m.writeProperty("z",c.z),m.writeProperty("w",c.w)}function Kl(m){if(!m)return;const c=[];return f(m.step)||c.push(new Ar(m.step)),(!f(m.max)||!f(m.min))&&c.push(new Si({max:m.max,min:m.min})),new us(c)}function Wg(m){return new Ni({assembly:Qi,components:[Kl("x"in m?m.x:void 0),Kl("y"in m?m.y:void 0),Kl("z"in m?m.z:void 0),Kl("w"in m?m.w:void 0)]})}function jg(m,c){return{baseStep:Xs(c),constraint:c,textProps:K.fromObject({draggingScale:No(c,m),formatter:yi(Na(c,m))})}}const cp={id:"input-point4d",type:"input",accept:(m,c)=>{if(!jo.isObject(m))return null;const p=fe,x=Ce(c,{x:p.optional.custom(ps),y:p.optional.custom(ps),z:p.optional.custom(ps),w:p.optional.custom(ps)});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Hg,constraint:m=>Wg(m.params),equals:jo.equals,writer:m=>Gg},controller:m=>{const c=m.value,p=m.constraint;if(!(p instanceof Ni))throw _.shouldNeverHappen();return new Vu(m.document,{assembly:Qi,axes:c.rawValue.getComponents().map((x,L)=>jg(x,p.components[L])),parser:ar,value:c,viewProps:m.viewProps})}};function up(m){const c=[],p=_i(m.options);return p&&c.push(p),new us(c)}const Xg={id:"input-string",type:"input",accept:(m,c)=>{if(typeof m!="string")return null;const x=Ce(c,{options:fe.optional.custom(ko)});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Ru,constraint:m=>up(m.params),writer:m=>Ia},controller:m=>{var c;const p=m.document,x=m.value,L=m.constraint;return L&&Ki(L,Ca)?new Ro(p,{props:K.fromObject({options:(c=Oa(L))!==null&&c!==void 0?c:[]}),value:x,viewProps:m.viewProps}):new Lo(p,{parser:q=>q,props:K.fromObject({formatter:Rl}),value:x,viewProps:m.viewProps})}},Va={monitor:{defaultInterval:200,defaultLineCount:3}},Jl=E("mll");class Ha{constructor(c,p){this.onValueUpdate_=this.onValueUpdate_.bind(this),this.formatter_=p.formatter,this.element=c.createElement("div"),this.element.classList.add(Jl()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("textarea");x.classList.add(Jl("i")),x.style.height=`calc(var(--bld-us) * ${p.lineCount})`,x.readOnly=!0,p.viewProps.bindDisabled(x),this.element.appendChild(x),this.textareaElem_=x,p.value.emitter.on("change",this.onValueUpdate_),this.value=p.value,this.update_()}update_(){const c=this.textareaElem_,p=c.scrollTop===c.scrollHeight-c.clientHeight,x=[];this.value.rawValue.forEach(L=>{L!==void 0&&x.push(this.formatter_(L))}),c.textContent=x.join(`
|
||
`),p&&(c.scrollTop=c.scrollHeight)}onValueUpdate_(){this.update_()}}class Xo{constructor(c,p){this.value=p.value,this.viewProps=p.viewProps,this.view=new Ha(c,{formatter:p.formatter,lineCount:p.lineCount,value:this.value,viewProps:this.viewProps})}}const hp=E("sgl");class dp{constructor(c,p){this.onValueUpdate_=this.onValueUpdate_.bind(this),this.formatter_=p.formatter,this.element=c.createElement("div"),this.element.classList.add(hp()),p.viewProps.bindClassModifiers(this.element);const x=c.createElement("input");x.classList.add(hp("i")),x.readOnly=!0,x.type="text",p.viewProps.bindDisabled(x),this.element.appendChild(x),this.inputElement=x,p.value.emitter.on("change",this.onValueUpdate_),this.value=p.value,this.update_()}update_(){const c=this.value.rawValue,p=c[c.length-1];this.inputElement.value=p!==void 0?this.formatter_(p):""}onValueUpdate_(){this.update_()}}class Gu{constructor(c,p){this.value=p.value,this.viewProps=p.viewProps,this.view=new dp(c,{formatter:p.formatter,value:this.value,viewProps:this.viewProps})}}const Gr={id:"monitor-bool",type:"monitor",accept:(m,c)=>{if(typeof m!="boolean")return null;const x=Ce(c,{lineCount:fe.optional.number});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Su},controller:m=>{var c;return m.value.rawValue.length===1?new Gu(m.document,{formatter:Mu,value:m.value,viewProps:m.viewProps}):new Xo(m.document,{formatter:Mu,lineCount:(c=m.params.lineCount)!==null&&c!==void 0?c:Va.monitor.defaultLineCount,value:m.value,viewProps:m.viewProps})}};class Wu{constructor(){this.emitter=new b,this.index_=-1}get index(){return this.index_}set index(c){this.index_!==c&&(this.index_=c,this.emitter.emit("change",{index:c,sender:this}))}}const Ai=E("grl");class $i{constructor(c,p){this.onCursorChange_=this.onCursorChange_.bind(this),this.onValueUpdate_=this.onValueUpdate_.bind(this),this.element=c.createElement("div"),this.element.classList.add(Ai()),p.viewProps.bindClassModifiers(this.element),this.formatter_=p.formatter,this.minValue_=p.minValue,this.maxValue_=p.maxValue,this.cursor_=p.cursor,this.cursor_.emitter.on("change",this.onCursorChange_);const x=c.createElementNS(it,"svg");x.classList.add(Ai("g")),x.style.height=`calc(var(--bld-us) * ${p.lineCount})`,this.element.appendChild(x),this.svgElem_=x;const L=c.createElementNS(it,"polyline");this.svgElem_.appendChild(L),this.lineElem_=L;const q=c.createElement("div");q.classList.add(Ai("t"),E("tt")()),this.element.appendChild(q),this.tooltipElem_=q,p.value.emitter.on("change",this.onValueUpdate_),this.value=p.value,this.update_()}get graphElement(){return this.svgElem_}update_(){const c=this.svgElem_.getBoundingClientRect(),p=this.value.rawValue.length-1,x=this.minValue_,L=this.maxValue_,q=[];this.value.rawValue.forEach((jt,Jt)=>{if(jt===void 0)return;const jr=hn(Jt,0,p,0,c.width),Yo=hn(jt,x,L,c.height,0);q.push([jr,Yo].join(","))}),this.lineElem_.setAttributeNS(null,"points",q.join(" "));const ee=this.tooltipElem_,Oe=this.value.rawValue[this.cursor_.index];if(Oe===void 0){ee.classList.remove(Ai("t","a"));return}const lt=hn(this.cursor_.index,0,p,0,c.width),mt=hn(Oe,x,L,c.height,0);ee.style.left=`${lt}px`,ee.style.top=`${mt}px`,ee.textContent=`${this.formatter_(Oe)}`,ee.classList.contains(Ai("t","a"))||(ee.classList.add(Ai("t","a"),Ai("t","in")),Le(ee),ee.classList.remove(Ai("t","in")))}onValueUpdate_(){this.update_()}onCursorChange_(){this.update_()}}class qg{constructor(c,p){if(this.onGraphMouseMove_=this.onGraphMouseMove_.bind(this),this.onGraphMouseLeave_=this.onGraphMouseLeave_.bind(this),this.onGraphPointerDown_=this.onGraphPointerDown_.bind(this),this.onGraphPointerMove_=this.onGraphPointerMove_.bind(this),this.onGraphPointerUp_=this.onGraphPointerUp_.bind(this),this.value=p.value,this.viewProps=p.viewProps,this.cursor_=new Wu,this.view=new $i(c,{cursor:this.cursor_,formatter:p.formatter,lineCount:p.lineCount,maxValue:p.maxValue,minValue:p.minValue,value:this.value,viewProps:this.viewProps}),!ve(c))this.view.element.addEventListener("mousemove",this.onGraphMouseMove_),this.view.element.addEventListener("mouseleave",this.onGraphMouseLeave_);else{const x=new js(this.view.element);x.emitter.on("down",this.onGraphPointerDown_),x.emitter.on("move",this.onGraphPointerMove_),x.emitter.on("up",this.onGraphPointerUp_)}}onGraphMouseLeave_(){this.cursor_.index=-1}onGraphMouseMove_(c){const p=this.view.element.getBoundingClientRect();this.cursor_.index=Math.floor(hn(c.offsetX,0,p.width,0,this.value.rawValue.length))}onGraphPointerDown_(c){this.onGraphPointerMove_(c)}onGraphPointerMove_(c){if(!c.data.point){this.cursor_.index=-1;return}this.cursor_.index=Math.floor(hn(c.data.point.x,0,c.data.bounds.width,0,this.value.rawValue.length))}onGraphPointerUp_(){this.cursor_.index=-1}}function Ql(m){return"format"in m&&!f(m.format)?m.format:yi(2)}function pp(m){var c;return m.value.rawValue.length===1?new Gu(m.document,{formatter:Ql(m.params),value:m.value,viewProps:m.viewProps}):new Xo(m.document,{formatter:Ql(m.params),lineCount:(c=m.params.lineCount)!==null&&c!==void 0?c:Va.monitor.defaultLineCount,value:m.value,viewProps:m.viewProps})}function Ga(m){var c,p,x;return new qg(m.document,{formatter:Ql(m.params),lineCount:(c=m.params.lineCount)!==null&&c!==void 0?c:Va.monitor.defaultLineCount,maxValue:(p="max"in m.params?m.params.max:null)!==null&&p!==void 0?p:100,minValue:(x="min"in m.params?m.params.min:null)!==null&&x!==void 0?x:0,value:m.value,viewProps:m.viewProps})}function Wr(m){return"view"in m&&m.view==="graph"}const fp={id:"monitor-number",type:"monitor",accept:(m,c)=>{if(typeof m!="number")return null;const p=fe,x=Ce(c,{format:p.optional.function,lineCount:p.optional.number,max:p.optional.number,min:p.optional.number,view:p.optional.string});return x?{initialValue:m,params:x}:null},binding:{defaultBufferSize:m=>Wr(m)?64:1,reader:m=>Oi},controller:m=>Wr(m.params)?Ga(m):pp(m)},Yg={id:"monitor-string",type:"monitor",accept:(m,c)=>{if(typeof m!="string")return null;const p=fe,x=Ce(c,{lineCount:p.optional.number,multiline:p.optional.boolean});return x?{initialValue:m,params:x}:null},binding:{reader:m=>Ru},controller:m=>{var c;const p=m.value;return p.rawValue.length>1||"multiline"in m.params&&m.params.multiline?new Xo(m.document,{formatter:Rl,lineCount:(c=m.params.lineCount)!==null&&c!==void 0?c:Va.monitor.defaultLineCount,value:p,viewProps:m.viewProps}):new Gu(m.document,{formatter:Rl,value:p,viewProps:m.viewProps})}};class $l{constructor(c){this.onValueChange_=this.onValueChange_.bind(this),this.reader=c.reader,this.writer=c.writer,this.emitter=new b,this.value=c.value,this.value.emitter.on("change",this.onValueChange_),this.target=c.target,this.read()}read(){const c=this.target.read();c!==void 0&&(this.value.rawValue=this.reader(c))}write_(c){this.writer(this.target,c)}onValueChange_(c){this.write_(c.rawValue),this.emitter.emit("change",{options:c.options,rawValue:c.rawValue,sender:this})}}function Zg(m,c){const p=m.accept(c.target.read(),c.params);if(f(p))return null;const x=fe,L={target:c.target,initialValue:p.initialValue,params:p.params},q=m.binding.reader(L),ee=m.binding.constraint?m.binding.constraint(L):void 0,Oe=$(q(p.initialValue),{constraint:ee,equals:m.binding.equals}),lt=new $l({reader:q,target:c.target,value:Oe,writer:m.binding.writer(L)}),mt=x.optional.boolean(c.params.disabled).value,jt=x.optional.boolean(c.params.hidden).value,Jt=m.controller({constraint:ee,document:c.document,initialValue:p.initialValue,params:p.params,value:lt.value,viewProps:Pt.create({disabled:mt,hidden:jt})}),jr=x.optional.string(c.params.label).value;return new wt(c.document,{binding:lt,blade:U(),props:K.fromObject({label:jr||c.target.key}),valueController:Jt})}class mp{constructor(c){this.onTick_=this.onTick_.bind(this),this.reader_=c.reader,this.target=c.target,this.emitter=new b,this.value=c.value,this.ticker=c.ticker,this.ticker.emitter.on("tick",this.onTick_),this.read()}dispose(){this.ticker.dispose()}read(){const c=this.target.read();if(c===void 0)return;const p=this.value.rawValue,x=this.reader_(c);this.value.rawValue=ag(p,x),this.emitter.emit("update",{rawValue:x,sender:this})}onTick_(c){this.read()}}function ii(m,c){return c===0?new kd:new Nd(m,c??Va.monitor.defaultInterval)}function ju(m,c){var p,x,L;const q=fe,ee=m.accept(c.target.read(),c.params);if(f(ee))return null;const Oe={target:c.target,initialValue:ee.initialValue,params:ee.params},lt=m.binding.reader(Oe),mt=(x=(p=q.optional.number(c.params.bufferSize).value)!==null&&p!==void 0?p:m.binding.defaultBufferSize&&m.binding.defaultBufferSize(ee.params))!==null&&x!==void 0?x:1,jt=q.optional.number(c.params.interval).value,Jt=new mp({reader:lt,target:c.target,ticker:ii(c.document,jt),value:og(mt)}),jr=q.optional.boolean(c.params.disabled).value,Yo=q.optional.boolean(c.params.hidden).value,Zo=m.controller({document:c.document,params:ee.params,value:Jt.value,viewProps:Pt.create({disabled:jr,hidden:Yo})}),Qs=(L=q.optional.string(c.params.label).value)!==null&&L!==void 0?L:c.target.key;return new jn(c.document,{binding:Jt,blade:U(),props:K.fromObject({label:Qs}),valueController:Zo})}class vp{constructor(){this.pluginsMap_={blades:[],inputs:[],monitors:[]}}getAll(){return[...this.pluginsMap_.blades,...this.pluginsMap_.inputs,...this.pluginsMap_.monitors]}register(c){c.type==="blade"?this.pluginsMap_.blades.unshift(c):c.type==="input"?this.pluginsMap_.inputs.unshift(c):c.type==="monitor"&&this.pluginsMap_.monitors.unshift(c)}createInput(c,p,x){const L=p.read();if(f(L))throw new _({context:{key:p.key},type:"nomatchingcontroller"});const q=this.pluginsMap_.inputs.reduce((ee,Oe)=>ee||Zg(Oe,{document:c,target:p,params:x}),null);if(q)return q;throw new _({context:{key:p.key},type:"nomatchingcontroller"})}createMonitor(c,p,x){const L=this.pluginsMap_.monitors.reduce((q,ee)=>q||ju(ee,{document:c,params:x,target:p}),null);if(L)return L;throw new _({context:{key:p.key},type:"nomatchingcontroller"})}createBlade(c,p){const x=this.pluginsMap_.blades.reduce((L,q)=>L||Hv(q,{document:c,params:p}),null);if(!x)throw new _({type:"nomatchingview",context:{params:p}});return x}createBladeApi(c){if(c instanceof wt)return new ct(c);if(c instanceof jn)return new Ct(c);if(c instanceof ge)return new Vs(c,this);const p=this.pluginsMap_.blades.reduce((x,L)=>x||L.api({controller:c,pool:this}),null);if(!p)throw _.shouldNeverHappen();return p}}function Pr(){const m=new vp;return[Bg,Vg,cp,Xg,Wo,Yl,Ua,Go,Bo,Gr,Yg,fp,Ue,St,ls,Ii].forEach(c=>{m.register(c)}),m}class ec extends r{constructor(c){super(c),this.emitter_=new b,this.controller_.valueController.value.emitter.on("change",p=>{this.emitter_.emit("change",{event:new o(this,p.rawValue)})})}get label(){return this.controller_.props.get("label")}set label(c){this.controller_.props.set("label",c)}get options(){return this.controller_.valueController.props.get("options")}set options(c){this.controller_.valueController.props.set("options",c)}get value(){return this.controller_.valueController.value.rawValue}set value(c){this.controller_.valueController.value.rawValue=c}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}}class Wa extends r{constructor(c){super(c),this.emitter_=new b,this.controller_.valueController.value.emitter.on("change",p=>{this.emitter_.emit("change",{event:new o(this,p.rawValue)})})}get label(){return this.controller_.props.get("label")}set label(c){this.controller_.props.set("label",c)}get maxValue(){return this.controller_.valueController.sliderController.props.get("maxValue")}set maxValue(c){this.controller_.valueController.sliderController.props.set("maxValue",c)}get minValue(){return this.controller_.valueController.sliderController.props.get("minValue")}set minValue(c){this.controller_.valueController.sliderController.props.set("minValue",c)}get value(){return this.controller_.valueController.value.rawValue}set value(c){this.controller_.valueController.value.rawValue=c}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}}class xs extends r{constructor(c){super(c),this.emitter_=new b,this.controller_.valueController.value.emitter.on("change",p=>{this.emitter_.emit("change",{event:new o(this,p.rawValue)})})}get label(){return this.controller_.props.get("label")}set label(c){this.controller_.props.set("label",c)}get formatter(){return this.controller_.valueController.props.get("formatter")}set formatter(c){this.controller_.valueController.props.set("formatter",c)}get value(){return this.controller_.valueController.value.rawValue}set value(c){this.controller_.valueController.value.rawValue=c}on(c,p){const x=p.bind(this);return this.emitter_.on(c,L=>{x(L.event)}),this}}const gp=function(){return{id:"list",type:"blade",accept(m){const c=fe,p=Ce(m,{options:c.required.custom(ko),value:c.required.raw,view:c.required.constant("list"),label:c.optional.string});return p?{params:p}:null},controller(m){const c=new Ro(m.document,{props:K.fromObject({options:Ou(m.params.options)}),value:$(m.params.value),viewProps:m.viewProps});return new Dt(m.document,{blade:m.blade,props:K.fromObject({label:m.params.label}),valueController:c})},api(m){return!(m.controller instanceof Dt)||!(m.controller.valueController instanceof Ro)?null:new ec(m.controller)}}}();function xi(m){return m.reduce((c,p)=>Object.assign(c,{[p.presetKey]:p.read()}),{})}function Xu(m,c){m.forEach(p=>{const x=c[p.presetKey];x!==void 0&&p.write(x)})}class Kg extends Hs{constructor(c,p){super(c,p)}get element(){return this.controller_.view.element}importPreset(c){const p=this.controller_.rackController.rack.find(wt).map(x=>x.binding.target);Xu(p,c),this.refresh()}exportPreset(){const c=this.controller_.rackController.rack.find(wt).map(p=>p.binding.target);return xi(c)}refresh(){this.controller_.rackController.rack.find(wt).forEach(c=>{c.binding.read()}),this.controller_.rackController.rack.find(jn).forEach(c=>{c.binding.read()})}}class Jg extends _t{constructor(c,p){super(c,{expanded:p.expanded,blade:p.blade,props:p.props,root:!0,viewProps:p.viewProps})}}const Qg={id:"slider",type:"blade",accept(m){const c=fe,p=Ce(m,{max:c.required.number,min:c.required.number,view:c.required.constant("slider"),format:c.optional.function,label:c.optional.string,value:c.optional.number});return p?{params:p}:null},controller(m){var c,p;const x=(c=m.params.value)!==null&&c!==void 0?c:0,L=new Dl(m.document,{baseStep:1,parser:ar,sliderProps:K.fromObject({maxValue:m.params.max,minValue:m.params.min}),textProps:K.fromObject({draggingScale:No(void 0,x),formatter:(p=m.params.format)!==null&&p!==void 0?p:Wd}),value:$(x),viewProps:m.viewProps});return new Dt(m.document,{blade:m.blade,props:K.fromObject({label:m.params.label}),valueController:L})},api(m){return!(m.controller instanceof Dt)||!(m.controller.valueController instanceof Dl)?null:new Wa(m.controller)}},qu=function(){return{id:"text",type:"blade",accept(m){const c=fe,p=Ce(m,{parse:c.required.function,value:c.required.raw,view:c.required.constant("text"),format:c.optional.function,label:c.optional.string});return p?{params:p}:null},controller(m){var c;const p=new Lo(m.document,{parser:m.params.parse,props:K.fromObject({formatter:(c=m.params.format)!==null&&c!==void 0?c:x=>String(x)}),value:$(m.params.value),viewProps:m.viewProps});return new Dt(m.document,{blade:m.blade,props:K.fromObject({label:m.params.label}),valueController:p})},api(m){return!(m.controller instanceof Dt)||!(m.controller.valueController instanceof Lo)?null:new xs(m.controller)}}}();function $g(m){const c=m.createElement("div");return c.classList.add(E("dfw")()),m.body&&m.body.appendChild(c),c}function qo(m,c,p){if(m.querySelector(`style[data-tp-style=${c}]`))return;const x=m.createElement("style");x.dataset.tpStyle=c,x.textContent=p,m.head.appendChild(x)}class yp extends Kg{constructor(c){var p;const x=c||{},L=(p=x.document)!==null&&p!==void 0?p:Ae(),q=Pr(),ee=new Jg(L,{expanded:x.expanded,blade:U(),props:K.fromObject({title:x.title}),viewProps:Pt.create()});super(ee,q),this.pool_=q,this.containerElem_=x.container||$g(L),this.containerElem_.appendChild(this.element),this.doc_=L,this.usesDefaultWrapper_=!x.container,this.setUpDefaultPlugins_()}get document(){if(!this.doc_)throw _.alreadyDisposed();return this.doc_}dispose(){const c=this.containerElem_;if(!c)throw _.alreadyDisposed();if(this.usesDefaultWrapper_){const p=c.parentElement;p&&p.removeChild(c)}this.containerElem_=null,this.doc_=null,super.dispose()}registerPlugin(c){("plugin"in c?[c.plugin]:"plugins"in c?c.plugins:[]).forEach(x=>{this.pool_.register(x),this.embedPluginStyle_(x)})}embedPluginStyle_(c){c.css&&qo(this.document,`plugin-${c.id}`,c.css)}setUpDefaultPlugins_(){qo(this.document,"default",'.tp-tbiv_b,.tp-coltxtv_ms,.tp-ckbv_i,.tp-rotv_b,.tp-fldv_b,.tp-mllv_i,.tp-sglv_i,.tp-grlv_g,.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw,.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border-width:0;font-family:inherit;font-size:inherit;font-weight:inherit;margin:0;outline:none;padding:0}.tp-p2dv_b,.tp-btnv_b,.tp-lstv_s{background-color:var(--btn-bg);border-radius:var(--elm-br);color:var(--btn-fg);cursor:pointer;display:block;font-weight:bold;height:var(--bld-us);line-height:var(--bld-us);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tp-p2dv_b:hover,.tp-btnv_b:hover,.tp-lstv_s:hover{background-color:var(--btn-bg-h)}.tp-p2dv_b:focus,.tp-btnv_b:focus,.tp-lstv_s:focus{background-color:var(--btn-bg-f)}.tp-p2dv_b:active,.tp-btnv_b:active,.tp-lstv_s:active{background-color:var(--btn-bg-a)}.tp-p2dv_b:disabled,.tp-btnv_b:disabled,.tp-lstv_s:disabled{opacity:.5}.tp-txtv_i,.tp-p2dpv_p,.tp-colswv_sw{background-color:var(--in-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--in-fg);font-family:inherit;height:var(--bld-us);line-height:var(--bld-us);min-width:0;width:100%}.tp-txtv_i:hover,.tp-p2dpv_p:hover,.tp-colswv_sw:hover{background-color:var(--in-bg-h)}.tp-txtv_i:focus,.tp-p2dpv_p:focus,.tp-colswv_sw:focus{background-color:var(--in-bg-f)}.tp-txtv_i:active,.tp-p2dpv_p:active,.tp-colswv_sw:active{background-color:var(--in-bg-a)}.tp-txtv_i:disabled,.tp-p2dpv_p:disabled,.tp-colswv_sw:disabled{opacity:.5}.tp-mllv_i,.tp-sglv_i,.tp-grlv_g{background-color:var(--mo-bg);border-radius:var(--elm-br);box-sizing:border-box;color:var(--mo-fg);height:var(--bld-us);scrollbar-color:currentColor transparent;scrollbar-width:thin;width:100%}.tp-mllv_i::-webkit-scrollbar,.tp-sglv_i::-webkit-scrollbar,.tp-grlv_g::-webkit-scrollbar{height:8px;width:8px}.tp-mllv_i::-webkit-scrollbar-corner,.tp-sglv_i::-webkit-scrollbar-corner,.tp-grlv_g::-webkit-scrollbar-corner{background-color:transparent}.tp-mllv_i::-webkit-scrollbar-thumb,.tp-sglv_i::-webkit-scrollbar-thumb,.tp-grlv_g::-webkit-scrollbar-thumb{background-clip:padding-box;background-color:currentColor;border:transparent solid 2px;border-radius:4px}.tp-rotv{--font-family: var(--tp-font-family, Roboto Mono, Source Code Pro, Menlo, Courier, monospace);--bs-br: var(--tp-base-border-radius, 6px);--cnt-h-p: var(--tp-container-horizontal-padding, 4px);--cnt-v-p: var(--tp-container-vertical-padding, 4px);--elm-br: var(--tp-element-border-radius, 2px);--bld-s: var(--tp-blade-spacing, 4px);--bld-us: var(--tp-blade-unit-size, 20px);--bs-bg: var(--tp-base-background-color, #28292e);--bs-sh: var(--tp-base-shadow-color, rgba(0, 0, 0, 0.2));--btn-bg: var(--tp-button-background-color, #adafb8);--btn-bg-a: var(--tp-button-background-color-active, #d6d7db);--btn-bg-f: var(--tp-button-background-color-focus, #c8cad0);--btn-bg-h: var(--tp-button-background-color-hover, #bbbcc4);--btn-fg: var(--tp-button-foreground-color, #28292e);--cnt-bg: var(--tp-container-background-color, rgba(187, 188, 196, 0.1));--cnt-bg-a: var(--tp-container-background-color-active, rgba(187, 188, 196, 0.25));--cnt-bg-f: var(--tp-container-background-color-focus, rgba(187, 188, 196, 0.2));--cnt-bg-h: var(--tp-container-background-color-hover, rgba(187, 188, 196, 0.15));--cnt-fg: var(--tp-container-foreground-color, #bbbcc4);--in-bg: var(--tp-input-background-color, rgba(187, 188, 196, 0.1));--in-bg-a: var(--tp-input-background-color-active, rgba(187, 188, 196, 0.25));--in-bg-f: var(--tp-input-background-color-focus, rgba(187, 188, 196, 0.2));--in-bg-h: var(--tp-input-background-color-hover, rgba(187, 188, 196, 0.15));--in-fg: var(--tp-input-foreground-color, #bbbcc4);--lbl-fg: var(--tp-label-foreground-color, rgba(187, 188, 196, 0.7));--mo-bg: var(--tp-monitor-background-color, rgba(0, 0, 0, 0.2));--mo-fg: var(--tp-monitor-foreground-color, rgba(187, 188, 196, 0.7));--grv-fg: var(--tp-groove-foreground-color, rgba(187, 188, 196, 0.1))}.tp-rotv_c>.tp-cntv.tp-v-lst,.tp-tabv_c .tp-brkv>.tp-cntv.tp-v-lst,.tp-fldv_c>.tp-cntv.tp-v-lst{margin-bottom:calc(-1*var(--cnt-v-p))}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_c,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_c{border-bottom-left-radius:0}.tp-rotv_c>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-tabv_c .tp-brkv>.tp-fldv.tp-v-lst .tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-v-lst .tp-fldv_b{border-bottom-left-radius:0}.tp-rotv_c>*:not(.tp-v-fst),.tp-tabv_c .tp-brkv>*:not(.tp-v-fst),.tp-fldv_c>*:not(.tp-v-fst){margin-top:var(--bld-s)}.tp-rotv_c>.tp-sprv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-fst),.tp-fldv_c>.tp-sprv:not(.tp-v-fst),.tp-rotv_c>.tp-cntv:not(.tp-v-fst),.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-fst),.tp-fldv_c>.tp-cntv:not(.tp-v-fst){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-sprv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-sprv+*:not(.tp-v-hidden),.tp-rotv_c>.tp-cntv+*:not(.tp-v-hidden),.tp-tabv_c .tp-brkv>.tp-cntv+*:not(.tp-v-hidden),.tp-fldv_c>.tp-cntv+*:not(.tp-v-hidden){margin-top:var(--cnt-v-p)}.tp-rotv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-tabv_c .tp-brkv>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-fldv_c>.tp-sprv:not(.tp-v-hidden)+.tp-sprv,.tp-rotv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-tabv_c .tp-brkv>.tp-cntv:not(.tp-v-hidden)+.tp-cntv,.tp-fldv_c>.tp-cntv:not(.tp-v-hidden)+.tp-cntv{margin-top:0}.tp-tabv_c .tp-brkv>.tp-cntv,.tp-fldv_c>.tp-cntv{margin-left:4px}.tp-tabv_c .tp-brkv>.tp-fldv>.tp-fldv_b,.tp-fldv_c>.tp-fldv>.tp-fldv_b{border-top-left-radius:var(--elm-br);border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-fldv.tp-fldv-expanded>.tp-fldv_b,.tp-fldv_c>.tp-fldv.tp-fldv-expanded>.tp-fldv_b{border-bottom-left-radius:0}.tp-tabv_c .tp-brkv .tp-fldv>.tp-fldv_c,.tp-fldv_c .tp-fldv>.tp-fldv_c{border-bottom-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv>.tp-tabv>.tp-tabv_i,.tp-fldv_c>.tp-tabv>.tp-tabv_i{border-top-left-radius:var(--elm-br)}.tp-tabv_c .tp-brkv .tp-tabv>.tp-tabv_c,.tp-fldv_c .tp-tabv>.tp-tabv_c{border-bottom-left-radius:var(--elm-br)}.tp-rotv_b,.tp-fldv_b{background-color:var(--cnt-bg);color:var(--cnt-fg);cursor:pointer;display:block;height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);overflow:hidden;padding-left:var(--cnt-h-p);padding-right:calc(4px + var(--bld-us) + var(--cnt-h-p));position:relative;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%;transition:border-radius .2s ease-in-out .2s}.tp-rotv_b:hover,.tp-fldv_b:hover{background-color:var(--cnt-bg-h)}.tp-rotv_b:focus,.tp-fldv_b:focus{background-color:var(--cnt-bg-f)}.tp-rotv_b:active,.tp-fldv_b:active{background-color:var(--cnt-bg-a)}.tp-rotv_b:disabled,.tp-fldv_b:disabled{opacity:.5}.tp-rotv_m,.tp-fldv_m{background:linear-gradient(to left, var(--cnt-fg), var(--cnt-fg) 2px, transparent 2px, transparent 4px, var(--cnt-fg) 4px);border-radius:2px;bottom:0;content:"";display:block;height:6px;right:calc(var(--cnt-h-p) + (var(--bld-us) + 4px - 6px)/2 - 2px);margin:auto;opacity:.5;position:absolute;top:0;transform:rotate(90deg);transition:transform .2s ease-in-out;width:6px}.tp-rotv.tp-rotv-expanded .tp-rotv_m,.tp-fldv.tp-fldv-expanded>.tp-fldv_b>.tp-fldv_m{transform:none}.tp-rotv_c,.tp-fldv_c{box-sizing:border-box;height:0;opacity:0;overflow:hidden;padding-bottom:0;padding-top:0;position:relative;transition:height .2s ease-in-out,opacity .2s linear,padding .2s ease-in-out}.tp-rotv.tp-rotv-cpl:not(.tp-rotv-expanded) .tp-rotv_c,.tp-fldv.tp-fldv-cpl:not(.tp-fldv-expanded)>.tp-fldv_c{display:none}.tp-rotv.tp-rotv-expanded .tp-rotv_c,.tp-fldv.tp-fldv-expanded>.tp-fldv_c{opacity:1;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p);transform:none;overflow:visible;transition:height .2s ease-in-out,opacity .2s linear .2s,padding .2s ease-in-out}.tp-lstv,.tp-coltxtv_m{position:relative}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m,.tp-coltxtv_mm{bottom:0;margin:auto;pointer-events:none;position:absolute;right:2px;top:0}.tp-lstv_m svg,.tp-coltxtv_mm svg{bottom:0;height:16px;margin:auto;position:absolute;right:0;top:0;width:16px}.tp-lstv_m svg path,.tp-coltxtv_mm svg path{fill:currentColor}.tp-pndtxtv,.tp-coltxtv_w{display:flex}.tp-pndtxtv_a,.tp-coltxtv_c{width:100%}.tp-pndtxtv_a+.tp-pndtxtv_a,.tp-coltxtv_c+.tp-pndtxtv_a,.tp-pndtxtv_a+.tp-coltxtv_c,.tp-coltxtv_c+.tp-coltxtv_c{margin-left:2px}.tp-btnv_b{width:100%}.tp-btnv_t{text-align:center}.tp-ckbv_l{display:block;position:relative}.tp-ckbv_i{left:0;opacity:0;position:absolute;top:0}.tp-ckbv_w{background-color:var(--in-bg);border-radius:var(--elm-br);cursor:pointer;display:block;height:var(--bld-us);position:relative;width:var(--bld-us)}.tp-ckbv_w svg{bottom:0;display:block;height:16px;left:0;margin:auto;opacity:0;position:absolute;right:0;top:0;width:16px}.tp-ckbv_w svg path{fill:none;stroke:var(--in-fg);stroke-width:2}.tp-ckbv_i:hover+.tp-ckbv_w{background-color:var(--in-bg-h)}.tp-ckbv_i:focus+.tp-ckbv_w{background-color:var(--in-bg-f)}.tp-ckbv_i:active+.tp-ckbv_w{background-color:var(--in-bg-a)}.tp-ckbv_i:checked+.tp-ckbv_w svg{opacity:1}.tp-ckbv.tp-v-disabled .tp-ckbv_w{opacity:.5}.tp-colv{position:relative}.tp-colv_h{display:flex}.tp-colv_s{flex-grow:0;flex-shrink:0;width:var(--bld-us)}.tp-colv_t{flex:1;margin-left:4px}.tp-colv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-colv.tp-colv-cpl .tp-colv_p{overflow:visible}.tp-colv.tp-colv-expanded .tp-colv_p{margin-top:var(--bld-s);opacity:1}.tp-colv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-colpv_h,.tp-colpv_ap{margin-left:6px;margin-right:6px}.tp-colpv_h{margin-top:var(--bld-s)}.tp-colpv_rgb{display:flex;margin-top:var(--bld-s);width:100%}.tp-colpv_a{display:flex;margin-top:var(--cnt-v-p);padding-top:calc(var(--cnt-v-p) + 2px);position:relative}.tp-colpv_a:before{background-color:var(--grv-fg);content:"";height:2px;left:calc(-1*var(--cnt-h-p));position:absolute;right:calc(-1*var(--cnt-h-p));top:0}.tp-colpv_ap{align-items:center;display:flex;flex:3}.tp-colpv_at{flex:1;margin-left:4px}.tp-svpv{border-radius:var(--elm-br);outline:none;overflow:hidden;position:relative}.tp-svpv_c{cursor:crosshair;display:block;height:calc(var(--bld-us)*4);width:100%}.tp-svpv_m{border-radius:100%;border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;filter:drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));height:12px;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;width:12px}.tp-svpv:focus .tp-svpv_m{border-color:#fff}.tp-hplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative}.tp-hplv_c{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAABCAYAAABubagXAAAAQ0lEQVQoU2P8z8Dwn0GCgQEDi2OK/RBgYHjBgIpfovFh8j8YBIgzFGQxuqEgPhaDOT5gOhPkdCxOZeBg+IDFZZiGAgCaSSMYtcRHLgAAAABJRU5ErkJggg==);background-position:left top;background-repeat:no-repeat;background-size:100% 100%;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;position:absolute;top:50%;width:100%}.tp-hplv_m{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-shadow:0 0 2px rgba(0,0,0,.1);box-sizing:border-box;height:12px;left:50%;margin-left:-6px;margin-top:-6px;pointer-events:none;position:absolute;top:50%;width:12px}.tp-hplv:focus .tp-hplv_m{border-color:#fff}.tp-aplv{cursor:pointer;height:var(--bld-us);outline:none;position:relative;width:100%}.tp-aplv_b{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:4px 4px;background-position:0 0,2px 2px;border-radius:2px;display:block;height:4px;left:0;margin-top:-2px;overflow:hidden;position:absolute;top:50%;width:100%}.tp-aplv_c{bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv_m{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:12px 12px;background-position:0 0,6px 6px;border-radius:var(--elm-br);box-shadow:0 0 2px rgba(0,0,0,.1);height:12px;left:50%;margin-left:-6px;margin-top:-6px;overflow:hidden;pointer-events:none;position:absolute;top:50%;width:12px}.tp-aplv_p{border-radius:var(--elm-br);border:rgba(255,255,255,.75) solid 2px;box-sizing:border-box;bottom:0;left:0;position:absolute;right:0;top:0}.tp-aplv:focus .tp-aplv_p{border-color:#fff}.tp-colswv{background-color:#fff;background-image:linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%),linear-gradient(to top right, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);background-size:10px 10px;background-position:0 0,5px 5px;border-radius:var(--elm-br);overflow:hidden}.tp-colswv.tp-v-disabled{opacity:.5}.tp-colswv_sw{border-radius:0}.tp-colswv_b{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border-width:0;cursor:pointer;display:block;height:var(--bld-us);left:0;margin:0;outline:none;padding:0;position:absolute;top:0;width:var(--bld-us)}.tp-colswv_b:focus::after{border:rgba(255,255,255,.75) solid 2px;border-radius:var(--elm-br);bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.tp-coltxtv{display:flex;width:100%}.tp-coltxtv_m{margin-right:4px}.tp-coltxtv_ms{border-radius:var(--elm-br);color:var(--lbl-fg);cursor:pointer;height:var(--bld-us);line-height:var(--bld-us);padding:0 18px 0 4px}.tp-coltxtv_ms:hover{background-color:var(--in-bg-h)}.tp-coltxtv_ms:focus{background-color:var(--in-bg-f)}.tp-coltxtv_ms:active{background-color:var(--in-bg-a)}.tp-coltxtv_mm{color:var(--lbl-fg)}.tp-coltxtv_w{flex:1}.tp-dfwv{position:absolute;top:8px;right:8px;width:256px}.tp-fldv.tp-fldv-not .tp-fldv_b{display:none}.tp-fldv_t{padding-left:4px}.tp-fldv_c{border-left:var(--cnt-bg) solid 4px}.tp-fldv_b:hover+.tp-fldv_c{border-left-color:var(--cnt-bg-h)}.tp-fldv_b:focus+.tp-fldv_c{border-left-color:var(--cnt-bg-f)}.tp-fldv_b:active+.tp-fldv_c{border-left-color:var(--cnt-bg-a)}.tp-grlv{position:relative}.tp-grlv_g{display:block;height:calc(var(--bld-us)*3)}.tp-grlv_g polyline{fill:none;stroke:var(--mo-fg);stroke-linejoin:round}.tp-grlv_t{margin-top:-4px;transition:left .05s,top .05s;visibility:hidden}.tp-grlv_t.tp-grlv_t-a{visibility:visible}.tp-grlv_t.tp-grlv_t-in{transition:none}.tp-grlv.tp-v-disabled .tp-grlv_g{opacity:.5}.tp-grlv .tp-ttv{background-color:var(--mo-fg)}.tp-grlv .tp-ttv::before{border-top-color:var(--mo-fg)}.tp-lblv{align-items:center;display:flex;line-height:1.3;padding-left:var(--cnt-h-p);padding-right:var(--cnt-h-p)}.tp-lblv.tp-lblv-nol{display:block}.tp-lblv_l{color:var(--lbl-fg);flex:1;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;overflow:hidden;padding-left:4px;padding-right:16px}.tp-lblv.tp-v-disabled .tp-lblv_l{opacity:.5}.tp-lblv.tp-lblv-nol .tp-lblv_l{display:none}.tp-lblv_v{align-self:flex-start;flex-grow:0;flex-shrink:0;width:160px}.tp-lblv.tp-lblv-nol .tp-lblv_v{width:100%}.tp-lstv_s{padding:0 20px 0 4px;width:100%}.tp-lstv_m{color:var(--btn-fg)}.tp-sglv_i{padding:0 4px}.tp-sglv.tp-v-disabled .tp-sglv_i{opacity:.5}.tp-mllv_i{display:block;height:calc(var(--bld-us)*3);line-height:var(--bld-us);padding:0 4px;resize:none;white-space:pre}.tp-mllv.tp-v-disabled .tp-mllv_i{opacity:.5}.tp-p2dv{position:relative}.tp-p2dv_h{display:flex}.tp-p2dv_b{height:var(--bld-us);margin-right:4px;position:relative;width:var(--bld-us)}.tp-p2dv_b svg{display:block;height:16px;left:50%;margin-left:-8px;margin-top:-8px;position:absolute;top:50%;width:16px}.tp-p2dv_b svg path{stroke:currentColor;stroke-width:2}.tp-p2dv_b svg circle{fill:currentColor}.tp-p2dv_t{flex:1}.tp-p2dv_p{height:0;margin-top:0;opacity:0;overflow:hidden;transition:height .2s ease-in-out,opacity .2s linear,margin .2s ease-in-out}.tp-p2dv.tp-p2dv-expanded .tp-p2dv_p{margin-top:var(--bld-s);opacity:1}.tp-p2dv .tp-popv{left:calc(-1*var(--cnt-h-p));right:calc(-1*var(--cnt-h-p));top:var(--bld-us)}.tp-p2dpv{padding-left:calc(var(--bld-us) + 4px)}.tp-p2dpv_p{cursor:crosshair;height:0;overflow:hidden;padding-bottom:100%;position:relative}.tp-p2dpv_g{display:block;height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.tp-p2dpv_ax{opacity:.1;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_l{opacity:.5;stroke:var(--in-fg);stroke-dasharray:1}.tp-p2dpv_m{border:var(--in-fg) solid 1px;border-radius:50%;box-sizing:border-box;height:4px;margin-left:-2px;margin-top:-2px;position:absolute;width:4px}.tp-p2dpv_p:focus .tp-p2dpv_m{background-color:var(--in-fg);border-width:0}.tp-popv{background-color:var(--bs-bg);border-radius:6px;box-shadow:0 2px 4px var(--bs-sh);display:none;max-width:168px;padding:var(--cnt-v-p) var(--cnt-h-p);position:absolute;visibility:hidden;z-index:1000}.tp-popv.tp-popv-v{display:block;visibility:visible}.tp-sprv_r{background-color:var(--grv-fg);border-width:0;display:block;height:2px;margin:0;width:100%}.tp-sldv.tp-v-disabled{opacity:.5}.tp-sldv_t{box-sizing:border-box;cursor:pointer;height:var(--bld-us);margin:0 6px;outline:none;position:relative}.tp-sldv_t::before{background-color:var(--in-bg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin:auto;position:absolute;right:0;top:0}.tp-sldv_k{height:100%;left:0;position:absolute;top:0}.tp-sldv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";display:block;height:2px;left:0;margin-bottom:auto;margin-top:auto;position:absolute;right:0;top:0}.tp-sldv_k::after{background-color:var(--btn-bg);border-radius:var(--elm-br);bottom:0;content:"";display:block;height:12px;margin-bottom:auto;margin-top:auto;position:absolute;right:-6px;top:0;width:12px}.tp-sldv_t:hover .tp-sldv_k::after{background-color:var(--btn-bg-h)}.tp-sldv_t:focus .tp-sldv_k::after{background-color:var(--btn-bg-f)}.tp-sldv_t:active .tp-sldv_k::after{background-color:var(--btn-bg-a)}.tp-sldtxtv{display:flex}.tp-sldtxtv_s{flex:2}.tp-sldtxtv_t{flex:1;margin-left:4px}.tp-tabv.tp-v-disabled{opacity:.5}.tp-tabv_i{align-items:flex-end;display:flex;overflow:hidden}.tp-tabv.tp-tabv-nop .tp-tabv_i{height:calc(var(--bld-us) + 4px);position:relative}.tp-tabv.tp-tabv-nop .tp-tabv_i::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:0;position:absolute;right:0}.tp-tabv_c{border-left:var(--cnt-bg) solid 4px;padding-bottom:var(--cnt-v-p);padding-top:var(--cnt-v-p)}.tp-tbiv{flex:1;min-width:0;position:relative}.tp-tbiv+.tp-tbiv{margin-left:2px}.tp-tbiv+.tp-tbiv::before{background-color:var(--cnt-bg);bottom:0;content:"";height:2px;left:-2px;position:absolute;width:2px}.tp-tbiv_b{background-color:var(--cnt-bg);display:block;padding-left:calc(var(--cnt-h-p) + 4px);padding-right:calc(var(--cnt-h-p) + 4px);width:100%}.tp-tbiv_b:hover{background-color:var(--cnt-bg-h)}.tp-tbiv_b:focus{background-color:var(--cnt-bg-f)}.tp-tbiv_b:active{background-color:var(--cnt-bg-a)}.tp-tbiv_b:disabled{opacity:.5}.tp-tbiv_t{color:var(--cnt-fg);height:calc(var(--bld-us) + 4px);line-height:calc(var(--bld-us) + 4px);opacity:.5;overflow:hidden;text-overflow:ellipsis}.tp-tbiv.tp-tbiv-sel .tp-tbiv_t{opacity:1}.tp-txtv{position:relative}.tp-txtv_i{padding:0 4px}.tp-txtv.tp-txtv-fst .tp-txtv_i{border-bottom-right-radius:0;border-top-right-radius:0}.tp-txtv.tp-txtv-mid .tp-txtv_i{border-radius:0}.tp-txtv.tp-txtv-lst .tp-txtv_i{border-bottom-left-radius:0;border-top-left-radius:0}.tp-txtv.tp-txtv-num .tp-txtv_i{text-align:right}.tp-txtv.tp-txtv-drg .tp-txtv_i{opacity:.3}.tp-txtv_k{cursor:pointer;height:100%;left:-3px;position:absolute;top:0;width:12px}.tp-txtv_k::before{background-color:var(--in-fg);border-radius:1px;bottom:0;content:"";height:calc(var(--bld-us) - 4px);left:50%;margin-bottom:auto;margin-left:-1px;margin-top:auto;opacity:.1;position:absolute;top:0;transition:border-radius .1s,height .1s,transform .1s,width .1s;width:2px}.tp-txtv_k:hover::before,.tp-txtv.tp-txtv-drg .tp-txtv_k::before{opacity:1}.tp-txtv.tp-txtv-drg .tp-txtv_k::before{border-radius:50%;height:4px;transform:translateX(-1px);width:4px}.tp-txtv_g{bottom:0;display:block;height:8px;left:50%;margin:auto;overflow:visible;pointer-events:none;position:absolute;top:0;visibility:hidden;width:100%}.tp-txtv.tp-txtv-drg .tp-txtv_g{visibility:visible}.tp-txtv_gb{fill:none;stroke:var(--in-fg);stroke-dasharray:1}.tp-txtv_gh{fill:none;stroke:var(--in-fg)}.tp-txtv .tp-ttv{margin-left:6px;visibility:hidden}.tp-txtv.tp-txtv-drg .tp-ttv{visibility:visible}.tp-ttv{background-color:var(--in-fg);border-radius:var(--elm-br);color:var(--bs-bg);padding:2px 4px;pointer-events:none;position:absolute;transform:translate(-50%, -100%)}.tp-ttv::before{border-color:var(--in-fg) transparent transparent transparent;border-style:solid;border-width:2px;box-sizing:border-box;content:"";font-size:.9em;height:4px;left:50%;margin-left:-2px;position:absolute;top:100%;width:4px}.tp-rotv{background-color:var(--bs-bg);border-radius:var(--bs-br);box-shadow:0 2px 4px var(--bs-sh);font-family:var(--font-family);font-size:11px;font-weight:500;line-height:1;text-align:left}.tp-rotv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br);border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br);padding-left:calc(4px + var(--bld-us) + var(--cnt-h-p));text-align:center}.tp-rotv.tp-rotv-expanded .tp-rotv_b{border-bottom-left-radius:0;border-bottom-right-radius:0}.tp-rotv.tp-rotv-not .tp-rotv_b{display:none}.tp-rotv_c>.tp-fldv.tp-v-lst>.tp-fldv_c,.tp-rotv_c>.tp-tabv.tp-v-lst>.tp-tabv_c{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c>.tp-fldv.tp-v-lst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-left-radius:var(--bs-br);border-bottom-right-radius:var(--bs-br)}.tp-rotv_c .tp-fldv.tp-v-vlst:not(.tp-fldv-expanded)>.tp-fldv_b{border-bottom-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-fldv.tp-v-fst>.tp-fldv_b{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst{margin-top:calc(-1*var(--cnt-v-p))}.tp-rotv.tp-rotv-not .tp-rotv_c>.tp-tabv.tp-v-fst>.tp-tabv_i{border-top-left-radius:var(--bs-br);border-top-right-radius:var(--bs-br)}.tp-rotv.tp-v-disabled,.tp-rotv .tp-v-disabled{pointer-events:none}.tp-rotv.tp-v-hidden,.tp-rotv .tp-v-hidden{display:none}'),this.pool_.getAll().forEach(c=>{this.embedPluginStyle_(c)}),this.registerPlugin({plugins:[Qg,gp,Ii,qu]})}}const e0=new n("3.0.8");t.BladeApi=r,t.ButtonApi=S,t.FolderApi=Hs,t.InputBindingApi=ct,t.ListApi=ec,t.MonitorBindingApi=Ct,t.Pane=yp,t.SeparatorApi=Nt,t.SliderApi=Wa,t.TabApi=Gs,t.TabPageApi=zr,t.TextApi=xs,t.TpChangeEvent=o,t.VERSION=e0,Object.defineProperty(t,"__esModule",{value:!0})})})(G_,G_.exports);var Dd,wr,rE,Cm=0,HC=[],sE=At.__b,oE=At.__r,aE=At.diffed,lE=At.__c,cE=At.unmount;function Ov(i,e){At.__h&&At.__h(wr,i,Cm||e),Cm=0;var t=wr.__H||(wr.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Sr(i){return Cm=1,i8(GC,i)}function i8(i,e,t){var n=Ov(Dd++,2);return n.t=i,n.__c||(n.__=[t?t(e):GC(void 0,e),function(r){var s=n.t(n.__[0],r);n.__[0]!==s&&(n.__=[s,n.__[1]],n.__c.setState({}))}],n.__c=wr),n.__}function wo(i,e){var t=Ov(Dd++,3);!At.__s&&Mb(t.__H,e)&&(t.__=i,t.__H=e,wr.__H.__h.push(t))}function Sb(i,e){var t=Ov(Dd++,4);!At.__s&&Mb(t.__H,e)&&(t.__=i,t.__H=e,wr.__h.push(t))}function nd(i){return Cm=5,kv(function(){return{current:i}},[])}function kv(i,e){var t=Ov(Dd++,7);return Mb(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function r8(){for(var i;i=HC.shift();)if(i.__P)try{i.__H.__h.forEach(Yf),i.__H.__h.forEach(W_),i.__H.__h=[]}catch(e){i.__H.__h=[],At.__e(e,i.__v)}}At.__b=function(i){wr=null,sE&&sE(i)},At.__r=function(i){oE&&oE(i),Dd=0;var e=(wr=i.__c).__H;e&&(e.__h.forEach(Yf),e.__h.forEach(W_),e.__h=[])},At.diffed=function(i){aE&&aE(i);var e=i.__c;e&&e.__H&&e.__H.__h.length&&(HC.push(e)!==1&&rE===At.requestAnimationFrame||((rE=At.requestAnimationFrame)||function(t){var n,r=function(){clearTimeout(s),uE&&cancelAnimationFrame(n),setTimeout(t)},s=setTimeout(r,100);uE&&(n=requestAnimationFrame(r))})(r8)),wr=null},At.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Yf),t.__h=t.__h.filter(function(n){return!n.__||W_(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],At.__e(n,t.__v)}}),lE&&lE(i,e)},At.unmount=function(i){cE&&cE(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Yf(n)}catch(r){e=r}}),e&&At.__e(e,t.__v))};var uE=typeof requestAnimationFrame=="function";function Yf(i){var e=wr,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),wr=e}function W_(i){var e=wr;i.__c=i.__(),wr=e}function Mb(i,e){return!i||i.length!==e.length||e.some(function(t,n){return t!==i[n]})}function GC(i,e){return typeof e=="function"?e(i):e}function Eb(){return(Eb=Object.assign||function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i}).apply(this,arguments)}function s8(i){this.getChildContext=function(){return i.context};var e=i.children,t=function(n,r){if(n==null)return{};var s,o,l={},h=Object.keys(n);for(o=0;o<h.length;o++)r.indexOf(s=h[o])>=0||(l[s]=n[s]);return l}(i,["context","children"]);return VC(e,t)}function o8(){var i=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(i),this._vdom=Bc(s8,Eb({},this._props,{context:i.detail.context}),function e(t,n){if(t.nodeType===3)return t.data;if(t.nodeType!==1)return null;var r=[],s={},o=0,l=t.attributes,h=t.childNodes;for(o=l.length;o--;)l[o].name!=="slot"&&(s[l[o].name]=l[o].value,s[WC(l[o].name)]=l[o].value);for(o=h.length;o--;){var d=e(h[o],null),f=h[o].slot;f?s[f]=Bc(hE,{name:f},d):r[o]=d}var g=n?Bc(hE,null,r):r;return Bc(n||t.nodeName.toLowerCase(),s,g)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?FC:Iv)(this._vdom,this._root)}function WC(i){return i.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():""})}function a8(i,e,t){if(this._vdom){var n={};n[i]=t=t??void 0,n[WC(i)]=t,this._vdom=VC(this._vdom,n),Iv(this._vdom,this._root)}}function l8(){Iv(this._vdom=null,this._root)}function hE(i,e){var t=this;return Bc("slot",Eb({},i,{ref:function(n){n?(t.ref=n,t._listener||(t._listener=function(r){r.stopPropagation(),r.detail.context=e},n.addEventListener("_preact",t._listener))):t.ref.removeEventListener("_preact",t._listener)}}))}function Nv(i,e,t,n){function r(){var s=Reflect.construct(HTMLElement,[],r);return s._vdomComponent=i,s._root=n&&n.shadow?s.attachShadow({mode:"open"}):s,s}return(r.prototype=Object.create(HTMLElement.prototype)).constructor=r,r.prototype.connectedCallback=o8,r.prototype.attributeChangedCallback=a8,r.prototype.disconnectedCallback=l8,t=t||i.observedAttributes||Object.keys(i.propTypes||{}),r.observedAttributes=t,t.forEach(function(s){Object.defineProperty(r.prototype,s,{get:function(){return this._vdom.props[s]},set:function(o){this._vdom?this.attributeChangedCallback(s,null,o):(this._props||(this._props={}),this._props[s]=o,this.connectedCallback());var l=typeof o;o!=null&&l!=="string"&&l!=="boolean"&&l!=="number"||this.setAttribute(s,o)}})}),customElements.define(e||i.tagName||i.displayName||i.name,r)}var as=(i,e)=>()=>{const[n,r]=Sr(()=>e());return wo(()=>{const s=e(r);return()=>{s.cancel()}},[]),[n,i]};const[Bv,c8]=Ge(void 0);vi(()=>Bv(void 0));const[jC,u8]=Ge(void 0),[Tb,h8]=Ge(!1),zv=as(jh,vi),Ab=as(ev,Os),d8=as(eb,tb),XC=as(hl,Ze),p8=as(QU,gl),f8=as($U,R_),m8=as(aT,qc),v8=as(lT,um),qC=as(Bv,c8),YC=as(jC,u8),g8=as(Tb,h8);var ZC=()=>{if(So())return;const i=vi(),e=Os();i==null||i.dispose();for(const t of e)t.dispose();Di()};const ca=i=>typeof i=="number"?Number(i.toFixed(2)):i;let Pm=!1;const dE=Mr(()=>Pm=!1,100,"trailing"),ua=(i,e,t,n=Me({},t),r)=>{const s=i.addFolder({title:e});for(const[o,l]of Object.entries(n))switch(typeof l){case"undefined":n[o]="";break;case"number":n[o]=ca(l);break;case"object":if(Array.isArray(l)){n[o]=JSON.stringify(l);break}typeof(l==null?void 0:l.x)=="number"&&(l.x=ca(l.x)),typeof(l==null?void 0:l.y)=="number"&&(l.y=ca(l.y)),typeof(l==null?void 0:l.z)=="number"&&(l.z=ca(l.z));break}return Object.fromEntries(Object.keys(n).map(o=>{const l=s.addInput(n,o);return l.on("change",({value:h})=>{if(!Pm){if(r!=null&&r[o]){const[d,f,g]=r[o],{x:y,y:_,z:w}=h;t[d]=ca(y),t[f]=ca(_),t[g]=ca(w);return}if(typeof h=="string"){if(h==="true"||h==="false"){t[o]=h==="true";return}const d=parseFloat(h);if(!Number.isNaN(d)){t[o]=d;return}}t[o]=ca(h)}}),[o,l]}))},y8=({mouse:i,keyboard:e})=>{const t=nd(null);wo(()=>(JS(i!=="enabled"),YM(e!=="enabled"),()=>{YM(!0),JS(!0)}),[i,e]);const[n,r]=Sr({});wo(()=>{const C=Ze(),A=()=>{hl(bn),o_(!0),QS(!0),a_(!0),r({})};A();const D=XV(A),I=k=>{k.key!=="Shift"&&k.key!=="Meta"&&k.key!=="Control"||My(!0)},F=k=>{k.key!=="Shift"&&k.key!=="Meta"&&k.key!=="Control"||My(!1)};document.addEventListener("keydown",I),document.addEventListener("keyup",F);const P=yv(()=>My(!1));return()=>{hl(C),o_(!1),QS(!1),a_(!1),document.removeEventListener("keydown",I),document.removeEventListener("keyup",F),D.cancel(),P.cancel()}},[]);const[s]=zv(),[o]=Ab(),[l]=d8(),[h]=XC(),[d,f]=Sr(),[g,y]=Sr();Sb(()=>{var C;if(!d||!g)return;const A=l.reduce((P,k,j)=>(P["camera "+j]=j,P),{}),D=d.addInput({camera:l.indexOf(Ze())},"camera",{options:A});g.add(D),D.on("change",({value:P})=>hl(l[P]));const I=Me({none:0},rs.exports.omit(A,"camera 0")),F=d.addInput({"secondary camera":l.indexOf((C=Qc())!==null&&C!==void 0?C:bn)},"secondary camera",{options:I});return g.add(F),F.on("change",({value:P})=>eU(P===0?void 0:l[P])),()=>{D.dispose(),F.dispose()}},[d,g,l,h]);const[_,w]=m8(),S=!!_,[b,T]=v8(),E=!!b;return wo(()=>{const C=t.current;if(!C)return;const A=new G_.exports.Pane({container:C});if(f(A),y(A.addFolder({title:"camera"})),!s){const G=["defaultFog","defaultLight","defaultLightScale"],{defaultLightEnabled:ne,defaultFogEnabled:ce}=ua(A,"settings",Cs,Object.assign(Me(bt(Me({defaultLightEnabled:S},S&&{defaultLight:_,defaultLightScale:Cs.defaultLightScale}),{defaultFogEnabled:E}),E&&{defaultFog:b}),rs.exports.omit(Cs,[...SC,...G])));return ne.on("change",({value:Z})=>w(Z?"default":!1)),ce.on("change",({value:Z})=>T(Z?"white":void 0)),()=>{A.dispose()}}const D=G=>{if(G.key==="Backspace"){G.preventDefault(),ZC();return}if(G.key.toLocaleLowerCase()!=="c")return;const ne=vi();if(ne){if(G.metaKey||G.ctrlKey){const[ce]=AC(Dv(ne));if(!ne.parent||!ce)return;ne.parent.attach(ce),Di(ce);return}ml(ne)&&dA(ne)}};document.addEventListener("keydown",D);const I=s,F=new En,P=G=>({x:I[G+"X"],y:I[G+"Y"],z:I[G+"Z"]}),k=(G,ne,ce)=>({x:I[G],y:I[ne],z:I[ce]}),j=G=>[G+"X",G+"Y",G+"Z"];if(!o.length){const{name:G}=ua(A,"general",I,{name:I.name,id:I.id});G.on("change",()=>wh())}if(s instanceof Sa){const G={scale:I.scale,"scale xyz":P("scale"),position:k("x","y","z"),rotation:P("rotation")};ua(A,"transform",I,G,{"scale xyz":j("scale"),position:["x","y","z"],rotation:j("rotation")}),F.watch(P_(()=>{Pm=!0,dE(),Object.assign(G,{"scale xyz":P("scale"),position:k("x","y","z"),rotation:P("rotation")}),A.refresh()}))}else if(ml(s)){const G={position:k("x","y","z")};ua(A,"transform",I,G,{position:["x","y","z"]}),F.watch(P_(()=>{Pm=!0,dE(),Object.assign(G,{position:k("x","y","z")}),A.refresh()}))}if(s instanceof To&&ua(A,"inner transform",I,{size:k("width","height","depth"),"inner position":P("inner"),"inner rotation":P("innerRotation")},{size:["width","height","depth"],"inner position":j("inner"),"inner rotation":j("innerRotation")}),!o.length){s instanceof Sa&&ua(A,"display",I,{bloom:I.bloom,reflection:I.reflection,outline:I.outline,visible:I.visible,innerVisible:I.innerVisible,frustumCulled:I.frustumCulled,metalnessFactor:I.metalnessFactor,roughnessFactor:I.roughnessFactor,opacityFactor:I.opacityFactor,toon:I.toon,pbr:I.pbr});const{schema:G,componentName:ne}=I.constructor,ce={};for(const[Z,$]of Object.entries(G)){if(Z in Tl||$===Function)continue;let K=I[Z];K===1/0?K=9999:K===-1/0?K=-9999:Array.isArray(K)&&(K=JSON.stringify(K)),ce[Z]=K}if(G===mb){ce.stride={x:0,y:0};const{stride:Z}=ua(A,ne,I,ce);Z.on("change",({value:$})=>{Object.assign(ce,{strideForward:-$.y,strideRight:$.x}),A.refresh()})}else ua(A,ne,I,ce)}return()=>{F.cancel(),A.dispose(),document.removeEventListener("keydown",D)}},[s,o,n,E,S]),ye("div",{ref:t,onKeyDown:C=>C.stopPropagation(),onKeyUp:C=>C.stopPropagation(),className:"lingo3d-ui",style:{width:300,height:"100%",background:"rgb(40, 41, 46)"}})};Nv(y8,"lingo3d-editor",["mouse","keyboard"]);const _8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 1024 1024",style:{margin:2,opacity:.25,flexShrink:0},children:ye("path",{fill:"#fff",d:"M838.4 325.12L554.24 479.36C528 493.44 512 521.6 512 552.96V851.2c0 32 31.36 53.12 57.6 38.4l284.16-154.24c25.6-14.08 42.24-42.24 42.24-73.6v-297.6c0-32.64-31.36-53.12-57.6-39.04zm-432.64 153.6L121.6 325.12c-26.24-14.08-57.6 6.4-57.6 38.4v299.52c0 31.36 16 59.52 42.24 73.6l284.16 153.6c26.24 14.08 57.6-7.04 57.6-39.04V552.32c0-31.36-16-59.52-42.24-73.6zm406.4-223.36c13.44-7.04 19.84-19.2 18.56-30.72 1.28-12.16-5.12-23.68-18.56-30.72L522.88 42.88c-12.8-7.04-28.16-10.24-43.52-10.24-15.36 0-30.72 3.2-43.52 10.24l-289.28 150.4c-13.44 7.04-19.2 19.2-18.56 30.72-.64 12.16 5.12 24.32 18.56 31.36l289.28 150.4C448.64 412.8 464 416 479.36 416c15.36 0 30.72-3.2 43.52-10.24l289.28-150.4z"})}),KC=({style:i,onClick:e})=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 1024 1024",style:Me({margin:2,flexShrink:0},i),onMouseDown:t=>t.stopPropagation(),onClick:t=>(t.stopPropagation(),e==null?void 0:e()),children:ye("path",{fill:"#fff",d:"M928.1 928.2H98v-830h830.1v830zm-104.8-415c0-24.6-19.9-44.5-44.5-44.5H556.5V246.4c0-24.6-19.9-44.5-44.5-44.5s-44.5 19.9-44.5 44.5v222.3H245.2c-24.6 0-44.5 19.9-44.5 44.5s19.9 44.5 44.5 44.5h222.3V780c0 24.6 19.9 44.5 44.5 44.5s44.5-19.9 44.5-44.5V557.7h222.3c24.6 0 44.5-20 44.5-44.5z"})}),JC=({style:i,onClick:e})=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 1024 1024",style:Me({margin:2,flexShrink:0},i),onMouseDown:t=>t.stopPropagation(),onClick:t=>(t.stopPropagation(),e==null?void 0:e()),children:ye("path",{fill:"#fff",d:"M752 240H144c-17.7 0-32 14.3-32 32v608c0 17.7 14.3 32 32 32h608c17.7 0 32-14.3 32-32V272c0-17.7-14.3-32-32-32zM596 606c0 4.4-3.6 8-8 8H308c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h280c4.4 0 8 3.6 8 8v48zm284-494H264c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h576v576c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32z"})});var QC=()=>ye("path",{fill:"#fff",d:"M914.5 653.5c-5.5 0-11 1.1-16 3.3l-.2.1h-.2L510.2 822.2 122.2 657h-.2l-.2-.1c-5-2.1-10.3-3.3-16-3.3-23.1 0-41.8 19.3-41.8 43.1 0 18 10.7 33.3 25.8 39.8l403.9 172.1.4.1c10.2 4.4 21.8 4.4 32 0l.2-.1c.1 0 .1-.1.2-.1l403.9-172.1c15.1-6.5 25.8-21.8 25.8-39.8.1-23.8-18.6-43.1-41.7-43.1zm0-186.5c-7.9-.2-16 3.2-16 3.2L510.2 635.6 121.8 470.2s-10.3-3.2-16-3.2C82.7 467 64 486.2 64 510c0 17.9 10.7 33.3 25.8 39.7l403.9 172c.1 0 .1.1.2.1l.1.1c5 2.1 10.3 3.3 16 3.3 5.7 0 11.1-1.2 16-3.3l.2-.1c.1 0 .1 0 .2-.1l403.9-172c15.1-6.4 25.8-21.8 25.9-39.7.1-23.8-18.6-43-41.7-43zM89.8 363.2l403.9 172.1c.1 0 .1 0 .2.1l.1.1c5 2.1 10.3 3.2 16 3.2 5.5 0 10.9-1.1 16-3.2l.2-.1.2-.1 403.9-172c15.1-6.5 25.8-21.8 25.9-39.7 0-18-10.7-33.3-25.8-39.8L526.5 111.6c-.1 0-.1 0-.2-.1l-.2-.1c-10.2-4.4-21.8-4.4-32 0l-.1.1L89.8 283.7C74.7 290.1 64 305.5 64 323.5c0 17.9 10.7 33.2 25.8 39.7z"});const x8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 1024 1024",style:{margin:2,opacity:.25,flexShrink:0},children:ye(QC,{})});document.addEventListener("mouseup",()=>Tb(!1));const $C=({appendable:i,object3d:e,level:t})=>{const n={opacity:e.children.length?.5:.05,cursor:"pointer"},[r,s]=Sr(!1),[o]=qC(),{setClickEl:l,handleClick:h,handleDoubleClick:d}=t3(e,i),[f,g]=YC();wo(()=>{f&&f.has(e)&&s(!0)},[f]);const y=nd(null),_=nd(null),w=o===e,S=kv(()=>{if(!w||!y.current||!_.current)return;const b=y.current.getBoundingClientRect();return _.current.getBoundingClientRect().right-b.left+4},[w,r]);return ye("div",{ref:l,onClick:h,onDblClick:d,onMouseDown:()=>Tb(!0),style:{color:"rgba(255, 255, 255, 0.75)",marginLeft:8,borderLeft:"1px solid rgba(255, 255, 255, 0.05)"},children:[ye("div",{ref:y,style:{display:"flex",alignItems:"center",border:w?"1px solid rgba(255, 255, 255, 0.5)":void 0,width:S,minWidth:"100%",cursor:"default"},children:[r?ye(JC,{style:n,onClick:()=>(s(!1),g(void 0))}):ye(KC,{style:n,onClick:()=>s(!0)}),ye(x8,{}),ye("div",{ref:_,children:e.name})]}),r&&e.children.map(b=>ye($C,{object3d:b,appendable:i,level:t+1},b.uuid))]})},e3=({appendable:i,level:e})=>{const[t,n]=Sr(),{loadedResolvable:r}=i;return wo(()=>{n(void 0);const s=r.then(()=>n(i.loadedGroup.children[0]));return()=>{s.cancel()}},[r]),ye(Cb,{appendable:i,level:e,children:t&&ye($C,{appendable:i,level:e+1,object3d:t})})};var b8=i=>{const[e,t]=Sr(null);return wo(()=>{if(!e)return;let n=0,r=0,s=0;const o=h=>{n=Date.now(),r=h.clientX,s=h.clientY},l=h=>{const d=Date.now(),f=d-n,g=Math.abs(h.clientX-r),y=Math.abs(h.clientY-s);n=d,r=h.clientX,s=h.clientY,f<300&&g<5&&y<5&&i(h)};return e.addEventListener("mousedown",o),e.addEventListener("mouseup",l),()=>{e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",l)}},[e]),t};const t3=(i,e)=>({setClickEl:b8(s=>{s.stopPropagation(),hl(bn),ml(e)&&vi()!==e&&Di(e),i instanceof $t?queueMicrotask(()=>Bv(i)):Di(i)}),handleClick:s=>s.stopPropagation(),handleDoubleClick:s=>{s.stopPropagation(),ml(i)&&(dA(i),Di(i))}}),Hi=[void 0],Cb=({appendable:i,level:e,children:t})=>{const n=i.name||rs.exports.upperFirst(i.constructor.componentName),r=i.children?[...i.children]:void 0,s={opacity:r!=null&&r.length||t?.5:.05,cursor:"pointer"},[o,l]=Sr(!1),[h,d]=Sr(!1),[f]=zv(),[g]=Ab(),y=f===i||g.includes(i),{setClickEl:_,handleClick:w,handleDoubleClick:S}=t3(i),[b,T]=YC();wo(()=>{b&&b.has(i.outerObject3d)&&d(!0)},[b]);const E=nd(null),C=nd(null),A=kv(()=>{if(!y||!E.current||!C.current)return;const I=E.current.getBoundingClientRect();return C.current.getBoundingClientRect().right-I.left+4},[y,h]),[D]=g8();return ye("div",{ref:_,onClick:w,onDblClick:S,draggable:!D,onDragStart:I=>(I.stopPropagation(),Hi[0]=i),onDragEnd:I=>(I.stopPropagation(),Hi[0]=void 0),onDragOver:I=>{I.stopPropagation(),I.preventDefault(),!(!Hi[0]||Hi[0]===i)&&l(!0)},onDragEnter:I=>{I.stopPropagation(),I.preventDefault(),!(!Hi[0]||Hi[0]===i)&&l(!0)},onDragLeave:I=>{I.stopPropagation(),!(!Hi[0]||Hi[0]===i)&&l(!1)},onDrop:I=>{I.stopPropagation(),!(!Hi[0]||Hi[0]===i)&&(l(!1),i.attach(Hi[0]))},style:{color:"rgba(255, 255, 255, 0.75)",marginLeft:8,borderLeft:"1px solid rgba(255, 255, 255, 0.05)",background:o?"rgba(255, 255, 255, 0.5)":"none"},children:[ye("div",{ref:E,style:{display:"flex",alignItems:"center",backgroundColor:y?"rgba(255, 255, 255, 0.1)":void 0,width:A,minWidth:"100%",cursor:"default"},children:[h?ye(JC,{style:s,onClick:()=>(d(!1),T(void 0))}):ye(KC,{style:s,onClick:()=>d(!0)}),ye(_8,{}),ye("div",{ref:C,children:n})]}),h&&(r==null?void 0:r.map(I=>I instanceof Ao?ye(e3,{appendable:I,level:e+1}):ye(Cb,{appendable:I,level:e+1},I.uuid))),h&&t]})},w8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M640 384h224a32 32 0 0132 32v384h-96v96H416a32 32 0 01-32-32V640H160a32 32 0 01-32-32V224h96v-96h384a32 32 0 0132 32v224zm0 32v192a32 32 0 01-32 32H416v224h352v-96h96V416H640zM96 96h96v96H96V96zm736 0h96v96h-96V96zM96 832h96v96H96v-96zm736 0h96v96h-96v-96z"})}),S8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M630.09 151.91V62.16H361.84v89.74H93.6v134.62h89.41v673.11h625.93v-673.1h89.42V151.91H630.09zM361.84 869.89h-89.43V286.53h89.43v583.36zm178.84 0h-89.43V286.53h89.43v583.36zm178.84 0h-89.43V286.53h89.43v583.36z"})}),Dy=({children:i,onClick:e,active:t})=>ye("div",{onClick:t?e:void 0,style:{width:24,height:24,display:"flex",justifyContent:"center",alignItems:"center",marginRight:2,opacity:t?1:.1,cursor:t?"pointer":"default"},children:i}),M8=()=>{const[i,e]=Sr(!1);return ye("div",{onDragOver:t=>{t.stopPropagation(),t.preventDefault(),Hi[0]&&e(!0)},onDragEnter:t=>{t.stopPropagation(),t.preventDefault(),Hi[0]&&e(!0)},onDragLeave:t=>{t.stopPropagation(),Hi[0]&&e(!1)},onDrop:t=>{var n,r;t.stopPropagation(),e(!1);const s=Hi[0];s&&(wh(),Li.add(s),$e.attach(s.outerObject3d),(r=(n=s.parent)===null||n===void 0?void 0:n.children)===null||r===void 0||r.delete(s),s.parent=void 0)},style:{background:i?"rgba(255, 255, 255, 0.5)":"none",width:"100%",height:18}})},E8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 1024 1024",children:ye(QC,{})}),n3=(i,e)=>{var t,n,r;e.add(i);const s=(r=(n=(t=i.userData.manager)===null||t===void 0?void 0:t.parent)===null||n===void 0?void 0:n.outerObject3d)!==null&&r!==void 0?r:i.parent;s&&n3(s,e)},T8=i=>{const e=vi();if(!(e instanceof Ao))return;const t=i.toLowerCase();let n;if(e.loadedGroup.traverse(s=>{n||s.name.toLowerCase().includes(t)&&(n=s)}),!n)return;const r=new Set;n3(n,r),jC(r),Bv(n)},A8=()=>{const[i,e]=Sr(void 0),[t,n]=Sr(!1);return wo(()=>{let[r,s]=[0,0];const o=h=>[r,s]=[h.clientX,h.clientY];document.addEventListener("mousemove",o);const l=vd(({target:h,rightClick:d})=>{d&&h&&e({x:r,y:s,target:h})});return()=>{l.cancel(),document.removeEventListener("mousemove",o)}},[]),i?ye("div",{className:"lingo3d-ui",onMouseDown:()=>e(void 0),style:{zIndex:9999,position:"absolute",left:0,top:0,width:"100%",height:"100%",overflow:"hidden"},children:ye("div",{onMouseDown:r=>r.stopPropagation(),style:{position:"absolute",left:i.x,top:i.y,background:"rgb(40, 41, 46)",padding:6},children:t?ye("input",{ref:r=>r==null?void 0:r.focus(),style:{all:"unset",padding:6},onKeyDown:r=>{r.stopPropagation(),!(r.key!=="Enter"&&r.key!=="Escape")&&(r.key==="Enter"&&T8(r.target.value),n(!1),e(void 0))}}):ye("div",{style:{padding:6,whiteSpace:"nowrap"},onClick:()=>n(!0),children:"Search children"})})}):null},C8=()=>{const[i,e]=Sr({});Sb(()=>{const h=tv(()=>e({}));return()=>{h.cancel()}},[]);const t=kv(()=>[...Li].filter(h=>!X2.has(h)),[i]),[n]=Ab(),[r]=zv(),[s]=qC(),[o]=XC(),l=()=>{s!=null&&s.name&&r instanceof To&&setTimeout(()=>Di(r.find(s.name)))};return ye(vu,{children:[ye("div",{className:"lingo3d-ui",onClick:()=>Di(),style:{width:200,height:"100%",background:"rgb(40, 41, 46)",padding:4,paddingTop:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[ye("div",{style:{height:24,borderBottom:"1px solid rgb(255,255,255,0.1)",opacity:o===bn?.5:.25,display:"flex",alignItems:"center",paddingLeft:12},children:[ye("div",{children:"scenegraph"}),ye("div",{style:{flexGrow:1}}),ye(Dy,{active:!!s,onClick:l,children:ye(E8,{})}),ye(Dy,{active:!!n.length,onClick:PV,children:ye(w8,{})}),ye(Dy,{active:!!r,onClick:ZC,children:ye(S8,{})})]}),ye("div",{style:{overflow:"scroll",opacity:o===bn?1:.5},className:"lingo3d-ui",children:[t.map(h=>h instanceof Ao?ye(e3,{appendable:h,level:0}):ye(Cb,{appendable:h,level:0},h.uuid)),ye(M8,{})]})]}),ye(A8,{})]})};Nv(C8,"lingo3d-scenegraph");const P8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M960 480L768 320v128H512V192h128L480 0 320 192h128v256H192V320L0 480l192 160V512h256v256H320l160 192 160-192H512V512h256v128l192-160z"})}),R8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M929 849a30 30 0 01-30-30v-83.137a447.514 447.514 0 01-70.921 92.209C722.935 933.225 578.442 975.008 442 953.482a444.917 444.917 0 01-241.139-120.591 30 30 0 1137.258-47.01l.231-.231A385.175 385.175 0 00442 892.625v-.006c120.855 22.123 250.206-13.519 343.656-106.975a386.646 386.646 0 0070.6-96.653h-87.247a30 30 0 010-60H929a30 30 0 0130 30V819a30 30 0 01-30 30zM512 392a120 120 0 11-120 120 120 120 0 01120-120zm293.005-147.025a29.87 29.87 0 01-19.117-6.882l-.232.231A386.5 386.5 0 00689.478 168h-.011c-145.646-75.182-329.021-51.747-451.117 70.35a386.615 386.615 0 00-70.6 96.65H255a30 30 0 010 60H95a30 30 0 01-30-30V205a30 30 0 0160 0v83.129a447.534 447.534 0 0170.923-92.206C317.981 73.866 493.048 37.2 647 85.836v-.045a444.883 444.883 0 01176.143 105.291 30 30 0 01-18.138 53.893z"})}),L8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M609.52 584.92a35.309 35.309 0 0124.98-10.36c9.37 0 18.36 3.73 24.98 10.36l189.29 189.22-.07-114.3.57-6.35c3.25-17.98 19.7-30.5 37.9-28.85 18.2 1.65 32.12 16.92 32.09 35.2v200.23c-.05 1.49-.19 2.97-.42 4.45l-.21 1.13c-.22 1.44-.55 2.85-.99 4.24l-.57 1.62-.56 1.41a34.163 34.163 0 01-7.62 11.36l2.12-2.4-.14.14-.92 1.06-1.06 1.2-.57.57-.56.57a36.378 36.378 0 01-16.23 8.39l-3.53.5-4.02.35h-199.6l-6.35-.63c-16.73-3.06-28.9-17.63-28.93-34.64l.56-6.35c3.07-16.76 17.67-28.93 34.71-28.92l114.29-.14-189.07-189.1-4.09-4.94c-9.71-14.01-8.01-32.95 4.02-45.02zm-162.06 0c12.06 12.05 13.78 30.99 4.09 45.01l-4.09 4.94-189.15 189.08 114.3.14c17.04-.01 31.65 12.17 34.71 28.92l.57 6.35c-.03 17.01-12.19 31.58-28.92 34.64l-6.35.63H173.09l-4.23-.42-3.39-.49a36.38 36.38 0 01-17.36-9.52l-1.06-1.13-.98-1.13.98 1.06-1.97-2.26.85 1.06-.42-.56a35.137 35.137 0 01-3.74-5.64l-1.13-2.68a34.71 34.71 0 01-2.11-7.33l-.28-1.13c-.21-1.47-.33-2.96-.36-4.45V659.78c-.03-18.28 13.89-33.55 32.09-35.2 18.2-1.65 34.65 10.87 37.9 28.85l.57 6.35-.07 114.36 189.29-189.22c13.77-13.77 36.11-13.77 49.88 0h-.09zm-74.71-471.71l6.35.57c16.76 3.06 28.93 17.67 28.92 34.71l-.63 6.35c-3.07 16.76-17.67 28.93-34.71 28.92l-114.3.14 189.15 189.08 4.09 4.94c10.26 15.02 7.42 35.37-6.55 47.01-13.98 11.63-34.51 10.74-47.42-2.07L208.29 233.71l.07 114.3-.57 6.35c-3.25 17.98-19.7 30.5-37.9 28.85-18.2-1.65-32.12-16.92-32.09-35.2V147.78c0-1.55.14-3.03.35-4.51l.21-1.13c.24-1.44.59-2.85 1.06-4.23a34.97 34.97 0 018.68-14.39l-2.12 2.4-.42.57 1.55-1.84-.99 1.06.92-.98 2.26-2.33c3.04-2.73 6.52-4.92 10.3-6.49l2.82-1.06c3.45-1.07 7.04-1.62 10.65-1.62l-3.6.14h.49l1.48-.14h201.31zm512.91 0l1.41.14h.42c2.43.29 4.84.79 7.19 1.48l2.82 1.06 2.61 1.2 3.04 1.76c2.09 1.33 4.03 2.89 5.78 4.66l1.13 1.2.78.98.21.14.49.64 2.33 3.17c2.35 3.83 3.98 8.07 4.8 12.49l.21 1.13c.21 1.48.35 2.96.35 4.44v200.37c-.16 18.13-14.03 33.19-32.08 34.83-18.06 1.64-34.42-10.67-37.83-28.48l-.57-6.35V233.65L659.54 422.87c-12.9 12.95-33.56 13.91-47.59 2.2-14.04-11.71-16.81-32.2-6.38-47.22l4.02-4.86 189.22-189.08-114.29-.14c-17.06.04-31.71-12.14-34.78-28.92l-.63-6.35c-.01-17.04 12.16-31.65 28.93-34.71l6.35-.57h201.27zm0 0"})}),D8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:[ye("path",{fill:"#fff",d:"M96 892.8V121.6c0-16 12.8-28.8 28.8-28.8h774.4c16 0 28.8 12.8 28.8 28.8v771.2c0 16-12.8 28.8-28.8 28.8H124.8c-16 3.2-28.8-9.6-28.8-28.8zm64-736v704h704v-704H160z"}),ye("path",{fill:"#fff",d:"M352 656V358.4c0-6.4 6.4-12.8 9.6-12.8h297.6c6.4 0 9.6 6.4 9.6 12.8V656c0 6.4-6.4 12.8-9.6 12.8H361.6c-3.2 0-9.6-6.4-9.6-12.8zm80-227.2v160h160v-160H432zm240 108.8v-48h192v48H672zm121.6-48H736v48h57.6v-48zm-633.6 48v-48h192v48H160zm124.8-48H224v48h57.6v-48z"}),ye("path",{fill:"#fff",d:"M489.6 156.8h48v192h-48v-192zm48 121.6v-57.6h-48v57.6h48zm-48 387.2h48v195.2h-48V665.6zm48 124.8v-57.6h-48v57.6h48z"})]}),I8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M185.6 489.6h-48c-3.2 0-9.6 3.2-9.6 9.6v384c0 3.2 3.2 9.6 9.6 9.6h48c3.2 0 9.6-3.2 9.6-9.6v-384c-3.2-6.4-6.4-9.6-9.6-9.6zm217.6 236.8c6.4 0 12.8-3.2 12.8-9.6v-48c0-3.2-6.4-9.6-12.8-9.6H140.8c-6.4 0-12.8 3.2-12.8 9.6v48c0 3.2 6.4 9.6 12.8 9.6h262.4zm512-547.2v-48c0-3.2-3.2-9.6-9.6-9.6h-384c-3.2 0-9.6 3.2-9.6 9.6v48c0 3.2 3.2 9.6 9.6 9.6h384c6.4 0 9.6-6.4 9.6-9.6zM678.4 377.6c0 6.4 3.2 9.6 9.6 9.6h48c3.2 0 9.6-3.2 9.6-9.6V134.4c0-6.4-3.2-9.6-9.6-9.6h-48c-3.2 0-9.6 3.2-9.6 9.6v243.2zm-195.2 89.6v416c0 9.6 6.4 16 16 16h400c9.6 0 16-6.4 16-16v-416c0-9.6-6.4-16-16-16h-400c-9.6 0-16 9.6-16 16zm361.6 57.6v304h-288v-304h288z"})}),Ss=({children:i,onClick:e,active:t,disabled:n})=>ye("div",{style:{margin:6,padding:6,background:t?"rgba(255, 255, 255, 0.1)":void 0,borderRadius:4,opacity:n?.25:t?1:.75,cursor:"pointer"},onClick:n||t?void 0:e,children:i}),O8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",style:{left:-2},children:ye("path",{fill:"#fff",d:"M279.552 198.879a22.26 22.26 0 0135.217-20.347L933.265 628.47a22.26 22.26 0 01-11.799 40.248l-324.43 19.456a22.26 22.26 0 00-17.23 9.972l-179.11 271.227a22.26 22.26 0 01-40.738-9.929L279.597 198.88z"})}),Iy=()=>ye("div",{style:{width:"60%",height:2,background:"rgba(255, 255, 255, 0.1)",margin:12}}),k8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:[ye("path",{fill:"#fff",d:"M808.192 246.528a320.16 320.16 0 00-592.352 0A238.592 238.592 0 0032 479.936c0 132.352 107.648 240 240 240h91.488a32 32 0 100-64H272a176.192 176.192 0 01-176-176 175.04 175.04 0 01148.48-173.888l19.04-2.976 6.24-18.24C305.248 181.408 402.592 111.936 512 111.936a256 256 0 01242.208 172.896l6.272 18.24 19.04 2.976A175.04 175.04 0 01928 479.936c0 97.024-78.976 176-176 176h-97.28a32 32 0 100 64H752c132.352 0 240-107.648 240-240a238.592 238.592 0 00-183.808-233.408z"}),ye("path",{fill:"#fff",d:"M649.792 789.888L544 876.48V447.936a32 32 0 00-64 0V876.48l-106.752-87.424a31.968 31.968 0 10-40.544 49.504l159.04 130.24a32 32 0 0040.576 0l158.048-129.44a32 32 0 10-40.576-49.472z"})]}),N8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:[ye("path",{fill:"#fff",d:"M870.4 342.4c-12.8 0-24-11.2-24-24V153.6c0-12.8 11.2-24 24-24s24 11.2 24 24v164.8c0 12.8-11.2 24-24 24z"}),ye("path",{fill:"#fff",d:"M870.4 177.6H705.6c-12.8 0-24-11.2-24-24s11.2-24 24-24h164.8c12.8 0 24 11.2 24 24s-11.2 24-24 24zm-96 716.8H249.6c-65.6 0-120-54.4-120-120V249.6c0-65.6 54.4-120 120-120H512c12.8 0 24 11.2 24 24s-11.2 24-24 24H249.6c-40 0-72 32-72 72v524.8c0 40 32 72 72 72h524.8c40 0 72-32 72-72V512c0-12.8 11.2-24 24-24s24 11.2 24 24v262.4c0 65.6-54.4 120-120 120z"}),ye("path",{fill:"#fff",d:"M526.4 521.6c-6.4 0-12.8-1.6-17.6-6.4-9.6-9.6-9.6-24 0-33.6l344-344c9.6-9.6 24-9.6 33.6 0 9.6 9.6 9.6 24 0 33.6l-344 344c-4.8 4.8-11.2 6.4-16 6.4z"})]}),Pb=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{}catch{return!1}else if("showOpenFilePicker"in self)return"showOpenFilePicker";return!1})(),B8=Pb?Promise.resolve().then(function(){return V8}):Promise.resolve().then(function(){return q8});async function z8(...i){return(await B8).default(...i)}Pb?Promise.resolve().then(function(){return G8}):Promise.resolve().then(function(){return Z8});Pb?Promise.resolve().then(function(){return j8}):Promise.resolve().then(function(){return J8});const U8=async i=>{const e=await i.getFile();return e.handle=i,e};var F8=async(i=[{}])=>{Array.isArray(i)||(i=[i]);const e=[];i.forEach((r,s)=>{e[s]={description:r.description||"",accept:{}},r.mimeTypes?r.mimeTypes.map(o=>{e[s].accept[o]=r.extensions||[]}):e[s].accept["*/*"]=r.extensions||[]});const t=await window.showOpenFilePicker({id:i[0].id,startIn:i[0].startIn,types:e,multiple:i[0].multiple||!1,excludeAcceptAllOption:i[0].excludeAcceptAllOption||!1}),n=await Promise.all(t.map(U8));return i[0].multiple?n:n[0]},V8={__proto__:null,default:F8};function Zf(i){function e(t){if(Object(t)!==t)return Promise.reject(new TypeError(t+" is not an object."));var n=t.done;return Promise.resolve(t.value).then(function(r){return{value:r,done:n}})}return Zf=function(t){this.s=t,this.n=t.next},Zf.prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(t){var n=this.s.return;return n===void 0?Promise.resolve({value:t,done:!0}):e(n.apply(this.s,arguments))},throw:function(t){var n=this.s.return;return n===void 0?Promise.reject(t):e(n.apply(this.s,arguments))}},new Zf(i)}const i3=async(i,e,t=i.name,n)=>{const r=[],s=[];var o,l=!1,h=!1;try{for(var d,f=function(g){var y,_,w,S=2;for(typeof Symbol<"u"&&(_=Symbol.asyncIterator,w=Symbol.iterator);S--;){if(_&&(y=g[_])!=null)return y.call(g);if(w&&(y=g[w])!=null)return new Zf(y.call(g));_="@@asyncIterator",w="@@iterator"}throw new TypeError("Object is not async iterable")}(i.values());l=!(d=await f.next()).done;l=!1){const g=d.value,y=`${t}/${g.name}`;g.kind==="file"?s.push(g.getFile().then(_=>(_.directoryHandle=i,_.handle=g,Object.defineProperty(_,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>y})))):g.kind!=="directory"||!e||n&&n(g)||r.push(i3(g,e,y,n))}}catch(g){h=!0,o=g}finally{try{l&&f.return!=null&&await f.return()}finally{if(h)throw o}}return[...(await Promise.all(r)).flat(),...await Promise.all(s)]};var H8=async(i={})=>{i.recursive=i.recursive||!1;const e=await window.showDirectoryPicker({id:i.id,startIn:i.startIn});return i3(e,i.recursive,void 0,i.skipDirectory)},G8={__proto__:null,default:H8},W8=async(i,e=[{}],t=null,n=!1,r=null)=>{Array.isArray(e)||(e=[e]),e[0].fileName=e[0].fileName||"Untitled";const s=[];let o=null;if(i instanceof Blob&&i.type?o=i.type:i.headers&&i.headers.get("content-type")&&(o=i.headers.get("content-type")),e.forEach((d,f)=>{s[f]={description:d.description||"",accept:{}},d.mimeTypes?(f===0&&o&&d.mimeTypes.push(o),d.mimeTypes.map(g=>{s[f].accept[g]=d.extensions||[]})):o?s[f].accept[o]=d.extensions||[]:s[f].accept["*/*"]=d.extensions||[]}),t)try{await t.getFile()}catch(d){if(t=null,n)throw d}const l=t||await window.showSaveFilePicker({suggestedName:e[0].fileName,id:e[0].id,startIn:e[0].startIn,types:s,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1});!t&&r&&r();const h=await l.createWritable();return"stream"in i?(await i.stream().pipeTo(h),l):"body"in i?(await i.body.pipeTo(h),l):(await h.write(await i),await h.close(),l)},j8={__proto__:null,default:W8},X8=async(i=[{}])=>(Array.isArray(i)||(i=[i]),new Promise((e,t)=>{const n=document.createElement("input");n.type="file";const r=[...i.map(l=>l.mimeTypes||[]),...i.map(l=>l.extensions||[])].join();n.multiple=i[0].multiple||!1,n.accept=r||"";const s=l=>{typeof o=="function"&&o(),e(l)},o=i[0].legacySetup&&i[0].legacySetup(s,()=>o(t),n);n.addEventListener("change",()=>{s(n.multiple?Array.from(n.files):n.files[0])}),n.click()})),q8={__proto__:null,default:X8},Y8=async(i=[{}])=>(Array.isArray(i)||(i=[i]),i[0].recursive=i[0].recursive||!1,new Promise((e,t)=>{const n=document.createElement("input");n.type="file",n.webkitdirectory=!0;const r=o=>{typeof s=="function"&&s(),e(o)},s=i[0].legacySetup&&i[0].legacySetup(r,()=>s(t),n);n.addEventListener("change",()=>{let o=Array.from(n.files);i[0].recursive?i[0].recursive&&i[0].skipDirectory&&(o=o.filter(l=>l.webkitRelativePath.split("/").every(h=>!i[0].skipDirectory({name:h,kind:"directory"})))):o=o.filter(l=>l.webkitRelativePath.split("/").length===2),r(o)}),n.click()})),Z8={__proto__:null,default:Y8},K8=async(i,e={})=>{Array.isArray(e)&&(e=e[0]);const t=document.createElement("a");let n=i;"body"in i&&(n=await async function(o,l){const h=o.getReader(),d=new ReadableStream({start:y=>async function _(){return h.read().then(({done:w,value:S})=>{if(!w)return y.enqueue(S),_();y.close()})}()}),f=new Response(d),g=await f.blob();return h.releaseLock(),new Blob([g],{type:l})}(i.body,i.headers.get("content-type"))),t.download=e.fileName||"Untitled",t.href=URL.createObjectURL(await n);const r=()=>{typeof s=="function"&&s()},s=e.legacySetup&&e.legacySetup(r,()=>s(),t);return t.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(t.href),3e4),r()}),t.click(),null},J8={__proto__:null,default:K8};const Q8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M836.8 353.6c-11.2-3.2-20.8-6.4-32-9.6 1.6-8 3.2-14.4 4.8-22.4 24-118.4 8-214.4-46.4-246.4C710.4 44.8 624 76.8 537.6 152c-8 8-17.6 14.4-25.6 22.4-4.8-4.8-11.2-9.6-16-16-91.2-81.6-182.4-115.2-236.8-83.2-52.8 30.4-68.8 120-46.4 233.6 1.6 11.2 4.8 22.4 8 33.6-12.8 3.2-25.6 8-36.8 11.2C76.8 392 0 451.2 0 510.4c0 62.4 81.6 124.8 192 163.2 9.6 3.2 17.6 6.4 27.2 8-3.2 12.8-6.4 24-8 36.8-20.8 110.4-4.8 198.4 48 228.8 54.4 32 145.6 0 233.6-78.4 6.4-6.4 14.4-12.8 20.8-19.2 8 8 17.6 16 27.2 24 84.8 73.6 169.6 104 222.4 73.6 54.4-32 72-126.4 48-241.6-1.6-8-3.2-17.6-6.4-27.2 6.4-1.6 12.8-3.2 19.2-6.4 116.8-35.2 200-97.6 200-161.6 0-59.2-78.4-118.4-187.2-156.8zM566.4 184c75.2-65.6 144-89.6 176-72 33.6 19.2 46.4 97.6 25.6 201.6-1.6 6.4-3.2 12.8-4.8 20.8-44.8-9.6-89.6-17.6-134.4-20.8C603.2 276.8 574.4 240 544 208c6.4-9.6 14.4-16 22.4-24zm-232 430.4c9.6 17.6 20.8 35.2 32 51.2-32-3.2-62.4-8-92.8-14.4 8-28.8 19.2-59.2 32-89.6 9.6 19.2 19.2 36.8 28.8 52.8zm-60.8-240c28.8-6.4 59.2-11.2 91.2-16-11.2 16-20.8 33.6-30.4 51.2-9.6 17.6-19.2 33.6-28.8 52.8-12.8-30.4-22.4-59.2-32-88zM328 512c12.8-27.2 27.2-54.4 43.2-81.6s32-52.8 48-78.4c30.4-1.6 60.8-3.2 91.2-3.2s62.4 1.6 91.2 3.2c17.6 25.6 33.6 51.2 48 76.8s30.4 52.8 43.2 81.6c-12.8 27.2-27.2 54.4-43.2 81.6-16 27.2-32 52.8-48 78.4-30.4 1.6-60.8 3.2-92.8 3.2s-62.4-1.6-91.2-3.2C400 644.8 384 619.2 368 592s-25.6-52.8-40-80zm361.6 102.4l28.8-52.8c12.8 28.8 24 59.2 33.6 88-30.4 6.4-62.4 12.8-94.4 16 11.2-16 22.4-33.6 32-51.2zm28.8-153.6L689.6 408c-9.6-17.6-20.8-33.6-30.4-49.6 32 4.8 62.4 9.6 91.2 16-8 30.4-19.2 59.2-32 86.4zM512 236.8c20.8 22.4 40 46.4 59.2 72-40-1.6-80-1.6-118.4 0 19.2-27.2 40-51.2 59.2-72zM280 113.6c33.6-19.2 108.8 8 187.2 78.4 4.8 4.8 9.6 9.6 16 14.4C452.8 240 424 275.2 396.8 312c-44.8 4.8-89.6 11.2-134.4 20.8-3.2-9.6-4.8-20.8-6.4-30.4-19.2-97.6-6.4-169.6 24-188.8zm-48 528c-8-3.2-16-4.8-25.6-8-43.2-12.8-91.2-35.2-126.4-62.4C59.2 556.8 46.4 536 41.6 512c0-36.8 64-83.2 155.2-115.2 11.2-4.8 22.4-8 35.2-11.2 14.4 43.2 30.4 86.4 49.6 128-19.2 40-36.8 83.2-49.6 128zm232 195.2c-33.6 30.4-72 54.4-113.6 70.4-22.4 11.2-48 11.2-70.4 3.2-32-19.2-44.8-89.6-27.2-184 1.6-11.2 4.8-22.4 8-33.6 44.8 9.6 89.6 16 136 19.2 25.6 36.8 56 73.6 86.4 107.2-6.4 6.4-12.8 12.8-19.2 17.6zm49.6-48c-20.8-22.4-40-46.4-60.8-72 19.2 0 38.4 1.6 59.2 1.6 20.8 0 41.6 0 60.8-1.6-19.2 24-38.4 48-59.2 72zM774.4 848c-1.6 24-14.4 48-33.6 62.4-32 19.2-99.2-4.8-172.8-68.8-8-8-16-14.4-25.6-22.4 30.4-33.6 59.2-68.8 84.8-107.2 46.4-3.2 91.2-11.2 136-20.8l4.8 24c11.2 43.2 12.8 89.6 6.4 132.8zm36.8-214.4c-4.8 1.6-11.2 3.2-17.6 4.8-14.4-43.2-32-86.4-51.2-128 19.2-40 35.2-83.2 49.6-126.4 11.2 3.2 20.8 6.4 30.4 9.6 92.8 32 158.4 80 158.4 116.8 0 40-68.8 89.6-169.6 123.2zM512 603.2c51.2 0 91.2-41.6 91.2-91.2s-41.6-91.2-91.2-91.2-91.2 41.6-91.2 91.2 40 91.2 91.2 91.2z"})}),$8=()=>ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",children:ye("path",{fill:"#fff",d:"M777.8 128.6H624L512 305.8l-96-177.2H64L512 896l448-767.4H777.8zm-602.4 64H283L512 589l228.8-396.4h107.6L512 769 175.4 192.6z"})});var Rb=(i,e)=>{const t=new Blob([e],{type:"text/plain"}),n=document.createElement("a"),r=n.href=URL.createObjectURL(t);n.download=i,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)};const r3=i=>{let e="";for(const t of i){const n=rs.exports.upperFirst(t.type);let r="";for(const[s,o]of Object.entries(t))s==="children"||s==="type"||!o||(typeof o=="string"?r+=` ${s}="${o}"`:o===!0?r+=` ${s}`:typeof o=="object"?r+=` ${s}={${JSON.stringify(o)}}`:r+=` ${s}={${o}}`);e+="children"in t&&t.children?`<${n}${r}>${r3(t.children)}</${n}>`:`<${n}${r} />`}return e};var eH=async()=>{const i=(await $n(()=>import("./standalone.52229138.js"),["./standalone.52229138.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.s})).default,e=(await $n(()=>import("./parser-babel.82506b34.js"),["./parser-babel.82506b34.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.p})).default,t=i.format(`
|
||
const App = () => {
|
||
return (
|
||
<World>
|
||
${r3(Dv())}
|
||
</World>
|
||
)
|
||
}
|
||
`,{parser:"babel",plugins:[e]});Rb("App.jsx",t)};const s3=i=>{let e="";for(const t of i){const n=rs.exports.upperFirst(t.type);let r="";for(let[s,o]of Object.entries(t))s==="children"||s==="type"||!o||(s=rs.exports.kebabCase(s),typeof o=="string"?r+=` ${s}='${o}'`:o===!0?r+=` ${s}`:typeof o=="object"?r+=` :${s}='${JSON.stringify(o)}'`:r+=` :${s}='${o}'`);e+="children"in t&&t.children?`<${n}${r}>
|
||
${s3(t.children)}</${n}>
|
||
`:`<${n}${r} />
|
||
`}return e};var tH=async()=>{const i=(await $n(()=>import("./standalone.52229138.js"),["./standalone.52229138.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.s})).default,e=(await $n(()=>import("./parser-html.e8a57b35.js"),["./parser-html.e8a57b35.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.p})).default,t=i.format(`
|
||
<template>
|
||
<World>
|
||
${s3(Dv())}
|
||
</World>
|
||
</template>
|
||
`,{parser:"vue",plugins:[e]});Rb("App.vue",t)};const nH=async()=>{const i=(await $n(()=>import("./standalone.52229138.js"),["./standalone.52229138.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.s})).default,e=(await $n(()=>import("./parser-babel.82506b34.js"),["./parser-babel.82506b34.js","./entry.aa7356a8.js","./entry.0702eb82.css"],import.meta.url).then(function(n){return n.p})).default,t=i.format(JSON.stringify(Dv()),{parser:"json",plugins:[e]});Rb("scene.json",t)},iH=async()=>{const e=await(await z8({extensions:[".json"]})).text();for(const t of Li)t.dispose();try{AC(JSON.parse(e))}catch{}},rH=()=>{const[i,e]=p8();let[t,n]=f8();i==="scale"&&(t="local");const[r]=zv(),s=r&&!(r instanceof Sa);return Sb(()=>{s&&i==="scale"&&e("translate")},[s]),ye("div",{className:"lingo3d-ui",style:{width:50,height:"100%",background:"rgb(40, 41, 46)",borderRight:"1px solid rgba(255, 255, 255, 0.05)",overflow:"hidden"},children:ye("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",opacity:.75,paddingTop:12},children:[ye(Ss,{active:i==="select",onClick:()=>e("select"),children:ye(O8,{})}),ye(Ss,{active:i==="translate",onClick:()=>e("translate"),children:ye(P8,{})}),ye(Ss,{active:i==="rotate",onClick:()=>e("rotate"),children:ye(R8,{})}),ye(Ss,{active:i==="scale",disabled:s,onClick:()=>e("scale"),children:ye(L8,{})}),ye(Iy,{}),ye(Ss,{active:t==="world",onClick:()=>n("world"),disabled:i==="scale"||i==="select",children:ye(D8,{})}),ye(Ss,{active:t==="local",onClick:()=>n("local"),disabled:i==="select",children:ye(I8,{})}),ye(Iy,{}),ye(Ss,{onClick:iH,children:ye(N8,{})}),ye(Ss,{onClick:nH,children:ye(k8,{})}),ye(Iy,{}),ye(Ss,{onClick:eH,children:ye(Q8,{})}),ye(Ss,{onClick:tH,children:ye($8,{})})]})})};Nv(rH,"lingo3d-toolbar");let Rm;wn.addEventListener("dragover",i=>i.preventDefault());wn.addEventListener("dragenter",i=>i.preventDefault());wn.addEventListener("drop",i=>{if(!Rm||!Qh())return;const e=EC(Rm),{x:t,y:n,z:r}=PT(i,!0);e.outerObject3d.position.set(t,n,r),Di(e)});const pE=({name:i,iconName:e=i})=>ye("div",{onDragStart:()=>Rm=i,onDragEnd:()=>Rm=void 0,style:{width:"50%",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:20,paddingBottom:20},children:[ye("img",{style:{width:50},src:`https://unpkg.com/lingo3d-editor@1.0.1/assets/${e}.png`}),ye("div",{style:{marginTop:6,opacity:.75,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:rs.exports.upperFirst(i)})]}),fE=i=>typeof i=="string"?i.endsWith("Camera")?"camera":i.endsWith("Light")?"light":i:Object.values(i)[0],mE=i=>typeof i=="string"?i:Object.keys(i)[0],sH=({names:i})=>{const e=[];let t=[],n=0;for(const r of i)n===0&&e.push(t=[]),t.push(r),++n===2&&(n=0);return ye(vu,{children:e.map(([r,s],o)=>ye("div",{style:{display:"flex"},children:[ye(pE,{name:mE(r),iconName:fE(r)}),s&&ye(pE,{name:mE(s),iconName:fE(s)})]},o))})},oH=()=>ye("div",{className:"lingo3d-ui",style:{width:200,height:"100%",background:"rgb(40, 41, 46)",padding:10},children:ye(sH,{names:["model","dummy","svgMesh","trigger","reflector","cube","sphere","cone","cylinder","octahedron","tetrahedron","torus","plane","circle","areaLight","ambientLight","skyLight","directionalLight","pointLight","spotLight","camera","thirdPersonCamera","firstPersonCamera","orbitCamera"]})});Nv(oH,"lingo3d-library");const o3=document.createElement("style");document.head.appendChild(o3);o3.innerHTML=`.lingo3d-ui * {
|
||
user-select: none;
|
||
-webkit-user-select: none;
|
||
position: relative;
|
||
box-sizing: border-box;
|
||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !important;
|
||
}
|
||
.lingo3d-ui {
|
||
position: relative;
|
||
box-sizing: border-box;
|
||
overflow-x: hidden;
|
||
overflow-y: scroll;
|
||
float: left;
|
||
color: white;
|
||
font-size: 11px;
|
||
}
|
||
|
||
.lingo3d-ui::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
|
||
.tp-rotv {
|
||
box-shadow: none !important;
|
||
background-color: transparent !important;
|
||
}
|
||
.tp-brkv {
|
||
border-left: none !important;
|
||
}
|
||
`;var aH={exports:{}};(function(i,e){(function(t,n){i.exports=n()})(rl,function(){var t=function(){function n(_){return o.appendChild(_.dom),_}function r(_){for(var w=0;w<o.children.length;w++)o.children[w].style.display=w===_?"block":"none";s=_}var s=0,o=document.createElement("div");o.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",o.addEventListener("click",function(_){_.preventDefault(),r(++s%o.children.length)},!1);var l=(performance||Date).now(),h=l,d=0,f=n(new t.Panel("FPS","#0ff","#002")),g=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var y=n(new t.Panel("MB","#f08","#201"));return r(0),{REVISION:16,dom:o,addPanel:n,showPanel:r,begin:function(){l=(performance||Date).now()},end:function(){d++;var _=(performance||Date).now();if(g.update(_-l,200),_>h+1e3&&(f.update(1e3*d/(_-h),100),h=_,d=0,y)){var w=performance.memory;y.update(w.usedJSHeapSize/1048576,w.jsHeapSizeLimit/1048576)}return _},update:function(){l=this.end()},domElement:o,setMode:r}};return t.Panel=function(n,r,s){var o=1/0,l=0,h=Math.round,d=h(window.devicePixelRatio||1),f=80*d,g=48*d,y=3*d,_=2*d,w=3*d,S=15*d,b=74*d,T=30*d,E=document.createElement("canvas");E.width=f,E.height=g,E.style.cssText="width:80px;height:48px";var C=E.getContext("2d");return C.font="bold "+9*d+"px Helvetica,Arial,sans-serif",C.textBaseline="top",C.fillStyle=s,C.fillRect(0,0,f,g),C.fillStyle=r,C.fillText(n,y,_),C.fillRect(w,S,b,T),C.fillStyle=s,C.globalAlpha=.9,C.fillRect(w,S,b,T),{dom:E,update:function(A,D){o=Math.min(o,A),l=Math.max(l,A),C.fillStyle=s,C.globalAlpha=1,C.fillRect(0,0,f,S),C.fillStyle=r,C.fillText(h(A)+" "+n+" ("+h(o)+"-"+h(l)+")",y,_),C.drawImage(E,w+d,S,b-d,T,w,S,b-d,T),C.fillRect(w+b-d,S,d,T),C.fillStyle=s,C.globalAlpha=.9,C.fillRect(w+b-d,S,d,h((1-A/D)*T))}}},t})})(aH);var a3=(i,e,t)=>{let n=e;const r=sd([]);return Rs(()=>{if(t!=null&&t.value)return;const s=r.value=[];for(const[o,l]of Object.entries(i)){const h=n[o];h!==l&&(l&&typeof l=="object"?JSON.stringify(l)!==JSON.stringify(h)&&s.push([o,l]):s.push([o,l]))}n=Me({},i)}),r};const l3=new WeakMap,lH=()=>new Map,c3=(i,e,t,n)=>{Rs(()=>{var r;if(e??(e=Ih(i==null?void 0:i.value)),!e)return;const s=Ma(l3,e,lH);for(const[o,l]of Ih(t.value)){if((r=s.get(o))==null||r.cancel(),l instanceof Tn){s.set(o,l.get(h=>e[o]=h));continue}e[o]=l??n[o]}})};var u3=(i,e)=>{const t=new e,n=sd(t);TE("parent",n);const r=EE("parent",void 0);Rs(()=>{var o;(o=Ih(r==null?void 0:r.value))==null||o.append(t)}),e.defaults||console.error("ManagerClass has no defaults",e);const s=a3(i,e.defaults);return c3(void 0,t,s,e.defaults),L4(()=>{const o=l3.get(t);if(o)for(const l of o.values())l.cancel();t.dispose()}),t};An(yC,_C);An(AT,CT);An(gC,ol);An(xC,bC);An(QA,$A);var cH=An(ab,lb);const uH=rd({name:"Model",props:cH,setup(i,{expose:e}){const n=u3(i,Ao);return e(n),(r,s)=>Dm(r.$slots,"default")}});An(mb,qA);An(YA,ZA);An(KA,JA);An(MT,ET);An(eT,tT);An(sA,oA);An(vb,gb);var hH=An(uA,hA);const dH=rd({name:"OrbitCamera",props:hH,setup(i,{expose:e}){const n=u3(i,Cl);return e(n),(r,s)=>Dm(r.$slots,"default")}});An(yb,_b);An(yb,_b);An(sC,oC);An(aC,ha);An(lC,cC);An(dC,pC);An(uC,hC);An(mC,vC);An(uv,hv);var pH=An(KT,ym);bt(Me({},pH),{onLoad:Function});function h3(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)e.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(t[n[r]]=i[n[r]]);return t}var vE=function(){};const j_=(i,e,t)=>Math.min(Math.max(t,i),e),Oy=.001,fH=.01,mH=10,vH=.05,gH=1;function yH({duration:i=800,bounce:e=.25,velocity:t=0,mass:n=1}){let r,s,o=1-e;o=j_(vH,gH,o),i=j_(fH,mH,i/1e3),o<1?(r=d=>{const f=d*o,g=f*i,y=f-t,_=X_(d,o),w=Math.exp(-g);return Oy-y/_*w},s=d=>{const g=d*o*i,y=g*t+t,_=Math.pow(o,2)*Math.pow(d,2)*i,w=Math.exp(-g),S=X_(Math.pow(d,2),o);return(-r(d)+Oy>0?-1:1)*((y-_)*w)/S}):(r=d=>{const f=Math.exp(-d*i),g=(d-t)*i+1;return-Oy+f*g},s=d=>{const f=Math.exp(-d*i),g=(t-d)*(i*i);return f*g});const l=5/i,h=xH(r,s,l);if(i=i*1e3,isNaN(h))return{stiffness:100,damping:10,duration:i};{const d=Math.pow(h,2)*n;return{stiffness:d,damping:o*2*Math.sqrt(n*d),duration:i}}}const _H=12;function xH(i,e,t){let n=t;for(let r=1;r<_H;r++)n=n-i(n)/e(n);return n}function X_(i,e){return i*Math.sqrt(1-e*e)}const bH=["duration","bounce"],wH=["stiffness","damping","mass"];function gE(i,e){return e.some(t=>i[t]!==void 0)}function SH(i){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},i);if(!gE(i,wH)&&gE(i,bH)){const t=yH(i);e=Object.assign(Object.assign(Object.assign({},e),t),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}function Lb(i){var{from:e=0,to:t=1,restSpeed:n=2,restDelta:r}=i,s=h3(i,["from","to","restSpeed","restDelta"]);const o={done:!1,value:e};let{stiffness:l,damping:h,mass:d,velocity:f,duration:g,isResolvedFromDuration:y}=SH(s),_=yE,w=yE;function S(){const b=f?-(f/1e3):0,T=t-e,E=h/(2*Math.sqrt(l*d)),C=Math.sqrt(l/d)/1e3;if(r===void 0&&(r=Math.min(Math.abs(t-e)/100,.4)),E<1){const A=X_(C,E);_=D=>{const I=Math.exp(-E*C*D);return t-I*((b+E*C*T)/A*Math.sin(A*D)+T*Math.cos(A*D))},w=D=>{const I=Math.exp(-E*C*D);return E*C*I*(Math.sin(A*D)*(b+E*C*T)/A+T*Math.cos(A*D))-I*(Math.cos(A*D)*(b+E*C*T)-A*T*Math.sin(A*D))}}else if(E===1)_=A=>t-Math.exp(-C*A)*(T+(b+C*T)*A);else{const A=C*Math.sqrt(E*E-1);_=D=>{const I=Math.exp(-E*C*D),F=Math.min(A*D,300);return t-I*((b+E*C*T)*Math.sinh(F)+A*T*Math.cosh(F))/A}}}return S(),{next:b=>{const T=_(b);if(y)o.done=b>=g;else{const E=w(b)*1e3,C=Math.abs(E)<=n,A=Math.abs(t-T)<=r;o.done=C&&A}return o.value=o.done?t:T,o},flipTarget:()=>{f=-f,[e,t]=[t,e],S()}}}Lb.needsInterpolation=(i,e)=>typeof i=="string"||typeof e=="string";const yE=i=>0,d3=(i,e,t)=>{const n=e-i;return n===0?1:(t-i)/n},Db=(i,e,t)=>-t*i+t*e+i,p3=(i,e)=>t=>Math.max(Math.min(t,e),i),Rh=i=>i%1?Number(i.toFixed(5)):i,Lm=/(-)?([\d]*\.?[\d])+/g,q_=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,MH=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function Id(i){return typeof i=="string"}const Uv={test:i=>typeof i=="number",parse:parseFloat,transform:i=>i},f3=Object.assign(Object.assign({},Uv),{transform:p3(0,1)});Object.assign(Object.assign({},Uv),{default:1});const EH=i=>({test:e=>Id(e)&&e.endsWith(i)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${i}`}),Lh=EH("%");Object.assign(Object.assign({},Lh),{parse:i=>Lh.parse(i)/100,transform:i=>Lh.transform(i*100)});const Ib=(i,e)=>t=>!!(Id(t)&&MH.test(t)&&t.startsWith(i)||e&&Object.prototype.hasOwnProperty.call(t,e)),m3=(i,e,t)=>n=>{if(!Id(n))return n;const[r,s,o,l]=n.match(Lm);return{[i]:parseFloat(r),[e]:parseFloat(s),[t]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},ll={test:Ib("hsl","hue"),parse:m3("hue","saturation","lightness"),transform:({hue:i,saturation:e,lightness:t,alpha:n=1})=>"hsla("+Math.round(i)+", "+Lh.transform(Rh(e))+", "+Lh.transform(Rh(t))+", "+Rh(f3.transform(n))+")"},TH=p3(0,255),ky=Object.assign(Object.assign({},Uv),{transform:i=>Math.round(TH(i))}),fa={test:Ib("rgb","red"),parse:m3("red","green","blue"),transform:({red:i,green:e,blue:t,alpha:n=1})=>"rgba("+ky.transform(i)+", "+ky.transform(e)+", "+ky.transform(t)+", "+Rh(f3.transform(n))+")"};function AH(i){let e="",t="",n="",r="";return i.length>5?(e=i.substr(1,2),t=i.substr(3,2),n=i.substr(5,2),r=i.substr(7,2)):(e=i.substr(1,1),t=i.substr(2,1),n=i.substr(3,1),r=i.substr(4,1),e+=e,t+=t,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(n,16),alpha:r?parseInt(r,16)/255:1}}const Y_={test:Ib("#"),parse:AH,transform:fa.transform},Fv={test:i=>fa.test(i)||Y_.test(i)||ll.test(i),parse:i=>fa.test(i)?fa.parse(i):ll.test(i)?ll.parse(i):Y_.parse(i),transform:i=>Id(i)?i:i.hasOwnProperty("red")?fa.transform(i):ll.transform(i)},v3="${c}",g3="${n}";function CH(i){var e,t,n,r;return isNaN(i)&&Id(i)&&((t=(e=i.match(Lm))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((r=(n=i.match(q_))===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0)>0}function y3(i){typeof i=="number"&&(i=`${i}`);const e=[];let t=0;const n=i.match(q_);n&&(t=n.length,i=i.replace(q_,v3),e.push(...n.map(Fv.parse)));const r=i.match(Lm);return r&&(i=i.replace(Lm,g3),e.push(...r.map(Uv.parse))),{values:e,numColors:t,tokenised:i}}function _3(i){return y3(i).values}function x3(i){const{values:e,numColors:t,tokenised:n}=y3(i),r=e.length;return s=>{let o=n;for(let l=0;l<r;l++)o=o.replace(l<t?v3:g3,l<t?Fv.transform(s[l]):Rh(s[l]));return o}}const PH=i=>typeof i=="number"?0:i;function RH(i){const e=_3(i);return x3(i)(e.map(PH))}const b3={test:CH,parse:_3,createTransformer:x3,getAnimatableNone:RH};function Ny(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function _E({hue:i,saturation:e,lightness:t,alpha:n}){i/=360,e/=100,t/=100;let r=0,s=0,o=0;if(!e)r=s=o=t;else{const l=t<.5?t*(1+e):t+e-t*e,h=2*t-l;r=Ny(h,l,i+1/3),s=Ny(h,l,i),o=Ny(h,l,i-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:n}}const LH=(i,e,t)=>{const n=i*i,r=e*e;return Math.sqrt(Math.max(0,t*(r-n)+n))},DH=[Y_,fa,ll],xE=i=>DH.find(e=>e.test(i)),w3=(i,e)=>{let t=xE(i),n=xE(e),r=t.parse(i),s=n.parse(e);t===ll&&(r=_E(r),t=fa),n===ll&&(s=_E(s),n=fa);const o=Object.assign({},r);return l=>{for(const h in o)h!=="alpha"&&(o[h]=LH(r[h],s[h],l));return o.alpha=Db(r.alpha,s.alpha,l),t.transform(o)}},IH=i=>typeof i=="number",OH=(i,e)=>t=>e(i(t)),S3=(...i)=>i.reduce(OH);function M3(i,e){return IH(i)?t=>Db(i,e,t):Fv.test(i)?w3(i,e):T3(i,e)}const E3=(i,e)=>{const t=[...i],n=t.length,r=i.map((s,o)=>M3(s,e[o]));return s=>{for(let o=0;o<n;o++)t[o]=r[o](s);return t}},kH=(i,e)=>{const t=Object.assign(Object.assign({},i),e),n={};for(const r in t)i[r]!==void 0&&e[r]!==void 0&&(n[r]=M3(i[r],e[r]));return r=>{for(const s in n)t[s]=n[s](r);return t}};function bE(i){const e=b3.parse(i),t=e.length;let n=0,r=0,s=0;for(let o=0;o<t;o++)n||typeof e[o]=="number"?n++:e[o].hue!==void 0?s++:r++;return{parsed:e,numNumbers:n,numRGB:r,numHSL:s}}const T3=(i,e)=>{const t=b3.createTransformer(e),n=bE(i),r=bE(e);return n.numHSL===r.numHSL&&n.numRGB===r.numRGB&&n.numNumbers>=r.numNumbers?S3(E3(n.parsed,r.parsed),t):o=>`${o>0?e:i}`},NH=(i,e)=>t=>Db(i,e,t);function BH(i){if(typeof i=="number")return NH;if(typeof i=="string")return Fv.test(i)?w3:T3;if(Array.isArray(i))return E3;if(typeof i=="object")return kH}function zH(i,e,t){const n=[],r=t||BH(i[0]),s=i.length-1;for(let o=0;o<s;o++){let l=r(i[o],i[o+1]);if(e){const h=Array.isArray(e)?e[o]:e;l=S3(h,l)}n.push(l)}return n}function UH([i,e],[t]){return n=>t(d3(i,e,n))}function FH(i,e){const t=i.length,n=t-1;return r=>{let s=0,o=!1;if(r<=i[0]?o=!0:r>=i[n]&&(s=n-1,o=!0),!o){let h=1;for(;h<t&&!(i[h]>r||h===n);h++);s=h-1}const l=d3(i[s],i[s+1],r);return e[s](l)}}function A3(i,e,{clamp:t=!0,ease:n,mixer:r}={}){const s=i.length;vE(s===e.length),vE(!n||!Array.isArray(n)||n.length===s-1),i[0]>i[s-1]&&(i=[].concat(i),e=[].concat(e),i.reverse(),e.reverse());const o=zH(e,n,r),l=s===2?UH(i,o):FH(i,o);return t?h=>l(j_(i[0],i[s-1],h)):l}const VH=i=>e=>e<=.5?i(2*e)/2:(2-i(2*(1-e)))/2,HH=i=>e=>Math.pow(e,i),GH=HH(2),WH=VH(GH);function jH(i,e){return i.map(()=>e||WH).splice(0,i.length-1)}function XH(i){const e=i.length;return i.map((t,n)=>n!==0?n/(e-1):0)}function qH(i,e){return i.map(t=>t*e)}function Kf({from:i=0,to:e=1,ease:t,offset:n,duration:r=300}){const s={done:!1,value:i},o=Array.isArray(e)?e:[i,e],l=qH(n&&n.length===o.length?n:XH(o),r);function h(){return A3(l,o,{ease:Array.isArray(t)?t:jH(o,t)})}let d=h();return{next:f=>(s.value=d(f),s.done=f>=r,s),flipTarget:()=>{o.reverse(),d=h()}}}function YH({velocity:i=0,from:e=0,power:t=.8,timeConstant:n=350,restDelta:r=.5,modifyTarget:s}){const o={done:!1,value:e};let l=t*i;const h=e+l,d=s===void 0?h:s(h);return d!==h&&(l=d-e),{next:f=>{const g=-l*Math.exp(-f/n);return o.done=!(g>r||g<-r),o.value=o.done?d:d+g,o},flipTarget:()=>{}}}const wE={keyframes:Kf,spring:Lb,decay:YH};function ZH(i){if(Array.isArray(i.to))return Kf;if(wE[i.type])return wE[i.type];const e=new Set(Object.keys(i));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?Kf:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?Lb:Kf}const C3=1/60*1e3,KH=typeof performance<"u"?()=>performance.now():()=>Date.now(),P3=typeof window<"u"?i=>window.requestAnimationFrame(i):i=>setTimeout(()=>i(KH()),C3);function JH(i){let e=[],t=[],n=0,r=!1,s=!1;const o=new WeakSet,l={schedule:(h,d=!1,f=!1)=>{const g=f&&r,y=g?e:t;return d&&o.add(h),y.indexOf(h)===-1&&(y.push(h),g&&r&&(n=e.length)),h},cancel:h=>{const d=t.indexOf(h);d!==-1&&t.splice(d,1),o.delete(h)},process:h=>{if(r){s=!0;return}if(r=!0,[e,t]=[t,e],t.length=0,n=e.length,n)for(let d=0;d<n;d++){const f=e[d];f(h),o.has(f)&&(l.schedule(f),i())}r=!1,s&&(s=!1,l.process(h))}};return l}const QH=40;let Z_=!0,id=!1,K_=!1;const Dh={delta:0,timestamp:0},Od=["read","update","preRender","render","postRender"],Vv=Od.reduce((i,e)=>(i[e]=JH(()=>id=!0),i),{}),$H=Od.reduce((i,e)=>{const t=Vv[e];return i[e]=(n,r=!1,s=!1)=>(id||n9(),t.schedule(n,r,s)),i},{}),e9=Od.reduce((i,e)=>(i[e]=Vv[e].cancel,i),{});Od.reduce((i,e)=>(i[e]=()=>Vv[e].process(Dh),i),{});const t9=i=>Vv[i].process(Dh),R3=i=>{id=!1,Dh.delta=Z_?C3:Math.max(Math.min(i-Dh.timestamp,QH),1),Dh.timestamp=i,K_=!0,Od.forEach(t9),K_=!1,id&&(Z_=!1,P3(R3))},n9=()=>{id=!0,Z_=!0,K_||P3(R3)};function L3(i,e,t=0){return i-e-t}function i9(i,e,t=0,n=!0){return n?L3(e+-i,e,t):e-(i-e)+t}function r9(i,e,t,n){return n?i>=e+t:i<=-t}const s9=i=>{const e=({delta:t})=>i(t);return{start:()=>$H.update(e,!0),stop:()=>e9.update(e)}};function o9(i){var e,t,{from:n,autoplay:r=!0,driver:s=s9,elapsed:o=0,repeat:l=0,repeatType:h="loop",repeatDelay:d=0,onPlay:f,onStop:g,onComplete:y,onRepeat:_,onUpdate:w}=i,S=h3(i,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:b}=S,T,E=0,C=S.duration,A,D=!1,I=!0,F;const P=ZH(S);!((t=(e=P).needsInterpolation)===null||t===void 0)&&t.call(e,n,b)&&(F=A3([0,100],[n,b],{clamp:!1}),n=0,b=100);const k=P(Object.assign(Object.assign({},S),{from:n,to:b}));function j(){E++,h==="reverse"?(I=E%2===0,o=i9(o,C,d,I)):(o=L3(o,C,d),h==="mirror"&&k.flipTarget()),D=!1,_&&_()}function G(){T.stop(),y&&y()}function ne(Z){if(I||(Z=-Z),o+=Z,!D){const $=k.next(Math.max(0,o));A=$.value,F&&(A=F(A)),D=I?$.done:o<=0}w==null||w(A),D&&(E===0&&(C??(C=o)),E<l?r9(o,C,d,I)&&j():G())}function ce(){f==null||f(),T=s(ne),T.start()}return r&&ce(),{stop:()=>{g==null||g(),T.stop()}}}class a9 extends Tn{constructor(){super(...arguments),B4(this,"restart")}}var l9=i=>{var e,t,n;const r=typeof(i==null?void 0:i.from)=="function"?i.from():(e=i==null?void 0:i.from)!=null?e:0,s=new a9((n=(t=i==null?void 0:i.map)==null?void 0:t.call(i,r))!=null?n:r);return Rs(o=>{if(typeof(i==null?void 0:i.from)!="function")return;const{map:l}=i;if(l){const d=i.from(f=>s.set(l(f)));return o(()=>{d.cancel()})}const h=i.from(s.set);o(()=>{h.cancel()})}),Rs(o=>{const l=i==null?void 0:i.step;if(!l)return;const h=s.get(l);o(()=>{h.cancel()})}),s},c9=i=>{var e=i,{from:t,to:n,duration:r=1e3,stopped:s,step:o}=e,l=N4(e,["from","to","duration","stopped","step"]);const h=l9({from:t,step:o}),d=sd({});let f=d;return h.restart=()=>d.value={},Rs(g=>{if(typeof s=="boolean"?s:s!=null&&s.value)return;const y=typeof n=="number"||Array.isArray(n)?n:n.value,_=o9(bt(Me({from:f===d?h.get():t,to:y,duration:r},l),{onUpdate:h.set}));g(()=>{_.stop()})}),h};const u9={class:"relative h-96 w-500px bg-transparent",style:{width:"width+'px'"}},C9=rd({__name:"model",props:{src:null,width:null},setup(i){const e=c9({from:180,to:0,duration:5e3});return(t,n)=>(SE(),ME("div",u9,[N0(zp(JV),{color:"transparent","default-light":"studio"},{default:D4(()=>[N0(zp(uH),{src:i.src,y:0,"rotation-z":zp(e),"box-visible":!1},null,8,["src","rotation-z"]),N0(zp(dH),{active:"",z:100,y:80,zoom:.8,"auto-rotate":"","enable-damping":""})]),_:1})]))}});export{ji as $,Ot as A,sr as B,bo as C,_a as D,Xm as E,Oh as F,ei as G,bl as H,xt as I,Zm as J,jc as K,B2 as L,In as M,Km as N,$t as O,Br as P,ai as Q,wx as R,su as S,oi as T,ld as U,z as V,K6 as W,Ta as X,Ze as Y,x9 as Z,C9 as _,Qe as a,va as a$,wn as a0,b9 as a1,Eo as a2,R6 as a3,S2 as a4,T2 as a5,Nh as a6,yr as a7,ti as a8,g2 as a9,Nr as aA,Cs as aB,v2 as aC,_l as aD,D6 as aE,cd as aF,Hn as aG,od as aH,px as aI,li as aJ,wl as aK,fl as aL,VB as aM,HB as aN,nm as aO,f9 as aP,Xt as aQ,l1 as aR,vI as aS,c1 as aT,Wy as aU,tm as aV,Fh as aW,p9 as aX,wa as aY,_o as aZ,dd as a_,y2 as aa,Pe as ab,Ln as ac,kh as ad,hx as ae,nn as af,ou as ag,fi as ah,R2 as ai,G0 as aj,C2 as ak,Tx as al,i2 as am,r2 as an,D2 as ao,WE as ap,Gn as aq,dn as ar,e_ as as,am as at,hd as au,Wh as av,rT as aw,lm as ax,Ds as ay,sT as az,os as b,om as b0,m9 as b1,Um as b2,Yt as b3,Hm as b4,cl as b5,pl as b6,dl as b7,kt as b8,Rx as b9,rn as ba,cx as bb,OI as bc,Ea as bd,hm as be,Er as bf,He as bg,dx as bh,Or as bi,is as bj,zE as bk,wf as bl,Ts as bm,rl as bn,d9 as bo,AU as c,ss as d,mo as e,Wn as f,zt as g,ae as h,xr as i,Ge as j,Om as k,pu as l,Kt as m,mT as n,Nz as o,Im as p,$c as q,wi as r,$e as s,fM as t,Yc as u,Cz as v,pT as w,g9 as x,Ma as y,El as z};
|