1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1675],{31476:function(e,t,i){let r,a,o,l,h,c,d,p,f,m,g,v,y,x,b,w,S,_,A,M,E,C,T,P,D,O,I,R,L,B,z,F,N,U,k,V,j,G,H,W,q,X,Y,Q,Z,K,J,$,ee,et,ei,er,es,ea,en,eo,el,eh,ec,ed,eu,ep,ef,em,eg,ev,ey,ex,eb,ew,eS,e_,eA,eM,eE,eC,eT,eP,eD,eO,eI,eR,eL,eB,ez,eF,eN,eU,ek,eV,ej,eG,eH,eW,eq,eX,eY,eQ,eZ,eK,eJ,e$,e0,e1,e2,e3,e4,e5,e6,e8,e9,e7,te,tt,ti,tr,ts,ta,tn,to,tl,th,tc,td,tu,tp,tf,tm,tg,tv,ty,tx,tb;i.r(t),i.d(t,{Application:function(){return Fu},Axis:function(){return gc},Easing:function(){return gA},GradientType:function(){return g4},NoiseType:function(){return g9},PatternStyle:function(){return vt},ProjectionType:function(){return g8},Side:function(){return gY},TextureFilter:function(){return g6},ToonType:function(){return ve},VoronoiStyle:function(){return g7},Wrapping:function(){return g5}});var tw,tS,t_=i(28070),tA=i(13787).lW,tM=Object.create,tE=Object.defineProperty,tC=Object.getOwnPropertyDescriptor,tT=Object.getOwnPropertyNames,tP=Object.getPrototypeOf,tD=Object.prototype.hasOwnProperty,tO=(e,t,i)=>t in e?tE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,tI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tR=(e,t,i,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of tT(t))tD.call(e,a)||a===i||tE(e,a,{get:()=>t[a],enumerable:!(r=tC(t,a))||r.enumerable});return e},tL=(e,t,i)=>(i=null!=e?tM(tP(e)):{},tR(!t&&e&&e.__esModule?i:tE(i,"default",{value:e,enumerable:!0}),e)),tB=(e,t,i)=>(tO(e,"symbol"!=typeof t?t+"":t,i),i),tz=tI((e,t)=>{var i;i=function(){return e.importState=function(t){var i=new e;return i.importState(t),i},e;function e(){return function(e){var t,i,r=0,a=0,o=0,l=1;0==e.length&&(e=[+new Date]);var h=(t=4022871197,(i=function(e){e=e.toString();for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));t=r>>>0,r-=t,r*=t,t=r>>>0,r-=t,t+=4294967296*r}return(t>>>0)*23283064365386963e-26}).version="Mash 0.9",i);r=h(" "),a=h(" "),o=h(" ");for(var c=0;c<e.length;c++)(r-=h(e[c]))<0&&(r+=1),(a-=h(e[c]))<0&&(a+=1),(o-=h(e[c]))<0&&(o+=1);h=null;var d=function(){var e=2091639*r+23283064365386963e-26*l;return r=a,a=o,o=e-(l=0|e)};return d.next=d,d.uint32=function(){return 4294967296*d()},d.fract53=function(){return d()+(2097152*d()|0)*11102230246251565e-32},d.version="Alea 0.9",d.args=e,d.exportState=function(){return[r,a,o,l]},d.importState=function(e){r=+e[0]||0,a=+e[1]||0,o=+e[2]||0,l=+e[3]||0},d}(Array.prototype.slice.call(arguments))}},"object"==typeof e?t.exports=i():"function"==typeof define&&define.amd?define(i):e.Alea=i()}),tF=tI((e,t)=>{var i,r;i=e,r=function(e){e.SVD=function(e,t,i,r,a){if(t=void 0===t||t,i=void 0===i||i,a=1e-64/(r=r||2220446049250313e-31),!e)throw TypeError("Matrix a is not defined");var o,l,h,c,d,p,f,m,g,v,y,x,b=e[0].length,w=e.length;if(w<b)throw TypeError("Invalid matrix: m < n");for(var S=[],_=[],A=[],M="f"===t?w:b,E=v=f=0;E<w;E++)_[E]=Array(M).fill(0);for(E=0;E<b;E++)A[E]=Array(b).fill(0);var C,T=Array(b).fill(0);for(E=0;E<w;E++)for(o=0;o<b;o++)_[E][o]=e[E][o];for(E=0;E<b;E++){for(S[E]=f,g=0,h=E+1,o=E;o<w;o++)g+=Math.pow(_[o][E],2);if(g<a)f=0;else for(m=(p=_[E][E])*(f=p<0?Math.sqrt(g):-Math.sqrt(g))-g,_[E][E]=p-f,o=h;o<b;o++){for(g=0,l=E;l<w;l++)g+=_[l][E]*_[l][o];for(p=g/m,l=E;l<w;l++)_[l][o]=_[l][o]+p*_[l][E]}for(T[E]=f,g=0,o=h;o<b;o++)g+=Math.pow(_[E][o],2);if(g<a)f=0;else{for(m=(p=_[E][E+1])*(f=p<0?Math.sqrt(g):-Math.sqrt(g))-g,_[E][E+1]=p-f,o=h;o<b;o++)S[o]=_[E][o]/m;for(o=h;o<w;o++){for(g=0,l=h;l<b;l++)g+=_[o][l]*_[E][l];for(l=h;l<b;l++)_[o][l]=_[o][l]+g*S[l]}}v<(y=Math.abs(T[E])+Math.abs(S[E]))&&(v=y)}if(i)for(E=b-1;0<=E;E--){if(0!==f){for(m=_[E][E+1]*f,o=h;o<b;o++)A[o][E]=_[E][o]/m;for(o=h;o<b;o++){for(g=0,l=h;l<b;l++)g+=_[E][l]*A[l][o];for(l=h;l<b;l++)A[l][o]=A[l][o]+g*A[l][E]}}for(o=h;o<b;o++)A[E][o]=0,A[o][E]=0;A[E][E]=1,f=S[E],h=E}if(t){if("f"===t)for(E=b;E<w;E++){for(o=b;o<w;o++)_[E][o]=0;_[E][E]=1}for(E=b-1;0<=E;E--){for(h=E+1,f=T[E],o=h;o<M;o++)_[E][o]=0;if(0!==f){for(m=_[E][E]*f,o=h;o<M;o++){for(g=0,l=h;l<w;l++)g+=_[l][E]*_[l][o];for(p=g/m,l=E;l<w;l++)_[l][o]=_[l][o]+p*_[l][E]}for(o=E;o<w;o++)_[o][E]=_[o][E]/f}else for(o=E;o<w;o++)_[o][E]=0;_[E][E]=_[E][E]+1}}for(r*=v,l=b-1;0<=l;l--)for(var P=0;P<50;P++){for(C=!1,h=l;0<=h;h--){if(Math.abs(S[h])<=r){C=!0;break}if(Math.abs(T[h-1])<=r)break}if(!C){for(d=0,c=h-(g=1),E=h;E<l+1&&(p=g*S[E],S[E]=d*S[E],!(Math.abs(p)<=r));
1E++)if(f=T[E],T[E]=Math.sqrt(p*p+f*f),d=f/(m=T[E]),g=-p/m,t)for(o=0;o<w;o++)y=_[o][c],x=_[o][E],_[o][c]=y*d+x*g,_[o][E]=-y*g+x*d}if(x=T[l],h===l){if(x<0&&(T[l]=-x,i))for(o=0;o<b;o++)A[o][l]=-A[o][l];break}for(v=T[h],f=Math.sqrt((p=(((y=T[l-1])-x)*(y+x)+((f=S[l-1])-(m=S[l]))*(f+m))/(2*m*y))*p+1),p=((v-x)*(v+x)+m*(y/(p<0?p-f:p+f)-m))/v,E=h+(g=d=1);E<l+1;E++){if(f=S[E],y=T[E],m=g*f,f*=d,x=Math.sqrt(p*p+m*m),p=v*(d=p/(S[E-1]=x))+f*(g=m/x),f=-v*g+f*d,m=y*g,y*=d,i)for(o=0;o<b;o++)v=A[o][E-1],x=A[o][E],A[o][E-1]=v*d+x*g,A[o][E]=-v*g+x*d;if(x=Math.sqrt(p*p+m*m),p=(d=p/(T[E-1]=x))*f+(g=m/x)*y,v=-g*f+d*y,t)for(o=0;o<w;o++)y=_[o][E-1],x=_[o][E],_[o][E-1]=y*d+x*g,_[o][E]=-y*g+x*d}S[h]=0,S[l]=p,T[l]=v}for(E=0;E<b;E++)T[E]<r&&(T[E]=0);return{u:_,q:T,v:A}},e.VERSION="1.1.1",Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof e&&"u">typeof t?r(e):"function"==typeof define&&define.amd?define(["exports"],r):r((i="u">typeof globalThis?globalThis:i||self).SVDJS={})}),tN=tI((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)},t.exports=e.default}),tU=tI((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()},t.exports=e.default}),tk=tI((e,t)=>{function i(e,t,r,a){this.message=e,this.expected=t,this.found=r,this.location=a,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,i)}!function(e,t){function i(){this.constructor=e}i.prototype=t.prototype,e.prototype=new i}(i,Error),i.buildMessage=function(e,t){var i={literal:function(e){return'"'+a(e.text)+'"'},class:function(e){var t,i="";for(t=0;t<e.parts.length;t++)i+=e.parts[t]instanceof Array?o(e.parts[t][0])+"-"+o(e.parts[t][1]):o(e.parts[t]);return"["+(e.inverted?"^":"")+i+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function a(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+r(e)})}return"Expected "+function(e){var t,r,a,o=Array(e.length);for(r=0;r<e.length;r++)o[r]=i[(t=e[r]).type](t);if(o.sort(),o.length>0){for(r=1,a=1;r<o.length;r++)o[r-1]!==o[r]&&(o[a]=o[r],a++);o.length=a}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+(t?'"'+a(t)+'"':"end of input")+" found."},t.exports={SyntaxError:i,parse:function(e,t){t=void 0!==t?t:{};var r,a,o,l,h,c,d,p,f={},m={svg_path:eh},g=eh,v=function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t=t.concat.apply(t,e[i]);var r=t[0];return r&&"m"==r.code&&(delete r.relative,r.code="M"),t},y=function(e,t){return function(e,t){if(!t)return[e];for(var i=[e],r=0,a=t.length;r<a;r++)i[r+1]=t[r][1];return i}(e,t)},x=/^[Mm]/,b=en(["M","m"],!1,!1),w=function(e,t,i){var r=eO(e,[t]);return i&&(r=r.concat(eO("M"==e?"L":"l",i[1]))),r},S=/^[Zz]/,_=en(["Z","z"],!1,!1),A=/^[Ll]/,M=en(["L","l"],!1,!1),E=function(e,t){return eO(e,t)},C=/^[Hh]/,T=en(["H","h"],!1,!1),P=/^[Vv]/,D=en(["V","v"],!1,!1),O=/^[Cc]/,I=en(["C","c"],!1,!1),R=/^[Ss]/,L=en(["S","s"],!1,!1),B=/^[Qq]/,z=en(["Q","q"],!1,!1),F=/^[Tt]/,N=en(["T","t"],!1,!1),U=/^[Aa]/,k=en(["A","a"],!1,!1),V=/^[01]/,j=en(["0","1"],!1,!1),G=function(){return""},H=ea(",",!1),W=function(e){return e.join("")},q=ea(".",!1),X=/^[eE]/,Y=en(["e","E"],!1,!1),Q=/^[+\-]/,Z=en(["+","-"],!1,!1),K=/^[0-9]/,J=en([["0","9"]],!1,!1),$=/^[ \t\n\r]/,ee=en([" "," ",` 2`,"\r"],!1,!1),et=0,ei=[{line:1,column:1}],er=0,es=[];if("startRule"in t){if(!(t.startRule in m))throw Error("Can't start parsing from rule \""+t.startRule+'".');g=m[t.startRule]}function ea(e,t){return{type:"literal",text:e,ignoreCase:t}}function en(e,t,i){return{type:"class",parts:e,inverted:t,ignoreCase:i}}function eo(t){var i,r=ei[t];if(r)return r;for(i=t-1;!ei[i];)i--;for(r={line:(r=ei[i]).line,column:r.column};i<t;)10===e.charCodeAt(i)?(r.line++,r.column=1):r.column++,i++;return ei[t]=r,r}function el(e){et<er||(et>er&&(er=et,es=[]),es.push(e))}function eh(){var e,t,i,r,a;for(e=et,t=[],i=eT();i!==f;)t.push(i),i=eT();if(t!==f){if((i=function(){var e,t,i,r,a,o;if(e=et,(t=ec())!==f){for(i=[],r=et,a=[],o=eT();o!==f;)a.push(o),o=eT();for(a!==f&&(o=ec())!==f?r=a=[a,o]:(et=r,r=f);r!==f;){for(i.push(r),r=et,a=[],o=eT();o!==f;)a.push(o),o=eT();a!==f&&(o=ec())!==f?r=a=[a,o]:(et=r,r=f)}i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}())===f&&(i=null),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f?e=t=v(i):(et=e,e=f)}else et=e,e=f}else et=e,e=f;return e}function ec(){var t,i,r,a,o,l;if(t=et,(i=function(){var t,i,r,a,o,l,h;if(t=et,x.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(b)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=ey())!==f?(o=et,(l=eS())===f&&(l=null),l!==f&&(h=eu())!==f?o=l=[l,h]:(et=o,o=f),o===f&&(o=null),o!==f?t=i=w(i,a,o):(et=t,t=f)):(et=t,t=f)}else et=t,t=f;return t}())!==f){for(r=[],a=et,o=[],l=eT();l!==f;)o.push(l),l=eT();for(o!==f&&(l=ed())!==f?a=o=[o,l]:(et=a,a=f);a!==f;){for(r.push(a),a=et,o=[],l=eT();l!==f;)o.push(l),l=eT();o!==f&&(l=ed())!==f?a=o=[o,l]:(et=a,a=f)}r!==f?t=i=y(i,r):(et=t,t=f)}else et=t,t=f;return t}function ed(){var t,i;return S.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(_)),i!==f&&(i=eO("Z")),(t=i)===f&&(t=function(){var t,i,r,a;if(t=et,A.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(M)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=eu())!==f?t=i=E(i,a):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,C.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(T)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=ep())!==f?t=i=eO(i,a.map(function(e){return{x:e}})):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,P.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(D)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=ep())!==f?t=i=eO(i,a.map(function(e){return{y:e}})):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,O.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(I)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=function(){var e,t,i,r,a,o;if(e=et,(t=ef())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=ef())!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=ef())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}())!==f?t=i=E(i,a):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,R.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(L)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=function(){var e,t,i,r,a,o;if(e=et,(t=em())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=em())!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=em())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}())!==f?t=i=E(i,a):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,B.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(z)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=function(){var e,t,i,r,a,o;if(e=et,(t=eg())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=eg())!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=eg())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}())!==f?t=i=E(i,a):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,F.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(N)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=function(){var e,t,i,r,a,o;if(e=et,(t=ey())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=ey())!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=ey())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}())!==f?t=i=E(i,a):(et=t,t=f)}else et=t,t=f;return t}())===f&&(t=function(){var t,i,r,a;if(t=et,U.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(k)),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f&&(a=function(){var e,t,i,r,a,o;if(e=et,(t=ev())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=ev())!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=ev())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}())!==f?t=i=E(i,a):(et=t,t=f)}else et=t,t=f;return t}()),t}function eu(){var e,t,i,r,a,o;if(e=et,(t=ey())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=ey())!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=ey())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}function ep(){var e,t,i,r,a,o;if(e=et,(t=eb())!==f){for(i=[],r=et,(a=eS())===f&&(a=null),a!==f&&(o=eb()
2)!==f?r=a=[a,o]:(et=r,r=f);r!==f;)i.push(r),r=et,(a=eS())===f&&(a=null),a!==f&&(o=eb())!==f?r=a=[a,o]:(et=r,r=f);i!==f?e=t=y(t,i):(et=e,e=f)}else et=e,e=f;return e}function ef(){var e,t,i,r,a,o,l,h,c;return e=et,(t=ey())!==f?((i=eS())===f&&(i=null),i!==f&&(r=ey())!==f?((a=eS())===f&&(a=null),a!==f&&(o=ey())!==f?(l=t,h=r,c=o,e=t={x1:l.x,y1:l.y,x2:h.x,y2:h.y,x:c.x,y:c.y}):(et=e,e=f)):(et=e,e=f)):(et=e,e=f),e}function em(){var e,t,i,r,a,o;return e=et,(t=ey())!==f?((i=eS())===f&&(i=null),i!==f&&(r=ey())!==f?(a=t,o=r,e=t={x2:a.x,y2:a.y,x:o.x,y:o.y}):(et=e,e=f)):(et=e,e=f),e}function eg(){var e,t,i,r,a,o;return e=et,(t=ey())!==f?((i=eS())===f&&(i=null),i!==f&&(r=ey())!==f?(a=t,o=r,e=t={x1:a.x,y1:a.y,x:o.x,y:o.y}):(et=e,e=f)):(et=e,e=f),e}function ev(){var e,t,i,r,a,o,l,h,c,d,p,m;return e=et,(t=ex())!==f?((i=eS())===f&&(i=null),i!==f&&(r=ex())!==f?((a=eS())===f&&(a=null),a!==f&&(o=eb())!==f&&eS()!==f&&(l=ew())!==f?((h=eS())===f&&(h=null),h!==f&&(c=ew())!==f?((d=eS())===f&&(d=null),d!==f&&(p=ey())!==f?e=t={rx:t,ry:r,xAxisRotation:o,largeArc:l,sweep:c,x:(m=p).x,y:m.y}:(et=e,e=f)):(et=e,e=f)):(et=e,e=f)):(et=e,e=f)):(et=e,e=f),e}function ey(){var e,t,i,r;return e=et,(t=eb())!==f?((i=eS())===f&&(i=null),i!==f&&(r=eb())!==f?e=t={x:t,y:r}:(et=e,e=f)):(et=e,e=f),e}function ex(){var e;return(e=eA())===f&&(e=eC()),e!==f&&(e*=1),e}function eb(){var e,t,i;return e=et,(t=eE())===f&&(t=null),t!==f&&(i=eA())!==f?e=t=[t,i]:(et=e,e=f),e===f&&(e=et,(t=eE())===f&&(t=null),t!==f&&(i=eC())!==f?e=t=[t,i]:(et=e,e=f)),e!==f&&(e=1*e.join("")),e}function ew(){var t;return V.test(e.charAt(et))?(t=e.charAt(et),et++):(t=f,el(j)),t!==f&&(t="1"==t),t}function eS(){var e,t,i,r,a;if(e=et,t=[],(i=eT())!==f)for(;i!==f;)t.push(i),i=eT();else t=f;if(t!==f){if((i=e_())===f&&(i=null),i!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f?e=t=[t,i,r]:(et=e,e=f)}else et=e,e=f}else et=e,e=f;if(e===f){if(e=et,t=et,(i=e_())!==f){for(r=[],a=eT();a!==f;)r.push(a),a=eT();r!==f?t=i=[i,r]:(et=t,t=f)}else et=t,t=f;t!==f&&(t=G()),e=t}return e}function e_(){var t;return 44===e.charCodeAt(et)?(t=",",et++):(t=f,el(H)),t}function eA(){var t,i,r,a,o,l,h;return t=et,(a=et,(o=eC())===f&&(o=null),o!==f?(46===e.charCodeAt(et)?(l=".",et++):(l=f,el(q)),l!==f&&(h=eC())!==f?a=o=[o,l,h]:(et=a,a=f)):(et=a,a=f),a===f&&(a=et,(o=eC())!==f?(46===e.charCodeAt(et)?(l=".",et++):(l=f,el(q)),l!==f?a=o=[o,l]:(et=a,a=f)):(et=a,a=f)),a!==f&&(a=W(a)),(i=a)!==f)?((r=eM())===f&&(r=null),r!==f?t=i=[i,r]:(et=t,t=f)):(et=t,t=f),t===f&&(t=et,(i=eC())!==f&&(r=eM())!==f?t=i=[i,r]:(et=t,t=f)),t!==f&&(t=W(t)),t}function eM(){var t,i,r,a;return t=et,X.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(Y)),i!==f?((r=eE())===f&&(r=null),r!==f&&(a=eC())!==f?t=i=[i,r,a]:(et=t,t=f)):(et=t,t=f),t!==f&&(t=W(t)),t}function eE(){var t;return Q.test(e.charAt(et))?(t=e.charAt(et),et++):(t=f,el(Z)),t}function eC(){var t,i;if(t=[],K.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(J)),i!==f)for(;i!==f;)t.push(i),K.test(e.charAt(et))?(i=e.charAt(et),et++):(i=f,el(J));else t=f;return t!==f&&(t=t.join("")),t}function eT(){var t;return $.test(e.charAt(et))?(t=e.charAt(et),et++):(t=f,el(ee)),t!==f&&(t=G()),t}var eP={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var eD in eP)eP[eD.toUpperCase()]=eP[eD];function eO(e,t){t||(t=[{}]);for(var i=t.length;i--;){var r={code:e,command:eP[e]};for(var a in e==e.toLowerCase()&&(r.relative=!0),t[i])r[a]=t[i][a];t[i]=r}return t}if((p=g())!==f&&et===e.length)return p;throw p!==f&&et<e.length&&el({type:"end"}),h=es,c=er<e.length?e.charAt(er):null,r=er,a=er<e.length?er+1:er,o=eo(r),l=eo(a),d={start:{offset:r,line:o.line,column:o.column},end:{offset:a,line:l.line,column:l.column}},new i(i.buildMessage(h,c),h,c,d)}}}),tV=tI((e,t)=>{var i=tk().parse;i.parseSVG=i,i.makeAbsolute=function(e){var t,i={x:0,y:0},r={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return e.forEach(function(e){for(var a in"moveto"===e.command&&(t=e),e.x0=i.x,e.y0=i.y,r)a in e&&(e[a]+=e.relative?e[r[a]]:0);"x"in e||(e.x=i.x),"y"in e||(e.y=i.y),e.relative=!1,e.code=e.code.toUpperCase(),"closepath"==e.command&&(e.x=t.x,e.y=t.y),i=e}),e},t.exports=i}),tj=tI((e,t)=>{t.exports=function(e,t){for(var i=e.split("."),r=t.split("."),a=0;a<3;a++){var o=Number(i[a]),l=Number(r[a]);if(o>l)return 1;if(l>o)return -1;if(!isNaN(o)&&isNaN(l))return 1;if(isNaN(o)&&!isNaN(l))return -1}return 0}}),tG={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},tH="srgb",tW="srgb-linear",tq="300 es",tX=class{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let i=t.slice(0);for(let t=0,r=i.length;t<r;t++)i[t].call(this,e);e.target=null}}},tY=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
25","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],tQ=1234567,tZ=Math.PI/180,tK=180/Math.PI;function tJ(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(tY[255&e]+tY[e>>8&255]+tY[e>>16&255]+tY[e>>24&255]+"-"+tY[255&t]+tY[t>>8&255]+"-"+tY[t>>16&15|64]+tY[t>>24&255]+"-"+tY[63&i|128]+tY[i>>8&255]+"-"+tY[i>>16&255]+tY[i>>24&255]+tY[255&r]+tY[r>>8&255]+tY[r>>16&255]+tY[r>>24&255]).toLowerCase()}function t$(e,t,i){return Math.max(t,Math.min(i,e))}function t0(e,t){return(e%t+t)%t}function t1(e,t,i){return(1-i)*e+i*t}function t2(e){return(e&e-1)==0&&0!==e}function t3(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function t4(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function t5(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function t6(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}var t8=Object.freeze({__proto__:null,DEG2RAD:tZ,RAD2DEG:tK,ceilPowerOfTwo:t3,clamp:t$,damp:function(e,t,i,r){return t1(e,t,1-Math.exp(-i*r))},degToRad:function(e){return e*tZ},denormalize:t5,euclideanModulo:t0,floorPowerOfTwo:t4,generateUUID:tJ,inverseLerp:function(e,t,i){return e!==t?(i-e)/(t-e):0},isPowerOfTwo:t2,lerp:t1,mapLinear:function(e,t,i,r,a){return r+(e-t)*(a-r)/(i-t)},normalize:t6,pingpong:function(e,t=1){return t-Math.abs(t0(e,2*t)-t)},radToDeg:function(e){return e*tK},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},seededRandom:function(e){void 0!==e&&(tQ=e);let t=tQ+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},setQuaternionFromProperEuler:function(e,t,i,r,a){let o=Math.cos,l=Math.sin,h=o(i/2),c=l(i/2),d=o((t+r)/2),p=l((t+r)/2),f=o((t-r)/2),m=l((t-r)/2),g=o((r-t)/2),v=l((r-t)/2);switch(a){case"XYX":e.set(h*p,c*f,c*m,h*d);break;case"YZY":e.set(c*m,h*p,c*f,h*d);break;case"ZXZ":e.set(c*f,c*m,h*p,h*d);break;case"XZX":e.set(h*p,c*v,c*g,h*d);break;case"YXY":e.set(c*g,h*p,c*v,h*d);break;case"ZYZ":e.set(c*v,c*g,h*p,h*d);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+a)}},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)}}),t9=class{constructor(e=0,t=0){t9.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw 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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 5,859 bytes, line 2
2sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+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){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*i-o*r+e.x,this.y=a*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},t7=class{constructor(){t7.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,a,o,l,h,c){let d=this.elements;return d[0]=e,d[1]=r,d[2]=l,d[3]=t,d[4]=a,d[5]=h,d[6]=i,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let 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){let i=e.elements,r=t.elements,a=this.elements,o=i[0],l=i[3],h=i[6],c=i[1],d=i[4],p=i[7],f=i[2],m=i[5],g=i[8],v=r[0],y=r[3],x=r[6],b=r[1],w=r[4],S=r[7],_=r[2],A=r[5],M=r[8];return a[0]=o*v+l*b+h*_,a[3]=o*y+l*w+h*A,a[6]=o*x+l*S+h*M,a[1]=c*v+d*b+p*_,a[4]=c*y+d*w+p*A,a[7]=c*x+d*S+p*M,a[2]=f*v+m*b+g*_,a[5]=f*y+m*w+g*A,a[8]=f*x+m*S+g*M,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8];return t*o*d-t*l*c-i*a*d+i*l*h+r*a*c-r*o*h}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],p=d*o-l*c,f=l*h-d*a,m=c*a-o*h,g=t*p+i*f+r*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);let v=1/g;return e[0]=p*v,e[1]=(r*c-d*i)*v,e[2]=(l*i-r*o)*v,e[3]=f*v,e[4]=(d*t-r*h)*v,e[5]=(r*a-l*t)*v,e[6]=m*v,e[7]=(i*h-c*t)*v,e[8]=(o*t-i*a)*v,this}transpose(){let e,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){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,a,o,l){let h=Math.cos(a),c=Math.sin(a);return this.set(i*h,i*c,-i*(h*o+c*l)+o+e,-r*c,r*h,-r*(-c*o+h*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(ie.makeScale(e,t)),this}rotate(e){return this.premultiply(ie.makeRotation(-e)),this}translate(e,t){return this.premultiply(ie.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},ie=new t7;function it(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var ii={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ir(e,t){return new ii[e](t)}function is(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function ia(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}
2function io(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var il={[tH]:{[tW]:ia},[tW]:{[tH]:io}},ih={legacyMode:!0,get workingColorSpace(){return tW},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,i){if(this.legacyMode||t===i||!t||!i)return e;if(il[t]&&void 0!==il[t][i]){let r=il[t][i];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},ic={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},id={r:0,g:0,b:0},iu={h:0,s:0,l:0},ip={h:0,s:0,l:0};function im(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}function ig(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var iv=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===t&&void 0===i?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tH){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,ih.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=ih.workingColorSpace){return this.r=e,this.g=t,this.b=i,ih.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=ih.workingColorSpace){if(e=t0(e,1),t=t$(t,0,1),i=t$(i,0,1),0===t)this.r=this.g=this.b=i;else{let r=i<=.5?i*(1+t):i+t-i*t,a=2*i-r;this.r=im(a,r,e+1/3),this.g=im(a,r,e),this.b=im(a,r,e-1/3)}return ih.toWorkingColorSpace(this,r),this}setStyle(e,t=tH){let i;function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,ih.toWorkingColorSpace(this,t),r(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,ih.toWorkingColorSpace(this,t),r(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){let i=parseFloat(e[1])/360,a=parseFloat(e[2])/100,o=parseFloat(e[3])/100;return r(e[4]),this.setHSL(i,a,o,t)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let e=i[1],r=e.length;if(3===r)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,ih.toWorkingColorSpace(this,t),this;if(6===r)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,ih.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=tH){let i=ic[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ia(e.r),this.g=ia(e.g),this.b=ia(e.b),this}copyLinearToSRGB(e){return this.r=io(e.r),this.g=io(e.g),this.b=io(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tH){return ih.fromWorkingColorSpace(ig(this,id),e),t$(255*id.r,0,255)<<16^t$(255*id.g,0,255)<<8^t$(255*id.b,0,255)<<0}getHexString(e=tH){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ih.workingColorSpace){ih.fromWorkingColorSpace(ig(this,id),t);let i=id.r,r=id.g,a=id.b,o=Math.max(i,r,a),l=Math.min(i,r,a),h,c,d=(l+o)/2;if(l===o)h=0,c=0;else{let e=o-l;
2switch(c=d<=.5?e/(o+l):e/(2-o-l),o){case i:h=(r-a)/e+(r<a?6:0);break;case r:h=(a-i)/e+2;break;case a:h=(i-r)/e+4}h/=6}return e.h=h,e.s=c,e.l=d,e}getRGB(e,t=ih.workingColorSpace){return ih.fromWorkingColorSpace(ig(this,id),t),e.r=id.r,e.g=id.g,e.b=id.b,e}getStyle(e=tH){return ih.fromWorkingColorSpace(ig(this,id),e),e!==tH?`color(${e} ${id.r} ${id.g} ${id.b})`:`rgb(${255*id.r|0},${255*id.g|0},${255*id.b|0})`}offsetHSL(e,t,i){return this.getHSL(iu),iu.h+=e,iu.s+=t,iu.l+=i,this.setHSL(iu.h,iu.s,iu.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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(iu),e.getHSL(ip);let i=t1(iu.h,ip.h,t),r=t1(iu.s,ip.s,t),a=t1(iu.l,ip.l,t);return this.setHSL(i,r,a),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};iv.NAMES=ic;var iy,ix=class{static getDataURL(e){let t;if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===iy&&(iy=is("canvas")),iy.width=e.width,iy.height=e.height;let i=iy.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=iy}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("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=is("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),a=r.data;for(let e=0;e<a.length;e++)a[e]=255*ia(a[e]/255);return i.putImageData(r,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*ia(t[e]/255
2)):t[e]=ia(t[e]);return{data:t,width:e.width,height:e.height}}}},ib=class{constructor(e=null){this.isSource=!0,this.uuid=tJ(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(null!==r){let e;if(Array.isArray(r)){e=[];for(let t=0,i=r.length;t<i;t++)r[t].isDataTexture?e.push(iw(r[t].image)):e.push(iw(r[t]))}else e=iw(r);i.url=e}return t||(e.images[this.uuid]=i),i}};function iw(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?ix.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var iS=0,i_=class extends tX{constructor(e=i_.DEFAULT_IMAGE,t=i_.DEFAULT_MAPPING,i=1001,r=1001,a=1006,o=1008,l=1023,h=1009,c=i_.DEFAULT_ANISOTROPY,d=3e3){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:iS++}),this.uuid=tJ(),this.name="",this.source=new ib(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=r,this.magFilter=a,this.minFilter=o,this.anisotropy=c,this.format=l,this.internalFormat=null,this.type=h,this.offset=new t9(0,0),this.repeat=new t9(1,1),this.center=new t9(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new t7,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=d,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){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={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,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}};i_.DEFAULT_IMAGE=null,i_.DEFAULT_MAPPING=300,i_.DEFAULT_ANISOTROPY=1;var iA=class{constructor(e=0,t=0,i=0,r=1){iA.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,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,i,r){return this.x=e,this.y=t,this.z=i,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 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 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=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}
2sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*a,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*a,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*a,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,a,o=e.elements,l=o[0],h=o[4],c=o[8],d=o[1],p=o[5],f=o[9],m=o[2],g=o[6],v=o[10];if(.01>Math.abs(h-d)&&.01>Math.abs(c-m)&&.01>Math.abs(f-g)){if(.1>Math.abs(h+d)&&.1>Math.abs(c+m)&&.1>Math.abs(f+g)&&.1>Math.abs(l+p+v-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(l+1)/2,o=(p+1)/2,y=(v+1)/2,x=(h+d)/4,b=(c+m)/4,w=(f+g)/4;return e>o&&e>y?e<.01?(i=0,r=.707106781,a=.707106781):(r=x/(i=Math.sqrt(e)),a=b/i):o>y?o<.01?(i=.707106781,r=0,a=.707106781):(i=x/(r=Math.sqrt(o)),a=w/r):y<.01?(i=.707106781,r=.707106781,a=0):(i=b/(a=Math.sqrt(y)),r=w/a),this.set(i,r,a,t),this}let y=Math.sqrt((g-f)*(g-f)+(c-m)*(c-m)+(d-h)*(d-h));return .001>Math.abs(y)&&(y=1),this.x=(g-f)/y,this.y=(c-m)/y,this.z=(d-h)/y,this.w=Math.acos((l+p+v-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){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},iM=class extends tX{constructor(e=1,t=1,i={}
2){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new iA(0,0,e,t),this.scissorTest=!1,this.viewport=new iA(0,0,e,t),this.texture=new i_({width:e,height:t,depth:1},i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,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;let t=Object.assign({},e.texture.image);return this.texture.source=new ib(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},iE=class extends i_{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},iC=class extends i_{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},iT=class extends iM{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;let a=this.texture;this.texture=[];for(let e=0;e<i;e++)this.texture[e]=a.clone(),this.texture[e].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,a=this.texture.length;r<a;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;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,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}},iP=class{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,a,o,l){let h=i[r+0],c=i[r+1],d=i[r+2],p=i[r+3],f=a[o+0],m=a[o+1],g=a[o+2],v=a[o+3];if(0===l){e[t+0]=h,e[t+1]=c,e[t+2]=d,e[t+3]=p;return}if(1===l){e[t+0]=f,e[t+1]=m,e[t+2]=g,e[t+3]=v;return}if(p!==v||h!==f||c!==m||d!==g){let e=1-l,t=h*f+c*m+d*g+p*v,i=t>=0?1:-1,r=1-t*t;if(r>Number.EPSILON){let a=Math.sqrt(r),o=Math.atan2(a,t*i);e=Math.sin(e*o)/a,l=Math.sin(l*o)/a}let a=l*i;if(h=h*e+f*a,c=c*e+m*a,d=d*e+g*a,p=p*e+v*a,e===1-l){let e=1/Math.sqrt(h*h+c*c+d*d+p*p);h*=e,c*=e,d*=e,p*=e}}e[t]=h,e[t+1]=c,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,i,r,a,o){let l=i[r],h=i[r+1],c=i[r+2],d=i[r+3],p=a[o],f=a[o+1],m=a[o+2],g=a[o+3];return e[t]=l*g+d*p+h*m-c*f,e[t+1]=h*g+d*f+c*p-l*m,e[t+2]=c*g+d*m+l*f-h*p,e[t+3]=d*g-l*p-h*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,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){let i=e._x,r=e._y,a=e._z,o=e._order,l=Math.cos,h=Math.sin,c=l(i/2),d=l(r/2),p=l(a/2),f=h(i/2),m=h(r/2),g=h(a/2);switch(o){case"XYZ":this._x=f*d*p+c*m*g,this._y=c*m*p-f*d*g,this._z=c*d*g+f*m*p,this._w=c*d*p-f*m*g;break;case"YXZ":this._x=f*d*p+c*m*g,this._y=c*m*p-f*d*g,this._z=c*d*g-f*m*p,this._w=c*d*p+f*m*g;break;case"ZXY":this._x=f*d*p-c*m*g,this._y=c*m*p+f*d*g,this._z=c*d*g+f*m*p,this._w=c*d*p-f*m*g;break;case"ZYX":this._x=f*d*p-c*m*g,this._y=c*m*p+f*d*g,this._z=c*d*g-f*m*p,this._w=c*d*p+f*m*g;break;case"YZX":this._x=f*d*p+c*m*g,this._y=c*m*p+f*d*g,this._z=c*d*g-f*m*p,this._w=c*d*p-f*m*g;break;case"XZY":this._x=f*d*p-c*m*g,this._y=c*m*p-f*d*g,this._z=c*d*g+f*m*p,this._w=c*d*p+f*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],a=t[8],o=t[1],l=t[5],h=t[9],c=t[2],d=t[6],p=t[10],f=i+l+p;if(f>0){let e=.5/Math.sqrt(f+1);this._w=.25/e,this._x=(d-h)*e,this._y=(a-c)*e,this._z=(o-r)*e}else if(i>l&&i>p){let e=2*Math.sqrt(1+i-l-p);this._w=(d-h)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(a+c)/e}else if(l>p){let e=2*Math.sqrt(1+l-i-p);this._w=(a-c)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(h+d)/e}else{let e=2*Math.sqrt(1+p-i-l);this._w=(o-r)/e,this._x=(a+c)/e,this._y=(h+d)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>
vendor: 4,509 bytes, line 2
2Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(t$(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let r=Math.min(1,t/i);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 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,r=e._y,a=e._z,o=e._w,l=t._x,h=t._y,c=t._z,d=t._w;return this._x=i*d+o*l+r*c-a*h,this._y=r*d+o*h+a*l-i*c,this._z=a*d+o*c+i*h-r*l,this._w=o*d-i*l-r*h-a*c,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,r=this._y,a=this._z,o=this._w,l=o*e._w+i*e._x+r*e._y+a*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=i,this._y=r,this._z=a,this;let h=1-l*l;if(h<=Number.EPSILON){let e=1-t;return this._w=e*o+t*this._w,this._x=e*i+t*this._x,this._y=e*r+t*this._y,this._z=e*a+t*this._z,this.normalize(),this._onChangeCallback(),this}let c=Math.sqrt(h),d=Math.atan2(c,l),p=Math.sin((1-t)*d)/c,f=Math.sin(t*d)/c;return this._w=o*p+this._w*f,this._x=i*p+this._x*f,this._y=r*p+this._y*f,this._z=a*p+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),a=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(a),i*Math.cos(a),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}},iD=class{constructor(e=0,t=0,i=0){iD.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw 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 Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(iI.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(iI.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,a=e.elements;return this.x=a[0]*t+a[3]*i+a[6]*r,this.y=a[1]*t+a[4]*i+a[7]*r,this.z=a[2]*t+a[5]*i+a[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,a=e.elements,o=1/(a[3]*t+a[7]*i+a[11]*r+a[15]);
2return this.x=(a[0]*t+a[4]*i+a[8]*r+a[12])*o,this.y=(a[1]*t+a[5]*i+a[9]*r+a[13])*o,this.z=(a[2]*t+a[6]*i+a[10]*r+a[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,a=e.x,o=e.y,l=e.z,h=e.w,c=h*t+o*r-l*i,d=h*i+l*t-a*r,p=h*r+a*i-o*t,f=-a*t-o*i-l*r;return this.x=c*h+-(f*a)+-(d*l)- -(p*o),this.y=d*h+-(f*o)+-(p*a)- -(c*l),this.z=p*h+-(f*l)+-(c*o)- -(d*a),this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r,this.y=a[1]*t+a[5]*i+a[9]*r,this.z=a[2]*t+a[6]*i+a[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){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,a=e.z,o=t.x,l=t.y,h=t.z;return this.x=r*h-a*l,this.y=a*o-i*h,this.z=i*l-r*o,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return iO.copy(this).projectOnVector(e),this.sub(iO)}reflect(e){return this.sub(iO.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(t$(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+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,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},iO=new iD,iI=new iP,iR=class{constructor(e=new iD(1/0,1/0,1/0),t=new iD(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,r=1/0,a=-1/0,o=-1/0,l=-1/0;for(let h=0,c=e.length;h<c;h+=3){let c=e[h],d=e[h+1],p=e[h+2];c<t&&(t=c),d<i&&(i=d),p<r&&(r=p),c>a&&(a=c),d>o&&(o=d),p>l&&(l=p)}return this.min.set(t,i,r),this.max.set(a,o,l),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,a=-1/0,o=-1/0,l=-1/0;for(let h=0,c=e.count;h<c;h++){let c=e.getX(h),d=e.getY(h),p=e.getZ(h);c<t&&(t=c),d<i&&(i=d),p<r&&(r=p),c>a&&(a=c),d>o&&(o=d),p>l&&(l=p)}return this.min.set(t,i,r),this.max.set(a,o,l),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=iB.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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);let i=e.geometry;if(void 0!==i){if(t&&null!=i.attributes&&void 0!==i.attributes.position){let t=i.attributes.position;for(let i=0,r=t.count;i<r;i++)iB.fromBufferAttribute(t,i).applyMatrix4(e.matrixWorld),this.expandByPoint(iB)}else null===i.boundingBox&&i.computeBoundingBox(),iz.copy(i.boundingBox),iz.applyMatrix4(e.matrixWorld),this.union(iz)}let r=e.children;for(let e=0,i=r.length;e<i;e++)this.expandByObject(r[e],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,iB),iB.distanceToSquared(e.center)<=e.radius*e.radiu
2s}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(iG),iH.subVectors(this.max,iG),iF.subVectors(e.a,iG),iN.subVectors(e.b,iG),iU.subVectors(e.c,iG),ik.subVectors(iN,iF),iV.subVectors(iU,iN),ij.subVectors(iF,iU);let t=[0,-ik.z,ik.y,0,-iV.z,iV.y,0,-ij.z,ij.y,ik.z,0,-ik.x,iV.z,0,-iV.x,ij.z,0,-ij.x,-ik.y,ik.x,0,-iV.y,iV.x,0,-ij.y,ij.x,0];return!!(iX(t,iF,iN,iU,iH)&&iX(t=[1,0,0,0,1,0,0,0,1],iF,iN,iU,iH))&&(iW.crossVectors(ik,iV),iX(t=[iW.x,iW.y,iW.z],iF,iN,iU,iH))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return iB.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(iB).length(),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()||(iL[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),iL[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),iL[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),iL[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),iL[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),iL[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),iL[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),iL[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(iL)),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)}},iL=[new iD,new iD,new iD,new iD,new iD,new iD,new iD,new iD],iB=new iD,iz=new iR,iF=new iD,iN=new iD,iU=new iD,ik=new iD,iV=new iD,ij=new iD,iG=new iD,iH=new iD,iW=new iD,iq=new iD;function iX(e,t,i,r,a){for(let o=0,l=e.length-3;o<=l;o+=3){iq.fromArray(e,o);let l=a.x*Math.abs(iq.x)+a.y*Math.abs(iq.y)+a.z*Math.abs(iq.z),h=t.dot(iq),c=i.dot(iq),d=r.dot(iq);if(Math.max(-Math.max(h,c,d),Math.min(h,c,d))>l)return!1}return!0}var iY=new iR,iQ=new iD,iZ=new iD,iK=class{constructor(e=new iD,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):iY.setFromPoints(e).getCenter(i);let r=0;for(let t=0,a=e.length;t<a;t++)r=Math.max(r,i.distanceToSquared(e[t]));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){let 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){let i=this.center.distanceToSquared(e);return t.copy(e),i>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.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;iQ.subVectors(e,this.center);let t=iQ.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(iQ,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(iZ.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(iQ.copy(e.center).add(iZ)),this.expandByPoint(iQ.copy(e.center).sub(iZ)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},iJ=new iD,i$=new iD,i0=new iD,i1=new iD,i2=new iD,i3=new iD,i4=new iD,i5=class{constructor(e=new iD,t=new iD(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,iJ)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=iJ.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(iJ.copy(this.direction).multiplyScalar(t).add(this.origin),iJ.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){i$.copy(e).add(t).multiplyScalar(.5),i0.copy(t).sub(e).normalize(),i1.copy(this.origin).sub(i$);let a=.5*e.distanceTo(t),o=-this.direction.dot(i0),l=i1.dot(this.direction),h=-i1.dot(i0),c=i1.lengthSq(),d=Math.abs(1-o*o),p,f,m,g;if(d>0){if(p=o*h-l,f=o*l-h,g=a*d,p>=0){if(f>=-g){if(f<=g){let e=1/d;p*=e,f*=e,m=p*(p+o*f+2*l)+f*(o*p+f+2*h)+c}else m=-(p=Math.max(0,-(o*(f=a)+l)))*p+f*(f+2*h)+c}else m=-(p=Math.max(0,-(o*(f=-a)+l)))*p+f*(f+2*h)+c}else f<=-g?(f=(p=Math.max(0,-(-o*a+l)))>0?-a:Math.min(Math.max(-a,-h),a),m=-p*p+f*(f+2*h)+c):f<=g?(p=0,m=(f=Math.min(Math.max(-a,-h),a))*(f+2*h)+c):(f=(p=Math.max(0,-(o*a+l)))>0?a:Math.min(Math.max(-a,-h),a),m=-p*p+f*(f+2*h)+c)}else f=o>0?-a:a,m=-(p=Math.max(0,-(o*f+l)))*p+f*(f+2*h)+c;
vendor: 4,217 bytes, line 2
2return i&&i.copy(this.direction).multiplyScalar(p).add(this.origin),r&&r.copy(i0).multiplyScalar(f).add(i$),m}intersectSphere(e,t){iJ.subVectors(e.center,this.origin);let i=iJ.dot(this.direction),r=iJ.dot(iJ)-i*i,a=e.radius*e.radius;if(r>a)return null;let o=Math.sqrt(a-r),l=i-o,h=i+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){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,a,o,l,h,c=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),d>=0?(a=(e.min.y-f.y)*d,o=(e.max.y-f.y)*d):(a=(e.max.y-f.y)*d,o=(e.min.y-f.y)*d),i>o||a>r||((a>i||isNaN(i))&&(i=a),(o<r||isNaN(r))&&(r=o),p>=0?(l=(e.min.z-f.z)*p,h=(e.max.z-f.z)*p):(l=(e.max.z-f.z)*p,h=(e.min.z-f.z)*p),i>h||l>r)||((l>i||i!=i)&&(i=l),(h<r||r!=r)&&(r=h),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return null!==this.intersectBox(e,iJ)}intersectTriangle(e,t,i,r,a){i2.subVectors(t,e),i3.subVectors(i,e),i4.crossVectors(i2,i3);let o=this.direction.dot(i4),l;if(o>0){if(r)return null;l=1}else{if(!(o<0))return null;l=-1,o=-o}i1.subVectors(this.origin,e);let h=l*this.direction.dot(i3.crossVectors(i1,i3));if(h<0)return null;let c=l*this.direction.dot(i2.cross(i1));if(c<0||h+c>o)return null;let d=-l*i1.dot(i4);return d<0?null:this.at(d/o,a)}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)}},i6=class{constructor(){i6.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,a,o,l,h,c,d,p,f,m,g,v,y){let x=this.elements;return x[0]=e,x[4]=t,x[8]=i,x[12]=r,x[1]=a,x[5]=o,x[9]=l,x[13]=h,x[2]=c,x[6]=d,x[10]=p,x[14]=f,x[3]=m,x[7]=g,x[11]=v,x[15]=y,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 i6().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,r=1/i8.setFromMatrixColumn(e,0).length(),a=1/i8.setFromMatrixColumn(e,1).length(),o=1/i8.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*a,t[5]=i[5]*a,t[6]=i[6]*a,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,a=e.z,o=Math.cos(i),l=Math.sin(i),h=Math.cos(r),c=Math.sin(r),d=Math.cos(a),p=Math.sin(a);if("XYZ"===e.order){let e=o*d,i=o*p,r=l*d,a=l*p;t[0]=h*d,t[4]=-h*p,t[8]=c,t[1]=i+r*c,t[5]=e-a*c,t[9]=-l*h,t[2]=a-e*c,t[6]=r+i*c,t[10]=o*h}else if("YXZ"===e.order){let e=h*d,i=h*p,r=c*d,a=c*p;t[0]=e+a*l,t[4]=r*l-i,t[8]=o*c,t[1]=o*p,t[5]=o*d,t[9]=-l,t[2]=i*l-r,t[6]=a+e*l,t[10]=o*h}else if("ZXY"===e.order){let e=h*d,i=h*p,r=c*d,a=c*p;t[0]=e-a*l,t[4]=-o*p,t[8]=r+i*l,t[1]=i+r*l,t[5]=o*d,t[9]=a-e*l,t[2]=-o*c,t[6]=l,t[10]=o*h}else if("ZYX"===e.order){let e=o*d,i=o*p,r=l*d,a=l*p;t[0]=h*d,t[4]=r*c-i,t[8]=e*c+a,t[1]=h*p,t[5]=a*c+e,t[9]=i*c-r,t[2]=-c,t[6]=l*h,t[10]=o*h}else if("YZX"===e.order){let e=o*h,i=o*c,r=l*h,a=l*c;t[0]=h*d,t[4]=a-e*p,t[8]=r*p+i,t[1]=p,t[5]=o*d,t[9]=-l*d,t[2]=-c*d,t[6]=i*p+r,t[10]=e-a*p}
2else if("XZY"===e.order){let e=o*h,i=o*c,r=l*h,a=l*c;t[0]=h*d,t[4]=-p,t[8]=c*d,t[1]=e*p+a,t[5]=o*d,t[9]=i*p-r,t[2]=r*p-i,t[6]=l*d,t[10]=a*p+e}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(i7,e,re)}lookAt(e,t,i){let r=this.elements;return rr.subVectors(e,t),0===rr.lengthSq()&&(rr.z=1),rr.normalize(),rt.crossVectors(i,rr),0===rt.lengthSq()&&(1===Math.abs(i.z)?rr.x+=1e-4:rr.z+=1e-4,rr.normalize(),rt.crossVectors(i,rr)),rt.normalize(),ri.crossVectors(rr,rt),r[0]=rt.x,r[4]=ri.x,r[8]=rr.x,r[1]=rt.y,r[5]=ri.y,r[9]=rr.y,r[2]=rt.z,r[6]=ri.z,r[10]=rr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,a=this.elements,o=i[0],l=i[4],h=i[8],c=i[12],d=i[1],p=i[5],f=i[9],m=i[13],g=i[2],v=i[6],y=i[10],x=i[14],b=i[3],w=i[7],S=i[11],_=i[15],A=r[0],M=r[4],E=r[8],C=r[12],T=r[1],P=r[5],D=r[9],O=r[13],I=r[2],R=r[6],L=r[10],B=r[14],z=r[3],F=r[7],N=r[11],U=r[15];return a[0]=o*A+l*T+h*I+c*z,a[4]=o*M+l*P+h*R+c*F,a[8]=o*E+l*D+h*L+c*N,a[12]=o*C+l*O+h*B+c*U,a[1]=d*A+p*T+f*I+m*z,a[5]=d*M+p*P+f*R+m*F,a[9]=d*E+p*D+f*L+m*N,a[13]=d*C+p*O+f*B+m*U,a[2]=g*A+v*T+y*I+x*z,a[6]=g*M+v*P+y*R+x*F,a[10]=g*E+v*D+y*L+x*N,a[14]=g*C+v*O+y*B+x*U,a[3]=b*A+w*T+S*I+_*z,a[7]=b*M+w*P+S*R+_*F,a[11]=b*E+w*D+S*L+_*N,a[15]=b*C+w*O+S*B+_*U,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[4],r=e[8],a=e[12],o=e[1],l=e[5],h=e[9],c=e[13],d=e[2],p=e[6],f=e[10],m=e[14];return e[3]*(+a*h*p-r*c*p-a*l*f+i*c*f+r*l*m-i*h*m)+e[7]*(+t*h*m-t*c*f+a*o*f-r*o*m+r*c*d-a*h*d)+e[11]*(+t*c*p-t*l*m-a*o*p+i*o*m+a*l*d-i*c*d)+e[15]*(-r*l*d-t*h*p+t*l*f+r*o*p-i*o*f+i*h*d)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let 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]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],p=e[9],f=e[10],m=e[11],g=e[12],v=e[13],y=e[14],x=e[15],b=p*y*c-v*f*c+v*h*m-l*y*m-p*h*x+l*f*x,w=g*f*c-d*y*c-g*h*m+o*y*m+d*h*x-o*f*x,S=d*v*c-g*p*c+g*l*m-o*v*m-d*l*x+o*p*x,_=g*p*h-d*v*h-g*l*f+o*v*f+d*l*y-o*p*y,A=t*b+i*w+r*S+a*_;if(0===A)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let M=1/A;return e[0]=b*M,e[1]=(v*f*a-p*y*a-v*r*m+i*y*m+p*r*x-i*f*x)*M,e[2]=(l*y*a-v*h*a+v*r*c-i*y*c-l*r*x+i*h*x)*M,e[3]=(p*h*a-l*f*a-p*r*c+i*f*c+l*r*m-i*h*m)*M,e[4]=w*M,e[5]=(d*y*a-g*f*a+g*r*m-t*y*m-d*r*x+t*f*x)*M,e[6]=(g*h*a-o*y*a-g*r*c+t*y*c+o*r*x-t*h*x)*M,e[7]=(o*f*a-d*h*a+d*r*c-t*f*c-o*r*m+t*h*m)*M,e[8]=S*M,e[9]=(g*p*a-d*v*a-g*i*m+t*v*m+d*i*x-t*p*x)*M,e[10]=(o*v*a-g*l*a+g*i*c-t*v*c-o*i*x+t*l*x)*M,e[11]=(d*l*a-o*p*a-d*i*c+t*p*c+o*i*m-t*l*m)*M,e[12]=_*M,e[13]=(d*v*r-g*p*r+g*i*f-t*v*f-d*i*y+t*p*y)*M,e[14]=(g*l*r-o*v*r-g*i*h+t*v*h+o*i*y-t*l*y)*M,e[15]=(o*p*r-d*l*r+d*i*h-t*p*h-o*i*f+t*l*f)*M,this}scale(e){let t=this.elements,i=e.x,r=e.y,a=e.z;return t[0]*=i,t[4]*=r,t[8]*=a,t[1]*=i,t[5]*=r,t[9]*=a,t[2]*=i,t[6]*=r,t[10]*=a,t[3]*=i,t[7]*=r,t[11]*=a,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),a=1-i,o=e.x,l=e.y,h=e.z,c=a*o,d=a*l;return this.set(c*o+i,c*l-r*h,c*h+r*l,0,c*l+r*h,d*l+i,d*h-r*o,0,c*h-r*l,d*h+r*o,a*h*h+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,a,o){return this.set(1,i,a,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,a=t._x,o=t._y,l=t._z,h=t._w,c=a+a,d=o+o,p=l+l,f=a*c,m=a*d,g=a*p,v=o*d,y=o*p,x=l*p,b=h*c,w=h*d,S=h*p,_=i.x,A=i.y,M=i.z;return r[0]=(1-(v+x))*_,r[1]=(m+S)*_,r[2]=(g-w)*_,r[3]=0,r[4]=(m-S)*A,r[5]=(1-(f+x))*A,r[6]=(y+b)*A,r[7]=0,r[8]=(g+w)*M,r[9]=(y-b)*M,r[10]=(1-(f+v))*M,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements,a=i8.set(r[0],r[1],r[2]).length(),o=i8.set(r[4],r[5],r[6]).length(),l=i8.set(r[8],r[9],r[10]).length();0>this.determinant()&&(a=-a),e.x=r[12],e.y=r[13],e.z=r[14],i9.copy(this);let h=1/a,c=1/o,d=1/l;return i9.elements[0]*=h,i9.elements[1]*=h,i9.elements[2]*=h,i9.elements[4]*=c,i9.elements[5]*=c,i9.elements[6]*=c,i9.elements[8]*=d,i9.elements[9]*=d,i9.elements[10]*=d,t.setFromRotationMatrix(i9),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,a,o){let l=this.elements;return l[0]=2*a/(t-e),l[4]=0,l[8]=(t+e)/(t-e),l[12]=0,l[1]=0,l[5]=2*a/(i-r),l[9]=(i+r)/(i-r),l[13]=0,l[2]=0,l[6]=0,l[10
2]=-(o+a)/(o-a),l[14]=-2*o*a/(o-a),l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,a,o){let l=this.elements,h=1/(t-e),c=1/(i-r),d=1/(o-a);return l[0]=2*h,l[4]=0,l[8]=0,l[12]=-((t+e)*h),l[1]=0,l[5]=2*c,l[9]=0,l[13]=-((i+r)*c),l[2]=0,l[6]=0,l[10]=-2*d,l[14]=-((o+a)*d),l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},i8=new iD,i9=new i6,i7=new iD(0,0,0),re=new iD(1,1,1),rt=new iD,ri=new iD,rr=new iD,rs=new i6,ra=new iP,rn=class{constructor(e=0,t=0,i=0,r=rn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,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,i,r=this._order){return this._x=e,this._y=t,this._z=i,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,i=!0){let r=e.elements,a=r[0],o=r[4],l=r[8],h=r[1],c=r[5],d=r[9],p=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(t$(l,-1,1)),.9999999>Math.abs(l)?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-t$(d,-1,1)),.9999999>Math.abs(d)?(this._y=Math.atan2(l,m),this._z=Math.atan2(h,c)):(this._y=Math.atan2(-p,a),this._z=0);break;case"ZXY":this._x=Math.asin(t$(f,-1,1)),.9999999>Math.abs(f)?(this._y=Math.atan2(-p,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(h,a));break;case"ZYX":this._y=Math.asin(-t$(p,-1,1)),.9999999>Math.abs(p)?(this._x=Math.atan2(f,m),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(t$(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(l,m));break;case"XZY":this._z=Math.asin(-t$(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(f,c),this._y=Math.atan2(l,a)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return rs.makeRotationFromQuaternion(e),this.setFromRotationMatrix(rs,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ra.setFromEuler(this),this.setFromQuaternion(ra,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],void 0!==e[3]&&(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}};rn.DEFAULT_ORDER="XYZ";var ro=class{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}},rl=0,rh=new iD,rc=new iP,rd=new i6,ru=new iD,rp=new iD,rf=new iD,rm=new iP,rg=new iD(1,0,0),rv=new iD(0,1,0),ry=new iD(0,0,1),rx={type:"added"},rb={type:"removed"},rw=class extends tX{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:rl++}),this.uuid=tJ(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rw.DEFAULT_UP.clone();
2let e=new iD,t=new rn,i=new iP,r=new iD(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new i6},normalMatrix:{value:new t7}}),this.matrix=new i6,this.matrixWorld=new i6,this.matrixAutoUpdate=rw.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=rw.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new ro,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 rc.setFromAxisAngle(e,t),this.quaternion.multiply(rc),this}rotateOnWorldAxis(e,t){return rc.setFromAxisAngle(e,t),this.quaternion.premultiply(rc),this}rotateX(e){return this.rotateOnAxis(rg,e)}rotateY(e){return this.rotateOnAxis(rv,e)}rotateZ(e){return this.rotateOnAxis(ry,e)}translateOnAxis(e,t){return rh.copy(e).applyQuaternion(this.quaternion),this.position.add(rh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(rg,e)}translateY(e){return this.translateOnAxis(rv,e)}translateZ(e){return this.translateOnAxis(ry,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(rd.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?ru.copy(e):ru.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),rp.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rd.lookAt(rp,ru,this.up):rd.lookAt(ru,rp,this.up),this.quaternion.setFromRotationMatrix(rd),r&&(rd.extractRotation(r.matrixWorld),rc.setFromRotationMatrix(rd),this.quaternion.premultiply(rc.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(rx)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(rb)),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(rb)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),rd.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),rd.multiply(e.parent.matrixWorld)),e.applyMatrix4(rd),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 i=0,r=this.children.length;i<r;i++){let r=this.children[i].getObjectByProperty(e,t);if(void 0!==r)return r}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let r=0,a=this.children.length;r<a;r++){let a=this.children[r].getObjectsByProperty(e,t);a.length>0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rp,e,rf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rp,rm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(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)&&(null===this.parent?this.matrixWorld.copy(this.matrix
2):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++){let r=t[i];(!0===r.matrixWorldAutoUpdate||!0===e)&&r.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++){let i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let r={};function a(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),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&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=a(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let r=i[t];a(e.shapes,r)}else a(e.shapes,i)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let t=[];for(let i=0,r=this.material.length;i<r;i++)t.push(a(e.materials,this.material[i]));r.material=t}else r.material=a(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];r.animations.push(a(e.animations,i))}}if(t){let t=o(e.geometries),r=o(e.materials),a=o(e.textures),l=o(e.images),h=o(e.shapes),c=o(e.skeletons),d=o(e.animations),p=o(e.nodes);t.length>0&&(i.geometries=t),r.length>0&&(i.materials=r),a.length>0&&(i.textures=a),l.length>0&&(i.images=l),h.length>0&&(i.shapes=h),c.length>0&&(i.skeletons=c),d.length>0&&(i.animations=d),p.length>0&&(i.nodes=p)}return i.object=r,i;function o(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}};rw.DEFAULT_UP=new iD(0,1,0),rw.DEFAULT_MATRIX_AUTO_UPDATE=!0,rw.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var rS=new iD,r_=new iD,rA=new iD,rM=new iD,rE=new iD,rC=new iD,rT=new iD,rP=new iD,rD=new iD,rO=new iD,rI=class{constructor(e=new iD,t=new iD,i=new iD){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),rS.subVectors(e,t),r.cross(rS);let a=r.lengthSq();return a>0?r.multiplyScalar(1/Math.sqrt(a)):r.set(0,0,0)}static getBarycoord(e,t,i,r,a){rS.subVectors(r,t),r_.subVectors(i,t),rA.subVectors(e,t);let o=rS.dot(rS),l=rS.dot(r_),h=rS.dot(rA),c=r_.dot(r_),d=r_.dot(rA),p=o*c-l*l;if(0===p)return a.set(-2,-1,-1);let f=1/p,m=(c*h-l*d)*f,g=(o*d-l*h)*f;return a.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,rM),rM.x>=0&&rM.y>=0&&rM.x+rM.y<=1}static getUV(e,t,i,r,a,o,l,h){return this.getBarycoord(e,t,i,r,rM),h.set(0,0),h.addScaledVector(a,rM.x),h.addScaledVector(o,rM.y),h.addScaledVector(l,rM.z),h}static isFrontFacing(e,t,i,r){return rS.subVectors(i,t),r_.subVectors(e,t),0>rS.cross(r_).dot(r)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),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}
2getArea(){return rS.subVectors(this.c,this.b),r_.subVectors(this.a,this.b),.5*rS.cross(r_).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rI.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rI.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,a){return rI.getUV(e,this.a,this.b,this.c,t,i,r,a)}containsPoint(e){return rI.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rI.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,r=this.b,a=this.c,o,l;rE.subVectors(r,i),rC.subVectors(a,i),rP.subVectors(e,i);let h=rE.dot(rP),c=rC.dot(rP);if(h<=0&&c<=0)return t.copy(i);rD.subVectors(e,r);let d=rE.dot(rD),p=rC.dot(rD);if(d>=0&&p<=d)return t.copy(r);let f=h*p-d*c;if(f<=0&&h>=0&&d<=0)return o=h/(h-d),t.copy(i).addScaledVector(rE,o);rO.subVectors(e,a);let m=rE.dot(rO),g=rC.dot(rO);if(g>=0&&m<=g)return t.copy(a);let v=m*c-h*g;if(v<=0&&c>=0&&g<=0)return l=c/(c-g),t.copy(i).addScaledVector(rC,l);let y=d*g-m*p;if(y<=0&&p-d>=0&&m-g>=0)return rT.subVectors(a,r),l=(p-d)/(p-d+(m-g)),t.copy(r).addScaledVector(rT,l);let x=1/(y+v+f);return o=v*x,l=f*x,t.copy(i).addScaledVector(rE,o).addScaledVector(rC,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},rR=0,rL=class extends tX{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rR++}),this.uuid=tJ(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.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(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let r=this[t];if(void 0===r){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(e){let t=[];for(let i in e){let r=e[i];delete r.metadata,t.push(r)}return t}
vendor: 11,949 bytes, line 2
2if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(i.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=r(e.textures),a=r(e.images);t.length>0&&(i.textures=t),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let r=0;r!==e;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}},rB=class extends rL{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new iv(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=0,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}},rz=new iD,rF=new t9,rN=class{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,a=this.itemSize;r<a;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)rF.fromBufferAttribute(this,t),rF.applyMatrix3(e),this.setXY(t,rF.x,rF.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)rz.fromBufferAttribute(this,t),rz.applyMatrix3(e),this.setXYZ(t,rz.x,rz.y,rz.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)rz.fromBufferAttribute(this,t),rz.applyMatrix4(e),this.setXYZ(t,rz.x,rz.y,rz.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)rz.fromBufferAttribute(this,t),rz.applyNormalMatrix(e),this.setXYZ(t,rz.x,rz.y,rz.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)rz.fromBufferAttribute(this,t),rz.transformDirection(e),this.setXYZ(t,rz.x,rz.y,rz.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=t5(t,this.array)),t}setX(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=t5(t,this.array)),t}setY(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=t5(t,this.array)),t}setZ(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=t5(t,this.array)),t}setW(e,t){return this.normalized&&(t=t6(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,a){return e*=this.itemSize,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array),a=t6(a,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=a,this}
2onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}},rU=class extends rN{constructor(e,t,i){super(new Uint16Array(e),t,i)}},rk=class extends rN{constructor(e,t,i){super(new Uint32Array(e),t,i)}},rV=class extends rN{constructor(e,t,i){super(new Float32Array(e),t,i)}},rj=0,rG=new i6,rH=new rw,rW=new iD,rq=new iR,rX=new iR,rY=new iD,rQ=class extends tX{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:rj++}),this.uuid=tJ(),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(it(e)?rk:rU)(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 void 0!==this.attributes[e]}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new t7().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return rG.makeRotationFromQuaternion(e),this.applyMatrix4(rG),this}rotateX(e){return rG.makeRotationX(e),this.applyMatrix4(rG),this}rotateY(e){return rG.makeRotationY(e),this.applyMatrix4(rG),this}rotateZ(e){return rG.makeRotationZ(e),this.applyMatrix4(rG),this}translate(e,t,i){return rG.makeTranslation(e,t,i),this.applyMatrix4(rG),this}scale(e,t,i){return rG.makeScale(e,t,i),this.applyMatrix4(rG),this}lookAt(e){return rH.lookAt(e),rH.updateMatrix(),this.applyMatrix4(rH.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rW).negate(),this.translate(rW.x,rW.y,rW.z),this}setFromPoints(e){let t=[];for(let i=0,r=e.length;i<r;i++){let r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new rV(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new iR);let 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 "fal
2se".',this),this.boundingBox.set(new iD(-1/0,-1/0,-1/0),new iD(1/0,1/0,1/0));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];rq.setFromBufferAttribute(i),this.morphTargetsRelative?(rY.addVectors(this.boundingBox.min,rq.min),this.boundingBox.expandByPoint(rY),rY.addVectors(this.boundingBox.max,rq.max),this.boundingBox.expandByPoint(rY)):(this.boundingBox.expandByPoint(rq.min),this.boundingBox.expandByPoint(rq.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(){null===this.boundingSphere&&(this.boundingSphere=new iK);let 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 "fal
2se".',this),this.boundingSphere.set(new iD,1/0);return}if(e){let i=this.boundingSphere.center;if(rq.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];rX.setFromBufferAttribute(i),this.morphTargetsRelative?(rY.addVectors(rq.min,rX.min),rq.expandByPoint(rY),rY.addVectors(rq.max,rX.max),rq.expandByPoint(rY)):(rq.expandByPoint(rX.min),rq.expandByPoint(rX.max))}rq.getCenter(i);let r=0;for(let t=0,a=e.count;t<a;t++)rY.fromBufferAttribute(e,t),r=Math.max(r,i.distanceToSquared(rY));if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],l=this.morphTargetsRelative;for(let t=0,a=o.count;t<a;t++)rY.fromBufferAttribute(o,t),l&&(rW.fromBufferAttribute(e,t),rY.add(rW)),r=Math.max(r,i.distanceToSquared(rY))}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(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.array,r=t.position.array,a=t.normal.array,o=t.uv.array,l=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new rN(new Float32Array(4*l),4));let h=this.getAttribute("tangent").array,c=[],d=[];for(let e=0;e<l;e++)c[e]=new iD,d[e]=new iD;let p=new iD,f=new iD,m=new iD,g=new t9,v=new t9,y=new t9,x=new iD,b=new iD,w=this.groups;0===w.length&&(w=[{start:0,count:i.length}]);for(let e=0,t=w.length;e<t;++e){let t=w[e],a=t.start,l=t.count;for(let e=a,t=a+l;e<t;e+=3)!function(e,t,i){p.fromArray(r,3*e),f.fromArray(r,3*t),m.fromArray(r,3*i),g.fromArray(o,2*e),v.fromArray(o,2*t),y.fromArray(o,2*i),f.sub(p),m.sub(p),v.sub(g),y.sub(g);let a=1/(v.x*y.y-y.x*v.y);isFinite(a)&&(x.copy(f).multiplyScalar(y.y).addScaledVector(m,-v.y).multiplyScalar(a),b.copy(m).multiplyScalar(v.x).addScaledVector(f,-y.x).multiplyScalar(a),c[e].add(x),c[t].add(x),c[i].add(x),d[e].add(b),d[t].add(b),d[i].add(b))}(i[e+0],i[e+1],i[e+2])}let S=new iD,_=new iD,A=new iD,M=new iD;function E(e){A.fromArray(a,3*e),M.copy(A);let t=c[e];S.copy(t),S.sub(A.multiplyScalar(A.dot(t))).normalize(),_.crossVectors(M,t);let i=0>_.dot(d[e])?-1:1;h[4*e]=S.x,h[4*e+1]=S.y,h[4*e+2]=S.z,h[4*e+3]=i}for(let e=0,t=w.length;e<t;++e){let t=w[e],r=t.start,a=t.count;for(let e=r,t=r+a;e<t;e+=3)E(i[e+0]),E(i[e+1]),E(i[e+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new rN(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let r=new iD,a=new iD,o=new iD,l=new iD,h=new iD,c=new iD,d=new iD,p=new iD;if(e)for(let f=0,m=e.count;f<m;f+=3){let m=e.getX(f+0),g=e.getX(f+1),v=e.getX(f+2);r.fromBufferAttribute(t,m),a.fromBufferAttribute(t,g),o.fromBufferAttribute(t,v),d.subVectors(o,a),p.subVectors(r,a),d.cross(p),l.fromBufferAttribute(i,m),h.fromBufferAttribute(i,g),c.fromBufferAttribute(i,v),l.add(d),h.add(d),c.add(d),i.setXYZ(m,l.x,l.y,l.z),i.setXYZ(g,h.x,h.y,h.z),i.setXYZ(v,c.x,c.y,c.z)}else for(let e=0,l=t.count;e<l;e+=3)r.fromBufferAttribute(t,e+0),a.fromBufferAttribute(t,e+1),o.fromBufferAttribute(t,e+2),d.subVectors(o,a),p.subVectors(r,a),d.cross(p),i.setXYZ(e+0,d.x,d.y,d.z),i.setXYZ(e+1,d.x,d.y,d.z),i.setXYZ(e+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)rY.fromBufferAttribute(e,t),rY.normalize(),e.setXYZ(t,rY.x,rY.y,rY.z)}toNonIndexed(){function e(e,t){let i=e.array,r=e.itemSize,a=e.normalized,o=new i.constructor(t.length*r),l=0,h=0;for(let a=0,c=t.length;a<c;a++){l=e.isInterleavedBufferAttribute?t[a]*e.data.stride+e.offset:t[a]*r;for(let e=0;e<r;e++)o[h++]=i[l++]}return new rN(o,r,a)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new rQ,i=this.index.array,r=this.attributes;for(let a in r){let o=e(r[a],i);t.setAttribute(a,o)}let a=this.morphAttributes;for(let r in a){let o=[],l=a[r];for(let t=0,r=l.length;t<r;t++){let r=e(l[t],i);o.push(r)}t.morphAttributes[r]=o}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,i=o.length;e<i;e++){let i=o[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
2if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let r=i[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},a=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],o=[];for(let t=0,r=i.length;t<r;t++){let r=i[t];o.push(r.toJSON(e.data))}o.length>0&&(r[t]=o,a=!0)}a&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let l=this.boundingSphere;return null!==l&&(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;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let r=e.attributes;for(let e in r){let i=r[e];this.setAttribute(e,i.clone(t))}let a=e.morphAttributes;for(let e in a){let i=[],r=a[e];for(let e=0,a=r.length;e<a;e++)i.push(r[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];this.addGroup(t.start,t.count,t.materialIndex)}let l=e.boundingBox;null!==l&&(this.boundingBox=l.clone());let h=e.boundingSphere;return null!==h&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}},rZ=new i6,rK=new i5,rJ=new iK,r$=new iD,r0=new iD,r1=new iD,r2=new iD,r3=new iD,r4=new t9,r5=new t9,r6=new t9,r8=new iD,r9=new iD,r7=class extends rw{constructor(e=new rQ,t=new rB){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,a=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let l=this.morphTargetInfluences;if(a&&l){r3.set(0,0,0);for(let i=0,r=a.length;i<r;i++){let r=l[i],h=a[i];0!==r&&(r2.fromBufferAttribute(h,e),o?r3.addScaledVector(r2,r):r3.addScaledVector(r2.sub(t),r))}t.add(r3)}return this.isSkinnedMesh&&this.boneTransform(e,t),t}raycast(e,t){let i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0===r||(null===i.boundingSphere&&i.computeBoundingSphere(),rJ.copy(i.boundingSphere),rJ.applyMatrix4(a),!1===e.ray.intersectsSphere(rJ))||(rZ.copy(a).invert(),rK.copy(e.ray).applyMatrix4(rZ),null!==i.boundingBox&&!1===rK.intersectsBox(i.boundingBox)))return;let o,l=i.index,h=i.attributes.position,c=i.attributes.uv,d=i.attributes.uv2,p=i.groups,f=i.drawRange;if(null!==l){if(Array.isArray(r))for(let i=0,a=p.length;i<a;i++){let a=p[i],h=r[a.materialIndex],m=Math.max(a.start,f.start),g=Math.min(l.count,Math.min(a.start+a.count,f.start+f.count));for(let i=m;i<g;i+=3)(o=se(this,h,e,rK,c,d,l.getX(i),l.getX(i+1),l.getX(i+2)))&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=a.materialIndex,t.push(o))}else{let i=Math.max(0,f.start),a=Math.min(l.count,f.start+f.count);for(let h=i;h<a;h+=3)(o=se(this,r,e,rK,c,d,l.getX(h),l.getX(h+1),l.getX(h+2)))&&(o.faceIndex=Math.floor(h/3),t.pu
2sh(o))}}else if(void 0!==h){if(Array.isArray(r))for(let i=0,a=p.length;i<a;i++){let a=p[i],l=r[a.materialIndex],m=Math.max(a.start,f.start),g=Math.min(h.count,Math.min(a.start+a.count,f.start+f.count));for(let i=m;i<g;i+=3)(o=se(this,l,e,rK,c,d,i,i+1,i+2))&&(o.faceIndex=Math.floor(i/3),o.face.materialIndex=a.materialIndex,t.push(o))}else{let i=Math.max(0,f.start),a=Math.min(h.count,f.start+f.count);for(let l=i;l<a;l+=3)(o=se(this,r,e,rK,c,d,l,l+1,l+2))&&(o.faceIndex=Math.floor(l/3),t.push(o))}}}};function se(e,t,i,r,a,o,l,h,c){e.getVertexPosition(l,r$),e.getVertexPosition(h,r0),e.getVertexPosition(c,r1);let d=function(e,t,i,r,a,o,l,h){if(null===(1===t.side?r.intersectTriangle(l,o,a,!0,h):r.intersectTriangle(a,o,l,0===t.side,h)))return null;r9.copy(h),r9.applyMatrix4(e.matrixWorld);let c=i.ray.origin.distanceTo(r9);return c<i.near||c>i.far?null:{distance:c,point:r9.clone(),object:e}}(e,t,i,r,r$,r0,r1,r8);if(d){a&&(r4.fromBufferAttribute(a,l),r5.fromBufferAttribute(a,h),r6.fromBufferAttribute(a,c),d.uv=rI.getUV(r8,r$,r0,r1,r4,r5,r6,new t9)),o&&(r4.fromBufferAttribute(o,l),r5.fromBufferAttribute(o,h),r6.fromBufferAttribute(o,c),d.uv2=rI.getUV(r8,r$,r0,r1,r4,r5,r6,new t9));let e={a:l,b:h,c:c,normal:new iD,materialIndex:0};rI.getNormal(r$,r0,r1,e.normal),d.face=e}return d}var st=class extends rQ{constructor(e=1,t=1,i=1,r=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:a,depthSegments:o};let l=this;r=Math.floor(r),a=Math.floor(a);let h=[],c=[],d=[],p=[],f=0,m=0;function g(e,t,i,r,a,o,g,v,y,x,b){let w=o/y,S=g/x,_=o/2,A=g/2,M=v/2,E=y+1,C=x+1,T=0,P=0,D=new iD;for(let o=0;o<C;o++){let l=o*S-A;for(let h=0;h<E;h++){let f=h*w-_;D[e]=f*r,D[t]=l*a,D[i]=M,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[i]=v>0?1:-1,d.push(D.x,D.y,D.z),p.push(h/y),p.push(1-o/x),T+=1}}for(let e=0;e<x;e++)for(let t=0;t<y;t++){let i=f+t+E*e,r=f+t+E*(e+1),a=f+(t+1)+E*(e+1),o=f+(t+1)+E*e;h.push(i,r,o),h.push(r,a,o),P+=6}l.addGroup(m,P,b),m+=P,f+=T}g("z","y","x",-1,-1,i,t,e,o=Math.floor(o),a,0),g("z","y","x",1,-1,i,t,-e,o,a,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,3),g("x","y","z",1,-1,e,t,i,r,a,4),g("x","y","z",-1,-1,e,t,-i,r,a,5),this.setIndex(h),this.setAttribute("position",new rV(c,3)),this.setAttribute("normal",new rV(d,3)),this.setAttribute("uv",new rV(p,2))}static fromJSON(e){return new st(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function si(e){let t={};for(let i in e)for(let r in t[i]={},e[i]){let a=e[i][r];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?t[i][r]=a.clone():Array.isArray(a)?t[i][r]=a.slice():t[i][r]=a}return t}function sr(e){let t={};for(let i=0;i<e.length;i++){let r=si(e[i]);for(let e in r)t[e]=r[e]}return t}function ss(e){return null===e.getRenderTarget()&&3001===e.outputEncoding?tH:tW}var sa={clone:si,merge:sr},sn=`void main() { 3 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4}`,so=`void main() { 5 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 6}`,sl=class extends rL{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=sn,this.fragmentShader=so,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,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=si(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let r=this.uniforms[i].value;r&&r.isTexture?t.uniforms[i]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[i]={type:"m4",value:r.toArray()}:t.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},sh=class extends rw{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new i6,this.projectionMatrix=new i6,this.projectionMatrixInverse=new i6}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);let 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)}},sc=class extends sh{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,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=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*tK*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*tZ*this.fov);return .5*this.getFilmHeight()/e}
6getEffectiveFOV(){return 2*tK*Math.atan(Math.tan(.5*tZ*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,a,o){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*tZ*this.fov)/this.zoom,i=2*t,r=this.aspect*i,a=-.5*r,o=this.view;if(null!==this.view&&this.view.enabled){let e=o.fullWidth,l=o.fullHeight;a+=o.offsetX*r/e,t-=o.offsetY*i/l,r*=o.width/e,i*=o.height/l}let l=this.filmOffset;0!==l&&(a+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+r,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},sd=class extends rw{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;let r=new sc(-90,1,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let a=new sc(-90,1,e,t);a.layers=this.layers,a.up.set(0,1,0),a.lookAt(-1,0,0),this.add(a);let o=new sc(-90,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);let l=new sc(-90,1,e,t);l.layers=this.layers,l.up.set(0,0,1),l.lookAt(0,-1,0),this.add(l);let h=new sc(-90,1,e,t);h.layers=this.layers,h.up.set(0,1,0),h.lookAt(0,0,1),this.add(h);let c=new sc(-90,1,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){null===this.parent&&this.updateMatrixWorld();let i=this.renderTarget,[r,a,o,l,h,c]=this.children,d=e.getRenderTarget(),p=e.toneMapping,f=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;let m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,a),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,l),e.setRenderTarget(i,4),e.render(t,h),i.texture.generateMipmaps=m,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(d),e.toneMapping=p,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}},su=class extends i_{constructor(e,t,i,r,a,o,l,h,c,d){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,r,a,o,l,h,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},sp=class extends iM{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1};this.texture=new su([i,i,i,i,i,i],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=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}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;let i={uniforms:{tEquirect:{value:null}},vertexShader:` 7 8 varying vec3 vWorldDirection; 9 10 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 11 12 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 13 14 } 15 16 void main() { 17 18 vWorldDirection = transformDirection( position, modelMatrix ); 19 20 #include <begin_vertex> 21 #include <project_vertex> 22 23 } 24 `,fragmentShader:` 25 26 uniform sampler2D tEquirect; 27 28 varying vec3 vWorldDirection; 29 30 #include <common> 31 32 void main() { 33 34 vec3 direction = normalize( vWorldDirection ); 35 36 vec2 sampleUV = equirectUv( direction ); 37 38 gl_FragColor = texture2D( tEquirect, sampleUV ); 39 40 } 41 `},r=new st(5,5,5),a=new sl({name:"CubemapFromEquirect",uniforms:si(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});a.uniforms.tEquirect.value=t;let o=new r7(r,a),l=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new sd(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){let a=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(a)}},sf=new iD,sm=new iD,sg=new t7,sv=class{constructor(e=new iD(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
41setFromCoplanarPoints(e,t,i){let r=sf.subVectors(i,t).cross(sm.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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){let i=e.delta(sf),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/r;return a<0||a>1?null:t.copy(i).multiplyScalar(a).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||sg.getNormalMatrix(e),r=this.coplanarPoint(sf).applyMatrix4(e),a=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(a),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)}},sy=new iK,sx=new iD,sb=class{constructor(e=new sv,t=new sv,i=new sv,r=new sv,a=new sv,o=new sv){this.planes=[e,t,i,r,a,o]}set(e,t,i,r,a,o){let l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(i),l[3].copy(r),l[4].copy(a),l[5].copy(o),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,r=i[0],a=i[1],o=i[2],l=i[3],h=i[4],c=i[5],d=i[6],p=i[7],f=i[8],m=i[9],g=i[10],v=i[11],y=i[12],x=i[13],b=i[14],w=i[15];return t[0].setComponents(l-r,p-h,v-f,w-y).normalize(),t[1].setComponents(l+r,p+h,v+f,w+y).normalize(),t[2].setComponents(l+a,p+c,v+m,w+x).normalize(),t[3].setComponents(l-a,p-c,v-m,w-x).normalize(),t[4].setComponents(l-o,p-d,v-g,w-b).normalize(),t[5].setComponents(l+o,p+d,v+g,w+b).normalize(),this}intersectsObject(e){let t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),sy.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(sy)}intersectsSprite(e){return sy.center.set(0,0,0),sy.radius=.7071067811865476,sy.applyMatrix4(e.matrixWorld),this.intersectsSphere(sy)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(sx.x=r.normal.x>0?e.max.x:e.min.x,sx.y=r.normal.y>0?e.max.y:e.min.y,sx.z=r.normal.z>0?e.max.z:e.min.z,0>r.distanceToPoint(sx))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}};function sw(){let e=null,t=!1,i=null,r=null;function a(t,o){i(t,o),r=e.requestAnimationFrame(a)}return{start:function(){!0!==t&&null!==i&&(r=e.requestAnimationFrame(a),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function sS(e,t){let i=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);let i=r.get(t);i&&(e.deleteBuffer(i.buffer),r.delete(t))},update:function(t,a){var o,l;let h,c;if(t.isGLBufferAttribute){let e=r.get(t);(!e||e.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version});return}t.isInterleavedBufferAttribute&&(t=t.data);let d=r.get(t);void 0===d?r.set(t,function(t,r){let a,o=t.array,l=t.usage,h=e.createBuffer();if(e.bindBuffer(r,h),e.bufferData(r,o,l),t.onUploadCallback(),o instanceof Float32Array)a=5126;else if(o instanceof Uint16Array){if(t.isFloat16BufferAttribute){if(i)a=5131;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.")}else a=5123}else if(o instanceof Int16Array)a=5122;else if(o instanceof Uint32Array)a=5125;else if(o instanceof Int32Array)a=5124;else if(o instanceof Int8Array)a=5120;else if(o instanceof Uint8Array)a=5121;else if(o instanceof Uint8ClampedArray)a=5121;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+o);return{buffer:h,type:a,bytesPerElement:o.BYTES_PER_ELEMENT,version:t.version}}(t,a)):d.version<t.version&&(o=d.buffer,h=(l=t).array,c=l.updateRange,e.bindBuffer(a,o),-1===c.count?e.bufferSubData(a,0,h):(i?e.bufferSubData(a,c.offset*h.BYTES_PER_ELEMENT,h,c.offset,c.c
41ount):e.bufferSubData(a,c.offset*h.BYTES_PER_ELEMENT,h.subarray(c.offset,c.offset+c.count)),c.count=-1),l.onUploadCallback(),d.version=t.version)}}}var s_=class extends rQ{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};let a=e/2,o=t/2,l=Math.floor(i),h=Math.floor(r),c=l+1,d=h+1,p=e/l,f=t/h,m=[],g=[],v=[],y=[];for(let e=0;e<d;e++){let t=e*f-o;for(let i=0;i<c;i++){let r=i*p-a;g.push(r,-t,0),v.push(0,0,1),y.push(i/l),y.push(1-e/h)}}for(let e=0;e<h;e++)for(let t=0;t<l;t++){let i=t+c*e,r=t+c*(e+1),a=t+1+c*(e+1),o=t+1+c*e;m.push(i,r,o),m.push(r,a,o)}this.setIndex(m),this.setAttribute("position",new rV(g,3)),this.setAttribute("normal",new rV(v,3)),this.setAttribute("uv",new rV(y,2))}static fromJSON(e){return new s_(e.width,e.height,e.widthSegments,e.heightSegments)}},sA={alphamap_fragment:`#ifdef USE_ALPHAMAP 42 diffuseColor.a *= texture2D( alphaMap, vUv ).g; 43#endif`,alphamap_pars_fragment:`#ifdef USE_ALPHAMAP 44 uniform sampler2D alphaMap; 45#endif`,alphatest_fragment:`#ifdef USE_ALPHATEST 46 if ( diffuseColor.a < alphaTest ) discard; 47#endif`,alphatest_pars_fragment:`#ifdef USE_ALPHATEST 48 uniform float alphaTest; 49#endif`,aomap_fragment:`#ifdef USE_AOMAP 50 float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; 51 reflectedLight.indirectDiffuse *= ambientOcclusion; 52 #if defined( USE_ENVMAP ) && defined( STANDARD ) 53 float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); 54 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 55 #endif 56#endif`,aomap_pars_fragment:`#ifdef USE_AOMAP 57 uniform sampler2D aoMap; 58 uniform float aoMapIntensity; 59#endif`,begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:`vec3 objectNormal = vec3( normal ); 60#ifdef USE_TANGENT 61 vec3 objectTangent = vec3( tangent.xyz ); 62#endif`,bsdfs:`vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 63 return RECIPROCAL_PI * diffuseColor; 64} 65vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 66 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 67 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 68} 69float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 70 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 71 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 72} 73vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 74 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 75 float x2 = x * x; 76 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 77 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 78} 79float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 80 float a2 = pow2( alpha ); 81 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 82 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 83 return 0.5 / max( gv + gl, EPSILON ); 84} 85float D_GGX( const in float alpha, const in float dotNH ) { 86 float a2 = pow2( alpha ); 87 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 88 return RECIPROCAL_PI * a2 / pow2( denom ); 89} 90vec3 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 ) { 91 float alpha = pow2( roughness ); 92 vec3 halfDir = normalize( lightDir + viewDir ); 93 float dotNL = saturate( dot( normal, lightDir ) ); 94 float dotNV = saturate( dot( normal, viewDir ) ); 95 float dotNH = saturate( dot( normal, halfDir ) ); 96 float dotVH = saturate( dot( viewDir, halfDir ) ); 97 vec3 F = F_Schlick( f0, f90, dotVH ); 98 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 99 float D = D_GGX( alpha, dotNH ); 100 return F * ( V * D ); 101} 102#ifdef USE_IRIDESCENCE 103 vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) { 104 float alpha = pow2( roughness ); 105 vec3 halfDir = normalize( lightDir + viewDir ); 106 float dotNL = saturate( dot( normal, lightDir ) );
107 float dotNV = saturate( dot( normal, viewDir ) ); 108 float dotNH = saturate( dot( normal, halfDir ) ); 109 float dotVH = saturate( dot( viewDir, halfDir ) ); 110 vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence ); 111 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 112 float D = D_GGX( alpha, dotNH ); 113 return F * ( V * D ); 114 } 115#endif 116vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 117 const float LUT_SIZE = 64.0; 118 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 119 const float LUT_BIAS = 0.5 / LUT_SIZE; 120 float dotNV = saturate( dot( N, V ) ); 121 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 122 uv = uv * LUT_SCALE + LUT_BIAS; 123 return uv; 124} 125float LTC_ClippedSphereFormFactor( const in vec3 f ) { 126 float l = length( f ); 127 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 128} 129vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 130 float x = dot( v1, v2 ); 131 float y = abs( x ); 132 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 133 float b = 3.4175940 + ( 4.1616724 + y ) * y; 134 float v = a / b; 135 float theta_sintheta = ( x >
135 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 136 return cross( v1, v2 ) * theta_sintheta; 137} 138vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 139 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 140 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 141 vec3 lightNormal = cross( v1, v2 ); 142 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 143 vec3 T1, T2; 144 T1 = normalize( V - N * dot( V, N ) ); 145 T2 = - cross( N, T1 ); 146 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 147 vec3 coords[ 4 ]; 148 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 149 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 150 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 151 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 152 coords[ 0 ] = normalize( coords[ 0 ] ); 153 coords[ 1 ] = normalize( coords[ 1 ] ); 154 coords[ 2 ] = normalize( coords[ 2 ] ); 155 coords[ 3 ] = normalize( coords[ 3 ] ); 156 vec3 vectorFormFactor = vec3( 0.0 ); 157 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 158 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 159 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 160 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 161 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 162 return vec3( result ); 163} 164float G_BlinnPhong_Implicit( ) { 165 return 0.25; 166} 167float D_BlinnPhong( const in float shininess, const in float dotNH ) { 168 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 169} 170vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 171 vec3 halfDir = normalize( lightDir + viewDir ); 172 float dotNH = saturate( dot( normal, halfDir ) ); 173 float dotVH = saturate( dot( viewDir, halfDir ) ); 174 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 175 float G = G_BlinnPhong_Implicit( ); 176 float D = D_BlinnPhong( shininess, dotNH ); 177 return F * ( G * D ); 178} 179#if defined( USE_SHEEN ) 180float D_Charlie( float roughness, float dotNH ) { 181 float alpha = pow2( roughness ); 182 float invAlpha = 1.0 / alpha; 183 float cos2h = dotNH * dotNH; 184 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 185 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 186} 187float V_Neubelt( float dotNV, float dotNL ) { 188 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 189} 190vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 191 vec3 halfDir = normalize( lightDir + viewDir ); 192 float dotNL = saturate( dot( normal, lightDir ) ); 193 float dotNV = saturate( dot( normal, viewDir ) ); 194 float dotNH = saturate( dot( normal, halfDir ) ); 195 float D = D_Charlie( sheenRoughness, dotNH ); 196 float V = V_Neubelt( dotNV, dotNL ); 197 return sheenColor * ( D * V ); 198} 199#endif`,iridescence_fragment:`#ifdef USE_IRIDESCENCE 200 const mat3 XYZ_TO_REC709 = mat3( 201 3.2404542, -0.9692660, 0.0556434, 202 -1.5371385, 1.8760108, -0.2040259, 203 -0.4985314, 0.0415560, 1.0572252 204 ); 205 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 206 vec3 sqrtF0 = sqrt( fresnel0 ); 207 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 208 } 209 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 210 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 211 } 212 float IorToFresnel0( float transmittedIor, float incidentIor ) { 213 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 214 } 215 vec3 evalSensitivity( float OPD, vec3 shift ) { 216 float phase = 2.0 * PI * OPD * 1.0e-9; 217 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 218 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 219 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 220 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 221 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 222 xyz /= 1.0685e-7; 223 vec3 rgb = XYZ_TO_REC709 * xyz; 224 return rgb; 225 } 226 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 227 vec3 I; 228 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 229 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 230 float cosTheta2Sq = 1.0 - sinTheta2Sq; 231 if ( cosTheta2Sq < 0.0 ) { 232 return vec3( 1.0 ); 233 } 234 float cosTheta2 = sqrt( cosTheta2Sq ); 235 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
236 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 237 float R21 = R12; 238 float T121 = 1.0 - R12; 239 float phi12 = 0.0; 240 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 241 float phi21 = PI - phi12; 242 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 243 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 244 vec3 phi23 = vec3( 0.0 ); 245 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 246 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 247 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 248 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 249 vec3 phi = vec3( phi21 ) + phi23; 250 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 251 vec3 r123 = sqrt( R123 ); 252 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 253 vec3 C0 = R12 + Rs; 254 I = C0; 255 vec3 Cm = Rs - T121; 256 for ( int m = 1; m <= 2; ++ m ) { 257 Cm *= r123; 258 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 259 I += Cm * Sm; 260 } 261 return max( I, vec3( 0.0 ) ); 262 } 263#endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP 264 uniform sampler2D bumpMap; 265 uniform float bumpScale; 266 vec2 dHdxy_fwd() { 267 vec2 dSTdx = dFdx( vUv ); 268 vec2 dSTdy = dFdy( vUv ); 269 float Hll = bumpScale * texture2D( bumpMap, vUv ).x; 270 float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; 271 float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; 272 return vec2( dBx, dBy ); 273 } 274 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 275 vec3 vSigmaX = dFdx( surf_pos.xyz ); 276 vec3 vSigmaY = dFdy( surf_pos.xyz ); 277 vec3 vN = surf_norm; 278 vec3 R1 = cross( vSigmaY, vN ); 279 vec3 R2 = cross( vN, vSigmaX ); 280 float fDet = dot( vSigmaX, R1 ) * faceDirection; 281 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 282 return normalize( abs( fDet ) * surf_norm - vGrad ); 283 } 284#endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0 285 vec4 plane; 286 #pragma unroll_loop_start 287 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 288 plane = clippingPlanes[ i ]; 289 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 290 } 291 #pragma unroll_loop_end 292 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 293 bool clipped = true; 294 #pragma unroll_loop_start 295 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 296 plane = clippingPlanes[ i ]; 297 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 298 } 299 #pragma unroll_loop_end 300 if ( clipped ) discard; 301 #endif 302#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 303 varying vec3 vClipPosition; 304 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 305#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 306 varying vec3 vClipPosition; 307#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 308 vClipPosition = - mvPosition.xyz; 309#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) 310 diffuseColor *= vColor; 311#elif defined( USE_COLOR ) 312 diffuseColor.rgb *= vColor; 313#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) 314 varying vec4 vColor; 315#elif defined( USE_COLOR ) 316 varying vec3 vColor; 317#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) 318 varying vec4 vColor; 319#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 320 varying vec3 vColor; 321#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) 322 vColor = vec4( 1.0 ); 323#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 324 vColor = vec3( 1.0 ); 325#endif 326#ifdef USE_COLOR 327 vColor *= color; 328#endif 329#ifdef USE_INSTANCING_COLOR 330 vColor.xyz *= instanceColor.xyz; 331#endif`,common:`#define PI 3.141592653589793 332#define PI2 6.283185307179586 333#define PI_HALF 1.5707963267948966 334#define RECIPROCAL_PI 0.3183098861837907 335#define RECIPROCAL_PI2 0.15915494309189535 336#define EPSILON 1e-6 337#ifndef saturate 338#define saturate( a ) clamp( a, 0.0, 1.0 ) 339#endif 340#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 341float pow2( const in float x ) { return x*x; } 342vec3 pow2( const in vec3 x ) { return x*x; } 343float pow3( const in float x ) { return x*x*x; } 344float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 345float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 346float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 347highp float rand( const in vec2 uv ) { 348 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 349 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 350 return fract( sin( sn ) * c ); 351} 352#ifdef HIGH_PRECISION 353 float precisionSafeLength( vec3 v ) { return length( v ); } 354#else 355 float precisionSafeLength( vec3 v ) { 356 float maxComponent = max3( abs( v ) ); 357 return length( v / maxComponent ) * maxComponent; 358 } 359#endif 360struct IncidentLight { 361 vec3 color; 362 vec3 direction; 363 bool visible; 364}; 365struct ReflectedLight { 366 vec3 directDiffuse; 367 vec3 directSpecular; 368 vec3 indirectDiffuse; 369 vec3 indirectSpecular; 370}; 371struct GeometricContext { 372 vec3 position; 373 vec3 normal; 374 vec3 viewDir; 375#ifdef USE_CLEARCOAT 376 vec3 clearcoatNormal; 377#endif 378}; 379vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 381} 382vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 383 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 384} 385mat3 transposeMat3( const in mat3 m ) { 386 mat3 tmp; 387 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 388 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 389 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 390 return tmp; 391} 392float luminance( const in vec3 rgb ) { 393 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 394 return dot( weights, rgb ); 395} 396bool isPerspectiveMatrix( mat4 m ) { 397 return m[ 2 ][ 3 ] == - 1.0; 398} 399vec2 equirectUv( in vec3 dir ) { 400 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 401 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 402 return vec2( u, v ); 403}`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV 404 #define cubeUV_minMipLevel 4.0 405 #define cubeUV_minTileSize 16.0 406 float getFace( vec3 direction ) { 407 vec3 absDirection = abs( direction ); 408 float face = - 1.0; 409 if ( absDirection.x > absDirection.z ) { 410 if ( absDirection.x > absDirection.y ) 411 face = direction.x > 0.0 ? 0.0 : 3.0; 412 else 413 face = direction.y > 0.0 ? 1.0 : 4.0; 414 } else { 415 if ( absDirection.z > absDirection.y ) 416 face = direction.z > 0.0 ? 2.0 : 5.0; 417 else 418 face = direction.y > 0.0 ? 1.0 : 4.0; 419 } 420 return face; 421 } 422 vec2 getUV( vec3 direction, float face ) { 423 vec2 uv; 424 if ( face == 0.0 ) { 425 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 426 } else if ( face == 1.0 ) { 427 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 428 } else if ( face == 2.0 ) { 429 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 430 } else if ( face == 3.0 ) { 431 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 432 } else if ( face == 4.0 ) { 433 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 434 } else { 435 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 436 } 437 return 0.5 * ( uv + 1.0 ); 438 } 439 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 440 float face = getFace( direction ); 441 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 442 mipInt = max( mipInt, cubeUV_minMipLevel ); 443 float faceSize = exp2( mipInt );
444 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 445 if ( face > 2.0 ) { 446 uv.y += faceSize; 447 face -= 3.0; 448 } 449 uv.x += face * faceSize; 450 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 451 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 452 uv.x *= CUBEUV_TEXEL_WIDTH; 453 uv.y *= CUBEUV_TEXEL_HEIGHT; 454 #ifdef texture2DGradEXT 455 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 456 #else 457 return texture2D( envMap, uv ).rgb; 458 #endif 459 } 460 #define cubeUV_r0 1.0 461 #define cubeUV_v0 0.339 462 #define cubeUV_m0 - 2.0 463 #define cubeUV_r1 0.8 464 #define cubeUV_v1 0.276 465 #define cubeUV_m1 - 1.0 466 #define cubeUV_r4 0.4 467 #define cubeUV_v4 0.046 468 #define cubeUV_m4 2.0 469 #define cubeUV_r5 0.305 470 #define cubeUV_v5 0.016 471 #define cubeUV_m5 3.0 472 #define cubeUV_r6 0.21 473 #define cubeUV_v6 0.0038 474 #define cubeUV_m6 4.0 475 float roughnessToMip( float roughness ) { 476 float mip = 0.0; 477 if ( roughness >= cubeUV_r1 ) { 478 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 479 } else if ( roughness >= cubeUV_r4 ) { 480 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 481 } else if ( roughness >= cubeUV_r5 ) { 482 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 483 } else if ( roughness >= cubeUV_r6 ) { 484 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 485 } else { 486 mip = - 2.0 * log2( 1.16 * roughness ); } 487 return mip; 488 } 489 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 490 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 491 float mipF = fract( mip ); 492 float mipInt = floor( mip ); 493 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 494 if ( mipF == 0.0 ) { 495 return vec4( color0, 1.0 ); 496 } else { 497 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 498 return vec4( mix( color0, color1, mipF ), 1.0 ); 499 } 500 } 501#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; 502#ifdef USE_INSTANCING 503 mat3 m = mat3( instanceMatrix ); 504 transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); 505 transformedNormal = m * transformedNormal; 506#endif 507transformedNormal = normalMatrix * transformedNormal; 508#ifdef FLIP_SIDED 509 transformedNormal = - transformedNormal; 510#endif 511#ifdef USE_TANGENT 512 vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; 513 #ifdef FLIP_SIDED 514 transformedTangent = - transformedTangent; 515 #endif 516#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP 517 uniform sampler2D displacementMap; 518 uniform float displacementScale; 519 uniform float displacementBias; 520#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP 521 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); 522#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP 523 vec4 emissiveColor = texture2D( emissiveMap, vUv ); 524 totalEmissiveRadiance *= emissiveColor.rgb; 525#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP 526 uniform sampler2D emissiveMap; 527#endif`,encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:`vec4 LinearToLinear( in vec4 value ) { 528 return value; 529} 530vec4 LinearTosRGB( in vec4 value ) { 531 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 ); 532}`,envmap_fragment:`#ifdef USE_ENVMAP 533 #ifdef ENV_WORLDPOS 534 vec3 cameraToFrag; 535 if ( isOrthographic ) { 536 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 537 } else { 538 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 539 } 540 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 541 #ifdef ENVMAP_MODE_REFLECTION 542 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 543 #else 544 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 545 #endif 546 #else 547 vec3 reflectVec = vReflect; 548 #endif 549 #ifdef ENVMAP_TYPE_CUBE 550 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 551 #else 552 vec4 envColor = vec4( 0.0 ); 553 #endif 554 #ifdef ENVMAP_BLENDING_MULTIPLY 555 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 556 #elif defined( ENVMAP_BLENDING_MIX ) 557 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 558 #elif defined( ENVMAP_BLENDING_ADD ) 559 outgoingLight += envColor.xyz * specularStrength * reflectivity; 560 #endif 561#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP 562 uniform float envMapIntensity; 563 uniform float flipEnvMap; 564 #ifdef ENVMAP_TYPE_CUBE 565 uniform samplerCube envMap; 566 #else 567 uniform sampler2D envMap; 568 #endif 569 570#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP 571 uniform float reflectivity; 572 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 573 #define ENV_WORLDPOS 574 #endif 575 #ifdef ENV_WORLDPOS 576 varying vec3 vWorldPosition; 577 uniform float refractionRatio; 578 #else 579 varying vec3 vReflect; 580 #endif 581#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP 582 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 583 #define ENV_WORLDPOS 584 #endif 585 #ifdef ENV_WORLDPOS 586 587 varying vec3 vWorldPosition; 588 #else 589 varying vec3 vReflect; 590 uniform float refractionRatio; 591 #endif 592#endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP ) 593 vec3 getIBLIrradiance( const in vec3 normal ) { 594 #if defined( ENVMAP_TYPE_CUBE_UV ) 595 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 596 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 597 return PI * envMapColor.rgb * envMapIntensity; 598 #else 599 return vec3( 0.0 ); 600 #endif 601 } 602 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 603 #if defined( ENVMAP_TYPE_CUBE_UV ) 604 vec3 reflectVec = reflect( - viewDir, normal ); 605 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 606 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 607 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 608 return envMapColor.rgb * envMapIntensity; 609 #else 610 return vec3( 0.0 ); 611 #endif 612 } 613#endif`,envmap_vertex:`#ifdef USE_ENVMAP 614 #ifdef ENV_WORLDPOS 615 vWorldPosition = worldPosition.xyz; 616 #else 617 vec3 cameraToVertex; 618 if ( isOrthographic ) { 619 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 620 } else {
621 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 622 } 623 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 624 #ifdef ENVMAP_MODE_REFLECTION 625 vReflect = reflect( cameraToVertex, worldNormal ); 626 #else 627 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 628 #endif 629 #endif 630#endif`,fog_vertex:`#ifdef USE_FOG 631 vFogDepth = - mvPosition.z; 632#endif`,fog_pars_vertex:`#ifdef USE_FOG 633 varying float vFogDepth; 634#endif`,fog_fragment:`#ifdef USE_FOG 635 #ifdef FOG_EXP2 636 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 637 #else 638 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 639 #endif 640 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 641#endif`,fog_pars_fragment:`#ifdef USE_FOG 642 uniform vec3 fogColor; 643 varying float vFogDepth; 644 #ifdef FOG_EXP2 645 uniform float fogDensity; 646 #else 647 uniform float fogNear; 648 uniform float fogFar; 649 #endif 650#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP 651 uniform sampler2D gradientMap; 652#endif 653vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 654 float dotNL = dot( normal, lightDirection ); 655 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 656 #ifdef USE_GRADIENTMAP 657 return vec3( texture2D( gradientMap, coord ).r ); 658 #else 659 vec2 fw = fwidth( coord ) * 0.5; 660 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 661 #endif 662}`,lightmap_fragment:`#ifdef USE_LIGHTMAP 663 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 664 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 665 reflectedLight.indirectDiffuse += lightMapIrradiance; 666#endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP 667 uniform sampler2D lightMap; 668 uniform float lightMapIntensity; 669#endif`,lights_lambert_fragment:`LambertMaterial material; 670material.diffuseColor = diffuseColor.rgb; 671material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; 672struct LambertMaterial { 673 vec3 diffuseColor; 674 float specularStrength; 675}; 676void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 677 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 678 vec3 irradiance = dotNL * directLight.color; 679 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 680} 681void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 682 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 683} 684#define RE_Direct RE_Direct_Lambert 685#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; 686uniform vec3 ambientLightColor; 687uniform vec3 lightProbe[ 9 ]; 688vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 689 float x = normal.x, y = normal.y, z = normal.z; 690 vec3 result = shCoefficients[ 0 ] * 0.886227; 691 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 692 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 693 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 694 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 695 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 696 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 697 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 698 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 699 return result; 700} 701vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 702 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 703 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 704 return irradiance; 705} 706vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 707 vec3 irradiance = ambientLightColor; 708 return irradiance; 709} 710float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 711 #if defined ( PHYSICALLY_CORRECT_LIGHTS ) 712 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 713 if ( cutoffDistance > 0.0 ) { 714 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 715 } 716 return distanceFalloff; 717 #else 718 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 719 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 720 } 721 return 1.0; 722 #endif 723} 724float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 725 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 726} 727#if NUM_DIR_LIGHTS > 0 728 struct DirectionalLight { 729 vec3 direction; 730 vec3 color; 731 }; 732 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 733 void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { 734 light.color = directionalLight.color; 735 light.direction = directionalLight.direction; 736 light.visible = true; 737 } 738#endif 739#if NUM_POINT_LIGHTS > 0 740 struct PointLight { 741 vec3 position; 742 vec3 color; 743 float distance; 744 float decay; 745 }; 746 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 747 void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { 748 vec3 lVector = pointLight.position - geometry.position; 749 light.direction = normalize( lVector ); 750 float lightDistance = length( lVector ); 751 light.color = pointLight.color; 752 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 753 light.visible = ( light.color != vec3( 0.0 ) ); 754 } 755#endif
756#if NUM_SPOT_LIGHTS > 0 757 struct SpotLight { 758 vec3 position; 759 vec3 direction; 760 vec3 color; 761 float distance; 762 float decay; 763 float coneCos; 764 float penumbraCos; 765 }; 766 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 767 void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { 768 vec3 lVector = spotLight.position - geometry.position; 769 light.direction = normalize( lVector ); 770 float angleCos = dot( light.direction, spotLight.direction ); 771 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 772 if ( spotAttenuation > 0.0 ) { 773 float lightDistance = length( lVector ); 774 light.color = spotLight.color * spotAttenuation; 775 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 776 light.visible = ( light.color != vec3( 0.0 ) ); 777 } else { 778 light.color = vec3( 0.0 ); 779 light.visible = false; 780 } 781 } 782#endif 783#if NUM_RECT_AREA_LIGHTS > 0 784 struct RectAreaLight { 785 vec3 color; 786 vec3 position; 787 vec3 halfWidth; 788 vec3 halfHeight; 789 }; 790 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 791 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 792#endif 793#if NUM_HEMI_LIGHTS > 0 794 struct HemisphereLight { 795 vec3 direction; 796 vec3 skyColor; 797 vec3 groundColor; 798 }; 799 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 800 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 801 float dotNL = dot( normal, hemiLight.direction ); 802 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 803 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 804 return irradiance; 805 } 806#endif`,lights_toon_fragment:`ToonMaterial material; 807material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; 808struct ToonMaterial { 809 vec3 diffuseColor; 810}; 811void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 812 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 813 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 814} 815void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 816 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 817} 818#define RE_Direct RE_Direct_Toon 819#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; 820material.diffuseColor = diffuseColor.rgb; 821material.specularColor = specular; 822material.specularShininess = shininess; 823material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; 824struct BlinnPhongMaterial { 825 vec3 diffuseColor; 826 vec3 specularColor; 827 float specularShininess; 828 float specularStrength; 829}; 830void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 831 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 832 vec3 irradiance = dotNL * directLight.color; 833 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 834 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 835} 836void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 837 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 838} 839#define RE_Direct RE_Direct_BlinnPhong 840#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; 841material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 842vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 843float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 844material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 845material.roughness = min( material.roughness, 1.0 ); 846#ifdef IOR 847 material.ior = ior; 848 #ifdef SPECULAR 849 float specularIntensityFactor = specularIntensity; 850 vec3 specularColorFactor = specularColor; 851 #ifdef USE_SPECULARINTENSITYMAP 852 specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; 853 #endif 854 #ifdef USE_SPECULARCOLORMAP 855 specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; 856 #endif 857 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 858 #else 859 float specularIntensityFactor = 1.0; 860 vec3 specularColorFactor = vec3( 1.0 ); 861 material.specularF90 = 1.0; 862 #endif 863 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 864#else 865 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 866 material.specularF90 = 1.0; 867#endif 868#ifdef USE_CLEARCOAT 869 material.clearcoat = clearcoat; 870 material.clearcoatRoughness = clearcoatRoughness; 871 material.clearcoatF0 = vec3( 0.04 ); 872 material.clearcoatF90 = 1.0; 873 #ifdef USE_CLEARCOATMAP 874 material.clearcoat *= texture2D( clearcoatMap, vUv ).x; 875 #endif 876 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 877 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; 878 #endif 879 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 880 material.clearcoatRoughness += geometryRoughness; 881 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 882#endif
883#ifdef USE_IRIDESCENCE 884 material.iridescence = iridescence; 885 material.iridescenceIOR = iridescenceIOR; 886 #ifdef USE_IRIDESCENCEMAP 887 material.iridescence *= texture2D( iridescenceMap, vUv ).r; 888 #endif 889 #ifdef USE_IRIDESCENCE_THICKNESSMAP 890 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; 891 #else 892 material.iridescenceThickness = iridescenceThicknessMaximum; 893 #endif 894#endif 895#ifdef USE_SHEEN 896 material.sheenColor = sheenColor; 897 #ifdef USE_SHEENCOLORMAP 898 material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; 899 #endif 900 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 901 #ifdef USE_SHEENROUGHNESSMAP 902 material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; 903 #endif 904#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { 905 vec3 diffuseColor; 906 float roughness; 907 vec3 specularColor; 908 float specularF90; 909 #ifdef USE_CLEARCOAT 910 float clearcoat; 911 float clearcoatRoughness; 912 vec3 clearcoatF0; 913 float clearcoatF90; 914 #endif 915 #ifdef USE_IRIDESCENCE 916 float iridescence; 917 float iridescenceIOR; 918 float iridescenceThickness; 919 vec3 iridescenceFresnel; 920 vec3 iridescenceF0; 921 #endif 922 #ifdef USE_SHEEN 923 vec3 sheenColor; 924 float sheenRoughness; 925 #endif 926 #ifdef IOR 927 float ior; 928 #endif 929 #ifdef USE_TRANSMISSION 930 float transmission; 931 float transmissionAlpha; 932 float thickness; 933 float attenuationDistance; 934 vec3 attenuationColor; 935 #endif 936}; 937vec3 clearcoatSpecular = vec3( 0.0 ); 938vec3 sheenSpecular = vec3( 0.0 ); 939float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 940 float dotNV = saturate( dot( normal, viewDir ) ); 941 float r2 = roughness * roughness; 942 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 943 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 944 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 945 return saturate( DG * RECIPROCAL_PI ); 946} 947vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 948 float dotNV = saturate( dot( normal, viewDir ) ); 949 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 950 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 951 vec4 r = roughness * c0 + c1; 952 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 953 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 954 return fab; 955} 956vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 957 vec2 fab = DFGApprox( normal, viewDir, roughness ); 958 return specularColor * fab.x + specularF90 * fab.y; 959} 960#ifdef USE_IRIDESCENCE 961void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 962#else 963void 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 ) { 964#endif 965 vec2 fab = DFGApprox( normal, viewDir, roughness ); 966 #ifdef USE_IRIDESCENCE 967 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 968 #else 969 vec3 Fr = specularColor; 970 #endif 971 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 972 float Ess = fab.x + fab.y; 973 float Ems = 1.0 - Ess; 974 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 975 singleScatter += FssEss; 976 multiScatter += Fms * Ems; 977} 978#if NUM_RECT_AREA_LIGHTS > 0 979 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 980 vec3 normal = geometry.normal; 981 vec3 viewDir = geometry.viewDir; 982 vec3 position = geometry.position; 983 vec3 lightPos = rectAreaLight.position; 984 vec3 halfWidth = rectAreaLight.halfWidth; 985 vec3 halfHeight = rectAreaLight.halfHeight; 986 vec3 lightColor = rectAreaLight.color; 987 float roughness = material.roughness; 988 vec3 rectCoords[ 4 ]; 989 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 990 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 991 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 992 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 993 vec4 t1 = texture2D( ltc_1, uv ); 994 vec4 t2 = texture2D( ltc_2, uv ); 995 mat3 mInv = mat3( 996 vec3( t1.x, 0, t1.y ), 997 vec3( 0, 1, 0 ), 998 vec3( t1.z, 0, t1.w ) 999 ); 1000 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1001 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1002 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1003 } 1004#endif 1005void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1006 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 1007 vec3 irradiance = dotNL * directLight.color; 1008 #ifdef USE_CLEARCOAT 1009 float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); 1010 vec3 ccIrradiance = dotNLcc * directLight.color; 1011 clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1012 #endif 1013 #ifdef USE_SHEEN 1014 sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); 1015 #endif 1016 #ifdef USE_IRIDESCENCE 1017 reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); 1018 #else 1019 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); 1020 #endif 1021 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1022} 1023void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1024 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1025} 1026void 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) { 1027 #ifdef USE_CLEARCOAT 1028 clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1029 #endif 1030 #ifdef USE_SHEEN 1031 sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); 1032 #endif 1033 vec3 singleScattering = vec3( 0.0 ); 1034 vec3 multiScattering = vec3( 0.0 ); 1035 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1036 #ifdef USE_IRIDESCENCE 1037 computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1038 #else 1039 computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1040 #endif 1041 vec3 totalScattering = singleScattering + multiScattering; 1042 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1043 reflectedLight.indirectSpecular += radiance * singleScattering; 1044 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1045 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1046} 1047#define RE_Direct RE_Direct_Physical 1048#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1049#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1050#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1051float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1052 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1053}`,lights_fragment_begin:` 1054GeometricContext geometry; 1055geometry.position = - vViewPosition; 1056geometry.normal = normal; 1057geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1058#ifdef USE_CLEARCOAT 1059 geometry.clearcoatNormal = clearcoatNormal; 1060#endif 1061#ifdef USE_IRIDESCENCE 1062 float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 1063 if ( material.iridescenceThickness == 0.0 ) { 1064 material.iridescence = 0.0; 1065 } else { 1066 material.iridescence = saturate( material.iridescence ); 1067 } 1068 if ( material.iridescence > 0.0 ) { 1069 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1070 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1071 } 1072#endif 1073IncidentLight directLight; 1074#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1075 PointLight pointLight; 1076 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1077 PointLightShadow pointLightShadow; 1078 #endif 1079 #pragma unroll_loop_start 1080 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1081 pointLight = pointLights[ i ]; 1082 getPointLightInfo( pointLight, geometry, directLight ); 1083 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1084 pointLightShadow = pointLightShadows[ i ]; 1085 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1086 #endif 1087 RE_Direct( directLight, geometry, material, reflectedLight ); 1088 } 1089 #pragma unroll_loop_end 1090#endif
1091#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1092 SpotLight spotLight; 1093 vec4 spotColor; 1094 vec3 spotLightCoord; 1095 bool inSpotLightMap; 1096 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1097 SpotLightShadow spotLightShadow; 1098 #endif 1099 #pragma unroll_loop_start 1100 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1101 spotLight = spotLights[ i ]; 1102 getSpotLightInfo( spotLight, geometry, directLight ); 1103 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1104 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1105 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1106 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1107 #else 1108 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1109 #endif 1110 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1111 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1112 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1113 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1114 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1115 #endif 1116 #undef SPOT_LIGHT_MAP_INDEX 1117 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1118 spotLightShadow = spotLightShadows[ i ]; 1119 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1120 #endif 1121 RE_Direct( directLight, geometry, material, reflectedLight ); 1122 } 1123 #pragma unroll_loop_end 1124#endif 1125#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1126 DirectionalLight directionalLight; 1127 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1128 DirectionalLightShadow directionalLightShadow; 1129 #endif 1130 #pragma unroll_loop_start 1131 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1132 directionalLight = directionalLights[ i ]; 1133 getDirectionalLightInfo( directionalLight, geometry, directLight ); 1134 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1135 directionalLightShadow = directionalLightShadows[ i ]; 1136 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1137 #endif 1138 RE_Direct( directLight, geometry, material, reflectedLight ); 1139 } 1140 #pragma unroll_loop_end 1141#endif 1142#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1143 RectAreaLight rectAreaLight; 1144 #pragma unroll_loop_start 1145 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1146 rectAreaLight = rectAreaLights[ i ]; 1147 RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); 1148 } 1149 #pragma unroll_loop_end 1150#endif 1151#if defined( RE_IndirectDiffuse ) 1152 vec3 iblIrradiance = vec3( 0.0 ); 1153 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1154 irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); 1155 #if ( NUM_HEMI_LIGHTS > 0 ) 1156 #pragma unroll_loop_start 1157 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1158 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 1159 } 1160 #pragma unroll_loop_end 1161 #endif 1162#endif 1163#if defined( RE_IndirectSpecular ) 1164 vec3 radiance = vec3( 0.0 ); 1165 vec3 clearcoatRadiance = vec3( 0.0 ); 1166#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) 1167 #ifdef USE_LIGHTMAP 1168 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 1169 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1170 irradiance += lightMapIrradiance; 1171 #endif 1172 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1173 iblIrradiance += getIBLIrradiance( geometry.normal ); 1174 #endif 1175#endif 1176#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1177 radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); 1178 #ifdef USE_CLEARCOAT 1179 clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); 1180 #endif 1181#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) 1182 RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); 1183#endif 1184#if defined( RE_IndirectSpecular ) 1185 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); 1186#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1187 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1188#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1189 uniform float logDepthBufFC; 1190 varying float vFragDepth; 1191 varying float vIsPerspective; 1192#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF 1193 #ifdef USE_LOGDEPTHBUF_EXT 1194 varying float vFragDepth; 1195 varying float vIsPerspective; 1196 #else 1197 uniform float logDepthBufFC; 1198 #endif 1199#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF 1200 #ifdef USE_LOGDEPTHBUF_EXT 1201 vFragDepth = 1.0 + gl_Position.w; 1202 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1203 #else 1204 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1205 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1206 gl_Position.z *= gl_Position.w; 1207 } 1208 #endif 1209#endif`,map_fragment:`#ifdef USE_MAP 1210 vec4 sampledDiffuseColor = texture2D( map, vUv ); 1211 #ifdef DECODE_VIDEO_TEXTURE 1212 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 ); 1213 #endif 1214 diffuseColor *= sampledDiffuseColor; 1215#endif`,map_pars_fragment:`#ifdef USE_MAP 1216 uniform sampler2D map; 1217#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1218 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1219#endif 1220#ifdef USE_MAP 1221 diffuseColor *= texture2D( map, uv ); 1222#endif 1223#ifdef USE_ALPHAMAP 1224 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1225#endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1226 uniform mat3 uvTransform; 1227#endif 1228#ifdef USE_MAP 1229 uniform sampler2D map; 1230#endif 1231#ifdef USE_ALPHAMAP 1232 uniform sampler2D alphaMap; 1233#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; 1234#ifdef USE_METALNESSMAP 1235 vec4 texelMetalness = texture2D( metalnessMap, vUv ); 1236 metalnessFactor *= texelMetalness.b; 1237#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP 1238 uniform sampler2D metalnessMap; 1239#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1240 vColor *= morphTargetBaseInfluence; 1241 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1242 #if defined( USE_COLOR_ALPHA ) 1243 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1244 #elif defined( USE_COLOR ) 1245 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1246 #endif 1247 } 1248#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS 1249 objectNormal *= morphTargetBaseInfluence; 1250 #ifdef MORPHTARGETS_TEXTURE 1251 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1252 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1253 } 1254 #else 1255 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1256 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1257 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1258 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1259 #endif 1260#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS 1261 uniform float morphTargetBaseInfluence; 1262 #ifdef MORPHTARGETS_TEXTURE 1263 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1264 uniform sampler2DArray morphTargetsTexture; 1265 uniform ivec2 morphTargetsTextureSize; 1266 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1267 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1268 int y = texelIndex / morphTargetsTextureSize.x; 1269 int x = texelIndex - y * morphTargetsTextureSize.x; 1270 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1271 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1272 } 1273 #else 1274 #ifndef USE_MORPHNORMALS 1275 uniform float morphTargetInfluences[ 8 ]; 1276 #else 1277 uniform float morphTargetInfluences[ 4 ]; 1278 #endif 1279 #endif 1280#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS 1281 transformed *= morphTargetBaseInfluence; 1282 #ifdef MORPHTARGETS_TEXTURE 1283 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1284 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1285 } 1286 #else 1287 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1288 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1289 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1290 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1291 #ifndef USE_MORPHNORMALS 1292 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1293 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1294 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1295 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1296 #endif 1297 #endif 1298#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1299#ifdef FLAT_SHADED 1300 vec3 fdx = dFdx( vViewPosition ); 1301 vec3 fdy = dFdy( vViewPosition ); 1302 vec3 normal = normalize( cross( fdx, fdy ) ); 1303#else 1304 vec3 normal = normalize( vNormal ); 1305 #ifdef DOUBLE_SIDED 1306 normal = normal * faceDirection; 1307 #endif 1308 #ifdef USE_TANGENT 1309 vec3 tangent = normalize( vTangent ); 1310 vec3 bitangent = normalize( vBitangent ); 1311 #ifdef DOUBLE_SIDED 1312 tangent = tangent * faceDirection; 1313 bitangent = bitangent * faceDirection; 1314 #endif 1315 #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) 1316 mat3 vTBN = mat3( tangent, bitangent, normal ); 1317 #endif 1318 #endif 1319#endif 1320vec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP 1321 normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1322 #ifdef FLIP_SIDED 1323 normal = - normal; 1324 #endif 1325 #ifdef DOUBLE_SIDED 1326 normal = normal * faceDirection; 1327 #endif 1328 normal = normalize( normalMatrix * normal ); 1329#elif defined( TANGENTSPACE_NORMALMAP ) 1330 vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1331 mapN.xy *= normalScale; 1332 #ifdef USE_TANGENT 1333 normal = normalize( vTBN * mapN ); 1334 #else
1335 normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); 1336 #endif 1337#elif defined( USE_BUMPMAP ) 1338 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1339#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED 1340 varying vec3 vNormal; 1341 #ifdef USE_TANGENT 1342 varying vec3 vTangent; 1343 varying vec3 vBitangent; 1344 #endif 1345#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED 1346 varying vec3 vNormal; 1347 #ifdef USE_TANGENT 1348 varying vec3 vTangent; 1349 varying vec3 vBitangent; 1350 #endif 1351#endif`,normal_vertex:`#ifndef FLAT_SHADED 1352 vNormal = normalize( transformedNormal ); 1353 #ifdef USE_TANGENT 1354 vTangent = normalize( transformedTangent ); 1355 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1356 #endif 1357#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP 1358 uniform sampler2D normalMap; 1359 uniform vec2 normalScale; 1360#endif 1361#ifdef OBJECTSPACE_NORMALMAP 1362 uniform mat3 normalMatrix; 1363#endif 1364#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) 1365 vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { 1366 vec3 q0 = dFdx( eye_pos.xyz ); 1367 vec3 q1 = dFdy( eye_pos.xyz ); 1368 vec2 st0 = dFdx( vUv.st ); 1369 vec2 st1 = dFdy( vUv.st ); 1370 vec3 N = surf_norm; 1371 vec3 q1perp = cross( q1, N ); 1372 vec3 q0perp = cross( N, q0 ); 1373 vec3 T = q1perp * st0.x + q0perp * st1.x; 1374 vec3 B = q1perp * st0.y + q0perp * st1.y; 1375 float det = max( dot( T, T ), dot( B, B ) ); 1376 float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); 1377 return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); 1378 } 1379#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT 1380 vec3 clearcoatNormal = geometryNormal; 1381#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP 1382 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; 1383 clearcoatMapN.xy *= clearcoatNormalScale; 1384 #ifdef USE_TANGENT 1385 clearcoatNormal = normalize( vTBN * clearcoatMapN ); 1386 #else 1387 clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); 1388 #endif 1389#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP 1390 uniform sampler2D clearcoatMap; 1391#endif 1392#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1393 uniform sampler2D clearcoatRoughnessMap; 1394#endif 1395#ifdef USE_CLEARCOAT_NORMALMAP 1396 uniform sampler2D clearcoatNormalMap; 1397 uniform vec2 clearcoatNormalScale; 1398#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP 1399 uniform sampler2D iridescenceMap; 1400#endif 1401#ifdef USE_IRIDESCENCE_THICKNESSMAP 1402 uniform sampler2D iridescenceThicknessMap; 1403#endif`,output_fragment:`#ifdef OPAQUE 1404diffuseColor.a = 1.0; 1405#endif 1406#ifdef USE_TRANSMISSION 1407diffuseColor.a *= material.transmissionAlpha + 0.1; 1408#endif 1409gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { 1410 return normalize( normal ) * 0.5 + 0.5; 1411} 1412vec3 unpackRGBToNormal( const in vec3 rgb ) { 1413 return 2.0 * rgb.xyz - 1.0; 1414} 1415const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1416const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1417const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1418const float ShiftRight8 = 1. / 256.; 1419vec4 packDepthToRGBA( const in float v ) { 1420 vec4 r = vec4( fract( v * PackFactors ), v ); 1421 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1422} 1423float unpackRGBAToDepth( const in vec4 v ) { 1424 return dot( v, UnpackFactors ); 1425} 1426vec2 packDepthToRG( in highp float v ) { 1427 return packDepthToRGBA( v ).yx; 1428} 1429float unpackRGToDepth( const in highp vec2 v ) { 1430 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1431} 1432vec4 pack2HalfToRGBA( vec2 v ) { 1433 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1434 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1435} 1436vec2 unpackRGBATo2Half( vec4 v ) { 1437 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1438} 1439float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1440 return ( viewZ + near ) / ( near - far ); 1441} 1442float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { 1443 return linearClipZ * ( near - far ) - near; 1444} 1445float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1446 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1447} 1448float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { 1449 return ( near * far ) / ( ( far - near ) * invClipZ - far ); 1450}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA 1451 gl_FragColor.rgb *= gl_FragColor.a; 1452#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); 1453#ifdef USE_INSTANCING 1454 mvPosition = instanceMatrix * mvPosition; 1455#endif 1456mvPosition = modelViewMatrix * mvPosition; 1457gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING 1458 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1459#endif`,dithering_pars_fragment:`#ifdef DITHERING 1460 vec3 dithering( vec3 color ) { 1461 float grid_position = rand( gl_FragCoord.xy ); 1462 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1463 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1464 return color + dither_shift_RGB; 1465 } 1466#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; 1467#ifdef USE_ROUGHNESSMAP 1468 vec4 texelRoughness = texture2D( roughnessMap, vUv ); 1469 roughnessFactor *= texelRoughness.g; 1470#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP 1471 uniform sampler2D roughnessMap;
1472#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 1473 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1474#endif 1475#if NUM_SPOT_LIGHT_MAPS > 0 1476 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1477#endif 1478#ifdef USE_SHADOWMAP 1479 #if NUM_DIR_LIGHT_SHADOWS > 0 1480 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1481 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1482 struct DirectionalLightShadow { 1483 float shadowBias; 1484 float shadowNormalBias; 1485 float shadowRadius; 1486 vec2 shadowMapSize; 1487 }; 1488 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1489 #endif 1490 #if NUM_SPOT_LIGHT_SHADOWS > 0 1491 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1492 struct SpotLightShadow { 1493 float shadowBias; 1494 float shadowNormalBias; 1495 float shadowRadius; 1496 vec2 shadowMapSize; 1497 }; 1498 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1499 #endif 1500 #if NUM_POINT_LIGHT_SHADOWS > 0 1501 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1502 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1503 struct PointLightShadow { 1504 float shadowBias; 1505 float shadowNormalBias; 1506 float shadowRadius; 1507 vec2 shadowMapSize; 1508 float shadowCameraNear; 1509 float shadowCameraFar; 1510 }; 1511 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1512 #endif 1513 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1514 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1515 } 1516 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1517 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1518 } 1519 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1520 float occlusion = 1.0; 1521 vec2 distribution = texture2DDistribution( shadow, uv ); 1522 float hard_shadow = step( compare , distribution.x ); 1523 if (hard_shadow != 1.0 ) { 1524 float distance = compare - distribution.x ; 1525 float variance = max( 0.00000, distribution.y * distribution.y ); 1526 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 ); 1527 } 1528 return occlusion; 1529 } 1530 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1531 float shadow = 1.0; 1532 shadowCoord.xyz /= shadowCoord.w; 1533 shadowCoord.z += shadowBias; 1534 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1535 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1536 if ( frustumTest ) { 1537 #if defined( SHADOWMAP_TYPE_PCF ) 1538 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1539 float dx0 = - texelSize.x * shadowRadius; 1540 float dy0 = - texelSize.y * shadowRadius; 1541 float dx1 = + texelSize.x * shadowRadius; 1542 float dy1 = + texelSize.y * shadowRadius; 1543 float dx2 = dx0 / 2.0; 1544 float dy2 = dy0 / 2.0; 1545 float dx3 = dx1 / 2.0; 1546 float dy3 = dy1 / 2.0; 1547 shadow = ( 1548 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1549 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1550 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1551 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1552 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1553 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1554 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1555 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1556 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1557 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1558 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1559 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1560 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1561 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1562 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1563 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1564 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1565 ) * ( 1.0 / 17.0 ); 1566 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1567 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1568 float dx = texelSize.x; 1569 float dy = texelSize.y; 1570 vec2 uv = shadowCoord.xy;
1571 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1572 uv -= f * texelSize; 1573 shadow = ( 1574 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1575 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1576 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1577 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1578 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1579 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1580 f.x ) + 1581 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1582 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1583 f.x ) + 1584 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1585 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1586 f.y ) + 1587 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1588 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1589 f.y ) + 1590 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1591 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1592 f.x ), 1593 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1594 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1595 f.x ), 1596 f.y ) 1597 ) * ( 1.0 / 9.0 ); 1598 #elif defined( SHADOWMAP_TYPE_VSM ) 1599 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1600 #else 1601 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1602 #endif 1603 } 1604 return shadow; 1605 } 1606 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1607 vec3 absV = abs( v ); 1608 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1609 absV *= scaleToCube; 1610 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1611 vec2 planar = v.xy; 1612 float almostATexel = 1.5 * texelSizeY; 1613 float almostOne = 1.0 - almostATexel; 1614 if ( absV.z >= almostOne ) { 1615 if ( v.z > 0.0 ) 1616 planar.x = 4.0 - v.x; 1617 } else if ( absV.x >= almostOne ) { 1618 float signX = sign( v.x ); 1619 planar.x = v.z * signX + 2.0 * signX; 1620 } else if ( absV.y >= almostOne ) { 1621 float signY = sign( v.y ); 1622 planar.x = v.x + 2.0 * signY + 2.0; 1623 planar.y = v.z * signY - 2.0; 1624 } 1625 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1626 } 1627 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1628 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1629 vec3 lightToPosition = shadowCoord.xyz; 1630 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1631 vec3 bd3D = normalize( lightToPosition ); 1632 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1633 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1634 return ( 1635 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1636 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1637 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1638 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1639 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1640 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1641 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1642 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1643 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1644 ) * ( 1.0 / 9.0 ); 1645 #else 1646 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1647 #endif 1648 } 1649#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 1650 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1651 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1652#endif 1653#ifdef USE_SHADOWMAP 1654 #if NUM_DIR_LIGHT_SHADOWS > 0 1655 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1656 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1657 struct DirectionalLightShadow { 1658 float shadowBias; 1659 float shadowNormalBias; 1660 float shadowRadius; 1661 vec2 shadowMapSize; 1662 }; 1663 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1664 #endif
1665 #if NUM_SPOT_LIGHT_SHADOWS > 0 1666 struct SpotLightShadow { 1667 float shadowBias; 1668 float shadowNormalBias; 1669 float shadowRadius; 1670 vec2 shadowMapSize; 1671 }; 1672 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1673 #endif 1674 #if NUM_POINT_LIGHT_SHADOWS > 0 1675 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1676 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1677 struct PointLightShadow { 1678 float shadowBias; 1679 float shadowNormalBias; 1680 float shadowRadius; 1681 vec2 shadowMapSize; 1682 float shadowCameraNear; 1683 float shadowCameraFar; 1684 }; 1685 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1686 #endif 1687#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1688 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1689 vec4 shadowWorldPosition; 1690#endif 1691#if defined( USE_SHADOWMAP ) 1692 #if NUM_DIR_LIGHT_SHADOWS > 0 1693 #pragma unroll_loop_start 1694 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1695 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1696 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1697 } 1698 #pragma unroll_loop_end 1699 #endif 1700 #if NUM_POINT_LIGHT_SHADOWS > 0 1701 #pragma unroll_loop_start 1702 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1703 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1704 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1705 } 1706 #pragma unroll_loop_end 1707 #endif 1708#endif 1709#if NUM_SPOT_LIGHT_COORDS > 0 1710 #pragma unroll_loop_start 1711 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1712 shadowWorldPosition = worldPosition; 1713 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1714 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1715 #endif 1716 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1717 } 1718 #pragma unroll_loop_end 1719#endif`,shadowmask_pars_fragment:`float getShadowMask() { 1720 float shadow = 1.0; 1721 #ifdef USE_SHADOWMAP 1722 #if NUM_DIR_LIGHT_SHADOWS > 0 1723 DirectionalLightShadow directionalLight; 1724 #pragma unroll_loop_start 1725 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1726 directionalLight = directionalLightShadows[ i ]; 1727 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1728 } 1729 #pragma unroll_loop_end 1730 #endif 1731 #if NUM_SPOT_LIGHT_SHADOWS > 0 1732 SpotLightShadow spotLight; 1733 #pragma unroll_loop_start 1734 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1735 spotLight = spotLightShadows[ i ]; 1736 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1737 } 1738 #pragma unroll_loop_end 1739 #endif 1740 #if NUM_POINT_LIGHT_SHADOWS > 0 1741 PointLightShadow pointLight; 1742 #pragma unroll_loop_start 1743 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1744 pointLight = pointLightShadows[ i ]; 1745 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1746 } 1747 #pragma unroll_loop_end 1748 #endif 1749 #endif 1750 return shadow; 1751}`,skinbase_vertex:`#ifdef USE_SKINNING 1752 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1753 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1754 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1755 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1756#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING 1757 uniform mat4 bindMatrix; 1758 uniform mat4 bindMatrixInverse; 1759 uniform highp sampler2D boneTexture; 1760 uniform int boneTextureSize; 1761 mat4 getBoneMatrix( const in float i ) { 1762 float j = i * 4.0; 1763 float x = mod( j, float( boneTextureSize ) ); 1764 float y = floor( j / float( boneTextureSize ) ); 1765 float dx = 1.0 / float( boneTextureSize ); 1766 float dy = 1.0 / float( boneTextureSize ); 1767 y = dy * ( y + 0.5 ); 1768 vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); 1769 vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); 1770 vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); 1771 vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); 1772 mat4 bone = mat4( v1, v2, v3, v4 ); 1773 return bone; 1774 } 1775#endif`,skinning_vertex:`#ifdef USE_SKINNING 1776 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1777 vec4 skinned = vec4( 0.0 ); 1778 skinned += boneMatX * skinVertex * skinWeight.x; 1779 skinned += boneMatY * skinVertex * skinWeight.y; 1780 skinned += boneMatZ * skinVertex * skinWeight.z; 1781 skinned += boneMatW * skinVertex * skinWeight.w; 1782 transformed = ( bindMatrixInverse * skinned ).xyz; 1783#endif`,skinnormal_vertex:`#ifdef USE_SKINNING 1784 mat4 skinMatrix = mat4( 0.0 ); 1785 skinMatrix += skinWeight.x * boneMatX; 1786 skinMatrix += skinWeight.y * boneMatY; 1787 skinMatrix += skinWeight.z * boneMatZ; 1788 skinMatrix += skinWeight.w * boneMatW; 1789 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1790 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1791 #ifdef USE_TANGENT 1792 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1793 #endif 1794#endif`,specularmap_fragment:`float specularStrength; 1795#ifdef USE_SPECULARMAP 1796 vec4 texelSpecular = texture2D( specularMap, vUv ); 1797 specularStrength = texelSpecular.r; 1798#else 1799 specularStrength = 1.0; 1800#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP 1801 uniform sampler2D specularMap; 1802#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) 1803 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1804#endif`,tonemapping_pars_fragment:`#ifndef saturate 1805#define saturate( a ) clamp( a, 0.0, 1.0 ) 1806#endif 1807uniform float toneMappingExposure; 1808vec3 LinearToneMapping( vec3 color ) { 1809 return toneMappingExposure * color; 1810} 1811vec3 ReinhardToneMapping( vec3 color ) { 1812 color *= toneMappingExposure; 1813 return saturate( color / ( vec3( 1.0 ) + color ) ); 1814} 1815vec3 OptimizedCineonToneMapping( vec3 color ) { 1816 color *= toneMappingExposure; 1817 color = max( vec3( 0.0 ), color - 0.004 ); 1818 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 1819} 1820vec3 RRTAndODTFit( vec3 v ) { 1821 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 1822 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 1823 return a / b; 1824} 1825vec3 ACESFilmicToneMapping( vec3 color ) { 1826 const mat3 ACESInputMat = mat3( 1827 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 1828 vec3( 0.04823, 0.01566, 0.83777 ) 1829 ); 1830 const mat3 ACESOutputMat = mat3( 1831 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 1832 vec3( -0.07367, -0.00605, 1.07602 ) 1833 ); 1834 color *= toneMappingExposure / 0.6; 1835 color = ACESInputMat * color; 1836 color = RRTAndODTFit( color ); 1837 color = ACESOutputMat * color; 1838 return saturate( color ); 1839} 1840vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION 1841 material.transmission = transmission; 1842 material.transmissionAlpha = 1.0; 1843 material.thickness = thickness; 1844 material.attenuationDistance = attenuationDistance; 1845 material.attenuationColor = attenuationColor; 1846 #ifdef USE_TRANSMISSIONMAP 1847 material.transmission *= texture2D( transmissionMap, vUv ).r; 1848 #endif 1849 #ifdef USE_THICKNESSMAP 1850 material.thickness *= texture2D( thicknessMap, vUv ).g;
1851 #endif 1852 vec3 pos = vWorldPosition; 1853 vec3 v = normalize( cameraPosition - pos ); 1854 vec3 n = inverseTransformDirection( normal, viewMatrix ); 1855 vec4 transmission = getIBLVolumeRefraction( 1856 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 1857 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 1858 material.attenuationColor, material.attenuationDistance ); 1859 material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); 1860 totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); 1861#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION 1862 uniform float transmission; 1863 uniform float thickness; 1864 uniform float attenuationDistance; 1865 uniform vec3 attenuationColor; 1866 #ifdef USE_TRANSMISSIONMAP 1867 uniform sampler2D transmissionMap; 1868 #endif 1869 #ifdef USE_THICKNESSMAP 1870 uniform sampler2D thicknessMap; 1871 #endif 1872 uniform vec2 transmissionSamplerSize; 1873 uniform sampler2D transmissionSamplerMap; 1874 uniform mat4 modelMatrix; 1875 uniform mat4 projectionMatrix; 1876 varying vec3 vWorldPosition; 1877 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 1878 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 1879 vec3 modelScale; 1880 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 1881 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 1882 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 1883 return normalize( refractionVector ) * thickness * modelScale; 1884 } 1885 float applyIorToRoughness( const in float roughness, const in float ior ) { 1886 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 1887 } 1888 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 1889 float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 1890 #ifdef texture2DLodEXT 1891 return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1892 #else 1893 return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1894 #endif 1895 } 1896 vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 1897 if ( isinf( attenuationDistance ) ) { 1898 return radiance; 1899 } else { 1900 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 1901 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; 1902 } 1903 } 1904 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 1905 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 1906 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 1907 const in vec3 attenuationColor, const in float attenuationDistance ) { 1908 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 1909 vec3 refractedRayExit = position + transmissionRay; 1910 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 1911 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 1912 refractionCoords += 1.0; 1913 refractionCoords /= 2.0; 1914 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 1915 vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); 1916 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 1917 return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); 1918 } 1919#endif`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) 1920 varying vec2 vUv; 1921#endif`,uv_pars_vertex:`#ifdef USE_UV 1922 #ifdef UVS_VERTEX_ONLY 1923 vec2 vUv; 1924 #else 1925 varying vec2 vUv; 1926 #endif 1927 uniform mat3 uvTransform; 1928#endif`,uv_vertex:`#ifdef USE_UV 1929 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1930#endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1931 varying vec2 vUv2; 1932#endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1933 attribute vec2 uv2; 1934 varying vec2 vUv2; 1935 uniform mat3 uv2Transform; 1936#endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1937 vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; 1938#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1938IGHT_COORDS > 0 1939 vec4 worldPosition = vec4( transformed, 1.0 ); 1940 #ifdef USE_INSTANCING 1941 worldPosition = instanceMatrix * worldPosition; 1942 #endif 1943 worldPosition = modelMatrix * worldPosition; 1944#endif`,background_vert:`varying vec2 vUv; 1945uniform mat3 uvTransform; 1946void main() { 1947 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1948 gl_Position = vec4( position.xy, 1.0, 1.0 ); 1949}`,background_frag:`uniform sampler2D t2D; 1950uniform float backgroundIntensity; 1951varying vec2 vUv; 1952void main() { 1953 vec4 texColor = texture2D( t2D, vUv ); 1954 #ifdef DECODE_VIDEO_TEXTURE 1955 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 1956 #endif 1957 texColor.rgb *= backgroundIntensity; 1958 gl_FragColor = texColor; 1959 #include <tonemapping_fragment> 1960 #include <encodings_fragment> 1961}`,backgroundCube_vert:`varying vec3 vWorldDirection; 1962#include <common> 1963void main() { 1964 vWorldDirection = transformDirection( position, modelMatrix ); 1965 #include <begin_vertex> 1966 #include <project_vertex> 1967 gl_Position.z = gl_Position.w; 1968}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE 1969 uniform samplerCube envMap; 1970#elif defined( ENVMAP_TYPE_CUBE_UV ) 1971 uniform sampler2D envMap; 1972#endif 1973uniform float flipEnvMap; 1974uniform float backgroundBlurriness; 1975uniform float backgroundIntensity; 1976varying vec3 vWorldDirection; 1977#include <cube_uv_reflection_fragment> 1978void main() { 1979 #ifdef ENVMAP_TYPE_CUBE 1980 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 1981 #elif defined( ENVMAP_TYPE_CUBE_UV ) 1982 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 1983 #else 1984 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 1985 #endif 1986 texColor.rgb *= backgroundIntensity; 1987 gl_FragColor = texColor; 1988 #include <tonemapping_fragment> 1989 #include <encodings_fragment> 1990}`,cube_vert:`varying vec3 vWorldDirection; 1991#include <common> 1992void main() { 1993 vWorldDirection = transformDirection( position, modelMatrix ); 1994 #include <begin_vertex> 1995 #include <project_vertex> 1996 gl_Position.z = gl_Position.w; 1997}`,cube_frag:`uniform samplerCube tCube; 1998uniform float tFlip; 1999uniform float opacity; 2000varying vec3 vWorldDirection; 2001void main() { 2002 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2003 gl_FragColor = texColor; 2004 gl_FragColor.a *= opacity; 2005 #include <tonemapping_fragment> 2006 #include <encodings_fragment> 2007}`,depth_vert:`#include <common> 2008#include <uv_pars_vertex> 2009#include <displacementmap_pars_vertex> 2010#include <morphtarget_pars_vertex> 2011#include <skinning_pars_vertex> 2012#include <logdepthbuf_pars_vertex> 2013#include <clipping_planes_pars_vertex> 2014varying vec2 vHighPrecisionZW; 2015void main() { 2016 #include <uv_vertex> 2017 #include <skinbase_vertex> 2018 #ifdef USE_DISPLACEMENTMAP 2019 #include <beginnormal_vertex> 2020 #include <morphnormal_vertex> 2021 #include <skinnormal_vertex> 2022 #endif 2023 #include <begin_vertex> 2024 #include <morphtarget_vertex> 2025 #include <skinning_vertex> 2026 #include <displacementmap_vertex> 2027 #include <project_vertex> 2028 #include <logdepthbuf_vertex> 2029 #include <clipping_planes_vertex> 2030 vHighPrecisionZW = gl_Position.zw; 2031}`,depth_frag:`#if DEPTH_PACKING == 3200 2032 uniform float opacity; 2033#endif 2034#include <common> 2035#include <packing> 2036#include <uv_pars_fragment> 2037#include <map_pars_fragment> 2038#include <alphamap_pars_fragment> 2039#include <alphatest_pars_fragment> 2040#include <logdepthbuf_pars_fragment> 2041#include <clipping_planes_pars_fragment> 2042varying vec2 vHighPrecisionZW; 2043void main() { 2044 #include <clipping_planes_fragment> 2045 vec4 diffuseColor = vec4( 1.0 ); 2046 #if DEPTH_PACKING == 3200 2047 diffuseColor.a = opacity; 2048 #endif 2049 #include <map_fragment> 2050 #include <alphamap_fragment> 2051 #include <alphatest_fragment> 2052 #include <logdepthbuf_fragment> 2053 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2054 #if DEPTH_PACKING == 3200 2055 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2056 #elif DEPTH_PACKING == 3201 2057 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2058 #endif 2059}`,distanceRGBA_vert:`#define DISTANCE 2060varying vec3 vWorldPosition; 2061#include <common> 2062#include <uv_pars_vertex> 2063#include <displacementmap_pars_vertex> 2064#include <morphtarget_pars_vertex> 2065#include <skinning_pars_vertex> 2066#include <clipping_planes_pars_vertex> 2067void main() { 2068 #include <uv_vertex> 2069 #include <skinbase_vertex> 2070 #ifdef USE_DISPLACEMENTMAP 2071 #include <beginnormal_vertex> 2072 #include <morphnormal_vertex> 2073 #include <skinnormal_vertex> 2074 #endif 2075 #include <begin_vertex> 2076 #include <morphtarget_vertex> 2077 #include <skinning_vertex> 2078 #include <displacementmap_vertex> 2079 #include <project_vertex> 2080 #include <worldpos_vertex> 2081 #include <clipping_planes_vertex> 2082 vWorldPosition = worldPosition.xyz; 2083}`,distanceRGBA_frag:`#define DISTANCE 2084uniform vec3 referencePosition; 2085uniform float nearDistance; 2086uniform float farDistance; 2087varying vec3 vWorldPosition; 2088#include <common> 2089#include <packing> 2090#include <uv_pars_fragment> 2091#include <map_pars_fragment> 2092#include <alphamap_pars_fragment> 2093#include <alphatest_pars_fragment> 2094#include <clipping_planes_pars_fragment> 2095void main () { 2096 #include <clipping_planes_fragment> 2097 vec4 diffuseColor = vec4( 1.0 ); 2098 #include <map_fragment> 2099 #include <alphamap_fragment> 2100 #include <alphatest_fragment> 2101 float dist = length( vWorldPosition - referencePosition ); 2102 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2103 dist = saturate( dist ); 2104 gl_FragColor = packDepthToRGBA( dist ); 2105}`,equirect_vert:`varying vec3 vWorldDirection; 2106#include <common> 2107void main() { 2108 vWorldDirection = transformDirection( position, modelMatrix ); 2109 #include <begin_vertex> 2110 #include <project_vertex> 2111}`,equirect_frag:`uniform sampler2D tEquirect; 2112varying vec3 vWorldDirection; 2113#include <common> 2114void main() { 2115 vec3 direction = normalize( vWorldDirection ); 2116 vec2 sampleUV = equirectUv( direction ); 2117 gl_FragColor = texture2D( tEquirect, sampleUV ); 2118 #include <tonemapping_fragment> 2119 #include <encodings_fragment> 2120}`,linedashed_vert:`uniform float scale; 2121attribute float lineDistance; 2122varying float vLineDistance; 2123#include <common> 2124#include <color_pars_vertex> 2125#include <fog_pars_vertex> 2126#include <morphtarget_pars_vertex> 2127#include <logdepthbuf_pars_vertex> 2128#include <clipping_planes_pars_vertex> 2129void main() { 2130 vLineDistance = scale * lineDistance; 2131 #include <color_vertex> 2132 #include <morphcolor_vertex> 2133 #include <begin_vertex> 2134 #include <morphtarget_vertex> 2135 #include <project_vertex> 2136 #include <logdepthbuf_vertex> 2137 #include <clipping_planes_vertex> 2138 #include <fog_vertex> 2139}`,linedashed_frag:`uniform vec3 diffuse; 2140uniform float opacity; 2141uniform float dashSize; 2142uniform float totalSize; 2143varying float vLineDistance; 2144#include <common> 2145#include <color_pars_fragment> 2146#include <fog_pars_fragment> 2147#include <logdepthbuf_pars_fragment> 2148#include <clipping_planes_pars_fragment> 2149void main() { 2150 #include <clipping_planes_fragment> 2151 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2152 discard; 2153 } 2154 vec3 outgoingLight = vec3( 0.0 ); 2155 vec4 diffuseColor = vec4( diffuse, opacity ); 2156 #include <logdepthbuf_fragment> 2157 #include <color_fragment> 2158 outgoingLight = diffuseColor.rgb; 2159 #include <output_fragment> 2160 #include <tonemapping_fragment> 2161 #include <encodings_fragment> 2162 #include <fog_fragment> 2163 #include <premultiplied_alpha_fragment> 2164}`,meshbasic_vert:`#include <common> 2165#include <uv_pars_vertex> 2166#include <uv2_pars_vertex> 2167#include <envmap_pars_vertex> 2168#include <color_pars_vertex> 2169#include <fog_pars_vertex> 2170#include <morphtarget_pars_vertex> 2171#include <skinning_pars_vertex> 2172#include <logdepthbuf_pars_vertex> 2173#include <clipping_planes_pars_vertex> 2174void main() { 2175 #include <uv_vertex> 2176 #include <uv2_vertex> 2177 #include <color_vertex> 2178 #include <morphcolor_vertex> 2179 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2180 #include <beginnormal_vertex> 2181 #include <morphnormal_vertex> 2182 #include <skinbase_vertex> 2183 #include <skinnormal_vertex> 2184 #include <defaultnormal_vertex> 2185 #endif 2186 #include <begin_vertex> 2187 #include <morphtarget_vertex> 2188 #include <skinning_vertex> 2189 #include <project_vertex> 2190 #include <logdepthbuf_vertex> 2191 #include <clipping_planes_vertex> 2192 #include <worldpos_vertex> 2193 #include <envmap_vertex> 2194 #include <fog_vertex> 2195}`,meshbasic_frag:`uniform vec3 diffuse; 2196uniform float opacity; 2197#ifndef FLAT_SHADED 2198 varying vec3 vNormal; 2199#endif 2200#include <common> 2201#include <dithering_pars_fragment> 2202#include <color_pars_fragment> 2203#include <uv_pars_fragment> 2204#include <uv2_pars_fragment> 2205#include <map_pars_fragment> 2206#include <alphamap_pars_fragment> 2207#include <alphatest_pars_fragment> 2208#include <aomap_pars_fragment> 2209#include <lightmap_pars_fragment> 2210#include <envmap_common_pars_fragment> 2211#include <envmap_pars_fragment> 2212#include <fog_pars_fragment> 2213#include <specularmap_pars_fragment> 2214#include <logdepthbuf_pars_fragment> 2215#include <clipping_planes_pars_fragment> 2216void main() { 2217 #include <clipping_planes_fragment> 2218 vec4 diffuseColor = vec4( diffuse, opacity ); 2219 #include <logdepthbuf_fragment> 2220 #include <map_fragment> 2221 #include <color_fragment> 2222 #include <alphamap_fragment> 2223 #include <alphatest_fragment> 2224 #include <specularmap_fragment> 2225 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2226 #ifdef USE_LIGHTMAP 2227 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 2228 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2229 #else 2230 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2231 #endif 2232 #include <aomap_fragment> 2233 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2234 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2235 #include <envmap_fragment> 2236 #include <output_fragment> 2237 #include <tonemapping_fragment> 2238 #include <encodings_fragment> 2239 #include <fog_fragment> 2240 #include <premultiplied_alpha_fragment> 2241 #include <dithering_fragment> 2242}`,meshlambert_vert:`#define LAMBERT 2243varying vec3 vViewPosition; 2244#include <common> 2245#include <uv_pars_vertex> 2246#include <uv2_pars_vertex> 2247#include <displacementmap_pars_vertex> 2248#include <envmap_pars_vertex> 2249#include <color_pars_vertex> 2250#include <fog_pars_vertex> 2251#include <normal_pars_vertex> 2252#include <morphtarget_pars_vertex> 2253#include <skinning_pars_vertex> 2254#include <shadowmap_pars_vertex> 2255#include <logdepthbuf_pars_vertex> 2256#include <clipping_planes_pars_vertex> 2257void main() { 2258 #include <uv_vertex> 2259 #include <uv2_vertex> 2260 #include <color_vertex> 2261 #include <morphcolor_vertex> 2262 #include <beginnormal_vertex> 2263 #include <morphnormal_vertex> 2264 #include <skinbase_vertex> 2265 #include <skinnormal_vertex> 2266 #include <defaultnormal_vertex> 2267 #include <normal_vertex> 2268 #include <begin_vertex> 2269 #include <morphtarget_vertex> 2270 #include <skinning_vertex> 2271 #include <displacementmap_vertex> 2272 #include <project_vertex> 2273 #include <logdepthbuf_vertex> 2274 #include <clipping_planes_vertex> 2275 vViewPosition = - mvPosition.xyz; 2276 #include <worldpos_vertex> 2277 #include <envmap_vertex> 2278 #include <shadowmap_vertex> 2279 #include <fog_vertex> 2280}`,meshlambert_frag:`#define LAMBERT 2281uniform vec3 diffuse; 2282uniform vec3 emissive; 2283uniform float opacity; 2284#include <common> 2285#include <packing> 2286#include <dithering_pars_fragment> 2287#include <color_pars_fragment> 2288#include <uv_pars_fragment> 2289#include <uv2_pars_fragment> 2290#include <map_pars_fragment> 2291#include <alphamap_pars_fragment> 2292#include <alphatest_pars_fragment> 2293#include <aomap_pars_fragment> 2294#include <lightmap_pars_fragment> 2295#include <emissivemap_pars_fragment> 2296#include <envmap_common_pars_fragment> 2297#include <envmap_pars_fragment> 2298#include <fog_pars_fragment> 2299#include <bsdfs> 2300#include <lights_pars_begin> 2301#include <normal_pars_fragment> 2302#include <lights_lambert_pars_fragment> 2303#include <shadowmap_pars_fragment> 2304#include <bumpmap_pars_fragment> 2305#include <normalmap_pars_fragment> 2306#include <specularmap_pars_fragment> 2307#include <logdepthbuf_pars_fragment> 2308#include <clipping_planes_pars_fragment> 2309void main() { 2310 #include <clipping_planes_fragment> 2311 vec4 diffuseColor = vec4( diffuse, opacity ); 2312 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2313 vec3 totalEmissiveRadiance = emissive; 2314 #include <logdepthbuf_fragment> 2315 #include <map_fragment> 2316 #include <color_fragment> 2317 #include <alphamap_fragment> 2318 #include <alphatest_fragment> 2319 #include <specularmap_fragment> 2320 #include <normal_fragment_begin> 2321 #include <normal_fragment_maps> 2322 #include <emissivemap_fragment> 2323 #include <lights_lambert_fragment> 2324 #include <lights_fragment_begin> 2325 #include <lights_fragment_maps> 2326 #include <lights_fragment_end> 2327 #include <aomap_fragment> 2328 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2329 #include <envmap_fragment> 2330 #include <output_fragment> 2331 #include <tonemapping_fragment> 2332 #include <encodings_fragment> 2333 #include <fog_fragment> 2334 #include <premultiplied_alpha_fragment> 2335 #include <dithering_fragment> 2336}`,meshmatcap_vert:`#define MATCAP 2337varying vec3 vViewPosition; 2338#include <common> 2339#include <uv_pars_vertex> 2340#include <color_pars_vertex> 2341#include <displacementmap_pars_vertex> 2342#include <fog_pars_vertex> 2343#include <normal_pars_vertex> 2344#include <morphtarget_pars_vertex> 2345#include <skinning_pars_vertex> 2346#include <logdepthbuf_pars_vertex> 2347#include <clipping_planes_pars_vertex> 2348void main() { 2349 #include <uv_vertex> 2350 #include <color_vertex> 2351 #include <morphcolor_vertex> 2352 #include <beginnormal_vertex> 2353 #include <morphnormal_vertex> 2354 #include <skinbase_vertex> 2355 #include <skinnormal_vertex> 2356 #include <defaultnormal_vertex> 2357 #include <normal_vertex> 2358 #include <begin_vertex> 2359 #include <morphtarget_vertex> 2360 #include <skinning_vertex> 2361 #include <displacementmap_vertex> 2362 #include <project_vertex> 2363 #include <logdepthbuf_vertex> 2364 #include <clipping_planes_vertex> 2365 #include <fog_vertex> 2366 vViewPosition = - mvPosition.xyz; 2367}`,meshmatcap_frag:`#define MATCAP 2368uniform vec3 diffuse; 2369uniform float opacity; 2370uniform sampler2D matcap; 2371varying vec3 vViewPosition; 2372#include <common> 2373#include <dithering_pars_fragment> 2374#include <color_pars_fragment> 2375#include <uv_pars_fragment> 2376#include <map_pars_fragment> 2377#include <alphamap_pars_fragment> 2378#include <alphatest_pars_fragment> 2379#include <fog_pars_fragment> 2380#include <normal_pars_fragment> 2381#include <bumpmap_pars_fragment> 2382#include <normalmap_pars_fragment> 2383#include <logdepthbuf_pars_fragment> 2384#include <clipping_planes_pars_fragment> 2385void main() { 2386 #include <clipping_planes_fragment> 2387 vec4 diffuseColor = vec4( diffuse, opacity ); 2388 #include <logdepthbuf_fragment> 2389 #include <map_fragment> 2390 #include <color_fragment> 2391 #include <alphamap_fragment> 2392 #include <alphatest_fragment> 2393 #include <normal_fragment_begin> 2394 #include <normal_fragment_maps> 2395 vec3 viewDir = normalize( vViewPosition ); 2396 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2397 vec3 y = cross( viewDir, x ); 2398 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2399 #ifdef USE_MATCAP
2400 vec4 matcapColor = texture2D( matcap, uv ); 2401 #else 2402 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2403 #endif 2404 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2405 #include <output_fragment> 2406 #include <tonemapping_fragment> 2407 #include <encodings_fragment> 2408 #include <fog_fragment> 2409 #include <premultiplied_alpha_fragment> 2410 #include <dithering_fragment> 2411}`,meshnormal_vert:`#define NORMAL 2412#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2413 varying vec3 vViewPosition; 2414#endif 2415#include <common> 2416#include <uv_pars_vertex> 2417#include <displacementmap_pars_vertex> 2418#include <normal_pars_vertex> 2419#include <morphtarget_pars_vertex> 2420#include <skinning_pars_vertex> 2421#include <logdepthbuf_pars_vertex> 2422#include <clipping_planes_pars_vertex> 2423void main() { 2424 #include <uv_vertex> 2425 #include <beginnormal_vertex> 2426 #include <morphnormal_vertex> 2427 #include <skinbase_vertex> 2428 #include <skinnormal_vertex> 2429 #include <defaultnormal_vertex> 2430 #include <normal_vertex> 2431 #include <begin_vertex> 2432 #include <morphtarget_vertex> 2433 #include <skinning_vertex> 2434 #include <displacementmap_vertex> 2435 #include <project_vertex> 2436 #include <logdepthbuf_vertex> 2437 #include <clipping_planes_vertex> 2438#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2439 vViewPosition = - mvPosition.xyz; 2440#endif 2441}`,meshnormal_frag:`#define NORMAL 2442uniform float opacity; 2443#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2444 varying vec3 vViewPosition; 2445#endif 2446#include <packing> 2447#include <uv_pars_fragment> 2448#include <normal_pars_fragment> 2449#include <bumpmap_pars_fragment> 2450#include <normalmap_pars_fragment> 2451#include <logdepthbuf_pars_fragment> 2452#include <clipping_planes_pars_fragment> 2453void main() { 2454 #include <clipping_planes_fragment> 2455 #include <logdepthbuf_fragment> 2456 #include <normal_fragment_begin> 2457 #include <normal_fragment_maps> 2458 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2459 #ifdef OPAQUE 2460 gl_FragColor.a = 1.0; 2461 #endif 2462}`,meshphong_vert:`#define PHONG 2463varying vec3 vViewPosition; 2464#include <common> 2465#include <uv_pars_vertex> 2466#include <uv2_pars_vertex> 2467#include <displacementmap_pars_vertex> 2468#include <envmap_pars_vertex> 2469#include <color_pars_vertex> 2470#include <fog_pars_vertex> 2471#include <normal_pars_vertex> 2472#include <morphtarget_pars_vertex> 2473#include <skinning_pars_vertex> 2474#include <shadowmap_pars_vertex> 2475#include <logdepthbuf_pars_vertex> 2476#include <clipping_planes_pars_vertex> 2477void main() { 2478 #include <uv_vertex> 2479 #include <uv2_vertex> 2480 #include <color_vertex> 2481 #include <morphcolor_vertex> 2482 #include <beginnormal_vertex> 2483 #include <morphnormal_vertex> 2484 #include <skinbase_vertex> 2485 #include <skinnormal_vertex> 2486 #include <defaultnormal_vertex> 2487 #include <normal_vertex> 2488 #include <begin_vertex> 2489 #include <morphtarget_vertex> 2490 #include <skinning_vertex> 2491 #include <displacementmap_vertex> 2492 #include <project_vertex> 2493 #include <logdepthbuf_vertex> 2494 #include <clipping_planes_vertex> 2495 vViewPosition = - mvPosition.xyz; 2496 #include <worldpos_vertex> 2497 #include <envmap_vertex> 2498 #include <shadowmap_vertex> 2499 #include <fog_vertex> 2500}`,meshphong_frag:`#define PHONG 2501uniform vec3 diffuse; 2502uniform vec3 emissive; 2503uniform vec3 specular; 2504uniform float shininess; 2505uniform float opacity; 2506#include <common> 2507#include <packing> 2508#include <dithering_pars_fragment> 2509#include <color_pars_fragment> 2510#include <uv_pars_fragment> 2511#include <uv2_pars_fragment> 2512#include <map_pars_fragment> 2513#include <alphamap_pars_fragment> 2514#include <alphatest_pars_fragment> 2515#include <aomap_pars_fragment> 2516#include <lightmap_pars_fragment> 2517#include <emissivemap_pars_fragment> 2518#include <envmap_common_pars_fragment> 2519#include <envmap_pars_fragment> 2520#include <fog_pars_fragment> 2521#include <bsdfs> 2522#include <lights_pars_begin> 2523#include <normal_pars_fragment> 2524#include <lights_phong_pars_fragment> 2525#include <shadowmap_pars_fragment> 2526#include <bumpmap_pars_fragment> 2527#include <normalmap_pars_fragment> 2528#include <specularmap_pars_fragment> 2529#include <logdepthbuf_pars_fragment> 2530#include <clipping_planes_pars_fragment> 2531void main() { 2532 #include <clipping_planes_fragment> 2533 vec4 diffuseColor = vec4( diffuse, opacity ); 2534 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2535 vec3 totalEmissiveRadiance = emissive; 2536 #include <logdepthbuf_fragment> 2537 #include <map_fragment> 2538 #include <color_fragment> 2539 #include <alphamap_fragment> 2540 #include <alphatest_fragment> 2541 #include <specularmap_fragment> 2542 #include <normal_fragment_begin> 2543 #include <normal_fragment_maps> 2544 #include <emissivemap_fragment> 2545 #include <lights_phong_fragment> 2546 #include <lights_fragment_begin> 2547 #include <lights_fragment_maps> 2548 #include <lights_fragment_end> 2549 #include <aomap_fragment> 2550 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 2551 #include <envmap_fragment> 2552 #include <output_fragment> 2553 #include <tonemapping_fragment> 2554 #include <encodings_fragment> 2555 #include <fog_fragment> 2556 #include <premultiplied_alpha_fragment> 2557 #include <dithering_fragment> 2558}`,meshphysical_vert:`#define STANDARD 2559varying vec3 vViewPosition; 2560#ifdef USE_TRANSMISSION 2561 varying vec3 vWorldPosition; 2562#endif 2563#include <common> 2564#include <uv_pars_vertex> 2565#include <uv2_pars_vertex> 2566#include <displacementmap_pars_vertex> 2567#include <color_pars_vertex> 2568#include <fog_pars_vertex> 2569#include <normal_pars_vertex> 2570#include <morphtarget_pars_vertex> 2571#include <skinning_pars_vertex> 2572#include <shadowmap_pars_vertex> 2573#include <logdepthbuf_pars_vertex> 2574#include <clipping_planes_pars_vertex> 2575void main() { 2576 #include <uv_vertex> 2577 #include <uv2_vertex> 2578 #include <color_vertex> 2579 #include <morphcolor_vertex> 2580 #include <beginnormal_vertex> 2581 #include <morphnormal_vertex> 2582 #include <skinbase_vertex> 2583 #include <skinnormal_vertex> 2584 #include <defaultnormal_vertex> 2585 #include <normal_vertex> 2586 #include <begin_vertex> 2587 #include <morphtarget_vertex> 2588 #include <skinning_vertex> 2589 #include <displacementmap_vertex> 2590 #include <project_vertex> 2591 #include <logdepthbuf_vertex> 2592 #include <clipping_planes_vertex> 2593 vViewPosition = - mvPosition.xyz; 2594 #include <worldpos_vertex> 2595 #include <shadowmap_vertex> 2596 #include <fog_vertex> 2597#ifdef USE_TRANSMISSION 2598 vWorldPosition = worldPosition.xyz; 2599#endif 2600}`,meshphysical_frag:`#define STANDARD 2601#ifdef PHYSICAL 2602 #define IOR 2603 #define SPECULAR 2604#endif 2605uniform vec3 diffuse; 2606uniform vec3 emissive; 2607uniform float roughness; 2608uniform float metalness; 2609uniform float opacity; 2610#ifdef IOR 2611 uniform float ior; 2612#endif 2613#ifdef SPECULAR 2614 uniform float specularIntensity; 2615 uniform vec3 specularColor; 2616 #ifdef USE_SPECULARINTENSITYMAP 2617 uniform sampler2D specularIntensityMap; 2618 #endif 2619 #ifdef USE_SPECULARCOLORMAP 2620 uniform sampler2D specularColorMap; 2621 #endif 2622#endif 2623#ifdef USE_CLEARCOAT 2624 uniform float clearcoat; 2625 uniform float clearcoatRoughness; 2626#endif
2627#ifdef USE_IRIDESCENCE 2628 uniform float iridescence; 2629 uniform float iridescenceIOR; 2630 uniform float iridescenceThicknessMinimum; 2631 uniform float iridescenceThicknessMaximum; 2632#endif 2633#ifdef USE_SHEEN 2634 uniform vec3 sheenColor; 2635 uniform float sheenRoughness; 2636 #ifdef USE_SHEENCOLORMAP 2637 uniform sampler2D sheenColorMap; 2638 #endif 2639 #ifdef USE_SHEENROUGHNESSMAP 2640 uniform sampler2D sheenRoughnessMap; 2641 #endif 2642#endif 2643varying vec3 vViewPosition; 2644#include <common> 2645#include <packing> 2646#include <dithering_pars_fragment> 2647#include <color_pars_fragment> 2648#include <uv_pars_fragment> 2649#include <uv2_pars_fragment> 2650#include <map_pars_fragment> 2651#include <alphamap_pars_fragment> 2652#include <alphatest_pars_fragment> 2653#include <aomap_pars_fragment> 2654#include <lightmap_pars_fragment> 2655#include <emissivemap_pars_fragment> 2656#include <bsdfs> 2657#include <iridescence_fragment> 2658#include <cube_uv_reflection_fragment> 2659#include <envmap_common_pars_fragment> 2660#include <envmap_physical_pars_fragment> 2661#include <fog_pars_fragment> 2662#include <lights_pars_begin> 2663#include <normal_pars_fragment> 2664#include <lights_physical_pars_fragment> 2665#include <transmission_pars_fragment> 2666#include <shadowmap_pars_fragment> 2667#include <bumpmap_pars_fragment> 2668#include <normalmap_pars_fragment> 2669#include <clearcoat_pars_fragment> 2670#include <iridescence_pars_fragment> 2671#include <roughnessmap_pars_fragment> 2672#include <metalnessmap_pars_fragment> 2673#include <logdepthbuf_pars_fragment> 2674#include <clipping_planes_pars_fragment> 2675void main() { 2676 #include <clipping_planes_fragment> 2677 vec4 diffuseColor = vec4( diffuse, opacity ); 2678 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2679 vec3 totalEmissiveRadiance = emissive; 2680 #include <logdepthbuf_fragment> 2681 #include <map_fragment> 2682 #include <color_fragment> 2683 #include <alphamap_fragment> 2684 #include <alphatest_fragment> 2685 #include <roughnessmap_fragment> 2686 #include <metalnessmap_fragment> 2687 #include <normal_fragment_begin> 2688 #include <normal_fragment_maps> 2689 #include <clearcoat_normal_fragment_begin> 2690 #include <clearcoat_normal_fragment_maps> 2691 #include <emissivemap_fragment> 2692 #include <lights_physical_fragment> 2693 #include <lights_fragment_begin> 2694 #include <lights_fragment_maps> 2695 #include <lights_fragment_end> 2696 #include <aomap_fragment> 2697 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 2698 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 2699 #include <transmission_fragment> 2700 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 2701 #ifdef USE_SHEEN 2702 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 2703 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; 2704 #endif 2705 #ifdef USE_CLEARCOAT 2706 float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); 2707 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 2708 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; 2709 #endif 2710 #include <output_fragment> 2711 #include <tonemapping_fragment> 2712 #include <encodings_fragment> 2713 #include <fog_fragment> 2714 #include <premultiplied_alpha_fragment> 2715 #include <dithering_fragment> 2716}`,meshtoon_vert:`#define TOON 2717varying vec3 vViewPosition; 2718#include <common> 2719#include <uv_pars_vertex> 2720#include <uv2_pars_vertex> 2721#include <displacementmap_pars_vertex> 2722#include <color_pars_vertex> 2723#include <fog_pars_vertex> 2724#include <normal_pars_vertex> 2725#include <morphtarget_pars_vertex> 2726#include <skinning_pars_vertex> 2727#include <shadowmap_pars_vertex> 2728#include <logdepthbuf_pars_vertex> 2729#include <clipping_planes_pars_vertex> 2730void main() { 2731 #include <uv_vertex> 2732 #include <uv2_vertex> 2733 #include <color_vertex> 2734 #include <morphcolor_vertex> 2735 #include <beginnormal_vertex> 2736 #include <morphnormal_vertex> 2737 #include <skinbase_vertex> 2738 #include <skinnormal_vertex> 2739 #include <defaultnormal_vertex> 2740 #include <normal_vertex> 2741 #include <begin_vertex> 2742 #include <morphtarget_vertex> 2743 #include <skinning_vertex> 2744 #include <displacementmap_vertex> 2745 #include <project_vertex> 2746 #include <logdepthbuf_vertex> 2747 #include <clipping_planes_vertex> 2748 vViewPosition = - mvPosition.xyz; 2749 #include <worldpos_vertex> 2750 #include <shadowmap_vertex> 2751 #include <fog_vertex> 2752}`,meshtoon_frag:`#define TOON 2753uniform vec3 diffuse; 2754uniform vec3 emissive; 2755uniform float opacity; 2756#include <common> 2757#include <packing> 2758#include <dithering_pars_fragment> 2759#include <color_pars_fragment> 2760#include <uv_pars_fragment> 2761#include <uv2_pars_fragment> 2762#include <map_pars_fragment> 2763#include <alphamap_pars_fragment> 2764#include <alphatest_pars_fragment> 2765#include <aomap_pars_fragment> 2766#include <lightmap_pars_fragment> 2767#include <emissivemap_pars_fragment> 2768#include <gradientmap_pars_fragment> 2769#include <fog_pars_fragment> 2770#include <bsdfs> 2771#include <lights_pars_begin> 2772#include <normal_pars_fragment> 2773#include <lights_toon_pars_fragment> 2774#include <shadowmap_pars_fragment> 2775#include <bumpmap_pars_fragment> 2776#include <normalmap_pars_fragment> 2777#include <logdepthbuf_pars_fragment> 2778#include <clipping_planes_pars_fragment> 2779void main() { 2780 #include <clipping_planes_fragment> 2781 vec4 diffuseColor = vec4( diffuse, opacity ); 2782 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2783 vec3 totalEmissiveRadiance = emissive; 2784 #include <logdepthbuf_fragment> 2785 #include <map_fragment> 2786 #include <color_fragment> 2787 #include <alphamap_fragment> 2788 #include <alphatest_fragment> 2789 #include <normal_fragment_begin> 2790 #include <normal_fragment_maps> 2791 #include <emissivemap_fragment> 2792 #include <lights_toon_fragment> 2793 #include <lights_fragment_begin> 2794 #include <lights_fragment_maps> 2795 #include <lights_fragment_end> 2796 #include <aomap_fragment> 2797 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2798 #include <output_fragment> 2799 #include <tonemapping_fragment> 2800 #include <encodings_fragment> 2801 #include <fog_fragment> 2802 #include <premultiplied_alpha_fragment> 2803 #include <dithering_fragment> 2804}`,points_vert:`uniform float size; 2805uniform float scale; 2806#include <common> 2807#include <color_pars_vertex> 2808#include <fog_pars_vertex> 2809#include <morphtarget_pars_vertex> 2810#include <logdepthbuf_pars_vertex> 2811#include <clipping_planes_pars_vertex> 2812void main() { 2813 #include <color_vertex> 2814 #include <morphcolor_vertex> 2815 #include <begin_vertex> 2816 #include <morphtarget_vertex> 2817 #include <project_vertex> 2818 gl_PointSize = size; 2819 #ifdef USE_SIZEATTENUATION 2820 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2821 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 2822 #endif 2823 #include <logdepthbuf_vertex> 2824 #include <clipping_planes_vertex> 2825 #include <worldpos_vertex> 2826 #include <fog_vertex> 2827}`,points_frag:`uniform vec3 diffuse; 2828uniform float opacity; 2829#include <common> 2830#include <color_pars_fragment> 2831#include <map_particle_pars_fragment> 2832#include <alphatest_pars_fragment> 2833#include <fog_pars_fragment> 2834#include <logdepthbuf_pars_fragment> 2835#include <clipping_planes_pars_fragment> 2836void main() { 2837 #include <clipping_planes_fragment> 2838 vec3 outgoingLight = vec3( 0.0 ); 2839 vec4 diffuseColor = vec4( diffuse, opacity ); 2840 #include <logdepthbuf_fragment> 2841 #include <map_particle_fragment> 2842 #include <color_fragment> 2843 #include <alphatest_fragment> 2844 outgoingLight = diffuseColor.rgb; 2845 #include <output_fragment> 2846 #include <tonemapping_fragment> 2847 #include <encodings_fragment> 2848 #include <fog_fragment> 2849 #include <premultiplied_alpha_fragment> 2850}`,shadow_vert:`#include <common> 2851#include <fog_pars_vertex> 2852#include <morphtarget_pars_vertex> 2853#include <skinning_pars_vertex> 2854#include <shadowmap_pars_vertex> 2855void main() { 2856 #include <beginnormal_vertex> 2857 #include <morphnormal_vertex> 2858 #include <skinbase_vertex> 2859 #include <skinnormal_vertex> 2860 #include <defaultnormal_vertex> 2861 #include <begin_vertex> 2862 #include <morphtarget_vertex> 2863 #include <skinning_vertex> 2864 #include <project_vertex> 2865 #include <worldpos_vertex> 2866 #include <shadowmap_vertex> 2867 #include <fog_vertex> 2868}`,shadow_frag:`uniform vec3 color; 2869uniform float opacity; 2870#include <common> 2871#include <packing> 2872#include <fog_pars_fragment> 2873#include <bsdfs> 2874#include <lights_pars_begin> 2875#include <shadowmap_pars_fragment> 2876#include <shadowmask_pars_fragment> 2877void main() { 2878 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 2879 #include <tonemapping_fragment> 2880 #include <encodings_fragment> 2881 #include <fog_fragment> 2882}`,sprite_vert:`uniform float rotation; 2883uniform vec2 center; 2884#include <common> 2885#include <uv_pars_vertex> 2886#include <fog_pars_vertex> 2887#include <logdepthbuf_pars_vertex> 2888#include <clipping_planes_pars_vertex> 2889void main() { 2890 #include <uv_vertex> 2891 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 2892 vec2 scale; 2893 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 2894 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 2895 #ifndef USE_SIZEATTENUATION 2896 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2897 if ( isPerspective ) scale *= - mvPosition.z; 2898 #endif 2899 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 2900 vec2 rotatedPosition; 2901 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 2902 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 2903 mvPosition.xy += rotatedPosition; 2904 gl_Position = projectionMatrix * mvPosition; 2905 #include <logdepthbuf_vertex> 2906 #include <clipping_planes_vertex> 2907 #include <fog_vertex> 2908}`,sprite_frag:`uniform vec3 diffuse; 2909uniform float opacity; 2910#include <common> 2911#include <uv_pars_fragment> 2912#include <map_pars_fragment> 2913#include <alphamap_pars_fragment> 2914#include <alphatest_pars_fragment> 2915#include <fog_pars_fragment> 2916#include <logdepthbuf_pars_fragment> 2917#include <clipping_planes_pars_fragment> 2918void main() { 2919 #include <clipping_planes_fragment> 2920 vec3 outgoingLight = vec3( 0.0 ); 2921 vec4 diffuseColor = vec4( diffuse, opacity ); 2922 #include <logdepthbuf_fragment> 2923 #include <map_fragment> 2924 #include <alphamap_fragment> 2925 #include <alphatest_fragment> 2926 outgoingLight = diffuseColor.rgb; 2927 #include <output_fragment> 2928 #include <tonemapping_fragment> 2929 #include <encodings_fragment> 2930 #include <fog_fragment> 2931}`},sM={common:{diffuse:{value:new iv(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new t7},uv2Transform:{value:new t7},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 t9(1,1)}}
2931,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 iv(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:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{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 iv(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new t7}},sprite:{diffuse:{value:new iv(16777215)},opacity:{value:1},center:{value:new t9(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new t7}}},sE={basic:{uniforms:sr([sM.common,sM.specularmap,sM.envmap,sM.aomap,sM.lightmap,sM.fog]),vertexShader:sA.meshbasic_vert,fragmentShader:sA.meshbasic_frag},lambert:{uniforms:sr([sM.common,sM.specularmap,sM.envmap,sM.aomap,sM.lightmap,sM.emissivemap,sM.bumpmap,sM.normalmap,sM.displacementmap,sM.fog,sM.lights,{emissive:{value:new iv(0)}}]),vertexShader:sA.meshlambert_vert,fragmentShader:sA.meshlambert_frag},phong:{uniforms:sr([sM.common,sM.specularmap,sM.envmap,sM.aomap,sM.lightmap,sM.emissivemap,sM.bumpmap,sM.normalmap,sM.displacementmap,sM.fog,sM.lights,{emissive:{value:new iv(0)},specular:{value:new iv(1118481)},shininess:{value:30}}]),vertexShader:sA.meshphong_vert,fragmentShader:sA.meshphong_frag},standard:{uniforms:sr([sM.common,sM.envmap,sM.aomap,sM.lightmap,sM.emissivemap,sM.bumpmap,sM.normalmap,sM.displacementmap,sM.roughnessmap,sM.metalnessmap,sM.fog,sM.lights,{emissive:{value:new iv(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:sA.meshphysical_vert,fragmentShader:sA.meshphysical_frag},toon:{uniforms:sr([sM.common,sM.aomap,sM.lightmap,sM.emissivemap,sM.bumpmap,sM.normalmap,sM.displacementmap,sM.gradientmap,sM.fog,sM.lights,{emissive:{value:new iv(0)}}]),vertexShader:sA.meshtoon_vert,fragmentShader:sA.meshtoon_frag},matcap:{uniforms:sr([sM.common,sM.bumpmap,sM.normalmap,sM.displacementmap,sM.fog,{matcap:{value:null}}]),vertexShader:sA.meshmatcap_vert,fragmentShader:sA.meshmatcap_frag},points:{uniforms:sr([sM.points,sM.fog]),vertexShader:sA.points_vert,fragmentShader:sA.points_frag},dashed:{uniforms:sr([sM.common,sM.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:sA.linedashed_vert,fragmentShader:sA.linedashed_frag},depth:{uniforms:sr([sM.common,sM.displacementmap]),vertexShader:sA.depth_vert,fragmentShader:sA.depth_frag},normal:{uniforms:sr([sM.common,sM.bumpmap,sM.normalmap,sM.displacementmap,{opacity:{value:1}}]),vertexShader:sA.meshnormal_vert,fragmentShader:sA.meshnormal_frag},sprite:{uniforms:sr([sM.sprite,sM.fog]),vertexShader:sA.sprite_vert,fragmentShader:sA.sprite_frag},background:{uniforms:{uvTransform:{value:new t7},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:sA.background_vert,fragmentShader:sA.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:sA.backgroundCube_vert,fragmentShader:sA.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:sA.cube_vert,fragmentShader:sA.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:sA.equirect_vert,fragmentShader:sA.equirect_frag},distanceRGBA:{uniforms:sr([sM.common,sM.displacementmap,{referencePosition:{value:new iD},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:sA.distanceRGBA_vert,fragmentShader:sA.distanceRGBA_frag},shadow:{uniforms:sr([sM.lights,sM.fog,{color:{value:new iv(0)},opacity:{value:1}}]),vertexShader:sA.shadow_vert,fragmentShader:sA.shadow_frag}};sE.physical={uniforms:sr([sE.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new t9(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new iv(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new t9},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new iv(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new iv(1,1,1)},specularColorMap:{value:null}}]),vertexShader:sA.meshphysical_vert,fragmentShader:sA.meshphysical_frag};var sC={r:0,b:0,g:0};function sT(e,t,i,r,a,o,l){let h=new iv(0),c=!0===o?0:1,d,p,f=null,m=0,g=null;function v(t,i){t.getRGB(sC,ss(e)),r.buffers.color.setClear(sC.r,sC.g,sC.b,i,l)}return{getClearColor:function(){return h},setClearColor:function(e,t=1){h.set(e),v(h,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){v(h,c=e)},render:function(r,o){let l=!1,y=!0===o.isScene?o.background:null;y&&y.isTexture&&(y=(o.backgroundBlurriness>0?i:t).get(y));let x=e.xr,b=x.getSession&&x.getSession();b&&"additive"===b.environmentBlendMode&&(y=null),null===y?v(h,c):y&&y.isColor&&(v(y,1),l=!0),(e.autoClear||l)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),y&&(y.isCubeTexture||306===y.mapping)?(void 0===p&&((p=new r7(new st(1,1,1),new sl({name:"Backgroun
2931dCubeMaterial",uniforms:si(sE.backgroundCube.uniforms),vertexShader:sE.backgroundCube.vertexShader,fragmentShader:sE.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(p)),p.material.uniforms.envMap.value=y,p.material.uniforms.flipEnvMap.value=y.isCubeTexture&&!1===y.isRenderTargetTexture?-1:1,p.material.uniforms.backgroundBlurriness.value=o.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,p.material.toneMapped=3001!==y.encoding,(f!==y||m!==y.version||g!==e.toneMapping)&&(p.material.needsUpdate=!0,f=y,m=y.version,g=e.toneMapping),p.layers.enableAll(),r.unshift(p,p.geometry,p.material,0,0,null)):y&&y.isTexture&&(void 0===d&&((d=new r7(new s_(2,2),new sl({name:"BackgroundMaterial",uniforms:si(sE.background.uniforms),vertexShader:sE.background.vertexShader,fragmentShader:sE.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=y,d.material.uniforms.backgroundIntensity.value=o.backgroundIntensity,d.material.toneMapped=3001!==y.encoding,!0===y.matrixAutoUpdate&&y.updateMatrix(),d.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||m!==y.version||g!==e.toneMapping)&&(d.material.needsUpdate=!0,f=y,m=y.version,g=e.toneMapping),d.layers.enableAll(),r.unshift(d,d.geometry,d.material,0,0,null))}}}function sP(e,t,i,r){let a=e.getParameter(34921),o=r.isWebGL2?null:t.get("OES_vertex_array_object"),l=r.isWebGL2||null!==o,h={},c=g(null),d=c,p=!1;function f(t){return r.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function m(t){return r.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function g(e){let t=[],i=[],r=[];for(let e=0;e<a;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function v(){let e=d.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function y(e){x(e,0)}function x(i,a){let o=d.newAttributes,l=d.enabledAttributes,h=d.attributeDivisors;o[i]=1,0===l[i]&&(e.enableVertexAttribArray(i),l[i]=1),h[i]!==a&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,a),h[i]=a)}function b(){let t=d.newAttributes,i=d.enabledAttributes;for(let r=0,a=i.length;r<a;r++)i[r]!==t[r]&&(e.disableVertexAttribArray(r),i[r]=0)}function w(t,i,a,o,l,h){!0===r.isWebGL2&&(5124===a||5125===a)?e.vertexAttribIPointer(t,i,a,l,h):e.vertexAttribPointer(t,i,a,o,l,h)}function S(){_(),p=!0,d!==c&&f((d=c).object)}function _(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:function(a,c,m,S,_){let A=!1;if(l){let t,i,l,p;let v=(t=!0===c.wireframe,void 0===(i=h[S.id])&&(i={},h[S.id]=i),void 0===(l=i[m.id])&&(l={},i[m.id]=l),void 0===(p=l[t])&&(p=g(r.isWebGL2?e.createVertexArray():o.createVertexArrayOES()),l[t]=p),p);d!==v&&f((d=v).object),(A=function(e,t,i,r){let a=d.attributes,o=t.attributes,l=0,h=i.getAttributes();for(let t in h)if(h[t].location>=0){let i=a[t],r=o[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===i||i.attribute!==r||r&&i.data!==r.data)return!0;l++}return d.attributesNum!==l||d.index!==r}(a,S,m,_))&&function(e,t,i,r){let a={},o=t.attributes,l=0,h=i.getAttributes();for(let t in h)if(h[t].location>=0){let i=o[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let r={};r.attribute=i,i&&i.data&&(r.data=i.data),a[t]=r,l++}d.attributes=a,d.attributesNum=l,d.index=r}(a,S,m,_)}else{let e=!0===c.wireframe;(d.geometry!==S.id||d.program!==m.id||d.wireframe!==e)&&(d.geometry=S.id,d.program=m.id,d.wireframe=e,A=!0)}null!==_&&i.update(_,34963),(A||p)&&(p=!1,function(a,o,l,h){if(!1===r.isWebGL2&&(a.isInstancedMesh||h.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;v();let c=h.attributes,d=l.getAttributes(),p=o.defaultAttributeValues;for(let t in d){let r=d[t];if(r.location>=0){let o=c[t];if(void 0===o&&("instanceMatrix"===t&&a.instanceMatrix&&(o=a.instanceMatrix),"instanceColor"===t&&a.instanceColor&&(o=a.instanceColor)),void 0!==o){let t=
2931o.normalized,l=o.itemSize,c=i.get(o);if(void 0===c)continue;let d=c.buffer,p=c.type,f=c.bytesPerElement;if(o.isInterleavedBufferAttribute){let i=o.data,c=i.stride,m=o.offset;if(i.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)x(r.location+e,i.meshPerAttribute);!0!==a.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let e=0;e<r.locationSize;e++)y(r.location+e);e.bindBuffer(34962,d);for(let e=0;e<r.locationSize;e++)w(r.location+e,l/r.locationSize,p,t,c*f,(m+l/r.locationSize*e)*f)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)x(r.location+e,o.meshPerAttribute);!0!==a.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)y(r.location+e);e.bindBuffer(34962,d);for(let e=0;e<r.locationSize;e++)w(r.location+e,l/r.locationSize,p,t,l*f,l/r.locationSize*e*f)}}else if(void 0!==p){let i=p[t];if(void 0!==i)switch(i.length){case 2:e.vertexAttrib2fv(r.location,i);break;case 3:e.vertexAttrib3fv(r.location,i);break;case 4:e.vertexAttrib4fv(r.location,i);break;default:e.vertexAttrib1fv(r.location,i)}}}}b()}(a,c,m,S),null!==_&&e.bindBuffer(34963,i.get(_).buffer))},reset:S,resetDefaultState:_,dispose:function(){for(let e in S(),h){let t=h[e];for(let e in t){let i=t[e];for(let e in i)m(i[e].object),delete i[e];delete t[e]}delete h[e]}},releaseStatesOfGeometry:function(e){if(void 0===h[e.id])return;let t=h[e.id];for(let e in t){let i=t[e];for(let e in i)m(i[e].object),delete i[e];delete t[e]}delete h[e.id]},releaseStatesOfProgram:function(e){for(let t in h){let i=h[t];if(void 0===i[e.id])continue;let r=i[e.id];for(let e in r)m(r[e].object),delete r[e];delete i[e.id]}},initAttributes:v,enableAttribute:y,disableUnusedAttributes:b}}function sD(e,t,i,r){let a=r.isWebGL2,o;this.setMode=function(e){o=e},this.render=function(t,r){e.drawArrays(o,t,r),i.update(r,o,1)},this.renderInstances=function(r,l,h){let c,d;if(0!==h){if(a)c=e,d="drawArraysInstanced";else if(c=t.get("ANGLE_instanced_arrays"),d="drawArraysInstancedANGLE",null===c){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}c[d](o,r,l,h),i.update(l,o,h)}}}function sO(e,t,i){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let o="u">typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext,l=void 0!==i.precision?i.precision:"highp",h=a(l);h!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);let c=o||t.has("WEBGL_draw_buffers"),d=!0===i.logarithmicDepthBuffer,p=e.getParameter(34930),f=e.getParameter(35660),m=e.getParameter(3379),g=e.getParameter(34076),v=e.getParameter(34921),y=e.getParameter(36347),x=e.getParameter(36348),b=e.getParameter(36349),w=f>0,S=o||t.has("OES_texture_float"),_=o?e.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,precision:l,logarithmicDepthBuffer:d,maxTextures:p,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:g,maxAttributes:v,maxVertexUniforms:y,maxVaryings:x,maxFragmentUniforms:b,vertexTextures:w,floatFragmentTextures:S,floatVertexTextures:w&&S,maxSamples:_}}function sI(e){let t=this,i=null,r=0,a=!1,o=!1,l=new sv,h=new t7,c={value:null,needsUpdate:!1};function d(e,i,r,a){let o=null!==e?e.length:0,d=null;if(0!==o){if(d=c.value,!0!==a||null===d){let t=r+4*o,a=i.matrixWorldInverse;h.getNormalMatrix(a),(null===d||d.length<t)&&(d=new Float32Array(t));for(let t=0,i=r;t!==o;++t,i+=4)l.copy(e[t]).applyMatrix4(a,h),l.normal.toArray(d,i),d[i+3]=l.constant}c.value=d,c.needsUpdate=!0}return t.numPlanes=o,t.numIntersection=0,d}this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==r||a;return a=t,r=e.length,i},this.beginShadows=function(){o=!0,d(null)},this.endShadows=function(){o=!1}
2931,this.setGlobalState=function(e,t){i=d(e,t,0)},this.setState=function(l,h,p){let f=l.clippingPlanes,m=l.clipIntersection,g=l.clipShadows,v=e.get(l);if(a&&null!==f&&0!==f.length&&(!o||g)){let e=o?0:r,t=4*e,a=v.clippingState||null;c.value=a,a=d(f,h,t,p);for(let e=0;e!==t;++e)a[e]=i[e];v.clippingState=a,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=e}else o?d(null):(c.value!==i&&(c.value=i,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}function sR(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function r(e){let i=e.target;i.removeEventListener("dispose",r);let a=t.get(i);void 0!==a&&(t.delete(i),a.dispose())}return{get:function(a){if(a&&a.isTexture&&!1===a.isRenderTargetTexture){let o=a.mapping;if(303===o||304===o){if(t.has(a))return i(t.get(a).texture,a.mapping);{let o=a.image;if(!o||!(o.height>0))return null;{let l=new sp(o.height/2);return l.fromEquirectangularTexture(e,a),t.set(a,l),a.addEventListener("dispose",r),i(l.texture,a.mapping)}}}}return a},dispose:function(){t=new WeakMap}}}var sL=class extends sh{constructor(e=-1,t=1,i=1,r=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=a,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=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,a,o){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,a=i-e,o=i+e,l=r+t,h=r-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=e*this.view.offsetX,o=a+e*this.view.width,l-=t*this.view.offsetY,h=l-t*this.view.height}this.projectionMatrix.makeOrthographic(a,o,l,h,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let 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,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},sB=[.125,.215,.35,.446,.526,.582],sz=new sL,sF=new iv,sN=null,sU=(1+Math.sqrt(5))/2,sk=1/sU,sV=[new iD(1,1,1),new iD(-1,1,1),new iD(1,1,-1),new iD(-1,1,-1),new iD(0,sU,sk),new iD(0,sU,-sk),new iD(sk,0,sU),new iD(-sk,0,sU),new iD(sU,sk,0),new iD(-sU,sk,0)],sj=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){sN=this._renderer.getRenderTarget(),this._setSize(256);let a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,i,r,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=sq(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=sW(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(sN),e.scissorTest=!1,sH(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),sN=this._renderer.getRenderTarget();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,encoding:3e3,depthBuffer:!1},r=sG(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=sG(e,t,i);let{_lodMax:r}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}
2931=function(e){let t=[],i=[],r=[],a=e,o=e-4+1+sB.length;for(let l=0;l<o;l++){let o=Math.pow(2,a);i.push(o);let h=1/o;l>e-4?h=sB[l-e+4-1]:0===l&&(h=0),r.push(h);let c=1/(o-2),d=-c,p=1+c,f=[d,d,p,d,p,p,d,d,p,p,d,p],m=new Float32Array(108),g=new Float32Array(72),v=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,r=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];m.set(r,18*e),g.set(f,12*e);let a=[e,e,e,e,e,e];v.set(a,6*e)}let y=new rQ;y.setAttribute("position",new rN(m,3)),y.setAttribute("uv",new rN(g,2)),y.setAttribute("faceIndex",new rN(v,1)),t.push(y),a>4&&a--}return{lodPlanes:t,sizeLods:i,sigmas:r}}(r)),this._blurMaterial=new sl({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new iD(0,1,0)}},vertexShader:sX(),fragmentShader:` 2932 2933 precision mediump float; 2934 precision mediump int; 2935 2936 varying vec3 vOutputDirection; 2937 2938 uniform sampler2D envMap; 2939 uniform int samples; 2940 uniform float weights[ n ]; 2941 uniform bool latitudinal; 2942 uniform float dTheta; 2943 uniform float mipInt; 2944 uniform vec3 poleAxis; 2945 2946 #define ENVMAP_TYPE_CUBE_UV 2947 #include <cube_uv_reflection_fragment> 2948 2949 vec3 getSample( float theta, vec3 axis ) { 2950 2951 float cosTheta = cos( theta ); 2952 // Rodrigues' axis-angle rotation 2953 vec3 sampleDirection = vOutputDirection * cosTheta 2954 + cross( axis, vOutputDirection ) * sin( theta ) 2955 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 2956 2957 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 2958 2959 } 2960 2961 void main() { 2962 2963 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 2964 2965 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 2966 2967 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 2968 2969 } 2970 2971 axis = normalize( axis ); 2972 2973 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2974 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 2975 2976 for ( int i = 1; i < n; i++ ) { 2977 2978 if ( i >= samples ) { 2979 2980 break; 2981 2982 } 2983 2984 float theta = dTheta * float( i ); 2985 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 2986 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 2987 2988 } 2989 2990 } 2991 `,blending:0,depthTest:!1,depthWrite:!1})}return r}_compileMaterial(e){let t=new r7(this._lodPlanes[0],e);this._renderer.compile(t,sz)}_sceneToCubeUV(e,t,i,r){let a=new sc(90,1,t,i),o=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],h=this._renderer,c=h.autoClear,d=h.toneMapping;h.getClearColor(sF),h.toneMapping=0,h.autoClear=!1;
2991let p=new rB({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),f=new r7(new st,p),m=!1,g=e.background;g?g.isColor&&(p.color.copy(g),e.background=null,m=!0):(p.color.copy(sF),m=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(a.up.set(0,o[t],0),a.lookAt(l[t],0,0)):1===i?(a.up.set(0,0,o[t]),a.lookAt(0,l[t],0)):(a.up.set(0,o[t],0),a.lookAt(0,0,l[t]));let c=this._cubeSize;sH(r,i*c,t>2?c:0,c,c),h.setRenderTarget(r),m&&h.render(f,a),h.render(e,a)}f.geometry.dispose(),f.material.dispose(),h.toneMapping=d,h.autoClear=c,e.background=g}_textureToCubeUV(e,t){let i=this._renderer,r=301===e.mapping||302===e.mapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=sq()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=sW());let a=r?this._cubemapMaterial:this._equirectMaterial,o=new r7(this._lodPlanes[0],a);a.uniforms.envMap.value=e;let l=this._cubeSize;sH(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,sz)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let t=1;t<this._lodPlanes.length;t++){let i=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=sV[(t-1)%sV.length];this._blur(e,t-1,t,i,r)}t.autoClear=i}_blur(e,t,i,r,a){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",a),this._halfBlur(o,e,i,i,r,"longitudinal",a)}_halfBlur(e,t,i,r,a,o,l){let h=this._renderer,c=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");let d=new r7(this._lodPlanes[r],c),p=c.uniforms,f=this._sizeLods[i]-1,m=isFinite(a)?Math.PI/(2*f):2*Math.PI/39,g=a/m,v=isFinite(a)?1+Math.floor(3*g):20;v>20&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${v} samples when the maximum is set to 20`);let y=[],x=0;for(let e=0;e<20;++e){let t=e/g,i=Math.exp(-t*t/2);y.push(i),0===e?x+=i:e<v&&(x+=2*i)}for(let e=0;e<y.length;e++)y[e]=y[e]/x;p.envMap.value=e.texture,p.samples.value=v,p.weights.value=y,p.latitudinal.value="latitudinal"===o,l&&(p.poleAxis.value=l);let{_lodMax:b}=this;p.dTheta.value=m,p.mipInt.value=b-i;let w=this._sizeLods[r],S=4*(this._cubeSize-w);sH(t,3*w*(r>b-4?r-b+4:0),S,3*w,2*w),h.setRenderTarget(t),h.render(d,sz)}};function sG(e,t,i){let r=new iM(e,t,i);return r.texture.mapping=306,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function sH(e,t,i,r,a){e.viewport.set(t,i,r,a),e.scissor.set(t,i,r,a)}function sW(){return new sl({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:sX(),fragmentShader:` 2992 2993 precision mediump float; 2994 precision mediump int; 2995 2996 varying vec3 vOutputDirection; 2997 2998 uniform sampler2D envMap; 2999 3000 #include <common> 3001 3002 void main() { 3003 3004 vec3 outputDirection = normalize( vOutputDirection ); 3005 vec2 uv = equirectUv( outputDirection ); 3006 3007 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3008 3009 } 3010 `,blending:0,depthTest:!1,depthWrite:!1})}function sq(){return new sl({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:sX(),fragmentShader:` 3011 3012 precision mediump float; 3013 precision mediump int; 3014 3015 uniform float flipEnvMap; 3016 3017 varying vec3 vOutputDirection; 3018 3019 uniform samplerCube envMap; 3020 3021 void main() { 3022 3023 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3024 3025 } 3026 `,blending:0,depthTest:!1,depthWrite:!1})}function sX(){return` 3027 3028 precision mediump float; 3029 precision mediump int; 3030 3031 attribute float faceIndex; 3032 3033 varying vec3 vOutputDirection; 3034 3035 // RH coordinate system; PMREM face-indexing convention 3036 vec3 getDirection( vec2 uv, float face ) { 3037 3038 uv = 2.0 * uv - 1.0; 3039 3040 vec3 direction = vec3( uv, 1.0 ); 3041 3042 if ( face == 0.0 ) { 3043 3044 direction = direction.zyx; // ( 1, v, u ) pos x 3045 3046 } else if ( face == 1.0 ) { 3047 3048 direction = direction.xzy; 3049 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3050 3051 } else if ( face == 2.0 ) { 3052 3053 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3054 3055 } else if ( face == 3.0 ) { 3056 3057 direction = direction.zyx; 3058 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3059 3060 } else if ( face == 4.0 ) { 3061 3062 direction = direction.xzy; 3063 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3064 3065 } else if ( face == 5.0 ) { 3066 3067 direction.z *= -1.0; // ( u, v, -1 ) neg z 3068 3069 } 3070 3071 return direction; 3072 3073 } 3074 3075 void main() { 3076 3077 vOutputDirection = getDirection( uv, faceIndex ); 3078 gl_Position = vec4( position, 1.0 ); 3079 3080 } 3081 `}function sY(e){let t=new WeakMap,i=null;function r(e){let i=e.target;i.removeEventListener("dispose",r);let a=t.get(i);void 0!==a&&(t.delete(i),a.dispose())}
3081return{get:function(a){if(a&&a.isTexture){let o=a.mapping,l=303===o||304===o,h=301===o||302===o;if(l||h){if(a.isRenderTargetTexture&&!0===a.needsPMREMUpdate){a.needsPMREMUpdate=!1;let r=t.get(a);return null===i&&(i=new sj(e)),r=l?i.fromEquirectangular(a,r):i.fromCubemap(a,r),t.set(a,r),r.texture}if(t.has(a))return t.get(a).texture;{let o=a.image;if(!(l&&o&&o.height>0||h&&o&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(o)))return null;{null===i&&(i=new sj(e));let o=l?i.fromEquirectangular(a):i.fromCubemap(a);return t.set(a,o),a.addEventListener("dispose",r),o.texture}}}}return a},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function sQ(e){let t={};function i(i){let r;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(i)}return t[i]=r,r}return{has:function(e){return null!==i(e)},init:function(e){e.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(e){let t=i(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function sZ(e,t,i,r){let a={},o=new WeakMap;function l(e){let h=e.target;for(let e in null!==h.index&&t.remove(h.index),h.attributes)t.remove(h.attributes[e]);h.removeEventListener("dispose",l),delete a[h.id];let c=o.get(h);c&&(t.remove(c),o.delete(h)),r.releaseStatesOfGeometry(h),!0===h.isInstancedBufferGeometry&&delete h._maxInstanceCount,i.memory.geometries--}function h(e){let i=[],r=e.index,a=e.attributes.position,l=0;if(null!==r){let e=r.array;l=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],a=e[t+1],o=e[t+2];i.push(r,a,a,o,o,r)}}else{let e=a.array;l=a.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,a=t+2;i.push(e,r,r,a,a,e)}}let h=new(it(i)?rk:rU)(i,1);h.version=l;let c=o.get(e);c&&t.remove(c),o.set(e,h)}return{get:function(e,t){return!0===a[t.id]||(t.addEventListener("dispose",l),a[t.id]=!0,i.memory.geometries++),t},update:function(e){let i=e.attributes;for(let e in i)t.update(i[e],34962);let r=e.morphAttributes;for(let e in r){let i=r[e];for(let e=0,r=i.length;e<r;e++)t.update(i[e],34962)}},getWireframeAttribute:function(e){let t=o.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&h(e)}else h(e);return o.get(e)}}}function sK(e,t,i,r){let a,o,l=r.isWebGL2,h;this.setMode=function(e){h=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(h,r,a,t*o),i.update(r,h,1)},this.renderInstances=function(r,c,d){let p,f;if(0!==d){if(l)p=e,f="drawElementsInstanced";else if(p=t.get("ANGLE_instanced_arrays"),f="drawElementsInstancedANGLE",null===p){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}p[f](h,c,a,r*o,d),i.update(c,h,d)}}}function sJ(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,i,r){switch(t.calls++,i){case 4:t.triangles+=e/3*r;break;case 1:t.lines+=e/2*r;break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function s$(e,t){return e[0]-t[0]}function s0(e,t){return Math.abs(t[1])-Math.abs(e[1])}function s1(e,t,i){let r={},a=new Float32Array(8),o=new WeakMap,l=new iA,h=[];for(let e=0;e<8;e++)h[e]=[e,0];return{update:function(c,d,p,f){let m=c.morphTargetInfluences;if(!0===t.isWebGL2){let r=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,a=void 0!==r?r.length:0,h=o.get(d);
3081if(void 0===h||h.count!==a){let e=function(){b.dispose(),o.delete(d),d.removeEventListener("dispose",e)};void 0!==h&&h.texture.dispose();let i=void 0!==d.morphAttributes.position,r=void 0!==d.morphAttributes.normal,c=void 0!==d.morphAttributes.color,p=d.morphAttributes.position||[],f=d.morphAttributes.normal||[],m=d.morphAttributes.color||[],g=0;!0===i&&(g=1),!0===r&&(g=2),!0===c&&(g=3);let v=d.attributes.position.count*g,y=1;v>t.maxTextureSize&&(y=Math.ceil(v/t.maxTextureSize),v=t.maxTextureSize);let x=new Float32Array(v*y*4*a),b=new iE(x,v,y,a);b.type=1015,b.needsUpdate=!0;let w=4*g;for(let e=0;e<a;e++){let t=p[e],a=f[e],o=m[e],h=v*y*4*e;for(let e=0;e<t.count;e++){let d=e*w;!0===i&&(l.fromBufferAttribute(t,e),x[h+d+0]=l.x,x[h+d+1]=l.y,x[h+d+2]=l.z,x[h+d+3]=0),!0===r&&(l.fromBufferAttribute(a,e),x[h+d+4]=l.x,x[h+d+5]=l.y,x[h+d+6]=l.z,x[h+d+7]=0),!0===c&&(l.fromBufferAttribute(o,e),x[h+d+8]=l.x,x[h+d+9]=l.y,x[h+d+10]=l.z,x[h+d+11]=4===o.itemSize?l.w:1)}}h={count:a,texture:b,size:new t9(v,y)},o.set(d,h),d.addEventListener("dispose",e)}let c=0;for(let e=0;e<m.length;e++)c+=m[e];let p=d.morphTargetsRelative?1:1-c;f.getUniforms().setValue(e,"morphTargetBaseInfluence",p),f.getUniforms().setValue(e,"morphTargetInfluences",m),f.getUniforms().setValue(e,"morphTargetsTexture",h.texture,i),f.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}else{let t=void 0===m?0:m.length,i=r[d.id];if(void 0===i||i.length!==t){i=[];for(let e=0;e<t;e++)i[e]=[e,0];r[d.id]=i}for(let e=0;e<t;e++){let t=i[e];t[0]=e,t[1]=m[e]}i.sort(s0);for(let e=0;e<8;e++)e<t&&i[e][1]?(h[e][0]=i[e][0],h[e][1]=i[e][1]):(h[e][0]=Number.MAX_SAFE_INTEGER,h[e][1]=0);h.sort(s$);let o=d.morphAttributes.position,l=d.morphAttributes.normal,c=0;for(let e=0;e<8;e++){let t=h[e],i=t[0],r=t[1];i!==Number.MAX_SAFE_INTEGER&&r?(o&&d.getAttribute("morphTarget"+e)!==o[i]&&d.setAttribute("morphTarget"+e,o[i]),l&&d.getAttribute("morphNormal"+e)!==l[i]&&d.setAttribute("morphNormal"+e,l[i]),a[e]=r,c+=r):(o&&!0===d.hasAttribute("morphTarget"+e)&&d.deleteAttribute("morphTarget"+e),l&&!0===d.hasAttribute("morphNormal"+e)&&d.deleteAttribute("morphNormal"+e),a[e]=0)}let p=d.morphTargetsRelative?1:1-c;f.getUniforms().setValue(e,"morphTargetBaseInfluence",p),f.getUniforms().setValue(e,"morphTargetInfluences",a)}}}}function s2(e,t,i,r){let a=new WeakMap;function o(e){let t=e.target;t.removeEventListener("dispose",o),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(e){let l=r.render.frame,h=e.geometry,c=t.get(e,h);return a.get(c)!==l&&(t.update(c),a.set(c,l)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",o)&&e.addEventListener("dispose",o),i.update(e.instanceMatrix,34962),null!==e.instanceColor&&i.update(e.instanceColor,34962)),c},dispose:function(){a=new WeakMap}}}var s3=new i_,s4=new iE,s5=new iC,s6=new su,s8=[],s9=[],s7=new Float32Array(16),ae=new Float32Array(9),at=new Float32Array(4);function ai(e,t,i){let r=e[0];if(null==r||r<=0||r>0)return e;let a=t*i,o=s8[a];if(void 0===o&&(o=new Float32Array(a),s8[a]=o),0!==t){r.toArray(o,0);for(let r=1,a=0;r!==t;++r)a+=i,e[r].toArray(o,a)}return o}function ar(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0}function as(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function aa(e,t){let i=s9[t];void 0===i&&(i=new Int32Array(t),s9[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function an(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function ao(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(ar(i,t))return;e.uniform2fv(this.addr,t),as(i,t)}}function al(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(ar(i,t))return;e.uniform3fv(this.addr,t),as(i,t)}}function ah(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(ar(i,t))return;e.uniform4fv(this.addr,t),as(i,t)}}function ac(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(ar(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),as(i,t)}else{if(ar(i,r))return;at.set(r),e.uniformMatrix2fv(this.addr,!1,at),as(i,r)}}function ad(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(ar(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),as(i,t)}else{if(ar(i,r))return;ae.set(r),e.uniformMatrix3fv(this.addr,!1,ae),as(i,r)}}function au(e,t){let i=this.cache,r=t.elements;if(void 0===r){if(ar(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),as(i,t)}else{if(ar(i,r))return;s7.set(r),e.uniformMatrix4fv(this.addr,!1,s7),as(i,r)}}function ap(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function af(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(ar(i,t))return;e.uniform2iv(this.addr,t),as(i,t)}}function am(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(ar(i,t))return;e.uniform3iv(this.addr,t),as(i,t)}}function ag(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(ar(i,t))return;e.uniform4iv(this.addr,t),as(i,t)}}function av(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function ay(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(ar(i,t))return;e.uniform2uiv(this.addr,t),as(i,t)}}function ax(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(ar(i,t))return;e.uniform3uiv(this.addr,t),as(i,t)}}function ab(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(ar(i,t))return;e.uniform4uiv(this.addr,t),as(i,t)}}function aw(e,t,i){let r=this.cache,a=i.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),i.setTexture2D(t||s3,a)}function aS(e,t,i){let r=this.cache,a=i.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),i.setTexture3D(t||s5,a)}function a_(e,t,i){let r=this.cache,a=i.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),i.setTextureCube(t||s6,a)}function aA(e,t,i){let r=this.cache,a=i.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),i.setTexture2DArray(t||s4,a)}function aM(e,t){e.uniform1fv(this.addr,t)}function aE(e,t){let i=ai(t,this.size,2);e.uniform2fv(this.addr,i)}function aC(e,t){let i=ai(t,this.size,3);e.uniform3fv(this.addr,i)}function aT(e,t){let i=ai(t,this.size,4);e.uniform4fv(this.addr,i)}function aP(e,t){let i=ai(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function aD(e,t){let i=ai(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function aO(e,t){let i=ai(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function aI(e,t){e.uniform1iv(this.addr,t)}function aR(e,t){e.uniform2iv(this.addr,t)}function aL(e,t){e.uniform3iv(this.addr,t)}function aB(e,t){e.uniform4iv(this.addr,t)}function az(e,t){e.uniform1uiv(this.addr,t)}function aF(e,t){e.uniform2uiv(this.addr,t)}function aN(e,t){e.uniform3uiv(this.addr,t)}function aU(e,t){e.uniform4uiv(this.addr,t)}function ak(e,t,i){let r=this.cache,a=t.length,o=aa(i,a);
3081ar(r,o)||(e.uniform1iv(this.addr,o),as(r,o));for(let e=0;e!==a;++e)i.setTexture2D(t[e]||s3,o[e])}function aV(e,t,i){let r=this.cache,a=t.length,o=aa(i,a);ar(r,o)||(e.uniform1iv(this.addr,o),as(r,o));for(let e=0;e!==a;++e)i.setTexture3D(t[e]||s5,o[e])}function aj(e,t,i){let r=this.cache,a=t.length,o=aa(i,a);ar(r,o)||(e.uniform1iv(this.addr,o),as(r,o));for(let e=0;e!==a;++e)i.setTextureCube(t[e]||s6,o[e])}function aG(e,t,i){let r=this.cache,a=t.length,o=aa(i,a);ar(r,o)||(e.uniform1iv(this.addr,o),as(r,o));for(let e=0;e!==a;++e)i.setTexture2DArray(t[e]||s4,o[e])}var aH=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=function(e){switch(e){case 5126:return an;case 35664:return ao;case 35665:return al;case 35666:return ah;case 35674:return ac;case 35675:return ad;case 35676:return au;case 5124:case 35670:return ap;case 35667:case 35671:return af;case 35668:case 35672:return am;case 35669:case 35673:return ag;case 5125:return av;case 36294:return ay;case 36295:return ax;case 36296:return ab;case 35678:case 36198:case 36298:case 36306:case 35682:return aw;case 35679:case 36299:case 36307:return aS;case 35680:case 36300:case 36308:case 36293:return a_;case 36289:case 36303:case 36311:case 36292:return aA}}(t.type)}},aW=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return aM;case 35664:return aE;case 35665:return aC;case 35666:return aT;case 35674:return aP;case 35675:return aD;case 35676:return aO;case 5124:case 35670:return aI;case 35667:case 35671:return aR;case 35668:case 35672:return aL;case 35669:case 35673:return aB;case 5125:return az;case 36294:return aF;case 36295:return aN;case 36296:return aU;case 35678:case 36198:case 36298:case 36306:case 35682:return ak;case 35679:case 36299:case 36307:return aV;case 35680:case 36300:case 36308:case 36293:return aj;case 36289:case 36303:case 36311:case 36292:return aG}}(t.type)}},aq=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){if(void 0===t)return;let r=this.seq;for(let a=0,o=r.length;a!==o;++a){let o=r[a];o.setValue(e,t[o.id],i)}}},aX=/(\w+)(\])?(\[|\.)?/g;function aY(e,t){e.seq.push(t),e.map[t.id]=t}var aQ=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){let i=e.getActiveUniform(t,r),a=e.getUniformLocation(t,i.name);!function(e,t,i){let r=e.name,a=r.length;for(aX.lastIndex=0;;){let o=aX.exec(r),l=aX.lastIndex,h=o[1],c="]"===o[2],d=o[3];if(c&&(h|=0),void 0===d||"["===d&&l+2===a){aY(i,void 0===d?new aH(h,e,t):new aW(h,e,t));break}{let e=i.map[h];void 0===e&&aY(i,e=new aq(h)),i=e}}}(i,a,this)}}setValue(e,t,i,r){let a=this.map[t];void 0!==a&&a.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];void 0!==r&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let a=0,o=t.length;a!==o;++a){let o=t[a],l=i[o.id];!1!==l.needsUpdate&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,a=e.length;r!==a;++r){let a=e[r];a.id in t&&i.push(a)}return i}};function aZ(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}var aK=0;function aJ(e,t,i){let r=e.getShaderParameter(t,35713),a=e.getShaderInfoLog(t).trim();if(r&&""===a)return"";let o=/ERROR: 0:(\d+)/.exec(a);if(!o)return a;{let r=parseInt(o[1]);return i.toUpperCase()+` 3082 3083`+a+` 3084 3085`+function(e,t){let i=e.split(` 3086`),r=[],a=Math.max(t-6,0),o=Math.min(t+6,i.length);for(let e=a;e<o;e++){let a=e+1;r.push(`${a===t?">":" "} ${a}: ${i[e]}`)}return r.join(` 3087`)}(e.getShaderSource(t),r)}}function a$(e){return""!==e}function a0(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_L
3087IGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function a1(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var a2=/^[ \t]*#include +<([\w\d./]+)>/gm;function a3(e){return e.replace(a2,a4)}function a4(e,t){let i=sA[t];if(void 0===i)throw Error("Can not resolve #include <"+t+">");return a3(i)}var a5=/#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 a6(e){return e.replace(a5,a8)}function a8(e,t,i,r){let a="";for(let e=parseInt(t);e<parseInt(i);e++)a+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return a}function a9(e){let t="precision "+e.precision+` float; 3088precision `+e.precision+" int;";return"highp"===e.precision?t+=` 3089#define HIGH_PRECISION`:"mediump"===e.precision?t+=` 3090#define MEDIUM_PRECISION`:"lowp"===e.precision&&(t+=` 3091#define LOW_PRECISION`),t}function a7(e,t,i,r){let a,o,l;let h,c,d=e.getContext(),p=i.defines,f=i.vertexShader,m=i.fragmentShader,g=(a="SHADOWMAP_TYPE_BASIC",1===i.shadowMapType?a="SHADOWMAP_TYPE_PCF":2===i.shadowMapType?a="SHADOWMAP_TYPE_PCF_SOFT":3===i.shadowMapType&&(a="SHADOWMAP_TYPE_VSM"),a),v=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),y=(o="ENVMAP_MODE_REFLECTION",i.envMap&&302===i.envMapMode&&(o="ENVMAP_MODE_REFRACTION"),o),x=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),b=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),w=i.isWebGL2?"":[i.extensionDerivatives||i.envMapCubeUVHeight||i.bumpMap||i.tangentSpaceNormalMap||i.clearcoatNormalMap||i.flatShading||"physical"===i.shaderID?"#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(a$).join(` 3092`),S=function(e){let t=[];for(let i in e){let r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join(` 3093`)}(p),_=d.createProgram(),A,M,E=i.glslVersion?"#version "+i.glslVersion+` 3094`:"";i.isRawShaderMaterial?((A=[S].filter(a$).join(` 3095`)).length>0&&(A+=` 3096`),(M=[w,S].filter(a$).join(` 3097`)).length>0&&(M+=` 3098`)):(A=[a9(i),"#define SHADER_NAME "+i.shaderName,S,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+y:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alph
vendor: 4,859 bytes, lines 3098-3100
3098aMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+g:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.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",` 3099`].filter(a$).join(` 3100`),M=[w,a9(i),"#define SHADER_NAME "+i.shaderName,S,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+v:"",i.envMap?"#define "+y:"",i.envMap?"#define "+x:"",b?"#define CUBEUV_TEXEL_WIDTH "+b.texelWidth:"",b?"#define CUBEUV_TEXEL_HEIGHT "+b.texelHeight:"",b?"#define CUBEUV_MAX_MIP "+b.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+g:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.p
3100hysicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?sA.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",sA.encodings_pars_fragment,"vec4 linearToOutputTexel( vec4 value ) { return LinearTo"+(l=function(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(i.outputEncoding))[0]+l[1]+"; }",i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",` 3101`].filter(a$).join(` 3102`)),f=a1(f=a0(f=a3(f),i),i),m=a1(m=a0(m=a3(m),i),i),f=a6(f),m=a6(m),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(E=`#version 300 es 3103`,A=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3104`)+` 3105`+A,M=["#define varying in",i.glslVersion===tq?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===tq?"":"#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(` 3106`)+` 3107`+M);let C=E+A+f,T=E+M+m,P=aZ(d,35633,C),D=aZ(d,35632,T);if(d.attachShader(_,P),d.attachShader(_,D),void 0!==i.index0AttributeName?d.bindAttribLocation(_,0,i.index0AttributeName):!0===i.morphTargets&&d.bindAttribLocation(_,0,"position"),d.linkProgram(_),e.debug.checkShaderErrors){let e=d.getProgramInfoLog(_).trim(),t=d.getShaderInfoLog(P).trim(),i=d.getShaderInfoLog(D).trim(),r=!0,a=!0;if(!1===d.getProgramParameter(_,35714)){r=!1;let t=aJ(d,P,"vertex"),i=aJ(d,D,"fragment");console.error("THREE.WebGLProgram: Shader Error "+d.getError()+" - VALIDATE_STATUS "+d.getProgramParameter(_,35715
3107)+` 3108 3109Program Info Log: `+e+` 3110`+t+` 3111`+i)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):(""===t||""===i)&&(a=!1);a&&(this.diagnostics={runnable:r,programLog:e,vertexShader:{log:t,prefix:A},fragmentShader:{log:i,prefix:M}})}return d.deleteShader(P),d.deleteShader(D),this.getUniforms=function(){return void 0===h&&(h=new aQ(d,_)),h},this.getAttributes=function(){return void 0===c&&(c=function(e,t){let i={},r=e.getProgramParameter(t,35721);for(let a=0;a<r;a++){let r=e.getActiveAttrib(t,a),o=r.name,l=1;35674===r.type&&(l=2),35675===r.type&&(l=3),35676===r.type&&(l=4),i[o]={type:r.type,location:e.getAttribLocation(t,o),locationSize:l}}return i}(d,_)),c},this.destroy=function(){r.releaseStatesOfProgram(this),d.deleteProgram(_),this.program=void 0},this.name=i.shaderName,this.id=aK++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=P,this.fragmentShader=D,this}var ne=0,nt=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return!1===o.has(r)&&(o.add(r),r.usedTimes++),!1===o.has(a)&&(o.add(a),a.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.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){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new ni(e),t.set(e,i)),i}},ni=class{constructor(e){this.id=ne++,this.code=e,this.usedTimes=0}};function nr(e,t,i,r,a,o,l){let h=new ro,c=new nt,d=[],p=a.isWebGL2,f=a.logarithmicDepthBuffer,m=a.vertexTextures,g=a.precision,v={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"};return{getParameters:function(o,h,d,y,x){let b,w,S,_,A=y.fog,M=x.geometry,E=o.isMeshStandardMaterial?y.environment:null,C=(o.isMeshStandardMaterial?i:t).get(o.envMap||E),T=C&&306===C.mapping?C.image.height:null,P=v[o.type];null!==o.precision&&(g=a.getMaxPrecision(o.precision))!==o.precision&&console.warn("THREE.WebGLProgram.getParameters:",o.precision,"not supported, using",g,"instead.");let D=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,O=void 0!==D?D.length:0,I=0;if(void 0!==M.morphAttributes.position&&(I=1),void 0!==M.morphAttributes.normal&&(I=2),void 0!==M.morphAttributes.color&&(I=3),P){let e=sE[P];b=e.vertexShader,w=e.fragmentShader}else b=o.vertexShader,w=o.fragmentShader,c.update(o),S=c.getVertexShaderID(o),_=c.getFragmentShaderID(o);let R=e.getRenderTarget(),L=o.alphaTest>0,B=o.clearcoat>0,z=o.iridescence>0;return{isWebGL2:p,shaderID:P,shaderName:o.type,vertexShader:b,fragmentShader:w,defines:o.defines,customVertexShaderID:S,customFragmentShaderID:_,isRawShaderMaterial:!0===o.isRawShaderMaterial,glslVersion:o.glslVersion,precision:g,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:m,outputEncoding:null===R?e.outputEncoding:!0===R.isXRRenderTarget?R.texture.encoding:3e3,map:!!o.map,matcap:!!o.matcap,envMap:!!C,envMapMode:C&&C.mapping,envMapCubeUVHeight:T,lightMap:!!o.lightMap,aoMap:!!o.aoMap,emissiveMap:!!o.emissiveMap,bumpMap:!!o.bumpMap,normalMap:!!o.normalMap,objectSpaceNormalMap:1===o.normalMapType,tangentSpaceNormalMap:0===o.normalMapType,decodeVideoTexture:!!o.map&&!0===o.map.isVideoTexture&&3001===o.map.encoding,clearcoat:B,clearcoatMap:B&&!!o.clearcoatMap,clearcoatRoughnessMap:B&&!!o.clearcoatRoughnessMap,clearcoatNormalMap:B&&!!o.clearcoatNormalMap,iridescence:z,iridescenceMap:z&&!!o.iridescenceMap,iridescenceThicknessMap:z&&!!o.iridescenceThicknessMap,displacementMap:!!o.displacementMap,roughnessMap:!!o.roughnessMap,metalnessMap:!!o.metalnessMap,specularMap:!!o.specularMap,specularIntensityMap:!!o.specularIntensityMap,specularColorMap:!!o.specularColorMap,opaque:!1===o.transparent&&1===o.blending,alphaMap:!!o.alphaMap,alphaTest:L,gradientMap:!!o.gradientMap,sheen:o.sheen>0,sheenColorMap:!!o.sheenColorMap,sheenRoughnessMap:!!o.sheenRoughnessMap,transmission:o.transmission>0,transmissionMap:!!o.transmissionMap,thicknessMap:!!o.thicknessMap,combine:o.combine,vertexTangents:!!o.normalMap&&!!M.attributes.tangent,vertexColors:o.vertexColors,vertexAlphas:!0===o.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,vertexUvs:!!o.map||!!o.bumpMap||!!o.normalMap||!!o.specularMap||!!o.alphaMap||!!o.emissiveMap||!!o.roughnessMap||!!o.metalnessMap||!!o.clearcoatMap||!!o.clearcoatRoughnessMap||!!o.clearcoatNormalMap||!!o.iridescenceMap||!!o.iridescenceThicknessMap||!!o.displacementMap||!!o.transmissionMap||!!o.thicknessMap||!!o.specularIntensityMap||!!o.specularColorMap||!!o.sheenColorMap||!!o.sheenRoughnessMap,uvsVertexOnly:!(o.map||o.bumpMap||o.normalMap||o.specularMap||o.alphaMap||o.emissiveMap||o.roughnessMap||o.metalnessMap||o.clearcoatNormalMap||o.iridescenceMap||o.iridescenceThicknessMap||o.transmission>0||o.transmissionMap||o.thicknessMap||o.specularIntensityMap||o.specularColorMap||o.sheen>0||o.sheenColorMap||o.sheenRoughnessMap)&&!!o.displacementMap,fog:!!A,useFog:!0===o.fog,fogExp2:A&&A.isFogExp2,flatShading:!!o.flatShading,sizeAttenuation:o.sizeAttenuation,logarithmicDepthBuffer:f,skinning:!0===x.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:O,morphTextureStride:I,numDirLights:h.directional.length,numPointLights:h.point.length,numSpotLights:h.spot.length,numSpotLightMaps:h.spotLightMap.length,numRectAreaLights:h.rectArea.length,numHemiLights:h.hemi.length,numDirLightShadows:h.directionalShadowMap.length,numPointLightShadows:h.pointShadowMap.length,numSpotLightShadows:h.spotShadowMap.length,numSpotLightShadowsWithMaps:h.numSpotLightShadowsWithMaps,numClippingPlanes:l.numPlanes,numClipIntersection:l.numIntersection,dithering:o.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:o.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:o.premultipliedAlpha,doubleSided:2===o.side,flipSided:1===o.side,useDepthPacking:!!o.depthPacking,depthPacking:o.depthPacking||0,index0AttributeName:o.index0AttributeName,extensionDerivatives:o.extensions&&o.extensions.derivatives,extensionFragDepth:o.extensions&&o.extensions.fragDepth,extensionDrawBuffers:o.extensions&&o.extensions.drawBuffers,extensionShaderTextureLOD:o.extensions&&o.extensions.shaderTextureLOD,rendererExtensionFragDepth:
3111p||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:p||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:p||r.has("EXT_shader_texture_lod"),customProgramCacheKey:o.customProgramCacheKey()}},getProgramCacheKey:function(t){let i=[];if(t.shaderID?i.push(t.shaderID):(i.push(t.customVertexShaderID),i.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)i.push(e),i.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i.push(t.precision),i.push(t.outputEncoding),i.push(t.envMapMode),i.push(t.envMapCubeUVHeight),i.push(t.combine),i.push(t.vertexUvs),i.push(t.fogExp2),i.push(t.sizeAttenuation),i.push(t.morphTargetsCount),i.push(t.morphAttributeCount),i.push(t.numDirLights),i.push(t.numPointLights),i.push(t.numSpotLights),i.push(t.numSpotLightMaps),i.push(t.numHemiLights),i.push(t.numRectAreaLights),i.push(t.numDirLightShadows),i.push(t.numPointLightShadows),i.push(t.numSpotLightShadows),i.push(t.numSpotLightShadowsWithMaps),i.push(t.shadowMapType),i.push(t.toneMapping),i.push(t.numClippingPlanes),i.push(t.numClipIntersection),i.push(t.depthPacking),h.disableAll(),t.isWebGL2&&h.enable(0),t.supportsVertexTextures&&h.enable(1),t.instancing&&h.enable(2),t.instancingColor&&h.enable(3),t.map&&h.enable(4),t.matcap&&h.enable(5),t.envMap&&h.enable(6),t.lightMap&&h.enable(7),t.aoMap&&h.enable(8),t.emissiveMap&&h.enable(9),t.bumpMap&&h.enable(10),t.normalMap&&h.enable(11),t.objectSpaceNormalMap&&h.enable(12),t.tangentSpaceNormalMap&&h.enable(13),t.clearcoat&&h.enable(14),t.clearcoatMap&&h.enable(15),t.clearcoatRoughnessMap&&h.enable(16),t.clearcoatNormalMap&&h.enable(17),t.iridescence&&h.enable(18),t.iridescenceMap&&h.enable(19),t.iridescenceThicknessMap&&h.enable(20),t.displacementMap&&h.enable(21),t.specularMap&&h.enable(22),t.roughnessMap&&h.enable(23),t.metalnessMap&&h.enable(24),t.gradientMap&&h.enable(25),t.alphaMap&&h.enable(26),t.alphaTest&&h.enable(27),t.vertexColors&&h.enable(28),t.vertexAlphas&&h.enable(29),t.vertexUvs&&h.enable(30),t.vertexTangents&&h.enable(31),t.uvsVertexOnly&&h.enable(32),i.push(h.mask),h.disableAll(),t.fog&&h.enable(0),t.useFog&&h.enable(1),t.flatShading&&h.enable(2),t.logarithmicDepthBuffer&&h.enable(3),t.skinning&&h.enable(4),t.morphTargets&&h.enable(5),t.morphNormals&&h.enable(6),t.morphColors&&h.enable(7),t.premultipliedAlpha&&h.enable(8),t.shadowMapEnabled&&h.enable(9),t.physicallyCorrectLights&&h.enable(10),t.doubleSided&&h.enable(11),t.flipSided&&h.enable(12),t.useDepthPacking&&h.enable(13),t.dithering&&h.enable(14),t.specularIntensityMap&&h.enable(15),t.specularColorMap&&h.enable(16),t.transmission&&h.enable(17),t.transmissionMap&&h.enable(18),t.thicknessMap&&h.enable(19),t.sheen&&h.enable(20),t.sheenColorMap&&h.enable(21),t.sheenRoughnessMap&&h.enable(22),t.decodeVideoTexture&&h.enable(23),t.opaque&&h.enable(24),i.push(h.mask),i.push(e.outputEncoding)),i.push(t.customProgramCacheKey),i.join()},getUniforms:function(e){let t=v[e.type],i;if(t){let e=sE[t];i=sa.clone(e.uniforms)}else i=e.uniforms;return i},acquireProgram:function(t,i){let r;for(let e=0,t=d.length;e<t;e++){let t=d[e];if(t.cacheKey===i){r=t,++r.usedTimes;break}}return void 0===r&&(r=new a7(e,i,t,o),d.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=d.indexOf(e);d[t]=d[d.length-1],d.pop(),e.destroy()}},releaseShaderCache:function(e){c.remove(e)},programs:d,dispose:function(){c.dispose()}}}function ns(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,r){e.get(t)[i]=r},dispose:function(){e=new WeakMap}}}function na(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function nn(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function no(){let e=[],t=0,i=[],r=[],a=[];function o(i,r,a,o,l,h){let c=e[t];return void 0===c?(c={id:i.id,object:i,geometry:r,material:a,groupOrder:o,renderOrder:i.renderOrder,z:l,group:h},e[t]=c):(c.id=i.id,c.object=i,c.geometry=r,c.material=a,c.groupOrder=o,c.renderOrder=i.renderOrder,c.z=l,c.group=h),t++,c}return{opaque:i,transmissive:r,transparent:a,init:function(){t=0,i.length=0,r.length=0,a.length=0},push:function(e,t,l,h,c,d){let p=o(e,t,l,h,c,d);l.transmission>0?r.push(p):!0===l.transparent?a.push(p):i.push(p)},unshift:function(e,t,l,h,c,d){let p=o(e,t,l,h,c,d);l.transmission>0?r.unshift(p):!0===l.transparent?a.unshift(p):i.unshift(p)},finish:function(){for(let i=t,r=e.length;i<r;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||na),r.length>1&&r.sort(t||nn),a.length>1&&a.sort(t||nn)}}}function nl(){let e=new WeakMap;return{get:function(t,i){let r=e.get(t),a;return void 0===r?(a=new no,e.set(t,[a])):i>=r.length?(a=new no,r.push(a)):a=r[i],a},dispose:function(){e=new WeakMap}}}function nh(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new iD,color:new iv};break;case"SpotLight":i={position:new iD,direction:new iD,color:new iv,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new iD,color:new iv,distance:0,decay:0};break;case"HemisphereLight":i={direction:new iD,skyColor:new iv,groundColor:new iv};break;case"RectAreaLight":i={color:new iv,position:new iD,halfWidth:new iD,halfHeight:new iD}}return e[t.id]=i,i}}}var nc=0;
3111function nd(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function nu(e,t){let i;let r=new nh,a=(i={},{get:function(e){let t;if(void 0!==i[e.id])return i[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t9};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t9,shadowCameraNear:1,shadowCameraFar:1e3}}return i[e.id]=t,t}}),o={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let e=0;e<9;e++)o.probe.push(new iD);let l=new iD,h=new i6,c=new i6;return{setup:function(i,l){let h=0,c=0,d=0;for(let e=0;e<9;e++)o.probe[e].set(0,0,0);let p=0,f=0,m=0,g=0,v=0,y=0,x=0,b=0,w=0,S=0;i.sort(nd);let _=!0!==l?Math.PI:1;for(let e=0,t=i.length;e<t;e++){let t=i[e],l=t.color,A=t.intensity,M=t.distance,E=t.shadow&&t.shadow.map?t.shadow.map.texture:null;if(t.isAmbientLight)h+=l.r*A*_,c+=l.g*A*_,d+=l.b*A*_;else if(t.isLightProbe)for(let e=0;e<9;e++)o.probe[e].addScaledVector(t.sh.coefficients[e],A);else if(t.isDirectionalLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*_),t.castShadow){let e=t.shadow,i=a.get(t);i.shadowBias=e.bias,i.shadowNormalBias=e.normalBias,i.shadowRadius=e.radius,i.shadowMapSize=e.mapSize,o.directionalShadow[p]=i,o.directionalShadowMap[p]=E,o.directionalShadowMatrix[p]=t.shadow.matrix,y++}o.directional[p]=e,p++}else if(t.isSpotLight){let e=r.get(t);e.position.setFromMatrixPosition(t.matrixWorld),e.color.copy(l).multiplyScalar(A*_),e.distance=M,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=t.decay,o.spot[m]=e;let i=t.shadow;if(t.map&&(o.spotLightMap[w]=t.map,w++,i.updateMatrices(t),t.castShadow&&S++),o.spotLightMatrix[m]=i.matrix,t.castShadow){let e=a.get(t);e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,o.spotShadow[m]=e,o.spotShadowMap[m]=E,b++}m++}else if(t.isRectAreaLight){let e=r.get(t);e.color.copy(l).multiplyScalar(A),e.halfWidth.set(.5*t.width,0,0),e.halfHeight.set(0,.5*t.height,0),o.rectArea[g]=e,g++}else if(t.isPointLight){let e=r.get(t);if(e.color.copy(t.color).multiplyScalar(t.intensity*_),e.distance=t.distance,e.decay=t.decay,t.castShadow){let e=t.shadow,i=a.get(t);i.shadowBias=e.bias,i.shadowNormalBias=e.normalBias,i.shadowRadius=e.radius,i.shadowMapSize=e.mapSize,i.shadowCameraNear=e.camera.near,i.shadowCameraFar=e.camera.far,o.pointShadow[f]=i,o.pointShadowMap[f]=E,o.pointShadowMatrix[f]=t.shadow.matrix,x++}o.point[f]=e,f++}else if(t.isHemisphereLight){let e=r.get(t);e.skyColor.copy(t.color).multiplyScalar(A*_),e.groundColor.copy(t.groundColor).multiplyScalar(A*_),o.hemi[v]=e,v++}}g>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(o.rectAreaLTC1=sM.LTC_FLOAT_1,o.rectAreaLTC2=sM.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(o.rectAreaLTC1=sM.LTC_HALF_1,o.rectAreaLTC2=sM.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),o.ambient[0]=h,o.ambient[1]=c,o.ambient[2]=d;let A=o.hash;(A.directionalLength!==p||A.pointLength!==f||A.spotLength!==m||A.rectAreaLength!==g||A.hemiLength!==v||A.numDirectionalShadows!==y||A.numPointShadows!==x||A.numSpotShadows!==b||A.numSpotMaps!==w)&&(o.directional.length=p,o.spot.length=m,o.rectArea.length=g,o.point.length=f,o.hemi.length=v,o.directionalShadow.length=y,o.directionalShadowMap.length=y,o.pointShadow.length=x,o.pointShadowMap.length=x,o.spotShadow.length=b,o.spotShadowMap.length=b,o.directionalShadowMatrix.length=y,o.pointShadowMatrix.length=x,o.spotLightMatrix.length=b+w-S,o.spotLightMap.length=w,o.numSpotLightShadowsWithMaps=S,A.directionalLength=p,A.pointLength=f,A.spotLength=m,A.rectAreaLength=g,A.hemiLength=v,A.numDirectionalShadows=y,A.numPointShadows=x,A.numSpotShadows=b,A.numSpotMaps=w,o.version=nc++)},setupView:function(e,t){let i=0,r=0,a=0,d=0,p=0,f=t.matrixWorldInverse;for(let t=0,m=e.length;t<m;t++){let m=e[t];if(m.isDirectionalLight){let e=o.directional[i];e.direction.setFromMatrixPosition(m.matrixWorld),l.setFromMatrixPosition(m.target.matrixWorld),e.direction.sub(l),e.direction.transformDirection(f),i++}else if(m.isSpotLight){let e=o.spot[a];e.position.setFromMatrixPosition(m.matrixWorld),e.position.applyMatrix4(f),e.direction.setFromMatrixPosition(m.matrixWorld),l.setFromMatrixPosition(m.target.matrixWorld),e.direction.sub(l),e.direction.transformDirection(f),a++}else if(m.isRectAreaLight){let e=o.rectArea[d];e.position.setFromMatrixPosition(m.matrixWorld),e.position.applyMatrix4(f),c.identity(),h.copy(m.matrixWorld),h.premultiply(f),c.extractRotation(h),e.halfWidth.set(.5*m.width,0,0),e.halfHeight.set(0,.5*m.height,0),e.halfWidth.applyMatrix4(c),e.halfHeight.applyMatrix4(c),d++}else if(m.isPointLight){let e=o.point[r];e.position.setFromMatrixPosition(m.matrixWorld),e.position.applyMatrix4(f),r++}else if(m.isHemisphereLight){let e=o.hemi[p];e.direction.setFromMatrixPosition(m.matrixWorld),e.direction.transformDirection(f),p++}}},state:o}}function np(e,t){let i=new nu(e,t),r=[],a=[];return{init:function(){r.length=0,a.length=0},state:{lightsArray:r,shadowsArray:a,lights:i},setupLights:function(e){i.setup(r,e)},setupLightsView:function(e){i.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){a.push(e)}}}function nf(e,t){let i=new WeakMap;return{get:function(r,a=0){let o=i.get(r),l;return void 0===o?(l=new np(e,t),i.set(r,[l])):a>=o.length?(l=new np(e,t),o.push(l)):l=o[a],l},dispose:function(){i=new WeakMap}}}var nm=class extends rL{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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}},ng=class extends rL{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new iD,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}},nv=`void main() { 3112 gl_Position = vec4( position, 1.0 ); 3113}`,ny=`uniform sampler2D shadow_pass; 3114uniform vec2 resolution; 3115uniform float radius; 3116#include <packing> 3117void main() {
3118 const float samples = float( VSM_SAMPLES ); 3119 float mean = 0.0; 3120 float squared_mean = 0.0; 3121 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3122 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3123 for ( float i = 0.0; i < samples; i ++ ) { 3124 float uvOffset = uvStart + i * uvStride; 3125 #ifdef HORIZONTAL_PASS 3126 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3127 mean += distribution.x; 3128 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3129 #else 3130 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3131 mean += depth; 3132 squared_mean += depth * depth; 3133 #endif 3134 } 3135 mean = mean / samples; 3136 squared_mean = squared_mean / samples; 3137 float std_dev = sqrt( squared_mean - mean * mean ); 3138 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3139}`;function nx(e,t,i){let r=new sb,a=new t9,o=new t9,l=new iA,h=new nm({depthPacking:3201}),c=new ng,d={},p=i.maxTextureSize,f={0:1,1:0,2:2},m=new sl({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t9},radius:{value:4}},vertexShader:nv,fragmentShader:ny}),g=m.clone();g.defines.HORIZONTAL_PASS=1;let v=new rQ;v.setAttribute("position",new rN(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new r7(v,m),x=this;function b(t,i,r,a,o,l){let p=null,m=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==m)p=m;else if(p=!0===r.isPointLight?c:h,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=p.uuid,t=i.uuid,r=d[e];void 0===r&&(r={},d[e]=r);let a=r[t];void 0===a&&(a=p.clone(),r[t]=a),p=a}return p.visible=i.visible,p.wireframe=i.wireframe,3===l?p.side=null!==i.shadowSide?i.shadowSide:i.side:p.side=null!==i.shadowSide?i.shadowSide:f[i.side],p.alphaMap=i.alphaMap,p.alphaTest=i.alphaTest,p.map=i.map,p.clipShadows=i.clipShadows,p.clippingPlanes=i.clippingPlanes,p.clipIntersection=i.clipIntersection,p.displacementMap=i.displacementMap,p.displacementScale=i.displacementScale,p.displacementBias=i.displacementBias,p.wireframeLinewidth=i.wireframeLinewidth,p.linewidth=i.linewidth,!0===r.isPointLight&&!0===p.isMeshDistanceMaterial&&(p.referencePosition.setFromMatrixPosition(r.matrixWorld),p.nearDistance=a,p.farDistance=o),p}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(i,h,c){if(!1===x.enabled||!1===x.autoUpdate&&!1===x.needsUpdate||0===i.length)return;let d=e.getRenderTarget(),f=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),w=e.state;w.setBlending(0),w.buffers.color.setClear(1,1,1,1),w.buffers.depth.setTest(!0),w.setScissorTest(!1);for(let d=0,f=i.length;d<f;d++){let f=i[d],v=f.shadow;if(void 0===v){console.warn("THREE.WebGLShadowMap:",f,"has no shadow.");continue}if(!1===v.autoUpdate&&!1===v.needsUpdate)continue;a.copy(v.mapSize);let x=v.getFrameExtents();if(a.multiply(x),o.copy(v.mapSize),(a.x>p||a.y>p)&&(a.x>p&&(o.x=Math.floor(p/x.x),a.x=o.x*x.x,v.mapSize.x=o.x),a.y>p&&(o.y=Math.floor(p/x.y),a.y=o.y*x.y,v.mapSize.y=o.y)),null===v.map){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};v.map=new iM(a.x,a.y,e),v.map.texture.name=f.name+".shadowMap",v.camera.updateProjectionMatrix()}e.setRenderTarget(v.map),e.clear();let S=v.getViewportCount();for(let i=0;i<S;i++){let a=v.getViewport(i);l.set(o.x*a.x,o.y*a.y,o.x*a.z,o.y*a.w),w.viewport(l),v.updateMatrices(f,i),r=v.getFrustum(),function i(a,o,l,h,c){if(!1===a.visible)return;if(a.layers.test(o.layers)&&(a.isMesh||a.isLine||a.isPoints)&&(a.castShadow||a.receiveShadow&&3===c)&&(!a.frustumCulled||r.intersectsObject(a))){a.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,a.matrixWorld);let i=t.update(a),r=a.material;if(Array.isArray(r)){let t=i.groups;for(let o=0,d=t.length;o<d;o++){let d=t[o],p=r[d.materialIndex];if(p&&p.visible){let t=b(a,p,h,l.near,l.far,c);e.renderBufferDirect(l,null,i,t,a,d)}}}else if(r.visible){let t=b(a,r,h,l.near,l.far,c);e.renderBufferDirect(l,null,i,t,a,null)}}let d=a.children;for(let e=0,t=d.length;e<t;e++)i(d[e],o,l,h,c)}(h,c,v.camera,f,this.type)}!0!==v.isPointLightShadow&&3===this.type&&function(i,r){let o=t.update(y);m.defines.VSM_SAMPLES!==i.blurSamples&&(m.defines.VSM_SAMPLES=i.blurSamples,g.defines.VSM_SAMPLES=i.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new iM(a.x,a.y)),m.uniforms.shadow_pass.value=i.map.texture,m.uniforms.resolution.value=i.mapSize,m.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(r,null,o,m,y,null),g.uniforms.shadow_pass.value=i.mapPass.texture,g.uniforms.resolution.value=i.mapSize,g.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(r,null,o,g,
3139y,null)}(v,c),v.needsUpdate=!1}x.needsUpdate=!1,e.setRenderTarget(d,f,v)}}function nb(e,t,i){let r=i.isWebGL2,a=new function(){let t=!1,i=new iA,r=null,a=new iA(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,o,l,h){!0===h&&(t*=l,r*=l,o*=l),i.set(t,r,o,l),!1===a.equals(i)&&(e.clearColor(t,r,o,l),a.copy(i))},reset:function(){t=!1,r=null,a.set(-1,0,0,0)}}},o=new function(){let t=!1,i=null,r=null,a=null;return{setTest:function(e){e?j(2929):G(2929)},setMask:function(r){i===r||t||(e.depthMask(r),i=r)},setFunc:function(t){if(r!==t){switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:default:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517)}r=t}},setLocked:function(e){t=e},setClear:function(t){a!==t&&(e.clearDepth(t),a=t)},reset:function(){t=!1,i=null,r=null,a=null}}},l=new function(){let t=!1,i=null,r=null,a=null,o=null,l=null,h=null,c=null,d=null;return{setTest:function(e){t||(e?j(2960):G(2960))},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,l){(r!==t||a!==i||o!==l)&&(e.stencilFunc(t,i,l),r=t,a=i,o=l)},setOp:function(t,i,r){(l!==t||h!==i||c!==r)&&(e.stencilOp(t,i,r),l=t,h=i,c=r)},setLocked:function(e){t=e},setClear:function(t){d!==t&&(e.clearStencil(t),d=t)},reset:function(){t=!1,i=null,r=null,a=null,o=null,l=null,h=null,c=null,d=null}}},h=new WeakMap,c=new WeakMap,d={},p={},f=new WeakMap,m=[],g=null,v=!1,y=null,x=null,b=null,w=null,S=null,_=null,A=null,M=!1,E=null,C=null,T=null,P=null,D=null,O=e.getParameter(35661),I=!1,R=e.getParameter(7938);-1!==R.indexOf("WebGL")?I=parseFloat(/^WebGL (\d)/.exec(R)[1])>=1:-1!==R.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(R)[1])>=2);let L=null,B={},z=e.getParameter(3088),F=e.getParameter(2978),N=new iA().fromArray(z),U=new iA().fromArray(F);function k(t,i,r){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;t<r;t++)e.texImage2D(i+t,0,6408,1,1,0,6408,5121,a);return o}let V={};function j(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function G(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}V[3553]=k(3553,3553,1),V[34067]=k(34067,34069,6),a.setClear(0,0,0,1),o.setClear(1),l.setClear(0),j(2929),o.setFunc(3),X(!1),Y(1),j(2884),q(0);let H={100:32774,101:32778,102:32779};if(r)H[103]=32775,H[104]=32776;else{let e=t.get("EXT_blend_minmax");null!==e&&(H[103]=e.MIN_EXT,H[104]=e.MAX_EXT)}let W={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function q(t,i,r,a,o,l,h,c){if(0===t){!0===v&&(G(3042),v=!1);return}if(!1===v&&(j(3042),v=!0),5!==t){if(t!==y||c!==M){if((100!==x||100!==S)&&(e.blendEquation(32774),x=100,S=100),c)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}b=null,w=null,_=null,A=null,y=t,M=c}return}o=o||i,l=l||r,h=h||a,(i!==x||o!==S)&&(e.blendEquationSeparate(H[i],H[o]),x=i,S=o),(r!==b||a!==w||l!==_||h!==A)&&(e.blendFuncSeparate(W[r],W[a],W[l],W[h]),b=r,w=a,_=l,A=h),y=t,M=!1}function X(t){E!==t&&(t?e.frontFace(2304):e.frontFace(2305),E=t)}function Y(t){0!==t?(j(2884),t!==C&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):G(2884),C=t}function Q(t,i,r){t?(j(32823),(P!==i||D!==r)&&(e.polygonOffset(i,r),P=i,D=r)):G(32823)}return{buffers:{color:a,depth:o,stencil:l},enable:j,disable:G,bindFramebuffer:function(t,i){return p[t]!==i&&(e.bindFramebuffer(t,i),p[t]=i,r&&(36009===t&&(p[36160]=i),36160===t&&(p[36009]=i)),!0)},drawBuffers:function(r,a){let o=m,l=!1;if(r){if(void 0===(o=f.get(a))&&(o=[],f.set(a,o)),r.isWebGLMultipleRenderTargets){let e=r.texture;if(o.length!==e.length||36064!==o[0]){for(let t=0,i=e.length;t<i;t++)o[t]=36064+t;o.length=e.length,l=!0}}else 36064!==o[0]&&(o[0]=36064,l=!0)}else 1029!==o[0]&&(o[0]=1029,l=!0);
3139l&&(i.isWebGL2?e.drawBuffers(o):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(o))},useProgram:function(t){return g!==t&&(e.useProgram(t),g=t,!0)},setBlending:q,setMaterial:function(e,t){2===e.side?G(2884):j(2884);let i=1===e.side;t&&(i=!i),X(i),1===e.blending&&!1===e.transparent?q(0):q(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),o.setFunc(e.depthFunc),o.setTest(e.depthTest),o.setMask(e.depthWrite),a.setMask(e.colorWrite);let r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?j(32926):G(32926)},setFlipSided:X,setCullFace:Y,setLineWidth:function(t){t!==T&&(I&&e.lineWidth(t),T=t)},setPolygonOffset:Q,setScissorTest:function(e){e?j(3089):G(3089)},activeTexture:function(t){void 0===t&&(t=33984+O-1),L!==t&&(e.activeTexture(t),L=t)},bindTexture:function(t,i,r){void 0===r&&(r=null===L?33984+O-1:L);let a=B[r];void 0===a&&(a={type:void 0,texture:void 0},B[r]=a),(a.type!==t||a.texture!==i)&&(L!==r&&(e.activeTexture(r),L=r),e.bindTexture(t,i||V[t]),a.type=t,a.texture=i)},unbindTexture:function(){let t=B[L];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,i){let r=c.get(i);void 0===r&&(r=new WeakMap,c.set(i,r));let a=r.get(t);void 0===a&&(a=e.getUniformBlockIndex(i,t.name),r.set(t,a))},uniformBlockBinding:function(t,i){let r=c.get(i).get(t);h.get(i)!==r&&(e.uniformBlockBinding(i,r,t.__bindingPointIndex),h.set(i,r))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===N.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),N.copy(t))},viewport:function(t){!1===U.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),U.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===r&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},L=null,B={},p={},f=new WeakMap,m=[],g=null,v=!1,y=null,x=null,b=null,w=null,S=null,_=null,A=null,M=!1,E=null,C=null,T=null,P=null,D=null,N.set(0,0,e.canvas.width,e.canvas.height),U.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),l.reset()}}}function nw(e,t,i,r,a,o,l){let h=a.isWebGL2,c=a.maxTextures,d=a.maxCubemapSize,p=a.maxTextureSize,f=a.maxSamples,m=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,g=!(typeof navigator>"u")&&/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap,y,x=new WeakMap,b=!1;try{b="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch{}function w(e,t){return b?new OffscreenCanvas(e,t):is("canvas")}function S(e,t,i,r){let a=1;if((e.width>r||e.height>r)&&(a=r/Math.max(e.width,e.height)),a<1||!0===t){if(!("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap))return"data"in e&&c
3139onsole.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e;{let r=t?t4:Math.floor,o=r(a*e.width),l=r(a*e.height);void 0===y&&(y=w(o,l));let h=i?w(o,l):y;return h.width=o,h.height=l,h.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),h}}return e}function _(e){return t2(e.width)&&t2(e.height)}function A(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function M(t){e.generateMipmap(t)}function E(i,r,a,o,l=!1){if(!1===h)return r;if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let c=r;return 6403===r&&(5126===a&&(c=33326),5131===a&&(c=33325),5121===a&&(c=33321)),33319===r&&(5126===a&&(c=33328),5131===a&&(c=33327),5121===a&&(c=33323)),6408===r&&(5126===a&&(c=34836),5131===a&&(c=34842),5121===a&&(c=3001===o&&!1===l?35907:32856),32819===a&&(c=32854),32820===a&&(c=32855)),(33325===c||33326===c||33327===c||33328===c||34842===c||34836===c)&&t.get("EXT_color_buffer_float"),c}function C(e,t,i){return!0===A(e,i)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function T(e){return 1003===e||1004===e||1005===e?9728:9729}function P(e){let t=e.target;t.removeEventListener("dispose",P),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let i=e.source,a=x.get(i);if(a){let r=a[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&O(e),0===Object.keys(a).length&&x.delete(i)}r.remove(e)}(t),t.isVideoTexture&&v.delete(t)}function D(t){let i=t.target;i.removeEventListener("dispose",D),function(t){let i=t.texture,a=r.get(t),o=r.get(i);if(void 0!==o.__webglTexture&&(e.deleteTexture(o.__webglTexture),l.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(a.__webglFramebuffer[t]),a.__webglDepthbuffer&&e.deleteRenderbuffer(a.__webglDepthbuffer[t]);else{if(e.deleteFramebuffer(a.__webglFramebuffer),a.__webglDepthbuffer&&e.deleteRenderbuffer(a.__webglDepthbuffer),a.__webglMultisampledFramebuffer&&e.deleteFramebuffer(a.__webglMultisampledFramebuffer),a.__webglColorRenderbuffer)for(let t=0;t<a.__webglColorRenderbuffer.length;t++)a.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(a.__webglColorRenderbuffer[t]);a.__webglDepthRenderbuffer&&e.deleteRenderbuffer(a.__webglDepthRenderbuffer)}if(t.isWebGLMultipleRenderTargets)for(let t=0,a=i.length;t<a;t++){let a=r.get(i[t]);a.__webglTexture&&(e.deleteTexture(a.__webglTexture),l.memory.textures--),r.remove(i[t])}r.remove(i),r.remove(t)}(i)}function O(t){let i=r.get(t);e.deleteTexture(i.__webglTexture);let a=t.source,o=x.get(a);delete o[i.__cacheKey],l.memory.textures--}let I=0;function R(e,t){let a,o=r.get(e);if(e.isVideoTexture&&(a=l.render.frame,v.get(e)!==a&&(v.set(e,a),e.update())),!1===e.isRenderTargetTexture&&e.version>0&&o.__version!==e.version){let i=e.image;if(null===i)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===i.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{N(o,e,t);return}}i.bindTexture(3553,o.__webglTexture,33984+t)}let L={1e3:10497,1001:33071,1002:33648},B={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function z(i,o,l){if(l?(e.texParameteri(i,10242,L[o.wrapS]),e.texParameteri(i,10243,L[o.wrapT]),(32879===i||35866===i)&&e.texParameteri(i,32882,L[o.wrapR]),e.texParameteri(i,10240,B[o.magFilter]),e.texParameteri(i,10241,B[o.minFilter])):(e.texParameteri(i,10242,33071),e.texParameteri(i,10243,33071),(32879===i||35866===i)&&e.texParameteri(i,32882,33071),(1001!==o.wrapS||1001!==o.wrapT)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(i,10240,T(o.magFilter)),e.texParameteri(i,10241,T(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){let l=t.get("EXT_texture_filter_anisotropic");1003!==o.magFilter&&(1005===o.minFilter||1008===o.minFilter)&&(1015!==o.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==h||1016!==o.type||!1!==t.has("OES_texture_half_float_linear"))&&(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(i,l.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,a.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function F(t,i){let r,a=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",P));let o=i.source,h=x.get(o);void 0===h&&(h={},x.set(o,h));let c=((r=[]).push(i.wrapS),r.push(i.wrapT),r.push(i.wrapR||0),r.push(i.magFilter),r.push(i.minFilter),r.push(i.anisotropy),r.push(i.internalFormat),r.push(i.format),r.push(i.type),r.push(i.generateMipmaps),r.push(i.premultiplyAlpha),r.push(i.flipY),r.push(i.unpackAlignment),r.push(i.encoding),r.join());if(c!==t.__cacheKey){void 0===h[c]&&(h[c]={texture:e.createTexture(),usedTimes:0},l.memory.textures++,a=!0),h[c].usedTimes++;let r=h[t.__cacheKey];void 0!==r&&(h[t.__cacheKey].usedTimes--,0===r.usedTimes&&O(i)),t.__cacheKey=c,t.__webglTexture=h[c].texture}return a}function N(t,a,l){let c=3553;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(c=35866),a.isData3DTexture&&(c=32879);let d=F(t,a),f=a.source;i.bindTexture(c,t.__webglTexture,33984+l);let m=r.get(f);if(f.version!==m.__version||!0===d){i.activeTexture(33984+l),e.pixelStorei(37440,a.flipY),e.pixelStorei(37441,a.premultiplyAlpha),e.pixelStorei(3317,a.unpackAlignment),e.pixelStorei(37443,0);let t=!h&&(1001!==a.wrapS||1001!==a.wrapT||1003!==a.minFilter&&1006!==a.minFilter)&&!1===_(a.image),r=S(a.image,t,!1,p),g=_(r=H(a,r))||h,v=o.convert(a.format,a.encoding),y=o.convert(a.type),x=E(a.internalFormat,v,y,a.encoding,a.isVideoTexture);z(c,a,g);let b,w=a.mipmaps,T=h&&!0!==a.isVideoTexture,P=void 0===m.__version||!0===d,D=C(a,r,g);if(a.isDepthTexture)x=6402,h?x=1015===a.type?36012:1014===a.type?33190:1020===a.type?35056:33189:1015===a.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===a.format&&6402===x&&1012!==a.type&&1014!==a.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),a.type=1014,y=o.convert(a.type)),1027===a.format&&6402===x&&(x=34041,1020!==a.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),a.type=1020,y=o.convert(a.type))),P&&(T?i.texStorage2D(3553,1,x,r.width,r.height):i.texImage2D(3553,0,x,r.width,r.height,0,v,y,null));else if(a.isDataTexture){if(w.length>0&&g){T&&P&&i.texStorage2D(3553,D,x,w[0].width,w[0].height);for(let e=0,t=w.length;e<t;e++)b=w[e],T?i.texSubImage2D(3553,e,0,0,b.width,b.height,v,y,b.data):i.texImage2D(3553,e,x,b.width,b.height,0,v,y,b.data);a.generateMipmaps=!1}else T?(P&&i.texStorage2D(3553,D,x,r.width,r.height),i.texSubImage2D(3553,0,0,0,r.width,r.height,v,y,r.data)):i.texImage2D(3553,0,x,r.width,r.height,0,v,y,r.data)}else if(a.isCompressedTexture){if(a.isCompressedArrayTexture){T&&P&&i.texStorage3D(35866,D,x,w[0].width,w[0].height,r.depth);for(let e=0,t=w.length;e<t;e++)b=w[e],1023!==a.format?null!==v?T?i.compressedTexSubImage3D(35866,e,0,0,0,b.width,b.height,r.depth,v,b.data,0,0):i.compressedTexImage3D(35866,e,x,b.width,b.height,r.depth,0,b.data,
31390,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?i.texSubImage3D(35866,e,0,0,0,b.width,b.height,r.depth,v,y,b.data):i.texImage3D(35866,e,x,b.width,b.height,r.depth,0,v,y,b.data)}else{T&&P&&i.texStorage2D(3553,D,x,w[0].width,w[0].height);for(let e=0,t=w.length;e<t;e++)b=w[e],1023!==a.format?null!==v?T?i.compressedTexSubImage2D(3553,e,0,0,b.width,b.height,v,b.data):i.compressedTexImage2D(3553,e,x,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?i.texSubImage2D(3553,e,0,0,b.width,b.height,v,y,b.data):i.texImage2D(3553,e,x,b.width,b.height,0,v,y,b.data)}}else if(a.isDataArrayTexture)T?(P&&i.texStorage3D(35866,D,x,r.width,r.height,r.depth),i.texSubImage3D(35866,0,0,0,0,r.width,r.height,r.depth,v,y,r.data)):i.texImage3D(35866,0,x,r.width,r.height,r.depth,0,v,y,r.data);else if(a.isData3DTexture)T?(P&&i.texStorage3D(32879,D,x,r.width,r.height,r.depth),i.texSubImage3D(32879,0,0,0,0,r.width,r.height,r.depth,v,y,r.data)):i.texImage3D(32879,0,x,r.width,r.height,r.depth,0,v,y,r.data);else if(a.isFramebufferTexture){if(P){if(T)i.texStorage2D(3553,D,x,r.width,r.height);else{let e=r.width,t=r.height;for(let r=0;r<D;r++)i.texImage2D(3553,r,x,e,t,0,v,y,null),e>>=1,t>>=1}}}else if(w.length>0&&g){T&&P&&i.texStorage2D(3553,D,x,w[0].width,w[0].height);for(let e=0,t=w.length;e<t;e++)b=w[e],T?i.texSubImage2D(3553,e,0,0,v,y,b):i.texImage2D(3553,e,x,v,y,b);a.generateMipmaps=!1}else T?(P&&i.texStorage2D(3553,D,x,r.width,r.height),i.texSubImage2D(3553,0,0,0,v,y,r)):i.texImage2D(3553,0,x,v,y,r);A(a,g)&&M(c),m.__version=f.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}function U(t,a,l,h,c){let d=o.convert(l.format,l.encoding),p=o.convert(l.type),f=E(l.internalFormat,d,p,l.encoding);r.get(a).__hasExternalTextures||(32879===c||35866===c?i.texImage3D(c,0,f,a.width,a.height,a.depth,0,d,p,null):i.texImage2D(c,0,f,a.width,a.height,0,d,p,null)),i.bindFramebuffer(36160,t),G(a)?m.framebufferTexture2DMultisampleEXT(36160,h,c,r.get(l).__webglTexture,0,j(a)):(3553===c||c>=34069&&c<=34074)&&e.framebufferTexture2D(36160,h,c,r.get(l).__webglTexture,0),i.bindFramebuffer(36160,null)}function k(t,i,r){if(e.bindRenderbuffer(36161,t),i.depthBuffer&&!i.stencilBuffer){let a=33189;if(r||G(i)){let t=i.depthTexture;t&&t.isDepthTexture&&(1015===t.type?a=36012:1014===t.type&&(a=33190));let r=j(i);G(i)?m.renderbufferStorageMultisampleEXT(36161,r,a,i.width,i.height):e.renderbufferStorageMultisample(36161,r,a,i.width,i.height)}else e.renderbufferStorage(36161,a,i.width,i.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(i.depthBuffer&&i.stencilBuffer){let a=j(i);r&&!1===G(i)?e.renderbufferStorageMultisample(36161,a,35056,i.width,i.height):G(i)?m.renderbufferStorageMultisampleEXT(36161,a,35056,i.width,i.height):e.renderbufferStorage(36161,34041,i.width,i.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{let t=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let a=0;a<t.length;a++){let l=t[a],h=o.convert(l.format,l.encoding),c=o.convert(l.type),d=E(l.internalFormat,h,c,l.encoding),p=j(i);r&&!1===G(i)?e.renderbufferStorageMultisample(36161,p,d,i.width,i.height):G(i)?m.renderbufferStorageMultisampleEXT(36161,p,d,i.width,i.height):e.renderbufferStorage(36161,d,i.width,i.height)}}e.bindRenderbuffer(36161,null)}function V(t){let a=r.get(t),o=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!a.__autoAllocateDepthBuffer){if(o)throw Error("target.depthTexture not supported in Cube render targets");!function(t,a){if(a&&a.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,t),!(a.depthTexture&&a.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(a.depthTexture).__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0),R(a.depthTexture,0);let o=r.get(a.depthTexture).__webglTexture,l=j(a);if(1026===a.depthTexture.format)G(a)?m.framebufferTexture2DMultisampleEXT(36160,36096,3553,o,0,l):e.framebufferTexture2D(36160,36096,3553,o,0);else if(1027===a.depthTexture.format)G(a)?m.framebufferTexture2DMultisampleEXT(36160,33306,3553,o,0,l):e.framebufferTexture2D(36160,33306,3553,o,0);else throw Error("Unknown depthTexture format")}(a.__webglFramebuffer,t)}else if(o){a.__webglDepthbuffer=[];for(let r=0;r<6;r++)i.bindFramebuffer(36160,a.__webglFramebuffer[r]),a.__webglDepthbuffer[r]=e.createRenderbuffer(),k(a.__webglDepthbuffer[r],t,!1)}else i.bindFramebuffer(36160,a.__webglFramebuffer),a.__webglDepthbuffer=e.createRenderbuffer(),k(a.__webglDepthbuffer,t,!1);i.bindFramebuffer(36160,null)}function j(e){return Math.min(f,e.samples)}function G(e){let i=r.get(e);return h&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function H(e,i){let r=e.encoding,a=e.format,o=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||1035===e.format||3e3!==r&&(3001===r?!1===h?!0===t.has("EXT_sRGB")&&1023===a?(e.format=1035,e.minFilter=1006,e.generateMipmaps=!1):i=ix.sRGBToLinear(i):(1023!==a||1009!==o)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),i}this.allocateTextureUnit=function(){let e=I;return e>
3139=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=R,this.setTexture2DArray=function(e,t){let a=r.get(e);if(e.version>0&&a.__version!==e.version){N(a,e,t);return}i.bindTexture(35866,a.__webglTexture,33984+t)},this.setTexture3D=function(e,t){let a=r.get(e);if(e.version>0&&a.__version!==e.version){N(a,e,t);return}i.bindTexture(32879,a.__webglTexture,33984+t)},this.setTextureCube=function(t,a){let l=r.get(t);if(t.version>0&&l.__version!==t.version){(function(t,a,l){if(6!==a.image.length)return;let c=F(t,a),p=a.source;i.bindTexture(34067,t.__webglTexture,33984+l);let f=r.get(p);if(p.version!==f.__version||!0===c){let t;i.activeTexture(33984+l),e.pixelStorei(37440,a.flipY),e.pixelStorei(37441,a.premultiplyAlpha),e.pixelStorei(3317,a.unpackAlignment),e.pixelStorei(37443,0);let r=a.isCompressedTexture||a.image[0].isCompressedTexture,m=a.image[0]&&a.image[0].isDataTexture,g=[];for(let e=0;e<6;e++)r||m?g[e]=m?a.image[e].image:a.image[e]:g[e]=S(a.image[e],!1,!0,d),g[e]=H(a,g[e]);let v=g[0],y=_(v)||h,x=o.convert(a.format,a.encoding),b=o.convert(a.type),w=E(a.internalFormat,x,b,a.encoding),T=h&&!0!==a.isVideoTexture,P=void 0===f.__version||!0===c,D=C(a,v,y);if(z(34067,a,y),r){T&&P&&i.texStorage2D(34067,D,w,v.width,v.height);for(let e=0;e<6;e++){t=g[e].mipmaps;for(let r=0;r<t.length;r++){let o=t[r];1023!==a.format?null!==x?T?i.compressedTexSubImage2D(34069+e,r,0,0,o.width,o.height,x,o.data):i.compressedTexImage2D(34069+e,r,w,o.width,o.height,0,o.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):T?i.texSubImage2D(34069+e,r,0,0,o.width,o.height,x,b,o.data):i.texImage2D(34069+e,r,w,o.width,o.height,0,x,b,o.data)}}}else{t=a.mipmaps,T&&P&&(t.length>0&&D++,i.texStorage2D(34067,D,w,g[0].width,g[0].height));for(let e=0;e<6;e++)if(m){T?i.texSubImage2D(34069+e,0,0,0,g[e].width,g[e].height,x,b,g[e].data):i.texImage2D(34069+e,0,w,g[e].width,g[e].height,0,x,b,g[e].data);for(let r=0;r<t.length;r++){let a=t[r].image[e].image;T?i.texSubImage2D(34069+e,r+1,0,0,a.width,a.height,x,b,a.data):i.texImage2D(34069+e,r+1,w,a.width,a.height,0,x,b,a.data)}}else{T?i.texSubImage2D(34069+e,0,0,0,x,b,g[e]):i.texImage2D(34069+e,0,w,x,b,g[e]);for(let r=0;r<t.length;r++){let a=t[r];T?i.texSubImage2D(34069+e,r+1,0,0,x,b,a.image[e]):i.texImage2D(34069+e,r+1,w,x,b,a.image[e])}}}A(a,y)&&M(34067),f.__version=p.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version})(l,t,a);return}i.bindTexture(34067,l.__webglTexture,33984+a)},this.rebindTextures=function(e,t,i){let a=r.get(e);void 0!==t&&U(a.__webglFramebuffer,e,e.texture,36064,3553),void 0!==i&&V(e)},this.setupRenderTarget=function(t){let c=t.texture,d=r.get(t),p=r.get(c);t.addEventListener("dispose",D),!0!==t.isWebGLMultipleRenderTargets&&(void 0===p.__webglTexture&&(p.__webglTexture=e.createTexture()),p.__version=c.version,l.memory.textures++);let f=!0===t.isWebGLCubeRenderTarget,m=!0===t.isWebGLMultipleRenderTargets,g=_(t)||h;if(f){d.__webglFramebuffer=[];for(let t=0;t<6;t++)d.__webglFramebuffer[t]=e.createFramebuffer()}else{if(d.__webglFramebuffer=e.createFramebuffer(),m){if(a.drawBuffers){let i=t.texture;for(let t=0,a=i.length;t<a;t++){let a=r.get(i[t]);void 0===a.__webglTexture&&(a.__webglTexture=e.createTexture(),l.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.")}if(h&&t.samples>0&&!1===G(t)){let r=m?c:[c];d.__webglMultisampledFramebuffer=e.createFramebuffer(),d.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,d.__webglMultisampledFramebuffer);for(let i=0;i<r.length;i++){let a=r[i];d.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(36161,d.__webglColorRenderbuffer[i]);let l=o.convert(a.format,a.encoding),h=o.convert(a.type),c=E(a.internalFormat,l,h,a.encoding,!0===t.isXRRenderTarget),p=j(t);e.renderbufferStorageMultisample(36161,p,c,t.width,t.height),e.framebufferRenderbuffer(36160,36064+i,36161,d.__webglColorRen
3139derbuffer[i])}e.bindRenderbuffer(36161,null),t.depthBuffer&&(d.__webglDepthRenderbuffer=e.createRenderbuffer(),k(d.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(36160,null)}}if(f){i.bindTexture(34067,p.__webglTexture),z(34067,c,g);for(let e=0;e<6;e++)U(d.__webglFramebuffer[e],t,c,36064,34069+e);A(c,g)&&M(34067),i.unbindTexture()}else if(m){let e=t.texture;for(let a=0,o=e.length;a<o;a++){let o=e[a],l=r.get(o);i.bindTexture(3553,l.__webglTexture),z(3553,o,g),U(d.__webglFramebuffer,t,o,36064+a,3553),A(o,g)&&M(3553)}i.unbindTexture()}else{let e=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(h?e=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(e,p.__webglTexture),z(e,c,g),U(d.__webglFramebuffer,t,c,36064,e),A(c,g)&&M(e),i.unbindTexture()}t.depthBuffer&&V(t)},this.updateRenderTargetMipmap=function(e){let t=_(e)||h,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture];for(let o=0,l=a.length;o<l;o++){let l=a[o];if(A(l,t)){let t=e.isWebGLCubeRenderTarget?34067:3553,a=r.get(l).__webglTexture;i.bindTexture(t,a),M(t),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(h&&t.samples>0&&!1===G(t)){let a=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],o=t.width,l=t.height,h=16384,c=[],d=t.stencilBuffer?33306:36096,p=r.get(t),f=!0===t.isWebGLMultipleRenderTargets;if(f)for(let t=0;t<a.length;t++)i.bindFramebuffer(36160,p.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,3
31396161,null),i.bindFramebuffer(36160,p.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,null,0);i.bindFramebuffer(36008,p.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,p.__webglFramebuffer);for(let i=0;i<a.length;i++){c.push(36064+i),t.depthBuffer&&c.push(d);let m=void 0!==p.__ignoreDepthValues&&p.__ignoreDepthValues;if(!1===m&&(t.depthBuffer&&(h|=256),t.stencilBuffer&&(h|=1024)),f&&e.framebufferRenderbuffer(36008,36064,36161,p.__webglColorRenderbuffer[i]),!0===m&&(e.invalidateFramebuffer(36008,[d]),e.invalidateFramebuffer(36009,[d])),f){let t=r.get(a[i]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,t,0)}e.blitFramebuffer(0,0,o,l,0,0,o,l,h,9728),g&&e.invalidateFramebuffer(36008,c)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),f)for(let t=0;t<a.length;t++){i.bindFramebuffer(36160,p.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+t,36161,p.__webglColorRenderbuffer[t]);let o=r.get(a[t]).__webglTexture;i.bindFramebuffer(36160,p.__webglFramebuffer),e.framebufferTexture2D(36009,36064+t,3553,o,0)}i.bindFramebuffer(36009,p.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=U,this.useMultisampledRTT=G}function nS(e,t,i){let r=i.isWebGL2;return{convert:function(i,a=null){let o;if(1009===i)return 5121;if(1017===i)return 32819;if(1018===i)return 32820;if(1010===i)return 5120;if(1011===i)return 5122;if(1012===i)return 5123;if(1013===i)return 5124;if(1014===i)return 5125;if(1015===i)return 5126;if(1016===i)return r?5131:null!==(o=t.get("OES_texture_half_float"))?o.HALF_FLOAT_OES:null;if(1021===i)return 6406;if(1023===i)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(1026===i)return 6402;if(1027===i)return 34041;if(1035===i)return null!==(o=t.get("EXT_sRGB"))?o.SRGB_ALPHA_EXT:null;if(1028===i)return 6403;if(1029===i)return 36244;if(1030===i)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(33776===i||33777===i||33778===i||33779===i){if(3001===a){if(null===(o=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(o=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(35840===i||35841===i||35842===i||35843===i){if(null===(o=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return null!==(o=t.get("WEBGL_compressed_texture_etc1"))?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(null===(o=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===i)return 3001===a?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(37496===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(o=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return 3001===a?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i){if(null===(o=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return 3001===a?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(o=t.get("EXT_texture_compression_rgtc")))return null;
3139if(36492===i)return o.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?r?34042:null!==(o=t.get("WEBGL_depth_texture"))?o.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[i]?e[i]:null}}}var n_=class extends sc{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},nA=class extends rw{constructor(){super(),this.isGroup=!0,this.type="Group"}},nM={type:"move"},nE=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new nA,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new nA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new iD,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new iD),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new nA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new iD,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new iD),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let r=null,a=null,o=null,l=this._targetRay,h=this._grip,c=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(c&&e.hand){for(let r of(o=!0,e.hand.values())){let e=t.getJointPose(r,i),a=this._getHandJoint(c,r);null!==e&&(a.matrix.fromArray(e.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.jointRadius=e.radius),a.visible=null!==e}let r=c.joints["index-finger-tip"],a=c.joints["thumb-tip"],l=r.position.distanceTo(a.position);c.inputState.pinching&&l>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&l<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==h&&e.gripSpace&&null!==(a=t.getPose(e.gripSpace,i))&&(h.matrix.fromArray(a.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),a.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(a.linearVelocity)):h.hasLinearVelocity=!1,a.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(a.angularVelocity)):h.hasAngularVelocity=!1);null!==l&&(null===(r=t.getPose(e.targetRaySpace,i))&&null!==a&&(r=a),null!==r&&(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(nM)))}return null!==l&&(l.visible=null!==r),null!==h&&(h.visible=null!==a),null!==c&&(c.visible=null!==o),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new nA;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},nC=class extends i_{constructor(e,t,i,r,a,o,l,h,c,d){if(1026!==(d=void 0!==d?d:1026)&&1027!==d)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===d&&(i=1014),void 0===i&&1027===d&&(i=1020),super(null,r,a,o,l,h,d,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==h?h:1003,this.flipY=!1,this.generateMipmaps=!1}},nT=class extends tX{constructor(e,t){super();let i=this,r=null,a=1,o=null,l="local-floor",h=1,c=null,d=null,p=null,f=null,m=null,g=null,v=t.getContextAttributes(),y=null,x=null,b=[],w=[],S=new Set,_=new Map,A=new sc;A.layers.enable(1),A.viewport=new iA;let M=new sc;M.layers.enable(2),M.viewport=new iA;let E=[A,M],C=new n_;C.layers.enable(1),C.layers.enable(2);let T=null,P=null;function D(e){let t=w.indexOf(e.inputSource);if(-1===t)return;let i=b[t];void 0!==i&&i.dispatchEvent({type:e.type,data:e.inputSource})}function O(){r.removeEventListener("select",D),r.removeEventListener("selectstart",D),r.removeEventListener("selectend",D),r.removeEventListener("squeeze",D),r.removeEventListener("squeezestart",D),r.removeEventListener("squeezeend",D),r.removeEventListener("end",O),r.removeEventListener("inputsourceschange",I);for(let e=0;e<b.length;e++){let t=w[e];null!==t&&(w[e]=null,b[e].disconnect(t))}T=null,P=null,e.setRenderTarget(y),m=null,f=null,p=null,r=null,x=null,F.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function I(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],r=w.indexOf(i);r>=0&&(w[r]=null,b[r].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],r=w.indexOf(i);if(-1===r){for(let e=0;e<b.length;e++)if(e>=w.length){w.push(i),r=e;break}else if(null===w[e]){w[e]=i,r=e;break}if(-1===r)break}let a=b[r];a&&a.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return void 0===t&&(t=new nE,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return void 0===t&&(t=new nE,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return void 0===t&&(t=new nE,b[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){l=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return p},this.getFrame=function(){return g}
3139,this.getSession=function(){return r},this.setSession=async function(d){if(null!==(r=d)){if(y=e.getRenderTarget(),r.addEventListener("select",D),r.addEventListener("selectstart",D),r.addEventListener("selectend",D),r.addEventListener("squeeze",D),r.addEventListener("squeezestart",D),r.addEventListener("squeezeend",D),r.addEventListener("end",O),r.addEventListener("inputsourceschange",I),!0!==v.xrCompatible&&await t.makeXRCompatible(),void 0===r.renderState.layers||!1===e.capabilities.isWebGL2){let i={antialias:void 0!==r.renderState.layers||v.antialias,alpha:v.alpha,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:a};m=new XRWebGLLayer(r,t,i),r.updateRenderState({baseLayer:m}),x=new iM(m.framebufferWidth,m.framebufferHeight,{format:1023,type:1009,encoding:e.outputEncoding,stencilBuffer:v.stencil})}else{let i=null,o=null,l=null;v.depth&&(l=v.stencil?35056:33190,i=v.stencil?1027:1026,o=v.stencil?1020:1014);let h={colorFormat:32856,depthFormat:l,scaleFactor:a};f=(p=new XRWebGLBinding(r,t)).createProjectionLayer(h),r.updateRenderState({layers:[f]}),x=new iM(f.textureWidth,f.textureHeight,{format:1023,type:1009,depthTexture:new nC(f.textureWidth,f.textureHeight,o,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:v.stencil,encoding:e.outputEncoding,samples:v.antialias?4:0}),e.properties.get(x).__ignoreDepthValues=f.ignoreDepthValues}x.isXRRenderTarget=!0,this.setFoveation(h),c=null,o=await r.requestReferenceSpace(l),F.setContext(r),F.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};let R=new iD,L=new iD;function B(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===r)return;C.near=M.near=A.near=e.near,C.far=M.far=A.far=e.far,(T!==C.near||P!==C.far)&&(r.updateRenderState({depthNear:C.near,depthFar:C.far}),T=C.near,P=C.far);let t=e.parent,i=C.cameras;B(C,t);for(let e=0;e<i.length;e++)B(i[e],t);C.matrixWorld.decompose(C.position,C.quaternion,C.scale),e.matrix.copy(C.matrix),e.matrix.decompose(e.position,e.quaternion,e.scale);let a=e.children;for(let e=0,t=a.length;e<t;e++)a[e].updateMatrixWorld(!0);2===i.length?function(e,t,i){R.setFromMatrixPosition(t.matrixWorld),L.setFromMatrixPosition(i.matrixWorld);let r=R.distanceTo(L),a=t.projectionMatrix.elements,o=i.projectionMatrix.elements,l=a[14]/(a[10]-1),h=a[14]/(a[10]+1),c=(a[9]+1)/a[5],d=(a[9]-1)/a[5],p=(a[8]-1)/a[0],f=(o[8]+1)/o[0],m=r/(-p+f),g=-(m*p);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(g),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();let v=l+m,y=h+m;e.projectionMatrix.makePerspective(l*p-g,l*f+(r-g),c*h/y*v,d*h/y*v,v,y)}(C,A,M):C.projectionMatrix.copy(A.projectionMatrix)},this.getCamera=function(){return C},this.getFoveation=function(){if(!(null===f&&null===m))return h},this.setFoveation=function(e){h=e,null!==f&&(f.fixedFoveation=e),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=e)},this.getPlanes=function(){return S};let z=null,F=new sw;F.setAnimationLoop(function(t,r){if(d=r.getViewerPose(c||o),g=r,null!==d){let t=d.views;null!==m&&(e.setRenderTargetFramebuffer(x,m.framebuffer),e.setRenderTarget(x));let i=!1;t.length!==C.cameras.length&&(C.cameras.length=0,i=!0);for(let r=0;r<t.length;r++){let a=t[r],o=null;if(null!==m)o=m.getViewport(a);else{let t=p.getViewSubImage(f,a);o=t.viewport,0===r&&(e.setRenderTargetTextures(x,t.colorTexture,f.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(x))}let l=E[r];void 0===l&&((l=new sc).layers.enable(r),l.viewport=new iA,E[r]=l),l.matrix.fromArray(a.transform.matrix),l.projectionMatrix.fromArray(a.projectionMatrix),l.viewport.set(o.x,o.y,o.width,o.height),0===r&&C.matrix.copy(l.matrix),!0===i&&C.cameras.push(l)}}for(let e=0;e<b.length;e++){let t=w[e],i=b[e];null!==t&&void 0!==i&&i.update(t,r,c||o)}if(z&&z(t,r),r.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:r.detectedPlanes});let e=null;for(let t of S)r.detectedPlanes.has(t)||(null===e&&(e=[]),e.push(t));if(null!==e)for(let t of e)S.delete(t),_.delete(t),i.dispatchEvent({type:"planeremoved",data:t});for(let e of r.detectedPlanes)if(S.has(e)){let t=_.get(e);e.lastChangedTime>t&&(_.set(e,e.lastChangedTime),i.dispatchEvent({type:"planechanged",data:e}))}else S.add(e),_.set(e,r.lastChangedTime),i.dispatchEvent({type:"planeadded",data:e})}g=null}),this.setAnimationLoop=function(e){z=e},this.dispose=function(){}}};function nP(e,t){function i(i,r){let a,o;i.opacity.value=r.opacity,r.color&&i.diffuse.value.copy(r.color),r.emissive&&i.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(i.map.value=r.map),r.alphaMap&&(i.alphaMap.value=r.alphaMap),r.bumpMap&&(i.bumpMap.value=r.bumpMap,i.bumpScale.value=r.bumpScale,1===r.side&&(i.bumpScale.value*=-1)),r.displacementMap&&(i.displacementMap.value=r.displacementMap,i.displacementScale.value=r.displacementScale,i.displacementBias.value=r.displacementBias),r.emissiveMap&&(i.emissiveMap.value=r.emissiveMap),r.normalMap&&(i.normalMap.value=r.normalMap,i.normalScale.value.copy(r.normalScale),1===r.side&&i.normalScale.value.negate()),r.specularMap&&(i.specularMap.value=r.specularMap),r.alphaTest>0&&(i.alphaTest.value=r.alphaTest);let l=t.get(r).envMap;if(l&&(i.envMap.value=l,i.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.
3139ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;let t=!0!==e.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*t}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity),r.map?a=r.map:r.specularMap?a=r.specularMap:r.displacementMap?a=r.displacementMap:r.normalMap?a=r.normalMap:r.bumpMap?a=r.bumpMap:r.roughnessMap?a=r.roughnessMap:r.metalnessMap?a=r.metalnessMap:r.alphaMap?a=r.alphaMap:r.emissiveMap?a=r.emissiveMap:r.clearcoatMap?a=r.clearcoatMap:r.clearcoatNormalMap?a=r.clearcoatNormalMap:r.clearcoatRoughnessMap?a=r.clearcoatRoughnessMap:r.iridescenceMap?a=r.iridescenceMap:r.iridescenceThicknessMap?a=r.iridescenceThicknessMap:r.specularIntensityMap?a=r.specularIntensityMap:r.specularColorMap?a=r.specularColorMap:r.transmissionMap?a=r.transmissionMap:r.thicknessMap?a=r.thicknessMap:r.sheenColorMap?a=r.sheenColorMap:r.sheenRoughnessMap&&(a=r.sheenRoughnessMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),i.uvTransform.value.copy(a.matrix)),r.aoMap?o=r.aoMap:r.lightMap&&(o=r.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),i.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,ss(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,a,o,l){let h,c;r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),r.gradientMap&&(e.gradientMap.value=r.gradientMap)):r.isMeshPhongMaterial?(i(e,r),e.specular.value.copy(r.specular),e.shininess.value=Math.max(r.shininess,1e-4)):r.isMeshStandardMaterial?(i(e,r),e.roughness.value=r.roughness,e.metalness.value=r.metalness,r.roughnessMap&&(e.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(e.metalnessMap.value=r.metalnessMap),t.get(r).envMap&&(e.envMapIntensity.value=r.envMapIntensity),r.isMeshPhysicalMaterial&&(e.ior.value=r.ior,r.sheen>0&&(e.sheenColor.value.copy(r.sheenColor).multiplyScalar(r.sheen),e.sheenRoughness.value=r.sheenRoughness,r.sheenColorMap&&(e.sheenColorMap.value=r.sheenColorMap),r.sheenRoughnessMap&&(e.sheenRoughnessMap.value=r.sheenRoughnessMap)),r.clearcoat>0&&(e.clearcoat.value=r.clearcoat,e.clearcoatRoughness.value=r.clearcoatRoughness,r.clearcoatMap&&(e.clearcoatMap.value=r.clearcoatMap),r.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=r.clearcoatRoughnessMap),r.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(r.clearcoatNormalScale),e.clearcoatNormalMap.value=r.clearcoatNormalMap,1===r.side&&e.clearcoatNormalScale.value.negate())),r.iridescence>0&&(e.iridescence.value=r.iridescence,e.iridescenceIOR.value=r.iridescenceIOR,e.iridescenceThicknessMinimum.value=r.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=r.iridescenceThicknessRange[1],r.iridescenceMap&&(e.iridescenceMap.value=r.iridescenceMap),r.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=r.iridescenceThicknessMap)),r.transmission>0&&(e.transmission.value=r.transmission,e.transmissionSamplerMap.value=l.texture,e.transmissionSamplerSize.value.set(l.width,l.height),r.transmissionMap&&(e.transmissionMap.value=r.transmissionMap),e.thickness.value=r.thickness,r.thicknessMap&&(e.thicknessMap.value=r.thicknessMap),e.attenuationDistance.value=r.attenuationDistance,e.attenuationColor.value.copy(r.attenuationColor)),e.specularIntensity.value=r.specularIntensity,e.specularColor.value.copy(r.specularColor),r.specularIntensityMap&&(e.specularIntensityMap.value=r.specularIntensityMap),r.specularColorMap&&(e.specularColorMap.value=r.specularColorMap))):r.isMeshMatcapMaterial?(i(e,r),r.matcap&&(e.matcap.value=r.matcap)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),e.referencePosition.value.copy(r.referencePosition),e.nearDistance.value=r.nearDistance,e.farDistance.value=r.farDistance):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,r.isLineDashedMaterial&&(e.dashSize.value=r.dashSize,e.totalSize.value=r.dashSize
3139+r.gapSize,e.scale.value=r.scale)):r.isPointsMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.size.value=r.size*a,e.scale.value=.5*o,r.map&&(e.map.value=r.map),r.alphaMap&&(e.alphaMap.value=r.alphaMap),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest),r.map?h=r.map:r.alphaMap&&(h=r.alphaMap),void 0!==h&&(!0===h.matrixAutoUpdate&&h.updateMatrix(),e.uvTransform.value.copy(h.matrix))):r.isSpriteMaterial?(e.diffuse.value.copy(r.color),e.opacity.value=r.opacity,e.rotation.value=r.rotation,r.map&&(e.map.value=r.map),r.alphaMap&&(e.alphaMap.value=r.alphaMap),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest),r.map?c=r.map:r.alphaMap&&(c=r.alphaMap),void 0!==c&&(!0===c.matrixAutoUpdate&&c.updateMatrix(),e.uvTransform.value.copy(c.matrix))):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function nD(e,t,i,r){let a={},o={},l=[],h=i.isWebGL2?e.getParameter(35375):0;function c(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function d(t){let i=t.target;i.removeEventListener("dispose",d);let r=l.indexOf(i.__bindingPointIndex);l.splice(r,1),e.deleteBuffer(a[i.id]),delete a[i.id],delete o[i.id]}return{bind:function(e,t){let i=t.program;r.uniformBlockBinding(e,i)},update:function(i,p){let f,m,g,v,y=a[i.id];void 0===y&&(function(e){let t=e.uniforms,i=0,r=0;for(let e=0,a=t.length;e<a;e++){let a=t[e],o={boundary:0,storage:0},l=Array.isArray(a.value)?a.value:[a.value];for(let e=0,t=l.length;e<t;e++){let t=c(l[e]);o.boundary+=t.boundary,o.storage+=t.storage}if(a.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT),a.__offset=i,e>0){let e=16-(r=i%16);0!==r&&e-o.boundary<0&&(i+=16-r,a.__offset=i)}i+=o.storage}(r=i%16)>0&&(i+=16-r),e.__size=i,e.__cache={}}(i),f=function(){for(let e=0;e<h;e++)if(-1===l.indexOf(e))return l.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),i.__bindingPointIndex=f,m=e.createBuffer(),g=i.__size,v=i.usage,e.bindBuffer(35345,m),e.bufferData(35345,g,v),e.bindBuffer(35345,null),e.bindBufferBase(35345,f,m),y=m,a[i.id]=y,i.addEventListener("dispose",d));let x=p.program;r.updateUBOMapping(i,x);let b=t.render.frame;o[i.id]!==b&&(function(t){let i=a[t.id],r=t.uniforms,o=t.__cache;e.bindBuffer(35345,i);for(let t=0,i=r.length;t<i;t++){let i=r[t];if(!0===function(e,t,i){let r=e.value;if(void 0===i[t]){if("number"==typeof r)i[t]=r;else{let e=Array.isArray(r)?r:[r],a=[];for(let t=0;t<e.length;t++)a.push(e[t].clone());i[t]=a}return!0}if("number"==typeof r){if(i[t]!==r)return i[t]=r,!0}else{let e=Array.isArray(i[t])?i[t]:[i[t]],a=Array.isArray(r)?r:[r];for(let t=0;t<e.length;t++){let i=e[t];if(!1===i.equals(a[t]))return i.copy(a[t]),!0}}return!1}(i,t,o)){let t=i.__offset,r=Array.isArray(i.value)?i.value:[i.value],a=0;for(let o=0;o<r.length;o++){let l=r[o],h=c(l);"number"==typeof l?(i.__data[0]=l,e.bufferSubData(35345,t+a,i.__data)):l.isMatrix3?(i.__data[0]=l.elements[0],i.__data[1]=l.elements[1],i.__data[2]=l.elements[2],i.__data[3]=l.elements[0],i.__data[4]=l.elements[3],i.__data[5]=l.elements[4],i.__data[6]=l.elements[5],i.__data[7]=l.elements[0],i.__data[8]=l.elements[6],i.__data[9]=l.elements[7],i.__data[10]=l.elements[8],i.__data[11]=l.elements[0]):(l.toArray(i.__data,a),a+=h.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(35345,t,i.__data)}}e.bindBuffer(35345,null)}(i),o[i.id]=b)},dispose:function(){for(let t in a)e.deleteBuffer(a[t]);l=[],a={},o={}}}}function nO(e={}){let t,i,r,a,o,l,h,c,d,p,f,m,g,v,y,x,b,w,S,_,A,M,E,C,T;this.isWebGLRenderer=!0;let P=void 0!==e.canvas?e.canvas:((T=is("canvas")).style.display="block",T),D=void 0!==e.context?e.context:null,O=void 0===e.depth||e.depth,I=void 0===e.stencil||e.stencil,R=void 0!==e.antialias&&e.antialias,L=void 0===e.premultipliedAlpha||e.premultipliedAlpha,B=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,z=void 0!==e.powerPreference?e.powerPreference:"default",F=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,N;
3139N=null!==D?D.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;let U=null,k=null,V=[],j=[];this.domElement=P,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=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;let G=this,H=!1,W=0,q=0,X=null,Y=-1,Q=null,Z=new iA,K=new iA,J=null,$=P.width,ee=P.height,et=1,ei=null,er=null,es=new iA(0,0,$,ee),ea=new iA(0,0,$,ee),en=!1,eo=new sb,el=!1,eh=!1,ec=null,ed=new i6,eu=new t9,ep=new iD,ef={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function em(){return null===X?et:1}let eg=D;function ev(e,t){for(let i=0;i<e.length;i++){let r=e[i],a=P.getContext(r,t);if(null!==a)return a}return null}try{if("setAttribute"in P&&P.setAttribute("data-engine","three.js r149"),P.addEventListener("webglcontextlost",eb,!1),P.addEventListener("webglcontextrestored",ew,!1),P.addEventListener("webglcontextcreationerror",eS,!1),null===eg){let e=["webgl2","webgl","experimental-webgl"];if(!0===G.isWebGL1Renderer&&e.shift(),eg=ev(e,{alpha:!0,depth:O,stencil:I,antialias:R,premultipliedAlpha:L,preserveDrawingBuffer:B,powerPreference:z,failIfMajorPerformanceCaveat:F}),null===eg)throw ev(e)?Error("Error creating WebGL context with your selected attributes."):Error("Error creating WebGL context.")}void 0===eg.getShaderPrecisionFormat&&(eg.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ey(){t=new sQ(eg),i=new sO(eg,t,e),t.init(i),M=new nS(eg,t,i),r=new nb(eg,t,i),a=new sJ,o=new ns,l=new nw(eg,t,r,o,i,M,a),h=new sR(G),c=new sY(G),d=new sS(eg,i),E=new sP(eg,t,d,i),p=new sZ(eg,d,a,E),f=new s2(eg,p,d,a),S=new s1(eg,i,l),x=new sI(o),m=new nr(G,h,c,t,i,E,x),g=new nP(G,o),v=new nl,y=new nf(t,i),w=new sT(G,h,c,r,f,N,L),b=new nx(G,f,i),C=new nD(eg,a,i,r),_=new sD(eg,t,a,i),A=new sK(eg,t,a,i),a.programs=m.programs,G.capabilities=i,G.extensions=t,G.properties=o,G.renderLists=v,G.shadowMap=b,G.state=r,G.info=a}ey();let ex=new nT(G,eg);function eb(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),H=!0}function ew(){console.log("THREE.WebGLRenderer: Context Restored."),H=!1;let e=a.autoReset,t=b.enabled,i=b.autoUpdate,r=b.needsUpdate,o=b.type;ey(),a.autoReset=e,b.enabled=t,b.autoUpdate=i,b.needsUpdate=r,b.type=o}function eS(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function e_(e){let t,i=e.target;i.removeEventListener("dispose",e_),void 0!==(t=o.get(i).programs)&&(t.forEach(function(e){m.releaseProgram(e)}),i.isShaderMaterial&&m.releaseShaderCache(i)),o.remove(i)}this.xr=ex,this.getContext=function(){return eg},this.getContextAttributes=function(){return eg.getContextAttributes()},this.forceContextLoss=function(){let e=t.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=t.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return et},this.setPixelRatio=function(e){void 0!==e&&(et=e,this.setSize($,ee,!1))},this.getSize=function(e){return e.set($,ee)},this.setSize=function(e,t,i){if(ex.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}$=e,ee=t,P.width=Math.floor(e*et),P.height=Math.floor(t*et),!1!==i&&(P.style.width=e+"px",P.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set($*et,ee*et).floor()},this.setDrawingBufferSize=function(e,t,i){$=e,ee=t,et=i,P.width=Math.floor(e*i),P.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(Z)},this.getViewport=function(e){return e.copy(es)},this.setViewport=function(e,t,i,a){e.isVector4?es.set(e.x,e.y,e.z,e.w):es.set(e,t,i,a),r.viewport(Z.copy(es).multiplyScalar(et).floor())},this.getScissor=function(e){return e.copy(ea)},this.setScissor=function(e,t,i,a){e.isVector4?ea.set(e.x,e.y,e.z,e.w):ea.set(e,t,i,a),r.scissor(K.copy(ea).multiplyScalar(et).floor())}
3139,this.getScissorTest=function(){return en},this.setScissorTest=function(e){r.setScissorTest(en=e)},this.setOpaqueSort=function(e){ei=e},this.setTransparentSort=function(e){er=e},this.getClearColor=function(e){return e.copy(w.getClearColor())},this.setClearColor=function(){w.setClearColor.apply(w,arguments)},this.getClearAlpha=function(){return w.getClearAlpha()},this.setClearAlpha=function(){w.setClearAlpha.apply(w,arguments)},this.clear=function(e=!0,t=!0,i=!0){let r=0;e&&(r|=16384),t&&(r|=256),i&&(r|=1024),eg.clear(r)},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(){P.removeEventListener("webglcontextlost",eb,!1),P.removeEventListener("webglcontextrestored",ew,!1),P.removeEventListener("webglcontextcreationerror",eS,!1),v.dispose(),y.dispose(),o.dispose(),h.dispose(),c.dispose(),f.dispose(),E.dispose(),C.dispose(),m.dispose(),ex.dispose(),ex.removeEventListener("sessionstart",eM),ex.removeEventListener("sessionend",eE),ec&&(ec.dispose(),ec=null),eC.stop()},this.renderBufferDirect=function(e,t,a,f,m,v){null===t&&(t=ef);let y=m.isMesh&&0>m.matrixWorld.determinant(),b=function(e,t,a,d,p){var f;!0!==t.isScene&&(t=ef),l.resetTextureUnits();let m=t.fog,v=d.isMeshStandardMaterial?t.environment:null,y=null===X?G.outputEncoding:!0===X.isXRRenderTarget?X.texture.encoding:3e3,b=(d.isMeshStandardMaterial?c:h).get(d.envMap||v),w=!0===d.vertexColors&&!!a.attributes.color&&4===a.attributes.color.itemSize,_=!!d.normalMap&&!!a.attributes.tangent,A=!!a.morphAttributes.position,M=!!a.morphAttributes.normal,E=!!a.morphAttributes.color,T=d.toneMapped?G.toneMapping:0,P=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,D=void 0!==P?P.length:0,O=o.get(d),I=k.state.lights;if(!0===el&&(!0===eh||e!==Q)){let t=e===Q&&d.id===Y;x.setState(d,e,t)}let R=!1;d.version===O.__version?(O.needsLights&&O.lightsStateVersion!==I.state.version||O.outputEncoding!==y||p.isInstancedMesh&&!1===O.instancing||!p.isInstancedMesh&&!0===O.instancing||p.isSkinnedMesh&&
3139!1===O.skinning||!p.isSkinnedMesh&&!0===O.skinning||O.envMap!==b||!0===d.fog&&O.fog!==m||void 0!==O.numClippingPlanes&&(O.numClippingPlanes!==x.numPlanes||O.numIntersection!==x.numIntersection)||O.vertexAlphas!==w||O.vertexTangents!==_||O.morphTargets!==A||O.morphNormals!==M||O.morphColors!==E||O.toneMapping!==T||!0===i.isWebGL2&&O.morphTargetsCount!==D)&&(R=!0):(R=!0,O.__version=d.version);let L=O.currentProgram;!0===R&&(L=eD(d,t,p));let B=!1,z=!1,F=!1,N=L.getUniforms(),U=O.uniforms;if(r.useProgram(L.program)&&(B=!0,z=!0,F=!0),d.id!==Y&&(Y=d.id,z=!0),B||Q!==e){if(N.setValue(eg,"projectionMatrix",e.projectionMatrix),i.logarithmicDepthBuffer&&N.setValue(eg,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),Q!==e&&(Q=e,z=!0,F=!0),d.isShaderMaterial||d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshStandardMaterial||d.envMap){let t=N.map.cameraPosition;void 0!==t&&t.setValue(eg,ep.setFromMatrixPosition(e.matrixWorld))}(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial)&&N.setValue(eg,"isOrthographic",!0===e.isOrthographicCamera),(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial||d.isShadowMaterial||p.isSkinnedMesh)&&N.setValue(eg,"viewMatrix",e.matrixWorldInverse)}if(p.isSkinnedMesh){N.setOptional(eg,p,"bindMatrix"),N.setOptional(eg,p,"bindMatrixInverse");let e=p.skeleton;e&&(i.floatVertexTextures?(null===e.boneTexture&&e.computeBoneTexture(),N.setValue(eg,"boneTexture",e.boneTexture,l),N.setValue(eg,"boneTextureSize",e.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."))}let V=a.morphAttributes;if((void 0!==V.position||void 0!==V.normal||void 0!==V.color&&!0===i.isWebGL2)&&S.update(p,a,d,L),(z||O.receiveShadow!==p.receiveShadow)&&(O.receiveShadow=p.receiveShadow,N.setValue(eg,"receiveShadow",p.receiveShadow)),d.isMeshGouraudMaterial&&null!==d.envMap&&(U.envMap.value=b,U.flipEnvMap.value=b.isCubeTexture&&!1===b.isRenderTargetTexture?-1:1),z&&(N.setValue(eg,"toneMappingExposure",G.toneMappingExposure),O.needsLights&&(f=F,U.ambientLightColor.needsUpdate=f,U.lightProbe.needsUpdate=f,U.directionalLights.needsUpdate=f,U.directionalLightShadows.needsUpdate=f,U.pointLights.needsUpdate=f,U.pointLightShadows.needsUpdate=f,U.spotLights.needsUpdate=f,U.spotLightShadows.needsUpdate=f,U.rectAreaLights.needsUpdate=f,U.hemisphereLights.needsUpdate=f),m&&!0===d.fog&&g.refreshFogUniforms(U,m),g.refreshMaterialUniforms(U,d,et,ee,ec),aQ.upload(eg,O.uniformsList,U,l)),d.isShaderMaterial&&!0===d.uniformsNeedUpdate&&(aQ.upload(eg,O.uniformsList,U,l),d.uniformsNeedUpdate=!1),d.isSpriteMaterial&&N.setValue(eg,"center",p.center),N.setValue(eg,"modelViewMatrix",p.modelViewMatrix),N.setValue(eg,"normalMatrix",p.normalMatrix),N.setValue(eg,"modelMatrix",p.matrixWorld),p.previousModelViewMatrix&&N.setValue(eg,"previousModelViewMatrix",p.previousModelViewMatrix),e.previousProjectionMatrix&&N.setValue(eg,"previousProjectionMatrix",e.previousProjectionMatrix),d.isShaderMaterial||d.isRawShaderMaterial){let e=d.uniformsGroups;for(let t=0,r=e.length;t<r;t++)if(i.isWebGL2){let i=e[t];C.update(i,L),C.bind(i,L)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return L}(e,t,a,f,m);r.setMaterial(f,y);let w=a.index,M=1;!0===f.wireframe&&(w=p.getWireframeAttribute(a),M=2);let T=a.drawRange,P=a.attributes.position,D=T.start*M,O=(T.start+T.count)*M;null!==v&&(D=Math.max(D,v.start*M),O=Math.min(O,(v.start+v.count)*M)),null!==w?(D=Math.max(D,0),O=Math.min(O,w.count)):null!=P&&(D=Math.max(D,0),O=Math.min(O,P.count));let I=O-D;if(I<0||I===1/0)return;E.setup(m,f,b,a,w);let R,L=_;if(null!==w&&(R=d.get(w),(L=A).setIndex(R)),m.isMesh)!0===f.wireframe?(r.setLineWidth(f.wireframeLinewidth*em()),L.setMode(1)):L.setMode(4);else if(m.isLine){let e=f.linewidth;void 0===e&&(e=1),r.setLineWidth(e*em()),m.isLineSegments?L.setMode(1):m.isLineLoop?L.setMode(2):L.setMode(3)}
3139else m.isPoints?L.setMode(0):m.isSprite&&L.setMode(4);if(m.isInstancedMesh)L.renderInstances(D,I,m.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);L.renderInstances(D,I,t)}else L.render(D,I)},this.compile=function(e,t){function i(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eD(e,t,i),e.side=0,e.needsUpdate=!0,eD(e,t,i),e.side=2):eD(e,t,i)}(k=y.get(e)).init(),j.push(k),e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(k.pushLight(e),e.castShadow&&k.pushShadow(e))}),k.setupLights(G.physicallyCorrectLights),e.traverse(function(t){let r=t.material;if(r){if(Array.isArray(r))for(let a=0;a<r.length;a++)i(r[a],e,t);else i(r,e,t)}}),j.pop(),k=null};let eA=null;function eM(){eC.stop()}function eE(){eC.start()}let eC=new sw;function eT(e,a,o,h){let c,d,p,f=e.opaque,m=e.transmissive,g=e.transparent;k.setupLightsView(o),!0===el&&x.setGlobalState(G.clippingPlanes,o),m.length>0&&(c=i.isWebGL2,null===ec&&(ec=new iM(1,1,{generateMipmaps:!0,type:t.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:c&&!0===R?4:0})),G.getDrawingBufferSize(eu),c?ec.setSize(eu.x,eu.y):ec.setSize(t4(eu.x),t4(eu.y)),d=G.getRenderTarget(),G.setRenderTarget(ec),G.clear(),p=G.toneMapping,G.toneMapping=0,eP(f,a,o),G.toneMapping=p,l.updateMultisampleRenderTarget(ec),l.updateRenderTargetMipmap(ec),G.setRenderTarget(d)),h&&r.viewport(Z.copy(h)),f.length>0&&eP(f,a,o),m.length>0&&eP(m,a,o),g.length>0&&eP(g,a,o),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eP(e,t,i){let r=!0===t.isScene?t.overrideMaterial:null;for(let a=0,o=e.length;a<o;a++){let o=e[a],l=o.object,h=o.geometry,c=null===r?o.material:r,d=o.group;l.layers.test(i.layers)&&(l.onBeforeRender(G,t,i,h,c,d),l.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,l.matrixWorld),l.normalMatrix.getNormalMatrix(l.modelViewMatrix),c.onBeforeRender(G,t,i,h,l,d),!0===c.transparent&&2===c.side&&!1===c.forceSinglePass?(c.side=1,c.needsUpdate=!0,G.renderBufferDirect(i,t,h,c,l,d),c.side=0,c.needsUpdate=!0,G.renderBufferDirect(i,t,h,c,l,d),c.side=2):G.renderBufferDirect(i,t,h,c,l,d),l.onAfterRender(G,t,i,h,c,d))}}function eD(e,t,i){!0!==t.isScene&&(t=ef);let r=o.get(e),a=k.state.lights,l=k.state.shadowsArray,d=a.state.version,p=m.getParameters(e,a.state,l,t,i),f=m.getProgramCacheKey(p),g=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?c:h).get(e.envMap||r.environment),void 0===g&&(e.addEventListener("dispose",e_),g=new Map,r.programs=g);let v=g.get(f);if(void 0!==v){if(r.currentProgram===v&&r.lightsStateVersion===d)return eO(e,p),v}else p.uniforms=m.getUniforms(e),e.onBuild(i,p,G),e.onBeforeCompile(p,G),v=m.acquireProgram(p,f),g.set(f,v),r.uniforms=p.uniforms;let y=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(y.clippingPlanes=x.uniform),eO(e,p),r.needsLights=e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights,r.lightsStateVersion=d,r.needsLights&&(y.ambientLightColor.value=a.state.ambient,y.lightProbe.value=a.state.probe,y.directionalLights.value=a.state.directional,y.directionalLightShadows.value=a.state.directionalShadow,y.spotLights.value=a.state.spot,y.spotLightShadows.value=a.state.spotShadow,y.rectAreaLights.value=a.state.rectArea,y.ltc_1.value=a.state.rectAreaLTC1,y.ltc_2.value=a.state.rectAreaLTC2,y.pointLights.value=a.state.point,y.pointLightShadows.value=a.state.pointShadow,y.hemisphereLights.value=a.state.hemi,y.directionalShadowMap.value=a.state.directionalShadowMap,y.directionalShadowMatrix.value=a.state.directionalShadowMatrix,y.spotShadowMap.value=a.state.spotShadowMap,y.spotLightMatrix.value=a.state.spotLightMatrix,y.spotLightMap.value=a.state.spotLightMap,y.pointShadowMap.value=a.state.pointShadowMap,y.pointShadowMatrix.value=a.state.pointShadowMatrix);let b=v.getUniforms(),w=aQ.seqWithValue(b.seq,y);return r.currentProgram=v,r.uniformsList=w,v}function eO(e,t){let i=o.get(e);i.outputEncoding=t.outputEncoding,i.instancing=t.instancing,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eC.setAnimationLoop(function(e){eA&&eA(e)}),"u">typeof self&&eC.setContext(self),this.setAnimationLoop=function(e){eA=e,ex.setAnimationLoop(e),null===e?eC.stop():eC.start()},ex.addEventListener("sessionstart",eM),ex.addEventListener("sessionend",eE),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===H)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ex.enabled&&!0===ex.isPresenting&&(!0===ex.cameraAutoUpdate&&ex.updateCamera(t),t=ex.getCamera()),!0===e.isScene&&e.onBeforeRender(G,e,t,X),(k=y.get(e,j.length)).init(),j.push(k),ed.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),eo.setFromProjectionMatrix(ed),eh=this.localClippingEnabled,el=x.init(this.clippingPlanes,eh),(U=v.get(e,V.length)).init(),V.push(U),function e(t,i,r,o){if(!1===t.visible)return;if(t.layers.test(i.layers)){if(t.isGroup)r=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(i);else if(t.isLight)k.pushLight(t),t.castShadow&&k.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||eo.intersectsSprite(t)){o&&ep.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ed);let e=f.update(t),i=t.material;i.visible&&U.push(t,e,i,r,ep.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==a.render.frame&&(t.skeleton.update(),t.skeleton.frame=a.render.frame),!t.frustumCulled||eo.intersectsObject(t))){o&&ep.setFromMatrixPosition(t.matrixWorld).applyMatrix4(ed);let e=f.update(t),i=t.material;if(Array.isArray(i)){let a=e.groups;for(let o=0,l=a.length;o<l;o++){let l=a[o],h=i[l.materialIndex];h&&h.visible&&U.push(t,e,h,r,ep.z,l)}}else i.visible&&U.push(t,e,i,r,ep.z,null)}}let l=t.children;for(let t=0,a=l.length;t<a;t++)e(l[t],i,r,o)}(e,t,0,G.sortObjects),U.finish(),!0===G.sortObjects&&U.sort(ei,er),!0===el&&x.beginShadows();let i=k.state.shadowsArray;if(b.render(i,e,t),!0===el&&x.endShadows(),!0===this.info.autoReset&&this.info.reset(),w.render(U,e),k.setupLights(G.physicallyCorrectLights),t.isArrayCamera){let i=t.cameras;for(let t=0,r=i.length;t<r;t++){let r=i[t];eT(U,e,r,r.viewport)}}else eT(U,e,t);null!==X&&(l.updateMultisampleRenderTarget(X),l.updateRenderTargetMipmap(X)),!0===e.isScene&&e.onAfterRender(G,e,t),E.resetDefaultState(),Y=-1,Q=null,j.pop(),k=j.length>0?j[j.length-1]:null,V.pop(),U=V.length>0?V[V.length-1]:null},this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return X},this.setRenderTargetTextures=function(e,i,r){o.get(e.texture).__webglTexture=i,o.get(e.depthTexture).__webglTexture=r;let a=o.get(e);a.__hasExternalTextures=!0,a.__hasExternalTextures&&(a.__autoAllocateDepthBuffer=void 0===r,a.__autoAllocateDepthBuffer||!0===t.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),a.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let i=o.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,a=0){X=e,W=t,q=a;let h=!0,c=null,d=!1,p=!1;if(e){let a=o.get(e);void 0!==a.__useDefaultFramebuffer?(r.bindFramebuffer(36160,null),h=!1):void 0===a.__webglFramebuffer?l.setupRenderTarget(e):a.__hasExternalTextures&&l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);let f=e.texture;(f.isData3DTexture||f.isDataArrayTexture||f.isCompressedArrayTexture)&&(p=!0);let m=o.get(e).__webglFramebuffer;
3139e.isWebGLCubeRenderTarget?(c=m[t],d=!0):c=i.isWebGL2&&e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:m,Z.copy(e.viewport),K.copy(e.scissor),J=e.scissorTest}else Z.copy(es).multiplyScalar(et).floor(),K.copy(ea).multiplyScalar(et).floor(),J=en;if(r.bindFramebuffer(36160,c)&&i.drawBuffers&&h&&r.drawBuffers(e,c),r.viewport(Z),r.scissor(K),r.setScissorTest(J),d){let i=o.get(e.texture);eg.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,a)}else if(p){let i=o.get(e.texture);eg.framebufferTextureLayer(36160,36064,i.__webglTexture,a||0,t||0)}Y=-1},this.readRenderTargetPixels=function(e,a,l,h,c,d,p){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let f=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==p&&(f=f[p]),f){r.bindFramebuffer(36160,f);try{let r=e.texture,o=r.format,p=r.type;if(1023!==o&&M.convert(o)!==eg.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let f=1016===p&&(t.has("EXT_color_buffer_half_float")||i.isWebGL2&&t.has("EXT_color_buffer_float"));if(1009!==p&&M.convert(p)!==eg.getParameter(35738)&&!(1015===p&&(i.isWebG
3139L2||t.has("OES_texture_float")||t.has("WEBGL_color_buffer_float")))&&!f){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}a>=0&&a<=e.width-h&&l>=0&&l<=e.height-c&&eg.readPixels(a,l,h,c,M.convert(o),M.convert(p),d)}finally{let e=null!==X?o.get(X).__webglFramebuffer:null;r.bindFramebuffer(36160,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,l,h,c){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(d=d[c]),d){let c=e.texture,f=c.format,m=c.type;if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-l){var p;r.bindFramebuffer(eg.FRAMEBUFFER,d);let e=eg.createBuffer();eg.bindBuffer(eg.PIXEL_PACK_BUFFER,e),eg.bufferData(eg.PIXEL_PACK_BUFFER,h.byteLength,eg.STREAM_READ),eg.readPixels(t,i,a,l,M.convert(f),M.convert(m),0);let c=null!==X?o.get(X).__webglFramebuffer:null;r.bindFramebuffer(eg.FRAMEBUFFER,c);let g=eg.fenceSync(eg.SYNC_GPU_COMMANDS_COMPLETE,0);return eg.flush(),await (p=eg,new Promise(function(e,t){setTimeout(function i(){switch(p.clientWaitSync(g,p.SYNC_FLUSH_COMMANDS_BIT,0)){case p.WAIT_FAILED:t();break;case p.TIMEOUT_EXPIRED:setTimeout(i,4);break;default:e()}},4)})),eg.bindBuffer(eg.PIXEL_PACK_BUFFER,e),eg.getBufferSubData(eg.PIXEL_PACK_BUFFER,0,h),eg.deleteBuffer(e),eg.deleteSync(g),h}throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t,i=0){let a=Math.pow(2,-i),o=Math.floor(t.image.width*a),h=Math.floor(t.image.height*a);l.setTexture2D(t,0),eg.copyTexSubImage2D(3553,i,0,0,e.x,e.y,o,h),r.unbindTexture()},this.copyTextureToTexture=function(e,t,i,a=0){let o=t.image.width,h=t.image.height,c=M.convert(i.format),d=M.convert(i.type);l.setTexture2D(i,0),eg.pixelStorei(37440,i.flipY),eg.pixelStorei(37441,i.premultiplyAlpha),eg.pixelStorei(3317,i.unpackAlignment),t.isDataTexture?eg.texSubImage2D(3553,a,e.x,e.y,o,h,c,d,t.image.data):t.isCompressedTexture?eg.compressedTexSubImage2D(3553,a,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,c,t.mipmaps[0].data):eg.texSubImage2D(3553,a,e.x,e.y,c,d,t.image),0===a&&i.generateMipmaps&&eg.generateMipmap(3553),r.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i,a,o=0){if(G.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let h=e.max.x-e.min.x+1,c=e.max.y-e.min.y+1,d=e.max.z-e.min.z+1,p=M.convert(a.format),f=M.convert(a.type),m;if(a.isData3DTexture)l.setTexture3D(a,0),m=32879;else if(a.isDataArrayTexture)l.setTexture2DArray(a,0),m=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}eg.pixelStorei(37440,a.flipY),eg.pixelStorei(37441,a.premultiplyAlpha),eg.pixelStorei(3317,a.unpackAlignment);let g=eg.getParameter(3314),v=eg.getParameter(32878),y=eg.getParameter(3316),x=eg.getParameter(3315),b=eg.getParameter(32877),w=i.isCompressedTexture?i.mipmaps[0]:i.image;eg.pixelStorei(3314,w.width),eg.pixelStorei(32878,w.height),eg.pixelStorei(3316,e.min.x),eg.pixelStorei(3315,e.min.y),eg.pixelStorei(32877,e.min.z),i.isDataTexture||i.isData3DTexture?eg.texSubImage3D(m,o,t.x,t.y,t.z,h,c,d,p,f,w.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),eg.compressedTexSubImage3D(m,o,t.x,t.y,t.z,h,c,d,p,w.data)):eg.texSubImage3D(m,o,t.x,t.y,t.z,h,c,d,p,f,w),eg.pixelStorei(3314,g),eg.pixelStorei(32878,v),eg.pixelStorei(3316,y),eg.pixelStorei(3315,x),eg.pixelStorei(32877,b),0===o&&a.generateMipmaps&&eg.generateMipmap(m),r.unbindTexture()},this.initRenderTarget=function(e){void 0===o.get(e).__webglFramebuffer&&l.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?l.setTextureCube(e,0):e.isData3DTexture?l.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?l.setTexture2DArray(e,0):l.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){W=0,q=0,X=null,r.reset(),E.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends nO{}).prototype.isWebGL1Renderer=!0;
vendor: 8,598 bytes, line 3139
3139var nI=class{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new iv(e),this.near=t,this.far=i}clone(){return new nI(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},nR=class extends rw{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}},nL=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=tJ()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,a=this.stride;r<a;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=tJ()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=tJ()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},nB=new iD,nz=class{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}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,i=this.data.count;t<i;t++)nB.fromBufferAttribute(this,t),nB.applyMatrix4(e),this.setXYZ(t,nB.x,nB.y,nB.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)nB.fromBufferAttribute(this,t),nB.applyNormalMatrix(e),this.setXYZ(t,nB.x,nB.y,nB.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)nB.fromBufferAttribute(this,t),nB.transformDirection(e),this.setXYZ(t,nB.x,nB.y,nB.z);return this}setX(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=t6(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=t5(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=t5(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=t5(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=t5(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,a){return e=e*this.data.stride+this.offset,this.normalized&&(t=t6(t,this.array),i=t6(i,this.array),r=t6(r,this.array),a=t6(a,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=a,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new nz(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return new rN(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}},nF=class extends rw{constructor(){super(),this.isBone=!0,this.type="Bone"}},nN=class extends i_{constructor(e=null,t=1,i=1,r,a,o,l,h,c=1003,d=1003,p,f){super(null,o,l,h,c,d,r,a,p,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},nU=new i6,nk=new i6,nV=class{constructor(e=[],t=[]){this.uuid=tJ(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)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 e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new i6)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new i6;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let r=0,a=e.length;r<a;r++){let a=e[r]?e[r].matrixWorld:nk;nU.multiplyMatrices(a,t[r]),nU.toArray(i,16*r)}null!==r&&(r.needsUpdate=!0)}clone(){return new nV(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=t3(e),4))*e*4);t.set(this.boneMatrices);let i=new nN(t,e,e,1023,1015);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;
3139for(let i=0,r=e.bones.length;i<r;i++){let r=e.bones[i],a=t[r];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),a=new nF),this.bones.push(a),this.boneInverses.push(new i6().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let r=0,a=t.length;r<a;r++){let a=t[r];e.bones.push(a.uuid);let o=i[r];e.boneInverses.push(o.toArray())}return e}},nj=class extends rN{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},nG=new i6,nH=new i6,nW=[],nq=new i6,nX=new r7,nY=class extends r7{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new nj(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1;for(let e=0;e<i;e++)this.setMatrixAt(e,nq)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}raycast(e,t){let i=this.matrixWorld,r=this.count;if(nX.geometry=this.geometry,nX.material=this.material,void 0!==nX.material)for(let a=0;a<r;a++){this.getMatrixAt(a,nG),nH.multiplyMatrices(i,nG),nX.matrixWorld=nH,nX.raycast(e,nW);for(let e=0,i=nW.length;e<i;e++){let i=nW[e];i.instanceId=a,i.object=this,t.push(i)}nW.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new nj(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}},nQ=class extends rL{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new iv(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}},nZ=new iD,nK=new iD,nJ=new i6,n$=new i5,n0=new iK,n1=class extends rw{constructor(e=new rQ,t=new nQ){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,r=t.count;e<r;e++)nZ.fromBufferAttribute(t,e-1),nK.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=nZ.distanceTo(nK);e.setAttribute("lineDistance",new rV(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,a=e.params.Line.threshold,o=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),n0.copy(i.boundingSphere),n0.applyMatrix4(r),n0.radius+=a,!1===e.ray.intersectsSphere(n0))return;nJ.copy(r).invert(),n$.copy(e.ray).applyMatrix4(nJ);let l=a/((this.scale.x+this.scale.y+this.scale.z)/3),h=l*l,c=new iD,d=new iD,p=new iD,f=new iD,m=this.isLineSegments?2:1,g=i.index,v=i.attributes.position;if(null!==g){let i=Math.max(0,o.start),r=Math.min(g.count,o.start+o.count);for(let a=i,o=r-1;a<o;a+=m){let i=g.getX(a),r=g.getX(a+1);if(c.fromBufferAttribute(v,i),d.fromBufferAttribute(v,r),n$.distanceSqToSegment(c,d,f,p)>h)continue;
3139f.applyMatrix4(this.matrixWorld);let o=e.ray.origin.distanceTo(f);o<e.near||o>e.far||t.push({distance:o,point:p.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}else{let i=Math.max(0,o.start),r=Math.min(v.count,o.start+o.count);for(let a=i,o=r-1;a<o;a+=m){if(c.fromBufferAttribute(v,a),d.fromBufferAttribute(v,a+1),n$.distanceSqToSegment(c,d,f,p)>h)continue;f.applyMatrix4(this.matrixWorld);let i=e.ray.origin.distanceTo(f);i<e.near||i>e.far||t.push({distance:i,point:p.clone().applyMatrix4(this.matrixWorld),index:a,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},n2=new iD,n3=new iD,n4=class extends n1{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,r=t.count;e<r;e+=2)n2.fromBufferAttribute(t,e),n3.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+n2.distanceTo(n3);e.setAttribute("lineDistance",new rV(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},n5=class extends i_{constructor(e,t,i,r,a,o,l,h,c){super(e,t,i,r,a,o,l,h,c),this.isVideoTexture=!0,this.minFilter=void 0!==o?o:1006,this.magFilter=void 0!==a?a:1006,this.generateMipmaps=!1;let d=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){d.needsUpdate=!0,e.requestVideoFrameCallback(t)})}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e==!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},n6=class extends i_{constructor(e,t,i,r,a,o,l,h,c){super(e,t,i,r,a,o,l,h,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},n8=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let 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;let t=[],i,r=this.getPoint(0),a=0;t.push(0);for(let o=1;o<=e;o++)t.push(a+=(i=this.getPoint(o/e)).distanceTo(r)),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),r=0,a=i.length,o;o=t||e*i[a-1];let l=0,h=a-1,c;for(;l<=h;)if((c=i[r=Math.floor(l+(h-l)/2)]-o)<0)l=r+1;else if(c>0)h=r-1;else{h=r;break}if(i[r=h]===o)return r/(a-1);let d=i[r],p=i[r+1]-d;return(r+(o-d)/p)/(a-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let a=this.getPoint(i),o=this.getPoint(r),l=t||(a.isVector2?new t9:new iD);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new iD,r=[],a=[],o=[],l=new iD,h=new i6;for(let t=0;t<=e;t++){let i=t/e;r[t]=this.getTangentAt(i,new iD)}a[0]=new iD,o[0]=new iD;let c=Number.MAX_VALUE,d=Math.abs(r[0].x),p=Math.abs(r[0].y),f=Math.abs(r[0].z);d<=c&&(c=d,i.set(1,0,0)),p<=c&&(c=p,i.set(0,1,0)),f<=c&&i.set(0,0,1),l.crossVectors(r[0],i).normalize(),a[0].crossVectors(r[0],l),o[0].crossVectors(r[0],a[0]);for(let t=1;t<=e;t++){if(a[t]=a[t-1].clone(),o[t]=o[t-1].clone(),l.crossVectors(r[t-1],r[t]),l.length()>Number.EPSILON){l.normalize();let e=Math.acos(t$(r[t-1].dot(r[t]),-1,1));a[t].applyMatrix4(h.makeRotationAxis(l,e))}o[t].crossVectors(r[t],a[t])}if(!0===t){let t=Math.acos(t$(a[0].dot(a[e]),-1,1));t/=e,r[0].dot(l.crossVectors(a[0],a[e]))>0&&(t=-t);for(let i=1;i<=e;i++)a[i].applyMatrix4(h.makeRotationAxis(r[i],t*i)),o[i].crossVectors(r[i],a[i])}return{tangents:r,normals:a,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.t
3139ype,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},n9=class extends n8{constructor(e=0,t=0,i=1,r=1,a=0,o=2*Math.PI,l=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=a,this.aEndAngle=o,this.aClockwise=l,this.aRotation=h}getPoint(e,t){let i=t||new t9,r=2*Math.PI,a=this.aEndAngle-this.aStartAngle,o=Math.abs(a)<Number.EPSILON;for(;a<0;)a+=r;for(;a>r;)a-=r;a<Number.EPSILON&&(a=o?0:r),!0!==this.aClockwise||o||(a===r?a=-r:a-=r);let l=this.aStartAngle+e*a,h=this.aX+this.xRadius*Math.cos(l),c=this.aY+this.yRadius*Math.sin(l);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=h-this.aX,r=c-this.aY;h=i*e-r*t+this.aX,c=i*t+r*e+this.aY}return i.set(h,c)}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(){let 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}},n7=class extends n9{constructor(e,t,i,r,a,o){super(e,t,i,i,r,a,o),this.isArcCurve=!0,this.type="ArcCurve"}};function oe(){let e=0,t=0,i=0,r=0;function a(a,o,l,h){e=a,t=l,i=-3*a+3*o-2*l-h,r=2*a-2*o+l+h}return{initCatmullRom:function(e,t,i,r,o){a(t,i,o*(i-e),o*(r-t))},initNonuniformCatmullRom:function(e,t,i,r,o,l,h){let c=(t-e)/o-(i-e)/(o+l)+(i-t)/l,d=(i-t)/l-(r-t)/(l+h)+(r-i)/h;a(t,i,c*=l,d*=l)},calc:function(a){let o=a*a;return e+t*a+i*o+o*a*r}}}var ot=new iD,oi=new oe,or=new oe,os=new oe,oa=class extends n8{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new iD){let i,r,a=this.points,o=a.length,l=(o-(this.closed?0:1))*e,h=Math.floor(l),c=l-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/o)+1)*o:0===c&&h===o-1&&(h=o-2,c=1),this.closed||h>0?i=a[(h-1)%o]:(ot.subVectors(a[0],a[1]).add(a[0]),i=ot);let d=a[h%o],p=a[(h+1)%o];if(this.closed||h+2<o?r=a[(h+2)%o]:(ot.subVectors(a[o-1],a[o-2]).add(a[o-1]),r=ot),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(i.distanceToSquared(d),e),a=Math.pow(d.distanceToSquared(p),e),o=Math.pow(p.distanceToSquared(r),e);a<1e-4&&(a=1),t<1e-4&&(t=a),o<1e-4&&(o=a),oi.initNonuniformCatmullRom(i.x,d.x,p.x,r.x,t,a,o),or.initNonuniformCatmullRom(i.y,d.y,p.y,r.y,t,a,o),os.initNonuniformCatmullRom(i.z,d.z,p.z,r.z,t,a,o)}else"catmullrom"===this.curveType&&(oi.initCatmullRom(i.x,d.x,p.x,r.x,this.tension),or.initCatmullRom(i.y,d.y,p.y,r.y,this.tension),os.initCatmullRom(i.z,d.z,p.z,r.z,this.tension));return t.set(oi.calc(c),or.calc(c),os.calc(c)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.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,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new iD().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function on(e,t,i,r,a){let o=(r-t)*.5,l=(a-i)*.5,h=e*e;return e*h*(2*i-2*r+o+l)+(-3*i+3*r-2*o-l)*h+o*e+i}function oo(e,t,i,r){let a;return(a=1-e)*a*t+2*(1-e)*e*i+e*e*r}function ol(e,t,i,r,a){let o,l;return(o=1-e)*o*o*t+3*(l=1-e)*l*e*i+3*(1-e)*e*e*r+e*e*e*a}var oh=class extends n8{constructor(e=new t9,t=new t9,i=new t9,r=new t9){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new t9){let i=this.v0,r=this.v1,a=this.v2,o=this.v3;return t.set(ol(e,i.x,r.x,a.x,o.x),ol(e,i.y,r.y,a.y,o.y)),t}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(){let 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}},oc=class extends n8{constructor(e=new iD,t=new iD,i=new iD,r=new iD){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new iD){let i=this.v0,r=this.v1,a=this.v2,o=this.v3;return t.set(ol(e,i.x,r.x,a.x,o.x),ol(e,i.y,r.y,a.y,o.y),ol(e,i.z,r.z,a.z,o.z)),t}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(){let 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}},od=class extends n8{constructor(e=new t9,t=new t9){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new t9){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let i=t||new t9;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},ou=class extends n8{constructor(e=new iD,t=new iD){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new iD){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}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(){let 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}},op=class extends n8{constructor(e=new t9,t=new t9,i=new t9){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}
vendor: 8,307 bytes, line 3139
3139getPoint(e,t=new t9){let i=this.v0,r=this.v1,a=this.v2;return t.set(oo(e,i.x,r.x,a.x),oo(e,i.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},of=class extends n8{constructor(e=new iD,t=new iD,i=new iD){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new iD){let i=this.v0,r=this.v1,a=this.v2;return t.set(oo(e,i.x,r.x,a.x),oo(e,i.y,r.y,a.y),oo(e,i.z,r.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let 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}},om=class extends n8{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new t9){let i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,l=i[0===a?a:a-1],h=i[a],c=i[a>i.length-2?i.length-1:a+1],d=i[a>i.length-3?i.length-1:a+2];return t.set(on(o,l.x,h.x,c.x,d.x),on(o,l.y,h.y,c.y,d.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new t9().fromArray(i))}return this}},og=Object.freeze({__proto__:null,ArcCurve:n7,CatmullRomCurve3:oa,CubicBezierCurve:oh,CubicBezierCurve3:oc,EllipseCurve:n9,LineCurve:od,LineCurve3:ou,QuadraticBezierCurve:op,QuadraticBezierCurve3:of,SplineCurve:om}),ov=class extends n8{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new od(t,e))}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),a=0;for(;a<r.length;){if(r[a]>=i){let e=r[a]-i,o=this.curves[a],l=o.getLength(),h=0===l?0:1-e/l;return o.getPointAt(h,t)}a++}return null}getLength(){let 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;let e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)e.push(t+=this.curves[i].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let r=0,a=this.curves;r<a.length;r++){let o=a[r],l=o.isEllipseCurve?2*e:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,h=o.getPoints(l);for(let e=0;e<h.length;e++){let r=h[e];i&&i.equals(r)||(t.push(r),i=r)}}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,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let i=e.curves[t];this.curves.push(new og[i.type]().fromJSON(i))}return this}},oy=class extends ov{constructor(e){super(),this.type="Path",this.currentPoint=new t9,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new od(this.currentPoint.clone(),new t9(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let a=new op(this.currentPoint.clone(),new t9(e,t),new t9(i,r));return this.curves.push(a),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,a,o){let l=new oh(this.currentPoint.clone(),new t9(e,t),new t9(i,r),new t9(a,o));return this.curves.push(l),this.currentPoint.set(a,o),this}splineThru(e){let t=new om([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,a,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(e+l,t+h,i,r,a,o),this}absarc(e,t,i,r,a,o){return this.absellipse(e,t,i,i,r,a,o),this}ellipse(e,t,i,r,a,o,l,h){let c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,t+d,i,r,a,o,l,h),this}absellipse(e,t,i,r,a,o,l,h){let c=new n9(e,t,i,r,a,o,l,h);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},ox=class extends rQ{constructor(e=[new t9(0,-.5),new t9(.5,0),new t9(0,.5)],t=12,i=0,r=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=t$(r,0,2*Math.PI);let a=[],o=[],l=[],h=[],c=[],d=1/t,p=new iD,f=new t9,m=new iD,g=new iD,v=new iD,y=0,x=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:y=e[t+1].x-e[t].x,x=e[t+1].y-e[t].y,m.x=1*x,m.y=-y,m.z=0*x,v.copy(m),m.normalize(),h.push(m.x,m.y,m.z);break;case e.length-1:h.push(v.x,v.y,v.z);break;default:y=e[t+1].x-e[t].x,x=e[t+1].y-e[t].y,m.x=1*x,m.y=-y,m.z=0*x,g.copy(m),m.x+=v.x,m.y+=v.y,m.z+=v.z,m.normalize(),h.push(m.x,m.y,m.z),v.copy(g)}for(let a=0;a<=t;a++){let m=i+a*d*r,g=Math.sin(m),v=Math.cos(m);for(let i=0;i<=e.length-1;i++){p.x=e[i].x*g,p.y=e[i].y,p.z=e[i].x*v,o.push(p.x,p.y,p.z),f.x=a/t,f.y=i/(e.length-1),l.push(f.x,f.y);let r=h[3*i+0]*g,d=h[3*i+1],m=h[3*i+0]*v;c.push(r,d,m)}}for(let i=0;i<t;i++)for(let t=0;t<e.length-1;t++){let r=t+i*e.length,o=r+e.length,l=r+e.length+1,h=r+1;a.push(r,o,h),a.push(l,h,o)}this.setIndex(a),this.setAttribute("position",new rV(o,3)),this.setAttribute("uv",new rV(l,2)),this.setAttribute("normal",new rV(c,3))}static fromJSON(e){return new ox(e.points,e.segments,e.phiStart,e.phiLength)}},ob=class extends rQ{constructor(e=1,t=1,i=1,r=32,a=1,o=!1,l=0,h=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h};let c=this;r=Math.floor(r),a=Math.floor(a);let d=[],p=[],f=[],m=[],g=0,v=[],y=i/2,x=0;function b(i){let a=g,o=new t9,v=new iD,b=0,w=!0===i?e:t,S=!0===i?1:-1;for(let e=1;e<=r;e++)p.push(0,y*S,0),f.push(0,S,0),m.push(.5,.5),g++;let _=g;for(let e=0;e<=r;e++){let t=e/r*h+l,i=Math.cos(t),a=Math.sin(t);v.x=w*a,v.y=y*S,v.z=w*i,p.push(v.x,v.y,v.z),f.push(0,S,0),o.x=.5*i+.5,o.y=.5*a*S+.5,m.push(o.x,o.y),g++}for(let e=0;e<r;e++){let t=a+e,r=_+e;!0===i?d.push(r,r+1,t):d.push(r+1,r,t),b+=3}c.addGroup(x,b,!0===i?1:2),x+=b}(function(){let o=new iD,b=new iD,w=0,S=(t-e)/i;for(let c=0;c<=a;c++){let d=[],x=c/a,w=x*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,a=t*h+l,c=Math.sin(a),v=Math.cos(a);b.x=w*c,b.y=-x*i+y,b.z=w*v,p.push(b.x,b.y,b.z),o.set(c,S,v).normalize(),f.push(o.x,o.y,o.z),m.push(t,1-x),d.push(g++)}v.push(d)}for(let e=0;e<r;e++)for(let t=0;t<a;t++){let i=v[t][e],r=v[t+1][e],a=v[t+1][e+1],o=v[t][e+1];d.push(i,r,o),d.push(r,a,o),w+=6}c.addGroup(x,w,0),x+=w})(),!1===o&&(e>0&&b(!0),t>0&&b(!1)),this.setIndex(d),this.setAttribute("position",new rV(p,3)),this.setAttribute("normal",new rV(f,3)),this.setAttribute("uv",new rV(m,2))}static fromJSON(e){return new ob(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},ow=class extends ob{constructor(e=1,t=1,i=32,r=1,a=!1,o=0,l=2*Math.PI){super(0,e,t,i,r,a,o,l),this.type="C
3139oneGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l}}static fromJSON(e){return new ow(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},oS=class extends rQ{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};let a=[],o=[];function l(e){a.push(e.x,e.y,e.z)}function h(t,i){let r=3*t;i.x=e[r+0],i.y=e[r+1],i.z=e[r+2]}function c(e,t,i,r){r<0&&1===e.x&&(o[t]=e.x-1),0===i.x&&0===i.z&&(o[t]=r/2/Math.PI+.5)}function d(e){return Math.atan2(e.z,-e.x)}(function(e){let i=new iD,r=new iD,a=new iD;for(let o=0;o<t.length;o+=3)h(t[o+0],i),h(t[o+1],r),h(t[o+2],a),function(e,t,i,r){let a=r+1,o=[];for(let r=0;r<=a;r++){o[r]=[];let l=e.clone().lerp(i,r/a),h=t.clone().lerp(i,r/a),c=a-r;for(let e=0;e<=c;e++)0===e&&r===a?o[r][e]=l:o[r][e]=l.clone().lerp(h,e/c)}for(let e=0;e<a;e++)for(let t=0;t<2*(a-e)-1;t++){let i=Math.floor(t/2);t%2==0?(l(o[e][i+1]),l(o[e+1][i]),l(o[e][i])):(l(o[e][i+1]),l(o[e+1][i+1]),l(o[e+1][i]))}}(i,r,a,e)})(r),function(e){let t=new iD;for(let i=0;i<a.length;i+=3)t.x=a[i+0],t.y=a[i+1],t.z=a[i+2],t.normalize().multiplyScalar(e),a[i+0]=t.x,a[i+1]=t.y,a[i+2]=t.z}(i),function(){let e=new iD;for(let t=0;t<a.length;t+=3){e.x=a[t+0],e.y=a[t+1],e.z=a[t+2];let i=d(e)/2/Math.PI+.5,r=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;o.push(i,1-r)}(function(){let e=new iD,t=new iD,i=new iD,r=new iD,l=new t9,h=new t9,p=new t9;for(let f=0,m=0;f<a.length;f+=9,m+=6){e.set(a[f+0],a[f+1],a[f+2]),t.set(a[f+3],a[f+4],a[f+5]),i.set(a[f+6],a[f+7],a[f+8]),l.set(o[m+0],o[m+1]),h.set(o[m+2],o[m+3]),p.set(o[m+4],o[m+5]),r.copy(e).add(t).add(i).divideScalar(3);let g=d(r);c(l,m+0,e,g),c(h,m+2,t,g),c(p,m+4,i,g)}})(),function(){for(let e=0;e<o.length;e+=6){let t=o[e+0],i=o[e+2],r=o[e+4],a=Math.max(t,i,r),l=Math.min(t,i,r);a>.9&&l<.1&&(t<.2&&(o[e+0]+=1),i<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.setAttribute("position",new rV(a,3)),this.setAttribute("normal",new rV(a.slice(),3)),this.setAttribute("uv",new rV(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new oS(e.vertices,e.indices,e.radius,e.details)}},o_=class extends oS{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=1/i;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
313919,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new o_(e.radius,e.detail)}},oA=class extends oy{constructor(e){super(e),this.uuid=tJ(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let i=e.holes[t];this.holes.push(new oy().fromJSON(i))}return this}},oM=function(e,t,i=2){let r,a,o,l,h,c,d,p=t&&t.length,f=p?t[0]*i:e.length,m=oE(e,0,f,i,!0),g=[];if(!m||m.next===m.prev)return g;if(p&&(m=function(e,t,i,r){let a=[],o,l,h,c,d;for(o=0,l=t.length;o<l;o++)h=t[o]*r,c=o<l-1?t[o+1]*r:e.length,(d=oE(e,h,c,r,!1))===d.next&&(d.steiner=!0),a.push(function(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}(d));for(a.sort(oT),o=0;o<a.length;o++)i=function(e,t){let i=function(e,t){let i=t,r=-1/0,a,o=e.x,l=e.y;do{if(l<=i.y&&l>=i.next.y&&i.next.y!==i.y){let e=i.x+(l-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=o&&e>r&&(r=e,a=i.x<i.next.x?i:i.next,e===o))return a}i=i.next}while(i!==t);if(!a)return null;let h=a,c=a.x,d=a.y,p=1/0,f;i=a;do{var m,g;o>=i.x&&i.x>=c&&o!==i.x&&oD(l<d?o:r,l,c,d,l<d?r:o,l,i.x,i.y)&&(f=Math.abs(l-i.y)/(o-i.x),oz(i,e)&&(f<p||f===p&&(i.x>a.x||i.x===a.x&&(m=a,g=i,0>oO(m.prev,m,g.prev)&&0>oO(g.next,m,m.next))))&&(a=i,p=f)),i=i.next}while(i!==h);return a}(e,t);if(!i)return t;let r=oF(i,e);return oC(r,r.next),oC(i,i.next)}(a[o],i);return i}(e,t,m,i)),e.length>80*i){r=o=e[0],a=l=e[1];for(let t=i;t<f;t+=i)h=e[t],c=e[t+1],h<r&&(r=h),c<a&&(a=c),h>o&&(o=h),c>l&&(l=c);d=0!==(d=Math.max(o-r,l-a))?32767/d:0}return function e(t,i,r,a,o,l,h){if(!t)return;!h&&l&&function(e,t,i,r){let a=e;do 0===a.z&&(a.z=oP(a.x,a.y,t,i,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){let t,i,r,a,o,l,h,c,d=1;do{for(i=e,e=null,o=null,l=0;i;){for(l++,r=i,h=0,t=0;t<d&&(h++,r=r.nextZ);t++);for(c=d;h>0||c>0&&r;)0!==h&&(0===c||!r||i.z<=r.z)?(a=i,i=i.nextZ,h--):(a=r,r=r.nextZ,c--),o?o.nextZ=a:e=a,a.prevZ=o,o=a;i=r}o.nextZ=null,d*=2}while(l>1)}(a)}(t,a,o,l);let c=t,d,p;for(;t.prev!==t.next;){if(d=t.prev,p=t.next,l?function(e,t,i,r){let a=e.prev,o=e.next;if(oO(a,e,o)>=0)return!1;let l=a.x,h=e.x,c=o.x,d=a.y,p=e.y,f=o.y,m=l<h?l<c?l:c:h<c?h:c,g=d<p?d<f?d:f:p<f?p:f,v=l>h?l>c?l:c:h>c?h:c,y=d>p?d>f?d:f:p>f?p:f,x=oP(m,g,t,i,r),b=oP(v,y,t,i,r),w=e.prevZ,S=e.nextZ;for(;w&&w.z>=x&&S&&S.z<=b;){if(w.x>=m&&w.x<=v&&w.y>=g&&w.y<=y&&w!==a&&w!==o&&oD(l,d,h,p,c,f,w.x,w.y)&&oO(w.prev,w,w.next)>=0||(w=w.prevZ,S.x>=m&&S.x<=v&&S.y>=g&&S.y<=y&&S!==a&&S!==o&&oD(l,d,h,p,c,f,S.x,S.y)&&oO(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;w&&w.z>=x;){if(w.x>=m&&w.x<=v&&w.y>=g&&w.y<=y&&w!==a&&w!==o&&oD(l,d,h,p,c,f,w.x,w.y)&&oO(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;S&&S.z<=b;){if(S.x>=m&&S.x<=v&&S.y>=g&&S.y<=y&&S!==a&&S!==o&&oD(l,d,h,p,c,f,S.x,S.y)&&oO(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}(t,a,o,l):function(e){let t=e.prev,i=e.next;if(oO(t,e,i)>=0)return!1;let r=t.x,a=e.x,o=i.x,l=t.y,h=e.y,c=i.y,d=r<a?r<o?r:o:a<o?a:o,p=l<h?l<c?l:c:h<c?h:c,f=r>a?r>o?r:o:a>o?a:o,m=l>h?l>c?l:c:h>c?h:c,g=i.next;for(;g!==t;){if(g.x>=d&&g.x<=f&&g.y>=p&&g.y<=m&&oD(r,l,a,h,o,c,g.x,g.y)&&oO(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}(t)){i.push(d.i/r|0),i.push(t.i/r|0),i.push(p.i/r|0),oU(t),t=p.next,c=p.next;continue}if((t=p)===c){h?1===h?e(t=function(e,t,i){let r=e;do{let a=r.prev,o=r.next.next;!oI(a,o)&&oR(a,r,r.next,o)&&oz(a,o)&&oz(o,a)&&(t.push(a.i/i|0),t.push(r.i/i|0),t.push(o.i/i|0),oU(r),oU(r.next),r=e=o),r=r.next}while(r!==e);return oC(r)}(oC(t),i,r),i,r,a,o,l,2):2===h&&function(t,i,r,a,o,l){let h=t;do{let t=h.next.next;for(;t!==h.prev;){var c,d;if(h.i!==t.i&&(c=h,d=t,c.next.i!==d.i&&c.prev.i!==d.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&oR(i,i.next,e,t))return!0;
3139i=i.next}while(i!==e);return!1}(c,d)&&(oz(c,d)&&oz(d,c)&&function(e,t){let i=e,r=!1,a=(e.x+t.x)/2,o=(e.y+t.y)/2;do i.y>o!=i.next.y>o&&i.next.y!==i.y&&a<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}(c,d)&&(oO(c.prev,c,d.prev)||oO(c,d.prev,d))||oI(c,d)&&oO(c.prev,c,c.next)>0&&oO(d.prev,d,d.next)>0))){let c=oF(h,t);h=oC(h,h.next),c=oC(c,c.next),e(h,i,r,a,o,l,0),e(c,i,r,a,o,l,0);return}t=t.next}h=h.next}while(h!==t)}(t,i,r,a,o,l):e(oC(t),i,r,a,o,l,1);break}}}(m,g,i,r,a,d,0),g};function oE(e,t,i,r,a){let o,l;if(a===function(e,t,i,r){let a=0;for(let o=t,l=i-r;o<i;o+=r)a+=(e[l]-e[o])*(e[o+1]+e[l+1]),l=o;return a}(e,t,i,r)>0)for(o=t;o<i;o+=r)l=oN(o,e[o],e[o+1],l);else for(o=i-r;o>=t;o-=r)l=oN(o,e[o],e[o+1],l);return l&&oI(l,l.next)&&(oU(l),l=l.next),l}function oC(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(oI(i,i.next)||0===oO(i.prev,i,i.next))){if(oU(i),(i=t=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function oT(e,t){return e.x-t.x}function oP(e,t,i,r,a){return(e=((e=((e=((e=((e=(e-i)*a|0)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)|(t=((t=((t=((t=((t=(t-r)*a|0)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)<<1}function oD(e,t,i,r,a,o,l,h){return(a-l)*(t-h)>=(e-l)*(o-h)&&(e-l)*(r-h)>=(i-l)*(t-h)&&(i-l)*(o-h)>=(a-l)*(r-h)}function oO(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function oI(e,t){return e.x===t.x&&e.y===t.y}function oR(e,t,i,r){let a=oB(oO(e,t,i)),o=oB(oO(e,t,r)),l=oB(oO(i,r,e)),h=oB(oO(i,r,t));return!!(a!==o&&l!==h||0===a&&oL(e,i,t)||0===o&&oL(e,r,t)||0===l&&oL(i,e,r)||0===h&&oL(i,t,r))}function oL(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function oB(e){return e>0?1:e<0?-1:0}function oz(e,t){return 0>oO(e.prev,e,e.next)?oO(e,t,e.next)>=0&&oO(e,e.prev,t)>=0:0>oO(e,t,e.prev)||0>oO(e,e.next,t)}function oF(e,t){let i=new ok(e.i,e.x,e.y),r=new ok(t.i,t.x,t.y),a=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function oN(e,t,i,r){let a=new ok(e,t,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function oU(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function ok(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var oV=class{static area(e){let t=e.length,i=0;for(let r=t-1,a=0;a<t;r=a++)i+=e[r].x*e[a].y-e[a].x*e[r].y;return .5*i}static isClockWise(e){return 0>oV.area(e)}static triangulateShape(e,t){let i=[],r=[],a=[];oj(e),oG(i,e);let o=e.length;t.forEach(oj);for(let e=0;e<t.length;e++)r.push(o),o+=t[e].length,oG(i,t[e]);let l=oM(i,r);for(let e=0;e<l.length;e+=3)a.push(l.slice(e,e+3));return a}};function oj(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function oG(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}var oH=class extends oS{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new oH(e.radius,e.detail)}},oW=class extends rQ{constructor(e=1,t=32,i=16,r=0,a=2*Math.PI,o=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:a,thetaStart:o,thetaLength:l},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let h=Math.min(o+l,Math.PI),c=0,d=[],p=new iD,f=new iD,m=[],g=[],v=[],y=[];for(let m=0;m<=i;m++){let x=[],b=m/i,w=0;0==m&&0==o?w=.5/t:m==i&&h==Math.PI&&(w=-.5/t);for(let i=0;i<=t;i++){let h=i/t;p.x=-e*Math.cos(r+h*a)*Math.sin(o+b*l),p.y=e*Math.cos(o+b*l),p.z=e*Math.sin(r+h*a)*Math.sin(o+b*l),g.push(p.x,p.y,p.z),f.copy(p).normalize(),v.push(f.x,f.y,f.z),y.push(h+w,1-b),x.push(c++)}d.push(x)}for(let e=0;e<i;e++)for(let r=0;r<t;r++){let t=d[e][r+1],a=d[e][r],l=d[e+1][r],c=d[e+1][r+1];(0!==e||o>0)&&m.push(t,a,c),(e!==i-1||h<Math.PI)&&m.push(a,l,c)}this.setIndex(m),this.setAttribute("position",new rV(g,3)),this.setAttribute("normal",new rV(v,3)),this.setAttribute("uv",new rV(y,2))}
3139static fromJSON(e){return new oW(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},oq=class extends rQ{constructor(e=1,t=.4,i=12,r=48,a=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:a},i=Math.floor(i),r=Math.floor(r);let o=[],l=[],h=[],c=[],d=new iD,p=new iD,f=new iD;for(let o=0;o<=i;o++)for(let m=0;m<=r;m++){let g=m/r*a,v=o/i*Math.PI*2;p.x=(e+t*Math.cos(v))*Math.cos(g),p.y=(e+t*Math.cos(v))*Math.sin(g),p.z=t*Math.sin(v),l.push(p.x,p.y,p.z),d.x=e*Math.cos(g),d.y=e*Math.sin(g),f.subVectors(p,d).normalize(),h.push(f.x,f.y,f.z),c.push(m/r),c.push(o/i)}for(let e=1;e<=i;e++)for(let t=1;t<=r;t++){let i=(r+1)*e+t-1,a=(r+1)*(e-1)+t-1,l=(r+1)*(e-1)+t,h=(r+1)*e+t;o.push(i,a,h),o.push(a,l,h)}this.setIndex(o),this.setAttribute("position",new rV(l,3)),this.setAttribute("normal",new rV(h,3)),this.setAttribute("uv",new rV(c,2))}static fromJSON(e){return new oq(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},oX=class extends rQ{constructor(e=1,t=.4,i=64,r=8,a=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:a,q:o},i=Math.floor(i),r=Math.floor(r);let l=[],h=[],c=[],d=[],p=new iD,f=new iD,m=new iD,g=new iD,v=new iD,y=new iD,x=new iD;for(let l=0;l<=i;++l){let w=l/i*a*Math.PI*2;b(w,a,o,e,m),b(w+.01,a,o,e,g),y.subVectors(g,m),x.addVectors(g,m),v.crossVectors(y,x),x.crossVectors(v,y),v.normalize(),x.normalize();for(let e=0;e<=r;++e){let a=e/r*Math.PI*2,o=-t*Math.cos(a),g=t*Math.sin(a);p.x=m.x+(o*x.x+g*v.x),p.y=m.y+(o*x.y+g*v.y),p.z=m.z+(o*x.z+g*v.z),h.push(p.x,p.y,p.z),f.subVectors(p,m).normalize(),c.push(f.x,f.y,f.z),d.push(l/i),d.push(e/r)}}for(let e=1;e<=i;e++)for(let t=1;t<=r;t++){let i=(r+1)*(e-1)+(t-1),a=(r+1)*e+(t-1),o=(r+1)*e+t,h=(r+1)*(e-1)+t;l.push(i,a,h),l.push(a,o,h)}function b(e,t,i,r,a){let o=Math.cos(e),l=Math.sin(e),h=i/t*e,c=Math.cos(h);a.x=r*(2+c)*.5*o,a.y=r*(2+c)*l*.5,a.z=r*Math.sin(h)*.5}this.setIndex(l),this.setAttribute("position",new rV(h,3)),this.setAttribute("normal",new rV(c,3)),this.setAttribute("uv",new rV(d,2))}static fromJSON(e){return new oX(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},oY=class extends sl{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};function oQ(e,t,i){return oK(e)?new e.constructor(e.subarray(t,void 0!==i?i:e.length)):e.slice(t,i)}function oZ(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function oK(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function oJ(e,t,i){let r=e.length,a=new e.constructor(r);for(let o=0,l=0;l!==r;++o){let r=i[o]*t;for(let i=0;i!==t;++i)a[l++]=e[r+i]}return a}function o$(e,t,i,r){let a=1,o=e[0];for(;void 0!==o&&void 0===o[r];)o=e[a++];if(void 0===o)return;let l=o[r];if(void 0!==l){if(Array.isArray(l))do void 0!==(l=o[r])&&(t.push(o.time),i.push.apply(i,l)),o=e[a++];while(void 0!==o);else if(void 0!==l.toArray)do void 0!==(l=o[r])&&(t.push(o.time),l.toArray(i,i.length)),o=e[a++];while(void 0!==o);else do void 0!==(l=o[r])&&(t.push(o.time),i.push(l)),o=e[a++];while(void 0!==o)}}var o0=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],a=t[i-1];e:{t:{let o;i:{r:if(!(e<r)){for(let o=i+2;;){if(void 0===r){if(e<a)break r;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(a=r,e<(r=t[++i]))break t}o=t.length;break i}if(!(e>=a)){let l=t[1];e<l&&(i=2,a=l);for(let o=i-2;;){if(void 0===a)return this._cachedIndex=0,this.copySampleValue_(0);if(i===o)break;if(r=a,e>=(a=t[--i-1]))break t}o=i,i=0;break i}break e}for(;i<o;){let r=i+o>>>1;e<t[r]?o=r:i=r+1}if(r=t[i],void 0===(a=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,a,r)}return this.interpolate_(i,a,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,a=e*r;for(let e=0;e!==r;++e)t[e]=i[a+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}},o1=class extends o0{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let r=this.parameterPositions,a=e-2,o=e+1,l=r[a],h=r[o];if(void 0===l)switch(this.getSettings_().endingStart){case 2401:a=e,l=2*t-i;break;case 2402:a=r.length-2,l=t+r[a]-r[a+1];break;default:a=e,l=i}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:o=e,h=2*i-t;break;case 2402:o=1,h=i+r[1]-r[0];break;default:o=e-1,h=t}let c=(i-t)*.5,d=this.valueSize;this._weightPrev=c/(t-l),this._weightNext=c/(h-i),this._offsetPrev=a*d,this._offsetNext=o*d}interpolate_(e,t,i,r){let a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,h=e*l,c=h-l,d=this._offsetPrev,p=this._offsetNext,f=this._weightPrev,m=this._weightNext,g=(i-t)/(r-t),v=g*g,y=v*g,x=-f*y+2*f*v-f*g,b=(1+f)*y+(-1.5-2*f)*v+(-.5+f)*g+1,w=(-1-m)*y+(1.5+m)*v+.5*g,S=m*y-m*v;for(let e=0;e!==l;++e)a[e]=x*o[d+e]+b*o[c+e]+w*o[h+e]+S*o[p+e];return a}},o2=class extends o0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,h=e*l,c=h-l,d=(i-t)/(r-t),p=1-d;for(let e=0;e!==l;++e)a[e]=o[c+e]*p+o[h+e]*d;return a}},o3=class extends o0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},o4=class{constructor(e,t,i,r){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oZ(t,this.TimeBufferType),this.values=oZ(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:oZ(e.times,Array),values:oZ(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(i.interpolation=t)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new o3(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new o2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new o1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,a=0,o=r-1;for(;a!==r&&i[a]<e;)++a;for(;-1!==o&&i[o]>t;)--o;if(++o,0!==a||o!==r){a>=o&&(a=(o=Math.max(o,1))-1);let e=this.getValueSize();this.times=oQ(i,a,o),this.values=oQ(this.values,a*e,o*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,a=i.length;0===a&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let t=0;t!==a;t++){let r=i[t];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,r),e=!1;break}if(null!==o&&o>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,r,o),e=!1;break}o=r}if(void 0!==r&&oK(r))for(let t=0,i=r.length;t!==i;++t){let i=r[t];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,i),e=!1;break}}return e}optimize(){let e=oQ(this.times),t=oQ(this.values),i=this.getValueSize(),r=2302===this.getInterpolation(),a=e.length-1,o=1;for(let l=1;l<a;++l){let a=!1,h=e[l];
3139if(h!==e[l+1]&&(1!==l||h!==e[0])){if(r)a=!0;else{let e=l*i,r=e-i,o=e+i;for(let l=0;l!==i;++l){let i=t[e+l];if(i!==t[r+l]||i!==t[o+l]){a=!0;break}}}}if(a){if(l!==o){e[o]=e[l];let r=l*i,a=o*i;for(let e=0;e!==i;++e)t[a+e]=t[r+e]}++o}}if(a>0){e[o]=e[a];for(let e=a*i,r=o*i,l=0;l!==i;++l)t[r+l]=t[e+l];++o}return o!==e.length?(this.times=oQ(e,0,o),this.values=oQ(t,0,o*i)):(this.times=e,this.values=t),this}clone(){let e=oQ(this.times,0),t=oQ(this.values,0),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};o4.prototype.TimeBufferType=Float32Array,o4.prototype.ValueBufferType=Float32Array,o4.prototype.DefaultInterpolation=2301;var o5=class extends o4{};o5.prototype.ValueTypeName="bool",o5.prototype.ValueBufferType=Array,o5.prototype.DefaultInterpolation=2300,o5.prototype.InterpolantFactoryMethodLinear=void 0,o5.prototype.InterpolantFactoryMethodSmooth=void 0;var o6=class extends o4{};o6.prototype.ValueTypeName="color";var o8=class extends o4{};o8.prototype.ValueTypeName="number";var o9=class extends o0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let a=this.resultBuffer,o=this.sampleValues,l=this.valueSize,h=(i-t)/(r-t),c=e*l;for(let e=c+l;c!==e;c+=4)iP.slerpFlat(a,0,o,c-l,o,c,h);return a}},o7=class extends o4{InterpolantFactoryMethodLinear(e){return new o9(this.times,this.values,this.getValueSize(),e)}};o7.prototype.ValueTypeName="quaternion",o7.prototype.DefaultInterpolation=2301,o7.prototype.InterpolantFactoryMethodSmooth=void 0;var le=class extends o4{};le.prototype.ValueTypeName="string",le.prototype.ValueBufferType=Array,le.prototype.DefaultInterpolation=2300,le.prototype.InterpolantFactoryMethodLinear=void 0,le.prototype.InterpolantFactoryMethodSmooth=void 0;var lt=class extends o4{};lt.prototype.ValueTypeName="vector";var li=class{constructor(e,t=-1,i,r=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=tJ(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let e=0,a=i.length;e!==a;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return o8;case"vector":case"vector2":case"vector3":case"vector4":return lt;case"color":return o6;case"quaternion":return o7;case"bool":case"boolean":return o5;case"string":return le}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];o$(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).scale(r));let a=new this(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a}static toJSON(e){let t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=i.length;e!==r;++e)t.push(o4.toJSON(i[e]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let a=t.length,o=[];for(let e=0;e<a;e++){let l=[],h=[];l.push((e+a-1)%a,e,(e+1)%a),h.push(0,1,0);let c=function(e){let t=e.length,i=Array(t);for(let e=0;e!==t;++e)i[e]=e;return i.sort(function(t,i){return e[t]-e[i]}),i}(l);l=oJ(l,1,c),h=oJ(h,1,c),r||0!==l[0]||(l.push(a),h.push(h[0])),o.push(new o8(".morphTargetInfluences["+t[e].name+"]",l,h).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<i.length;e++)if(i[e].name===t)return i[e];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let r={},a=/^([\w-]*?)([\d]+)$/;for(let t=0,i=e.length;t<i;t++){let i=e[t],o=i.name.match(a);if(o&&o.length>1){let e=o[1],t=r[e];t||(r[e]=t=[]),t.push(i)}}let o=[];for(let e in r)o.push(this.CreateFromMorphTargetSequence(e,r[e],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,r,a){if(0!==i.length){let o=[],l=[];o$(i,o,l,r),0!==o.length&&a.push(new e(t,o,l))}},r=[],a=e.name||"default",o=e.fps||30,l=e.blendMode,h=e.length||-1,c=e.hierarchy||[];for(let e=0;e<c.length;e++){let a=c[e].keys;if(!(!a||0===a.length)){if(a[0].morphTargets){let e={},t;for(t=0;t<a.length;t++)if(a[t].morphTargets)for(let i=0;i<a[t].morphTargets.length;i++)e[a[t].morphTargets[i]]=-1;for(let i in e){let e=[],o=[];for(let r=0;r!==a[t].morphTargets.length;++r){let r=a[t];e.push(r.time),o.push(r.morphTarget===i?1:0)}r.push(new o8(".morphTargetInfluence["+i+"]",e,o))}h=e.length*o}else{let o=".bones["+t[e].name+"]";i(lt,o+".position",a,"pos",r),i(o7,o+".quaternion",a,"rot",r),i(lt,o+".scale",a,"scl",r)}}}return 0===r.length?null:new this(a,h,r,l)}resetDuration(){let e=this.tracks,t=0;for(let i=0,r=e.length;i!==r;++i){let e=this.tracks[i];t=Math.max(t,e.times[e.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(){let 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)}},lr={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]}},ls=class{constructor(e,t,i){let r=this,a=!1,o=0,l=0,h,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){l++,!1===a&&void 0!==r.onStart&&r.onStart(e,o,l),a=!0},this.itemEnd=function(e){o++,void 0!==r.onProgress&&r.onProgress(e,o,l),o===l&&(a=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return h?h(e):e},this.setURLModifier=function(e){return h=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return -1!==t&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=c.length;t<i;t+=2){let i=c[t],r=c[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}},la=new ls,ln=class{constructor(e){this.manager=void 0!==e?e:la,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;
3139return new Promise(function(r,a){i.load(e,r,t,a)})}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}},lo={},ll=class extends Error{constructor(e,t){super(e),this.response=t}},lh=class extends ln{constructor(e){super(e)}load(e,t,i,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let a=lr.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(void 0!==lo[e]){lo[e].push({onLoad:t,onProgress:i,onError:r});return}lo[e]=[],lo[e].push({onLoad:t,onProgress:i,onError:r});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,h=this.responseType;fetch(o).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||void 0===t.body||void 0===t.body.getReader)return t;let i=lo[e],r=t.body.getReader(),a=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),o=a?parseInt(a):0,l=0!==o,h=0;return new Response(new ReadableStream({start(e){(function t(){r.read().then(({done:r,value:a})=>{if(r)e.close();else{let r=new ProgressEvent("progress",{lengthComputable:l,loaded:h+=a.byteLength,total:o});for(let e=0,t=i.length;e<t;e++){let t=i[e];t.onProgress&&t.onProgress(r)}e.enqueue(a),t()}})})()}}))}throw new ll(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(h){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,l));case"json":return e.json();default:if(void 0===l)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(l),i=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{lr.add(e,t);let i=lo[e];delete lo[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let i=lo[e];if(void 0===i)throw this.manager.itemError(e),t;delete lo[e];for(let e=0,r=i.length;e<r;e++){let r=i[e];r.onError&&r.onError(t)}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}},lc=class extends ln{constructor(e){super(e)}load(e,t,i,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let a=this,o=lr.get(e);if(void 0!==o)return a.manager.itemStart(e),setTimeout(function(){t&&t(o),a.manager.itemEnd(e)},0),o;let l=is("img");function h(){d(),lr.add(e,this),t&&t(this),a.manager.itemEnd(e)}function c(t){d(),r&&r(t),a.manager.itemError(e),a.manager.itemEnd(e)}function d(){l.removeEventListener("load",h,!1),l.removeEventListener("error",c,!1)}return l.addEventListener("load",h,!1),l.addEventListener("error",c,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(l.crossOrigin=this.crossOrigin),a.manager.itemStart(e),l.src=e,l}},ld=class extends ln{constructor(e){super(e)}load(e,t,i,r){let a=new i_,o=new lc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(e){a.image=e,a.needsUpdate=!0,void 0!==t&&t(a)},i,r),a}},lu=class extends rw{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new iv(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}},lp=class extends lu{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(rw.DEFAULT_UP),this.updateMatrix(),this.groundColor=new iv(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},lf=new i6,lm=new iD,lg=new iD,lv=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new t9(512,512),this.map=null,this.mapPass=null,this.matrix=new i6,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new sb,this._frameExtents=new t9(1,1),this._viewportCount=1,this._viewports=[new iA(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;lm.setFromMatrixPosition(e.matrixWorld),t.position.copy(lm),lg.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(lg),t.updateMatrixWorld(),lf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(lf),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(lf)}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(){let e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radiu
3139s=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},ly=class extends lv{constructor(){super(new sc(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=2*tK*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;(i!==t.fov||r!==t.aspect||a!==t.far)&&(t.fov=i,t.aspect=r,t.far=a,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},lx=class extends lu{constructor(e,t,i=0,r=Math.PI/3,a=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(rw.DEFAULT_UP),this.updateMatrix(),this.target=new rw,this.distance=i,this.angle=r,this.penumbra=a,this.decay=o,this.map=null,this.shadow=new ly}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},lb=new i6,lw=new iD,lS=new iD,l_=class extends lv{constructor(){super(new sc(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new t9(4,2),this._viewportCount=6,this._viewports=[new iA(2,1,1,1),new iA(0,1,1,1),new iA(3,1,1,1),new iA(1,1,1,1),new iA(3,0,1,1),new iA(1,0,1,1)],this._cubeDirections=[new iD(1,0,0),new iD(-1,0,0),new iD(0,0,1),new iD(0,0,-1),new iD(0,1,0),new iD(0,-1,0)],this._cubeUps=[new iD(0,1,0),new iD(0,1,0),new iD(0,1,0),new iD(0,1,0),new iD(0,0,1),new iD(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,r=this.matrix,a=e.distance||i.far;a!==i.far&&(i.far=a,i.updateProjectionMatrix()),lw.setFromMatrixPosition(e.matrixWorld),i.position.copy(lw),lS.copy(i.position),lS.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(lS),i.updateMatrixWorld(),r.makeTranslation(-lw.x,-lw.y,-lw.z),lb.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(lb)}},lA=class extends lu{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new l_}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},lM=class extends lv{constructor(){super(new sL(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},lE=class extends lu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rw.DEFAULT_UP),this.updateMatrix(),this.target=new rw,this.shadow=new lM}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},lC=class extends rQ{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},lT=class extends ln{constructor(e){super(e)}load(e,t,i,r){let a=this,o=new lh(a.manager);o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,function(i){try{t(a.parse(JSON.parse(i)))}catch(t){r?r(t):console.error(t),a.manager.itemError(e)}},i,r)}parse(e){let t={},i={};function r(e,r){if(void 0!==t[r])return t[r];let a=e.interleavedBuffers[r],o=function(e,t){if(void 0!==i[t])return i[t];let r=new Uint32Array(e.arrayBuffers[t]).buffer;return i[t]=r,r}(e,a.buffer),l=new nL(ir(a.type,o),a.stride);return l.uuid=a.uuid,t[r]=l,l}let a=e.isInstancedBufferGeometry?new lC:new rQ,o=e.data.index;if(void 0!==o){let e=ir(o.type,o.array);a.setIndex(new rN(e,1))}let l=e.data.attributes;for(let t in l){let i=l[t],o;if(i.isInterleavedBufferAttribute)o=new nz(r(e.data,i.data),i.itemSize,i.offset,i.normalized);else{let e=ir(i.type,i.array);o=new(i.isInstancedBufferAttribute?nj:rN)(e,i.itemSize,i.normalized)}void 0!==i.name&&(o.name=i.name),void 0!==i.usage&&o.setUsage(i.usage),void 0!==i.updateRange&&(o.updateRange.offset=i.updateRange.offset,o.updateRange.count=i.updateRange.count),a.setAttribute(t,o)}let h=e.data.morphAttributes;if(h)for(let t in h){let i=h[t],o=[];for(let t=0,a=i.length;t<a;t++){let a=i[t],l;l=a.isInterleavedBufferAttribute?new nz(r(e.data,a.data),a.itemSize,a.offset,a.normalized):new rN(ir(a.type,a.array),a.itemSize,a.normalized),void 0!==a.name&&(l.name=a.name),o.push(l)}a.morphAttributes[t]=o}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);let c=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==c)for(let e=0,t=c.length;e!==t;++e){let t=c[e];a.addGroup(t.start,t.count,t.materialIndex)}let d=e.data.boundingSphere;if(void 0!==d){let e=new iD;void 0!==d.center&&e.fromArray(d.center),a.boundingSphere=new iK(e,d.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}},lP=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=lD(),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){let t=lD();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function lD(){return(typeof performance>"u"?Date:performance).now()}var lO=class{constructor(e,t,i){let r,a,o;switch(this.binding=e,this.valueSize=i,t){case"quaternion":r=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:r=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let i=this.buffer,r=this.valueSize,a=e*r+r,o=this.cumulativeWeight;if(0===o){for(let e=0;e!==r;++e)i[a+e]=i[e];o=t}else{o+=t;let e=t/o;this._mixBufferRegion(i,a,0,e,r)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,r=e*t+t,a=this.cumulativeWeight,o=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,a<1){let e=t*this._origIndex;this._mixBufferRegion(i,r,e,1-a,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let e=t,a=t+t;e!==a;++e)if(i[e]!==i[e+t]){l.setValue(i,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let e=i;e!==r;++e)t[e]=t[r+e%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;
vendor: 4,425 bytes, line 3139
3139for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,a){if(r>=.5)for(let r=0;r!==a;++r)e[t+r]=e[i+r]}_slerp(e,t,i,r){iP.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,a){let o=this._workIndex*a;iP.multiplyQuaternionsFlat(e,o,e,t,e,i),iP.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,a){let o=1-r;for(let l=0;l!==a;++l){let a=t+l;e[a]=e[a]*o+e[i+l]*r}}_lerpAdditive(e,t,i,r,a){for(let o=0;o!==a;++o){let a=t+o;e[a]=e[a]+e[i+o]*r}}},lI="\\[\\]\\.:\\/",lR=RegExp("["+lI+"]","g"),lL="[^"+lI+"]",lB="[^"+lI.replace("\\.","")+"]",lz=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",lL)+/(WCOD+)?/.source.replace("WCOD",lB)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lL)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lL)+"$"),lF=["material","materials","bones","map"],lN=class{constructor(e,t,i){let r=i||lU.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,a=i.length;r!==a;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},lU=class{constructor(e,t,i){this.path=t,this.parsedPath=i||lU.parseTrackName(t),this.node=lU.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new lU.Composite(e,t,i):new lU(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(lR,"")}static parseTrackName(e){let t=lz.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){let e=i.nodeName.substring(r+1);-1!==lF.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let r=0;r<e.length;r++){let a=e[r];if(a.name===t||a.uuid===t)return a;let o=i(a.children);if(o)return o}return null},r=i(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){let i=this.resolvedProperty;for(let r=0,a=i.length;r!==a;++r)e[t++]=i[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){let i=this.resolvedProperty;for(let r=0,a=i.length;r!==a;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,a=i.length;r!==a;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,a=i.length;r!==a;++r)i[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}
3139_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,t=this.parsedPath,i=t.objectName,r=t.propertyName,a=t.propertyIndex;if(e||(e=lU.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(i){let r=t.objectIndex;switch(i){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 t=0;t<e.length;t++)if(e[t].name===r){r=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(void 0===e[i]){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(void 0!==r){if(void 0===e[r]){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[r]}}let o=e[r];if(void 0===o){console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+r+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===r){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}void 0!==e.morphTargetDictionary[a]&&(a=e.morphTargetDictionary[a])}h=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else void 0!==o.fromArray&&void 0!==o.toArray?(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}};lU.Composite=lN,lU.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},lU.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},lU.prototype.GetterByBindingType=[lU.prototype._getValue_direct,lU.prototype._getValue_array,lU.prototype._getValue_arrayElement,lU.prototype._getValue_toArray],lU.prototype.SetterByBindingTypeAndVersioning=[[lU.prototype._setValue_direct,lU.prototype._setValue_direct_setNeedsUpdate,lU.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lU.prototype._setValue_array,lU.prototype._setValue_array_setNeedsUpdate,lU.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lU.prototype._setValue_arrayElement,lU.prototype._setValue_arrayElement_setNeedsUpdate,lU.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lU.prototype._setValue_fromArray,lU.prototype._setValue_fromArray_setNeedsUpdate,lU.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var lk=class{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;let a=t.tracks,o=a.length,l=Array(o),h={endingStart:2400,endingEnd:2400};for(let e=0;e!==o;++e){let t=a[e].createInterpolant(null);l[e]=t,t.settings=h}this._interpolantSettings=h,this._interpolants=l,this._propertyBindings=Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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&&0!==this.timeScale&&null===this._startTime&&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}
3139fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){let i=this._clip.duration,r=e._clip.duration;e.warp(1,r/i,t),this.warp(i/r,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return null!==e&&(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,i){let r=this._mixer,a=r.time,o=this.timeScale,l=this._timeScaleInterpolant;null===l&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);let h=l.parameterPositions,c=l.sampleValues;return h[0]=a,h[1]=a+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(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,i,r){if(!this.enabled){this._updateWeight(e);return}let a=this._startTime;if(null!==a){let r=(e-a)*i;r<0||0===i?t=0:(this._startTime=null,t=i*r)}t*=this._updateTimeScale(e);let o=this._updateTime(t),l=this._updateWeight(e);if(l>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(o),t[i].accumulateAdditive(l);else for(let i=0,a=e.length;i!==a;++i)e[i].evaluate(o),t[i].accumulate(r,l)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,r=this.time+e,a=this._loopCount,o=2202===i;if(0===e)return -1===a?r:o&&(1&a)==1?t-r:r;if(2200===i){-1===a&&(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(-1===a&&(e>=0?(a=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=t||r<0){let i=Math.floor(r/t);r-=t*i,a+=Math.abs(i);let l=this.repetitions-a;if(l<=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(1===l){let t=e<0;this._setEndings(t,!t,o)}else this._setEndings(!1,!1,o);this._loopCount=a,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=r;if(o&&(1&a)==1)return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(e?r.endingStart=this.zeroSlopeAtStart?2401:2400:r.endingStart=2402,t?r.endingEnd=this.zeroSlopeAtEnd?2401:2400:r.endingEnd=2402)}_scheduleFading(e,t,i){let r=this._mixer,a=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);let l=o.parameterPositions,h=o.sampleValues;return l[0]=a,h[0]=t,l[1]=a+e,h[1]=i,this}},lV=new Float32Array(1),lj=class extends tX{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let i=e._localRoot||this._root,r=e._clip.tracks,a=r.length,o=e._propertyBindings,l=e._interpolants,h=i.uuid,c=this._bindingsByRootAndName,d=c[h];void 0===d&&(d={},c[h]=d);for(let e=0;e!==a;++e){let a=r[e],c=a.name,p=d[c];if(void 0!==p)++p.referenceCount,o[e]=p;
vendor: 6,265 bytes, line 3139
3139else{if(void 0!==(p=o[e])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,h,c));continue}let r=t&&t._propertyBindings[e].binding.parsedPath;p=new lO(lU.create(i,c,r),a.ValueTypeName,a.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,h,c),o[e]=p}l[e].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let 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){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,i){let r=this._actions,a=this._actionsByClip,o=a[t];if(void 0===o)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,a[t]=o;else{let t=o.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;let a=e._clip.uuid,o=this._actionsByClip,l=o[a],h=l.knownActions,c=h[h.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,h[d]=c,h.pop(),e._byClipCacheIndex=null;let p=l.actionByRoot,f=(e._localRoot||this._root).uuid;delete p[f],0===h.length&&delete o[a],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,a=t[r];e._cacheIndex=r,t[r]=e,a._cacheIndex=i,t[i]=a}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,a=t[r];e._cacheIndex=r,t[r]=e,a._cacheIndex=i,t[i]=a}_addInactiveBinding(e,t,i){let r=this._bindingsByRootAndName,a=this._bindings,o=r[t];void 0===o&&(o={},r[t]=o),o[i]=e,e._cacheIndex=a.length,a.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,r=i.rootNode.uuid,a=i.path,o=this._bindingsByRootAndName,l=o[r],h=t[t.length-1],c=e._cacheIndex;h._cacheIndex=c,t[c]=h,t.pop(),delete l[a],0===Object.keys(l).length&&delete o[r]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,a=t[r];e._cacheIndex=r,t[r]=e,a._cacheIndex=i,t[i]=a}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,a=t[r];e._cacheIndex=r,t[r]=e,a._cacheIndex=i,t[i]=a}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&((i=new o2(new Float32Array(2),new Float32Array(2),1,lV)).__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,a=t[r];e.__cacheIndex=r,t[r]=e,a.__cacheIndex=i,t[i]=a}clipAction(e,t,i){let r=t||this._root,a=r.uuid,o="string"==typeof e?li.findByName(r,e):e,l=null!==o?o.uuid:e,h=this._actionsByClip[l],c=null;if(void 0===i&&(i=null!==o?o.blendMode:2500),void 0!==h){let e=h.actionByRoot[a];if(void 0!==e&&e.blendMode===i)return e;c=h.knownActions[0],null===o&&(o=c._clip)}if(null===o)return null;let d=new lk(this,o,t,i);return this._bindAction(d,c),this._addInactiveAction(d,l,a),d}existingAction(e,t){let i=t||this._root,r=i.uuid,a="string"==typeof e?li.findByName(i,e):e,o=a?a.uuid:e,l=this._actionsByClip[o];return void 0!==l&&l.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,r=this.time+=e,a=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==i;++l)t[l]._update(r,e,a,o);let l=this._bindings,h=this._nActiveBindings;for(let e=0;e!==h;++e)l[e].apply(o);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,r=this._actionsByClip,a=r[i];if(void 0!==a){let e=a.knownActions;for(let i=0,r=e.length;i!==r;++i){let r=e[i];this._deactivateAction(r);let a=r._cacheIndex,o=t[t.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,o._cacheIndex=a,t[a]=o,t.pop(),this._removeInactiveBindingsForAction(r)}delete r[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let e in i){let r=i[e].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}let r=this._bindingsByRootAndName[t];if(void 0!==r)for(let e in r){let t=r[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}},lG=class{constructor(e){this.value=e}clone(){return new lG(void 0===this.value.clone?this.value:this.value.clone())}},lH=class{constructor(e,t,i=0,r=1/0){this.ray=new i5(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new ro,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:
3139Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return lq(e,this,i,t),i.sort(lW),i}intersectObjects(e,t=!0,i=[]){for(let r=0,a=e.length;r<a;r++)lq(e[r],this,i,t);return i.sort(lW),i}};function lW(e,t){return e.distance-t.distance}function lq(e,t,i,r){if(e.layers.test(t.layers)&&e.raycast(t,i),!0===r){let r=e.children;for(let e=0,a=r.length;e<a;e++)lq(r[e],t,i,!0)}}var lX=class{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,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,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(t$(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},lY=new t9,lQ=class{constructor(e=new t9(1/0,1/0),t=new t9(-1/0,-1/0)){this.isBox2=!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,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=lY.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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 lY.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)}},lZ=new iD,lK=new iD,lJ=class{constructor(e=new iD,t=new iD){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){lZ.subVectors(e,this.start),lK.subVectors(this.end,this.start);let i=lK.dot(lK),r=lK.dot(lZ)/i;return t&&(r=t$(r,0,1)),r}closestPointToPoint(e,t,i){let r=this.closestPointToPointParameter(e,t);return this.delta(i).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)}},l$=new iD,l0=class extends rw{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let i=new rQ,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 e=0,t=1;e<32;e++,t++){let i=e/32*Math.PI*2,a=t/32*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(a),Math.sin(a),1)}i.setAttribute("position",new rV(r,3));let a=new nQ({fog:!1,toneMapped:!1});this.cone=new n4(i,a),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),l$.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(l$),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},l1=class extends r7{constructor(e,t,i){super(new oW(t,4,2),new rB({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},l2=new iD,l3=new iD,l4=new iD,l5=class extends rw{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===t&&(t=1);let r=new rQ;r.setAttribute("position",new rV([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let a=new nQ({fog:!1,toneMapped:!1});this.lightPlane=new n1(r,a),this.add(this.lightPlane),(r=new rQ).setAttribute("position",new rV([0,0,0,0,0,1],3)),this.targetLine=new n1(r,a),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),l2.setFromMatrixPosition(this.light.matrixWorld),l3.setFromMatrixPosition(this.light.target.matrixWorld),l4.subVectors(l3,l2),this.lightPlane.lookAt(l3),void 0!==this.color?(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(l3),this.targetLine.scale.z
3139=l4.length()}},l6=new iD,l8=new sh,l9=class extends n4{constructor(e){let t=new rQ,i=new nQ({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],a=[],o={};function l(e,t){h(e),h(t)}function h(e){r.push(0,0,0),a.push(0,0,0),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}l("n1","n2"),l("n2","n4"),l("n4","n3"),l("n3","n1"),l("f1","f2"),l("f2","f4"),l("f4","f3"),l("f3","f1"),l("n1","f1"),l("n2","f2"),l("n3","f3"),l("n4","f4"),l("p","n1"),l("p","n2"),l("p","n3"),l("p","n4"),l("u1","u2"),l("u2","u3"),l("u3","u1"),l("c","t"),l("p","c"),l("cn1","cn2"),l("cn3","cn4"),l("cf1","cf2"),l("cf3","cf4"),t.setAttribute("position",new rV(r,3)),t.setAttribute("color",new rV(a,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();let c=new iv(16755200),d=new iv(16711680),p=new iv(43775),f=new iv(16777215),m=new iv(3355443);this.setColors(c,d,p,f,m)}setColors(e,t,i,r,a){let o=this.geometry.getAttribute("color");o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,i.r,i.g,i.b),o.setXYZ(33,i.r,i.g,i.b),o.setXYZ(34,i.r,i.g,i.b),o.setXYZ(35,i.r,i.g,i.b),o.setXYZ(36,i.r,i.g,i.b),o.setXYZ(37,i.r,i.g,i.b),o.setXYZ(38,r.r,r.g,r.b),o.setXYZ(39,r.r,r.g,r.b),o.setXYZ(40,a.r,a.g,a.b),o.setXYZ(41,a.r,a.g,a.b),o.setXYZ(42,a.r,a.g,a.b),o.setXYZ(43,a.r,a.g,a.b),o.setXYZ(44,a.r,a.g,a.b),o.setXYZ(45,a.r,a.g,a.b),o.setXYZ(46,a.r,a.g,a.b),o.setXYZ(47,a.r,a.g,a.b),o.setXYZ(48,a.r,a.g,a.b),o.setXYZ(49,a.r,a.g,a.b),o.needsUpdate=!0}update(){let e=this.geometry,t=this.pointMap;l8.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),l7("c",t,e,l8,0,0,-1),l7("t",t,e,l8,0,0,1),l7("n1",t,e,l8,-1,-1,-1),l7("n2",t,e,l8,1,-1,-1),l7("n3",t,e,l8,-1,1,-1),l7("n4",t,e,l8,1,1,-1),l7("f1",t,e,l8,-1,-1,1),l7("f2",t,e,l8,1,-1,1),l7("f3",t,e,l8,-1,1,1),l7("f4",t,e,l8,1,1,1),l7("u1",t,e,l8,.7,1.1,-1),l7("u2",t,e,l8,-.7,1.1,-1),l7("u3",t,e,l8,0,2,-1),l7("cf1",t,e,l8,-1,0,1),l7("cf2",t,e,l8,1,0,1),l7("cf3",t,e,l8,0,-1,1),l7("cf4",t,e,l8,0,1,1),l7("cn1",t,e,l8,-1,0,-1),l7("cn2",t,e,l8,1,0,-1),l7("cn3",t,e,l8,0,-1,-1),l7("cn4",t,e,l8,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function l7(e,t,i,r,a,o,l){l6.set(a,o,l).unproject(r);let h=t[e];if(void 0!==h){let e=i.getAttribute("position");for(let t=0,i=h.length;t<i;t++)e.setXYZ(h[t],l6.x,l6.y,l6.z)}}var he=class extends n4{constructor(e,t=16776960){let i=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 rQ;r.setIndex(new rN(i,1)),r.setAttribute("position",new rV([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(r,new nQ({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}},ht=class extends n4{constructor(e=1){let t=new rQ;t.setAttribute("position",new rV([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new rV([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new nQ({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,i){let r=new iv,a=this.geometry.attributes.color.array;return r.set(e),r.toArray(a,0),r.toArray(a,3),r.set(t),r.toArray(a,6),r.toArray(a,9),r.set(i),r.toArray(a,12),r.toArray(a,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},hi=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),a=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[256|e]=32768,a[e]=24,a[256|e]=24):t<-14?(r[e]=1024>>-t-14,r[256|e]=1024>>-t-14|32768,a[e]=-t-1,a[256|e]=-t-1):t<=15?(r[e]=t+15<<10,r[256|e]=t+15<<10|32768,a[e]=13,a[256|e]=13):t<128?(r[e]=31744,r[256|e]=64512,a[e]=24,a[256|e]=24):(r[e]=31744,r[256|e]=64512,a[e]=13,a[256|e]=13)}let o=new Uint32Array(2048),l=new Uint32Array(64),h=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;(8388608&t)==0;)t<<=1,i-=8388608;t&=-8388609,i+=947912704,o[e]=t|i}for(let e=1024;e<2048;++e)o[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)l[e]=e<<23;l[31]=1199570944,l[32]=2147483648;for(let e=33;e<63;++e)l[e]=2147483648+(e-32<<23);l[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(h[e]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:a,mantissaTable:o,exponentTable:l,offsetTable:h}}(),hr=Object.freeze({__proto__:null,fromHalfFloat:function(e){let t=e>>10;return hi.uint32View[0]=hi.mantissaTable[hi.offsetTable[t]+(1023&e)]+hi.exponentTable[t],hi.floatView[0]},toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=t$(e,-65504,65504),hi.floatView[0]=e;let t=hi.uint32View[0],i=t>>23&511;return hi.baseTable[i]+((8388607&t)>>hi.shiftTable[i])}});"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"149"}})),"u">typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="
3139149");var hs=Symbol("target"),ha=Symbol("unsubscribe");function hn(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var ho=Array.isArray;function hl(e){return"symbol"==typeof e}var hh={after:(e,t)=>ho(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>ho(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+="."),hl(t)?e+t.toString():e+t):e,initial:e=>{if(ho(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(".");return -1===t?"":e.slice(0,t)},last:e=>{if(ho(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(".");return -1===t?e:e.slice(t+1)},walk:(e,t)=>{if(ho(e))for(let i of e)t(i);else if(""!==e){let i=0,r=e.indexOf(".");if(-1===r)t(e);else for(;i<e.length;)-1===r&&(r=e.length),t(e.slice(i,r)),i=r+1,r=e.indexOf(".",i)}},get(e,t){return this.walk(t,t=>{e&&(e=e[t])}),e}};function hc(e,t,i){return e.isUnsubscribed||t.ignoreSymbols&&hl(i)||t.ignoreUnderscores&&"_"===i.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(i)}var hd=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let i=this._getProperties(e),r=i[t];return void 0===r&&(r=Reflect.getOwnPropertyDescriptor(e,t),i[t]=r),r}getProxy(e,t,i,r){if(this.isUnsubscribed)return e;let a=e[r],o=a||e;this._pathCache.set(o,t);let l=this._proxyCache.get(o);return void 0===l&&(l=void 0===a?new Proxy(e,i):e,this._proxyCache.set(o,l)),l}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,hh.get(t,this.getPath(e)))}defineProperty(e,t,i){return!!Reflect.defineProperty(e,t,i)&&(this.isUnsubscribed||(this._getProperties(e)[t]=i),!0)}setProperty(e,t,i,r,a){if(!this._equals(a,i)||!(t in e)){let a=this._getOwnPropertyDescriptor(e,t);return void 0!==a&&"set"in a?Reflect.set(e,t,i,r):Reflect.set(e,t,i)}return!0}deleteProperty(e,t,i){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let r=this._getDescriptorCache().get(e);r&&(delete r[t],this._pathCache.delete(i))}return!0}return!1}isSameDescriptor(e,t,i){let r=this._getOwnPropertyDescriptor(t,i);return void 0!==e&&void 0!==r&&Object.is(e.value,r.value)&&(e.writable||!1)===(r.writable||!1)&&(e.enumerable||!1)===(r.enumerable||!1)&&(e.configurable||!1)===(r.configurable||!1)&&e.get===r.get&&e.set===r.set}isGetInvariant(e,t){let i=this._getOwnPropertyDescriptor(e,t);return void 0!==i&&!0!==i.configurable&&!0!==i.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function hu(e){return"[object Object]"===toString.call(e)}function hp(){return!0}function hf(e,t){return e.length!==t.length||e.some((e,i)=>t[i]!==e)}var hm=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),hg=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),hv={push:hp,pop:hp,shift:hp,unshift:hp,copyWithin:hf,reverse:hf,sort:hf,splice:hf,flat:hf,fill:hf},hy=new Set([...hm,...hg,...Object.keys(hv)]);function hx(e,t){if(e.size!==t.size)return!0;for(let i of e)if(!t.has(i))return!0;return!1}var hb=["keys","values","entries"],hw=new Set(["has","toString"]),hS={add:hx,clear:hx,delete:hx,forEach:hx},h_=new Set([...hw,...Object.keys(hS),...hb]);function hA(e,t){let i;if(e.size!==t.size)return!0;for(let[r,a]of e)if((i=t.get(r))!==a||void 0===i&&!t.has(r))return!0;return!1}var hM=new Set([...hw,"get"]),hE={set:hA,clear:hA,delete:hA,forEach:hA},hC=new Set([...hM,...Object.keys(hE),...hb]),hT=class{constructor(e,t,i,r){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=r,this._changes=r?[]:null,this.clone=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return hm.has(e)}_shallowClone(e){let t=e;if(hu(e))t={...e};else if(ho(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(e=>this._shallowClone(e)));else if(e instanceof Map)for(let[i,r]of(t=new Map,e.entries()))t.set(i,this._shallowClone(r));return this._clonedCache.add(t),t}preferredThisArg(e,t,i,r){return e?(ho(r)?this._onIsChanged=hv[t]:r instanceof Set?this._onIsChanged=hS[t]:r instanceof Map&&(this._onIsChanged=hE[t]),r):i}update(e,t,i){let r=hh.after(e,this._path);if("length"!==t){let e=this.clone;hh.walk(r,t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])}),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:i}),e&&e[t]&&(e[t]=i)}this._isChanged=!0}undo(e){let t;for(let i=this._changes.length-1;-1!==i;i--)t=this._changes[i],hh.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},hP=class extends hT{static isHandledMethod(e){return hy.has(e)}},hD=class extends hT{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},hO=class extends hT{static isHandledMethod(e){return h_.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},hI=class extends hT{static isHandledMethod(e){return hC.has(e)}undo(e){for(let[t,i]of this.clone.entries())e.set(t,i);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},hR=class extends hT{constructor(e,t,i,r){super(void 0,t,i,r),this._arg1=i[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},hL=class extends hT{constructor(e,t,i,r){super(void 0,t,i,r),this._weakKey=i[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},hB=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return hu(e)||ho(e)||hn(e)}static isHandledMethod(e,t){return hu(e)?hT.isHandledMethod(t):ho(e)?hP.isHandledMethod(t):e instanceof Set?hO.isHandledMethod(t):e instanceof Map?hI.isH
3139andledMethod(t):hn(e)}get isCloning(){return this._stack.length>0}start(e,t,i){let r=hT;ho(e)?r=hP:e instanceof Date?r=hD:e instanceof Set?r=hO:e instanceof Map?r=hI:e instanceof WeakSet?r=hR:e instanceof WeakMap&&(r=hL),this._stack.push(new r(e,t,i,this._hasOnValidate))}update(e,t,i){this._stack[this._stack.length-1].update(e,t,i)}preferredThisArg(e,t,i){let{name:r}=e,a=hB.isHandledMethod(i,r);return this._stack[this._stack.length-1].preferredThisArg(a,r,t,i)}isChanged(e,t,i){return this._stack[this._stack.length-1].isChanged(e,t,i)}undo(e){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},hz={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},hF=(e,t,i={})=>{i={...hz,...i};let r=Symbol("ProxyTarget"),{equals:a,isShallow:o,ignoreDetached:l,details:h}=i,c=new hd(a),d="function"==typeof i.onValidate,p=new hB(d),f=(e,t,r,a,o)=>!d||p.isCloning||!0===i.onValidate(hh.concat(c.getPath(e),t),r,a,o),m=(t,r,a,o)=>{hc(c,i,r)||l&&c.isDetached(t,e)||g(c.getPath(t),r,a,o)},g=(e,i,r,a,o)=>{p.isCloning?p.update(e,i,a):t(hh.concat(e,i),r,a,o)},v=e=>e&&(e[r]||e),y=(t,a,h,d)=>("object"==typeof t?null===t:"function"!=typeof t)||t instanceof RegExp||"constructor"===h||o&&!hB.isHandledMethod(a,h)||hc(c,i,h)||c.isGetInvariant(a,h)||l&&c.isDetached(a,e)?t:(void 0===d&&(d=c.getPath(a)),c.getProxy(t,hh.concat(d,h),x,r)),x={get(e,t,i){if(hl(t)){if(t===r||t===hs)return e;if(t===ha&&!c.isUnsubscribed&&0===c.getPath(e).length)return c.unsubscribe(),e}return y(hn(e)?Reflect.get(e,t):Reflect.get(e,t,i),e,t)},set(e,t,i,o){i=v(i);let l=e[r]||e,h=l[t];if(a(h,i)&&t in e)return!0;let d=f(e,t,i,h);return d&&c.setProperty(l,t,i,o,h)?(m(e,t,e[t],h),!0):!d},defineProperty(e,t,i){if(!c.isSameDescriptor(i,e,t)){let r=e[t];f(e,t,i.value,r)&&c.defineProperty(e,t,i,r)&&m(e,t,i.value,r)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let i=Reflect.get(e,t),r=f(e,t,void 0,i);return r&&c.deleteProperty(e,t,i)?(m(e,t,void 0,i),!0):!r},apply(t,i,o){let l=i[r]||i;if(c.isUnsubscribed)return Reflect.apply(t,l,o);if((!1===h||!0!==h&&!h.includes(t.name))&&hB.isHandledType(l)){var d;let r=hh.initial(c.getPath(t)),h=hB.isHandledMethod(l,t.name);p.start(l,r,o);let m=Reflect.apply(t,p.preferredThisArg(t,i,l),h?o.map(e=>v(e)):o),b=p.isChanged(l,a),w=p.stop();if(hB.isHandledType(m)&&h&&(i instanceof Map&&"get"===t.name&&(r=hh.concat(r,o[0])),m=c.getProxy(m,r,x)),b){let i={name:t.name,args:o,result:m},a=p.isCloning?hh.initial(r):r,h=p.isCloning?hh.last(r):"";f(hh.get(e,a),h,l,w,i)?g(a,h,l,w,i):p.undo(l)}return(i instanceof Map||i instanceof Set)&&"object"==typeof(d=m)&&"function"==typeof d.next?function(e,t,i,r,a){let o=e.next;if("entries"===t.name)e.next=function(){let e=o.call(this);return!1===e.done&&(e.value[0]=a(e.value[0],t,e.value[0],r),e.value[1]=a(e.value[1],t,e.value[0],r)),e};else if("values"===t.name){let l=i[hs].keys();e.next=function(){let e=o.call(this);return!1===e.done&&(e.value=a(e.value,t,l.next().value,r)),e}}else e.next=function(){let e=o.call(this);return!1===e.done&&(e.value=a(e.value,t,e.value,r)),e};return e}(m,t,i,r,y):m}return Reflect.apply(t,i,o)}},b=c.getProxy(e,i.pathAsArray?[]:"",x);return t=t.bind(b),d&&(i.onValidate=i.onValidate.bind(b)),b};hF.target=e=>e&&e[hs]||e,hF.unsubscribe=e=>e[ha]||e;var hN="object"==typeof global&&global&&global.Object===Object&&global,hU="object"==typeof self&&self&&self.Object===Object&&self,hk=hN||hU||Function("return this")(),hV=hk.Symbol,hj=Object.prototype,hG=hj.hasOwnProperty,hH=hj.toString,hW=hV?hV.toStringTag:void 0,hq=function(e){var t=hG.call(e,hW),i=e[hW];try{e[hW]=void 0;var r=!0}catch{}var a=hH.call(e);return r&&(t?e[hW]=i:delete e[hW]),a},hX=Object.prototype.toString,hY=hV?hV.toStringTag:void 0,hQ=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":hY&&hY in Object(e)?hq(e):hX.call(e)},hZ=function(e){return null!=e&&"object"==typeof e},hK=function(e){return"symbol"==typeof e||hZ(e)&&"[object Symbol]"==hQ(e)},hJ=function(e,t){for(var i=-1,r=null==e?0:e.length,a=Array(r);++i<r;)a[i]=t(e[i],i,e);return a},h$=Array.isArray,h0=1/0,h1=hV?hV.prototype:void 0,h2=h1?h1.toString:void 0,h3=function e(t){if("string"==typeof t)return t;if(h$(t))return hJ(t,e)+"";if(hK(t))return h2?h2.call(t):"";var i=t+"";return"0"==i&&1/t==-h0?"-0":i},h4=/\s/,h5=function(e){for(var t=e.length;t--&&h4.test(e.charAt(t)););return t},h6=/^\s+/,h8=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},h9=0/0,h7=/^[-+]0x[0-9a-f]+$/i,ce=/^0b[01]+$/i,ct=/^0o[0-7]+$/i,ci=parseInt,cr=function(e){if("number"==typeof e)return e;if(hK(e))return h9;if(h8(e)){var t,i="function"==typeof e.valueOf?e.valueOf():e;e=h8(i)?i+"":i}if("string"!=typeof e)return 0===e?e:+e;e=(t=e)&&t.slice(0,h5(t)+1).replace(h6,"");var r=ce.test(e);return r||ct.test(e)?ci(e.slice(2),r?2:8):h7.test(e)?h9:+e}
3139,cs=function(e){return e},ca=function(e){if(!h8(e))return!1;var t=hQ(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},cn=hk["__core-js_shared__"],co=(pP=/[^.]+$/.exec(cn&&cn.keys&&cn.keys.IE_PROTO||""))?"Symbol(src)_1."+pP:"",cl=Function.prototype.toString,ch=function(e){if(null!=e){try{return cl.call(e)}catch{}try{return e+""}catch{}}return""},cc=/^\[object .+?Constructor\]$/,cd=Object.prototype,cu=Function.prototype.toString,cp=cd.hasOwnProperty,cf=RegExp("^"+cu.call(cp).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cm=function(e,t){var i,r=e?.[t];return h8(i=r)&&(!co||!(co in i))&&(ca(i)?cf:cc).test(ch(i))?r:void 0},cg=cm(hk,"WeakMap"),cv=Object.create,cy=function(){function e(){}return function(t){if(!h8(t))return{};if(cv)return cv(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}(),cx=function(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)},cb=function(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t},cw=Date.now,cS=function(){try{var e=cm(Object,"defineProperty");return e({},"",{}),e}catch{}}(),c_=(pD=cS?function(e,t){return cS(e,"toString",{configurable:!0,enumerable:!1,value:function(){return t},writable:!0})}:cs,pO=0,pI=0,function(){var e=cw(),t=16-(e-pI);if(pI=e,t>0){if(++pO>=800)return arguments[0]}else pO=0;return pD.apply(void 0,arguments)}),cA=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r&&!1!==t(e[i],i,e););return e},cM=function(e,t,i,r){for(var a=e.length,o=i+(r?1:-1);r?o--:++o<a;)if(t(e[o],o,e))return o;return -1},cE=function(e){return e!=e},cC=function(e,t,i){for(var r=i-1,a=e.length;++r<a;)if(e[r]===t)return r;return -1},cT=/^(?:0|[1-9]\d*)$/,cP=function(e,t){var i=typeof e;return!!(t=t??9007199254740991)&&("number"==i||"symbol"!=i&&cT.test(e))&&e>-1&&e%1==0&&e<t},cD=function(e,t,i){"__proto__"==t&&cS?cS(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i},cO=function(e,t){return e===t||e!=e&&t!=t},cI=Object.prototype.hasOwnProperty,cR=function(e,t,i){var r=e[t];cI.call(e,t)&&cO(r,i)&&(void 0!==i||t in e)||cD(e,t,i)},cL=function(e,t,i,r){var a=!i;i||(i={});for(var o=-1,l=t.length;++o<l;){var h=t[o],c=r?r(i[h],e[h],h,i,e):void 0;void 0===c&&(c=e[h]),a?cD(i,h,c):cR(i,h,c)}return i},cB=Math.max,cz=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},cF=function(e){return null!=e&&cz(e.length)&&!ca(e)},cN=Object.prototype,cU=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||cN)},ck=function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r},cV=function(e){return hZ(e)&&"[object Arguments]"==hQ(e)},cj=Object.prototype,cG=cj.hasOwnProperty,cH=cj.propertyIsEnumerable,cW=cV(function(){return arguments}())?cV:function(e){return hZ(e)&&cG.call(e,"callee")&&!cH.call(e,"callee")},cq="object"==typeof exports&&exports&&!exports.nodeType&&exports,cX=cq&&"object"==typeof module&&module&&!module.nodeType&&module,cY=cX&&cX.exports===cq?hk.Buffer:void 0,cQ=(cY?cY.isBuffer:void 0)||function(){return!1},cZ={};cZ["[object Float32Array]"]=cZ["[object Float64Array]"]=cZ["[object Int8Array]"]=cZ["[object Int16Array]"]=cZ["[object Int32Array]"]=cZ["[object Uint8Array]"]=cZ["[object Uint8ClampedArray]"]=cZ["[object Uint16Array]"]=cZ["[object Uint32Array]"]=!0,cZ["[object Arguments]"]=cZ["[object Array]"]=cZ["[object ArrayBuffer]"]=cZ["[object Boolean]"]=cZ["[object DataView]"]=cZ["[object Date]"]=cZ["[object Error]"]=cZ["[object Function]"]=cZ["[object Map]"]=cZ["[object Number]"]=cZ["[object Object]"]=cZ["[object RegExp]"]=cZ["[object Set]"]=cZ["[object String]"]=cZ["[object WeakMap]"]=!1;var cK=function(e){return function(t){return e(t)}},cJ="object"==typeof exports&&exports&&!exports.nodeType&&exports,c$=cJ&&"object"==typeof module&&module&&!module.nodeType&&module,c0=c$&&c$.exports===cJ&&hN.process,c1=function(){try{return c$&&c$.require&&c$.require("util").types||c0&&c0.binding&&c0.binding("util")}catch{}}(),c2=c1&&c1.isTypedArray,c3=c2?cK(c2):function(e){return hZ(e)&&cz(e.length)&&!!cZ[hQ(e)]},c4=Object.prototype.hasOwnProperty,c5=function(e,t){var i=h$(e),r=!i&&cW(e),a=!i&&!r&&cQ(e),o=!i&&!r&&!a&&c3(e),l=i||r||a||o,h=l?ck(e.length,String):[],c=h.length;for(var d in e)(t||c4.call(e,d))&&!(l&&("length"==d||a&&("offset"==d||"parent"==d)||o&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||cP(d,c)))&&h.push(d);return h},c6=function(e,t){return function(i){return e(t(i))}},c8=c6(Object.keys,Object),c9=Object.prototype.hasOwnProperty,c7=function(e){if(!cU(e))return c8(e);var t=[];for(var i in Object(e))c9.call(e,i)&&"constructor"!=i&&t.push(i);return t},de=function(e){return cF(e)?c5(e):c7(e)},dt=function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t},di=Object.prototype.hasOwnProperty,dr=function(e){if(!h8(e))return dt(e);var t=cU(e),i=[];for(var r in e)"constructor"==r&&(t||!di.call(e,r))||i.push(r);return i},ds=function(e){return cF(e)?c5(e,!0):dr(e)},da=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dn=/^\w*$/,dl=function(e,t){if(h$(e))return!1;var i=typeof e;return!!("number"==i||"symbol"==i||"boolean"==i||null==e||hK(e))||dn.test(e)||!
3139da.test(e)||null!=t&&e in Object(t)},dh=cm(Object,"create"),dc=Object.prototype.hasOwnProperty,dd=Object.prototype.hasOwnProperty;function du(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}du.prototype.clear=function(){this.__data__=dh?dh(null):{},this.size=0},du.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},du.prototype.get=function(e){var t=this.__data__;if(dh){var i=t[e];return"__lodash_hash_undefined__"===i?void 0:i}return dc.call(t,e)?t[e]:void 0},du.prototype.has=function(e){var t=this.__data__;return dh?void 0!==t[e]:dd.call(t,e)},du.prototype.set=function(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=dh&&void 0===t?"__lodash_hash_undefined__":t,this};var dp=function(e,t){for(var i=e.length;i--;)if(cO(e[i][0],t))return i;return -1},df=Array.prototype.splice;function dm(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}dm.prototype.clear=function(){this.__data__=[],this.size=0},dm.prototype.delete=function(e){var t=this.__data__,i=dp(t,e);return!(i<0)&&(i==t.length-1?t.pop():df.call(t,i,1),--this.size,!0)},dm.prototype.get=function(e){var t=this.__data__,i=dp(t,e);return i<0?void 0:t[i][1]},dm.prototype.has=function(e){return dp(this.__data__,e)>-1},dm.prototype.set=function(e,t){var i=this.__data__,r=dp(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this};var dg=cm(hk,"Map"),dv=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},dy=function(e,t){var i=e.__data__;return dv(t)?i["string"==typeof t?"string":"hash"]:i.map};function dx(e){var t=-1,i=null==e?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}function db(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw TypeError("Expected a function");var i=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=i.cache;if(o.has(a))return o.get(a);var l=e.apply(this,r);return i.cache=o.set(a,l)||o,l};return i.cache=new(db.Cache||dx),i}dx.prototype.clear=function(){this.size=0,this.__data__={hash:new du,map:new(dg||dm),string:new du}},dx.prototype.delete=function(e){var t=dy(this,e).delete(e);return this.size-=t?1:0,t},dx.prototype.get=function(e){return dy(this,e).get(e)},dx.prototype.has=function(e){return dy(this,e).has(e)},dx.prototype.set=function(e,t){var i=dy(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this},db.Cache=dx;var dw=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,dS=/\\(\\)?/g,d_=(pL=(pR=db(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(dw,function(e,i,r,a){t.push(r?a.replace(dS,"$1"):i||e)}),t},function(e){return 500===pL.size&&pL.clear(),e})).cache,pR),dA=function(e){return null==e?"":h3(e)},dM=function(e,t){return h$(e)?e:dl(e,t)?[e]:d_(dA(e))},dE=1/0,dC=function(e){if("string"==typeof e||hK(e))return e;var t=e+"";return"0"==t&&1/e==-dE?"-0":t},dT=function(e,t){t=dM(t,e);for(var i=0,r=t.length;null!=e&&i<r;)e=e[dC(t[i++])];return i&&i==r?e:void 0},dP=function(e,t){for(var i=-1,r=t.length,a=e.length;++i<r;)e[a+i]=t[i];return e},dD=hV?hV.isConcatSpreadable:void 0,dO=function(e){return h$(e)||cW(e)||!!(dD&&e&&e[dD])},dI=function e(t,i,r,a,o){var l=-1,h=t.length;for(r||(r=dO),o||(o=[]);++l<h;){var c=t[l];i>0&&r(c)?i>1?e(c,i-1,r,a,o):dP(o,c):a||(o[o.length]=c)}return o},dR=function(e){var t;return c_((t=cB((t=void 0,e.length-1),0),function(){for(var i,r=arguments,a=-1,o=cB(r.length-t,0),l=Array(o);++a<o;)l[a]=r[t+a];a=-1;for(var h=Array(t+1);++a<t;)h[a]=r[a];return h[t]=(null==(i=l)?0:i.length)?dI(i,1):[],cx(e,this,h)}),e+"")},dL=c6(Object.getPrototypeOf,Object),dB=Object.prototype,dz=Function.prototype.toString,dF=dB.hasOwnProperty,dN=dz.call(Object),dU=function(e){if(!hZ(e)||"[object Object]"!=hQ(e))return!1;var t=dL(e);if(null===t)return!0;var i=dF.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&dz.call(i)==dN},dk=function(e,t,i){var r=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(i=i>a?a:i)<0&&(i+=a),a=t>i?0:i-t>>>0,t>>>=0;for(var o=Array(a);++r<a;)o[r]=e[r+t];return o},dV=function(e,t,i){var r=e.length;return i=void 0===i?r:i,!t&&i>=r?e:dk(e,t,i)},dj=RegExp("[\\u200d\ud800-\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),dG="\ud800-\udfff",dH="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",dW="\ud83c[\udffb-\udfff]",dq="[^"+dG+"]",dX="(?:\ud83c[\udde6-\uddff]){2}",dY="[\ud800-\udbff][\udc00-\udfff]",dQ="(?:"+dH+"|"+dW+")?",dZ="[\\ufe0e\\ufe0f]?",dK="(?:\\u200d(?:"+[dq,dX,dY].join("|")+")"+dZ+dQ+")*",dJ=RegExp(dW+"(?="+dW+")|(?:"+[dq+dH+"?",dH,dX,dY,"["+dG+"]"].join("|")+")"+(dZ+dQ+dK),"g"),d$=function(e){return dj.test(e)?e.match(dJ)||[]:e.split("")};function d0(e){var t=this.__data__=new dm(e);this.size=t.size}d0.prototype.clear=function(){this.__data__=new dm,this.size=0},d0.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i},d0.prototype.get=function(e){return this.__data__.get(e)},d0.prototype.has=function(e){return this.__data__.has(e)},d0.prototype.set=function(e,t){var i=this.__data__;if(i instanceof dm){var r=i.__data__;if(!dg||r.length<199)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new dx(r)}return i.set(e,t),this.size=i.size,this};var d1="object"==typeof exports&&exports&&!exports.nodeType&&exports,d2=d1&&"object"==typeof module&&module&&!module.nodeType&&module,d3=d2&&d2.exports===d1?hk.Buffer:void 0,d4=d3?d3.allocUnsafe:void 0,d5=function(e,t){if(t)return e.slice();var i=e.length,r=d4?d4(i):new e.constructor(i);return e.copy(r),r},d6=function(e,t){for(var i=-1,r=null==e?0:e.length,a=0,o=[];++i<r;){var l=e[i];t(l,i,e)&&(o[a++]=l)}return o},d8=function(){return[]},d9=Object.prototype.propertyIsEnumerable,d7=Object.getOwnPropertySymbols,ue=d7?function(e){return null==e?[]:d6(d7(e=Object(e)),function(t){return d9.call(e,t)})}:d8,ut=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)dP(t,ue(e)),e=dL(e);return t}:d8,ui=function(e,t,i){var r=t(e);return h$(e)?r:dP(r,i(e))},ur=function(e){return ui(e,de,ue)},us=function(e){return ui(e,ds,ut)},ua=cm(hk,"DataView"),un=cm(hk,"Promise"),uo=cm(hk,"Set"),ul="[object Map]",uh="[object Promise]",uc="[object Set]",ud="[object WeakMap]",uu="[object DataView]",up=ch(ua),uf=ch(dg),um=ch(un),ug=ch(uo),uv=ch(cg),uy=hQ;(ua&&uy(new ua(new ArrayBuffer(1)))!=uu||dg&&uy(new dg)!=ul||un&&uy(un.resolve())!=uh||uo&&uy(new uo)!=uc||cg&&uy(new cg)!=ud)&&(uy=function(e){var t=hQ(e),i="[object Object]"==t?e.constructor:void 0,r=i?ch(i):"";if(r)switch(r){case up:return uu;case uf:return ul;case um:return uh;case ug:return uc;case uv:return ud}return t});var ux=uy,ub=Object.prototype.hasOwnProperty,uw=function(e){var t=e.length,i=new e.constructor(t);return t&&"string"==typeof e[0]&&ub.call(e,"index")&&(i.index=e.index,i.input=e.input),i},uS=hk.Uint8Array,u_=function(e){var t=new e.constructor(e.byteLength);return new uS(t).set(new uS(e)),t},uA=function(e,t){var i=t?u_(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)},uM=/\w*$/,uE=function(e){var t=new e.constructor(e.source,uM.exec(e));return t.lastIndex=e.lastIndex,t}
3139,uC=hV?hV.prototype:void 0,uT=uC?uC.valueOf:void 0,uP=function(e,t){var i=t?u_(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)},uD=function(e,t,i){var r=e.constructor;switch(t){case"[object ArrayBuffer]":return u_(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return uA(e,i);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return uP(e,i);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return uE(e);case"[object Symbol]":return uT?Object(uT.call(e)):{}}},uO=c1&&c1.isMap,uI=uO?cK(uO):function(e){return hZ(e)&&"[object Map]"==ux(e)},uR=c1&&c1.isSet,uL=uR?cK(uR):function(e){return hZ(e)&&"[object Set]"==ux(e)},uB="[object Arguments]",uz="[object Function]",uF="[object Object]",uN={};uN[uB]=uN["[object Array]"]=uN["[object ArrayBuffer]"]=uN["[object DataView]"]=uN["[object Boolean]"]=uN["[object Date]"]=uN["[object Float32Array]"]=uN["[object Float64Array]"]=uN["[object Int8Array]"]=uN["[object Int16Array]"]=uN["[object Int32Array]"]=uN["[object Map]"]=uN["[object Number]"]=uN[uF]=uN["[object RegExp]"]=uN["[object Set]"]=uN["[object String]"]=uN["[object Symbol]"]=uN["[object Uint8Array]"]=uN["[object Uint8ClampedArray]"]=uN["[object Uint16Array]"]=uN["[object Uint32Array]"]=!0,uN["[object Error]"]=uN[uz]=uN["[object WeakMap]"]=!1;var uU=function e(t,i,r,a,o,l){var h,c=1&i,d=2&i,p=4&i;if(r&&(h=o?r(t,a,o,l):r(t)),void 0!==h)return h;if(!h8(t))return t;var f=h$(t);if(f){if(h=uw(t),!c)return cb(t,h)}else{var m,g,v,y,x=ux(t),b=x==uz||"[object GeneratorFunction]"==x;if(cQ(t))return d5(t,c);if(x==uF||x==uB||b&&!o){if(h=d||b?{}:"function"!=typeof t.constructor||cU(t)?{}:cy(dL(t)),!c)return d?(g=(m=h)&&cL(t,ds(t),m),cL(t,ut(t),g)):(y=(v=h)&&cL(t,de(t),v),cL(t,ue(t),y))}else{if(!uN[x])return o?t:{};h=uD(t,x,c)}}l||(l=new d0);var w=l.get(t);if(w)return w;l.set(t,h),uL(t)?t.forEach(function(a){h.add(e(a,i,r,a,t,l))}):uI(t)&&t.forEach(function(a,o){h.set(o,e(a,i,r,o,t,l))});var S=p?d?us:ur:d?ds:de,_=f?void 0:S(t);return cA(_||t,function(a,o){_&&(a=t[o=a]),cR(h,o,e(a,i,r,o,t,l))}),h},uk=function(e){return uU(e,5)};function uV(e){var t=-1,i=null==e?0:e.length;for(this.__data__=new dx;++t<i;)this.add(e[t])}uV.prototype.add=uV.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},uV.prototype.has=function(e){return this.__data__.has(e)};var uj=function(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1},uG=function(e,t,i,r,a,o){var l=1&i,h=e.length,c=t.length;if(h!=c&&!(l&&c>h))return!1;var d=o.get(e),p=o.get(t);if(d&&p)return d==t&&p==e;var f=-1,m=!0,g=2&i?new uV:void 0;for(o.set(e,t),o.set(t,e);++f<h;){var v=e[f],y=t[f];if(r)var x=l?r(y,v,f,t,e,o):r(v,y,f,e,t,o);if(void 0!==x){if(x)continue;m=!1;break}if(g){if(!uj(t,function(e,t){if(!g.has(t)&&(v===e||a(v,e,i,r,o)))return g.push(t)})){m=!1;break}}else if(!(v===y||a(v,y,i,r,o))){m=!1;break}}return o.delete(e),o.delete(t),m},uH=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e,r){i[++t]=[r,e]}),i},uW=function(e){var t=-1,i=Array(e.size);return e.forEach(function(e){i[++t]=e}),i},uq=hV?hV.prototype:void 0,uX=uq?uq.valueOf:void 0,uY=function(e,t,i,r,a,o,l){switch(i){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)break;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new uS(e),new uS(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return cO(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=uH;case"[object Set]":var c=1&r;if(h||(h=uW),e.size!=t.size&&!c)break;var d=l.get(e);if(d)return d==t;r|=2,l.set(e,t);var p=uG(h(e),h(t),r,a,o,l);return l.delete(e),p;case"[object Symbol]":if(uX)return uX.call(e)==uX.call(t)}return!1},uQ=Object.prototype.hasOwnProperty,uZ=function(e,t,i,r,a,o){var l=1&i,h=ur(e),c=h.length;if(c!=ur(t).length&&!l)return!1;for(var d=c;d--;){var p=h[d];if(!(l?p in t:uQ.call(t,p)))return!1}var f=o.get(e),m=o.get(t);if(f&&m)return f==t&&m==e;var g=!0;o.set(e,t),o.set(t,e);for(var v=l;++d<c;){var y=e[p=h[d]],x=t[p];if(r)var b=l?r(x,y,p,t,e,o):r(y,x,p,e,t,o);if(!(void 0===b?y===x||a(y,x,i,r,o):b)){g=!1;break}v||(v="constructor"==p)}if(g&&!v){var w=e.constructor,S=t.constructor;w!=S&&"constructor"in e&&"constructor"in t&&!("function"==typeof w&&w instanceof w&&"function"==typeof S&&S instanceof S)&&(g=!1)}return o.delete(e),o.delete(t),g},uK="[object Arguments]",uJ="[object Array]",u$="[object Object]",u0=Object.prototype.hasOwnProperty,u1=function(e,t,i,r,a,o){var l=h$(e),h=h$(t),c=l?uJ:ux(e),d=h?uJ:ux(t);c=c==uK?u$:c,d=d==uK?u$:d;var p=c==u$,f=d==u$,m=c==d;if(m&&cQ(e)){if(!cQ(t))return!1;l=!0,p=!1}if(m&&!p)return o||(o=new d0),l||c3(e)?uG(e,t,i,r,a,o):uY(e,t,c,i,r,a,o);if(!(1&i)){var g=p&&u0.call(e,"__wrapped__"),v=f&&u0.call(t,"__wrapped__");
3139if(g||v){var y=g?e.value():e,x=v?t.value():t;return o||(o=new d0),a(y,x,i,r,o)}}return!!m&&(o||(o=new d0),uZ(e,t,i,r,a,o))},u2=function(e,t){return null!=e&&t in Object(e)},u3=function(e,t,i){t=dM(t,e);for(var r=-1,a=t.length,o=!1;++r<a;){var l=dC(t[r]);if(!(o=null!=e&&i(e,l)))break;e=e[l]}return o||++r!=a?o:!!(a=null==e?0:e.length)&&cz(a)&&cP(l,a)&&(h$(e)||cW(e))},u4=function(){return hk.Date.now()},u5=Math.max,u6=Math.min,u8=function(e,t,i){var r,a,o,l,h,c,d=0,p=!1,f=!1,m=!0;if("function"!=typeof e)throw TypeError("Expected a function");function g(t){var i=r,o=a;return r=a=void 0,d=t,l=e.apply(o,i)}function v(e){var i=e-c,r=e-d;return void 0===c||i>=t||i<0||f&&r>=o}function y(){var e,i,r,a=u4();if(v(a))return x(a);h=setTimeout(y,(e=a-c,i=a-d,r=t-e,f?u6(r,o-i):r))}function x(e){return h=void 0,m&&r?g(e):(r=a=void 0,l)}function b(){var e,i=u4(),o=v(i);if(r=arguments,a=this,c=i,o){if(void 0===h)return d=e=c,h=setTimeout(y,t),p?g(e):l;if(f)return clearTimeout(h),h=setTimeout(y,t),g(c)}return void 0===h&&(h=setTimeout(y,t)),l}return t=cr(t)||0,h8(i)&&(p=!!i.leading,o=(f="maxWait"in i)?u5(cr(i.maxWait)||0,t):o,m="trailing"in i?!!i.trailing:m),b.cancel=function(){void 0!==h&&clearTimeout(h),d=0,r=c=a=h=void 0},b.flush=function(){return void 0===h?l:x(u4())},b},u9=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0},u7=function(e,t){return e>t},pe=function(e,t){return function e(t,i,r,a,o){return t===i||(null!=t&&null!=i&&(hZ(t)||hZ(i))?u1(t,i,r,a,e,o):t!=t&&i!=i)}(e,t)},pt=function(e,t,i){for(var r=-1,a=e.length;++r<a;){var o=e[r],l=t(o);if(null!=l&&(void 0===h?l==l&&!hK(l):i(l,h)))var h=l,c=o}return c},pi=function(e,t){var i,r;
3139return t=dM(t,e),i=e,null==(e=(r=t).length<2?i:dT(i,dk(r,0,-1)))||delete e[dC(u9(t))]},pr=function(e){return dU(e)?void 0:e},ps=dR(function(e,t){var i={};if(null==e)return i;var r=!1;t=hJ(t,function(t){return t=dM(t,e),r||(r=t.length>1),t}),cL(e,us(e),i),r&&(i=uU(i,7,pr));for(var a=t.length;a--;)pi(i,t[a]);return i}),pa=function(e,t,i,r){if(!h8(e))return e;t=dM(t,e);for(var a=-1,o=t.length,l=o-1,h=e;null!=h&&++a<o;){var c=dC(t[a]),d=i;if("__proto__"===c||"constructor"===c||"prototype"===c)break;if(a!=l){var p=h[c];void 0===(d=r?r(p,c,h):void 0)&&(d=h8(p)?p:cP(t[a+1])?[]:{})}cR(h,c,d),h=h[c]}return e},pn=function(e,t,i){for(var r=-1,a=t.length,o={};++r<a;){var l=t[r],h=dT(e,l);i(h,l)&&pa(o,dM(l,e),h)}return o},po=dR(function(e,t){return null==e?{}:pn(e,t,function(t,i){return null!=e&&u3(e,i,u2)})}),pl=function(e,t,i){var r=!0,a=!0;if("function"!=typeof e)throw TypeError("Expected a function");return h8(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),u8(e,t,{leading:r,maxWait:t,trailing:a})},ph=function(e,t){for(var i,r=e.length;r--&&((i=e[r])==i?cC(t,i,0):cM(t,cE,0))>-1;);return r},pc=function(e,t,i){if((e=dA(e))&&(i||void 0===t))return e.slice(0,h5(e)+1);if(!e||!(t=h3(t)))return e;var r=d$(e),a=ph(r,d$(t))+1;return dV(r,0,a).join("")},pd=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().includes(" electron/"),pu=(pd&&(()=>{if(typeof window>"u")return;let e=new URLSearchParams(window.location.search).get("desktop-app-version");return e?(window.localStorage.setItem("desktop-app-version",e),e):window.localStorage.getItem("desktop-app-version")??"0.0.6"})(),!(typeof window>"u")&&window.navigator.platform.toUpperCase().includes("MAC")),pp=!(typeof window>"u")&&(/iPad|iPhone|iPod/.test(window.navigator.userAgent)||pu&&"ontouchend"in document),pf=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,pm=!(typeof window>"u")&&("ontouchstart"in window||navigator.maxTouchPoints>0),pg=(()=>{if(typeof window>"u")return!1;let e=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(e)&&/Apple Computer/.test(t)})(),pv=Number((()=>{if(typeof window>"u")return null;let e=navigator.userAgent.match(/Version\/(\d+\.\d)/);return e&&e[1]})());function py(e){return pu?e.metaKey:e.ctrlKey}var px=[],pb={},pw={},pS={};function p_(e){px.includes(e)||px.push(e)}function pA(e){delete pb[e.pointerId];for(let t=0;t<px.length;t++)if(px[t].pointerId===e.pointerId){px.splice(t,1);break}}function pM(e){if("touch"!==e.pointerType)return;let t=pb[e.pointerId];void 0===t&&(t={x:0,y:0},pb[e.pointerId]=t),t.x=e.pageX,t.y=e.pageY}function pE(e){return pb[(e.pointerId===px[0].pointerId?px[1]:px[0]).pointerId]}function pC(e){pw[e.key]=!0,pS[e.key]=void 0===pS[e.key]?1:pS[e.key]+1}function pT(e){if(pu&&pw.Meta)for(let e in pw)pw[e]=!1;else pw[e.key]=!1;pS={}}var pP,pD,pO,pI,pR,pL,pB,pz,pF,pN=new Promise(e=>{pB=e}),pU=new Promise(e=>{pF=e}),pk=class{modifyById(e,t){if(void 0===this[e])throw Error("not expected");{let i={...this,[e]:t};return Object.setPrototypeOf(i,pk.prototype),i}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){if(1===e.type){let t=this[e.id],i;i=void 0===t?{type:2,id:e.id}:{type:1,id:e.id,data:t};let{id:r,data:a}=e,o={...this,[r]:a};return Object.setPrototypeOf(o,pk.prototype),{data:o,actual:e,reverse:i}}if(2===e.type){let{id:t}=e,i=this[t];if(void 0===i)return null;{let r={...this};return Object.setPrototypeOf(r,pk.prototype),delete r[t],{data:r,actual:e,reverse:{type:1,id:t,data:i}}}}return null}};function pV(e){if(void 0!==e.deepFreeze){e.deepFreeze(e);return}for(let t of Object.getOwnPropertyNames(e)){let i=e[t];i&&"object"==typeof i&&pV(i)}return Object.freeze(e)}var pj=class extends Error{};function pG(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function pH(e,t,i){if(void 0===e?void 0===t?(e=0,t=10):e=t-10:void 0===t&&(t=e+10),e>t){let i=e;e=t,t=i}let r=[],a=1/(i+1);for(let o=0;o<i;o++){let i=e+(t-e)*(o+.75+.5*Math.random())*a;r.push(i)}return r}function pW(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array}var pq=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,pq.prototype)}deepFreeze(){let e=0;for(;e<this.length;)pV(this[e]),e++}fillCaches0(e,t){for(let i of(this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t),e.children))this.fillCaches0(i,e.id)}fillCaches(){if(void 0===this.objCaches)for(let e of(this.objCaches=new Map,this.parentCaches=new Map,this))this.fillCaches0(e,null)}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(0!==e.length)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);
3139if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(t)e=t;else break}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return void 0!==this.childrenOf(e)}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return null===e?this:this.get(e)?.children}traverseFrom(e,t){if(null===e)this.traverse(t);else{let i=this.get(e);i&&function e(t,i){if(!0!==i(t.id,t.data))for(let r of t.children)e(r,i)}(i,t)}}traverse(e){!function e(t,i){for(let r of t)!0!==i(r.id,r.data)&&e(r.children,i)}(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return null===e?this:this.get(e).children}modifyById(e,t){if(void 0===this.get(e))throw Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),a=r.findIndex(t=>t.id===e);if(a<0)throw Error("not expected");let o=r[a];return(r=[...r])[a]={...o,data:t},this.modifyArrayBy(i,r)}}modifyArrayBy(e,t){let i=e,r=t;for(;null!==i;){let e=r,t=i;if(void 0===(i=this.parent(i)))throw Error();let a=(r=this.childrenArray(i)).findIndex(e=>e.id===t);if(a<0)throw Error();(r=[...r])[a]={...r[a],children:e}}Object.setPrototypeOf(r,pq.prototype);let a=r;return a.fillCaches(),a}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(void 0!==this.get(e))return!0;for(let e of t)if(this.checkDuplicatedIdRec(e))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:a,children:o}=e;if(null!==t&&void 0===this.get(t)||this.checkDuplicatedIdRec(e))return null;{let l=this.childrenArray(t),h={fi:i,id:r,data:a,children:o};return(l=[...l,h]).sort((e,t)=>e.fi-t.fi),e.localIndex=l.indexOf(h),{data:this.modifyArrayBy(t,l),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(null===this.get(t))return null;{let i=this.parent(t);if(void 0===i)return null;let r=this.childrenArray(i),a=r.findIndex(e=>e.id===t);e.localIndex=a;let o=(r=[...r]).splice(a,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...o,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(null!==t&&void 0===this.get(t))return this.deleteOp({type:8,id:r});if(null!==t){let e=t;for(;null!==e;){if(void 0===e)throw Error();if(e===r)throw new pj("cyclic tree");e=this.parent(e)}}let a=this.parent(r);if(void 0===a)return null;let o=a,l=this.childrenArray(a),h=l.findIndex(e=>e.id===r),c=(l=[...l]).splice(h,1)[0],d=this.modifyArrayBy(a,l);a=t,l=d.childrenArray(a);let p=c.fi;return(l=[...l,c={...c,fi:i}]).sort((e,t)=>e.fi-t.fi),e.localIndex=l.indexOf(c),{data:d=d.modifyArrayBy(a,l),actual:e,reverse:{type:9,parent:o,fi:p,id:r}}}previous(e,t){if(null===t){let t=this.childrenArray(e);return 0===t.length?null:t[t.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(void 0!==t){let i=this.childrenArray(t),r=i.findIndex(t=>t.id===e)+1;if(r<i.length)return i[r].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(void 0!==t){let i=this.childrenArray(t),r=i.findIndex(t=>t.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push({...i,...e})}for(let e of(t.sort((e,t)=>(function(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return -1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0})(e.sortKey,t.sortKey)),t))delete e.sortKey;return t}getWithSortKey(e){var t=e;let i=[],r=this.get(t),a=r;if(void 0!==r){for(;t;)i.splice(0,0,r.fi),null!==(t=this.parent(t))&&(r=this.get(t));return{...a,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(null===t){if(0===r.length)return pH(0,i,i);{let e=r[0].fi;return pH(e-i,e,i)}}{let a=this.get(t);if(void 0===a||this.parent(t)!==e)throw Error("illegal args");let o=r.find(e=>e.fi>a.fi);if(void 0!==o)return pH(a.fi,o.fi,i);{let e=r[r.length-1].fi;return pH(e,e+i,i)}}}};(pZ||(pZ={})).runOp=function(e,t){if(0!==t.type)return null;if(Array.isArray(e)){let i=t.props,r={},a=[...e],o=!1;if(i)for(let e of Object.keys(i)){let t=parseInt(e);if(isNaN(t))throw Error("wrong index");r[e]=a[t],a[t]=i[e],o=!0}
3139return o?{data:a,actual:t,reverse:{type:0,props:r}}:null}{let i=t.props,r={},a={...e},o=!1;if(i)for(let e of Object.keys(i)){r[e]=a[e];let t=i[e];void 0===t?delete a[e]:a[e]=t,o=!0}return o?{data:a,actual:t,reverse:{type:0,props:r}}:null}};var pX=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,pX.prototype)}deepFreeze(){let e=0;for(;e<this.length;)pV(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(void 0===this.objCaches)for(let e of(this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1,this))this.fillCaches0(e)}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(0!==e.length)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(void 0===this.get(e))throw Error("not expected");{let i=this,r=i.findIndex(t=>t.id===e);if(r<0)throw Error("not expected");let a=i[r];return(i=[...i])[r]={...a,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){return Object.setPrototypeOf(e,pX.prototype),"u">typeof t_||e.fillCaches(),e}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,a=this,o={fi:t,id:i,data:r};return(a=[...a,o]).sort((e,t)=>e.fi-t.fi),e.localIndex=a.indexOf(o),{data:this.modifyArrayBy(a),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(e=>e.id===t);if(-1===r)return null;e.localIndex=r;let a=(i=[...i]).splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...a}}}moveOp(e){let{fi:t,id:i}=e,r=this,a=(r=[...r]).findIndex(e=>e.id===i);if(-1===a)return null;let o=r[a].fi,l={...r[a],fi:t};return r[a]=l,r.sort((e,t)=>e.fi-t.fi),e.localIndex=r.indexOf(l),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:o,id:i}}}previous(e){if(null===e)return 0===this.length?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){if(null===e){if(0===this.length)return pH(0,t,t);{let e=this[0].fi;return pH(e-t,e,t)}}{let i=this.get(e);if(void 0===i)throw Error("illegal args");let r=this.find(e=>e.fi>i.fi);if(void 0!==r)return pH(i.fi,r.fi,t);{let e=this[this.length-1].fi;return pH(e,e+t,t)}}}};function pY(e){return e&&"object"==typeof e&&e instanceof pJ}var pQ,pZ,pK,pJ=class{unusedFunOverridesTable(e){}runOp(e){let t=[],i=this,r=0,a={};for(;r<e.path.length;){if(t.push(i),void 0!==(i=void 0===i?void 0:i[e.path[r]])&&!pY(i))return null;r+=1}for(let[t,r]of(i=i?pG(i):new pJ,Object.entries(e.props))){let e=i[t];a[t]=e,void 0===r?delete i[t]:i[t]=r}for(;r>0;){if(0===Object.keys(i).length){let a=t[r-1];a&&(i=pG(a),delete i[e.path[r-1]])}else{let a=t[r-1];if(a){let t=pG(a);t[e.path[r-1]]=i,i=t}else{let t=new pJ;t[e.path[r-1]]=i,i=t}}r-=1}let o=Object.setPrototypeOf(i,pJ.prototype),l={...e,props:a};return{data:o,actual:e,reverse:l}}};function p$(e,t){if(void 0===t)return;let i=!1,r=e.map(e=>{let r=e.id,a=p0(e.data,t[r]);if(i=i||void 0!==a,void 0===a&&(a=e.data),!e.children)return{...e,id:r,data:a};{let o=p$(e.children,t);return void 0!==o?i=!0:o=e.children,{...e,id:r,data:a,children:o}}});if(i)return r}function p0(e,t){if(!pY(t))return t;if(e instanceof pq){let i=p$(e,t);return void 0!==i&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}if(e instanceof pX)return function(e,t){if(void 0===t)return;let i=!1,r=e.map(e=>{let r=e.id,a=p0(e.data,t[r]);return i=i||void 0!==a,void 0===a&&(a=e.data),{...e,id:r,data:a}});if(i)return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}(e,t);if(Array.isArray(e)){let i=!1,r=e.map((e,r)=>{let a=p0(e,t[r]);return i=i||void 0!==a,void 0===a&&(a=e),a});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof pJ)return p1(e,t);if(e&&"object"==typeof e){let i={},r=!1;for(let[a,o]of Object.entries(e)){let e=p0(o,t[a]);r=r||void 0!==e,void 0===e&&(e=o),i[a]=e}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}function p1(e,t){if(void 0===e)return t;if(void 0===t)return e;if(!pY(t))return t;if(!pY(e))return pK.apply(e,t);let i=new Set;for(let t of Object.keys(e))i.add(t);for(let e of Object.keys(t))i.add(e);let r=new pJ;for(let a of i){let i=p1(void 0===e?void 0:e[a],void 0===t?void 0:t[a]);r[a]=i}return r}function p2(e,t){return null===e?null:(e.cur[e.len]=t,e.len+=1,e)}function p3(e){e&&(e.len-=1)}(fm=pK||(pK={})).apply=function(e,t){return p0(e,t)??e},fm.merge=function(e,t){return p1(e,t)},fm.filterOp=function(e,t){let i=0,r=t.path,a=e;for(;i<r.length&&void 0!==a;){if(void 0===(a=fx.zoomOnce(a,r[i])))return t;if(!pY(a))return;i+=1}if(void 0===a)return t;if(pY(a)){if(0===t.type){let e={...t.props};for(let t of Object.keys(a))delete e[t];return{...t,props:e}}{if(1!==t.type&&4!==t.type&&7!==t.type)return t;let e=p$([t],a);return e?e[0]:t}}},(fg||(fg={})).replaceProps=function(e,t){let i=fx.zoom(t,e.path);if("object"!=typeof i)return{...e,props:{}};{let t={};for(let r of Object.keys(e.props))t[r]=i[r];return{...e,props:t}}},(e=>{function t(e,t){let i=t.path;for(var r=[];;){let a;if(e instanceof pJ&&0===t.type&&null===(a=e.runOp({...t,path:i.slice(r.length)}))&&(a=void 0),void 0===a&&r.length===i.length&&(a=e instanceof pq||e instanceof pX||e instanceof pk?e.runOp(t):pZ.runOp(e,t)),void 0!==a){if(null===a)return null;{let e=a.data;for(let t=r.length-1;t>=0;t--){let a=i[t],o=r[t];if(o instanceof pq){if("number"==typeof a)throw Error("illegal arg");e=o.modifyById(a,e)}else if(o instanceof pX){if("number"==typeof a)throw Error("illegal arg");e=o.modifyById(a,e)}else if(o instanceof pk){if("number"==typeof a)throw Error("illegal arg");e=o.modifyById(a,e)}else if(o instanceof pJ)e=Object.setPrototypeOf({...o,[a]:e},pJ.prototype);else if("object"!=typeof o)return null;else if(Array.isArray(o)){if("string"==typeof a&&isNaN(a=parseInt(a)))throw Error("Invalid path");let t=e;(e=[...o])[a]=t}else e={...o,[a]:e}}return{data:e,actual:{...a.actual,path:i},reverse:{...a.reverse,path:i}}}}let o=i[r.length],l;if(e instanceof pq){if("number"==typeof o)throw Error("");l=e.get(o)?.data}else if(e instanceof pX){if("number"==typeof o)throw Error("");l=e.get(o)?.data}else null!==e&&(l=e[o]);if(void 0===l)return null;r.push(e),e=l}}function i(e,t){for(let i=0;i<e.length&&i<t.length;i++)if(e[i]!==t[i])return!0;return!1}function r(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}e.drop=function(e,t){return{...e,path:e.path.slice(t)}},e.applySimple=function(e,i){return t(e,i)?.data??e},e.apply=t,e.pathDisjoint=i,e.pathEq=r,e.commutative=function(e,t){return i(e.path,t.path)},e.subsumed=function(e,t){return!!(0===e.type&&0===t.type&&r(e.path,t.path))&&Object.keys(e.props).every(e=>void 0!==t.props[e])}})(fv||(fv={})),(e=>{function t(e,t){var i=e;let r=[],a=[];for(let e of t)try{if(3===e.type||5===e.type&&"variables"===e.path[e.path.length-1]){let t,o,l;if(3===e.type?(t=fx.zoom(i,[...e.path,e.id]),l=fv.apply(i,{...e,type:2})):(t=fx.zoom(i,[...e.path,e.id,"value"]),l=fv.apply(i,e)),null!==l){i=l.data;let[h,c]=function(e,t){let i={cur:[],result:[],len:0};return[e=function e(t,i,r){if(t instanceof pq){let a=function t(i,r,a){let o=!1,l=i.map(i=>{let l=i.id,h=r[l];if(void 0!==h&&"string"==typeof h&&(o=!0,l=h,null!==a))throw Error("not supported");let c=e(i.data,r,p2(a,l));p3(a),o=o||void 0!==c,void 0===c&&(c=i.data);let d=t(i.children,r,a);return void 0!==d?o=!0:d=i.children,{...i,id:l,data:c,children:d}});if(o)return l}(t,i,r);return void 0!==a&&Object.setPrototypeOf(a,Object.getPrototypeOf(t)),a}if(t instanceof pX)return function(t,i,r){let a=!1,o=t.map(t=>{let o=t.id,l=i[o];if(void 0!==l&&"string"==typeof l&&(a=!0,o=l,null!==r))throw Error("not supported");let h=e(t.data,i,p2(r,o));return p3(r),a=a||void 0!==h,void 0===h&&(h=t.data),{...t,id:o,data:h}});if(a)return Object.setPrototypeOf(o,Object.getPrototypeOf(t)),o}(t,i,r);if(Array.isArray(t)){let a=!1,o=t.map((t,o)=>{let l=e(t,i,p2(r,o));return p3(r),a=a||void 0!==l,void 0===l&&(l=t),l});return a?(Object.setPrototypeOf(o,Object.getPrototypeOf(t)),o):void 0}if(t&&"object"==typeof t&&!pW(t)){let a={},o=!1;for(let[l,h]of Object.entries(t))if("name"!==l&&"variableId"!==l){let t=i[l];if("string"==typeof t){if(null!==r)throw Error("not supported");o=!0,l=t}let c=e(h,i,p2(r,l));p3(r),o=o||void 0!==c,void 0===c&&(c=h),a[l]=c}else a[l]=h;return o?(Object.setPrototypeOf(a,Object.getPrototypeOf(t)),a):void 0}{var a;if("string"!=typeof t)return;let e=i[t];return void 0!==e&&(a=r,null!==a&&a.result.push(a.cur.slice(0,a.len)
3139)),e}}(e,t,i)??e,i.result]}(i,{[e.id]:t});i=h;for(let l=0;l<c.length;l++){let h=c[l],d=h.pop();if("number"==typeof d){let r=[d];for(let e=l+1;e<c.length;e++){let t=c[e],i=t[t.length-1];if("number"==typeof i&&fx.equal(h,t.slice(0,t.length-1)))r.push(i),c.splice(e,1);else break}let a=fx.zoom(i,h);o=a.map((t,i)=>r.includes(i)?e.id:t),t=a,d=h.pop()}else{if("alphaOverride"===d||"alpha"===d){let e=t/=100,r=fx.zoom(i,h.slice(0,h.length-2)),a=r.layers.map(t=>t.id===h[h.length-1]?{...t,data:{...t.data,[d]:e}}:t);Object.setPrototypeOf(a,Object.getPrototypeOf(r.layers)),r.layers=a}o=e.id}r.push({type:0,path:h,props:{[d]:t}}),a.push({type:0,path:h,props:{[d]:o}})}a.push(l.reverse),r.push(l.actual)}}else{let t=fv.apply(i,e);null!==t&&(r.push(t.actual),i=t.data,a.push(t.reverse))}}catch(e){if(e instanceof pj)return null;throw e}return{data:i,actual:r,reverse:a.reverse()}}e.empty=function(){return[]},e.removePrefix=function(e,t){let i=[];for(let r of e){let[e,...a]=r.path;e===t&&i.push({...r,path:a})}return i},e.addPrefix=function(e,t){return e.map(e=>({...e,path:[t,...e.path]}))},e.concat=function(e,t){return[...e,...t]},e.compress=function(e,t){return[...e.filter(e=>!t.some(t=>fv.subsumed(e,t))),...t]},e.commutative=function(e,t){return e.every(e=>t.every(t=>fv.commutative(e,t)))},e.applyAll=function(e,i){for(let r of i){let i=t(e,r);null!==i&&(e=i.data)}return e},e.apply=t})(fy||(fy={}));var p4=Symbol(),p5=Symbol(),p6=Symbol(),p8=class{reportOp(e,t,i=[]){let r=this;if(null!==t){for(r._current=t.data;!(r instanceof fn);){let e=r._path,t=r._current;if(""!==e&&i.splice(0,0,e),null===(r=r._parent))return;r.update(e,t)}r.push(i,e,t.actual,t.reverse)}}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[p6];i&&i(),delete this._children[e]}}}},p9=class extends p8{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if("string"==typeof e&&isNaN(e=parseInt(e)))throw Error("Invalid path");this._current=[...this._current],this._current[e]=t}else if(this._current instanceof pJ){let i={...this._current,[e]:t};this._current=Object.setPrototypeOf(i,pJ.prototype)}else this._current={...this._current,[e]:t}}runOp(e){this.reportOp(e,pZ.runOp(this._current,e),e.path)}},p7=class extends p8{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,pk.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},fe={get(e,t){if(t===p6)return()=>{e._parent=null};if(t===p4)return e._current;if(t===p5)return e;let{_current:i,_children:r}=e;if("push"===t&&Array.isArray(i))throw Error("not supported to expand array");let a=void 0===r?void 0:r[t];if(void 0!==a)return a;let o=i[t],l=fo(e,t,o);return l!==o?(void 0===r&&(r={},e._children=r),r[t]=l,l):o},has:(e,t)=>t in e._current,ownKeys:e=>Reflect.ownKeys(e._current),defineProperty(){throw Error("not supported")},getPrototypeOf:e=>Object.getPrototypeOf(e._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},ft={...fe,set(e,t,i){let r={type:0,props:{[t]:fc(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty:(e,t)=>(e.deleteChildren(t),e.runOp({type:0,props:{[t]:void 0}}),!0)},fi={...fe,set(e,t,i){return void 0===i?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty:(e,t)=>(e.runOp({type:2,id:t}),!0)},fr=class extends p8{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[p6]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=void 0===i?void 0:i[e];if(void 0!==r)return r;let a=t.get(e)?.data,o=fo(this,e,a);return o!==a?(void 0===i&&(i={},this._children=i),i[e]=o,o):a}
3139add(e,t,i,r,a){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:a})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let t=0;t<i.length;t++){let a=i[t];this.add(e,r[t],a.id,a.data,a.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let t=0;t<i.length;t++){let a=i[t];this.add(e,r[t],a.id,a.data,a.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let t=0;t<i.length;t++){let a=i[t];this.move(e,r[t],a)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let t=0;t<i.length;t++){let a=i[t];this.move(e,r[t],a)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},fs=class extends p8{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[p6]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i<t;i++){let t=this._current[i].id,r=this._current[i].fi;e(this.data(this._current[i].id),t,r)}}find(e){let t=this.length;for(let i=0;i<t;i++){let t=this._current[i].id;if(e(this.data(t),t))return this.get(t)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}data(e){let{_current:t,_children:i}=this,r=void 0===i?void 0:i[e];if(void 0!==r)return r;let a=t.get(e)?.data,o=fo(this,e,a);return o!==a?(void 0===i&&(i={},this._children=i),i[e]=o,o):a}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,i){this.runOp({type:4,fi:e,id:t,data:i})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.add(i[e],r.id,r.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.add(i[e],r.id,r.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.move(i[e],r)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let e=0;e<t.length;e++){let r=t[e];this.move(i[e],r)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function fa(e,t,i){if(e.length>0){let r=e[e.length-1];if(0===r.type&&0===t.type&&fx.equal(r.path,i)){Object.assign(r.props,t.props);return}}e.push({...t,path:i})}var fn=class extends p8{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(""!==e)throw Error("");this._current=t}push(e,t,i,r){fa(this.ts,t,e),fa(this.actual,i,e),fa(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function fo(e,t,i){return i instanceof pq?new fr(e,t,i):i instanceof pX?new fs(e,t,i):i instanceof pk?new Proxy(new p7(e,t,i),fi):null!==i&&"object"==typeof i?pW(i)?i:new Proxy(new p9(e,t,i),ft):i}function fl(e){let t=new fn(e);return[fo(t,"",e),t]}function fh(e,t){let[i,r]=fl(e);return t(i),r.result()}function fc(e){return e instanceof fr||e instanceof fs?e._current:null!==e&&"object"==typeof e?e[p4]:e}function fd(e,t){let i=[];if(!(t.length<=e.length))return null;for(var r=0;r<t.length;){if("*"===t[r])i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}return i}(e=>{function t(e,t){return(e instanceof pq||e instanceof fr)&&"string"==typeof t||(e instanceof pX||e instanceof fs)&&"string"==typeof t?e.data(t):"number"==typeof t&&Array.isArray(e)||"string"==typeof t&&"object"==typeof e&&null!==e?e[t]:void 0}function i(e,i,r=0){for(;r<i.length&&void 0!==e;)e=t(e,i[r]),r+=1;return e}e.equal=function(e,t){if(t.length!==e.length)return!1;for(var i=0;i<e.length;){if(e[i]!==t[i])return!1;i+=1}return!0},e.removeOverridden=function(e,t,r){let a=i(r,e);if(void 0===a||"object"!=typeof a||null===a)return t;{let e={...t};return Object.keys(a).forEach(t=>{delete e[t]}),e}},e.zoomOnce=t,e.zoom=i})(fx||(fx={}));var fu=class{},fp=class extends fu{constructor(e){super(),this.id=e}},ff=class extends fu{constructor(e){super(),this.data=e}};try{fb=new TextDecoder}catch{}var fm,fg,fv,fy,fx,fb,fw,fS,f_,fA,fM,fE,fC,fT=0,fP=[],fD=fP,fO=0,fI={},fR=0,fL=0,fB=[],fz={useRecords:!1,mapsAsObjects:!0},fF=class{},fN=new fF;fN.name="MessagePack 0xC1";var fU=!1,fk=2;try{Function("")}catch{fk=1/0}var fV=class{constructor(e){e&&(!1===e.useRecords&&void 0===e.mapsAsObjects&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(fw)return mi(()=>(mr(),this?this.unpack(e,t):fV.prototype.unpack.call(fz,e,t)));fS=t>-1?t:e.length,fT=0,fO=0,fL=0,fA=null,fD=fP,fM=null,fw=e;try{fC=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(t){throw fw=null,e instanceof Uint8Array?t:Error("Source must be a Uint8Array or Buffer but was a "+(e&&"object"==typeof e?e.constructor.name:typeof e))}
3139if(this instanceof fV){if(fI=this,this.structures)return f_=this.structures,fj();(!f_||f_.length>0)&&(f_=[])}else fI=fz,(!f_||f_.length>0)&&(f_=[]);return fj()}unpackMultiple(e,t){let i,r=0;try{fU=!0;let a=e.length,o=this?this.unpack(e,a):ma.unpack(e,a);if(t){for(t(o);fT<a;)if(r=fT,!1===t(fj()))return}else{for(i=[o];fT<a;)r=fT,i.push(fj());return i}}catch(e){throw e.lastPosition=r,e.values=i,e}finally{fU=!1,mr()}}_mergeStructures(e,t){e=e||[];for(let t=0,i=e.length;t<i;t++){let i=e[t];i&&(i.isShared=!0,t>=32&&(i.highByte=t-32>>5))}for(let i in e.sharedLength=e.length,t||[])if(i>=0){let r=e[i],a=t[i];a&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=a)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function fj(){try{if(!fI.trusted&&!fU){let e=f_.sharedLength||0;e<f_.length&&(f_.length=e)}let e=fH();if(fT==fS)f_.restoreStructures&&fG(),f_=null,fw=null,fE&&(fE=null);else if(fT>fS){let e=Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!fU)throw Error("Data read, but end of buffer not reached");return e}catch(e){throw f_.restoreStructures&&fG(),mr(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function fG(){for(let e in f_.restoreStructures)f_[e]=f_.restoreStructures[e];f_.restoreStructures=null}function fH(){let e=fw[fT++];if(e<160){if(e<128){if(e<64)return e;{let t=f_[63&e]||fI.getStructures&&fY()[63&e];return t?(t.read||(t.read=fq(t,63&e)),t.read()):e}}if(e<144){if(e-=128,fI.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[f9()]=fH();return t}{let t=new Map;for(let i=0;i<e;i++)t.set(fH(),fH());return t}}{let t=Array(e-=144);for(let i=0;i<e;i++)t[i]=fH();return t}}if(e<192){let t=e-160;if(fL>=fT)return fA.slice(fT-fR,(fT+=t)-fR);if(0==fL&&fS<140){let e=t<16?f4(t):f3(t);if(null!=e)return e}return fQ(t)}{let t;switch(e){case 192:return null;case 193:return fM?(t=fH())>0?fM[1].slice(fM.position1,fM.position1+=t):fM[0].slice(fM.position0,fM.position0-=t):fN;case 194:return!1;case 195:return!0;case 196:return f5(fw[fT++]);case 197:return t=fC.getUint16(fT),fT+=2,f5(t);case 198:return t=fC.getUint32(fT),fT+=4,f5(t);case 199:return f6(fw[fT++]);case 200:return t=fC.getUint16(fT),fT+=2,f6(t);case 201:return t=fC.getUint32(fT),fT+=4,f6(t);case 202:if(t=fC.getFloat32(fT),fI.useFloat32>2){let e=ms[(127&fw[fT])<<1|fw[fT+1]>>7];return fT+=4,(e*t+(t>0?.5:-.5)>>0)/e}return fT+=4,t;case 203:return t=fC.getFloat64(fT),fT+=8,t;case 204:return fw[fT++];case 205:return t=fC.getUint16(fT),fT+=2,t;case 206:return t=fC.getUint32(fT),fT+=4,t;case 207:return t=fI.int64AsNumber?4294967296*fC.getUint32(fT)+fC.getUint32(fT+4):fC.getBigUint64(fT),fT+=8,t;case 208:return fC.getInt8(fT++);case 209:return t=fC.getInt16(fT),fT+=2,t;case 210:return t=fC.getInt32(fT),fT+=4,t;case 211:return t=fI.int64AsNumber?4294967296*fC.getInt32(fT)+fC.getUint32(fT+4):fC.getBigInt64(fT),fT+=8,t;case 212:if(114==(t=fw[fT++]))return f7(63&fw[fT++]);{let e=fB[t];if(e)return e.read?(fT++,e.read(fH())):e.noBuffer?(fT++,e()):e(fw.subarray(fT,++fT));throw Error("Unknown extension "+t)}case 213:return 114==(t=fw[fT])?(fT++,f7(63&fw[fT++],fw[fT++])):f6(2);case 214:return f6(4);case 215:return f6(8);case 216:return f6(16);case 217:return t=fw[fT++],fL>=fT?fA.slice(fT-fR,(fT+=t)-fR):fZ(t);case 218:return t=fC.getUint16(fT),fT+=2,fL>=fT?fA.slice(fT-fR,(fT+=t)-fR):fK(t);case 219:return t=fC.getUint32(fT),fT+=4,fL>=fT?fA.slice(fT-fR,(fT+=t)-fR):fJ(t);case 220:return t=fC.getUint16(fT),fT+=2,f0(t);case 221:return t=fC.getUint32(fT),fT+=4,f0(t);case 222:return t=fC.getUint16(fT),fT+=2,f1(t);case 223:return t=fC.getUint32(fT),fT+=4,f1(t);default:if(e>=224)return e-256;if(void 0===e){let e=Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}throw Error("Unknown MessagePack token "+e)}}}var fW=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function fq(e,t){function i(){if(i.count++>fk){let i=e.read=Function("r","return function(){return {"+e.map(e=>fW.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()").join(",")+"}}")(fH);return 0===e.highByte&&(e.read=fX(t,e.read)),i()}let r={};for(let t=0,i=e.length;t<i;t++)r[e[t]]=fH();return r}return i.count=0,0===e.highByte?fX(t,i):i}var fX=(e,t)=>function(){let i=fw[fT++];if(0===i)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),a=f_[r]||fY()[r];if(!a)throw Error("Record id is not defined for "+r);return a.read||(a.read=fq(a,e)),a.read()};function fY(){let e=mi(()=>(fw=null,fI.getStructures()));return f_=fI._mergeStructures(e,f_)}var fQ=f$,fZ=f$,fK=f$,fJ=f$;function f$(e){let t;if(e<16&&(t=f4(e)))return t;if(e>64&&fb)return fb.decode(fw.subarray(fT,fT+=e));let i=fT+e,r=[];for(t="";fT<i;){let e=fw[fT++];if((128&e)==0)r.push(e);else if((224&e)==192){let t=63&fw[fT++];r.push((31&e)<<6|t)}else if((240&e)==224){let t=63&fw[fT++],i=63&fw[fT++];r.push((31&e)<<12|t<<6|i)}else if((248&e)==240){let t=(7&e)<<18|(63&fw[fT++])<<12|(63&fw[fT++])<<6|63&fw[fT++];t>65535&&(t-=65536,r.push(t>>>10&1023|55296),t=56320|1023&t),r.push(t)}else r.push(e);r.length>=4096&&(t+=f2.apply(String,r),r.length=0)}return r.length>0&&(t+=f2.apply(String,r)),t}function f0(e){let t=Array(e);for(let i=0;i<e;i++)t[i]=fH();return t}function f1(e){if(fI.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[f9()]=fH();return t}{let t=new Map;for(let i=0;i<e;i++)t.set(fH(),fH());return t}}var f2=String.fromCharCode;function f3(e){let t=fT,i=Array(e);for(let r=0;r<e;r++){let e=fw[fT++];if((128&e)>0){fT=t;return}i[r]=e}return f2.apply(String,i)}function f4(e){if(e<4){if(e<2){if(0===e)return"";{let e=fw[fT++];if((128&e)>1){fT-=1;return}return f2(e)}}{let t=fw[fT++],i=fw[fT++];if((128&t)>0||(128&i)>0){fT-=2;return}if(e<3)return f2(t,i);let r=fw[fT++];if((128&r)>0){fT-=3;return}return f2(t,i,r)}}{let t=fw[fT++],i=fw[fT++],r=fw[fT++],a=fw[fT++];if((128&t)>0||(128&i)>0||(128&r)>0||(128&a)>0){fT-=4;return}if(e<6){if(4===e)return f2(t,i,r,a);{let e=fw[fT++];if((128&e)>0){fT-=5;return}return f2(t,i,r,a,e)}}if(e<8){let o=fw[fT++],l=fw[fT++];if((128&o)>0||(128&l)>0){fT-=6;return}if(e<7)return f2(t,i,r,a,o,l);let h=fw[fT++];if((128&h)>0){fT-=7;return}return f2(t,i,r,a,o,l,h)}{let o=fw[fT++],l=fw[fT++],h=fw[fT++],c=fw[fT++];if((128&o)>0||(128&l)>0||(128&h)>0||(128&c)>0){fT-=8;return}if(e<10){if(8===e)return f2(t,i,r,a,o,l,h,c);{let e=fw[fT++];if((128&e)>0){fT-=9;return}return f2(t,i,r,a,o,l,h,c,e)}}if(e<12){let d=fw[fT++],p=fw[fT++];if((128&d)>0||(128&p)>0){fT-=10;return}if(e<11)return f2(t,i,r,a,o,l,h,c,d,p);let f=fw[fT++];if((128&f)>0){fT-=11;return}return f2(t,i,r,a,o,l,h,c,d,p,f)}{let d=fw[fT++],p=fw[fT++],f=fw[fT++],m=fw[fT++];if((128&d)>0||(128&p)>0||(128&f)>0||(128&m)>0){fT-=12;return}if(e<14){if(12===e)return f2(t,i,r,a,o,l,h,c,d,p,f,m);{let e=fw[fT++];if((128&e)>0){fT-=13;return}return f2(t,i,r,a,o,l,h,c,d,p,f,m,e)}}{let g=fw[fT++],v=fw[fT++];if((128&g)>0||(128&v)>0){fT-=14;return}if(e<15)return f2(t,i,r,a,o,l,h,c,d,p,f,m,g,v);let y=fw[fT++];if((128&y)>0){fT-=15;return}return f2(t,i,r,a,o,l,h,c,d,p,f,m,g,v,y)}}}}}function f5(e){return fI.copyBuffers?Uint8Array.prototype.slice.call(fw,fT,fT+=e):fw.subarray(fT,fT+=e)}function f6(e){let t=fw[fT++];if(fB[t])return fB[t](fw.subarray(fT,fT+=e));throw Error("Unknown extension type "+t)}var f8=Array(4096);function f9(){let e=fw[fT++];if(!(e>=160)||!(e<192))return fT--,fH();if(e-=160,fL>=fT)return fA.slice(fT-fR,(fT+=e)-fR);if(!(0==fL&&fS<180))return fQ(e);let t=(e<<5^(e>1?fC.getUint16(fT):e>0?fw[fT]:0))&4095,i=f8[t],r=fT,a=fT+e-3,o,l=0;if(i&&i.bytes==e){for(;r<a;){if((o=fC.getUint32(r))!=i[l++]){r=1879048192;break}r+=4}for(a+=3;r<a;)if((o=fw[r++])!=i[l++]){r=1879048192;break}if(r===a)return fT=r,i.string;a-=3,r=fT}for(i=[],f8[t]=i,i.bytes=e;r<a;)o=fC.getUint32(r),i.push(o),r+=4;for(a+=3;r<a;)o=fw[r++],i.push(o);let h=e<16?f4(e):f3(e);return null!=h?i.string=h:i.string=fQ(e)}var f7=(e,t)=>{var i=fH();let r=e;void 0!==t&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let a=f_[e];return a&&a.isShared&&((f_.restoreStructures||(f_.restoreStructures=[]))[e]=a),f_[e]=i,i.read=fq(i,r),i.read()},me="object"==typeof self?self:global;fB[0]=()=>{},fB[0].noBuffer=!0,fB[101]=()=>{let e=fH();return(me[e[0]]||Error)(e[1])},fB[105]=e=>{let t=fC.getUint32(fT-4);fE||(fE=new Map);let i=fw[fT],r,a={target:r=i>=144&&i<160||220==i||221==i?[]:{}};fE.set(t,a);let o=fH();return a.used?Object.assign(r,o):(a.target=o,o)}
3139,fB[112]=e=>{let t=fC.getUint32(fT-4),i=fE.get(t);return i.used=!0,i.target},fB[115]=()=>new Set(fH());var mt=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");function mi(e){let t=fS,i=fT,r=fO,a=fR,o=fL,l=fA,h=fD,c=fE,d=fM,p=new Uint8Array(fw.slice(0,fS)),f=f_,m=f_.slice(0,f_.length),g=fI,v=fU,y=e();return fS=t,fT=i,fO=r,fR=a,fL=o,fA=l,fD=h,fE=c,fM=d,fw=p,fU=v,(f_=f).splice(0,f_.length,...m),fI=g,fC=new DataView(fw.buffer,fw.byteOffset,fw.byteLength),y}function mr(){fw=null,fE=null,f_=null}fB[116]=e=>{let t=e[0],i=mt[t];if(!i)throw Error("Could not find typed array for code "+t);return new me[i](Uint8Array.prototype.slice.call(e,1).buffer)},fB[120]=()=>{let e=fH();return new RegExp(e[0],e[1])},fB[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=fT;fT+=t-4,(fM=[fH(),fH()]).position0=0,fM.position1=0;let r=fT;fT=i;try{return fH()}finally{fT=r}},fB[255]=e=>new Date(4==e.length?(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])*1e3:8==e.length?((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((3&e[3])*4294967296+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])*1e3:12==e.length?((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])*1e3:"invalid");var ms=Array(147);for(let e=0;e<256;e++)ms[e]=+("1e"+Math.floor(45.15-.30103*e));var ma=new fV({useRecords:!1});new Uint8Array((ma.unpack,ma.unpackMultiple,ma.unpack,new Float32Array(1)).buffer,0,4);try{mn=new TextEncoder}catch{}var mn,mo,ml,mh,mc,md,mu="u">typeof tA,mp=mu?tA.allocUnsafeSlow:Uint8Array,mf=mu?tA:Uint8Array,mm=mu?4294967296:2144337920,mg=0,mv=null,my=/[\u0080-\uFFFF]/,mx=Symbol("record-id"),mb=class extends fV{constructor(e){super(e),this.offset=0;let t,i,r,a,o,l=0,h=mf.prototype.utf8Write?function(e,t,i){return mh.utf8Write(e,t,i)}:!!mn&&!!mn.encodeInto&&function(e,t){return mn.encodeInto(e,mh.subarray(t)).written},c=this;e||(e={});let d=e&&e.sequential,p=e.structures||e.saveStructures,f=e.maxSharedStructures;if(null==f&&(f=p?32:0),f>8160)throw Error("Maximum maxSharedStructure is 8160");let m=e.maxOwnStructures;null==m&&(m=p?32:64),d&&!e.saveStructures&&(this.structures=[]);let g=f>32||m+f>64,v=f+64,y=f+m+64;if(y>8256)throw Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let x=[],b=0,w=0;this.pack=this.encode=function(e,h){if(mh||(mc=new DataView((mh=new mp(8192)).buffer,0,8192),mg=0),(md=mh.length-10)-mg<2048?(mc=new DataView((mh=new mp(mh.length)).buffer,0,mh.length),md=mh.length-10,mg=0):mg=mg+7&2147483640,t=mg,o=c.structuredClone?new Map:null,c.bundleStrings?(mv=["",""],mh[mg++]=214,mh[mg++]=98,mv.position=mg-t,mg+=4):mv=null,i=c.structures){i.uninitialized&&(i=c._mergeStructures(c.getStructures()));let e=i.sharedLength||0;if(e>f)throw Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let t=0;t<e;t++){let e=i[t];if(!e)continue;let r,a=i.transitions;for(let t=0,i=e.length;t<i;t++){let i=e[t];(r=a[i])||(r=a[i]=Object.create(null)),a=r}a[mx]=t+64}l=e}d||(i.nextId=e+64)}r&&(r=!1),a=i||[];try{if(S(e),mv){mc.setUint32(mv.position+t,mg-mv.position-t);let e=mv;mv=null,S(e[0]),S(e[1])}if(c.offset=mg,o&&o.idsToInsert){(mg+=6*o.idsToInsert.length)>md&&A(mg),c.offset=mg;let e=function(e,t){let i,r=6*t.length,a=e.length-r;for(t.sort((e,t)=>e.offset>t.offset?1:-1);i=t.pop();){let t=i.offset,o=i.id;e.copyWithin(t+r,t,a);let l=t+(r-=6);e[l++]=214,e[l++]=105,e[l++]=o>>24,e[l++]=o>>16&255,e[l++]=o>>8&255,e[l++]=255&o,a=t}return e}(mh.subarray(t,mg),o.idsToInsert);return o=null,e}return h&mP?(mh.start=t,mh.end=mg,mh):mh.subarray(t,mg)}finally{if(i){if(w<10&&w++,b>1e4)i.transitions=null,w=0,b=0,x.length>0&&(x=[]);else if(x.length>0&&!d){for(let e=0,t=x.length;e<t;e++)x[e][mx]=0;x=[]}if(r&&c.saveStructures){let r=i.sharedLength||f;i.length>r&&(i=i.slice(0,r));let a=mh.subarray(t,mg);return!1===c.saveStructures(i,l)?(c._mergeStructures(c.getStructures()),c.pack(e)):(l=r,a)}}h&mD&&(mg=t)}};let S=e=>{mg>md&&(mh=A(mg));var i,r=typeof e;if("string"===r){let t,r=e.length;if(mv&&r>=8&&r<4096){let t=my.test(e);mv[t?0:1]+=e,mh[mg++]=193,S(t?-r:r);return}t=r<32?1:r<256?2:r<65536?3:5;let a=3*r;if(mg+a>md&&(mh=A(mg+a)),r<64||!h){let a,o,l,h=mg+t;for(a=0;a<r;a++)(o=e.charCodeAt(a))<128?mh[h++]=o:(o<2048?mh[h++]=o>>
31396|192:((64512&o)==55296&&(64512&(l=e.charCodeAt(a+1)))==56320?(o=65536+((1023&o)<<10)+(1023&l),a++,mh[h++]=o>>18|240,mh[h++]=o>>12&63|128):mh[h++]=o>>12|224,mh[h++]=o>>6&63|128),mh[h++]=63&o|128);i=h-mg-t}else i=h(e,mg+t,a);i<32?mh[mg++]=160|i:i<256?(t<2&&mh.copyWithin(mg+2,mg+1,mg+1+i),mh[mg++]=217,mh[mg++]=i):i<65536?(t<3&&mh.copyWithin(mg+3,mg+2,mg+2+i),mh[mg++]=218,mh[mg++]=i>>8,mh[mg++]=255&i):(t<5&&mh.copyWithin(mg+5,mg+3,mg+3+i),mh[mg++]=219,mc.setUint32(mg,i),mg+=4),mg+=i}else if("number"===r){if(e>>>0===e)e<64?mh[mg++]=e:e<256?(mh[mg++]=204,mh[mg++]=e):e<65536?(mh[mg++]=205,mh[mg++]=e>>8,mh[mg++]=255&e):(mh[mg++]=206,mc.setUint32(mg,e),mg+=4);else if(e>>0===e)e>=-32?mh[mg++]=256+e:e>=-128?(mh[mg++]=208,mh[mg++]=e+256):e>=-32768?(mh[mg++]=209,mc.setInt16(mg,e),mg+=2):(mh[mg++]=210,mc.setInt32(mg,e),mg+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){let i;if(mh[mg++]=202,mc.setFloat32(mg,e),t<4||(i=e*ms[(127&mh[mg])<<1|mh[mg+1]>>7])>>0===i){mg+=4;return}mg--}mh[mg++]=203,mc.setFloat64(mg,e),mg+=8}}else if("object"===r){if(e){if(o){let i=o.get(e);if(i){if(!i.id){let e=o.idsToInsert||(o.idsToInsert=[]);i.id=e.push(i)}mh[mg++]=214,mh[mg++]=112,mc.setUint32(mg,i.id),mg+=4;return}o.set(e,{offset:mg-t})}let r=e.constructor;if(r===Object)_(e,!0);else if(r===Array){(i=e.length)<16?mh[mg++]=144|i:i<65536?(mh[mg++]=220,mh[mg++]=i>>8,mh[mg++]=255&i):(mh[mg++]=221,mc.setUint32(mg,i),mg+=4);for(let t=0;t<i;t++)S(e[t])}else if(r===Map)for(let[t,r]of((i=e.size)<16?mh[mg++]=128|i:i<65536?(mh[mg++]=222,mh[mg++]=i>>8,mh[mg++]=255&i):(mh[mg++]=223,mc.setUint32(mg,i),mg+=4),e))S(t),S(r);else{for(let t=0,i=mo.length;t<i;t++)if(e instanceof ml[t]){let i,r=mo[t];if(r.write){r.type&&(mh[mg++]=212,mh[mg++]=r.type,mh[mg++]=0),S(r.write.call(this,e));return}let a=mh,o=mc,l=mg;mh=null;try{i=r.pack.call(this,e,e=>(mh=a,a=null,(mg+=e)>md&&A(mg),{target:mh,targetView:mc,position:mg-e}),S)}finally{a&&(mh=a,mc=o,mg=l,md=mh.length-10)}i&&(i.length+mg>md&&A(i.length+mg),mg=function(e,t,i,r){let a=e.length;switch(a){case 1:t[i++]=212;break;case 2:t[i++]=213;break;case 4:t[i++]=214;break;case 8:t[i++]=215;break;case 16:t[i++]=216;break;default:a<256?(t[i++]=199,t[i++]=a):(a<65536?(t[i++]=200,t[i++]=a>>8):(t[i++]=201,t[i++]=a>>24,t[i++]=a>>16&255,t[i++]=a>>8&255),t[i++]=255&a)}return t[i++]=r,t.set(e,i),i+=a}(i,mh,mg,r.type));return}_(e,!e.hasOwnProperty)}}else mh[mg++]=192}else if("boolean"===r)mh[mg++]=e?195:194;else if("bigint"===r){if(e<BigInt(1)<<BigInt(63)&&e>=-(BigInt(1)<<BigInt(63)))mh[mg++]=211,mc.setBigInt64(mg,e);else if(e<BigInt(1)<<BigInt(64)&&e>0)mh[mg++]=207,mc.setBigUint64(mg,e);else if(this.largeBigIntToFloat)mh[mg++]=203,mc.setFloat64(mg,Number(e));else throw RangeError(e+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");mg+=8}else if("undefined"===r)this.encodeUndefinedAsNil?mh[mg++]=192:(mh[mg++]=212,mh[mg++]=0,mh[mg++]=0);else if("function"===r)S(this.writeFunction&&this.writeFunction());else throw Error("Unknown type: "+r)},_=!1===this.useRecords?this.variableMapSize?e=>{let t,i=Object.keys(e),r=i.length;r<16?mh[mg++]=128|r:r<65536?(mh[mg++]=222,mh[mg++]=r>>8,mh[mg++]=255&r):(mh[mg++]=223,mc.setUint32(mg,r),mg+=4);for(let a=0;a<r;a++)S(t=i[a]),S(e[t])}:(e,i)=>{mh[mg++]=222;let r=mg-t;mg+=2;let a=0;for(let t in e)(i||e.hasOwnProperty(t))&&(S(t),S(e[t]),a++);mh[r+++t]=a>>8,mh[r+t]=255&a}:e=>{let t=Object.keys(e),i,o=a.transitions||(a.transitions=Object.create(null)),l=0;for(let e=0,r=t.length;e<r;e++){let r=t[e];(i=o[r])||(i=o[r]=Object.create(null),l++),o=i}let h=o[mx];if(h)h>=96&&g?(mh[mg++]=(31&(h-=96))+96,mh[mg++]=h>>5):mh[mg++]=h;else{(h=a.nextId)||(h=64),h<v&&this.shouldShareStructure&&!this.shouldShareStructure(t)?((h=a.nextOwnId)<y||(h=v),a.nextOwnId=h+1):(h>=y&&(h=v),a.nextId=h+1);let e=t.highByte=h>=96&&g?h-96>>5:-1;o[mx]=h,a[h-64]=t,h<v?(t.isShared=!0,a.sharedLength=h-63,r=!0,e>=0?(mh[mg++]=(31&h)+96,mh[mg++]=e):mh[mg++]=h):(e>=0?(mh[mg++]=213,mh[mg++]=114,mh[mg++]=(31&h)+96,mh[mg++]=e):(mh[mg++]=212,mh[mg++]=114,mh[mg++]=h),l&&(b+=w*l),x.length>=m&&(x.shift()[mx]=0),x.push(o),S(t))}for(let i=0,r=t.length;i<r;i++)S(e[t[i]])},A=e=>{let i;if(e>
313916777216){if(e-t>mm)throw Error("Packed buffer would be larger than maximum buffer size");i=Math.min(mm,4096*Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096))}else i=(Math.max(e-t<<2,mh.length-1)>>12)+1<<12;let r=new mp(i);return mc=new DataView(r.buffer,0,i),mh.copy?mh.copy(r,0,t,e):r.set(mh.slice(t,e)),mg-=t,t=0,md=r.length-10,mh=r}}useBuffer(e){mc=new DataView((mh=e).buffer,mh.byteOffset,mh.byteLength),mg=0}};function mw(e,t,i,r){let a=e.byteLength;if(a+1<256){var{target:o,position:l}=i(4+a);o[l++]=199,o[l++]=a+1}else if(a+1<65536){var{target:o,position:l}=i(5+a);o[l++]=200,o[l++]=a+1>>8,o[l++]=a+1&255}else{var{target:o,position:l,targetView:h}=i(7+a);o[l++]=201,h.setUint32(l,a+1),l+=4}o[l++]=116,o[l++]=t,o.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),l)}function mS(e,t){let i=e.byteLength;if(i<256){var r,a,{target:r,position:a}=t(i+2);r[a++]=196,r[a++]=i}else if(i<65536){var{target:r,position:a}=t(i+3);r[a++]=197,r[a++]=i>>8,r[a++]=255&i}else{var{target:r,position:a,targetView:o}=t(i+5);r[a++]=198,o.setUint32(a,i),a+=4}r.set(e,a)}function m_(e){if(e.Class){if(!e.pack&&!e.write)throw Error("Extension has no pack or write function");if(e.pack&&!e.type)throw Error("Extension has no type (numeric code to identify the extension)");ml.unshift(e.Class),mo.unshift(e)}e.unpack?fB[e.type]=e.unpack:fB[e.type]=e}ml=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,fF],mo=[{pack(e,t,i){let r=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&r>=0&&r<4294967296){let{target:e,targetView:i,position:a}=t(6);e[a++]=214,e[a++]=255,i.setUint32(a,r)}else if(r>0&&r<17179869184){let{target:i,targetView:a,position:o}=t(10);i[o++]=215,i[o++]=255,a.setUint32(o,4e6*e.getMilliseconds()+(r/1e3/4294967296>>0)),a.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),i(this.onInvalidDate());let{target:e,targetView:r,position:a}=t(3);e[a++]=212,e[a++]=255,e[a++]=255}else{let{target:i,targetView:a,position:o}=t(15);i[o++]=199,i[o++]=12,i[o++]=255,a.setUint32(o,1e6*e.getMilliseconds()),a.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(e,t,i){let r=Array.from(e),{target:a,position:o}=t(this.structuredClone?3:0);this.structuredClone&&(a[o++]=212,a[o++]=115,a[o++]=0),i(r)}},{pack(e,t,i){let{target:r,position:a}=t(this.structuredClone?3:0);this.structuredClone&&(r[a++]=212,r[a++]=101,r[a++]=0),i([e.name,e.message])}},{pack(e,t,i){let{target:r,position:a}=t(this.structuredClone?3:0);this.structuredClone&&(r[a++]=212,r[a++]=120,r[a++]=0),i([e.source,e.flags])}},{pack(e,t){this.structuredClone?mw(e,16,t):mS(mu?tA.from(e):new Uint8Array(e),t)}},{pack(e,t){let i=e.constructor;i!==mf&&this.structuredClone?mw(e,mt.indexOf(i.name),t):mS(e,t)}},{pack(e,t){let{target:i,position:r}=t(1);i[r]=193}}];var mA=new mb({useRecords:!1});mA.pack,mA.pack;var{NEVER:mM,ALWAYS:mE,DECIMAL_ROUND:mC,DECIMAL_FIT:mT}={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},mP=512,mD=1024,mO=new mb({structuredClone:!0});function mI(e){return"MouseDown"===e||"MouseUp"===e||"KeyDown"===e||"KeyUp"===e||"Collision"===e||"Trigger"===e}m_({Class:pk.prototype.constructor,type:1,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,pk.prototype),e)}),m_({Class:pX.prototype.constructor,type:2,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,pX.prototype),e)}),m_({Class:pq.prototype.constructor,type:3,write:e=>[...e],read:e=>(Object.setPrototypeOf(e,pq.prototype),e)}),m_({Class:fp.prototype.constructor,type:4,write:e=>e.id,read:e=>new fp(e)}),m_({Class:ff.prototype.constructor,type:5,write:e=>e.data,read:e=>new ff(e)}),m_({Class:pJ.prototype.constructor,type:6,write:e=>({...e}),read:e=>(Object.setPrototypeOf(e,pJ.prototype),e)}),(e=>{function t(e){return mO.pack(e)}e.serialize=t,e.deserialize=function(e){return mO.unpack(e)},e.checksum=function(e){return(function(e){var t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e[i],t&=t;return t})(t(function e(t){if(pW(t))return t;if(Array.isArray(t))return t.map(e);if("object"!=typeof t||null===t)return t;{let i={};for(let r of Object.keys(t).sort())i[r]=e(t[r]);return Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}}(e))).toString()}})(mL||(mL={})),(mR=mB||(mB={})).toEventUIType=function(e){return"Conditional"===e.type?"Distance"===e.condition.type?"Distance":"StateChange":e.type},mR.fromEventUIType=function(e){return"Distance"===e||"StateChange"===e?"Conditional":e};var mR,mL,mB,mz,mF={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]};(mN=mz||(mz={})).is=function(e){return"MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type},mN.defaultData=function(e){return"MouseDown"===e||"MouseUp"===e||"MousePress"===e?{type:e,mode:"Object",disabled:!1,name:"",actions:new pX}
vendor: 4,293 bytes, line 3139
3139:{type:e,disabled:!1,name:"",key:void 0,actions:new pX}},(mU=m$||(m$={})).propertyDefaultData=function(e){return{type:"Property",value:[e??null,"position","x"]}},mU.valueDefaultData={type:"Literal",value:0},(mk=m0||(m0={})).comparisonDefaultData=function(e){return{type:"Comparison",operator:"==",lOperand:m$.propertyDefaultData(e),rOperand:{...m$.valueDefaultData}}},mk.distanceDefaultData=function(e){return{type:"Distance",toObject:e??null,fromObject:e??null,distance:200}},mk.stateDefaultData=function(e,t){return{type:"State",object:e??null,state:t??null}},(m1||(m1={})).isConditionalSubActions=function(e){return void 0!==e.find(e=>"ifActions"===e||"elseActions"===e)},(mV=m2||(m2={})).is=function(e){return"Conditional"===e.type},mV.defaultData=function(e){return{type:"Conditional",disabled:!1,name:"",inActions:new pX,outActions:new pX,condition:m0.distanceDefaultData(e)}},(m3||(m3={})).defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new pX,drop:new pX}},(m4||(m4={})).defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new pX},(m5||(m5={})).defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5},(mj=m6||(m6={})).is=function(e){return"MouseHover"===e.type},mj.defaultData=function(){return{type:"MouseHover",disabled:!1,name:"",actions:new pX}},(mG=m8||(m8={})).is=function(e){return"Scroll"===e.type},mG.defaultData=function(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new pX}},(mH=m9||(m9={})).is=function(e){return"Start"===e.type},mH.defaultData=function(){return{type:"Start",disabled:!1,name:"",actions:new pX}},(mW=m7||(m7={})).is=function(e){return"Collision"===e.type},mW.defaultData=function(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new pX}},(mq=ge||(ge={})).is=function(e){return"Trigger"===e.type},mq.defaultData=function(e,t){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new pX,triggerZone:"box",position:t.toArray(),rotation:[0,0,0],size:e.toArray(),radius:e.length()/2,helperVisible:!0}},(mX=gt||(gt={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},mX.is=function(e){return"Resize"===e.type},mX.sizeToDevice=function(e){return"string"==typeof e?e:"custom"},mX.deviceToSize=function(e){return"string"==typeof e?[...mX.defaultSizes[e]]:[...e]},mX.defaultData=function(){let e={size:"mobile",operator:"<",actions:new pX},t={size:"tablet",operator:"<",actions:new pX},i={size:[...mX.defaultSizes.custom],operator:"<>",actions:new pX},r=new pX;return r.push({id:t8.generateUUID(),fi:0,data:e},{id:t8.generateUUID(),fi:1,data:t},{id:t8.generateUUID(),fi:2,data:i}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:r}},mX.defaultBreakpointData=function(){return{size:[...mX.defaultSizes.custom],operator:"<>",actions:new pX}},(mY=gi||(gi={})).propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Ob
3139ject Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},mY.is=function(e){return"VariableChange"===e.type},mY.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new pX,variableId:"",objectId:null,property:"Position X"}},(mQ=gr||(gr={})).is=function(e){return"API"===e.type},mQ.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new pX,errorActions:new pX,userAPIId:""}},(mZ=gs||(gs={})).is=function(e){return"WEBHOOK"===e.type},mZ.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new pX,userWebhookId:""}},(mK=ga||(ga={})).is=function(e){return"AIAssistantListener"===e.type},mK.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new pX,analysis:"average",analysisRange:[0,71],analysisSingle:0}},(mJ=gn||(gn={})).is=function(e){return"AIAssistantTrigger"===e.type},mJ.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new pX}};var mN,mU,mk,mV,mj,mG,mH,mW,mq,mX,mY,mQ,mZ,mK,mJ,m$,m0,m1,m2,m3,m4,m5,m6,m8,m9,m7,ge,gt,gi,gr,gs,ga,gn,go,gl="personal camera",gh="a218fcc3-276b-49b9-b485-49037fd14f5f",gc=((r=g
vendor: 4,202 bytes, line 3139
3139c||{}).x="x",r.y="y",r.z="z",r);(e=>{function t(e,t){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function i(e,i){return Math.sqrt(t(e,i))}function r(t,i,r){let a=e.sub(i,t),o=e.sub(r,t),l=e.dot(a,o)/e.dot(a,a),h=e.scalarMultiply(a,l);return e.add(t,h)}e.isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i]},e.add=function(e,t){return[e[0]+t[0],e[1]+t[1]]},e.sub=function(e,t){return[e[0]-t[0],e[1]-t[1]]},e.multiply=function(e,t){return[e[0]*t[0],e[1]*t[1]]},e.divide=function(e,t){return[e[0]/t[0],e[1]/t[1]]},e.distanceSquared=t,e.distance=i,e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},e.scalarMultiply=function(e,t){return[e[0]*t,e[1]*t]},e.projectionOnto=r,e.projectionOntoDistance=function(e,t,a){return i(e,r(e,t,a))},e.center=function(e,t){return[(e[0]+t[0])*.5,(e[1]+t[1])*.5]}})(go||(go={})),(gd=gg||(gg={})).isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},gd.add=function(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]},gd.sub=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},gd.div=function(e,t){return[e[0]/t[0],e[1]/t[1],e[2]/t[2]]},gd.mul=function(e,t){return[e[0]*t[0],e[1]*t[1],e[2]*t[2]]},gd.dist=function(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])},gd.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i,e[2]+(t[2]-e[2])*i]},(gu=gv||(gv={})).isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},gu.lerp=function(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i,e[2]+(t[2]-e[2])*i,e[3]+(t[3]-e[3])*i]},(e=>{let t=180/Math.PI,i=Math.PI/180;function r(e){return"number"==typeof e?e*t:e}function a(e){return"number"==typeof e?e*i:e}e.radToDeg=function(e){return[r(e[0]),r(e[1]),r(e[2])]},e.degToRad=function(e){return[a(e[0]),a(e[1]),a(e[2])]}})(gy||(gy={})),(gp=gx||(gx={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],gp.isEqual=function(e,t){for(let i=0;i<16;i++)if(e[i]!==t[i])return!1;return!0},gp.simplify=function(e){return e??gp.identity},gp.applyMatrix4=function(e,t){let i=t.slice(0);for(var r=0,a=t.length;r<a;r+=3){let a=e[3]*t[r]+e[7]*t[r+1]+e[11]*t[r+2]+e[15];i[r]=(e[0]*t[r]+e[4]*t[r+1]+e[8]*t[r+2]+e[12])/a,i[r+1]=(e[1]*t[r]+e[5]*t[r+1]+e[9]*t[r+2]+e[13])/a,i[r+2]=(e[2]*t[r]+e[6]*t[r+1]+e[10]*t[r+2]+e[14])/a}return i},(gf=gb||(gb={})).isRGB=function(e){return"object"==typeof e&&"number"==typeof e.r&&"number"==typeof e.g&&"number"==typeof e.b},gf.white={r:1,g:1,b:1},gf.red={r:1,g:0,b:0},gf.black={r:0,g:0,b:0},gf.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:1}},gf.clone=function(e){return{r:e.r,g:e.g,b:e.b}},gf.fromHex=function(e){return{r:((e=Math.floor(e))>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}},gf.toHex=function(e){return 65536*Math.round(255*e.r)+256*Math.round(255*e.g)+Math.round(255*e.b)},gf.equals=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b},gf.equalsFixed=function(e,t){return e.r.toFixed(2)===t.r.toFixed(2)&&e.g.toFixed(2)===t.g.toFixed(2)&&e.b.toFixed(2)===t.b.toFixed(2)},gf.lerp=function(e,t,i){return{r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i}},gf.is=function(e){return!!h8(e)&&"r"in e&&"g"in e&&"b"in e&&!("a"in e)},(gm=gw||(gw={})).white={...gb.white,a:1},gm.is=function(e){return!!h8(e)&&"r"in e&&"g"in e&&"b"in e&&"a"in e},gm.transparent={...gb.white,a:0},gm.from0to1=function(e){return{r:e[0],g:e[1],b:e[2],a:e[3]}},gm.fromHexAndA=function(e,t){return{...gb.fromHex(e),a:t}},gm.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:e.a}},gm.equals=function(e,t){return gb.equals(e,t)&&e.a===t.a},gm.equalsFixed=function(e,t){return gb.equalsFixed(e,t)&&e.a.toFixed(2)===t.a.toFixed(2)},gm.lerp=function(e,t,i){return{r:e.r+(t.r-e.r)*i,g:e.g+(t.g-e.g)*i,b:e.b+(t.b-e.b)*i,a:e.a+(t.a-e.a)*i}},gm.toStyle=function({r:e,g:t,b:i,a:r}=gm.white){return`rgba(${255*e}, ${255*t}, ${255*i}, ${r})`},(gS||(gS={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]};var gd,gu,gp,gf,gm,gg,gv,gy,gx,gb,gw,gS,g_,gA=((a=gA||{})[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_O
3139UT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING",a[a.ARC=7]="ARC",a[a.NONE=8]="NONE",a);function gM(e){return"string"==typeof e&&36===e.length&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}(g_||(g_={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(gF||(gF={})).defaultData={control1:[.5,0],control2:[.5,1]},(o=gN||(gN={})).linear=[0,0,1,1],o.ease=[.25,.1,.25,1],o.easeIn=[.42,0,1,1],o.easeOut=[0,0,.58,1],o.easeInOut=[.42,0,.58,1],(gI=gU||(gU={})).all=["PerspectiveCamera","OrthographicCamera"],gI.is=function(e){return gI.all.includes(e)},(gR=gk||(gk={})).DefaultUp=[0,1,0],gR.DefaultTargetOffset=1e3,gR.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:gR.DefaultUp,isUpVectorFlipped:!1,targetOffset:gR.DefaultTargetOffset},gR.getZoom=function(e){return"PerspectiveCamera"===e.type?e.perspective?.zoom??1:e.orthographic?.zoom??1},(gL=gV||(gV={})).defaultData=function(e,t=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:2*Math.max("number"==typeof e[0]?e[0]:1,"number"==typeof e[1]?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[("number"==typeof e[0]?e[0]+e[0]:1)*t,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map(e=>("number"==typeof e?e:1)*(1+t)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},gL.merge=function(e,t){let i={...e};if(gE.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i.radial={...e.radial},t.radial){let r=e.radial,a=t.radial;gC.forEach(e=>{Object.assign(i.radial,{[e]:a[e]??r[e]})})}if(i.linear={...e.linear},t.linear){let r=e.linear,a=t.linear;gT.forEach(e=>{Object.assign(i.linear,{[e]:a[e]??r[e]})})}if(i.grid={...e.grid},t.grid){let r=e.grid,a=t.grid;gP.forEach(e=>{Object.assign(i.grid,{[e]:a[e]??r[e]})})}if(i.toObject={...e.toObject},t.toObject){let r=e.toObject,a=t.toObject;gD.forEach(e=>{Object.assign(i.toObject,{[e]:a[e]??r[e]})})}if(i.randomnessObject={...e.randomnessObject},t.randomnessObject){let r=e.randomnessObject,a=t.randomnessObject;gO.forEach(e=>{Object.assign(i.randomnessObject,{[e]:a[e]??r[e]})})}return i},gL.isPartial=function(e){return!!(e.randomnessObject||e.toObject)},(gB=gj||(gj={})).defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}},l=["radial","linear","grid","toObject","randomnessObject"],gB.toOps=function(e,t){let i=[];for(let r of(void 0!==e.count&&i.push({type:0,path:t,props:{count:e.count}}),l)){let a=e[r];a&&Object.keys(a).length>0&&i.push({type:0,path:[...t,r],props:a})}return i};var gE=["count"],gC=["radius","start","end","position","scale","rotation"],gT=["position","scale","rotation"],gP=["count","size"],gD=["count","position","scale","rotation"],gO=["strength","scale","rotation","position","movement","seed","freqScale"];(gz=gG||(gG={})).all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],gz.is=function(e){return gz.all.includes(e)},(gH||(gH={})).defaultData=function(e){return function(e){if("PointLight"===e)return{type:e,color:gw.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if("SpotLight"===e)return{type:e,color:gw.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if("DirectionalLight"===e)return{type:e,color:gw.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw Error("not implemented")}(e)},(h=gW||(gW={})).defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},h.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},h.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:h.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...h.defaultCollisionData},(gq||(gq={})).defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]};var gI,gR,gL,gB,gz,gF,gN,gU,gk,gV,gj,gG,gH,gW,gq,gX,gY=((c=gY||{})[c.Front=0]="Front",c[c.Back=1]="Back",c[c.Double=2]="Double",c);(gQ=gX||(gX={})).defaultData={castShadow:!0,receiveShadow:!0}
vendor: 12,034 bytes, line 3139
3139,gQ.equals=function(e,t){return e.castShadow===t.castShadow&&e.receiveShadow===t.receiveShadow},(gZ=gK||(gK={})).defaultData={flatShading:!1,wireframe:!1,side:0},gZ.equals=function(e,t){return e.flatShading===t.flatShading&&e.side===t.side&&e.wireframe===t.wireframe},(gJ||(gJ={})).defaultData={...gK.defaultData,...gX.defaultData},(g$||(g$={})).getMaterialData=function(e,t){let i=[];if("material"in e){let r="string"==typeof e.material?t.materials[e.material]??t.lib.materials[e.material]?.asset:e.material;r&&i.push(r)}else if("materials"in e)for(let r of e.materials){let e="string"==typeof r?t.materials[r]??t.lib.materials[r]?.asset:r;e&&i.push(e)}return i},(d=g0||(g0={})).defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},d.maxSize=3e7,(g1||(g1={})).is=function(e){return"texture"===e||"video"===e||"color"===e||"depth"===e||"normal"===e||"gradient"===e||"noise"===e||"fresnel"===e||"rainbow"===e||"toon"===e||"outline"===e||"particle"===e||"transmission"===e||"matcap"===e||"displace"===e||"pattern"===e||"light"===e},(g2||(g2={})).is=function(e){return"phong"===e||"toon"===e||"lambert"===e||"physical"===e};var gQ,gZ,gK,gJ,g$,g0,g1,g2,g3,g4=((p=g4||{})[p.Linear=0]="Linear",p[p.Radial=1]="Radial",p[p.Polar=2]="Polar",p),g5=((f=g5||{})[f.RepeatWrapping=1e3]="RepeatWrapping",f[f.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",f[f.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",f),g6=((m=g6||{})[m.NearestFilter=1003]="NearestFilter",m[m.LinearFilter=1006]="LinearFilter",m[m.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",m),g8=((g=g8||{})[g.UV=0]="UV",g[g.Planar=1]="Planar",g[g.Spherical=2]="Spherical",g[g.Cylindrical=3]="Cylindrical",g[g.Triplanar=4]="Triplanar",g),g9=((v=g9||{})[v.Simplex=0]="Simplex",v[v.SimplexFractal=1]="SimplexFractal",v[v.Ashima=2]="Ashima",v[v.Fbm=3]="Fbm",v[v.Perlin=4]="Perlin",v[v.Voronoi=5]="Voronoi",v),g7=((y=g7||{})[y.F1=0]="F1",y[y.F2=1]="F2",y[y.F2MinusF1=2]="F2MinusF1",y[y.SmoothBlend=3]="SmoothBlend",y[y.Edge=4]="Edge",y[y.Power=5]="Power",y[y.Lines=6]="Lines",y[y.Cells=7]="Cells",y),ve=((x=ve||{})[x.Lights=0]="Lights",x[x.Static=1]="Static",x[x.Camera=2]="Camera",x),vt=((b=vt||{})[b.Circle=0]="Circle",b[b.Ring=1]="Ring",b[b.Polygon=2]="Polygon",b[b.Cross=3]="Cross",b[b.Diamond=4]="Diamond",b[b.Checkerboard=5]="Checkerboard",b[b.Line=6]="Line",b[b.Wave=7]="Wave",b),vi=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],vr=["wrapping","image","video","name","minFilter","magFilter"];(vu=g3||(g3={})).patch=function(e,t){let{texture:i,...r}=t;if(Object.assign(e,r),i){let t=e.texture;t&&Object.assign(t,i)}},vu.defaultColorLayer=function(e){return{...vu.defaultData("color"),color:e}},vu.defaultData=function(e,t){return"light"===e&&t?function(e){let t={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(e){case"phong":return{...t,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...t,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...t,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...t,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}(t):function(e){let t={alpha:1,mode:0,isMask:!1,visible:!0};switch(e){case"texture":return{...t,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...t,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:g0.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...t,type:"color",color:gb.fromHex(5526619)};case"depth":return{...t,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...t,type:"normal",cnormal:[1,1,1]};case"gradient":return{...t,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...t,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...gb.fromHex(6710886),a:1},colorB:{...gb.fromHex(6710886),a:1},colorC:{...gb.fromHex(16777215),a:1},colorD:{...gb.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"fresnel":return{...t,type:"fresnel",color:gw.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...t,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...t,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:gw.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...t,type:"outline",outlineColor:gw.fromHexAndA(0,1),contourColor:gw.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...t,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...t,type:"transmission",thickness:10,ior:1.5,roughness:1};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...t,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...gb.fromHex(0),a:1},colorB:{...gb.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}(e)},(e=>{function t(e,t="layer1",i="layer2",r=gb.fromHex(16777215)){let a=new pX;return a.push({fi:0,data:g3.defaultData("light",e),id:t}),a.push({fi:1,data:g3.defaultData("color"),id:i}),{layers:a}}e.isMergable=function(e){return!e.layers.some(e=>"texture"===e.data.type&&0!==e.data.projection||"depth"===e.data.type&&!e.data.isWorldSpace||"noise"===e.data.type||"displace"===e.data.type)},e.getHash=function(e){let t="";return e.layers.forEach(e=>{Object.entries(e.data).forEach(([e,i])=>{t+=`${e}${i}`,Array.isArray(i)?i.forEach(e=>t+=`${e}`):"object"==typeof i?Object.values(i).forEach(e=>{"number"==typeof e?t+=`${e.toFixed(4)}`:t+=`${e}`}):t+=`${i}`})}),t},e.defaultEmptyData=function(){return{layers:new pX}},e.defaultData=function(e="layer1",i="layer2"){return t("phong",e,i)},e.withName=function(e,t){return{...e,name:t}},e.defaultTwoLayerData=t,e.defaultColorMaterial=function(e,t,i="layer1",r="layer2"){let a=new pX;return a.push({fi:0,data:g3.defaultData("light",t),id:i}),a.push({fi:1,data:g3.defaultColorLayer(e),id:r}),{layers:a}},e.defaultUIObjectMaterial=function(e){let t=g3.defaultData("texture");e&&Object.assign(t.texture,{image:e});let i=new pX;return i.push({fi:0,data:t,id:"layer1"}),i.push({fi:1,data:{...g3.defaultData("transmission"),alpha:1},id:"layer2"}),i.push({fi:2,data:{...g3.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:i}},e.defaultTwoLayerTextureData=function(e,t="phong",i="layer1",r="layer2"){let a=g3.defaultData("texture");Object.assign(a.texture,{image:e});let o=new pX;return o.push({fi:0,data:a,id:i}),o.push({fi:1,data:g3.defaultData("light",t),id:r}),{layers:o}},e.defaultTwoLayerVideoTextureData=function(e,t="phong",i="layer1",r="layer2"){let a=g3.defaultData("video");Object.assign(a.texture,{video:e});let o=new pX;return o.push({fi:0,data:a,id:i}),o.push({fi:1,data:g3.defaultData("light",t),id:r}),{layers:o}}})(vv||(vv={})),(vy||(vy={})).defaultData=function(){return{points:new pX,roundness:0,shapeHoles:[],isClosed:!1}},(vx||(vx={})).defaultData=function(){return{points:new pX,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}};var vs={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(vb||(vb={})).merge=function(e,t){let i={...e};return vn.forEach(r=>{Object.assign(i,{[r]:t[r]??e[r]})}),i};var va={shape:vs,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},vn=["depth","offset","angle","twist","startScale","endScale"];(vp=vw||(vw={})).is2DParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"UIGeometry"===e},vp.isParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"BooleanGeometry"===e||"TextGeometry"===e||"InputGeometry"===e},vp.isSwappableGeometry=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"TextGeometry"===e||"SubdivGeometry"===e||"NonParametricGeometry"===e},(vS||(vS={})).merge=function(e,t){let i={...e};return Object.assign(i,t),"PathGeometry"===i.type&&"extrusion"in t&&t.extrusion&&(i.extrusion={...e.extrusion},Object.assign(i.extrusion,vb.merge(i.extrusion,t.extrusion))),i},(vf=v_||(v_={})).defaultData=function(e){if("RectangleGeometry"===e)return{width:320,height:320,type:e,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("UIGeometry"===e)return{type:e,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if("PathGeometry"===e)return{type:e,width:1,height:1,depth:1,path:vx.defaultData(),extrusion:va};if("VectorGeometry"===e)return{width:1,height:1,type:e,subdivisions:12,shape:vy.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("BooleanGeometry"===e)return{type:e,operation:2,width:0,height:0,depth:0,phongAngle:35};if("ShapeBlendGeometry"===e)return{type:e,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if("TextGeometry"===e)return{type:e,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if("InputGeometry"===e)return{...vf.defaultData("TextGeometry"),type:e,editable:!0};if("SphereGeometry"===e)return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw Error("not implemented")};var vo=["width","height","depth"];function vl(e){for(let t of Object.keys(e))void 0===e[t]&&delete e[t];return e}function vh(e,t){return Object.setPrototypeOf(e,t),e}function vc(e){return Array.isArray(e)?e:[e]}function vd(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return -1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}(vA||(vA={}
vendor: 4,094 bytes, line 3139
3139)).defaultData={enabled:!1,useBackgroundColor:!1,color:gb.white,near:.1,far:2e3},w={opacity:1,blendFunction:13,enabled:!1},(vM||(vM={})).defaultData={enabled:!1,pixelation:{...w,blendFunction:16,granularity:15},bloom:{...w,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...w,offset:[2,2]},vignette:{...w,darkness:1,offset:0},hueSaturation:{...w,hue:3,saturation:0},brightnessContrast:{...w,brightness:.25,contrast:0},depthOfField:{...w,focusDistance:100,focalLength:20,bokehScale:5},noise:{...w,blendFunction:16}},(vE||(vE={})).defaultData={softShadowQuality:"low"},(vC||(vC={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},(vT||(vT={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(vP||(vP={})).defaultData={usePhysics:!1,gravity:-10},(vD||(vD={})).defaultData={playCamera:gl,gameControlObject:null},(vO||(vO={})).defaultData={backgroundColor:gw.fromHexAndA(3815994,1),postprocessing:vM.defaultData,fog:vA.defaultData,globalPhysics:vP.defaultData,ambient:vC.defaultData,ao:vT.defaultData,shadow:vE.defaultData,publish:vD.defaultData},(vI||(vI={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95},(vm=vR||(vR={})).isComponentRelated=function(e){return"Component"===e||"Instance"===e},vm.isEmptyOrComponent=function(e){return"Empty"===e||"Instance"===e},(vg=vL||(vL={})).identity={...gS.identity,hiddenMatrix:gx.identity},vg.fromObject=function(e){return{position:e.position,rotation:e.rotation,scale:e.scale,pivot:e.pivot,pivotRotation:e.pivotRotation,hiddenMatrix:e.hiddenMatrix}},vg.merge=function(e,t){return{position:t?.position||e.position,rotation:t?.rotation||e.rotation,pivot:t?.pivot||e.pivot,pivotRotation:t?.pivotRotation||e.pivotRotation,scale:t?.scale||e.scale,hiddenMatrix:t?.hiddenMatrix||e.hiddenMatrix}},vg.diff=function(e,t){return vl({position:gg.isEqual(e.position,t.position)?void 0:t.position,rotation:gg.isEqual(e.rotation,t.rotation)?void 0:t.rotation,scale:gg.isEqual(e.scale,t.scale)?null:t.scale,hiddenMatrix:gx.isEqual(e.hiddenMatrix,t.hiddenMatrix)?void 0:t.hiddenMatrix})};var vu,vp,vf,vm,vg,vv,vy,vx,vb,vw,vS,v_,vA,vM,vE,vC,vT,vP,vD,vO,vI,vR,vL,vB,vz=["slide","offset"];function vF(e){e.layers.forEach(e=>{if("depth"===e.type&&void 0!==e.colorA){let t=e.colorA,i=e.colorB,r=[[t.r,t.g,t.b,t.a],[i.r,i.g,i.b,i.a]],a=[0,1];for(let e=2;e<10;e++)r.push(r[1]),a.push(1);let o={...po(fc(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,e.near),far:Math.max(0,e.far),colors:r,steps:a,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(e,o)}else if("depth"===e.type&&1===e.gradientType&&(e.near<0||e.far<0)){let t={...fc(e),near:Math.max(e.near,0),far:Math.max(e.far,0)};Object.assign(e,t)}})}function vN(e,t){Object.values(e.shared.materials).forEach(e=>t(e))}function vU(e,t){e.scene.objects.traverse((e,i)=>{"materials"in i?i.materials.forEach((e,r)=>{void 0===e&&(i.materials[r]=vv.defaultData(),e=i.materials[r]),"string"!=typeof e&&t(e)}):"material"in i?"string"!=typeof i.material&&(void 0===i.material&&(i.material=vv.defaultData()),t(i.material)):"Mesh"===i.type&&(void 0===i.material&&(i.material=vv.defaultData()),t(i.material)),"overrides"in i&&Object.values(i.overrides).forEach(e=>{e.material&&"string"!=typeof e.material&&Object.getPrototypeOf(e.material)!==pJ.prototype&&t(e.material)})})}function vk(e){void 0===e.layers&&Object.assign(e,vv.defaultTwoLayerData("lambert"))}function vV(e){e.layers&&e.layers.forEach(e=>{if("depth"===e.type&&10===e.colors.length){let t=[...e.colors];t.push(e.colors[9]);let i=[...e.steps];i.push(e.steps[9]);let r={...fc(e),colors:t,steps:i};Object.assign(e,r)}})}function vj(e){e.scene.objects.traverse((e,t)=>{"materials"in t?t.materials.forEach(e=>{"string"!=typeof e&&vV(e)}):"material"in t&&"string"!=typeof t.material&&vV(t.material)}
3139),Object.values(e.shared.materials).forEach(e=>vV(e))}function vG(e){e.layers&&e.layers.forEach(e=>{"depth"===e.type&&void 0!==e.num&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)})}function vH(e){e.layers&&e.layers.forEach(e=>{"displace"!==e.type&&void 0===e.isMask&&(e.isMask=!1),("texture"===e.type||"video"===e.type)&&void 0===e.blending&&(e.blending=0),("noise"===e.type||"displace"===e.type&&"noise"===e.displacementType)&&(void 0===e.voronoiStyle&&(e.voronoiStyle=0),void 0===e.highCut&&(e.highCut=1),void 0===e.lowCut&&(e.lowCut=0),void 0===e.smoothness&&(e.smoothness=.3),void 0===e.seed&&(e.seed=0),void 0===e.quality&&(e.quality=1))})}function vW(e){let t=e.layers.find(e=>"light"===e.type)?.data;t?.category==="basic"&&(Object.assign(t,g3.defaultData("light","phong")),t.visible=!1)}function vq(e){vN(e,vW),vU(e,vW)}function vX(e){e.layers.forEach(e=>{"light"===e.type&&"toon"!==e.category&&void 0===e.occlusion&&(e.occlusion=!0)})}function vY(e){e.layers&&e.layers.forEach(e=>{"light"===e.type&&void 0===e.bumpMapIntensity&&(e.bumpMapIntensity=5)})}function vQ(e){e.layers&&e.layers.forEach(e=>{"light"===e.type&&void 0===e.alphaOverride&&(e.alphaOverride=1)})}(vB||(vB={})).defaultData={states:new pX,events:new pX,timelineAnimations:new pk,visible:!0,raycastLock:!1,physics:gq.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...vL.identity,cloner:null},(yY||(yY={})).defaultData={type:"Empty",...vB.defaultData},(yQ||(yQ={})).defaultData={type:"ParticleCollider",...vI.defaultData,...vB.defaultData},(yZ||(yZ={})).defaultData={type:"Component",...vB.defaultData},(yK||(yK={})).defaultData={type:"Particle",...vB.defaultData,...gW.defaultData},(yJ||(yJ={})).defaultData={type:"Mesh",...vB.defaultData,...gJ.defaultData},(y$||(y$={})).defaultData={...vB.defaultData,...vL.identity,position:[0,0,gk.DefaultTargetOffset],...gk.defaultData},(yN=y0||(y0={})).defaultData=function(e){return{...vB.defaultData,...gH.defaultData(e)}},yN.defaultDirectionalLightData={...yN.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7},(e=>{function t(e,t,i=0){for(;i<t.length;){let r=e?e[t[i]]:void 0;if(t.length===i+1)return r;if(!r)return;e=r.descendants,i+=1}}e.resolveWithDes=t,e.resolve=function(e,i,r=0){let a=t(e,i,r);if(a){let e=Object.keys(a);if(1===e.length&&"descendants"===e[0])return}return a}})(y1||(y1={})),(e=>{function t(e,t){return{...vB.defaultData,...t,component:e,overrides:new pJ,physics:void 0,events:void 0,type:"Instance"}}e.rootOverrideProps=["physics","events"],e.compositeNonOptionalOverrideProps=["geometry"],e.compositeEntireOverrideOverrideProps=["material"],e.ofComponent=t,e.fromComponentData=function(e){let i=vL.fromObject(e.data);return t(e.id,i)}})(y2||(y2={})),(yU=y3||(y3={})).defaultData={type:"Page",...vB.defaultData,physics:{...gq.defaultData,fusedBody:!1},...vO.defaultData,camera:y$.defaultData},yU.isUIPage=function(e){return void 0!==e.uiScene},(S=y4||(y4={})).defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:gx.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:gq.defaultData,states:new pX,events:new pX,timelineAnimations:new pk,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...gk.defaultData},S.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},S.defaultMeshObject={name:"Rectangle",...vB.defaultData,...yJ.defaultData,geometry:v_.defaultData("RectangleGeometry"),material:vv.defaultTwoLayerData("phong","layer1","layer2")},S.defaultBooleanObject={name:"Boolean",...vB.defaultData,...yJ.defaultData,geometry:v_.defaultData("BooleanGeometry"),material:vv.defaultTwoLayerData("phong","layer1","layer2")},S.defaultShapeBlendObject={name:"Shape Blend",...vB.defaultData,...yJ.defaultData,geometry:v_.defaultData("ShapeBlendGeometry"),material:vv.defaultTwoLayerData("phong","layer1","layer2")},S.defaultTextObject={name:"Text",...vB.defaultData,...yJ.defaultData,geometry:v_.defaultData("TextGeometry"),material:vv.defaultTwoLayerData("phong","layer1","layer2")},S.defaultInputObject={name:"Input",...vB.defaultData,...yJ.defaultData,geometry:v_.defaultData("InputGeometry"),material:vv.defaultTwoLayerData("phong","layer1","layer2")},(yk=y5||(y5={}
3139)).newEmpty=function(e,t){let i={name:t};return"Mesh"===e.type?(i.geometry={},"material"in e&&(i.material={layers:new pJ}),"materials"in e&&(i.materials=e.materials.map(e=>({layers:new pJ})))):gU.is(e.type)&&(i.perspective={},i.orthographic={}),i},yk.toOps=function(e,t){let i,r=[],a={orthographic:0,perspective:0,geometry:0};function o(e,t){for(let[i,a]of Object.entries(t.layers)){let{texture:t,...o}=a;if(void 0!==t&&Object.keys(t).length>0){let a={path:[...e,"layers",i,"texture"],props:t,type:0};r.push(a)}if(Object.keys(o).length>0){let t={path:[...e,"layers",i],props:o,type:0};r.push(t)}}}for(let[e,l]of Object.entries(t))if("name"!==e){if("cloner"===e)r.push(...gj.toOps(l,["cloner"]));else if("pathSnapping"===e)r.push({path:[e],props:{slide:l.slide,offset:l.offset},type:0});else if("material"===e)o(["material"],l);else if("materials"===e)for(let[e,t]of Object.entries(l))o(["materials",e],t);else if(0===a[e]){if("geometry"===e&&void 0!==l.extrusion){let t={path:[e,"extrusion"],props:l.extrusion,type:0};r.push(t),l={...l},delete l.extrusion}if(Object.keys(l).length>0){let t={path:[e],props:l,type:0};r.push(t)}}else void 0===i&&(i={path:[],props:{},type:0},r.push(i)),i.props[e]=l}return r},yk.patch=function(e,t){if(void 0===t)return e;let i={...e};return(Object.assign(i,vL.merge(i,t)),Object.assign(i,{pathSnapping:Object.assign({},i.pathSnapping,{slide:t.pathSnapping?.slide??i.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??i.pathSnapping?.offset??0})}),gU.is(e.type))?(i.orthographic={...i.orthographic},i.perspective={...i.perspective},t.orthographic?.zoom!==void 0&&(i.orthographic.zoom=t.orthographic.zoom),t.perspective?.zoom!==void 0&&(i.perspective.zoom=t.perspective.zoom),void 0!==t.isUpVectorFlipped&&(i.isUpVectorFlipped=t.isUpVectorFlipped),void 0!==t.targetOffset&&(i.targetOffset=t.targetOffset)):"Mesh"===e.type?("geometry"in t&&Object.assign(i,{geometry:vS.merge(i.geometry,t.geometry)}),(t.material||t.materials)&&(i=function(e,t){if(void 0===t)return e;let i={...e};return"material"in i&&"material"in t&&t.material&&(i.material=fh(i.material,e=>{if("string"!=typeof e)for(let[i,r]of Object.entries(t.material.layers)){let t=e.layers.data(i);t&&g3.patch(t,r)}}).data),i.materials&&t.materials&&(i.materials=fh(i.materials,e=>{for(let r=0;r<i.materials.length;r++){let i=t.materials[r];if("string"!=typeof i)for(let[t,a]of Object.entries(i.layers)){let i=e[r]?.layers?.data(t);i&&g3.patch(i,a)}}}).data),i}(i,t)),i.cloner&&"cloner"in t&&Object.assign(i,{cloner:gV.merge(i.cloner,t.cloner)})):"Empty"===e.type?i.cloner&&"cloner"in t&&Object.assign(i,{cloner:gV.merge(i.cloner,t.cloner)}):gG.is(e.type)&&(void 0!==t.intensity&&(i.intensity=t.intensity),void 0!==t.color&&("string"==typeof t.color?i.color=t.color:i.color=gb.clone(t.color))),i},(y6||(y6={})).defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0},(y8||(y8={})).defaultData={orbitControls:y6.defaultData,playPage:gh,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((e,t)=>{let i=0,r=0;return t<5?r=-30:t<10&&(r=30),0===t||10===t||5===t?i=30:(4===t||11===t||9===t)&&(i=-30),[120,[i,r],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1},(y9||(y9={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(y7||(y7={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(_=xe||(xe={})).defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...y9.defaultData},isRandomSeed:!0,seed:_.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:y7.defaultData}),_.generateSeed=()=>Math.round(1e5*Math.random()),(yV=xt||(xt={})).physicsEnabled=function(e){return void 0!==e.find(e=>"Page"===e.data.type&&e.data.globalPhysics.usePhysics)},yV.traverseModuleInstances=function(e,t,i){e.scene.objects.traverseFrom(t,(t,r)=>{if("Instance"===r.type){let a=xf.getComponentData(e,r.component)?.data;a&&i(t,r,a.events)}else i(t,r,r.events)})},(e=>{function t(t=!0,i=[]){let r=[],a=y4.defaultMeshObject;t&&(r.push({...e.defaultLight}),r.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:a,children:[]})),r.push(...i);let o=new pq;
3139return o.push({fi:1,id:gh,data:{...y3.defaultData,name:"Scene 1"},children:r}),o}function i(t){return{...e.defaultData,objects:vh(t,pq.prototype)}}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:y0.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:y8.defaultData,styles:xe.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new pq,publish:y8.defaultData,styles:xe.defaultData()}},e.emptyDataWithPage=function(e=!0){return{objects:t(e),publish:y8.defaultData,styles:xe.defaultData()}},e.emptyData=function(){return{objects:new pq,publish:{...y8.defaultData},styles:xe.defaultData()}},e.withObjs=i,e.withObj=function(e,t){return i([{id:e,data:t,children:[],fi:0}])}})(xi||(xi={})),(xr||(xr={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}},(A=xs||(xs={})).defaultData=e=>({url:e,name:"New Webhook",parametersSchemas:new pX}),A.defaultParameterValueByType=e=>"number"===e?0:"boolean"!==e&&"",(xa||(xa={})).defaultData=(e,t="GET")=>({url:e,method:t,name:"New API",headers:new pX,queries:new pX,autoStart:!0}),(e=>{function t(e){return void 0!==e.textValue}function i(e){return"boolean"==typeof e}e.isTextValue=t,e.isNumber=function(e){return"number"==typeof e},e.isBoolean=i,e.typeOfVariable=function(e){return t(e)?"string":i(e)?"boolean":"number"},e.getDisplayedValue=function(t){return e.isTextValue(t)?Array.isArray(t.textValue)?t.textValue.map(e=>e.toString().padStart(t.padding??2,"0")).join(t.deliminator??":")+(void 0!==t.suffix?" "+t.suffix:""):t.textValue.toString():e.isBoolean(t)?t?"True":"False":e.isNumber(t)?parseFloat(t.toFixed(3)).toString():t.toString()}})(xn||(xn={})),(xo||(xo={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(xl||(xl={})).all=[...xo.all,"components"],(xh||(xh={})).defaultData=function(){return{images:new pk,videos:new pk,colors:new pk,audios:new pk,particles:new pk,fonts:new pk,materials:new pk,components:new pk,variables:new pk,userAPIs:new pk,userWebhooks:new pk,timelineAnimations:new pk}},(xc||(xc={})).defaultData=function(){return{images:new pk,videos:new pk,colors:new pk,audios:new pk,particles:new pk,fonts:new pk,materials:new pk,components:new pk,variables:new pk,userAPIs:new pk,userWebhooks:new pk,timelineAnimations:new pk}},(yj=xd||(xd={})).defaultColors=function(){let e={};return e["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},vh(e,pk.prototype)},yj.defaultImages=function(){return vh({},pk.prototype)},yj.emptyData=function(){return{catelogs:new pk,materials:new pk,images:new pk,videos:new pk,colors:new pk,timelineAnimations:new pk,audios:new pk,particles:new pk,fonts:new pk,variables:new pX,userAPIs:new pk,userWebhooks:new pk,lib:xc.defaultData()}},yj.defaultVariables=function(e){switch(e){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":let t=[0,0,0];return{name:"Time",value:{textValue:t,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:t,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1};case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",e)}},yj.getFormattedTimerTime=function(e,t){if("HH:mm:ss"===t.format){let t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),r=Math.round(e-3600*t-60*i);return{textValue:[t,i,r]}}if("mm:ss"!==t.format)return e="number"===t.format?Math.round(e):Math.round(1e3*e)/1e3;{let t=Math.floor(e/60),i=Math.round(e-60*t);return{textValue:[t,i]}}},(xu||(xu={})).list=["idle","move","jump","run"],(M=xp||(xp={})).defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},M.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","▲"],["rotPosY","◀"],["rotNegX","▼"],["rotNegY","▶"],["jump","Space"],["run","⇧"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:M.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOr
3139ientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new pX,move:new pX,jump:new pX,run:new pX},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:gw.fromHexAndA(3728051,1)}};var vZ=180/Math.PI;function vK(e){e.rotation=e.rotation.slice(0,3).map(e=>e*vZ)}function vJ(e){vK(e),"Page"===e.type&&vK(e.camera),e.states?.forEach(e=>{void 0===e.rotation||null===e.rotation||(e.rotation=e.rotation.slice(0,3).map(e=>e*vZ))});let t=e.geometry;t&&"SphereGeometry"===t.type&&(t.thetaLength=(t.thetaLength??180)*vZ),t&&"TorusGeometry"===t.type&&(t.arc=t.arc*vZ),t&&"PathGeometry"===t.type&&(t.extrusion.angle*=vZ,t.extrusion.twist*=vZ),"Mesh"===e.type&&"TextGeometry"===e.geometry.type&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(fc(e.events))&&e.events?.forEach(e=>{("MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type||"Collision"===e.type||"Trigger"===e.type)&&(e.runMode=e.toggle?"Toggle":"Repeat")})}function v$(e,t){for(let i of(t(e.data),e.children))v$(i,t)}function v0(e){e.timelineAnimations=vh({},pk.prototype)}function v1(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function v2(e){let t=e.schema??0;if(122!==t){let i;for(let i of(console.warn("updating from ",t,"to ",122),function(e,t){let i,r;if(t<1&&(vU(e,vF),vN(e,vF),e.schema=1),t<2&&(Object.assign(e.scene.publish,{orbitControls:{...y6.defaultData,...fc(e.scene.publish.orbitControls)}}),e.schema=2),t<3&&(function(e){function t(e){if(e.layers){for(let t of Object.values(e.layers))if(t){for(let[e,i]of Object.entries(t))if((vi.includes(e)||"boolean"==typeof i)&&delete t[e],"texture"===e)for(let[e,t]of Object.entries(i))(vr.includes(e)||"boolean"==typeof t)&&delete i[e]}}}e.scene.objects.traverse((e,i)=>{i.states.forEach(e=>{e.material?t(e.material):e.materials&&e.materials.forEach(e=>{t(e)})})})}(e),e.schema=3),t<4&&(e.scene.publish.withBackground=!0,e.schema=4),t<5&&(e.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1},e.schema=5),t<6&&(function(e){e.scene.objects.traverse((e,t)=>{let i=t.cloner;i&&(i.radial.scale=i.radial.scale.map(e=>e+1),i.linear.scale=i.linear.scale.map(e=>e+1))})}(e),e.schema=6),t<7&&(function(e){e.scene.objects.traverse((e,t)=>{let i=t.geometry;i&&("DodecahedronGeometry"===i.type||"IcosahedronGeometry"===i.type)&&(i.detail=Math.round(i.detail))})}(e),e.schema=7),t<8&&(e.schema=8),t<9&&(vj(e),e.schema=9),t<10&&(function(e){e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&("BooleanGeometry"===t.geometry.type||"SubdivGeometry"===t.geometry.type)&&(t.geometry.phongAngle=35)})}(e),e.schema=10),t<11&&(e.scene.environment.ambientLight.softShadows=!1,e.scene.environment.ambientLight.softShadowQuality="low",e.scene.objects.traverse((e,t)=>{("DirectionalLight"===t.type||"SpotLight"===t.type)&&(t.shadowResolution=1024,t.shadowRadius=1,t.depth=1e5)}),e.shared.penumbraSize=[,,,,,].fill(.5),e.schema=11),t<12&&(vj(e),e.schema=12),t<13&&(e.shared.audios=vh({},pk.prototype),e.schema=13),t<14&&(Object.entries(i=e.shared.materials).forEach(([e,t])=>{t.layers||Object.assign(i,{[e]:{name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]}})}),e.schema=14),t<15&&(Object.entries(fc(e.shared.images)).filter(e=>!1===e[1].asset).map(e=>e[0]).forEach(t=>{delete e.shared.images[t]}),Object.entries(fc(e.shared.audios)).filter(e=>!1===e[1].asset).map(e=>e[0]).forEach(t=>{delete e.shared.audios[t]}),e.schema=15),t<16&&(e.scene.publish.settings.web.preload=!1,e.schema=16),t<17&&(vU(e,vG),vN(e,vG),e.schema=17),t<18&&(vU(e,vk),vN(e,vk),e.schema=18),t<19&&(Object.assign(e.scene.publish.settings,{video:{...y8.defaultData.settings.video,...fc(e.scene.publish.settings.video)}}),e.schema=19),t<20&&(e.shared.fonts=vh({},pk.prototype),r=[],e.scene.objects.traverse((t,i)=>{if("TextFrame"===i.type){let a=vv.defaultTwoLayerData("phong"),o="string"==typeof i.color?e.shared.colors[i.color]:i.color;a.layers[1].data.color={r:o.r,g:o.g,b:o.b},a.layers[1].data.alpha=i.alpha;let l=i.font.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");void 0===e.shared.fonts[l]&&(e.shared.fonts[l]={name:l});let h={name:i.name,...vB.defaultData,...yJ.defaultData,flatShading:!1,wireframe:!1,geometry:{...v_.defaultData("TextGeometry"),width:i.width,height:i.height,font:l,depth:0,horizontalAlign:i.horizontalAlign,verticalAlign:i.verticalAlign,fontSize:1.40625*i.fontSize,lineHeight:i.lineHeight/1.40625,letterSpacing:i.letterSpacing-1,text:i.text,textTransform:i.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:a,states:fc(i.states),events:fc(i.events),visible:i.visible,raycastLock:i.raycastLock,position:i.position,rotation:i.rotation,scale:i.scale,hiddenMatrix:i.hiddenMatrix},c=fc(e.scene.objects).parent(t);e.scene.objects.insertAfter(c??null,t,[{id:t+"new",data:h,children:[]}]),r.push(t)}}),r.forEach(t=>{e.scene.objects.delete(t)}),e.schema=20),t<21&&(function(e){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};e.scene.objects.traverse((e,i)=>
3139{i.events.forEach(e=>{if(t[Number(e.type)]){if(Object.assign(e,{type:t[Number(e.type)]}),"Audio"===e.type&&"audioEvent"in e&&(Object.assign(e,{playAudio:e.audioEvent}),delete e.audioEvent),"GameControl"===e.type)Object.assign(e,{gameActions:{idle:new pX,move:new pX,jump:new pX}});else{let t=new pX;Object.assign(e,{actions:t}),("MouseDown"===e.type||"MouseUp"===e.type||"KeyDown"===e.type||"KeyUp"===e.type)&&"url"in e&&t.push({fi:0,id:t8.generateUUID(),data:{type:"Link",url:e.url,delay:0}}),"targets"in e&&(e.targets.forEach((e,i,r)=>{let a={easing:e.easing,duration:e.duration};6===e.easing?Object.assign(a,po(e,"mass","stiffness","damping","velocity")):5===e.easing&&Object.assign(a,{control1:{...e.control1},control2:{...e.control2}});let o={repeat:e.repeat?-1:0,delay:e.delay,delayDirection:e.delayDirection,direction:e.cycle&&e.rewind?"pingpong-rewind":e.cycle?"pingpong":"normal"},l={state:e.state,...o,...a},h={allowSlerp:!0,type:"Transition",object:e.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new pX({fi:0,id:t8.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:t8.generateUUID(),data:l})};t.push({fi:r,id:i,data:h})}),delete e.targets)}}})})}(e),function(e){e.scene.objects.traverse((e,t)=>{function i(e,i){let r=new pX,a=[];if(t.events.forEach((e,t,o)=>{if("Audio"===e.type&&e.trigger===i){let i;a.push(t),"play"===e.interaction?i={...po(e,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in e?e.after:void 0,toggle:"after"in e?e.toggle:void 0,type:"Audio"}:("pause"===e.interaction||"stop"===e.interaction)&&(i={...po(e,"interaction","delay","object","playAudio"),type:"Audio"}),i&&r.push({fi:o,id:t,data:i})}}),a.forEach(e=>t.events.delete(e)),r.length){let i=t.events.find(t=>t.type===e)?.data;i?"actions"in i&&i.actions.insertBefore(null,r):t.events.insertBefore(null,[{id:t8.generateUUID(),data:{type:e,actions:r}}])}}i("Start","start"),i("MouseDown","mouseDown"),i("MouseUp","mouseUp"),i("KeyDown","keyDown"),i("KeyUp","keyUp")})}(e),e.schema=21),t<22&&(vq(e),e.schema=22),t<23&&(function(e){e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(t.geometry.scaleBaked||(t.geometry.scaleBaked=[1,1,1]))})}(e),e.schema=23),t<24&&(function(e){e.scene.objects.traverse((e,t)=>{"Empty"!==t.type&&"Mesh"!==t.type||!t.cloner||t.cloner.randomnessObject||t.cloner.toObject||t.cloner.randomness||(t.cloner={...t.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}(e),e.schema=24),(t<25||void 0===e.shared.videos)&&(e.shared.videos=vh({},pk.prototype),t<25&&(e.schema=25)),t<26&&(function(e){e.scene.objects.traverse((t,i)=>{let r=e.scene.objects.unproxy().parent(t);if(r){let t=fc(e.scene.objects.data(r));t&&"Mesh"===t.type&&"BooleanGeometry"===t.geometry.type&&"Mesh"===i.type&&(i.visible=!0!==fc(i).booleanExclude)}})}(e),e.schema=26),t<27&&(function(e){e.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&("NonParametricGeometry"===t.geometry.type?void 0!==t.material&&delete t.material:void 0!==t.materials&&delete t.materials)})}(e),e.schema=27),t<28&&(vq(e),e.schema=28),t<29&&(function(e){function t(e){for(let i in Object.setPrototypeOf(e,pJ.prototype),e){var t;Object.setPrototypeOf(t=e[i],pJ.prototype),t.texture&&Object.setPrototypeOf(t.texture,pJ.prototype)}}e.scene.objects.traverse((e,i)=>{i.states.forEach(e=>{if(e.material){let i=fc(e.material).layers;t(i),e.material.layers=i}if(e.materials)for(let i=0;i<e.materials.length;i++){let r=e.materials[i],a=fc(r).layers;t(a),r.layers=a}})})}(e),e.schema=29),t<30&&(function(e){e.scene.objects.traverse((e,t)=>{"Mesh"!==t.type||"NonParametricGeometry"!==t.geometry.type||"material"in t||"materials"in t||(t.material=vv.defaultTwoLayerData("phong"))})}(e),e.schema=30),t<31&&(void 0===e.scene.publish.orbitControls.autoZoom&&(e.scene.publish.orbitControls.autoZoom=!1),e.scene.objects.traverse((e,t)=>
3139{("OrthographicCamera"===t.type||"PerspectiveCamera"===t.type)&&(void 0===t.orthographic.autoZoom&&(t.orthographic.autoZoom=!1),void 0===t.orthographic.autoZoomFrustumSize&&(t.orthographic.autoZoomFrustumSize=790))}),e.schema=31),t<33&&(function(e){e.scene.objects.traverse((e,t)=>{void 0===t.pathSnapping&&(t.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),void 0===t.pathSnapping.offset&&(t.pathSnapping.offset=0)})}(e),e.schema=33),t<34&&(void 0===e.scene.publish.mouseEventTarget&&(e.scene.publish.mouseEventTarget="canvas"),void 0===e.scene.publish.settings.web.hint&&(e.scene.publish.settings.web.hint=!1),e.schema=34),t<35&&(function(e){let{video:t}=e.scene.publish.settings;"gif"===t.format&&t.fps>48&&(t.fps=15)}(e),e.schema=35),t<36&&(function(e){e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&(e.resetYPosition=Math.abs(e.resetYPosition-t.position[1]))})})}(e),e.schema=36),t<37&&(function(e){let t=e.scene.environment.usePhysics;e.scene.objects.traverse((e,i)=>{t&&null===i.physics?i.collision=!1:i.collision="visibility"})}(e),e.schema=37),t<38&&(vU(e,vH),vN(e,vH),e.schema=38),t<39&&(function(e){e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&(e.navmesh=xp.defaultDataThirdPerson.navmesh)})})}(e),e.schema=39),t<40&&(e.scene.styles||(e.scene.styles=xe.defaultData()),e.schema=40),t<41&&(void 0===e.scene.environment.ambientLight.occlusion&&(e.scene.environment.ambientLight.occlusion=!1),void 0===e.scene.environment.ambientLight.aoFullRes&&(e.scene.environment.ambientLight.aoFullRes=!1),void 0===e.scene.environment.ambientLight.radius&&(e.scene.environment.ambientLight.radius=256),void 0===e.scene.environment.ambientLight.bias&&(e.scene.environment.ambientLight.bias=.5),void 0===e.scene.environment.ambientLight.aoColor&&(e.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),vU(e,vX),vN(e,vX),e.schema=41),t<42&&(function(e){e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&Object.assign(e.gameActions,{run:new pX})})})}(e),e.schema=42),t<43&&(function(e){e.scene.objects.traverse((e,t)=>{t.events.forEach(e=>{"GameControl"===e.type&&(e.keyAssignments=[...e.keyAssignments,["run","⇧"],["none","Ctrl"]])})})}(e),e.schema=43),t<99){vU(e,vY),vN(e,vY),null===e.scene.publish.playCamera&&(e.scene.publish.playCamera=gl);let t=fc(e.scene.objects),i=e.scene.objects;for(let r of(e.scene.publish.playPage=gh,i.insertBefore(null,null,[{id:gh,data:{...y3.defaultData,backgroundColor:e.scene.backgroundColor,fog:e.scene.fog,postprocessing:e.scene.postprocessing,ao:po(e.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:e.scene.publish.playCamera,gameControlObject:e.scene.publish.gameControlObject},shadow:po(e.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...vP.defaultData,...po(e.scene.environment,"usePhysics","gravity")},camera:fc(e.scene.ownerCamera)??y3.defaultData.camera,name:"Scene"},children:[]}]),t))r.id!==xi.TRASH_CAN_ID&&i.move(gh,r.fi,r.id);let r=0,a=0;
vendor: 4,129 bytes, line 3139
3139e.shared.penumbraSize&&e.scene.objects.traverse((t,i)=>{"DirectionalLight"===i.type?(i.penumbraSize=e.shared.penumbraSize[Math.min(r,2)],r+=1):"SpotLight"===i.type&&(i.penumbraSize=e.shared.penumbraSize[3+Math.min(a,1)],a+=1),(void 0===i.physics||null===i.physics)&&"Instance"!==i.type&&(i.physics={},Object.assign(i.physics,gq.defaultData)),void 0!==i.physics&&null!==i.physics&&(i.physics.enabled=i.collision??"visibility",delete i.collision)}),e.schema=99}}(e,t),t<100&&(void 0===e.scene.publish.joystickSizeAndXYOffset&&(e.scene.publish.joystickSizeAndXYOffset=y8.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(vU(e,vQ),vN(e,vQ),e.schema=101),t<102&&(function(e){e.scene.objects.traverse((e,t)=>{let i=t.geometry;i&&"PathGeometry"===i.type&&(i.extrusion.capType="flat",i.extrusion.bevel=50,i.extrusion.bevelSides=6,"Custom"===i.extrusion.shape.type&&(i.extrusion.shape.shapeQuality="low"))})}(e),e.schema=102),t<104&&(e.shared.catelogs=new pk,e.shared.lib=xc.defaultData(),e.schema=104),t<105&&(e.shared.variables=vh({},pk.prototype),e.scene.objects.traverse((e,t)=>{vJ(t)}),e.schema=105),Object.values(e.shared.lib.components)))!function(e){let t=e.schema??104;122!==t&&(t<105&&(v$(e.asset,vJ),e.schema=105),t<118&&(v$(e.asset,v0),e.schema=118),t<121&&(v$(e.asset,v1),e.schema=121))}(i);t<106&&(i=fc(e.shared.variables),e.shared.variables=vh(Object.entries(i??{}).map(([e,t],i)=>({fi:i,id:e,data:t})),pX.prototype),e.schema=106),t<107&&(e.shared.lib.variables=xc.defaultData().variables,e.schema=107),t<109&&(e.shared.particles=vh({},pk.prototype),e.shared.lib&&(e.shared.lib.particles=xc.defaultData().particles),e.schema=109),t<110&&(function(e){e.scene.objects.traverse((e,t)=>{"Particle"===t.type&&"number"==typeof t.renderMaterial.size&&Object.assign(t.renderMaterial,{size:[t.renderMaterial.size,t.renderMaterial.size]})})}(e),e.schema=110),t<111&&(e.scene.objects.traverse((e,t)=>{Array.isArray(fc(t.events))&&t.events?.forEach(e=>{"disabled"in e||(e.disabled=!1),("MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type)&&(e.mode=e.mode||"Object")})}),e.schema=111),t<112&&(function(e){e.scene.objects.traverse((e,t)=>{"Page"===t.type&&(t.postprocessing.depthOfField.focusDistance=100,t.postprocessing.depthOfField.focalLength=20,t.postprocessing.depthOfField.bokehScale=5)})}(e),e.schema=112),t<113&&(function(e){e.scene.objects.traverse((e,t)=>{!1!==Array.isArray(fc(t.events))&&t.events?.forEach(e=>{let t=e.runMode;"MouseDown"===e.type||"MouseUp"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"Collision"===e.type||"Trigger"===e.type?e.actions?.forEach(e=>{"Transition"===e.type&&(e.runMode=t??"Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle"===t?"Toggle":"Normal")}):"MouseHover"===e.type||"MousePress"===e.type||"KeyPress"===e.type?e.actions?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")}):"GameControl"===e.type?(delete e.actions,Object.keys(e.gameActions).forEach(t=>{e.gameActions[t]?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),"Animation"===e.type&&(e.runMode="Normal")})})):"DragDrop"===e.type?(delete e.actions,e.dragDropActions?.drag?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")}),e.dragDropActions?.drop?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")})):"Resize"===e.type?(delete e.actions,e.breakpoints?.forEach(e=>{e.actions?.forEach(e=>{("Transition"===e.type||"Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Toggle")})})):"Start"===e.type?e.actions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Once"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}):"VariableChange"===e.type||"Scroll"===e.type?e.actions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}):"Conditional"===e.type&&(delete e.actions,e.inActions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}
3139),e.outActions?.forEach(e=>{"Transition"===e.type&&(e.runMode="Repeat"),("Animation"===e.type||"SwitchCamera"===e.type)&&(e.runMode="Normal")}))})})}(e),e.schema=113),t<114&&(void 0===e.scene.publish.settings.web.imageQuality&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(e.shared.userAPIs=vh({},pk.prototype),e.shared.userWebhooks=vh({},pk.prototype),e.shared.lib&&(e.shared.lib.userAPIs=xc.defaultData().userAPIs,e.shared.lib.userWebhooks=xc.defaultData().userWebhooks),e.schema=115),t<116&&(void 0===e.scene.publish.settings.videoStatic&&(e.scene.publish.settings.videoStatic=y8.defaultData.settings.videoStatic),e.schema=116),t<117&&(void 0===e.scene.publish.settings.web.pixelRatioMobile&&(e.scene.publish.settings.web.pixelRatioMobile=0),void 0===e.scene.publish.settings.web.pixelRatioDesktop&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=vh({},pk.prototype),e.scene.objects.traverse((e,t)=>{v0(t)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=xf.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=xf.defaultData.scene.publish.settings.videoStatic.imageFormat,e.schema=119),t<120&&(e.scene.publish.settings.image.colorSpace="display-p3",e.scene.publish.settings.videoStatic.colorSpace="display-p3",e.schema=120),t<121&&(e.scene.objects.traverse((e,t)=>{v1(t),"Page"===t.type&&v1(t.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=xf.defaultData.scene.publish.orbitControls.rotationSpeed,e.schema=122)}}function v3(e,t=!1){let i=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),a=new Set(Object.keys(e[0].morphAttributes)),o={},l={},h=e[0].morphTargetsRelative,c=new rQ,d=0;for(let p=0;p<e.length;++p){let f=e[p],m=0;if(i!==(null!==f.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let e in f.attributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===o[e]&&(o[e]=[]),o[e].push(f.attributes[e]),m++}if(m!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". Make sure all geometries have the same number of attributes."),null;if(h!==f.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let e in f.morphAttributes){if(!a.has(e))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". .morphAttributes must be consistent throughout all geometries."),null;void 0===l[e]&&(l[e]=[]),l[e].push(f.morphAttributes[e])}if(t){let e;if(i)e=f.index.count;else{if(void 0===f.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". The geometry must have either an index or a position attribute"),null;e=f.attributes.position.count}c.addGroup(d,e,p),d+=e}}if(i){let t=0,i=[];for(let r=0;r<e.length;++r){let a=e[r].index;for(let e=0;e<a.count;++e)i.push(a.getX(e)+t);t+=e[r].attributes.position.count}c.setIndex(i)}for(let e in o){let t=v4(o[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+e+" attribute."),null;c.setAttribute(e,t)}for(let e in l){let t=l[e][0].length;if(0===t)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[e]=[];for(let i=0;i<t;++i){let t=[];for(let r=0;r<l[e].length;++r)t.push(l[e][r][i]);let r=v4(t);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+e+" morphAttribute."),null;c.morphAttributes[e].push(r)}}return c}function v4(e){let t,i,r,a=0;for(let o=0;o<e.length;++o){let l=e[o];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(void 0===t&&(t=l.array.constructor),t!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===i&&(i=l.itemSize),i!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===r&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;a+=l.array.length}let o=new t(a),l=0;for(let t=0;t<e.length;++t)o.set(e[t].array,l),l+=e[t].array.length;return new rN(o,i,r)}function v5(e,t=[0,0]){return[e&&!isNaN(e[0])?e[0]:t[0],e&&!isNaN(e[1])?e[1]:t[1]]}function v6(e,t,i){switch(e){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:let{control1:r,control2:a}=t??{...gF.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${a[0]}, ${a[1]} )`;case 6:let{mass:o,stiffness:l,damping:h,velocity:c}=i??{...g_.defaultData},d=new v7(o,l,h,c),p=d.solve(1);return()=>e=>d.solve(e)/p;case 8:return()=>e=>Math.floor(e)}}function v8(e,t,i){return{id:t,fi:i,data:{id:t,path:e,keyframes:new pX}}}(yG=xf||(xf={})).defaultData={schema:122,scene:xi.defaultData,frames:new pk().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",xr.defaultData),shared:{...xd.emptyData(),colors:xd.defaultColors()}},yG.emptyDataForImports=function(){return{schema:122,scene:xi.emptyDataWithPage(),frames:new pk().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",xr.defaultData),shared:{...xd.emptyData(),colors:xd.defaultColors(),images:xd.defaultImages()}}},yG.emptyData=function(){return{schema:122,scene:xi.emptyDataWithPage(),frames:new pk().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",xr.defaultData),shared:xd.emptyData()}},yG.clipboard2dData=function(){return{schema:122,scene:xi.emptyData(),frames:new pk,shared:xd.emptyData()}},yG.collabHelper={...fy,updateSchema:e=>(e.schema??0)<122?fh(e,v2):(e.schema??0)-122},yG.updateSchemaDirectly=function(e){let t=yG.collabHelper.updateSchema(e);return"number"==typeof t?0===t?e:null:t.data},yG.withoutLib=function(e){return{...e,shared:{...e.shared,lib:xc.defaultData()}}},yG.getComponentData=function(e,t){let i=e.scene.objects.get(t);if(i&&"Component"===i.data.type)return i;{let i=e.shared.lib.components[t];if(i)return{...i.asset,id:t}}},yG.hasSensitiveData=function(e){for(let t of Object.values(e.shared.userAPIs))for(let e of t.headers)if("authorization"===e.data.key.toLowerCase()&&""!==e.data.value)return!0;return!1},(xm||(xm={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"},(xg||(xg={})).is=function(e){return!0},(yH=xv||(xv={})).defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},yH.merge=function(e,t){return{position:t?.position??e.position,rotation:t?.rotation??e.rotation,scale:t?.scale??e.scale,shear:t?.shear??e.shear}},yH.diff=function(e,t){return vl({position:go.isEqual(e.position,t.position)?void 0:t.position,rotation:e.rotation===t.rotation?void 0:t.rotation,scale:go.isEqual(e.scale,t.scale)?void 0:t.scale,shear:e.shear&&t.shear&&go.isEqual(e.shear,t.shear)?void 0:t.shear})},(xy||(xy={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(xx||(xx={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(xb||(xb={})).defaultData={opacity:1,fill:{color:gw.fromHexAndA(5526619,1),enabled:!0},stroke:{color:gw.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:gw.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:gw.from0to1([0,0,0,1]),enabled:!1,spread:0}},(yW=xw||(xw={})).newEmpty=function(e,t){return{name:t}},yW.patch=function(e,t){if(void 0===t)return e;let i={...e};return Object.assign(i,xv.merge(i,t)),i=function(e,t){if(void 0===t)return e;let i={...e};return"fill"in i&&"fill"in t&&void 0!==t.fill&&Object.assign(i,{fill:{...i.fill,...t.fill}}),"stroke"in i&&"stroke"in t&&void 0!==t.stroke&&Object.assign(i,{stroke:{...i.stroke,...t.stroke}}),"layerBlur"in i&&"layerBlur"in t&&void 0!==t.layerBlur&&Object.assign(i,{layerBlur:{...i.layerBlur,...t.layerBlur}}),"backgroundBlur"in i&&"backgroundBlur"in t&&void 0!==t.backgroundBlur&&Object.assign(i,{backgroundBlur:{...i.backgroundBlur,...t.backgroundBlur}}),"dropShadow"in i&&"dropShadow"in t&&void 0!==t.dropShadow&&Object.assign(i,{dropShadow:{...i.dropShadow,...t.dropShadow}}),"innerShadow"in i&&"innerShadow"in t&&void 0!==t.innerShadow&&Object.assign(i,{innerShadow:{...i.innerShadow,...t.innerShadow}}),i}(i=function(e,t){if(void 0===t)return e;let i={...e};for(let e of["width","height","cornerRadius"])e in i&&e in t&&void 0!==t[e]&&Object.assign(i,{[e]:t[e]});return i}(i,t),t)},yW.toOps=function(e,t){let i,r=[];for(let[e,a]of Object.entries(t))"name"!==e&&(void 0===i&&(i={path:[],props:{}
3139,type:0},r.push(i)),i.props[e]=a);return r},(xS||(xS={})).defaultData={...xv.defaultData,...xy.defaultData,states:new pX,events:new pX,visible:!0,raycastLock:!1},(x_||(x_={})).defaultData={...xS.defaultData,...xb.defaultData},(xA||(xA={})).defaultData={cornerRadius:[0,0,0,0]},(xM||(xM={})).defaultData={...x_.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(xE||(xE={})).defaultData={...x_.defaultData,...xA.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(xC||(xC={})).defaultData={...x_.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"},(xT||(xT={})).defaultData={...x_.defaultData,type:"path2d",path:"",name:"Path"},(xP||(xP={})).is=function(e){return"ellipse2d"===e.type||"rectangle2d"===e.type||"text2d"===e.type||"vector2d"===e.type||"path2d"===e.type},(xD||(xD={})).defaultData={...xS.defaultData,name:"Group",type:"group2d"},(xO||(xO={})).defaultData=()=>({...xS.defaultData,...xA.defaultData,...xb.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:gw.fromHexAndA(4737101,1),enabled:!0},stroke:{color:gw.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(yq=xI||(xI={})).defaultData=function(e){switch(e){case"rectangle2d":case"vector2d":return{...xE.defaultData};case"ellipse2d":return{...xM.defaultData};case"text2d":return{...xC.defaultData};case"path2d":return{...xT.defaultData};case"frame2d":return{...xO.defaultData()};case"group2d":return{...xD.defaultData}}},yq.getPivot=function(e){return"width"in e&&"height"in e?["number"==typeof e.width?.5*e.width:0,"number"==typeof e.height?.5*e.height:0]:[0,0]},yq.isResizeable=function(e){return"rectangle2d"===e.type||"ellipse2d"===e.type||"text2d"===e.type||"frame2d"===e.type},yq.isAutoLayoutable=function(e){return"frame2d"===e.type&&void 0!==e.autoLayout},yq.hasCorners=function(e){return"rectangle2d"===e.type||"frame2d"===e.type},(E=xR||(xR={})).defaultData={name:"UI",type:"scene2d",objects:new pq},E.emptyData=function(){return{type:"scene2d",objects:new pq}},(xL||(xL={})).is=function(e){return e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z},(yX=xB||(xB={})).getControlsWithDefault=function(e,t){let i=[0,0],r=[1,1];if(e?.cubicControls)i=v5(e.cubicControls.control1,i);else switch(e?.type){case 2:case 4:i=[.42,0];break;case 3:case 0:i=[0,0];break;case 1:i=[.25,.1];break;case 7:i=[.25,1]}if(t?.cubicControls)r=v5(t.cubicControls.control2,r);else switch(t?.type){case 2:case 0:r=[1,1];break;case 3:case 4:r=[.58,1];break;case 1:r=[.25,1];break;case 7:r=[.5,1]}return{control1:i,control2:r}},yX.defaultData=function(e,t){return{id:e,name:t,to:5,properties:new pX}},yX.createMaterialGroup=function(e){let t=new pX;return e.forEach(({data:e,id:i,fi:r})=>{if("light"===e.type){let a=v8(["material",`${e.category} lighting`],i,r);t.push(a)}else{let a=v8(["material",e.type],i,r);t.push(a)}}),t},yX.createName=function(e){return Object.entries(e).reduce((e,[t,i])=>("string"!=typeof i&&e.push({name:i.name}),e),[])},yX.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:v6(3),duration:1e3},opacity:{value:[0,1],easing:v6(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:v6(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:v6(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:v6(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}];var v9=["x","y","z"],v7=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return 1-(e=this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}getDuration(){let e=0,t=0;for(;;)if(e+=.16666666666666666,1===this.solve(e)){if(++t>=16)break}else t=0;return 166.66666666666666*e}},ye=class{constructor(){}};function yt(e,t,i){return i.min.x=t[e],i.min.y=t[e+1],i.min.z=t[e+2],i.max.x=t[e+3],i.max.y=t[e+4],i.max.z=t[e+5],i}function yi(e){let t=-1,i=-1/0;for(let r=0;r<3;r++){let a=e[r+3]-e[r];a>i&&(i=a,t=r)}return t}function yr(e,t,i){let r,a;for(let o=0;o<3;o++){let l=o+3;r=e[o],a=t[o],i[o]=r<a?r:a,r=e[l],a=t[l],i[l]=r>a?r:a}}function ys(e,t,i){for(let r=0;r<3;r++){let a=t[e+2*r],o=t[e+2*r+1],l=a-o,h=a+o;l<i[r]&&(i[r]=l),h>i[r+3]&&(i[r+3]=h)}}function ya(e){let t=e[3]-e[0],i=e[4]-e[1],r=e[5]-e[2];return 2*(t*i+i*r+r*t)}function yn(e,t,i,r,a=null){let o=1/0,l=1/0,h=1/0,c=-1/0,d=-1/0,p=-1/0,f=1/0,m=1/0,g=1/0,v=-1/0,y=-1/0,x=-1/0,b=null!==a;for(let r=6*t,a=(t+i)*6;r<a;r+=6){let t=e[r+0],i=e[r+1],a=t-i,w=t+i;a<o&&(o=a),w>c&&(c=w),b&&t<f&&(f=t),b&&t>v&&(v=t);let S=e[r+2],_=e[r+3],A=S-_,M=S+_;A<l&&(l=A),M>d&&(d=M),b&&S<m&&(m=S),b&&S>y&&(y=S);let E=e[r+4],C=e[r+5],T=E-C,P=E+C;T<h&&(h=T),P>p&&(p=P),b&&E<g&&(g=E),b&&E>x&&(x=E)}r[0]=o,r[1]=l,r[2]=h,r[3]=c,r[4]=d,r[5]=p,b&&(a[0]=f,a[1]=m,a[2]=g,a[3]=v,a[4]=y,a[5]=x)}var yo=(e,t)=>e.candidate-t.candidate,yl=Array(32).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),yh=new Float32Array(6),yc=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,r=-1/0;for(let a=0,o=e.length;a<o;a++){let o=e[a][t];i=o<i?o:i,r=o>r?o:r}this.min=i,this.max=r}setFromPoints(e,t){let i=1/0,r=-1/0;for(let a=0,o=t.length;a<o;
3139a++){let o=t[a],l=e.dot(o);i=l<i?l:i,r=l>r?l:r}this.min=i,this.max=r}isSeparated(e){return this.min>e.max||e.min>this.max}};yc.prototype.setFromBox=(C=new iD,function(e,t){let i=t.min,r=t.max,a=1/0,o=-1/0;for(let t=0;t<=1;t++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){C.x=i.x*t+r.x*(1-t),C.y=i.y*l+r.y*(1-l),C.z=i.z*h+r.z*(1-h);let c=e.dot(C);a=Math.min(c,a),o=Math.max(c,o)}this.min=a,this.max=o}),new yc;var yd=(T=new iD,P=new iD,D=new iD,function(e,t,i){let r=e.start,a=t.start;D.subVectors(r,a),T.subVectors(e.end,e.start),P.subVectors(t.end,t.start);let o=D.dot(P),l=P.dot(T),h=P.dot(P),c=D.dot(T),d=T.dot(T)*h-l*l,p,f;p=0!==d?(o*l-c*h)/d:0,f=(o+p*l)/h,i.x=p,i.y=f}),yu=(O=new t9,I=new iD,R=new iD,function(e,t,i,r){yd(e,t,O);let a=O.x,o=O.y;if(a>=0&&a<=1&&o>=0&&o<=1){e.at(a,i),t.at(o,r);return}if(a>=0&&a<=1){o<0?t.at(0,r):t.at(1,r),e.closestPointToPoint(r,!0,i);return}if(o>=0&&o<=1){a<0?e.at(0,i):e.at(1,i),t.closestPointToPoint(i,!0,r);return}{let l,h;if(l=a<0?e.start:e.end,h=o<0?t.start:t.end,e.closestPointToPoint(h,!0,I),t.closestPointToPoint(l,!0,R),I.distanceToSquared(h)<=R.distanceToSquared(l)){i.copy(I),r.copy(h);return}i.copy(l),r.copy(R);return}}),yp=(L=new iD,B=new iD,z=new sv,F=new lJ,function(e,t){let{radius:i,center:r}=e,{a:a,b:o,c:l}=t;if(F.start=a,F.end=o,F.closestPointToPoint(r,!0,L).distanceTo(r)<=i||(F.start=a,F.end=l,F.closestPointToPoint(r,!0,L).distanceTo(r)<=i)||(F.start=o,F.end=l,F.closestPointToPoint(r,!0,L).distanceTo(r)<=i))return!0;let h=t.getPlane(z);if(Math.abs(h.distanceToPoint(r))<=i){let e=h.projectPoint(r,B);if(t.containsPoint(e))return!0}return!1});function yf(e){return 1e-15>Math.abs(e)}var ym=class extends rI{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=[,,,,].fill().map(()=>new iD),this.satBounds=[,,,,].fill().map(()=>new yc),this.points=[this.a,this.b,this.c],this.sphere=new iK,this.plane=new sv,this.needsUpdate=!0}intersectsSphere(e){return yp(e,this)}update(){let e=this.a,t=this.b,i=this.c,r=this.points,a=this.satAxes,o=this.satBounds,l=a[0],h=o[0];this.getNormal(l),h.setFromPoints(l,r);let c=a[1],d=o[1];c.subVectors(e,t),d.setFromPoints(c,r);let p=a[2],f=o[2];p.subVectors(t,i),f.setFromPoints(p,r);let m=a[3],g=o[3];m.subVectors(i,e),g.setFromPoints(m,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(l,e),this.needsUpdate=!1}};ym.prototype.closestPointToSegment=(N=new iD,U=new iD,k=new lJ,function(e,t=null,i=null){let{start:r,end:a}=e,o=this.points,l,h=1/0;for(let r=0;r<3;r++){let a=(r+1)%3;k.start.copy(o[r]),k.end.copy(o[a]),yu(k,e,N,U),(l=N.distanceToSquared(U))<h&&(h=l,t&&t.copy(N),i&&i.copy(U))}return this.closestPointToPoint(r,N),(l=r.distanceToSquared(N))<h&&(h=l,t&&t.copy(N),i&&i.copy(r)),this.closestPointToPoint(a,N),(l=a.distanceToSquared(N))<h&&(h=l,t&&t.copy(N),i&&i.copy(a)),Math.sqrt(h)}),ym.prototype.intersectsTriangle=(V=new ym,j=[,,,],G=[,,,],H=new yc,W=new yc,q=new iD,X=new iD,Y=new iD,Q=new iD,Z=new lJ,K=new lJ,J=new lJ,function(e,t=null,i=!1){this.needsUpdate&&this.update(),e.isExtendedTriangle?e.needsUpdate&&e.update():(V.copy(e),V.update(),e=V);let r=this.plane,a=e.plane;if(Math.abs(r.normal.dot(a.normal))>1-1e-10){let r=this.satBounds,a=this.satAxes;G[0]=e.a,G[1]=e.b,G[2]=e.c;for(let e=0;e<4;e++){let t=r[e],i=a[e];if(H.setFromPoints(i,G),t.isSeparated(H))return!1}let o=e.satBounds,l=e.satAxes;j[0]=this.a,j[1]=this.b,j[2]=this.c;for(let e=0;e<4;e++){let t=o[e],i=l[e];if(H.setFromPoints(i,j),t.isSeparated(H))return!1}for(let e=0;e<4;e++){let t=a[e];for(let e=0;e<4;e++){let i=l[e];if(q.crossVectors(t,i),H.setFromPoints(q,j),W.setFromPoints(q,G),H.isSeparated(W))return!1}}return t&&(i||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),t.start.set(0,0,0),t.end.set(0,0,0)),!0}{let i=this.points,o=!1,l=0;for(let e=0;e<3;e++){let t=i[e],r=i[(e+1)%3];Z.start.copy(t),Z.end.copy(r),Z.delta(X);let h=o?K.start:K.end,c=yf(a.distanceToPoint(t));if(yf(a.normal.dot(X))&&c){K.copy(Z),l=2;break}
3139if((a.intersectLine(Z,h)||c)&&!yf(h.distanceTo(r))){if(l++,o)break;o=!0}}if(1===l&&e.containsPoint(K.end))return t&&(t.start.copy(K.end),t.end.copy(K.end)),!0;if(2!==l)return!1;let h=e.points,c=!1,d=0;for(let e=0;e<3;e++){let t=h[e],i=h[(e+1)%3];Z.start.copy(t),Z.end.copy(i),Z.delta(Y);let a=c?J.start:J.end,o=yf(r.distanceToPoint(t));if(yf(r.normal.dot(Y))&&o){J.copy(Z),d=2;break}if((r.intersectLine(Z,a)||o)&&!yf(a.distanceTo(i))){if(d++,c)break;c=!0}}if(1===d&&this.containsPoint(J.end))return t&&(t.start.copy(J.end),t.end.copy(J.end)),!0;if(2!==d)return!1;if(K.delta(X),J.delta(Y),0>X.dot(Y)){let e=J.start;J.start=J.end,J.end=e}let p=K.start.dot(X),f=K.end.dot(X),m=J.start.dot(X),g=J.end.dot(X);return(p===g||m===f||f<m!=p<g)&&(t&&(Q.subVectors(K.start,J.start),Q.dot(X)>0?t.start.copy(K.start):t.start.copy(J.start),Q.subVectors(K.end,J.end),0>Q.dot(X)?t.end.copy(K.end):t.end.copy(J.end)),!0)}}),ym.prototype.distanceToPoint=($=new iD,function(e){return this.closestPointToPoint(e,$),e.distanceTo($)}),ym.prototype.distanceToTriangle=(ee=new iD,et=new iD,ei=["a","b","c"],er=new lJ,es=new lJ,function(e,t=null,i=null){let r=t||i?er:null;if(this.intersectsTriangle(e,r))return(t||i)&&(t&&r.getCenter(t),i&&r.getCenter(i)),0;let a=1/0;for(let r=0;r<3;r++){let o,l=ei[r],h=e[l];this.closestPointToPoint(h,ee),(o=h.distanceToSquared(ee))<a&&(a=o,t&&t.copy(ee),i&&i.copy(h));let c=this[l];e.closestPointToPoint(c,ee),(o=c.distanceToSquared(ee))<a&&(a=o,t&&t.copy(c),i&&i.copy(ee))}for(let r=0;r<3;r++){let o=ei[r],l=ei[(r+1)%3];er.set(this[o],this[l]);for(let r=0;r<3;r++){let o=ei[r],l=ei[(r+1)%3];es.set(e[o],e[l]),yu(er,es,ee,et);let h=ee.distanceToSquared(et);h<a&&(a=h,t&&t.copy(ee),i&&i.copy(et))}}return Math.sqrt(a)});var yg=class{constructor(e,t,i){this.isOrientedBox=!0,this.min=new iD,this.max=new iD,this.matrix=new i6,this.invMatrix=new i6,this.points=Array(8).fill().map(()=>new iD),this.satAxes=[,,,].fill().map(()=>new iD),this.satBounds=[,,,].fill().map(()=>new yc),this.alignedSatBounds=[,,,].fill().map(()=>new yc),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}};yg.prototype.update=function(){let e=this.matrix,t=this.min,i=this.max,r=this.points;for(let a=0;a<=1;a++)for(let o=0;o<=1;o++)for(let l=0;l<=1;l++){let h=r[1*a|2*o|4*l];h.x=a?i.x:t.x,h.y=o?i.y:t.y,h.z=l?i.z:t.z,h.applyMatrix4(e)}let a=this.satBounds,o=this.satAxes,l=r[0];for(let e=0;e<3;e++){let t=o[e],i=a[e],h=r[1<<e];t.subVectors(l,h),i.setFromPoints(t,r)}let h=this.alignedSatBounds;h[0].setFromPointsField(r,"x"),h[1].setFromPointsField(r,"y"),h[2].setFromPointsField(r,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1},yg.prototype.intersectsBox=(ea=new yc,function(e){this.needsUpdate&&this.update();let t=e.min,i=e.max,r=this.satBounds,a=this.satAxes,o=this.alignedSatBounds;if(ea.min=t.x,ea.max=i.x,o[0].isSeparated(ea)||(ea.min=t.y,ea.max=i.y,o[1].isSeparated(ea))||(ea.min=t.z,ea.max=i.z,o[2].isSeparated(ea)))return!1;for(let t=0;t<3;t++){let i=a[t],o=r[t];if(ea.setFromBox(i,e),o.isSeparated(ea))return!1}return!0}),yg.prototype.intersectsTriangle=(en=new ym,eo=[,,,],el=new yc,eh=new yc,ec=new iD,function(e){this.needsUpdate&&this.update(),e.isExtendedTriangle?e.needsUpdate&&e.update():(en.copy(e),en.update(),e=en);let t=this.satBounds,i=this.satAxes;eo[0]=e.a,eo[1]=e.b,eo[2]=e.c;for(let e=0;e<3;e++){let r=t[e],a=i[e];if(el.setFromPoints(a,eo),r.isSeparated(el))return!1}let r=e.satBounds,a=e.satAxes,o=this.points;for(let e=0;e<3;e++){let t=r[e],i=a[e];if(el.setFromPoints(i,o),t.isSeparated(el))return!1}for(let e=0;e<3;e++){let t=i[e];for(let e=0;e<4;e++){let i=a[e];if(ec.crossVectors(t,i),el.setFromPoints(ec,eo),eh.setFromPoints(ec,o),el.isSeparated(eh))return!1}}return!0}),yg.prototype.closestPointToPoint=function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix
3139),t},yg.prototype.distanceToPoint=(ed=new iD,function(e){return this.closestPointToPoint(e,ed),e.distanceTo(ed)}),yg.prototype.distanceToBox=(eu=["x","y","z"],ep=Array(12).fill().map(()=>new lJ),ef=Array(12).fill().map(()=>new lJ),em=new iD,eg=new iD,function(e,t=0,i=null,r=null){if(this.needsUpdate&&this.update(),this.intersectsBox(e))return(i||r)&&(e.getCenter(eg),this.closestPointToPoint(eg,em),e.closestPointToPoint(em,eg),i&&i.copy(em),r&&r.copy(eg)),0;let a=t*t,o=e.min,l=e.max,h=this.points,c=1/0;for(let e=0;e<8;e++){let t=h[e];eg.copy(t).clamp(o,l);let d=t.distanceToSquared(eg);if(d<c&&(c=d,i&&i.copy(t),r&&r.copy(eg),d<a))return Math.sqrt(d)}let d=0;for(let e=0;e<3;e++)for(let t=0;t<=1;t++)for(let i=0;i<=1;i++){let r=(e+1)%3,a=(e+2)%3,c=t<<r|i<<a,p=1<<e|t<<r|i<<a,f=h[c],m=h[p];ep[d].set(f,m);let g=eu[e],v=eu[r],y=eu[a],x=ef[d],b=x.start,w=x.end;b[g]=o[g],b[v]=t?o[v]:l[v],b[y]=i?o[y]:l[v],w[g]=l[g],w[v]=t?o[v]:l[v],w[y]=i?o[y]:l[v],d++}for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let h=0;h<=1;h++){eg.x=e?l.x:o.x,eg.y=t?l.y:o.y,eg.z=h?l.z:o.z,this.closestPointToPoint(eg,em);let d=eg.distanceToSquared(em);if(d<c&&(c=d,i&&i.copy(em),r&&r.copy(eg),d<a))return Math.sqrt(d)}for(let e=0;e<12;e++){let t=ep[e];for(let e=0;e<12;e++){yu(t,ef[e],em,eg);let o=em.distanceToSquared(eg);if(o<c&&(c=o,i&&i.copy(em),r&&r.copy(eg),o<a))return Math.sqrt(o)}}return Math.sqrt(c)});var yv=new iD,yy=new iD,yx=new iD,yb=new t9,yw=new t9,yS=new t9,y_=new iD,yA=new iD,yM=new iD,yE=new iD;function yC(e,t,i,r,a){let o=3*r,l=e.index.getX(o),h=e.index.getX(o+1),c=e.index.getX(o+2),{position:d,normal:p,uv:f,uv1:m}=e.attributes,g=function(e,t,i,r,a,o,l,h,c){yv.fromBufferAttribute(t,o),yy.fromBufferAttribute(t,l),yx.fromBufferAttribute(t,h);let d=null===(1===c?e.intersectTriangle(yx,yy,yv,!0,yE):e.intersectTriangle(yv,yy,yx,2!==c,yE))?null:{distance:e.origin.distanceTo(yE),point:yE.clone()};if(d){r&&(yb.fromBufferAttribute(r,o),yw.fromBufferAttribute(r,l),yS.fromBufferAttribute(r,h),d.uv=rI.getInterpolation(yE,yv,yy,yx,yb,yw,yS,new t9)),a&&(yb.fromBufferAttribute(a,o),yw.fromBufferAttribute(a,l),yS.fromBufferAttribute(a,h),d.uv1=rI.getInterpolation(yE,yv,yy,yx,yb,yw,yS,new t9)),i&&(y_.fromBufferAttribute(i,o),yA.fromBufferAttribute(i,l),yM.fromBufferAttribute(i,h),d.normal=rI.getInterpolation(yE,yv,yy,yx,y_,yA,yM,new iD),d.normal.dot(e.direction)>0&&d.normal.multiplyScalar(-1));let t={a:o,b:l,c:h,normal:new iD,materialIndex:0};rI.getNormal(yv,yy,yx,t.normal),d.face=t,d.faceIndex=o}return d}(i,d,p,f,m,l,h,c,t);return g?(g.faceIndex=r,a&&a.push(g),g):null}function yT(e,t,i,r){let a=e.a,o=e.b,l=e.c,h=t,c=t+1,d=t+2;i&&(h=i.getX(t),c=i.getX(t+1),d=i.getX(t+2)),a.x=r.getX(h),a.y=r.getY(h),a.z=r.getZ(h),o.x=r.getX(c),o.y=r.getY(c),o.z=r.getZ(c),l.x=r.getX(d),l.y=r.getY(d),l.z=r.getZ(d)}function yP(e,t,i,r,a,o,l){let h=i.index,c=i.attributes.position;for(let i=e,d=t+e;i<d;i++)if(yT(l,3*i,h,c),l.needsUpdate=!0,r(l,i,a,o))return!0;return!1}var yD=class{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){let e=this._primitives;return 0===e.length?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}};function yO(e,t){return 65535===t[e+15]}var yI=new iR,yR=new iD,yL=["x","y","z"],yB=(ex=[],eb=new yD(()=>new iR),function(...e){ev=eb.getPrimitive(),ey=eb.getPrimitive(),ex.push(ev,ey);let t=function e(t,i,r,a,o=null,l=0,h=0){function c(e){let t=2*e,i=xN,r=xU;for(;!yO(t,i);)e+=8,t=2*e;return r[e+6]}function d(e){let t=2*e,i=xN,r=xU;for(;!yO(t,i);)t=2*(e=r[e+6]);return r[e+6]+i[t+14]}let p=2*t,f=xF,m=xN,g=xU;if(yO(p,m)){let e=g[t+6],i=m[p+14];return yt(t,f,ev),a(e,i,!1,h,l+t,ev)}{let p=t+8,v=g[t+6],y=p,x=v,b,w,S,_;if(o&&(S=ev,_=ey,yt(y,f,S),yt(x,f,_),b=o(S),(w=o(_))<b)){y=v,x=p;let e=b;b=w,w=e,S=_}S||yt(y,f,S=ev);let A=r(S,yO(2*y,m),b,h+1,l+y),M;if(2===A){let e=c(y),t=d(y)-e;M=a(e,t,!0,h+1,l+y,S)}else M=A&&e(y,i,r,a,o,l,h+1);if(M)return!0;yt(x,f,_=ey);let E=r(_,yO(2*x,m),w,h+1,l+x),C;if(2===E){let e=c(x),t=d(x)-e;C=a(e,t,!0,h+1,l+x,_)}else C=E&&e(x,i,r,a,o,l,h+1);return!!C}}(...e);eb.releasePrimitive(ev),eb.releasePrimitive(ey),ex.pop(),ex.pop();let i=ex.length;return i>0&&(ey=ex[i-1],ev=ex[i-2]),t}),yz=(ew=new ym,eS=new ym,e_=new i6,eA=new yg,eM=new yg,function e(t,i,r,a,o=null){let l=2*t,h=xF,c=xN,d=xU;if(null===o&&(r.boundingBox||r.computeBoundingBox(),eA.set(r.boundingBox.min,r.boundingBox.max,a),o=eA),yO(l,c)){let e=i.index,o=i.attributes.position,p=r.index,f=r.attributes.position,m=d[t+6],g=c[l+14];if(e_.copy(a).invert(),r.boundsTree)return yt(t,h,eM),eM.matrix.copy(e_),eM.needsUpdate=!0,r.boundsTree.shapecast({intersectsBounds:e=>eM.intersectsBox(e),intersectsTriangle:t=>
3139{t.a.applyMatrix4(a),t.b.applyMatrix4(a),t.c.applyMatrix4(a),t.needsUpdate=!0;for(let i=3*m,r=(g+m)*3;i<r;i+=3)if(yT(eS,i,e,o),eS.needsUpdate=!0,t.intersectsTriangle(eS))return!0;return!1}});for(let t=3*m,i=g+3*m;t<i;t+=3){yT(ew,t,e,o),ew.a.applyMatrix4(e_),ew.b.applyMatrix4(e_),ew.c.applyMatrix4(e_),ew.needsUpdate=!0;for(let e=0,t=p.count;e<t;e+=3)if(yT(eS,e,p,f),eS.needsUpdate=!0,ew.intersectsTriangle(eS))return!0}}else{let l=t+8,c=d[t+6];return yt(l,h,yI),!!(o.intersectsBox(yI)&&e(l,i,r,a,o)||(yt(c,h,yI),o.intersectsBox(yI)&&e(c,i,r,a,o)))}});function yF(e,t,i,r){return yt(e,t,yI),i.intersectBox(yI,r)}var yN,yU,yk,yV,yj,yG,yH,yW,yq,yX,yY,yQ,yZ,yK,yJ,y$,y0,y1,y2,y3,y4,y5,y6,y8,y9,y7,xe,xt,xi,xr,xs,xa,xn,xo,xl,xh,xc,xd,xu,xp,xf,xm,xg,xv,xy,xx,xb,xw,xS,x_,xA,xM,xE,xC,xT,xP,xD,xO,xI,xR,xL,xB,xz,xF,xN,xU,xk=[];function xV(e){xz&&xk.push(xz),xz=e,xF=new Float32Array(e),xN=new Uint16Array(e),xU=new Uint32Array(e)}function xj(){xz=null,xF=null,xN=null,xU=null,xk.length&&xV(xk.pop())}var xG=Symbol("skip tree generation"),xH=new iR,xW=new iR,xq=new i6,xX=new yg,xY=new yg,xQ=new iD,xZ=new iD,xK=new iD,xJ=new iD,x$=new iD,x0=new iR,x1=new yD(()=>new ym),x2=class{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),x2.serialize(arguments[0],{cloneBuffers:void 0===arguments[2]||arguments[2]});t={cloneBuffers:!0,...t};let i=e.geometry,r=e._roots,a=i.getIndex();return t.cloneBuffers?{roots:r.map(e=>e.slice()),index:a.array.slice()}:{roots:r,index:a.array}}static deserialize(e,t,i={}){if("boolean"==typeof i)return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),x2.deserialize(arguments[0],arguments[1],{setIndex:void 0===arguments[2]||arguments[2]});i={setIndex:!0,...i};let{index:r,roots:a}=e,o=new x2(t,{...i,[xG]:!0});if(o._roots=a,i.setIndex){let i=t.getIndex();if(null===i){let i=new rN(e.index,1,!1);t.setIndex(i)}else i.array!==r&&(i.array.set(r),i.needsUpdate=!0)}return o}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw Error("MeshBVH: Only BufferGeometries are supported.");if((t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[xG]:!1},t)).useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[xG]||(this._roots=function(e,t){let i=function(e,t){function i(e){m&&m(e/g)}function r(t,a,m,g=null,y=0){if(!v&&y>=c&&(v=!0,d&&(console.warn(`MeshBVH: Max depth of ${c} reached when generating BVH. Consider increasing maxDepth.`),console.warn(e))),m<=p||y>=c)return i(a+m),t.offset=a,t.count=m,t;let x=function(e,t,i,r,a,o){let l=-1,h=0;if(0===o)-1!==(l=yi(t))&&(h=(t[l]+t[l+3])/2);else if(1===o)-1!==(l=yi(e))&&(h=function(e,t,i,r){let a=0;for(let o=t,l=t+i;o<l;o++)a+=e[6*o+2*r];return a/i}(i,r,a,l));else if(2===o){let o=ya(e),c=1.25*a,d=6*r,p=(r+a)*6;for(let e=0;e<3;e++){let r=t[e],f=(t[e+3]-r)/32;if(a<8){let t=[...yl];t.length=a;let r=0;for(let a=d;a<p;a+=6,r++){let o=t[r];o.candidate=i[a+2*e],o.count=0;let{bounds:l,leftCacheBounds:h,rightCacheBounds:c}=o;for(let e=0;e<3;e++)c[e]=1/0,c[e+3]=-1/0,h[e]=1/0,h[e+3]=-1/0,l[e]=1/0,l[e+3]=-1/0;ys(a,i,l)}t.sort(yo);let f=a;for(let e=0;e<f;e++){let i=t[e];for(;e+1<f&&t[e+1].candidate===i.candidate;)t.splice(e+1,1),f--}for(let r=d;r<p;r+=6){let a=i[r+2*e];for(let e=0;e<f;e++){let o=t[e];a>=o.candidate?ys(r,i,o.rightCacheBounds):(ys(r,i,o.leftCacheBounds),o.count++)}}for(let i=0;i<f;i++){let r=t[i],d=r.count,p=a-r.count,f=r.leftCacheBounds,m=r.rightCacheBounds,g=0;0!==d&&(g=ya(f)/o);let v=0;0!==p&&(v=ya(m)/o);let y=1+1.25*(g*d+v*p);y<c&&(l=e,c=y,h=r.candidate)}}else{for(let e=0;e<32;e++){let t=yl[e];t.count=0,t.candidate=r+f+e*f;let i=t.bounds;for(let e=0;e<3;e++)i[e]=1/0,i[e+3]=-1/0}for(let t=d;t<p;t+=6){let a=~~((i[t+2*e]-r)/f);a>=32&&(a=31);let o=yl[a];o.count++,ys(t,i,o.bounds)}let t=yl[31];!function(e,t){t.set(e)}(t.bounds,t.rightCacheBounds);for(let e=30;e>=0;e--){let t=yl[e],i=yl[e+1];
3139yr(t.bounds,i.rightCacheBounds,t.rightCacheBounds)}let m=0;for(let t=0;t<31;t++){let i=yl[t],r=i.count,d=i.bounds,p=yl[t+1].rightCacheBounds;0!==r&&(0===m?function(e,t){t.set(e)}(d,yh):yr(d,yh,yh));let f=0,g=0;0!==(m+=r)&&(f=ya(yh)/o);let v=a-m;0!==v&&(g=ya(p)/o);let y=1+1.25*(f*m+g*v);y<c&&(l=e,c=y,h=i.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${o} used.`);return{axis:l,pos:h}}(t.boundingData,g,l,a,m,f);if(-1===x.axis)return i(a+m),t.offset=a,t.count=m,t;let b=function(e,t,i,r,a){let o=i,l=i+r-1,h=a.pos,c=2*a.axis;for(;;){for(;o<=l&&t[6*o+c]<h;)o++;for(;o<=l&&t[6*l+c]>=h;)l--;if(!(o<l))return o;for(let i=0;i<3;i++){let r=e[3*o+i];e[3*o+i]=e[3*l+i],e[3*l+i]=r;let a=t[6*o+2*i+0];t[6*o+2*i+0]=t[6*l+2*i+0],t[6*l+2*i+0]=a;let h=t[6*o+2*i+1];t[6*o+2*i+1]=t[6*l+2*i+1],t[6*l+2*i+1]=h}o++,l--}}(h,l,a,m,x);if(b===a||b===a+m)i(a+m),t.offset=a,t.count=m;else{t.splitAxis=x.axis;let e=new ye,i=b-a;t.left=e,e.boundingData=new Float32Array(6),yn(l,a,i,e.boundingData,o),r(e,a,i,o,y+1);let h=new ye,c=m-i;t.right=h,h.boundingData=new Float32Array(6),yn(l,b,c,h.boundingData,o),r(h,b,c,o,y+1)}return t}!function(e,t){if(!e.index){let i=e.attributes.position.count,r=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,a;a=i>65535?new Uint32Array(new r(4*i)):new Uint16Array(new r(2*i)),e.setIndex(new rN(a,1));for(let e=0;e<i;e++)a[e]=e}}(e,t);let a=new Float32Array(6),o=new Float32Array(6),l=function(e,t){let i=e.attributes.position,r=e.index.array,a=r.length/3,o=new Float32Array(6*a),l=i.normalized,h=i.array,c=i.offset||0,d=3;i.isInterleavedBufferAttribute&&(d=i.data.stride);let p=["getX","getY","getZ"];for(let e=0;e<a;e++){let a=3*e,f=6*e,m,g,v;l?(m=r[a+0],g=r[a+1],v=r[a+2]):(m=r[a+0]*d+c,g=r[a+1]*d+c,v=r[a+2]*d+c);for(let e=0;e<3;e++){let r,a,c;l?(r=i[p[e]](m),a=i[p[e]](g),c=i[p[e]](v)):(r=h[m+e],a=h[g+e],c=h[v+e]);let d=r;a<d&&(d=a),c<d&&(d=c);let y=r;a>y&&(y=a),c>y&&(y=c);let x=(y-d)/2,b=2*e;o[f+b+0]=d+x,o[f+b+1]=x+(Math.abs(d)+x)*5960464477539063e-23,d<t[e]&&(t[e]=d),y>t[e+3]&&(t[e+3]=y)}}return o}(e,a),h=e.index.array,c=t.maxDepth,d=t.verbose,p=t.maxLeafTris,f=t.strategy,m=t.onProgress,g=e.index.count/3,v=!1,y=[],x=function(e){if(!e.groups||!e.groups.length)return[{offset:0,count:e.index.count/3}];let t=[],i=new Set;for(let t of e.groups)i.add(t.start),i.add(t.start+t.count);let r=Array.from(i.values()).sort((e,t)=>e-t);for(let e=0;e<r.length-1;e++){let i=r[e],a=r[e+1];t.push({offset:i/3,count:(a-i)/3})}return t}(e);if(1===x.length){let e=x[0],t=new ye;t.boundingData=a,function(e,t,i,r){let a=1/0,o=1/0,l=1/0,h=-1/0,c=-1/0,d=-1/0;for(let r=6*t,p=(t+i)*6;r<p;r+=6){let t=e[r+0];t<a&&(a=t),t>h&&(h=t);let i=e[r+2];i<o&&(o=i),i>c&&(c=i);let p=e[r+4];p<l&&(l=p),p>d&&(d=p)}r[0]=a,r[1]=o,r[2]=l,r[3]=h,r[4]=c,r[5]=d}(l,e.offset,e.count,o),r(t,e.offset,e.count,o),y.push(t)}else for(let e of x){let t=new ye;t.boundingData=new Float32Array(6),yn(l,e.offset,e.count,t.boundingData,o),r(t,e.offset,e.count,o),y.push(t)}return y}(e,t),r,a,o,l=[],h=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let e=0;e<i.length;e++){let t=i[e],c=new h(32*function e(t){return t.count?1:1+e(t.left)+e(t.right)}(t));r=new Float32Array(c),a=new Uint32Array(c),o=new Uint16Array(c),function e(t,i){let l=t/4,h=t/2,c=!!i.count,d=i.boundingData;for(let e=0;e<6;e++)r[l+e]=d[e];if(c){let e=i.offset,r=i.count;return a[l+6]=e,o[h+14]=r,o[h+15]=65535,t+32}{let r=i.left,o=i.right,h=i.splitAxis,c;if((c=e(t+32,r))/4>4294967296)throw Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return a[l+6]=c/4,c=e(c,o),a[l+7]=h,c}}(0,t),l.push(c)}return l}(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new iR))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));let t=this.geometry,i=t.index.array,r=t.attributes.position,a,o,l,h,c=0,d=this._roots;for(let t=0,p=d.length;t<p;t++)o=new Uint32Array(a=d[t]),l=new Uint16Array(a),h=new Float32Array(a),function t(a,c,d=!1){let p=2*a;if(65535===l[p+15]){let e=o[a+6],t=l[p+14],c=1/0,d=1/0,f=1/0,m=-1/0,g=-1/0,v=-1/0;for(let a=3*e,o=3*(e+t);a<o;a++){let e=i[a],t=r.getX(e),o=r.getY(e),l=r.getZ(e);t<c&&(c=t),t>m&&(m=t),o<d&&(d=o),o>g&&(g=o),l<f&&(f=l),l>v&&(v=l)}return(h[a+0]!==c||h[a+1]!==d||h[a+2]!==f||h[a+3]!==m||h[a+4]!==g||h[a+
31395]!==v)&&(h[a+0]=c,h[a+1]=d,h[a+2]=f,h[a+3]=m,h[a+4]=g,h[a+5]=v,!0)}{let i=a+8,r=o[a+6],l=i+c,p=r+c,f=d,m=!1,g=!1;e?f||(m=e.has(l),g=e.has(p),f=!m&&!g):(m=!0,g=!0);let v=f||m,y=f||g,x=!1;v&&(x=t(i,c,f));let b=!1;y&&(b=t(r,c,f));let w=x||b;if(w)for(let e=0;e<3;e++){let t=i+e,o=r+e,l=h[t],c=h[t+3],d=h[o],p=h[o+3];h[a+e]=l<d?l:d,h[a+e+3]=c>p?c:p}return w}}(0,c),c+=a.byteLength}traverse(e,t=0){let i=this._roots[t],r=new Uint32Array(i),a=new Uint16Array(i);!function t(o,l=0){let h=2*o,c=65535===a[h+15];if(c){let t=r[o+6],d=a[h+14];e(l,c,new Float32Array(i,4*o,6),t,d)}else{let a=r[o+6],h=r[o+7];e(l,c,new Float32Array(i,4*o,6),h)||(t(o+8,l+1),t(a,l+1))}}(0)}raycast(e,t=0){let i=this._roots,r=this.geometry,a=[],o=t.isMaterial,l=Array.isArray(t),h=r.groups,c=o?t.side:t;for(let o=0,d=i.length;o<d;o++){let d=l?t[h[o].materialIndex].side:c,p=a.length;if(xV(i[o]),function e(t,i,r,a,o){let l=2*t,h=xF,c=xN,d=xU;if(yO(l,c))!function(e,t,i,r,a,o){for(let l=r,h=r+a;l<h;l++)yC(e,t,i,l,o)}(i,r,a,d[t+6],c[l+14],o);else{let l=t+8;yF(l,h,a,yR)&&e(l,i,r,a,o);let c=d[t+6];yF(c,h,a,yR)&&e(c,i,r,a,o)}}(0,r,d,e,a),xj(),l){let e=h[o].materialIndex;for(let t=p,i=a.length;t<i;t++)a[t].face.materialIndex=e}}return a}raycastFirst(e,t=0){let i=this._roots,r=this.geometry,a=t.isMaterial,o=Array.isArray(t),l=null,h=r.groups,c=a?t.side:t;for(let a=0,d=i.length;a<d;a++){let d=o?t[h[a].materialIndex].side:c;xV(i[a]);let p=function e(t,i,r,a){let o=2*t,l=xF,h=xN,c=xU;if(yO(o,h))return function(e,t,i,r,a){let o=1/0,l=null;for(let h=r,c=r+a;h<c;h++){let r=yC(e,t,i,h);r&&r.distance<o&&(l=r,o=r.distance)}return l}(i,r,a,c[t+6],h[o+14]);{let o=c[t+7],h=yL[o],d=a.direction[h]>=0,p,f;d?(p=t+8,f=c[t+6]):(p=c[t+6],f=t+8);let m=yF(p,l,a,yR)?e(p,i,r,a):null;if(m){let e=m.point[h];if(d?e<=l[f+o]:e>=l[f+o+3])return m}let g=yF(f,l,a,yR)?e(f,i,r,a):null;return m&&g?m.distance<=g.distance?m:g:m||g||null}}(0,r,d,e);xj(),null!=p&&(null==l||p.distance<l.distance)&&(l=p,o&&(p.face.materialIndex=h[a].materialIndex))}return l}intersectsGeometry(e,t){let i=this.geometry,r=!1;for(let a of this._roots)if(xV(a),r=yz(0,i,e,t),xj(),r)break;return r}shapecast(e,t,i){let r=this.geometry;if(e instanceof Function){if(t){let e=t;t=(t,i,r,a)=>{let o=3*i;return e(t,o,o+1,o+2,r,a)}}e={boundsTraverseOrder:i,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}let a=x1.getPrimitive(),{boundsTraverseOrder:o,intersectsBounds:l,intersectsRange:h,intersectsTriangle:c}=e;if(h&&c){let e=h;h=(t,i,o,l,h)=>!!e(t,i,o,l,h)||yP(t,i,r,c,o,l,a)}else h||(h=c?(e,t,i,o)=>yP(e,t,r,c,i,o,a):(e,t,i)=>i);let d=!1,p=0;for(let e of this._roots){if(xV(e),d=yB(0,r,l,h,o,p),xj(),d)break;p+=e.byteLength}return x1.releasePrimitive(a),d}bvhcast(e,t,i){let{intersectsRanges:r,intersectsTriangles:a}=i,o=this.geometry.index,l=this.geometry.attributes.position,h=e.geometry.index,c=e.geometry.attributes.position;xq.copy(t).invert();let d=x1.getPrimitive(),p=x1.getPrimitive();if(a){let e=function(e,i,r,f,m,g,v,y){for(let x=r,b=r+f;x<b;x++){yT(p,3*x,h,c),p.a.applyMatrix4(t),p.b.applyMatrix4(t),p.c.applyMatrix4(t),p.needsUpdate=!0;for(let t=e,r=e+i;t<r;t++)if(yT(d,3*t,o,l),d.needsUpdate=!0,a(d,p,t,x,m,g,v,y))return!0}return!1};if(r){let t=r;r=function(i,r,a,o,l,h,c,d){return!!t(i,r,a,o,l,h,c,d)||e(i,r,a,o,l,h,c,d)}}else r=e}e.getBoundingBox(xW),xW.applyMatrix4(t);let f=this.shapecast({intersectsBounds:e=>xW.intersectsBox(e),intersectsRange:(t,i,a,o,l,h)=>(xH.copy(h),xH.applyMatrix4(xq),e.shapecast({intersectsBounds:e=>xH.intersectsBox(e),intersectsRange:(e,a,h,c,d)=>r(t,i,e,a,o,l,c,d)}))});return x1.releasePrimitive(d),x1.releasePrimitive(p),f}intersectsBox(e,t){return xX.set(e.min,e.max,t),xX.needsUpdate=!0,this.shapecast({intersectsBounds:e=>xX.intersectsBox(e),intersectsTriangle:e=>xX.intersectsTriangle(e)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},r={},a=0,o=1/0){e.boundingBox||e.computeBoundingBox(),xX.set(e.boundingBox.min,e.boundingBox.max,t),xX.needsUpdate=!0;let l=this.geometry,h=l.attributes.position,c=l.index,d=e.attributes.position,p=e.index,f=x1.getPrimitive(),m=x1.getPrimitive(),g=null,v=null;r&&(g=xJ,v=x$);let y=1/0,x=null,b=null;return xq.copy(t).invert(),xY.matrix.copy(xq),this.shapecast({boun
3139dsTraverseOrder:e=>xX.distanceToBox(e),intersectsBounds:(e,t,i)=>i<y&&i<o&&(t&&(xY.min.copy(e.min),xY.max.copy(e.max),xY.needsUpdate=!0),!0),intersectsRange:(i,r)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:e=>xY.distanceToBox(e),intersectsBounds:(e,t,i)=>i<y&&i<o,intersectsRange:(e,o)=>{for(let l=3*e,w=(e+o)*3;l<w;l+=3){yT(m,l,p,d),m.a.applyMatrix4(t),m.b.applyMatrix4(t),m.c.applyMatrix4(t),m.needsUpdate=!0;for(let e=3*i,t=(i+r)*3;e<t;e+=3){yT(f,e,c,h),f.needsUpdate=!0;let t=f.distanceToTriangle(m,xZ,g);if(t<y&&(xK.copy(xZ),v&&v.copy(g),y=t,x=e/3,b=l/3),t<a)return!0}}}});{let e=p?p.count:d.count;for(let o=0;o<e;o+=3){yT(m,o,p,d),m.a.applyMatrix4(t),m.b.applyMatrix4(t),m.c.applyMatrix4(t),m.needsUpdate=!0;for(let e=3*i,t=(i+r)*3;e<t;e+=3){yT(f,e,c,h),f.needsUpdate=!0;let t=f.distanceToTriangle(m,xZ,g);if(t<y&&(xK.copy(xZ),v&&v.copy(g),y=t,x=e/3,b=o/3),t<a)return!0}}}}}),x1.releasePrimitive(f),x1.releasePrimitive(m),y===1/0?null:(i.point?i.point.copy(xK):i.point=xK.clone(),i.distance=y,i.faceIndex=x,r&&(r.point?r.point.copy(v):r.point=v.clone(),r.point.applyMatrix4(xq),xK.applyMatrix4(xq),r.distance=xK.sub(r.point).length(),r.faceIndex=b),i)}closestPointToPoint(e,t={},i=0,r=1/0){let a=i*i,o=r*r,l=1/0,h=null;if(this.shapecast({boundsTraverseOrder:t=>(xQ.copy(e).clamp(t.min,t.max),xQ.distanceToSquared(e)),intersectsBounds:(e,t,i)=>i<l&&i<o,intersectsTriangle:(t,i)=>{t.closestPointToPoint(e,xQ);let r=e.distanceToSquared(xQ);return r<l&&(xZ.copy(xQ),l=r,h=i),r<a}}),l===1/0)return null;let c=Math.sqrt(l);return t.point?t.point.copy(xZ):t.point=xZ.clone(),t.distance=c,t.faceIndex=h,t}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{yt(0,new Float32Array(t),x0),e.union(x0)}),e}},x3=tL(tz()),x4=.5*(Math.sqrt(3)-1),x5=(3-Math.sqrt(3))/6,x6=1/3,x8=1/6,x9=e=>0|Math.floor(e),x7=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),be=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function bt(e){let t=new Uint8Array(512);for(let e=0;e<256;e++)t[e]=e;for(let i=0;i<255;i++){let r=i+~~(e()*(256-i)),a=t[i];t[i]=t[r],t[r]=a}for(let e=256;e<512;e++)t[e]=t[e-256];return t}var bi,br=new rI,bs=class{constructor(e){this.weightAttribute=null;let t=e.geometry;if(!t.isBufferGeometry||3!==t.attributes.position.itemSize)throw Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");t.index&&(t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let e=this.positionAttribute,t=new Float32Array(e.count/3);for(let i=0;i<e.count;i+=3){let r=1;br.a.fromBufferAttribute(e,i),br.b.fromBufferAttribute(e,i+1),br.c.fromBufferAttribute(e,i+2),r*=br.getArea(),t[i/3]=r}this.distribution=new Float32Array(e.count/3);let i=0;for(let e=0;e<t.length;e++)i+=t[e],this.distribution[e]=i;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t){if(this.distribution){let i=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*i);return this.sampleFace(r,e,t)}}binarySearch(e){if(!this.distribution)return 0;let t=this.distribution,i=0,r=t.length-1,a=-1;for(;i<=r;){let o=Math.ceil((i+r)/2);if(0===o||t[o-1]<=e&&t[o]>e){a=o;break}e<t[o]?r=o-1:i=o+1}return a}sampleFace(e,t,i){let r=this.randomFunction(),a=this.randomFunction();return r+a>1&&(r=1-r,a=1-a),br.a.fromBufferAttribute(this.positionAttribute,3*e),br.b.fromBufferAttribute(this.positionAttribute,3*e+1),br.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(br.a,r).addScaledVector(br.b,a).addScaledVector(br.c,1-(r+a)),br.getNormal(i),this}},ba=tL(tF()),bn=new i6,bo=new i6,bl=new i6;(bi||(bi={})).is=function(e){return e&&e.__isSPEObject};var bh=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new i6,this.copyPreviousMatrix=!0,this.hiddenMatrix=new i6,this.pivotMatrix=new i6,this.matrixWorldRigid=new i6,this.shearScale=new i6,this.shearScaleInv=new i6}get __isSPEObject(){return!0}
3139isDescendantOf(e){e instanceof rw&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}updateMatrixWorld(e){for(let t of(this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0),this.children))t.updateMatrixWorld(e)}updateWorldMatrix(e,t){let i=this.parent;if(e&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),t)for(let e of this.children)e.updateWorldMatrix(!1,!0)}traverseChildren(e,t=0){for(let i of this.children)bi.is(i)&&i.traverseObject(e,t+1)}traverseObject(e,t=0){if(!0!==e(this,t))for(let i of this.children)bi.is(i)&&i.traverseObject(e,t+1)}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:i,v:r,q:a}=(0,ba.SVD)(t),o=bn.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),l=bo.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),h=bl.copy(l).transpose();
3139this.shearScale.makeScale(a[0],a[1],a[2]).multiply(h).premultiply(l),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(o,h).copyPosition(this.matrixWorld),a.every(e=>.01>Math.abs(a[0]-e))?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}attach(e,t){this.updateWorldMatrix(!0,!1);let i=new i6().copy(this.matrixWorld).invert();return null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),i.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof i6?e.hiddenMatrix.premultiply(i):e.applyMatrix4(i),e.updateWorldMatrix(!1,!1),this.add(e),void 0!==t&&(this.children.pop(),this.children.splice(t,0,e)),this}copy(e,t=!1){return super.copy(e,t),this.hasNonUniformScale=e.hasNonUniformScale,this}onAfterRender(e,t,i,r,a,o){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},bc=class extends bh(rw){},bd=e=>"Mesh"===e.type,bu=class extends bc{constructor(e){super(),this.object=e,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new bu(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){return void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return bd(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}},bp=new iD,bf=new iD,bm=new i6,bg=[new iD(-1,1,1),new iD(-1,-1,1),new iD(1,-1,1),new iD(1,1,1),new iD(-1,1,-1),new iD(-1,-1,-1),new iD(1,-1,-1),new iD(1,1,-1)],bv=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],by=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],bx=(e,t,i)=>{e.updateEntityBoxSize(bp,bf),bm.copy(t).multiply(e.matrixWorld),0===bf.x&&0===bf.y&&0===bf.z?i.push(new iD(bp.x,bp.y,bp.z).applyMatrix4(bm)):bg.forEach(e=>{i.push(e.clone().multiply(bf).add(bp).applyMatrix4(bm))})},bb=class extends iR{constructor(){super(...arguments),this.matrix=new i6,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(e=>e.clone()),this.faces=e.faces.map(e=>e.clone()),this.edges=e.edges.map(e=>e.clone()),this.centerEdges=e.centerEdges.map(e=>e.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new i6().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];return!0===i?e.traverseEntity(e=>{if(e.visible||e.cloner&&e.data.visible){if(!("geometry"in e)){r.push(new iD);return}bx(e,t,r)}}):bx(e,t,r),this.setFromPoints(r)}getCenter(e){return(e=super.getCenter(e)).applyMatrix4(this.matrix),e}getPositionToCenter(e){return(e=super.getCenter(e)).applyMatrix4(bm.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(bf).multiplyScalar(.5),this.getCenter(bp),bm.copy(this.matrix).setPosition(bp),this.vertices=bg.map(e=>e.clone().multiply(bf).applyMatrix4(bm))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=bv.map(([e,t])=>new lJ(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new iD))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=by.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}},bw={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}},bS=class extends ov{constructor(){super()}getPoints(e=12){let t=[],i,r=this.getCurveLengths(),a=r[r.length-1]/r.length;for(let o=0,l=this.curves;o<l.length;o++){let h=l[o],c=Math.ceil(e*(0===o?r[o]:r[o]-r[o-1])/a),d=h.getPoints(c);for(let e=0;e<d.length;e++){let r=d[e];i&&i.equals(r)||(t.push(r),i=r)}}return this.autoClose&&t.length>
31391&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}};function b_(e,t,i){return .001>=t.clone().sub(e).cross(t.clone().sub(i)).length()}function bA(e,t){let i=new iD(...e.position),r=new iD(...e.controlNext.position),a=new iD(...t.controlPrevious.position),o=new iD(...t.position);return b_(i,r,o)&&b_(i,a,o)}function bM(e){let t=e.points.map(e=>new iD(...e.data.position)),i=[e.points[0]],r=new iD(...i[0].data.position);for(let a=0;a<e.points.length-1;a++)b_(r,t[a],t[a+1])||(i.push(e.points[a]),r=t[a]);i.push(e.points[e.points.length-1]);let a=e.isClosed,o=i.length-(a?0:1),l=i.length,h=[];for(let t=0;t<l;t++){let r=i[t].data,o=new iD(...r.position),c=new iD(...r.controlPrevious.position),d=new iD(...r.controlNext.position),p={position:o,baseRoundness:r.roundness,controlPrevious:c,controlNext:d};if(0===r.roundness||!e.isClosed&&(0===t||t===l-1)){h[t]={...p,removedLength:0};continue}let f=a&&0==t?l-1:t-1,m=a&&t==l-1?0:t+1,g=i[f].data,v=i[m].data,y=new iD(...g.position),x=new iD(...v.position),b=y.clone().sub(o).normalize(),w=x.clone().sub(o).normalize();Object.assign(p,{prevDir:b,nextDir:w});let S=bA(g,r),_=bA(r,v);if(S&&_){let e=b.clone().add(w).normalize(),i=e.clone().cross(b).length()/b.dot(e);h[t]={...p,tan:i,removedLength:r.roundness/i}}else h[t]={...p,removedLength:0}}for(let e=0;e<o;e++){let t=e,i=a&&e===l-1?0:e+1,r=h[t],o=h[i];if(0!==r.removedLength||0!==o.removedLength){let e=r.position.distanceTo(o.position);r.removedLength=Math.min(r.removedLength,e/2),o.removedLength=Math.min(o.removedLength,e/2)}}let c=[];for(let e=0;e<o;e++){let t=e,r=a&&e===l-1?0:e+1,o=h[t],d=h[r],p=null;if(bA(i[t].data,i[r].data)){let e=o.position.clone(),t=d.position.clone();(0!==o.removedLength||0!==d.removedLength)&&(o.nextDir&&e.add(o.nextDir.clone().setLength(o.removedLength)),d.prevDir&&t.add(d.prevDir.clone().setLength(d.removedLength))),e.distanceTo(t)>.001&&(p=new oc(e,e.clone().lerp(t,.3),t.clone().lerp(e,.3),t))}else o.position.distanceTo(d.position)>.001&&(p=new oc(o.position,o.controlNext,d.controlPrevious,d.position));c[2*e+1]=p}for(let e=0;e<l;e++){let t=h[e];if(0===t.removedLength){c[2*e]=null;continue}let i=t.position,r=t.prevDir.clone().multiplyScalar(t.removedLength).add(i),a=t.nextDir.clone().multiplyScalar(t.removedLength).add(i),o=t.tan*t.removedLength,l=t.prevDir.clone().add(t.nextDir).normalize(),d=r.clone().lerp(a,.5),p=r.distanceTo(a)/2,f=l.clone().multiplyScalar(Math.sqrt(Math.pow(o,2)-Math.pow(p,2))).add(d),m=l.clone().multiplyScalar(-o).add(f),g=i.distanceTo(m)/i.distanceTo(d),v=t.prevDir.clone().multiplyScalar(g*i.distanceTo(r)).add(i),y=v.clone().lerp(m,2),x=r.clone().lerp(v,4/3),b=a.clone().lerp(y,4/3);c[2*e]=new oc(r,x,b,a)}let d=new bS;return c.forEach(e=>{e&&d.add(e)}),d}(SH||(SH={})).is=function(e){return e&&e.__isEntity};var bE=e=>SH.is(e),bC={type:"completeState",isfromEntity:!0}
vendor: 5,820 bytes, line 3139
3139,bT=["x","y","z"],bP=new iD,bD=new iD(1,1,1),bO=new iP,bI=new rn,bR=new iD().set(0,1,0),bL=e=>class extends bh(e){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new bb,this._recursiveBBox=new bb,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(e){let t=this.children[e];if(SH.is(t))return t}entityChildrenCount(){let e=this.children.length;for(;e--;)if(SH.is(this.children[e]))return e+1;return 0}get isConcreteEntity(){return"string"==typeof this.identity}get isVirtualEntity(){return"string"!=typeof this.identity}get isInstanceRoot(){return this.isConcreteEntity&&"Instance"===this.data.type}nearestInstanceSelfOrParent(){let e=this;for(;"Instance"!==e.data.type;){let t=e.parent;if(!SH.is(t))return;e=t}return e}forInstancesRec(e){this.instances.forEach(t=>{t.disposed||e(t),t.forInstancesRec(e)})}super_Entity(e,t){"string"==typeof e&&(this.uuid=e),this.identity=e,this.data=t,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(e,t,i=!1){if(!(0===this.data.states.length&&!i)){for(let e of this.data.states)y5.toOps(this.data,e.data).forEach(e=>{let i=fg.replaceProps(e,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,t)});if(null!==e){let i=this.data.states.data(e);i&&(this.dataPatched=y5.patch(this.data,i),y5.toOps(this.data,i).forEach(e=>{this.updateByPatchedOp(e,this.dataPatched,t)}))}i&&this.updateTransformState(this.dataPatched,t),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(e,t){e.setScalar(0),t.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{bE(e)&&e.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(e=>{e.resetBBoxNeedsUpdateSelf()})}find(e){let t;return this.traverseEntity(i=>{i.uuid===e&&(t=i)}),t}traverseSortNextHelper(){let e=this.parent;if(e){let t=e.children,i=t.indexOf(this)+1;if(SH.is(t[i]))return t[i];if(SH.is(e))return e.traverseSortNextHelper()}}sortNext(){let e=this.children;return this.children.length>0&&SH.is(this.children[0])?e[0]:this.traverseSortNextHelper()}goUp(e){let t=this;for(;e>0&&null!==t;)t=t.parent,e-=1;return t}hasAnccestorOrSelf(e){return this===e||this.hasAnccestor(e)}hasAnccestor(e){let t=this.parent;for(;t;){if(e===t)return!0;t=t.parent}return!1}countToAccestor(e){let t=0,i=this;for(;i!==e;){if(null===i)return -1;i=i.parent,t+=1}return t}forEachEntity(e){for(let t of this.children)bE(t)&&e(t)}traverseEntityAncestors(e){this.traverseAncestors(t=>{SH.is(t)&&e(t)})}traverseConcreteEntity(e,t=0){if(!0!==e(this,t))for(let i of this.children)bE(i)&&i.isConcreteEntity&&i.traverseEntity(e,t+1)}traverseEntity(e,t=0){if(!0!==e(this,t))for(let i of this.children)bE(i)&&i.traverseEntity(e,t+1)}traverseVisibleEntity(e){for(let t of(e(this),this.children))bE(t)&&t.visible&&t.traverseVisibleEntity(e)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(e){super.updateMatrixWorld(e),this.dispatchEvent({type:"updateMatrixWorld"})}copy(e,t=!1){return super.copy(e,t),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}hasEntityChild(){return this.children.some(e=>bE(e))}isAncestorOf(e){if(this.uuid===e)return!1;let t=!1;return this.traverseEntity(i=>{i.uuid===e&&(t=!0)}),t}toObjectTransformState(e=[]){return this.updateWorldMatrix(!0,!1),ps({position:this.position.toArray(),rotation:[this.rotation.x*t8.RAD2DEG,this.rotation.y*t8.RAD2DEG,this.rotation.z*t8.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]},e)}getTransformValues(e,t,i){return t[e].map((t,r)=>i?.shared.getVariable(t,[this.uuid,e,bT[r]])??t)}updateTransformState(e,t){let i=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,t)),i=!0),e.rotation&&(bP.fromArray(this.getTransformValues("rotation",e,t)).multiplyScalar(t8.DEG2RAD),this.rotation.setFromVector3(bP),i=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,t)),i=!0),void 0!==e.hiddenMatrix&&(i=!0,this.hiddenMatrix.fromArray(e.hiddenMatrix??gx.identity)),void 0!==e.pivot||void 0!==e.pivotRotation){if(i=!0,void 0!==e.pivot&&void 0!==e.pivotRotation)this.pivotMatrix.compose(bP.fromArray(e.pivot).negate(),bO.setFromEuler(bI.fromArray(e.pivotRotation.map(e=>e*t8.DEG2RAD))).invert(),bD);else if(void 0!==e.pivot)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(void 0!==e.pivotRotation){let t=bP.setFromMatrixPosition(this.pivotMatrix);bO.setFromEuler(bI.fromArray(e.pivotRotation.map(e=>e*t8.DEG2RAD))).invert(),this.pivotMatrix.compose(t,bO,bD)}}return i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(e=>
3139{e.invalidateClonerTransform(this)})),e.position&&e.rotation&&e.scale&&void 0!==e.hiddenMatrix&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(e=!1){if(e){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(e=>{e.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let e of this.children)SH.is(e)&&e.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(e=>{SH.is(e)&&e.disposeRecursively()})}toState(e=[]){return ps({name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(e)},e)}updateByObjUpdateOp(e,t){void 0!==e&&this.updateByOp({type:0,props:e,path:[]},{...this.data,...e},t,!1)}updateByOp(e,t,i,r){let a=this.data;this.data=t;let o=e,l=fd(e.path,["states","*"]);if(null!==l){if(0===e.type){let[t]=l;if(this?.stateSelection===t){let t={...e.props};if(delete t.name,Object.values(e.props).some(e=>void 0===e)){let i=this.data;if(void 0!==i){let r=fx.zoom(i,e.path.slice(2));if(r)for(let i in e.props)void 0===e.props[i]&&i in r&&(t[i]=r[i])}}o={...e,props:t,path:e.path.slice(2)}}}}else if(0===e.type){let t=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==t){if(void 0!==e.props.name&&t.name){let{name:e,...i}=t;t=i}if(void 0!==e.props.material&&"material"in t){let{material:e,...i}=t;t=i}let i=fx.removeOverridden(e.path,e.props,t);o={...e,props:i}}}if(this.updateByPatchedOpBase(o,y5.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),fd(e.path,["overrides"])){let r=[],a=[...e.path];for(r.push(a[1]),a.splice(0,2);a.length>0&&"descendants"===a[0];)r.push(a[1]),a.splice(0,2);if(void 0===r[r.length-1]){if(0===e.type)for(let t of Object.keys(e.props)){r[r.length-1]=t;let a=i.scene.findInstance([this.uuid,...r]);a&&(a.overrideData=e.props[t],a.updateState(pK.apply(a.component.data,a.overrideData),i))}}else{let o=i.scene.findInstance([this.uuid,...r]);if(o){let l=fx.zoom(o.component.data,a);if(0===(e={...e,path:a}).type){let t=e.props;if(l)for(let[i,r]of Object.entries(e.props))void 0===r&&(t===e.props&&(t={...e.props}),t[i]=l[i]);e={...e,props:t}}o.overrideData=y1.resolve(t.overrides,r),o.updateByOp(e,fv.applySimple(o.data,e),i,!1)}}}else if(this.instances.length>0){let r;if(0===e.path.length&&0===e.type){let t;for(let i of y2.rootOverrideProps)i in e.props&&(void 0===t&&(t={}),t[i]=e.props[i]);t&&(r={...e,props:t})}else for(let t of y2.rootOverrideProps)if(fd(e.path,[t])){r=e;break}void 0!==r&&this.instances.forEach(e=>{if(e.isInstanceRoot){let t=pK.filterOp(e.overrideData,r);t&&e.updateByOp(t,fv.applySimple(e.data,t),i,!0)}}),this.instances.forEach(r=>{if(!r.isInstanceRoot){let o=pK.filterOp(r.overrideData,e);if(o){let l;l=a===r.data&&e===o?t:fv.applySimple(r.data,o),r.updateByOp(o,l,i,!0)}}})}}updateByPatchedOpBase(e,t,i){if(this.dataPatched=t,0===e.path.length&&0===e.type)void 0===e.props.type||gU.is(e.props.type)||bw.changeEntityProptotype(this,t,i);else if(1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&"type"in e.props)for(let e of(bw.changeEntityProptotype(this,t,i),this.children))SH.is(e)&&e.updateVisible(i.scene);this.updateByPatchedOp(e,t,i)}updateByPatchedOp(e,t,i){if(0===e.path.length&&0===e.type?this.updateState(e.props,i):0===e.type&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(t,i),"morphTargetInfluences"===e.path[0]&&0===e.type){let r=t.morphTargetInfluences.get(e.path[1])?.data.name;r&&this.updateMorphInfluences(r,i.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(null!==fd(e.path,["pathSnapping"])&&this.updatePathSnapping(t.pathSnapping),null!==fd(e.path,["cloner"])){let r=fv.drop(e,1);0===r.path.length&&0===r.type&&!0===r.props.disabled?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(t.cloner,i):(this.setFromClonerState(t.cloner,i),this.expandCloner(i)),this.updateVisible(i.scene)}}updatePathSnapping(e=this.dataPatched.pathSnapping){this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(e){let t=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(null===t)return;let o=e.find(t);if(!o||!1===this._needApplyPathSnapping)return;this._needApplyPathSnapping=!1;let l=o.data;if(l.geometry.path.points.length<=1)return;let h=bM(l.geometry.path),c=(i+r)%1;i+r===1&&0===c&&(c=1);let d=null;try{d=h.curves.length?h.getPointAt(c):null}catch(e){}if(null===d)return;let p=this.parent?this.parent?.matrixWorld:new i6;o.updateMatrixWorld();let f=new i6().multiplyMatrices(p.clone().invert(),o.matrixWorld);d.applyMatrix4(f);let m={position:d.toArray(),rotation:l.rotation};if("tangential"===a){let e=new i6().extractRotation(o.matrixWorld),t=h.getTangentAt(c).applyMatrix4(e).add(d),i=new i6().lookAt(d,t,bR),r=bP.setFromEuler(new rn().setFromRotationMatrix(i)).multiplyScalar(t8.RAD2DEG);m={...m,rotation:r.toArray()}}this.updateTransformState(m),this.traverseEntity(e=>{e._cameraType&&e.dispatchEvent(bC)})}updateVisible(e){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!e)return;let t=!1;this.traverseEntity(e=>{if("Splat"===e.data.type)return t=!0,!0}),t&&e.reloadSplats()}updateState_Entity(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.raycastLock&&(this.raycastLock=e.raycastLock),void 0!==e.visible&&(this.updateVisible(t?.scene),this.resetBBoxNeedsUpdate()),t&&"cloner"in e&&void 0!==e.cloner&&(this.setFromClonerState(e.cloner,t),this.updateVisible(t.scene)),this.updateTransformState(e,t)}get attachedSurfaceCloners(){return this.children.filter(e=>e instanceof bw.Cloner&&"toObject"===e.parameters.type)}setFromClonerState(e,t){this.disposed||(null===e||e.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):void 0===this.cloner?(this.cloner=new bw.Cloner(this,e),t.scene.addPendingExpandCloner(this)):this.cloner.updateState(e,t))}expandCloner(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}invalidateClonerTransform(e){this.cloner&&this.cloner.invalidateTransform(e)}requestRender(){this.dispatchEvent({type:"requestRender"})}},bB=class{static create(e){return this.build(this.normalizeInputs(e))}
3139static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,a=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);a.thetaLength=t8.clamp(a.thetaLength,0,360);let o=a.width/2,l=a.radiusTop??o,h=a.radiusBottom??o;if(l===h?(l=o,h=o):l>h?(l=o,h=h*o/l):(l=l*o/h,h=o),a.shapeBlendNode){let e=2*Math.max(l=i??o,h=r??o);a.width=e,a.depth=e}return{parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(a.height??a.width),depth:Math.abs(a.depth??a.width),radiusTop:l,radiusBottom:h})}}static build(e){let{width:t,depth:i,height:r,radialSegments:a,heightSegments:o,openEnded:l,thetaStart:h,thetaLength:c,radiusTop:d,radiusBottom:p,cornerRadius:f,cornerSegments:m,hollow:g}=e.parameters,v;return 0===c?(v=new rQ).setAttribute("position",new rV([],3)):v=f||g?new bN(d,p,r,a,o,l,h,c*Math.PI/180,f,f,m,g):new ob(d,p,r,a,o,l,h,c*Math.PI/180),v.scale(1,1,i/t),Object.assign(v,{userData:{...e,type:"CylinderGeometry"}})}};function bz(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function bF(e){return new t9(e.y,-e.x)}var bN=class extends rQ{constructor(e,t,i,r,a,o,l,h,c,d,p,f,m=!1){super(),this.type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,t=void 0!==t?t:1,i=i||1,r=Math.floor(r)||8,a=Math.floor(a)||1,o=void 0!==o&&o,l=void 0!==l?l:0,h=void 0!==h?h:2*Math.PI,o&&(c=0,d=0);let g=[],v=[],y=[],x=[],b=0,w=i/2,S=new iD,_=new iD;m&&0==e&&(e=c),m&&0==t&&(t=d);let A=new t9(e,w),M=new t9(t,-w),E=null,C=null,T=null,P=null,D=A.clone().sub(M),O=0,I=0,R=0;f>0&&(O=Math.min(e,t)*(1-f),I=e-O,R=t-O);let L=A.clone();L.x-=O;let B=Math.PI-D.angle(),z=D.angle(),F=Math.tan(z/2),N=Math.tan(B/2),U=F+N;if(c=Math.min(c,(e-I)/(f?U:N),D.length()/U),d=Math.min(d,(t-R)/(f?U:F),D.length()/U),c>0){let e=c/F;E=A.clone().sub(new t9(e,c)),f&&(T=E.clone(),T.x-=O-U*c),A.sub(D.clone().setLength(e))}if(d>0){let e=d/N;C=M.clone().sub(new t9(e,-d)),M.add(D.clone().setLength(e)),f&&(P=C.clone(),P.x-=O-U*d,L.sub(D.clone().setLength(e)))}let k=.5>(D=A.clone().sub(M)).length(),V=[];for(let p=0;p<=r;p++){let m=[],g=p/r,w=g*h+l,A=new t9(Math.sin(w),Math.cos(w));if(P&&C?(j(m,g,A,B,d,P,-1,!0),j(m,g,A,z,d,C,-1,!1)):C?(G(m,A,C.x,0,-1),j(m,g,A,z,d,C,-1,!1)):o||G(m,A,t,R,-1),bz(bF(D).normalize(),A,S),!k)for(let e=0;e<=a;e++){let t=e/a;bz(D.clone().multiplyScalar(t).add(M),A,_),v.push(_.x,_.y,_.z),y.push(S.x,S.y,S.z),x.push(g,.5+_.y/i),m.push(b++)}if(T&&E?(j(m,g,A,B,c,E,1,!1),j(m,g,A,z,c,T,1,!0)):E?(j(m,g,A,B,c,E,1,!1),G(m,A,E.x,0,1)):o||G(m,A,e,I,1),f&&!k){bz(bF(D).multiplyScalar(-1).normalize(),A,S);for(let e=0;e<=a;e++){let t=e/a;bz(D.clone().multiplyScalar(-t).add(L),A,_),v.push(_.x,_.y,_.z),y.push(S.x,S.y,S.z),x.push(g,.5+_.y/i),m.push(b++)}}f&&!o&&m.push(m[0]),V.push(m)}for(let e=0;e<V.length-1;e++)for(let t=0;t<V[0].length-1;t++){if(o&&f&&t==a)continue;let i=V[e][t],r=V[e+1][t],l=V[e+1][t+1],h=V[e][t+1],c=v[3*l+0],d=v[3*l+2];g.push(i,r,h),(0!=c||0!=d)&&g.push(r,l,h)}function j(e,t,r,a,o,l,h,c){for(let d=0;d<p+1;d++){let f=d/p,m=h<0?f:1-f;c&&(m-=1);let g=new t9(Math.sin(m*=a),Math.cos(m)*h);bz(g.clone().multiplyScalar(o).add(l),r,_),v.push(_.x,_.y,_.z),bz(g,r,S),y.push(S.x,S.y,S.z),x.push(t,.5+_.y/i),e.push(b++)}}function G(e,t,i,r,a){let o=new iD,l=new t9,h=[i,r];for(let i of(a<0&&h.reverse(),h))l.set(i,w*a),bz(l,t,o),v.push(o.x,o.y,o.z),y.push(0,a,0),x.push(.5,.5),e.push(b++)}function H(i,r,a){let o=new t9(Math.sin(a),Math.cos(a)),l=new t9(-Math.cos(a),Math.sin(a)),h=new iD,c=i<0?(e,t,i)=>g.push(e,t,i):(e,t,i)=>g.push(e,i,t);bz(new t9((e+t+I+R)/4,0),o,h),v.push(h.x,h.y,h.z),y.push(l.x,0,l.y),x.push(.5,.5);let d=b++;for(let e of r){let t=v.slice(3*e,3*e+3);v.push(...t),y.push(l.x,0,l.y);let i=x.slice(2*e,2*e+2);x.push(...i),b++}for(let e=d+1;e<b-1;e++)c(d,e,e+1);c(d,b-1,d+1)}h<2*Math.PI&&(H(-1,V[0],l),H(1,V[V.length-1],l+h)),this.setIndex(g),this.setAttribute("position",new rV(v,3)),this.setAttribute("normal",new rV(y,3)),this.setAttribute("uv",new rV(x,2))}},bU=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=t8.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,depth:i,height:r,radialSegments:a,heightSegments:o,openEnded:l,thetaStart:h,thetaLength:c,cornerRadiusTop:d,cornerRadiusBottom:p,cornerSegments:f}=e.parameters,m;return 0===c?(m=new rQ).setAttribute("position",new rV([],3)):m=d>0||p>0||c<360?new bN(0,t/2,r,a,o,l,h,c*Math.PI/180,d,p,f,0,!0):new ow(t/2,r,a,o,l),m.scale(1,1,i/t),Object.assign(m,{userData:{...e,type:"ConeGeometry"}})}},bk=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,widthSegments:a,heightSegments:o,depthSegments:l,cornerRadius:h,cornerSegments:c}=e.parameters;
3139return Object.assign(0===h?new st(t,i,r,a,o,l):new bj(t,i,r,a,o,l,h,c),{userData:{...e,type:"CubeGeometry"}})}},bV=Math.PI/2,bj=class extends rQ{constructor(e=1,t=1,i=1,r=1,a=1,o=1,l=0,h=4){super(),this.type="BoxGeometry",r=Math.floor(r),a=Math.floor(a),o=Math.floor(o),h=Math.floor(h),l=Math.min(l,e/2,t/2,i/2);let c=[],d=[],p=[],f=[],m=0;function g(e,t,i,r,a,o,h,g,v,y){let x=(o-2*l)/v,b=(h-2*l)/y,w=o/2-l,S=h/2-l,_=g/2,A=v+1,M=y+1,E=0,C=new iD;for(let o=0;o<M;o++){let l=o*b-S;for(let h=0;h<A;h++){let c=h*x-w;C[e]=c*r,C[t]=l*a,C[i]=_,d.push(C.x,C.y,C.z),C[e]=0,C[t]=0,C[i]=g>0?1:-1,p.push(C.x,C.y,C.z),f.push(h/v),f.push(1-o/y),E+=1}}for(let e=0;e<y;e++)for(let t=0;t<v;t++){let i=m+t+A*e,r=m+t+A*(e+1),a=m+(t+1)+A*(e+1),o=m+(t+1)+A*e;c.push(i,r,o),c.push(r,a,o)}m+=E}function v(e,t,i,r,a,o,g,v,y,x){let b=(g-2*l)/x,w=g/2-l,S=v/2-l,_=y/2,A=x+1,M=0,E=new iD,C=new iD;for(let c=0;c<h+1;c++){let m=c/h*bV,g=Math.sin(m)*l,v=(1-Math.cos(m))*l,y=Math.sin(m),T=Math.cos(m);E[t]=(S+g)*a,E[i]=(_-v)*o,C[e]=0,C[t]=y*Math.sign(E[t]),C[i]=T*Math.sign(E[i]);for(let t=0;t<A;t++){let i=t*b-w;E[e]=i*r,d.push(E.x,E.y,E.z),p.push(C.x,C.y,C.z),f.push(t/x),f.push(0),M+=1}}for(let e=0;e<h;e++)for(let t=0;t<x;t++){let i=m+t+A*e,r=m+t+A*(e+1),a=m+(t+1)+A*(e+1),o=m+(t+1)+A*e;c.push(i,r,o),c.push(r,a,o)}m+=M}function y(r,a,o){let g=new iD,v=new iD(e/2,t/2,i/2);v.subScalar(l);let y=[],x=r*a*o>0?(e,t,i)=>c.push(e,t,i):(e,t,i)=>c.push(e,i,t);for(let e=0;e<=h;e++){let t=[],i=bV*(1-e/h),c=Math.cos(i),x=Math.sin(i),b=0;for(let i=0;i<=e;i++){let i=Math.cos(b),h=Math.sin(b);g.x=c*i,g.y=x,g.z=c*h;let y=v.clone().addScaledVector(g,l);d.push(r*y.x,a*y.y,o*y.z),p.push(r*g.x,a*g.y,o*g.z),f.push(0,0),t.push(m++),b+=bV/e}y.push(t)}let b=y.length-1;for(let e=0;e<b;e++){let t=y[e],i=y[e+1],r=t.length-1;x(t[0],i[1],i[0]);for(let e=1;e<=r;e++)x(t[e-1],t[e],i[e]),x(t[e],i[e+1],i[e])}}g("z","y","x",-1,-1,i,t,e,o,a),g("z","y","x",1,-1,i,t,-e,o,a),g("x","z","y",1,1,e,i,t,r,o),g("x","z","y",1,-1,e,i,-t,r,o),g("x","y","z",1,-1,e,t,i,r,a),g("x","y","z",-1,-1,e,t,-i,r,a),l>0&&(v("z","y","x",-1,-1,1,i,t,e,o),v("z","y","x",1,-1,-1,i,t,e,o),v("z","y","x",-1,1,-1,i,t,e,o),v("z","y","x",1,1,1,i,t,e,o),v("x","y","z",-1,-1,-1,e,t,i,r),v("x","y","z",1,-1,1,e,t,i,r),v("x","y","z",-1,1,1,e,t,i,r),v("x","y","z",1,1,-1,e,t,i,r),v("y","x","z",-1,-1,1,t,e,i,a),v("y","x","z",1,-1,-1,t,e,i,a),v("y","x","z",1,1,1,t,e,i,a),v("y","x","z",-1,1,-1,t,e,i,a),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),this.setIndex(c),this.setAttribute("position",new rV(d,3)),this.setAttribute("normal",new rV(p,3)),this.setAttribute("uv",new rV(f,2))}},bG=class extends rQ{constructor(e=[],t=[],i="",r=1,a=.2,o=4){super(),this.type="PolyhedronGeometryRound";let l=[],h=[],c=[];(function(){0==(a=Math.min(1-1e-5,a))&&(o=0);let h={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new iD,p=d.clone(),f=new rI,m=a*r,g=r-m,v=o+1,y=new iD,x=(e,t)=>y.subVectors(e,t).normalize(),b=(e,t)=>Array(e).fill(void 0).map(t),w=b(e.length/3,(t,i)=>new iD().fromArray(e,3*i).setLength(r)),S=[];for(let e=0;e<w.length;e++){let i=w[e],r=[],a,o,l,h=1e10,c=-1;for(;-1!=(c=t.indexOf(e,c+1));){let e=c-c%3;a=t[e+(c+1)%3],o=t[e+(c+2)%3],h=Math.min(h,l=i.distanceToSquared(w[a])),r.push([a,o,l])}h+=1e-6;let d=[],p=0,f=r.length;for(let t=0;t<f;t++){[a,o,l]=r[p];let t=S[a]?.includes(e)==!0;l<=h&&d.push(a+1e6*+t),p=r.findIndex(e=>e[0]==o)}S.push(d)}let _=[];{let e=0,t=0,i,r,a=3==h;for(let l=0;l<=o;l++){i=l*(l+1)/2,r=(l+1)*(l+2)/2;for(let h=0;h<o-l;h++)[e,t]=[i+h+l+2,r+h+l+3],_.push(i,r,...a?[t,i]:[e,r],t,e),[i,r]=[e,t];_.push(i,r,i+o+2)}}let A=d.clone(),M=d.clone(),E=d.clone(),C=d.clone(),T=d.clone(),P=[],D=b(w.length,()=>b(h,()=>d.clone()));for(let e=0;e<w.length;e++){d.copy(w[e]).normalize(),A.copy(d).multiplyScalar(g);let t=S[e];for(let i=0;i<t.length;i++){let r=t[i],a=t[(i+1)%h];f.setFromPointsAndIndices(w,e,r%1e6,a%1e6),f.b.sub(f.a).setLength(1e10).add(f.a),f.c.sub(f.a).setLength(1e10).add(f.a),f.closestPointToPoint(A,D[e][i])}let i=[],r=[],a=[],b=new iD;0==o&&[...D[e]].reduce((e,t)=>
3139e.add(t),b).multiplyScalar(1/h);for(let t=0;t<h;t++){let l=[],c=(t-1+h)%h,f=D[e][c],w=D[e][t];d.copy(f).sub(A),p.copy(w).sub(A);let S=A.angleTo(d),_=d.angleTo(p),P=Math.cos(S)*m;0==o?M.copy(b):M.copy(A).setLength(g+P),r.push(P);let O=[M,f,w];for(let e=0;e<2;e++){let t=O[e],r=O[e+1];C.subVectors(t,A),T.subVectors(r,A),E.crossVectors(C,T).normalize();for(let r=0;r<v;r++){let a=[S,_][e]*r/v;d.copy(C).applyAxisAngle(E,a).add(A),i.push(d.clone()),e&&(x(d,A),l.push([0==r?t:d.clone(),y.clone()]))}e&&(x(r,A),l.push([r,y.clone()]))}a.push(l)}P.push(a);let O=2*v;for(let e=0;e<h;e++){let t=O*e,a=(e+1)%h*O,o=[i[t]];for(let l=1;l<v;l++){C=i[t+l],T=i[a+l],o.push(C);for(let t=1,i=l-2+1;t<=i;t++)d.lerpVectors(C,T,t/(i+1)),d.sub(A).setLength(r[e]).add(A),o.push(d.clone());o.push(T)}for(let e=0;e<v;e++)o.push(i[e+v+t]);o.push(i[a+v]);let p=_.map(e=>o[e]);l.push(...p.map(e=>[e.x,e.y,e.z]).flat()),c.push(...p.map(e=>(x(e,A),[y.x,y.y,y.z])).flat())}}let O=[];for(let e=0;e<S.length;e++)for(let t=0;t<h;t++){let i=S[e][t];if(i<1e6){let r=S[i].findIndex(t=>t%1e6==e),a=P[e][t],o=P[i][r];for(let e=0;e<v;e++){let t=a[e],i=o[v-e],r=a[e+1];[t,i,r,r,i,o[v-(e+1)]].forEach(e=>{l.push(e[0].x,e[0].y,e[0].z),c.push(e[1].x,e[1].y,e[1].z)})}O.push(a[0][0],o[v][0],a[v][0],o[0][0])}}for(;O.length;){let e,t,i,r;[e,t]=O.splice(0,2);let a=[e];for(;e!=t;)a.push(t),r=(i=O.indexOf(t))%2,t=O.splice(i-r,2)[1-r];y.subVectors(a[0],a[1]).cross(d.subVectors(a[0],a[2])).normalize();let o=0>y.dot(a[0]);o&&y.negate();for(let e=1;e<=a.length-2;
3139e++)[a[e+ +o],a[e+1-+o],a[0]].forEach(e=>{l.push(e.x,e.y,e.z),c.push(y.x,y.y,y.z)})}})(),function(){let e=new iD;for(let t=0;t<l.length;t+=3){e.x=l[t+0],e.y=l[t+1],e.z=l[t+2];let i=f(e)/2/Math.PI+.5,r=Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5;h.push(i,1-r)}let t=new iD,i=new iD,r=new iD,a=new iD,o=new t9,c=new t9,d=new t9,p=(e,t,i,r)=>{r<0&&1===e.x&&(h[t]=e.x-1),0===i.x&&0===i.z&&(h[t]=r/2/Math.PI+.5)};for(let e=0,m=0;e<l.length;e+=9,m+=6){t.set(l[e+0],l[e+1],l[e+2]),i.set(l[e+3],l[e+4],l[e+5]),r.set(l[e+6],l[e+7],l[e+8]),o.set(h[m+0],h[m+1]),c.set(h[m+2],h[m+3]),d.set(h[m+4],h[m+5]),a.copy(t).add(i).add(r).divideScalar(3);let g=f(a);p(o,m+0,t,g),p(c,m+2,i,g),p(d,m+4,r,g)}for(let e=0;e<h.length;e+=6){let t=h[e+0],i=h[e+2],r=h[e+4],a=Math.max(t,i,r),o=Math.min(t,i,r);a>.9&&o<.1&&(t<.2&&(h[e+0]+=1),i<.2&&(h[e+2]+=1),r<.2&&(h[e+4]+=1))}function f(e){return Math.atan2(e.z,-e.x)}}(),this.setAttribute("position",new rV(l,3)),this.setAttribute("normal",new rV(c,3)),this.setAttribute("uv",new rV(h,2))}static fromJSON(e){return new bG(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},bH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}
vendor: 4,387 bytes, line 3139
3139static build(e){let{width:t,height:i,depth:r,detail:a,corner:o,cornerSides:l}=e.parameters,h=0===a&&0!==o?new bW(.5*t,o,l):new o_(.5*t,a);return h.scale(1,i/t,r/t),Object.assign(h,{userData:{...e,type:"DodecahedronGeometry"}})}},bW=class extends bG{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,a=1/r,o="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-a,-r,0,-a,r,0,a,-r,0,a,r,-a,-r,0,-a,r,0,a,-r,0,a,r,0,-r,0,-a,r,0,-a,-r,0,a,r,0,a],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],o,e,t,i),this.type=o}static fromJSON(e){return new bW(e.radius,e.corner,e.cornerSides)}},bq=class{constructor(e){this.position=new t9,this.startPosition=new t9,this.uuid=t8.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new bq(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},bX=class extends bq{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new bX(this.parent).copy(this)}},bY=class extends bq{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new bX(this),new bX(this))}static create(e,t){let i=new bY(e,new t9(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return 0===t?this.controls[1]:1===t?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=t?r.position.copy(this.position):r.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new bY(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){return[this.curveBefore?.getTangentAt(1),this.curveAfter?.getTangentAt(0)]}computeNormals(e=new t9,t=new t9){let[i,r]=this.computeTangents();return i&&r&&(bQ(i,e),bQ(r,t)),[e,t]}computeTangent(e=new t9){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new t9){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function bQ(e,t=new t9){let i=e.length();return t.set(-e.y/i,e.x/i)}var bZ=e=>e,bK=new t9,bJ=new t9,b$=new t9,b0=new t9,b1=new t9,b2=new t9,b3=new iD,b4=new iD;function b5(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function b6(e,t,i){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),a=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),o=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((a*a+r*r-o*o)/(2*a*r))}function b8(e,t,i){return 0===bK.copy(t).sub(e).cross(bJ.copy(i).sub(e))}function b9(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function b7(e,t){return b8(e.position,e.controls[1].position,t.position)&&b8(e.position,t.controls[0].position,t.position)}function we(e,t=12,i=!1){let r=[];for(let a=0,o=e.length;a<o;a++){let o=e[a],l=0;if(i&&void 0!==o.roundedCurveCorner){let e=.5*wt(o.roundedCurveCorner,t);a>0&&(r[a-1]+=e),l+=e}void 0!==o.curveAfter&&(l+=wt(o.curveAfter,t)),r.push(l)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*wt(e[0].roundedCurveCorner,t)),r}function wt(e,t=12){return e&&e instanceof n9?2*t:e&&(e instanceof od||e instanceof ou)?1:e&&e instanceof om?t*e.points.length:t}var wi=new t9,wr=new t9,ws=new t9,wa=new t9,wn=new t9,wo=new t9,wl=class extends oA{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new sv(ne
vendor: 3,370 bytes, line 3139
3139w iD(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=t8.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new wl;return r.isClosed=e.isClosed,r.points=e.points.map(e=>bY.create(e.id,e.data)),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(e=>wl.createFromState(e)),void 0!==t&&void 0!==i&&r.applySize(t,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,i=this.points.length;t<i;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(t=>t.uuid===e);if(i<0){let i=t;for(let t=0,r=this.shapeHoles.length;t<r;t++){let r=this.shapeHoles[t],a=r.points.length,o=r.getPointIndexById(e);if(!(o<0))return o+i;i+=a}}return i}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let r=this.shapeHoles[i],a=e-t;if(a<=r.points.length-1)return r.points[a];t+=r.points.length}}throw Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let r=this.shapeHoles[i],a=r.points.indexOf(e);if(a>=0)return t+a;t+=r.points.length}return -1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...e]}applySize(e,t){0===e&&(e=.001),0===t&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=wi.set(e,t);for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];t.position.multiply(i),t.controls[0].position.multiply(i),t.controls[1].position.multiply(i)}for(let i=0,r=this.shapeHoles.length;i<r;i++)this.shapeHoles[i].applyScale(e,t);this._update()}createPoint(e,t=0,i=t8.generateUUID()){let r=new bY(i,e instanceof t9?e:new t9(e,t));return r.roundness=this.roundness,r}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];if(i.uuid===e)return i}for(let t=0,i=this.shapeHoles.length;t<i;t++){let i=this.shapeHoles[t].getPointByUuid(e);if(i)return i}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(t=>t.uuid===e);t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e<t;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,t=12,i=!1){this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(e,t,i=12,r=!0){let a=b4.set(0,0,0),o,l=0,h=[];for(let r=0;r<t.length;r++){let c=bZ(t[r]),d=wt(c,i);h.push(d);for(let t=0;t<=d;
3139t++)if(c instanceof oh||c instanceof op||c instanceof od){if(c.getPoint(t/d,bK),a.set(bK.x,bK.y,0),void 0!==o&&function(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}(o,a))continue;void 0===o&&(o=b3),o.copy(a),e.setXYZ(l,a.x,a.y,a.z),l++}}r&&l>1&&!(e.getX(l-1)===e.getX(0)&&e.getY(l-1)===e.getY(0)&&e.getZ(l-1)===e.getZ(0))&&(e.setXYZ(l,e.getX(0),e.getY(0),e.getZ(0)),l++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((e,t)=>e+t,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=we(this.points,e,!1),this.roundedCurveDivisions=we(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*(function(e,t,i,r=12,a=!0){let o=b4.set(0,0,0),l=0,h=[];for(let a=0;a<t.length;a++){if(!1===i[a])continue;let c,d=bZ(t[a]),p=wt(d,r);h.push(p);for(let t=0;t<=p;t++)if(d instanceof oh||d instanceof op||d instanceof od){if(d.getPoint(t/p,bK),o.set(bK.x,bK.y,0),c?.equals(o))continue;void 0===c?c=b3:(e.setXYZ(l,c.x,c.y,c.z),l++,e.setXYZ(l,o.x,o.y,o.z),l++),c.copy(o)}}return a&&l>1&&!(e.getX(l-1)===e.getX(0)&&e.getY(l-1)===e.getY(0)&&e.getZ(l-1)===e.getZ(0))&&(e.setXYZ(l,e.getX(0),e.getY(0),e.getZ(0)),l++),h})(e,this.curves,t,i,this.autoClose).reduce((e,t)=>e+t,0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t),function(e,t,i=12,r=!0){let a,o=0;for(let r=0;r<t.length;r++){let l=bZ(t[r]),h=wt(l,i);for(let t=0;t<=h;
3139t++)if(l instanceof oh||l instanceof op||l instanceof od){if(l.getPoint(t/h,bK),void 0!==a&&function(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}(a,bK,1e-12))continue;void 0===a&&(a=bJ),a.copy(bK),e.push(bK.x,bK.y),o++}}return b5(e[0],e[e.length-2],1e-12)&&b5(e[1],e[e.length-1],1e-12)&&(e.pop(),e.pop()),r&&o>1&&!(b5(e[o-1],e[1],1e-12)&&b5(e[o-2],e[0],1e-12))&&(e.push(e[0],e[1]),o++),e}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,a=0;t&&void 0!==this.points[0].roundedCurveCorner&&(a=.5*wt(this.points[0].roundedCurveCorner,this.subdivision));let o=e-a;o<0&&(o+=r.reduce((e,t)=>e+t,0));for(let e=0,t=r.length;e<t;e++){let t=r[e];if(o<i+t)return[e,(o-i+1)/t];i+=t}return[0,1]}getCurveT(e,t,i){let r=this.points[e],a=this.points[e>=this.points.length-1?0:e+1],o=this.curveDivisions,l=o[e];if(b9(r,a)){let e=r.position.distanceTo(a.position);return r.position.distanceTo(wi.set(i.x,i.y))/e}let h=0;for(let t=0;t<e;t++)h+=o[t];return(t-h)/l}dispose(){}_applyCurveForPoint(e,t){b9(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let i=this.curves[this.curves.length-1];e.curveBefore=i,t.curveAfter=i;let r=i.clone();e.roundedCurveBefore=r,t.roundedCurveAfter=r,e.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];if(0===e)this.moveTo(t.position.x,t.position.y);else{let i=this.points[e-1];this._applyCurveForPoint(t,i)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let e=this.points[0],t=this.points[this.points.length-1];this._applyCurveForPoint(e,t)}if(this.points.length>2){let e=0;for(let i=0,r=this.points.length;i<r;i++){var t;let r=this.points[i],a=this.points[i-1]??this.points[this.points.length-1],o=this.points[i+1]??this.points[0],l=r.roundness,h=a&&o&&b7(a,r)&&b7(r,o)&&b8(a.position,r.position,o.position);if(!r.controlsMoved()&&l>0&&!h){let a,o=r.curveBefore,h=r.curveAfter;if(void 0===o||void 0===h)continue;let c=r.roundedCurveBefore,d=r.roundedCurveAfter,p=o.getLength(),f=h.getLength(),m=Math.min(Math.min(l,.499*p),Math.min(l,.499*f)),g=1-m/p,v=m/f,y=o.getPointAt(g,wi),x=h.getPointAt(v,wr);if(this._subSplitCurve(o,c,g,y,void 0),this._subSplitCurve(h,d,v,void 0,x),this.useCubicForRoundedCorners){let e=Math.tan(b6(y,r.position,x)/2)*y.distanceTo(r.position),[i,o]=function(e,t,i,r,a){let o=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),l=(e.y+t.y)/2,h=(e.x+t.x)/2,c=Math.sqrt(Math.pow(i,2)-Math.pow(o/2,2))*(e.y-t.y)/o,d=Math.sqrt(Math.pow(i,2)-Math.pow(o/2,2))*(t.x-e.x)/o;return r.set(h+c,l+d),a.set(h-c,l-d),[r,a]}(y,x,e,ws,wa),[l,h]=function(e,t,i,r,a,o){let l=t.x-e.x,h=t.y-e.y,c=i.x-e.x,d=i.y-e.y,p=Math.sqrt((l+c)*(l+c)+(h+d)*(h+d)),f;return b6(t,e,i)>Math.PI&&(p*=-1),f=b5(d,h)?(h+d)*(r/p-.5)*8/3/(l-c):(l+c)*(r/p-.5)*8/3/(d-h),a.set(t.x-f*h,t.y+f*l),o.set(i.x+f*d,i.y-f*c),[a,o]}((t=r.position,i.distanceTo(t)<o.distanceTo(t)?o:i),y,x,e,wn,wo);a=new oh(y.clone(),l.clone(),h.clone(),x.clone())}else a=new op(y.clone(),r.position.clone(),x.clone());r.roundedCurveCorner=a,this.roundedCurves.splice(i+e,0,a),e++}}}}_subSplitCurve(e,t,i,r,a){if(e instanceof od)void 0!==r&&t.v2.copy(r),void 0!==a&&t.v1.copy(a);else{let o=e.getUtoTmapping(i,0),l=function(e,t,i,r,a=.5){let o=bK.subVectors(t,e).multiplyScalar(a).add(e),l=bJ.subVectors(i,t).multiplyScalar(a).add(t),h=b$.subVectors(r,i).multiplyScalar(a).add(i),c=b0.subVectors(l,o).multiplyScalar(a).add(o),d=b1.subVectors(h,l).multiplyScalar(a).add(l),p=b2.subVectors(d,c).multiplyScalar(a).add(c);return[e.x,e.y,o.x,o.y,c.x,c.y,p.x,p.y,d.x,d.y,h.x,h.y,r.x,r.y]}(e.v0,e.v1,e.v2,e.v3,o);return void 0!==r&&(t.v0.set(l[0],l[1]),t.v1.set(l[2],l[3]),t.v2.set(l[4],l[5]),t.v3.set(l[6],l[7])),void 0!==a&&(t.v0.set(l[6],l[7]),t.v1.set(l[8],l[9]),t.v2.set(l[10],l[11]),t.v3.set(l[12],l[13])),t}return t}clone(){let e=new wl(this._width,this._height);return e.points=this.points.map(e=>e.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(e=>e.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>
vendor: 14,065 bytes, line 3139
3139e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let t=7*i,r=e.points[t+0],a=e.points[t+1],o=e.points[t+2],l=e.points[t+3],h=e.points[t+4],c=e.points[t+5],d=e.points[t+6],p=new bY(t8.generateUUID(),new t9(r,a));p.controls[0].position.set(o,l),p.controls[1].position.set(h,c),p.roundness=d,this.points.push(p)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(e=>{let t=new wl;return t.fromJSON(e),t}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(e,t)=>{t instanceof oh&&t.v3.equals(e.position)&&e.controls[0].position.copy(t.v2)};return this.points=(e=>{let t=[],r,a;for(r=0,a=e.length;r<a;r++)e[r]instanceof op&&(e[r]=function(e){let t=new t9;t.addVectors(e.v0,bK.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new t9;return i.addVectors(e.v2,bJ.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new oh(e.v0,t,i,e.v2)}(e[r]));for(r=0,a=e.length;r<a;r++){let a=e[r],o=r>0?e[r-1]:null,l;a instanceof oh?(l=this.createPoint(a.v0)).controls[1].position.copy(a.v1):a instanceof od&&(l=this.createPoint(a.v1)),void 0!==l&&(null!==o&&i(l,o),t.push(l))}let o=e[e.length-1],l=!1;return o instanceof oh?o.v3.equals(t[0].position)&&(t[0].controls[0].position.copy(o.v2),l=!0):o instanceof od&&o.v2.equals(t[0].position)&&(l=!0),this.isClosed=l,t})(e.curves),e instanceof oA&&(this.shapeHoles=e.holes.map(e=>{let t=new wl;return t.fromShape(e),t})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.roundness&&(i.roundness=t.roundness),void 0!==t.areControlsDirectionsMirrored&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},wh=2*Math.PI;function wc({x:e,y:t},i,r,a,o){return{x:e*i+a,y:t*r+o}}function wd(e,t,i,r){let a=Math.min(1,Math.max(-1,e*i+t*r));return(e*r-t*i<0?-1:1)*Math.acos(a)}function wu(e,t){if(!e)throw t||"Assertion Failed!"}(Sj=SW||(SW={}))[Sj.ODD=0]="ODD",Sj[Sj.NONZERO=1]="NONZERO",Sj[Sj.POSITIVE=2]="POSITIVE",Sj[Sj.NEGATIVE=3]="NEGATIVE",Sj[Sj.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",(SG=Sq||(Sq={}))[SG.POLYGONS=0]="POLYGONS",SG[SG.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",SG[SG.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS";var wp=function(){function e(){}return e.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},e.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},e.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},e.edgeGoesLeft=function(t){return e.vertLeq(t.Dst,t.Org)},e.edgeGoesRight=function(t){return e.vertLeq(t.Org,t.Dst)},e.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},e.edgeEval=function(t,i,r){wu(e.vertLeq(t,i)&&e.vertLeq(i,r));var a=i.s-t.s,o=r.s-i.s;return a+o>0?a<o?i.t-t.t+(t.t-r.t)*(a/(a+o)):i.t-r.t+(r.t-t.t)*(o/(a+o)):0},e.edgeSign=function(t,i,r){wu(e.vertLeq(t,i)&&e.vertLeq(i,r));var a=i.s-t.s,o=r.s-i.s;return a+o>0?(i.t-r.t)*a+(i.t-t.t)*o:0},e.transEval=function(t,i,r){wu(e.transLeq(t,i)&&e.transLeq(i,r));var a=i.t-t.t,o=r.t-i.t;return a+o>0?a<o?i.s-t.s+(t.s-r.s)*(a/(a+o)):i.s-r.s+(r.s-t.s)*(o/(a+o)):0},e.transSign=function(t,i,r){wu(e.transLeq(t,i)&&e.transLeq(i,r));var a=i.t-t.t,o=r.t-i.t;return a+o>0?(i.s-r.s)*a+(i.s-t.s)*o:0},e.vertCCW=function(e,t,i){return e.s*(t.t-i.t)+t.s*(i.t-e.t)+i.s*(e.t-t.t)>=0},e.interpolate=function(e,t,i,r){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)},e.intersect=function(t,i,r,a,o){var l,h,c;e.vertLeq(t,i)||(c=t,t=i,i=c),e.vertLeq(r,a)||(c=r,r=a,a=c),e.vertLeq(t,r)||(c=t,t=r,r=c,c=i,i=a,a=c),e.vertLeq(r,i)?e.vertLeq(i,a)?((l=e.edgeEval(t,r,i))+(h=e.edgeEval(r,i,a))<0&&(l=-l,h=-h),o.s=e.interpolate(l,r.s,h,i.s)):((l=e.edgeSign(t,r,i))+(h=-e.edgeSign(t,a,i))<0&&(l=-l,h=-h),o.s=e.interpolate(l,r.s,h,a.s)):o.s=(r.s+i.s)/2,e.transLeq(t,i)||(c=t,t=i,i=c),e.transLeq(r,a)||(c=r,r=a,a=c),e.transLeq(t,r)||(c=t,t=r,r=c,c=i,i=a,a=c),e.transLeq(r,i)?e.transLeq(i,a)?((l=e.transEval(t,r,i))+(h=e.transEval(r,i,a))<0&&(l=-l,h=-h),o.t=e.interpolate(l,r.t,h,i.t)):((l=e.transSign(t,r,i))+(h=-e.transSign(t,a,i))<0&&(l=-l,h=-h),o.t=e.interpolate(l,r.t,h,a.t)):o.t=(r.t+i.t)/2},e}(),wf=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},wm=function(){function e(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),wg=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},wv=function(){function e(){var e=new wg,t=new wf,i=new wm(0),r=new wm(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,i.next=i,i.Sym=r,r.next=r,r.Sym=i,this.vHead=e,this.fHead=t,this.eHead=i,this.eHeadSym=r}return e.prototype.makeEdge_=function(e){var t=new wm(0),i=new wm(1);e.Sym.side<e.side&&(e=e.Sym);var r=e.Sym.next;return i.next=r,r.Sym.next=t,t.next=e,e.Sym.next=i,t.Sym=i,t.Onext=t,t.Lnext=i,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,i.Sym=t,i.Onext=i,i.Lnext=t,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,t},e.prototype.splice_=function(e,t){var i=e.Onext,r=t.Onext;i.Sym.Lnext=t,r.Sym.Lnext=e,e.Onext=r,t.Onext=i},e.prototype.makeVertex_=function(e,t,i){wu(e,"Vertex can't be null!");var r=i.prev;e.prev=r,r.next=e,e.next=i,i.prev=e,e.anEdge=t;var a=t;do a.Org=e,a=a.Onext;while(a!==t)},e.prototype.makeFace_=function(e,t,i){wu(e,"Face can't be null");var r=i.prev;e.prev=r,r.next=e,e.next=i,i.prev=e,e.anEdge=t,e.trail=null,e.marked=!1,e.inside=i.inside;var a=t;do a.Lface=e,a=a.Lnext;while(a!==t)},e.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,i=e.Sym.next;t.Sym.next=i,i.Sym.next=t},e.prototype.killVertex_=function(e,t){var i=e.anEdge,r=i;do r.Org=t,r=r.Onext;while(r!==i);var a=e.prev,o=e.next;o.prev=a,a.next=o},e.prototype.killFace_=function(e,t){var i=e.anEdge,r=i;do r.Lface=t,r=r.Lnext;while(r!==i);var a=e.prev,o=e.next;o.prev=a,a.next=o},e.prototype.makeEdge=function(){var e=new wg,t=new wg,i=new wf,r=this.makeEdge_(this.eHead);return this.makeVertex_(e,r,this.vHead),this.makeVertex_(t,r.Sym,this.vHead),this.makeFace_(i,r,this.fHead),r},e.prototype.splice=function(e,t){var i=!1,r=!1;if(e!==t){if(t.Org!==e.Org&&(r=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!r){var a=new wg;this.makeVertex_(a,t,e.Org),e.Org.anEdge=e}if(!i){var o=new wf;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},e.prototype.delete=function(e){var t=e.Sym,i=!1;if(e.Lface!==e.Rface&&(i=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!i){var r=new wf;this.makeFace_(r,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},e.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),i=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var r=new wg;return this.makeVertex_(r,i,t.Org),t.Lface=i.Lface=e.Lface,t},e.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e).Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,t),e.Dst=t.Org,t.Dst.anEdge=t.Sym,t.Rface=e.Rface,t.winding=e.winding,t.Sym.winding=e.Sym.winding,t.idx=e.idx,t.Sym.idx=e.Sym.idx,t},e.prototype.connect=function(e,t){var i=!1,r=this.makeEdge_(e),a=r.Sym;if(t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(r,e.Lnext),this.splice_(a,t),r.Org=e.Dst,a.Org=t.Org,r.Lface=a.Lface=e.Lface,e.Lface.anEdge=a,!i){var o=new wf;this.makeFace_(o,r,e.Lface)}return r},e.prototype.zapFace=function(e){var t,i,r,a,o,l=e.anEdge;i=l.Lnext;do i=(t=i).Lnext,t.Lface=null,null===t.Rface&&(t.Onext===t?this.killVertex_(t.Org,null):(t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),(r=t.Sym).Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),this.killEdge_(t));while(t!=l);a=e.prev,(o=e.next).prev=a,a.next=o},e.prototype.countFaceVerts_=function(e){var t=e.anEdge,i=0;do i++,t=t.Lnext;while(t!==e.anEdge);return i},e.prototype.mergeConvexFaces=function(e){var t,i,r,a,o;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(t.inside)for(o=(i=t.anEdge).Org;r=i.Lnext,(a=i.Sym)&&a.Lface&&a.Lface.inside&&this.countFaceVerts_(t)+this.countFaceVerts_(a.Lface)-2<=e&&wp.vertCCW(i.Lprev.Org,i.Org,a.Lnext.Lnext.Org)&&wp.vertCCW(a.Lprev.Org,a.Org,i.Lnext.Lnext.Org)&&(r=a.Lnext,this.delete(a),i=null,a=null),!(i&&i.Lnext.Org===o);)i=r;return!0},e.prototype.check=function(){var e,t,i,r,a,o,l=this.fHead,h=this.vHead,c=this.eHead;for(t=l,t=l;(e=t.next)!==l;t=e){wu(e.prev===t),a=e.anEdge;do wu(a.Sym!==a),wu(a.Sym.Sym===a),wu(a.Lnext.Onext.Sym===a),wu(a.Onext.Sym.Lnext===a),wu(a.Lface===e),a=a.Lnext;while(a!==e.anEdge)}for(wu(e.prev===t&&null===e.anEdge),r=h,r=h;(i=r.next)!==h;r=i){wu(i.prev===r),a=i.anEdge;do wu(a.Sym!==a),wu(a.Sym.Sym===a),wu(a.Lnext.Onext.Sym===a),wu(a.Onext.Sym.Lnext===a),wu(a.Org===i),a=a.Onext;while(a!==i.anEdge)}for(wu(i.prev===r&&null===i.anEdge),o=c,o=c;(a=o.next)!==c;o=a)wu(a.Sym.next===o.Sym),wu(a.Sym!==a),wu(a.Sym.Sym===a),wu(null!==a.Org),wu(null!==a.Dst),wu(a.Lnext.Onext.Sym===a),wu(a.Onext.Sym.Lnext===a);wu(a.Sym.next===o.Sym&&a.Sym===this.eHeadSym&&a.Sym.Sym===a&&null===a.Org&&null===a.Dst&&null===a.Lface&&null===a.Rface)},e}(),wy=function(){this.handle=null},wx=function(){this.key=null,this.node=0},wb=function(){function e(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var i=0;i<e+1;i++)this.nodes[i]=new wy,this.handles[i]=new wx;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(e){var t,i,r,a=this.nodes,o=this.handles;for(t=a[e].handle;;){if((r=e<<1)<this.size&&this.leq(o[a[r+1].handle].key,o[a[r].handle].key)&&++r,wu(r<=this.max),i=a[r].handle,r>this.size||this.leq(o[t].key,o[i].key)){a[e].handle=t,o[t].node=e;break}a[e].handle=i,o[i].node=e,e=r}},e.prototype.floatUp_=function(e){var t,i,r,a=this.nodes,o=this.handles;for(t=a[e].handle;;){if(i=a[r=e>>1].handle,0===r||this.leq(o[i].key,o[t].key)){a[e].handle=t,o[t].node=e;break}a[e].handle=i,o[i].node=e,e=r}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,i,r,a;if(2*(t=++this.size)>this.max){for(this.max*=2,a=this.nodes.length,this.nodes.length=this.max+1,r=a;r<this.nodes.length;r++)this.nodes[r]=new wy;for(a=this.handles.length,this.handles.length=this.max+1,r=a;r<this.handles.length;r++)this.handles[r]=new wx}return 0===this.freeList?i=t:(i=this.freeList,this.freeList=this.handles[i].node),this.nodes[t].handle=i,this.handles[i].node=t,this.handles[i].key=e,this.initialized&&this.floatUp_(t),i},e.prototype.extractMin=function(){var e=this.nodes,t=this.handles,i=e[1].handle,r=t[i].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[i].key=null,t[i].node=this.freeList,this.freeList=i,--this.size,this.size>0&&this.floatDown_(1)),r},e.prototype.delete=function(e){var t,i=this.nodes,r=this.handles;wu(e>=1&&e<=this.max&&null!==r[e].key),i[t=r[e].node].handle=i[this.size].handle,r[i[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(r[i[t>>1].handle].key,r[i[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},e}(),ww=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},wS=function(){this.key=null,this.next=null,this.prev=null},w_=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new wS,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do t=t.next;while(null!==t.key&&!this.leq(this.frame,e,t.key));return t},e.prototype.insertBefore=function(e,t){do e=e.prev;while(null!==e.key&&!this.leq(this.frame,e.key,t));var i=new wS;return i.key=t,i.next=e.next,e.next.prev=i,i.prev=e,e.next=i,i},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),wA=function(){function e(){}
3139return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,i){var r=e.event,a=t.eUp,o=i.eUp;return a.Dst===r?o.Dst===r?wp.vertLeq(a.Org,o.Org)?0>=wp.edgeSign(o.Dst,a.Org,o.Org):wp.edgeSign(a.Dst,o.Org,a.Org)>=0:0>=wp.edgeSign(o.Dst,r,o.Org):o.Dst===r?wp.edgeSign(a.Dst,r,a.Org)>=0:wp.edgeEval(a.Dst,r,a.Org)>=wp.edgeEval(o.Dst,r,o.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&wu(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){wu(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=i,i.activeRegion=t},e.topLeftRegion=function(t,i){var r,a=i.eUp.Org;do i=e.regionAbove(i);while(i.eUp.Org===a);if(i.fixUpperEdge){if(null===(r=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;e.fixUpperEdge(t,i,r),i=e.regionAbove(i)}return i},e.topRightRegion=function(t){var i=t.eUp.Dst;do t=e.regionAbove(t);while(t.eUp.Dst===i);return t},e.addRegionBelow=function(e,t,i){var r=new ww;return r.eUp=i,r.nodeUp=e.dict.insertBefore(t.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,i.activeRegion=r,r},e.isWindingInside=function(e,t){switch(e.windingRule){case SW.ODD:return(1&t)!=0;case SW.NONZERO:return 0!==t;case SW.POSITIVE:return t>0;case SW.NEGATIVE:return t<0;case SW.ABS_GEQ_TWO:return t>=2||t<=-2}throw Error("Invalid winding rulle")},e.computeWinding=function(t,i){i.windingNumber=e.regionAbove(i).windingNumber+i.eUp.winding,i.inside=e.isWindingInside(t,i.windingNumber)},e.finishRegion=function(t,i){var r=i.eUp,a=r.Lface;a.inside=i.inside,a.anEdge=r,e.deleteRegion(t,i)},e.finishLeftRegions=function(t,i,r){for(var a,o=null,l=i,h=i.eUp;l!==r;){if(l.fixUpperEdge=!1,(a=(o=e.regionBelow(l)).eUp).Org!=h.Org){if(!o.fixUpperEdge){e.finishRegion(t,l);break}a=t.mesh.connect(h.Lprev,a.Sym),e.fixUpperEdge(t,o,a)}h.Onext!==a&&(t.mesh.splice(a.Oprev,a),t.mesh.splice(h,a)),e.finishRegion(t,l),h=o.eUp,l=o}return h},e.addRightEdges=function(t,i,r,a,o,l){var h,c,d,p,f=!0;d=r;do wu(wp.vertLeq(d.Org,d.Dst)),e.addRegionBelow(t,i,d.Sym),d=d.Onext;while(d!==a);for(null===o&&(o=e.regionBelow(i).eUp.Rprev),c=i,p=o;(d=(h=e.regionBelow(c)).eUp.Sym).Org===p.Org;)d.Onext!==p&&(t.mesh.splice(d.Oprev,d),t.mesh.splice(p.Oprev,d)),h.windingNumber=c.windingNumber-d.winding,h.inside=e.isWindingInside(t,h.windingNumber),c.dirty=!0,!f&&e.checkForRightSplice(t,c)&&(e.addWinding(d,p),e.deleteRegion(t,c),t.mesh.delete(p)),f=!1,c=h,p=d;c.dirty=!0,wu(c.windingNumber-d.winding===h.windingNumber),l&&e.walkDirtyRegions(t,c)},e.spliceMergeVertices=function(e,t,i){e.mesh.splice(t,i)},e.vertexWeights=function(e,t,i){var r=wp.vertL1dist(t,e),a=wp.vertL1dist(i,e),o=.5*a/(r+a),l=.5*r/(r+a);e.coords[0]+=o*t.coords[0]+l*i.coords[0],e.coords[1]+=o*t.coords[1]+l*i.coords[1],e.coords[2]+=o*t.coords[2]+l*i.coords[2]},e.getIntersectData=function(t,i,r,a,o,l){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,r,a),e.vertexWeights(i,o,l)},e.checkForRightSplice=function(t,i){var r=e.regionBelow(i),a=i.eUp,o=r.eUp;if(wp.vertLeq(a.Org,o.Org)){if(wp.edgeSign(o.Dst,a.Org,o.Org)>0)return!1;wp.vertEq(a.Org,o.Org)?a.Org!==o.Org&&(t.pq.delete(a.Org.pqHandle),e.spliceMergeVertices(t,o.Oprev,a)):(t.mesh.splitEdge(o.Sym),t.mesh.splice(a,o.Oprev),i.dirty=r.dirty=!0)}else{if(0>wp.edgeSign(a.Dst,o.Org,a.Org))return!1;e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(a.Sym),t.mesh.splice(o.Oprev,a)}return!0},e.checkForLeftSplice=function(t,i){var r,a=e.regionBelow(i),o=i.eUp,l=a.eUp;if(wu(!wp.vertEq(o.Dst,l.Dst)),wp.vertLeq(o.Dst,l.Dst)){if(0>wp.edgeSign(o.Dst,l.Dst,o.Org))return!1;e.regionAbove(i).dirty=i.dirty=!0,r=t.mesh.splitEdge(o),t.mesh.splice(l.Sym,r),r.Lface.inside=i.inside}else{if(wp.edgeSign(l.Dst,o.Dst,l.Org)>0)return!1;i.dirty=a.dirty=!0,r=t.mesh.splitEdge(l),t.mesh.splice(o.Lnext,l.Sym),r.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var r,a,o=e.regionBelow(i),l=i.eUp,h=o.eUp,c=l.Org,d=h.Org,p=l.Dst,f=h.Dst,m=new wg;if(wu(!wp.vertEq(f,p)),wu(0>=wp.edgeSign(p,t.event,c)),wu(wp.edgeSign(f,t.event,d)>=0),wu(c!==t.event&&d!==t.event),wu(!i.fixUpperEdge&&!o.fixUpperEdge),c===d||Math.min(c.t,p.t)>Math.max(d.t,f.t))return!1;
3139if(wp.vertLeq(c,d)){if(wp.edgeSign(f,c,d)>0)return!1}else if(0>wp.edgeSign(p,d,c))return!1;return e.debugEvent(t),wp.intersect(p,c,f,d,m),wu(Math.min(c.t,p.t)<=m.t),wu(m.t<=Math.max(d.t,f.t)),wu(Math.min(f.s,p.s)<=m.s),wu(m.s<=Math.max(d.s,c.s)),wp.vertLeq(m,t.event)&&(m.s=t.event.s,m.t=t.event.t),r=wp.vertLeq(c,d)?c:d,wp.vertLeq(r,m)&&(m.s=r.s,m.t=r.t),wp.vertEq(m,c)||wp.vertEq(m,d)?(e.checkForRightSplice(t,i),!1):!wp.vertEq(p,t.event)&&wp.edgeSign(p,t.event,m)>=0||!wp.vertEq(f,t.event)&&0>=wp.edgeSign(f,t.event,m)?f===t.event?(t.mesh.splitEdge(l.Sym),t.mesh.splice(h.Sym,l),i=e.topLeftRegion(t,i),l=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),o),e.addRightEdges(t,i,l.Oprev,l,l,!0),!0):p===t.event?(t.mesh.splitEdge(h.Sym),t.mesh.splice(l.Lnext,h.Oprev),o=i,i=e.topRightRegion(i),a=e.regionBelow(i).eUp.Rprev,o.eUp=h.Oprev,h=e.finishLeftRegions(t,o,null),e.addRightEdges(t,i,h.Onext,l.Rprev,a,!0),!0):(wp.edgeSign(p,t.event,m)>=0&&(e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(l.Sym),l.Org.s=t.event.s,l.Org.t=t.event.t),0>=wp.edgeSign(f,t.event,m)&&(i.dirty=o.dirty=!0,t.mesh.splitEdge(h.Sym),h.Org.s=t.event.s,h.Org.t=t.event.t),!1):(t.mesh.splitEdge(l.Sym),t.mesh.splitEdge(h.Sym),t.mesh.splice(h.Oprev,l),l.Org.s=m.s,l.Org.t=m.t,l.Org.pqHandle=t.pq.insert(l.Org),e.getIntersectData(t,l.Org,c,p,d,f),e.regionAbove(i).dirty=i.dirty=o.dirty=!0,!1)},e.walkDirtyRegions=function(t,i){for(var r,a,o=e.regionBelow(i);;){for(;o.dirty;)i=o,o=e.regionBelow(o);if(!i.dirty&&(o=i,null===(i=e.regionAbove(i))||!i.dirty))return;if(i.dirty=!1,r=i.eUp,a=o.eUp,r.Dst!==a.Dst&&e.checkForLeftSplice(t,i)&&(o.fixUpperEdge?(e.deleteRegion(t,o),t.mesh.delete(a),a=(o=e.regionBelow(i)).eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(r),r=(i=e.regionAbove(o)).eUp)),r.Org!==a.Org){if(r.Dst===a.Dst||i.fixUpperEdge||o.fixUpperEdge||r.Dst!==t.event&&a.Dst!==t.event)e.checkForRightSplice(t,i);else if(e.checkForIntersect(t,i))return}r.Org===a.Org&&r.Dst===a.Dst&&(e.addWinding(a,r),e.deleteRegion(t,i),t.mesh.delete(r),i=e.regionAbove(o))}},e.connectRightVertex=function(t,i,r){var a,o=r.Onext,l=e.regionBelow(i),h=i.eUp,c=l.eUp,d=!1;if(h.Dst!==c.Dst&&e.checkForIntersect(t,i),wp.vertEq(h.Org,t.event)&&(t.mesh.splice(o.Oprev,h),i=e.topLeftRegion(t,i),o=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),l),d=!0),wp.vertEq(c.Org,t.event)&&(t.mesh.splice(r,c.Oprev),r=e.finishLeftRegions(t,l,null),d=!0),d){e.addRightEdges(t,i,r.Onext,o,o,!0);return}a=wp.vertLeq(c.Org,h.Org)?c.Oprev:h,a=t.mesh.connect(r.Lprev,a),e.addRightEdges(t,i,a,a.Onext,a.Onext,!1),a.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,i)},e.connectLeftDegenerate=function(t,i,r){var a,o,l,h,c;if(a=i.eUp,wp.vertEq(a.Org,r)){wu(!1),e.spliceMergeVertices(t,a,r.anEdge);return}if(!wp.vertEq(a.Dst,r)){t.mesh.splitEdge(a.Sym),i.fixUpperEdge&&(t.mesh.delete(a.Onext),i.fixUpperEdge=!1),t.mesh.splice(r.anEdge,a),e.sweepEvent(t,r);return}wu(!1),i=e.topRightRegion(i),o=h=(l=(c=e.regionBelow(i)).eUp.Sym).Onext,c.fixUpperEdge&&(wu(o!==l),e.deleteRegion(t,c),t.mesh.delete(l),l=o.Oprev),t.mesh.splice(r.anEdge,l),wp.edgeGoesLeft(o)||(o=null),e.addRightEdges(t,i,l.Onext,h,o,!0)},e.connectLeftVertex=function(t,i){var r,a,o,l,h,c,d=new ww;if(d.eUp=i.anEdge.Sym,r=t.dict.search(d).key,a=e.regionBelow(r)){if(l=r.eUp,h=a.eUp,0===wp.edgeSign(l.Dst,i,l.Org)){e.connectLeftDegenerate(t,r,i);return}(o=wp.vertLeq(h.Dst,l.Dst)?r:a,r.inside||o.fixUpperEdge)?(c=o===r?t.mesh.connect(i.anEdge.Sym,l.Lnext):t.mesh.connect(h.Dnext,i.anEdge).Sym,o.fixUpperEdge?e.fixUpperEdge(t,o,c):e.computeWinding(t,e.addRegionBelow(t,r,c)),e.sweepEvent(t,i)):e.addRightEdges(t,r,i.anEdge,i.anEdge,null,!0)}},e.sweepEvent=function(t,i){t.event=i,e.debugEvent(t);for(var r=i.anEdge;null===r.activeRegion;)if((r=r.Onext)===i.anEdge){e.connectLeftVertex(t,i);return}var a=e.topLeftRegion(t,r.activeRegion);wu(null!==a);var o=e.regionBelow(a),l=o.eUp,h=e.finishLeftRegions(t,o,null);h.Onext===l?e.connectRightVertex(t,a,h):e.addRightEdges(t,a,h.Onext,l,l,!0)},e.addSentinel=function(e,t,i,r){var a=new ww,o=e.mesh.makeEdge();o.Org.s=i,o.Org.t=r,o.Dst.s=t,o.Dst.t=r,e.event=o.Dst,a.eUp=o,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=e.dict.insert(a)},e.initEdgeDict=function(t){t.dict=new w_(t,e.edgeLeq);var i=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],a=t.bmin[0]-i,o=t.bmax[0]+i,l=t.bmin[1]-r,h=t.bmax[1]+r;e.addSentinel(t,a,o,l),e.addSentinel(t,a,o,h)},e.doneEdgeDict=function(t){for(var i,r=0;null!==(i=t.dict.min().key);)i.sentinel||(wu(i.fixUpperEdge),wu(1==++r)),wu(0===i.windingNumber),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,r,a,o=t.mesh.eHead;for(i=o.next;i!==o;i=r)r=i.next,a=i.Lnext,wp.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,a,i),t.mesh.delete(i),a=(i=a).Lnext),a.Lnext===i&&(a!==i&&((a===r||a===r.Sym)&&(r=r.next),t.mesh.delete(a)),(i===r||i===r.Sym)&&(r=r.next),t.mesh.delete(i))},e.initPriorityQ=function(e){var t,i,r,a=0;for(i=(r=e.mesh.vHead).next;i!==r;i=i.next)a++;for(a+=8,t=e.pq=new wb(a,wp.vertLeq),i=(r=e.mesh.vHead).next;i!==r;i=i.next)i.pqHandle=t.insert(i);return i===r&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,i){var r,a,o;for(r=i.fHead.next;r!==i.fHead;r=a)a=r.next,wu((o=r.anEdge).Lnext!==o),o.Lnext.Lnext===o&&(e.addWinding(o.Onext,o),t.mesh.delete(o));return!0},e.computeInterior=function(t,i){var r,a;if(void 0===i&&(i=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(r=t.pq.extractMin());){for(;!(null===(a=t.pq.min())||!wp.vertEq(a,r));)a=t.pq.extractMin(),e.spliceMergeVertices(t,r.anEdge,a.anEdge);
3139e.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),!!e.removeDegenerateFaces(t,t.mesh)&&(i&&t.mesh.check(),!0)},e}(),wM=function(){function e(){this.mesh=new wv,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=SW.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,i,r,a,o,l,h=[0,0,0],c=[0,0,0],d=[0,0,0],p=[0,0,0],f=[0,0,0],m=[null,null,null],g=[null,null,null],v=this.mesh.vHead;t=v.next;for(var y=0;y<3;++y)a=t.coords[y],c[y]=a,g[y]=t,h[y]=a,m[y]=t;for(t=v.next;t!==v;t=t.next)for(var x=0;x<3;++x)(a=t.coords[x])<c[x]&&(c[x]=a,g[x]=t),a>h[x]&&(h[x]=a,m[x]=t);var b=0;if(h[1]-c[1]>h[0]-c[0]&&(b=1),h[2]-c[2]>h[b]-c[b]&&(b=2),c[b]>=h[b]){e[0]=0,e[1]=0,e[2]=1;return}for(l=0,i=g[b],r=m[b],d[0]=i.coords[0]-r.coords[0],d[1]=i.coords[1]-r.coords[1],d[2]=i.coords[2]-r.coords[2],t=v.next;t!==v;t=t.next)p[0]=t.coords[0]-r.coords[0],p[1]=t.coords[1]-r.coords[1],p[2]=t.coords[2]-r.coords[2],f[0]=d[1]*p[2]-d[2]*p[1],f[1]=d[2]*p[0]-d[0]*p[2],f[2]=d[0]*p[1]-d[1]*p[0],(o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2])>l&&(l=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);l<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(d)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,i=this.mesh.fHead,r=this.mesh.vHead,a=0,o=i.next;o!==i;o=o.next)if(!((t=o.anEdge).winding<=0))do a+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext;while(t!==o.anEdge);if(a<0){for(e=r.next;e!==r;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var e,t,i=this.mesh.vHead,r=[0,0,0],a=!1;r[0]=this.normal[0],r[1]=this.normal[1],r[2]=this.normal[2],r[0]||r[1]||r[2]||(this.computeNormal_(r),a=!0),e=this.sUnit,t=this.tUnit;var o=this.longAxis_(r);e[o]=0,e[(o+1)%3]=1,e[(o+2)%3]=0,t[o]=0,t[(o+1)%3]=0,t[(o+2)%3]=r[o]>0?1:-1;for(var l=i.next;l!==i;l=l.next)l.s=this.dot_(l.coords,e),l.t=this.dot_(l.coords,t);a&&this.checkOrientation_();for(var h=!0,c=i.next;c!==i;c=c.next)h?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,h=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var i,r;if(!((i=t.anEdge).Lnext!==i&&i.Lnext.Lnext!==i))throw"Mono region invalid";for(;wp.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;wp.vertLeq(i.Org,i.Dst);i=i.Lnext);for(r=i.Lprev;i.Lnext!==r;)if(wp.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(wp.edgeGoesLeft(r.Lnext)||0>=wp.edgeSign(r.Org,r.Dst,r.Lnext.Dst));)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(wp.edgeGoesRight(i.Lprev)||wp.edgeSign(i.Dst,i.Org,i.Lprev.Org)>=0);)i=e.connect(i,i.Lprev).Sym;i=i.Lnext}if(r.Lnext===i)throw"Mono region invalid";for(;r.Lnext.Lnext!==i;)r=e.connect(r.Lnext,r).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)if(t=i.next,i.inside&&!this.tessellateMonoRegion_(e,i))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)t=i.next,i.inside||e.zapFace(i)},e.prototype.setWindingNumber_=function(e,t,i){for(var r,a=e.eHead.next;a!==e.eHead;a=r)r=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?t:-t:i?e.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,i,r){var a,o,l=0,h=0;i>3&&e.mergeConvexFaces(i);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var d=e.fHead.next;d!==e.fHead;d=d.next)if(d.n=-1,d.inside){a=d.anEdge,o=0;do{var c=a.Org;-1===c.n&&(c.n=h,h++),o++,a=a.Lnext}while(a!==d.anEdge);if(o>i)throw"Face vertex greater that support polygon";d.n=l,++l}this.elementCount=l,t===Sq.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*i,this.vertexCount=h,this.vertices=[],this.vertices.length=h*r,this.vertexIndices=[],this.vertexIndices.length=h;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(-1!==c.n){var p=c.n*r;this.vertices[p+0]=c.coords[0],this.vertices[p+1]=c.coords[1],r>2&&(this.vertices[p+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=0,d=e.fHead.next;d!==e.fHead;d=d.next)if(d.inside){a=d.anEdge,o=0;do{var c=a.Org;this.elements[f++]=c.n,o++,a=a.Lnext}while(a!==d.anEdge);for(var m=o;m<i;++m)this.elements[f++]=-1;if(t===Sq.CONNECTED_POLYGONS){a=d.anEdge;do this.elements[f++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==d.anEdge);for(var g=o;g<i;++g)this.elements[f++]=-1}}},e.prototype.outputContours_=function(e,t){var i,r,a=0,o=0;this.vertexCount=0,this.elementCount=0;for(var l=e.fHead.next;l!==e.fHead;l=l.next)if(l.inside){r=i=l.anEdge;do this.vertexCount++,i=i.Lnext;while(i!==r);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var h=0,c=0,d=0;a=0;for(var l=e.fHead.next;l!==e.fHead;l=l.next)if(l.inside){o=0,r=i=l.anEdge;do this.vertices[h++]=i.Org.coords[0],this.vertices[h++]=i.Org.coords[1],t>2&&(this.vertices[h++]=i.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(i):i.Org.idx,o++,i=i.Lnext;while(i!==r);this.elements[d++]=a,this.elements[d++]=o,a+=o}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new wv),e<2&&(e=2),e>3&&(e=3);for(var i=null,r=0;r<t.length;r+=e)null===i?(i=this.mesh.makeEdge(),this.mesh.splice(i,i.Sym)):(this.mesh.splitEdge(i),i=i.Lnext),i.Org.coords[0]=t[r+0],i.Org.coords[1]=t[r+1],e>2?i.Org.coords[2]=t[r+2]:i.Org.coords[2]=0,i.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(i),i.winding=1,i.Sym.winding=-1},e.prototype.tesselate=function(e,t,i,r,a,o){if(void 0===e&&(e=SW.ODD),void 0===t&&(t=Sq.POLYGONS),void 0===o&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=e,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),wA.computeInterior(this,o);var l=this.mesh;return t===Sq.BOUNDARY_CONTOURS?this.setWindingNumber_(l,1,!0):this.tessellateInterior_(l),o&&l.check(),t===Sq.BOUNDARY_CONTOURS?this.outputContours_(l,r):this.outputPolymesh_(l,t,i,r),!0},e}();function wE(e){var t=e.windingRule,i=void 0===t?SW.ODD:t,r=e.elementType,a=void 0===r?Sq.POLYGONS:r,o=e.polySize,l=e.vertexSize,h=void 0===l?2:l,c=e.normal,d=e.contours,p=void 0===d?[]:d,f=e.strict,m=void 0===f||f,g=e.debug;if(!p&&m)throw Error("Contours can't be empty");if(p){var v=new wM;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;y<p.length;y++)v.addContour(h||2,p[y]);return v.tesselate(i,a,void 0===o?3:o,h,void 0===c?[0,0,1]:c,m),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:void 0!==g&&g?v.mesh:void 0}}}SW.ODD,SW.NONZERO,SW.POSITIVE,SW.NEGATIVE,SW.ABS_GEQ_TWO,Sq.POLYGONS,Sq.CONNECTED_POLYGONS,Sq.BOUNDARY_CONTOURS;var wC=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let i=e*wC.eSize;this.buffer=new ArrayBuffer(i);let r=Float32Array.BYTES_PER_ELEMENT,a=0;this.positions=new Float32Array(this.buffer,a*r,3*e),a+=3*e,this.normals=new Float32Array(this.buffer,a*r,3*e),a+=3*e,this.uvs=new Float32Array(this.buffer,a*r,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let i=new ArrayBuffer(e*wC.eSize),r=Float32Array.BYTES_PER_ELEMENT,a=0,o=new Float32Array(i,0*r,3*e),l=new Float32Array(i,(a+=3*e)*r,3*e),h=new Float32Array(i,(a+=3*e)*r,2*e);t?(o.set(this.positions.subarray(0,3*this.size)),l.set(this.normals.subarray(0,3*this.size)),h.set(this.uvs.subarray(0,2*this.size))):(o.set(this.positions),l.set(this.normals),h.set(this.uvs)),this.buffer=i,this.positions=o,this.normals=l,this.uvs=h,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let e=this.capacity;for(;t>e;)e*=2;this.realloc(e)}let i=this.size;return this.size=t,i}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}};wC.eSize=8*Float32Array.BYTES_PER_ELEMENT;var wT=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let a=e-1>>1,o=t[a];if(i(r,o)>=0)break;t[e]=o,e=a}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,a=t[e];for(;e<r;){let r=(e<<1)+1,o=r+1;if(o<this.length&&0>i(t[o],t[r])&&(r=o),i(t[r],a)>=0)break;t[e]=t[r],e=r}t[e]=a}};function wP(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=function(e,t,i){let r=!1,a=1/0;for(let o of i)for(let i=0,l=o.length,h=l-1;i<l;h=i++){let l=o[i],c=o[h];l[1]>t!=c[1]>t&&e<(c[0]-l[0])*(t-l[1])/(c[1]-l[1])+l[0]&&(r=!r),a=Math.min(a,function(e,t,i,r){let a=i[0],o=i[1],l=r[0]-a,h=r[1]-o;if(0!==l||0!==h){let i=((e-a)*l+(t-o)*h)/(l*l+h*h);i>1?(a=r[0],o=r[1]):i>0&&(a+=l*i,o+=h*i)}return(l=e-a)*l+(h=t-o)*h}(e,t,l,c))}return 0===a?0:(r?1:-1)*Math.sqrt(a)}(e,t,r),this.max=this.d+this.h*Math.SQRT2}var wD={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},wO={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},wI={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},wR=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),wL=class extends rQ{constructor(e,t,i=0,r=12,a=3,o=SW.ODD,l=!1){let h,c,d;super(),this.forPathBevel=l,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=a;let p=this._shape.extractShapePointsToFlatArray([],r),f=this._shape.shapeHoles.map(e=>{let t=e.extractShapePointsToFlatArray([],r),i=[];for(let e=t.length-1;e>=1;e-=2){let r=t[e-1],a=t[e-0];i.push(r,a)}return i}),m=[],g=[];for(let e=0;e<p.length;e+=2)g.push([p[e],p[e+1]]);m.push(g);for(let e=0;e<f.length;e++){let t=f[e],i=[];for(let e=0;e<t.length;e+=2)i.push([t[e],t[e+1]]);m.push(i)}h=e.isText?.1*new lQ().setFromPoints(e.points.map(e=>e.position)).getSize(new t9).length():0===m[0].length?i:i>0?function(e,t,i=1,r=!1){let a=1/0,o=1/0,l=-1/0,h=-1/0;for(let[t,i]of e[0])t<a&&(a=t),i<o&&(o=i),t>l&&(l=t),i>h&&(h=i);
3139let c=l-a,d=h-o,p=Math.max(i,Math.min(c,d));if(p===i){let e=[a,o];return e.distance=0,e.distance}let f=new wT([],(e,t)=>t.max-e.max),m=function(e){let t=0,i=0,r=0,a=e[0];for(let e=0,o=a.length,l=o-1;e<o;l=e++){let o=a[e],h=a[l],c=o[0]*h[1]-h[0]*o[1];i+=(o[0]+h[0])*c,r+=(o[1]+h[1])*c,t+=3*c}let o=new wP(i/t,r/t,0,e);return 0===t||o.d<0?new wP(a[0][0],a[0][1],0,e):o}(e),g=new wP(a+c/2,o+d/2,0,e);g.d>m.d&&(m=g);let v=2;function y(a,o,l){let h=new wP(a,o,l,e);if(v++,h.max>m.d+i&&f.push(h),h.d>m.d&&(m=h,r&&console.log(`found best ${Math.round(1e4*h.d)/1e4} after ${v} probes`),m.d>t))return t}let x=p/2;for(let e=a;e<l;e+=p)for(let t=o;t<h;t+=p)y(e+x,t+x,x);for(;f.length;){let{max:e,x:t,y:r,h:a}=f.pop();if(e-m.d<=i)break;y(t-(x=a/2),r-x,x),y(t+x,r-x,x),y(t-x,r+x,x),y(t+x,r+x,x)}r&&console.log(`num probes: ${v} 3140best distance: ${m.d}`);let b=[m.x,m.y];return b.distance=m.d,b.distance}(m,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,h,t/2),this._bevelSegments=Math.floor(a));try{c=wE({windingRule:o,elementType:Sq.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[p]})}catch{c=wD}try{d=wE({windingRule:SW.ODD,elementType:Sq.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...f]})}catch{d=wO}if(!c)throw Error("error generating geometry");let v=c.elementCount;if(d){c.elementCount+=d.elementCount;for(let e=0;e<d.elements.length;e++){let t=d.elements[e],i=e%2==0?c.vertexCount:0;c.elements.push(t+i)}for(let e=0;e<d.vertexIndices.length;e++){let t=d.vertexIndices[e],i=c.vertexCount;c.vertexIndices.push(t+i)}for(let e=0;e<d.vertices.length;e++){let t=d.vertices[e];c.vertices.push(t)}}let y=1/0,x=-1/0,b=1/0,w=-1/0;for(let e=0,t=c.vertexCount;e<t;e++){let t=2*e,i=c.vertices[t+0],r=c.vertices[t+1];i<y&&(y=i),i>x&&(x=i),r<b&&(b=r),r>w&&(w=r)}this._minX=y,this._minY=b,this._width=x-y,this._height=w-b,this._buffer=new wC(this._computeBufferEstimatedSize(c));let S=[],_=[];for(let e=c.elementCount-1;e>=0;e--){let t=e>=v,i=2*e,a=c.elements[i+0],o=c.elements[i+1],d=a+o,p={start:a,count:o,normals:[],continuous:[],concave:[]},m=a,g=d-1,y=a+1,x=this._shape.roundedCurves.length;do{let e=m-a,i=c.vertices[2*g+0],r=c.vertices[2*g+1],l=c.vertices[2*m+0],h=c.vertices[2*m+1],f=c.vertices[2*y+0],v=c.vertices[2*y+1],b=l-i,w=h-r,S=Math.sqrt(b*b+w*w);b/=S,w/=S;let _=l-f,A=h-v,M=Math.sqrt(_*_+A*A);_/=M,A/=M,p.normals[2*e+0]=-A,p.normals[2*e+1]=_,p.concave[e]=b*A-w*_>0;let E=c.vertexIndices[m];if(Array.isArray(E))p.continuous[e]=!1;else{let[t,i]=this._shape.getCurveIndexFromVertexId(E-1,!0);if(i>0&&i<1)p.continuous[e]=!0;else{let r=1===i?t+1:t-1;r=(r+x)%x;let a=1===i?0:1,o=this._shape.roundedCurves[t].getTangent(i),l=this._shape.roundedCurves[r].getTangent(a);p.continuous[e]=o.dot(l)>.95}}t&&(p.normals[2*e+0]*=-1,p.normals[2*e+1]*=-1),[g,m,y]=[m,y,y+1],y>=d&&(y-=o)}while(y!==a+1);let b=[];b.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(2*a,2*d),vertexCount:o,vertexIndices:Array(o).fill(!0).map((e,t)=>[t,t]),elements:[0,o],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(2*a,2*d)});let w=0;for(let e=1;e<=this._bevelSegments;e++){let i=e/this._bevelSegments*Math.PI/2,a=(1-Math.cos(i))*this._bevel,l=[],h=[],d=[],f=[],m=0;for(let e=0;e<o;e++){let i=2*e,g=(e-1+o)%o*2,v=c.vertices[2*p.start+i+0],y=c.vertices[2*p.start+i+1],x=-p.normals[g+0]*a,b=-p.normals[g+1]*a,w=-p.normals[i+0]*a,S=-p.normals[i+1]*a;if(p.concave[e]||!p.concave[e]&&t){let i=Math.atan2(b,x),o=Math.atan2(S,w);o>i&&(o-=2*Math.PI);let h=o-i;if(p.continuous[e]||t){let r=i+h/2,o=Math.cos(r)*a,c=Math.sin(r)*a;l[2*m+0]=v+o*(t?-1:1),l[2*m+1]=y+c*(t?-1:1),f[m]=e,m++}else{let t=Math.max(1,Math.floor(r/4*Math.abs(h)/Math.PI));for(let r=0;r<=t;r++){let o=i+r/t*h,c=Math.cos(o)*a,d=Math.sin(o)*a;l[2*m+0]=v+c,l[2*m+1]=y+d,f[m]=e,m++}}}else l[2*m+0]=v+x,l[2*m+1]=y+b,f[m]=e,h[e]=m,l[2*++m+0]=v,l[2*m+1]=y,f[m]=e,l[2*++m+0]=v+w,l[2*m+1]=y+S,f[m]=e,d[e]=m,m++}let g=wE({windingRule:SW.POSITIVE,elementType:Sq.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[l],edgeCreateCallback:e=>{let t=e.Org.idx,i=f[t],r=f[(t+1)%f.length];e.idx=[i,r],e.Sym.idx=[r,i]},vertexIdCallback:e=>{let t=e.Lprev.idx;return[t?t[1]:0,e.idx?e.idx[0]:0]}});if(!g)throw console.log("Error"),Error(`error generating bevel geometry for ${e}'th loop`);if(!g.vertexCount){w=(1-Math.sin((e-1)/this._bevelSegments*Math.PI/2))*this._bevel;break}for(let e=0;e<g.vertexIndices.length;e++){let[t,i]=g.vertexIndices[e];if(t===i)continue;let r=i;i<t&&(r+=o);for(let a=t;a<r;a++){let r=a%o,l=(a+1)%o;if(!p.continuous[r]||!p.continuous[l]){g.vertexIndices[e]=[t,r],g.vertexIndices.splice(e+1,0,[l,i]),g.vertices.splice((e+1)*2,0,g.vertices[2*e],g.vertices[2*e+1]);break}}}b.push({bevelI:e,angle:i,size:a,boundary:g,reverseMap:f,insetPoints:l})}let A=(e,t,i)=>{let r=0,a=e.boundary.vertexIndices.length;for(;r<a&&i(e.boundary.vertexIndices[t]);)t=(t+1)%a,r++;return r},M=S.length;for(let e=1;e<b.length;
3140e++){let t=b[e-1],i=b[e],r=t.boundary.vertexIndices.length,a=i.boundary.vertexIndices.length;if(!r||!a)break;let h=p.concave.length,c=0,d=wR(0,o);for(;!t.boundary.vertexIndices.filter(d).length||!i.boundary.vertexIndices.filter(d).length;)d=wR(++c,o);let f=t.boundary.vertexIndices.findIndex(d),m=i.boundary.vertexIndices.findIndex(d);do f=(f+1)%r;while(d(t.boundary.vertexIndices[f]));do m=(m+1)%a;while(d(i.boundary.vertexIndices[m]));let g=c=(c+1)%o,v=0,y=this._buildBevelVert(p,t,(f-1+r)%r,void 0,v),x=this._buildBevelVert(p,i,(m-1+a)%a,void 0,v),w=y,_=x,M,E,C=!1;do{v=(c||h)/h;let e=A(t,f,d=wR(c,o)),g=A(i,m,d),y=C;if(C=!1,e&&!g){for(let i=0;i<e;i++)M=this._buildBevelVert(p,t,(f+i)%r,i/(e-1),v),S.push(w.topN,M.topP,_.topN),!1===l&&S.push(M.bottomP,w.bottomN,_.bottomN),w=M;C=!0}else if(!e&&g)for(let e=0;e<g;e++)E=this._buildBevelVert(p,i,(m+e)%a,e/(g-1),v),S.push(_.topN,w.topP,E.topP),!1===l&&S.push(w.bottomP,_.bottomN,E.bottomP),_=E;else if(e&&g){if(M=this._buildBevelVert(p,t,f,0,v),E=this._buildBevelVert(p,i,m,0,v),y?(S.push(w.topN,E.topP,_.topN),S.push(w.topN,M.topP,E.topP),!1===l&&(S.push(E.bottomP,w.bottomN,_.bottomN),S.push(E.bottomP,M.bottomP,w.bottomN))):(S.push(_.topN,w.topN,M.topP),S.push(_.topN,M.topP,E.topP),!1===l&&(S.push(M.bottomP,w.bottomN,_.bottomN),S.push(M.bottomP,_.bottomN,E.bottomP))),w=M,_=E,e===g)for(let o=1;o<e;o++)M=this._buildBevelVert(p,t,(f+o)%r,o/(e-1),v),E=this._buildBevelVert(p,i,(m+o)%a,o/(g-1),v),S.push(w.topN,M.topP,_.topN),S.push(_.topN,M.topP,E.topP),!1===l&&(S.push(M.bottomP,w.bottomN,_.bottomN),S.push(M.bottomP,_.bottomN,E.bottomP)),w=M,_=E;else if(e>g){let o=e/g,h=0;for(let c=1;c<e;c++)M=this._buildBevelVert(p,t,(f+c)%r,c/(e-1),v),S.push(w.topN,M.topP,_.topN),!1===l&&S.push(M.bottomP,w.bottomN,_.bottomN),w=M,c>(h+1)*o&&(h++,E=this._buildBevelVert(p,i,(m+h)%a,h/(g-1),v),S.push(_.topN,M.topP,E.topP),!1===l&&S.push(M.bottomP,_.bottomN,E.bottomP),_=E)}else{let o=g/e,h=0;for(let c=1;c<g;c++)E=this._buildBevelVert(p,i,(m+c)%a,c/(g-1),v),S.push(_.topN,M.topP,E.topP),!1===l&&S.push(M.bottomP,_.bottomN,E.bottomP),_=E,c>(h+1)*o&&(h++,M=this._buildBevelVert(p,t,(f+h)%r,h/(e-1),v),S.push(w.topN,M.topP,_.topN),!1===l&&S.push(M.bottomP,w.bottomN,_.bottomN),w=M)}}f=(f+e)%r,m=(m+g)%a,c=(c+1)%h}while(c!==g)}if(!1===l&&this._depth>2*this._bevel&&this._buildWall(b,p,S),t){let e=[];for(let t=S.length-1;t>=M+2;t-=3){let i=S[t-2],r=S[t-1],a=S[t-0];e.push(a,r,i)}S.splice(M,S.length-M,...e)}if(t){let e=[];for(let t=b[b.length-1].boundary.vertices.length-1;t>=1;t-=2){let i=b[b.length-1].boundary.vertices[t-1],r=b[b.length-1].boundary.vertices[t-0];e.push(i,r)}_.push(e)}if(!t){let e=b[b.length-1],t;try{t=wE({windingRule:b.length>1?SW.POSITIVE:SW.ODD,elementType:Sq.POLYGONS,vertexSize:2,strict:!0,contours:[e.insetPoints,..._]})}catch{t=wI}if(!t)throw Error("Error generating geometry for surface");0===f.length&&this._bevel<h&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let e=0;e<3*t.elementCount;e+=3){let i=this._buildSurfaceVert(t,t.elements[e+0],w),r=this._buildSurfaceVert(t,t.elements[e+1],w),a=this._buildSurfaceVert(t,t.elements[e+2],w);S.push(i.top,r.top,a.top),!1===l&&S.push(a.bottom,r.bottom,i.bottom)}}this.vertexCache={}}this._buffer.shrink();let A=new rN(Uint32Array.from(S),1),M=new rN(this._buffer.positions,3),E=new rN(this._buffer.normals,3),C=new rN(this._buffer.uvs,2);M.needsUpdate=!0,E.needsUpdate=!0,C.needsUpdate=!0,A.needsUpdate=!0,this.setAttribute("position",M),this.setAttribute("normal",E),this.setAttribute("uv",C),this.setIndex(A)}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let e=0,a=r.boundary.vertexCount;e<a;e++){let o=this._buildBevelVert(t,r,e),l=this._buildBevelVert(t,r,(e+1)%a);i.push(l.topP,o.topN,o.bottomN),i.push(l.topP,o.bottomN,l.bottomP)}}_buildSurfaceVert(e,t,i){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let a=e.vertices[2*t+0],o=e.vertices[2*t+1],l=(a-this._minX)/this._width,h=(o-this._minY)/this._height;this.forPathBevel&&(h=1);let c=this._buffer.get(this.forPathBevel?1:2),d=3*c,p=2*c,f={top:c+0,bottom:c+1};return this._buffer.positions[d+0]=a,this._buffer.positions[d+1]=o,this._buffer.positions[d+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[d+0]=0,this._buffer.normals[d+1]=0,this._buffer.normals[d+2]=1,this._buffer.uvs[p+0]=l,this._buffer.uvs[p+1]=h,!1===this.forPathBevel&&(this._buffer.positions[d+3]=a,this._buffer.positions[d+4]=o,this._buffer.positions[d+5]=i,this._buffer.normals[d+3]=0,this._buffer.normals[d+4]=0,this._buffer.normals[d+5]=-1,this._buffer.uvs[p+2]=l,this._buffer.uvs[p+3]=h),this.vertexCache[r]=f,f}_buildBevelVert(e,t,i,r=1,a){let o=`${t.bevelI}
3140:${i}`;if(o in this.vertexCache&&0!==a&&1!==a&&(!a||a===this.vertexCache[o].pathBevelUCoord))return this.vertexCache[o];let[l,h]=t.boundary.vertexIndices[i],c,d,p,f;l!==h?(d=l,c=h,f=!1,p=e.continuous[d]&&e.continuous[c]):(d=((c=l)-1+e.count)%e.count,f=e.concave[c]&&t.bevelI>0,p=e.continuous[c]||f);let m=Math.cos(t.angle),g=Math.sin(t.angle),v=2*i,y=2*c,x=2*d,b=t.boundary.vertices[v+0],w=t.boundary.vertices[v+1],S=(1-g)*this._bevel,_=(b-this._minX)/this._width,A=(w-this._minY)/this._height;this.forPathBevel&&(void 0!==a&&(_=a),A=1);let M=e.normals[y+0],E=e.normals[y+1],C=e.normals[x+0],T=e.normals[x+1];if(f){let e=C-M,t=T-E,i=Math.sqrt((M+=e*(1-r))*M+(E+=t*(1-r))*E);M/=i,E/=i}let P=this.forPathBevel?this._buffer.get(p?1:2):this._buffer.get(p?2:4),D=3*P,O=2*P,I={i,fi:c,topP:P+0,topN:P+0,bottomP:P+1,bottomN:P+1,pathBevelUCoord:a};return this._buffer.positions[D+0]=b,this._buffer.positions[D+1]=w,this._buffer.positions[D+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[D+0]=M*m,this._buffer.normals[D+1]=E*m,this._buffer.normals[D+2]=g,this._buffer.uvs[O+0]=_,this._buffer.uvs[O+1]=A,!1===this.forPathBevel&&(this._buffer.positions[D+3]=b,this._buffer.positions[D+4]=w,this._buffer.positions[D+5]=S,this._buffer.normals[D+3]=M*m,this._buffer.normals[D+4]=E*m,this._buffer.normals[D+5]=-g,this._buffer.uvs[O+2]=A,this._buffer.uvs[O+3]=_),p||(this.forPathBevel?(P+=1,D+=3,O+=2):(P+=2,D+=6,O+=4),I.topP=P+0,I.bottomP=P+1,this._buffer.positions[D+0]=b,this._buffer.positions[D+1]=w,this._buffer.positions[D+2]=(this.forPathBevel?this._bevel:this._depth)-S,this._buffer.normals[D+0]=C*m,this._buffer.normals[D+1]=T*m,this._buffer.normals[D+2]=g,this._buffer.uvs[O+0]=_,this._buffer.uvs[O+1]=A,!1===this.forPathBevel&&(this._buffer.positions[D+3]=b,this._buffer.positions[D+4]=w,this._buffer.positions[D+5]=S,this._buffer.normals[D+3]=C*m,this._buffer.normals[D+4]=T*m,this._buffer.normals[D+5]=-g,this._buffer.uvs[O+2]=A,this._buffer.uvs[O+3]=_)),this.vertexCache[o]=I,I}clone(){let e=new wL(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=uk(this.userData),e}},wB=class extends rQ{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=SW.ODD,this.elementType=Sq.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:SW.ODD,elementType:Sq.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r=this._shape.extractShapePointsToFlatArray([],this._curveSegments),a=this._shape.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],this._curveSegments)),o,l=!0,h=!0,c,d;for(let e=0,t=r.length/2;e<t;e++){let t=2*e,i=r[t+0],a=r[t+1];if(void 0!==c&&i!==c&&(l=!1),void 0!==d&&a!==d&&(h=!1),c=i,d=a,!l&&!h)break}if(!l&&!h)try{o=wE({contours:[r,...a],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{o=wD}let p=o?.vertexCount??1,f=o?.elementCount??1;if(this._positionAttribute=new rN(new Float32Array(3*p),3),this._normalAttribute=new rN(new Float32Array(3*p),3),this._uvAttribute=new rN(new Float32Array(2*p),2),this._indexAttribute=new rN(new Uint32Array(3*f),1),o){let e=1/0,t=-1/0,i=1/0,r=-1/0;for(let a=0;a<p;a++){let l=2*a,h=o.vertices[l+0],c=o.vertices[l+1];h<e&&(e=h),h>t&&(t=h),c<i&&(i=c),c>r&&(r=c)}let a=t-e,l=r-i;for(let t=0;t<p;t++){let r=2*t,h=o.vertices[r+0],c=o.vertices[r+1],d=(h-e)/a,p=(c-i)/l;this._positionAttribute.setXYZ(t,h,c,0),this._normalAttribute.setXYZ(t,0,0,1),this._uvAttribute.setXY(t,d,p)}for(let e=0;e<f;e++){let t=3*e,i=o.elements[t+0],r=o.elements[t+1],a=o.elements[t+2];this._indexAttribute.setX(t+0,i),this._indexAttribute.setX(t+1,r),this._indexAttribute.setX(t+2,a)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(o?.elementCount??1)*3)}clone(){let e=new wB(this._shape,this._curveSegments);return e.userData=uk(this.userData),e}},wz=class extends wL{constructor(e,t,i=0,r=12,a=3,o=SW.ODD){super(e,t,i,r,a,o),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return 2*e.vertexCount*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let e=0,a=r.boundary.vertexCount;e<a;e++){let o=this._buildBevelVert(t,r,e),l=this._buildBevelVert(t,r,(e+1)%a);i.push(l.topP,o.topN,o.bottomN),i.push(l.topP,o.bottomN,l.bottomP)}}clone(){let e=new wz(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=uk(this.userData),e}},wF=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:SW.ODD},e.parameters),r=Math.abs(i.width),a=Math.abs(i.height??i.width),o=Math.abs(i.depth??0),l=e.shape??t?.shape,h=l?.roundness??i.roun
3140dness;void 0!==l&&(l instanceof wl?(l.width!==r||l.height!==a)&&l.applySize(r,a):l=new wl(r,a).fromJSON(l),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&l.update());let c=l??new wl(r,a);return{parameters:Object.assign(i,{width:r,height:a,depth:o,roundness:h}),shape:c}}static build(e){let{depth:t,extrudeBevelSize:i,extrudeBevelSegments:r,subdivisions:a,roundness:o,windingRule:l}=e.parameters;return e.shape.roundness=o,Object.assign(t<=0?new wB(e.shape,a,{windingRule:l}):new wz(e.shape,t,i,a,r,l),{userData:{...e,type:"VectorGeometry"}})}},wN=2*Math.PI,wU=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=t8.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof wl?e.shape:new wl,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let t,{width:i,height:r,spikes:a,angle:o,innerRadius:l,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}=e.parameters,p=e.shape,f=function(e,t,i,r,a,o){if(r>=wN)return a>30||a%4==0?(function(e,t,i,r=0,a=0,o=0){let l=.5522847498*t,h=.5522847498*i;e.addPoint(wj(a-t,o,a-t,o-h,a-t,o+h)),e.addPoint(wj(a,o+i,a-l,o+i,a+l,o+i)),e.addPoint(wj(a+t,o,a+t,o+h,a+t,o-h)),e.addPoint(wj(a,o-i,a+l,o-i,a-l,o-i)),r>0&&wH(e,t,i,r)}(e,t,i,o),Math.round(a/4)):wk(e,r,a,t,i,o);let l={x:0,y:i},h=(r=Math.max(r,.001))+.5*Math.PI,c={x:Math.cos(h)*t,y:Math.sin(h)*i},d=function({px:e,py:t,cx:i,cy:r,rx:a,ry:o,largeArcFlag:l,sweepFlag:h}){var c,d;let p,f,m,g,v,y,x,b,w,S,_,A=[];if(0===a||0===o)return[];let M=(e-i)/2,E=(t-r)/2;if(0===M&&0===E)return[];let C=Math.pow(M,2)/Math.pow(a=Math.abs(a),2)+Math.pow(E,2)/Math.pow(o=Math.abs(o),2);C>1&&(a*=Math.sqrt(C),o*=Math.sqrt(C));let T=(c=a,d=o,p=Math.pow(c,2),f=Math.pow(d,2),m=Math.pow(M,2),(v=p*f-p*(g=Math.pow(E,2))-f*m)<0&&(v=0),v/=p*g+f*m,y=(v=Math.sqrt(v)*(l===h?-1:1))*c/d*E,x=-(v*d)/c*M,S=wd(1,0,b=(M-y)/c,w=(E-x)/d),_=wd(b,w,(-M-y)/c,(-E-x)/d),!h&&_>0&&(_-=wh),h&&_<0&&(_+=wh),{centerx:y+(e+i)/2,centery:x+(t+r)/2,ang1:S,ang2:_}),{ang1:P,ang2:D}=T,{centerx:O,centery:I}=T,R=Math.abs(D)/(wh/4);1e-7>Math.abs(1-R)&&(R=1);let L=Math.max(Math.ceil(R),1);D/=L;for(let e=0;e<L;e++)A.push(function(e,t){let i=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),a=Math.sin(e),o=Math.cos(e+t),l=Math.sin(e+t);return[{x:r-a*i,y:a+r*i},{x:o+l*i,y:l-o*i},{x:o,y:l}]}(P,D)),P+=D;return A.map(e=>{let{x:t,y:i}=wc(e[0],a,o,O,I),{x:r,y:l}=wc(e[1],a,o,O,I),{x:h,y:c}=wc(e[2],a,o,O,I);return{x1:t,y1:i,x2:r,y2:l,x:h,y:c}})}({px:l.x,py:l.y,cx:c.x,cy:c.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return a>30||a%d.length==0?function(e,t,i,r,a,o,l,h){let c=Math.round(a/r.length);e.addPoint(wV(t,i));for(let t=0,i=r.length;t<i;t++){let i=r[t],a=e.points[t],o=wV(i.x,i.y);a.controls[1].position.set(i.x1,i.y1),o.controls[0].position.set(i.x2,i.y2),e.addPoint(o)}return h>0?wG(e,o,l,h):e.addPoint(wV(0,0)),c}(e,l.x,l.y,d,a,t,i,o):wk(e,r,a,t,i,o)}(p,.5*i,.5*r,o*Math.PI/180,a,l);return p.isClosed=!0,p.update(),0===o?(t=new rQ).setAttribute("position",new rV([],3)):t=wF.create({shape:p,parameters:{subdivisions:f,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function wk(e,t,i,r,a,o){let l=-t/i;for(let t=0;t<=i;t++){let i=l*t,o=Math.sin(i)*r,h=Math.cos(i)*a;e.addPoint(wV(o,h))}return t<wN?o>0?wG(e,r,a,o):e.addPoint(wV(0,0)):(e.removePoint(e.points[e.points.length-1]),o>0&&wH(e,r,a,o)),1}function wV(e,t){return new bY(t8.generateUUID(),new t9(e,t))}function wj(e,t,i,r,a,o){let l=wV(e,t);return l.controls[0].position.set(i,r),l.controls[1].position.set(a,o),l}function wG(e,t,i,r){wW(e,t,i,r).forEach(t=>e.addPoint(t))}function wH(e,t,i,r){let a=wW(e,t,i,r),o=new wl;a.forEach(e=>o.addPoint(e)),o.isClosed=!0,e.shapeHoles.push(o)}function wW(e,t,i,r){let a=r*t/100,o=Math.abs(i)/Math.abs(t)*a,l=new t9(a/t,o/i),h=e.points.map(e=>{let t=e.clone();return t.uuid=t8.generateUUID(),t}).reverse();
3140return h.forEach(e=>{e.position.multiply(l);let t=e.controls[0].position.clone().multiply(l),i=e.controls[1].position.clone().multiply(l);e.controls[0].position.copy(i),e.controls[1].position.copy(t)}),h}var wq=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),a=Math.abs(i.height??r),o=Math.abs(i.depth??r),l=Math.abs(Math.min(r,o))/2;return{parameters:Object.assign(i,{width:r,height:a,depth:o,radius:l,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:a,revolutions:o,segments:l,pathRadius:h,pathType:c,pathSegments:d,cornerRadius:p,cornerSegments:f}=e.parameters;return Object.assign(new wY(!1,t,i,r,a,o,l,h,c,d,p,f),{userData:{...e,type:"HelixGeometry"}})}},wX=new rk([0,0,0],1),wY=class extends rQ{constructor(e=!0,t=1,i=1,r=1,a=1,o=1,l=1,h=1,c=1,d=1,p=1,f=1){if(super(),0===o)return;let m=e&&1===o;m&&(f=0),p>100&&(p=100),0===p&&(f=0);let g=()=>new iD,v=new iD,y=g(),x=g(),b=g(),w,S,_,A,M,E,C,T,P=g(),D=g(),O=g(),I=g(),R=g(),L=g(),B=g(),z=g(),F=i-2*h+.001,N=F/o,U=Math.ceil(l*o),k=U+1,V=F/U,j=-F/2,G=d+1,H=2*Math.PI/d,W=Math.PI/2/f,q=Math.min((1-p/100)*h,h-.01),X=h-q,Y=0,Q=2*f+2,Z=G*Q/2,K=Z+G*k,J=Math.max(0,G*(k+Q)),[$,ee,et]=[3,3,2].map(e=>Array(J*e).fill(0)),ei=[],er=a-h;function es(t,i){let r=Math.PI/2;T=2*Math.PI*((E=i*V)%N)/N+r,E+=j,C=Math.sin(T)*er,M=Math.cos(T)*er,e?t.set(M,C,E):t.set(M,E,C)}es(v,-.0000000001),es(y,0),P.copy(v),es(v,1);let ea=v.distanceTo(y),en=m?0:X+q,eo=ea*U+2*en,el=eo-en;for(let t=0;t<=U;t++){es(x,t),z.subVectors(x,P).normalize(),P.copy(x),L.copy(x).setComponent(+e+1,0).normalize(),B.crossVectors(z,L).normalize();let i=0===t,r=t===U,a=i?3*Math.PI/2:W,o=i?q:el,l=i?G:K,c=i?0:J-G,p=z.clone().multiplyScalar(i?-X:X).add(x),g=z.clone().multiplyScalar(i?-1:1).normalize();for(let e=0;e<G;e++){let w=e*H;if(D.addVectors(v.copy(L).multiplyScalar(h*Math.cos(w)),y.copy(B).multiplyScalar(h*Math.sin(w))),O.copy(D).normalize(),i||r){m||(Y=c+e,[0,1,2].forEach(e=>{$[3*Y+e]=p.getComponent(e),ee[3*Y+e]=g.getComponent(e)}),et[2*Y]=+r,et[2*Y+1]=e/d),y.copy(O).multiplyScalar(q),b.addVectors(x,y);for(let t=0;t<f;t++){let r=t*W+a;I.addVectors(v.copy(z).multiplyScalar(X*Math.sin(r)),y.copy(O).multiplyScalar(X*Math.cos(r))),R.copy(I).normalize(),y.addVectors(b,I),I.normalize(),Y=l+t*G+e,[0,1,2].forEach(e=>{$[3*Y+e]=y.getComponent(e),ee[3*Y+e]=R.getComponent(e)});let h=+i+Math.sin(r);et[2*Y]=(o+X*h)/eo,et[2*Y+1]=e/d}}y.addVectors(x,D),Y=Z+t*G+e,[0,1,2].forEach(e=>{$[3*Y+e]=y.getComponent(e),ee[3*Y+e]=O.getComponent(e)}),et[2*Y]=(en+t*ea)/eo,et[2*Y+1]=e/d}}let eh=k+2*f+2,[ec,ed]=[+m,eh-1];for(let e=ec;e<=ed-1;e++){let t=m&&e===ed-1;for(let i=0;i<G-1;i++)S=(w=e*G+i)+1,_=(t?i:w)+G,A=(t?i+1:S)+G,0===e?ei.push(S,A,_):e===eh-2?ei.push(w,S,_):ei.push(w,S,_,S,A,_)}this.setIndex(ei),this.setAttribute("position",new rV($,3)),this.setAttribute("normal",new rV(ee,3)),this.setAttribute("uv",new rV(et,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e=this.userData.parameters,t=Math.ceil(e.tubularSegments),i=e.radialSegments+1,r=Array.from(this.getIndex().array),a,o,l,h,c=6*(t-1)*e.radialSegments,d=t==t;for(let p=0;p<e.radialSegments;p++)o=(a=t*i+p)+1,l=(d?p:a)+i,h=(d?p+1:o)+i,r[c++]=a,r[c++]=o,r[c++]=l,r[c++]=o,r[c++]=h,r[c++]=l;return r.length=c,wX.array=r,wX.count=r.length,wX}},wQ=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}
3140static build(e){let{width:t,height:i,depth:r,detail:a,corner:o,cornerSides:l}=e.parameters,h=0===a&&0!==o?new wZ(.5*t,o,l):new oH(.5*t,a);return h.scale(1,i/t,r/t),Object.assign(h,{userData:{...e,type:"IcosahedronGeometry"}})}},wZ=class extends bG{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,a="IcosahedronGeometry";super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,e,t,i),this.type=a}static fromJSON(e){return new wZ(e.radius,e.corner,e.cornerSides)}},wK=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(e=>{Array.isArray(e)&&(e.x=e[0],e.y=e[1])});let i=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,a=new oA;a.moveTo(t[0].x,t[0].y),a.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let o=new ox(a.extractPoints(r).shape,i);return o.rotateZ(Math.PI),Object.assign(o,{userData:{...e,type:"LatheGeometry"}})}},wJ=new i6,w$=new rw,w0=new iD,w1=class extends tX{constructor(){super(),this.uuid=t8.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new t7().getNormalMatrix(e);for(let t=0,i=this.vertices.length;t<i;t++)this.vertices[t].applyMatrix4(e);for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e];i.normal.applyMatrix3(t).normalize();for(let e=0,r=i.vertexNormals.length;e<r;e++)i.vertexNormals[e].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return wJ.makeRotationX(e),this.applyMatrix4(wJ),this}rotateY(e){return wJ.makeRotationY(e),this.applyMatrix4(wJ),this}rotateZ(e){return wJ.makeRotationZ(e),this.applyMatrix4(wJ),this}translate(e,t,i){return wJ.makeTranslation(e,t,i),this.applyMatrix4(wJ),this}scale(e,t,i){return wJ.makeScale(e,t,i),this.applyMatrix4(wJ),this}lookAt(e){return w$.lookAt(e),w$.updateMatrix(),this.applyMatrix4(w$.matrix),this}fromBufferGeometry(e){let t=this,i=null!==e.index?e.index:void 0,r=e.attributes;if(void 0===r.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let a=r.position,o=r.normal,l=r.color,h=r.uv,c=r.uv2;void 0!==c&&(this.faceVertexUvs[1]=[]);for(let e=0;e<a.count;e++)t.vertices.push(new iD().fromBufferAttribute(a,e)),void 0!==l&&t.colors.push(new iv().fromBufferAttribute(l,e));function d(e,i,r,a){let d=void 0===l?[]:[t.colors[e].clone(),t.colors[i].clone(),t.colors[r].clone()],p=void 0===o?[]:[new iD().fromBufferAttribute(o,e),new iD().fromBufferAttribute(o,i),new iD().fromBufferAttribute(o,r)],f=new w3(e,i,r,p,d,a);t.faces.push(f),void 0!==h&&t.faceVertexUvs[0].push([new t9().fromBufferAttribute(h,e),new t9().fromBufferAttribute(h,i),new t9().fromBufferAttribute(h,r)]),void 0!==c&&t.faceVertexUvs[1].push([new t9().fromBufferAttribute(c,e),new t9().fromBufferAttribute(c,i),new t9().fromBufferAttribute(c,r)])}let p=e.groups;if(p.length>0)for(let e=0;e<p.length;e++){let t=p[e],r=t.start,a=t.count;for(let e=r,o=r+a;e<o;e+=3)void 0!==i?d(i.getX(e),i.getX(e+1),i.getX(e+2),t.materialIndex):d(e,e+1,e+2,t.materialIndex)}else if(void 0!==i)for(let e=0;e<i.count;e+=3)d(i.getX(e),i.getX(e+1),i.getX(e+2));else for(let e=0;e<a.count;e+=3)d(e,e+1,e+2);
3140return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(w0).negate(),this.translate(w0.x,w0.y,w0.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,i=0===t?1:1/t,r=new i6;return r.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix4(r),this}computeFaceNormals(){let e=new iD,t=new iD;for(let i=0,r=this.faces.length;i<r;i++){let r=this.faces[i],a=this.vertices[r.a],o=this.vertices[r.b],l=this.vertices[r.c];e.subVectors(l,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}}computeVertexNormals(e=!0){let t=Array(this.vertices.length);for(let e=0,i=this.vertices.length;e<i;e++)t[e]=new iD;if(e){let e=new iD,i=new iD;for(let r=0,a=this.faces.length;r<a;r++){let a=this.faces[r],o=this.vertices[a.a],l=this.vertices[a.b],h=this.vertices[a.c];e.subVectors(h,l),i.subVectors(o,l),e.cross(i),t[a.a].add(e),t[a.b].add(e),t[a.c].add(e)}}else{this.computeFaceNormals();for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e];t[i.a].add(i.normal),t[i.b].add(i.normal),t[i.c].add(i.normal)}}for(let e=0,i=this.vertices.length;e<i;e++)t[e].normalize();for(let e=0,i=this.faces.length;e<i;e++){let i=this.faces[e],r=i.vertexNormals;3===r.length?(r[0].copy(t[i.a]),r[1].copy(t[i.b]),r[2].copy(t[i.c])):(r[0]=t[i.a].clone(),r[1]=t[i.b].clone(),r[2]=t[i.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],i=t.vertexNormals;3===i.length?(i[0].copy(t.normal),i[1].copy(t.normal),i[2].copy(t.normal)):(i[0]=t.normal.clone(),i[1]=t.normal.clone(),i[2]=t.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];
3140t.__originalFaceNormal?t.__originalFaceNormal.copy(t.normal):t.__originalFaceNormal=t.normal.clone(),t.__originalVertexNormals||(t.__originalVertexNormals=[]);for(let e=0,i=t.vertexNormals.length;e<i;e++)t.__originalVertexNormals[e]?t.__originalVertexNormals[e].copy(t.vertexNormals[e]):t.__originalVertexNormals[e]=t.vertexNormals[e].clone()}let e=new w1;e.faces=this.faces;for(let t=0,i=this.morphTargets.length;t<i;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let e=this.morphNormals[t].faceNormals,i=this.morphNormals[t].vertexNormals;for(let t=0,r=this.faces.length;t<r;t++){let t=new iD,r={a:new iD,b:new iD,c:new iD};e.push(t),i.push(r)}}let i=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e],r=i.faceNormals[e],a=i.vertexNormals[e];r.copy(t.normal),a.a.copy(t.vertexNormals[0]),a.b.copy(t.vertexNormals[1]),a.c.copy(t.vertexNormals[2])}}for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];
3140t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new iR),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new iK),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,i=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let r,a=this.vertices.length,o=this.vertices,l=e.vertices,h=this.faces,c=e.faces,d=this.colors,p=e.colors;void 0!==t&&(r=new t7().getNormalMatrix(t));for(let e=0,i=l.length;e<i;e++){let i=l[e].clone();void 0!==t&&i.applyMatrix4(t),o.push(i)}for(let e=0,t=p.length;e<t;e++)d.push(p[e].clone());for(let e=0,t=c.length;e<t;e++){let t=c[e],o,l,d=t.vertexNormals,p=t.vertexColors,f=new w3(t.a+a,t.b+a,t.c+a);f.normal.copy(t.normal),void 0!==r&&f.normal.applyMatrix3(r).normalize();for(let e=0,t=d.length;e<t;e++)o=d[e].clone(),void 0!==r&&o.applyMatrix3(r).normalize(),f.vertexNormals.push(o);f.color.copy(t.color);for(let e=0,t=p.length;e<t;e++)l=p[e],f.vertexColors.push(l.clone());f.materialIndex=t.materialIndex+i,h.push(f)}for(let t=0,i=e.faceVertexUvs.length;t<i;t++){let i=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=i.length;e<r;e++){let r=i[e],a=[];for(let e=0,t=r.length;e<t;e++)a.push(r[e].clone());this.faceVertexUvs[t].push(a)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},i=[],r=[],a=Math.pow(10,e);for(let e=0,o=this.vertices.length;e<o;e++){let o=this.vertices[e],l=Math.round(o.x*a)+"_"+Math.round(o.y*a)+"_"+Math.round(o.z*a);void 0===t[l]?(t[l]=e,i.push(this.vertices[e]),r[e]=i.length-1):r[e]=r[t[l]]}let o=[];for(let e=0,t=this.faces.length;e<t;e++){let t=this.faces[e];t.a=r[t.a],t.b=r[t.b],t.c=r[t.c];let i=[t.a,t.b,t.c];for(let t=0;t<3;t++)if(i[t]===i[(t+1)%3]){o.push(e);break}}for(let e=o.length-1;e>=0;e--){let t=o[e];this.faces.splice(t,1);for(let e=0,i=this.faceVertexUvs.length;e<i;e++)this.faceVertexUvs[e].splice(t,1)}let l=this.vertices.length-i.length;return this.vertices=i,l}setFromPoints(e){this.vertices=[];for(let t=0,i=e.length;t<i;t++){let i=e[t];this.vertices.push(new iD(i.x,i.y,i.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let i=0;i<t;i++)e[i]._id=i;e.sort(function(e,t){return e.materialIndex-t.materialIndex});let i=this.faceVertexUvs[0],r=this.faceVertexUvs[1],a,o;i&&i.length===t&&(a=[]),r&&r.length===t&&(o=[]);for(let l=0;l<t;l++){let t=e[l]._id;a&&a.push(i[t]),o&&o.push(r[t])}a&&(this.faceVertexUvs[0]=a),o&&(this.faceVertexUvs[1]=o)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}let t=[];for(let e=0;e<this.vertices.length;e++){let i=this.vertices[e];t.push(i.x,i.y,i.z)}let i=[],r=[],a={},o=[],l={},h=[],c={};for(let e=0;e<this.faces.length;e++){let t=this.faces[e],r=void 0!==this.faceVertexUvs[0][e],a=t.normal.length()>0,o=t.vertexNormals.length>0,l=1!==t.color.r||1!==t.color.g||1!==t.color.b,h=t.vertexColors.length>0,c=0;if(c=d(0,0,0),c=d(c,1,!0),c=d(c,2,!1),c=d(c,3,r),c=d(c,4,a),c=d(c,5,o),c=d(c,6,l),c=d(c,7,h),i.push(c),i.push(t.a,t.b,t.c),i.push(t.materialIndex),r){let t=this.faceVertexUvs[0][e];i.push(m(t[0]),m(t[1]),m(t[2]))}if(a&&i.push(p(t.normal)),o){let e=t.vertexNormals;i.push(p(e[0]),p(e[1]),p(e[2]))}if(l&&i.push(f(t.color)),h){let e=t.vertexColors;i.push(f(e[0]),f(e[1]),f(e[2]))}}function d(e,t,i){return i?e|1<<t:e&~(1<<t)}function p(e){let t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==a[t]||(a[t]=r.length/3,r.push(e.x,e.y,e.z)),a[t]}function f(e){let t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==l[t]||(l[t]=o.length,o.push(e.getHex())),l[t]}function m(e){let t=e.x.toString()+e.y.toString();return void 0!==c[t]||(c[t]=h.length/2,h.push(e.x,e.y)),c[t]}return e.data={},e.data.vertices=t,e.data.normals=r,o.length>0&&(e.data.colors=o),h.length>0&&(e.data.uvs=[h]),e.data.faces=i,e}clone(){return new w1().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let e=0,i=t.length;e<i;e++)this.vertices.push(t[e].clone());let i=e.colors;for(let e=0,t=i.length;e<t;e++)this.colors.push(i[e].clone());let r=e.faces;for(let e=0,t=r.length;e<t;e++)this.faces.push(r[e].clone());for(let t=0,i=e.faceVertexUvs.length;t<i;t++){let i=e.faceVertexUvs[t];void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]);for(let e=0,r=i.length;e<r;e++){let r=i[e],a=[];for(let e=0,t=r.length;e<t;e++){let t=r[e];a.push(t.clone())}this.faceVertexUvs[t].push(a)}}let a=e.morphTargets;for(let e=0,t=a.length;e<t;e++){let t={};if(t.name=a[e].name,void 0!==a[e].vertices){t.vertices=[];for(let i=0,r=a[e].vertices.length;i<r;i++)t.vertices.push(a[e].vertices[i].clone())}if(void 0!==a[e].normals){t.normals=[];for(let i=0,r=a[e].normals.length;i<r;i++)t.normals.push(a[e].normals[i].clone())}this.morphTargets.push(t)}let o=e.morphNormals;for(let e=0,t=o.length;e<t;e++){let t={};if(void 0!==o[e].vertexNormals){t.vertexNormals=[];for(let i=0,r=o[e].vertexNormals.length;i<r;i++){let r=o[e].vertexNormals[i],a={};a.a=r.a.clone(),a.b=r.b.clone(),a.c=r.c.clone(),t.vertexNormals.push(a)}}if(void 0!==o[e].faceNormals){t.faceNormals=[];for(let i=0,r=o[e].faceNormals.length;i<r;i++)t.faceNormals.push(o[e].faceNormals[i].clone())}this.morphNormals.push(t)}let l=e.skinWeights;for(let e=0,t=l.length;e<t;e++)this.skinWeights.push(l[e].clone());let h=e.skinIndices;for(let e=0,t=h.length;e<t;e++)this.skinIndices.push(h[e].clone());let c=e.lineDistances;for(let e=0,t=c.length;e<t;e++)this.lineDistances.push(c[e]);let d=e.boundingBox;null!==d&&(this.boundingBox=d.clone());let p=e.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new w2().fromGeometry(this),t=new rQ,i=new Float32Array(3*e.vertices.length);if(t.setAttribute("position",w8.call(new rN(i,3),e.vertices)),e.normals.length>0){let i=new Float32Array(3*e.normals.length);t.setAttribute("normal",w8.call(new rN(i,3),e.normals))}if(e.colors.length>0){let i=new Float32Array(3*e.colors.length);t.setAttribute("color",w5.call(new rN(i,3),e.colors))}if(e.uvs.length>0){let i=new Float32Array(2*e.uvs.length);t.setAttribute("uv",w6.call(new rN(i,2),e.uvs))}if(e.uvs2.length>0){let i=new Float32Array(2*e.uvs2.length);t.setAttribute("uv2",w6.call(new rN(i,2),e.uvs2))}for(let i in t.groups=e.groups,e.morphTargets){let r=[],a=e.morphTargets[i];for(let e=0,t=a.length;e<t;e++){let t=a[e],i=new rV(3*t.data.length,3);i.name=t.name,r.push(w8.call(i,t.data))}t.morphAttributes[i]=r}if(e.skinIndices.length>0){let i=new rV(4*e.skinIndices.length,4);t.setAttribute("skinIndex",w9.call(i,e.skinIndices))}if(e.skinWeights.length>0){let i=new rV(4*e.skinWeights.length,4);t.setAttribute("skinWeight",w9.call(i,e.skinWeights))}
3140return null!==e.boundingSphere&&(t.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new rQ,i=e.geometry;if(e.isPoints||e.isLine){let e=new rV(3*i.vertices.length,3),r=new rV(3*i.colors.length,3);if(t.setAttribute("position",w8.call(e,i.vertices)),t.setAttribute("color",w5.call(r,i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let e=new rV(i.lineDistances.length,1);t.setAttribute("lineDistance",w4.call(e,i.lineDistances))}null!==i.boundingSphere&&(t.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(t.boundingBox=i.boundingBox.clone())}else e.isMesh&&(t=i.toBufferGeometry());return t}};w1.prototype.isGeometry=!0;var w2=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],i,r,a,o=e.faces;for(r=0;r<o.length;r++){let e=o[r];e.materialIndex!==a&&(a=e.materialIndex,void 0!==i&&(i.count=3*r-i.start,t.push(i)),i={start:3*r,materialIndex:a})}void 0!==i&&(i.count=3*r-i.start,t.push(i)),this.groups=t}fromGeometry(e){let t=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,l=e.morphTargets,h=l.length,c;if(h>0){c=[];for(let e=0;e<h;e++)c[e]={name:l[e].name,data:[]};this.morphTargets.position=c}let d=e.morphNormals,p=d.length,f;if(p>0){f=[];for(let e=0;e<p;e++)f[e]={name:d[e].name,data:[]};this.morphTargets.normal=f}let m=e.skinIndices,g=e.skinWeights,v=m.length===i.length,y=g.length===i.length;i.length>0&&0===t.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let e=0;e<t.length;e++){let x=t[e];this.vertices.push(i[x.a],i[x.b],i[x.c]);let b=x.vertexNormals;if(3===b.length)this.normals.push(b[0],b[1],b[2]);else{let e=x.normal;this.normals.push(e,e,e)}let w=x.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{let e=x.color;this.colors.push(e,e,e)}if(!0===a){let t=r[0][e];void 0!==t?this.uvs.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",e),this.uvs.push(new t9,new t9,new t9))}if(!0===o){let t=r[1][e];void 0!==t?this.uvs2.push(t[0],t[1],t[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",e),this.uvs2.push(new t9,new t9,new t9))}for(let e=0;e<h;e++){let t=l[e].vertices;c[e].data.push(t[x.a],t[x.b],t[x.c])}for(let t=0;t<p;t++){let i=d[t].vertexNormals[e];f[t].data.push(i.a,i.b,i.c)}v&&this.skinIndices.push(m[x.a],m[x.b],m[x.c]),y&&this.skinWeights.push(g[x.a],g[x.b],g[x.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}},w3=class{constructor(e,t,i,r,a,o=0){this.a=e,this.b=t,this.c=i,this.normal=r&&r.isVector3?r:new iD,this.vertexNormals=Array.isArray(r)?r:[],this.color=a&&a.isColor?a:new iv,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,i=e.vertexNormals.length;t<i;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,i=e.vertexColors.length;t<i;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};function w4(e){return this.array.set(e),this}function w5(e){let t=this.array,i=0;for(let r=0,a=e.length;r<a;r++){let a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new iv),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this}function w6(e){let t=this.array,i=0;for(let r=0,a=e.length;r<a;r++){let a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new t9),t[i++]=a.x,t[i++]=a.y}return this}function w8(e){let t=this.array,i=0;for(let r=0,a=e.length;r<a;r++){let a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new iD),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this}function w9(e){let t=this.array,i=0;for(let r=0,a=e.length;r<a;r++){let a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new iA),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this}var w7=["a","b","c"];function Se(e,t,i){let r=Math.min(e,t),a=Math.max(e,t);return i.get(r+"_"+a)}function St(e,t,i,r,a,o){let l=Math.min(e,t),h=Math.max(e,t),c=l+"_"+h,d;r.has(c)?d=r.get(c):(d={a:i[l],b:i[h],newEdge:null,faces:[]},r.set(c,d)),d.faces.push(a),o[e].edges.push(d),o[t].edges.push(d)}function Si(e,t,i,r,a){e.push(new w3(t,i,r,void 0,void 0,a))}function Sr(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function Ss(e,t,i,r){e.push([t.clone(),i.clone(),r.clone()])}var Sa=class{constructor(e=1){this.subdivisions=e}modify(e){(e=e instanceof rQ?new w1().fromBufferGeometry(e):e.clone()).mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new iD,i,r,a,o,l,h=e.vertices,c=e.faces,d=e.faceVertexUvs[0],p=void 0!==d&&d.length>0,f=[],m=new Map;!function(e,t,i,r){let a,o,l;for(a=0,o=e.length;a<o;a++)i[a]={edges:[]};for(a=0,o=t.length;a<o;a++)St((l=t[a]).a,l.b,e,r,l,i),St(l.b,l.c,e,r,l,i),St(l.c,l.a,e,r,l,i)}(h,c,f,m);let g=[],v,y,x,b,w,S,_;for(let e of Array.from(m.keys())){for(y=m.get(e),x=new iD,w=3/8,S=1/8,2!=(_=y.faces.length)&&(w=.5,S=0),x.addVectors(y.a,y.b).multiplyScalar(w),t.set(0,0,0),o=0;o<_;o++){for(b=y.faces[o],l=0;l<3&&!((v=h[function(e,t){switch(t){case"c":return e.c;case"b":return e.b;default:return e.a}}(b,w7[l])])!==y.a&&v!==y.b);l++);v&&t.add(v)}t.multiplyScalar(S),x.add(t),y.newEdge=g.length,g.push(x)}let A,M,E,C,T,P,D,O=[];for(r=0,a=h.length;r<a;r++){for(P=h[r],3==(i=(T=f[r].edges).length)?A=3/16:i>
31403&&(A=3/(8*i)),M=1-i*Number(A),E=A,i<=2&&2==i&&(M=3/4,E=1/8),D=P.clone().multiplyScalar(M),t.set(0,0,0),o=0;o<i;o++)v=(C=T[o]).a!==P?C.a:C.b,t.add(v);t.multiplyScalar(Number(E)),D.add(t),O.push(D)}let I=O.concat(g),R=O.length,L,B,z,F=[],N=[],U,k,V,j,G=new t9,H=new t9,W=new t9;for(r=0,a=c.length;r<a;r++)Si(F,L=Number(Se((b=c[r]).a,b.b,m).newEdge)+R,B=Number(Se(b.b,b.c,m).newEdge)+R,z=Number(Se(b.c,b.a,m).newEdge)+R,b.materialIndex),Si(F,b.a,L,z,b.materialIndex),Si(F,b.b,B,L,b.materialIndex),Si(F,b.c,z,B,b.materialIndex),p&&(k=(U=d[r])[0],V=U[1],j=U[2],G.set(Sr(k.x,V.x),Sr(k.y,V.y)),H.set(Sr(V.x,j.x),Sr(V.y,j.y)),W.set(Sr(k.x,j.x),Sr(k.y,j.y)),Ss(N,G,H,W),Ss(N,k,G,W),Ss(N,V,H,G),Ss(N,j,W,H));e.vertices=I,e.faces=F,p&&(e.faceVertexUvs[0]=N)}},Sn=new iD,So=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.geometry??t?.geometry??new rQ().copy(new st(100,100,100)),r;void 0===t?(i.computeBoundingBox(),i.boundingBox.getSize(Sn),r={width:Sn.x,height:Sn.y,depth:Sn.z,subdivisions:0}):r=t.parameters;let a={...r,...e.parameters};return{parameters:{width:Math.abs(a.width),height:Math.abs(a.height),depth:Math.abs(a.depth),subdivisions:Math.abs(a.subdivisions)},geometry:i}}static build(e){var t;let i,r,{width:a,height:o,depth:l,subdivisions:h}=e.parameters,c=e.geometry??new rQ().copy(new st(100,100,100)),d=c.userData.parameters;void 0===d?(c.boundingBox=(t=c,i=new iR,(r=t.attributes.position)?i.setFromBufferAttribute(r):i.makeEmpty(),i),c.boundingBox.getSize(Sn)):Sn.set(d.width,d.height,d.depth),(a!==Sn.x||o!==Sn.y||l!==Sn.z)&&c.scale(0===Sn.x?1:a/Sn.x,0===Sn.y?1:o/Sn.y,0===Sn.z?1:l/Sn.z);let p=c.originalGeometry;try{h>0?(void 0===p||d?.subdivisions!==h)&&(void 0===p&&(p=c),c=new Sa(h).modify(p).toBufferGeometry()):(void 0!==p&&(c=p),p=void 0,void 0===c.getAttribute("normal")&&c.computeVertexNormals())}catch{void 0!==p&&(c=p),p=void 0,void 0===c.getAttribute("normal")&&c.computeVertexNormals()}return void 0!==p&&Object.assign(c,{originalGeometry:p}),delete e.geometry,Object.assign(c,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new lT(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(Sn);let r=100/Sn.x;Object.assign(i.parameters,{width:100,height:Sn.y*r,depth:Sn.z*r}),t(this.build(i))})}},Sl=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof wl?e.shape:new wl,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,cornerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,c=e.shape,d=.5*t,p=.5*i,f=2*Math.PI/r;for(let e=0;e<r;e++){let t=f*e,i=0+Math.sin(t)*d,r=0+Math.cos(t)*p;c.addPoint(c.createPoint(i,r))}c.isClosed=!0;for(let e=0,t=c.points.length;e<t;e++)c.points[e].roundness=a;return c.roundness=a,c.update(),Object.assign(wF.create({shape:c,parameters:{roundness:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),{userData:{...e,type:"PolygonGeometry"}})}},Sh=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,radialSegments:a,heightSegments:o,openEnded:l,cornerRadius:h,cornerSegments:c}=e.parameters,d=new Su(.5*t,i,a,o,l,h,c);return d.scale(1,1,r/t),Object.assign(d,{userData:{...e,type:"PyramidGeometry"}})}};function Sc(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function Sd(e,t,i,r,a,o){let l=t.clone().sub(e),h=i.clone().sub(e),c=l.angleTo(h);if(l.normalize(),h.normalize(),r===a){let t=l.add(h).normalize();o.copy(e).addScaledVector(t,r/Math.sin(c/2))}else{let t=l.angleTo(h);o.copy(e),o.addScaledVector(l,a/Math.sin(t)),o.addScaledVector(h,r/Math.sin(t))}}var Su=class extends rQ{constructor(e=.5,t=1,i=4,r=1,a=!1,o=0,l=4){let h;super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),l=Math.floor(l);let c=[],d=[],p=[],f=[],m=0,g=t/2,v=Math.PI/i,y=e*Math.cos(Math.PI/i),x=2*Math.PI/i,b=Math.PI-(i-2)*Math.PI/i,w=new iD(0,-g,0),S=new iD(0,g,0),_=new t9(e,-g),A=new t9(y,-g),M=new t9(0,S.y).sub(A),E=new t9(0,S.y).sub(_),C=new t9(M.y,-M.x).normalize(),T=new t9(E.y,-E.x).normalize(),P=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-M.angle())/2)-1e-8;o=Math.min(o,P);{let e=new iD(C.x,C.y,0),t=new iD(Math.cos(x)*e.x,e.y,Math.sin(x)*e.x);h=e.angleTo(t)}
vendor: 4,634 bytes, line 3140
3140let D=o/Math.tan((Math.PI-M.angle())/2),O=o/Math.tan((Math.PI-h)/2),I=new iD;if(!a){d.push(w.x,w.y,w.z),p.push(0,-1,0),f.push(0,0);let e=m++,t=[],r=_.clone(),a=D/Math.cos(Math.PI/i);r.x-=a;for(let e=0;e<i;e++){let a=e/i*Math.PI*2+v;Sc(r,new t9(Math.sin(a),Math.cos(a)),I),d.push(I.x,I.y,I.z),p.push(0,-1,0),f.push(0,0),t.push(m++)}for(let i=0;i<t.length;i++)c.push(t[i],e,t[(i+1)%t.length])}let R=[];{let e=new iD,t=new iD,r=new iD,a=new iD,g=new iD,y=new iD;for(let x=0;x<i;x++){let A=x/i*Math.PI*2+v,P=(x+.5)/i*Math.PI*2+v,I=(x+1)/i*Math.PI*2+v,B=new t9(Math.sin(A),Math.cos(A)),z=new t9(Math.sin(P),Math.cos(P)),F=new t9(Math.sin(I),Math.cos(I));Sc(_,B,t),Sc(_,F,r),Sc(C,z,e),Sd(S,t,r,O,O,a),d.push(a.x,a.y,a.z),Sd(t,S,r,O,D,g),d.push(g.x,g.y,g.z),Sd(r,t,S,D,O,y),d.push(y.x,y.y,y.z),p.push(e.x,e.y,e.z),p.push(e.x,e.y,e.z),p.push(e.x,e.y,e.z),f.push(0,0),f.push(0,0),f.push(0,0);let N=m++,U=m++,k=m++;if(c.push(N,U,k),o>0){let v,x;{let e=t.clone().add(r).multiplyScalar(.5),i=S.clone().sub(e).normalize(),a=w.clone().sub(e).normalize().add(i).normalize().multiplyScalar(-1);L(e,y.clone().sub(g),a,M.angle())}{let e=new iD;Sc(T,F,e);let t=y.clone().add(a).multiplyScalar(.5);t=function(e,t,i){let r=e.clone().sub(t),a=i.clone().sub(t);return r.projectOnVector(a),r.add(t)}(t,r,S);let i=y.clone().sub(a);[v,x]=L(t,i,e,h,a.y)}{let e=v,t=e.clone().setY(0).normalize(),i=new iD(0,-1,0),r=t.clone().cross(i);!function(e,t,i,r){let a=Math.PI/2,h=E.angle()-a,g=[],v=new iD,y=new iD;for(let c=0;c<=l;c++){let x=[],w=c/l;for(let l=0;l<=c;l++){let g=((c?l/c:0)-.5)*b,S=Math.cos(g),_=Math.sin(g),A=(a+Math.atan(Math.tan(h)*S))*w,M=Math.cos(A),E=Math.sin(A);v.set(0,0,0),v.addScaledVector(t,E*S),v.addScaledVector(i,M),v.addScaledVector(r,E*_),y.copy(e).addScaledVector(v,o),d.push(y.x,y.y,y.z),p.push(v.x,v.y,v.z),f.push(0,0),x.push(m++)}g.push(x)}let x=g.length-1;for(let e=0;e<x;e++){let t=g[e],i=g[e+1],r=t.length-1;c.push(t[0],i[1],i[0]);for(let e=1;e<=r;e++)c.push(t[e-1],t[e],i[e]),c.push(t[e],i[e+1],i[e])}}(e,t,i,r)}R.concat(x);{let t=M.angle(),r=Math.PI-t,a=S.clone();a.y-=o/Math.sin(t-Math.PI/2);let h=new iD,g=[];for(let t=0;t<l;t++){let c=[],v=Math.PI/2-r*t/l,y=Math.cos(v),x=Math.sin(v),b=P;for(let r=0;r<=t;r++){let r=Math.cos(b),l=Math.sin(b);e.x=y*l,e.y=x,e.z=y*r,h.copy(a).addScaledVector(e,o),d.push(h.x,h.y,h.z),p.push(e.x,e.y,e.z),f.push(0,0),c.push(m++),b+=2*Math.PI/t/i}g.push(c)}x.reverse(),g.push(x);let v=g.length-1;for(let e=0;e<v;e++){let t=g[e],i=g[e+1],r=t.length-1;c.push(i[1],t[0],i[0]);for(let e=1;e<=r;e++)c.push(t[e],t[e-1],i[e]),c.push(i[e+1],t[e],i[e])}}}}}function L(e,t,i,r,a){let h=-r/2,g=(Math.PI-r)/2,v=t.clone().normalize().cross(i);e.addScaledVector(i,-o/Math.sin(g));let y=new iD,x=new iD,b=m,w=[];for(let c=0;c<=l;c++){let g=h+c/l*r;x.set(0,0,0),x.addScaledVector(v,Math.sin(g)),x.addScaledVector(i,Math.cos(g));for(let i=0;i<=1;i++){let r=i/1-.5;if(y.copy(e),y.addScaledVector(t,r),y.addScaledVector(x,o),null!=a){let e=Math.max(0,y.y-a);y.addScaledVector(t,-e/t.y)}d.push(y.x,y.y,y.z),p.push(x.x,x.y,x.z),f.push(0,0),0===i&&w.push(m),m++}}for(let e=0;e<l;e++)for(let t=0;t<1;t++){let i=b+t+2*e,r=i+2,a=r+1,o=i+1;c.push(i,r,o),c.push(r,a,o)}return[e.clone().addScaledVector(t,.5),w]}this.setIndex(c),this.setAttribute("position",new rV(d,3)),this.setAttribute("normal",new rV(p,3)),this.setAttribute("uv",new rV(f,2))}},Sp=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof wl?e.shape:new wl,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:r}}static build(e){let t=e.shape,{width:i,height:r,cornerRadius:a,cornerType:o,depth:l,extrudeBevelSize:h,extrudeBevelSegments:c}=e.parameters,d={x:.5*i,y:.5*r},p={x:-d.x,y:-d.y},f={x:d.x,y:d.y};function m(e,t,a){return t>i&&a>r?Math.min(e*i/t,e*r/a):t>i?e*i/t:a>r?e*r/a:e}let g=[];g[0]=0===a[0]?0:m(a[0],a[0]+a[3],a[0]+a[1]),g[1]=0===a[1]?0:m(a[1],a[1]+a[2],a[1]+a[0]),g[2]=0===a[2]?0:m(a[2],a[2]+a[1],a[2]+a[3]),g[3]=0===a[3]?0:m(a[3],a[3]+a[0],a[3]+a[2]);let v=p.x,y=f.x,x=f.y,b=p.y;t.addPoint(t.createPoint(v,x)),t.addPoint(t.createPoint(y,x)),t.addPoint(t.createPoint(y,b)),t.addPoint(t.createPoint(v,b)),t.isClosed=!0;let w=!0;for(let e=0,i=t.points.length;e<i;e++)t.points[e].roundness=g[e],e>0&&g[e]!==g[e-1]&&(w=!1);return w&&(t.roundness=g[0]),t.useCubicForRoundedCorners=1!==o,t.update(
3140),Object.assign(wF.create({shape:t,parameters:{depth:l,extrudeBevelSize:h,extrudeBevelSegments:c}}),{userData:{...e,type:"RectangleGeometry"}})}},Sf=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=t8.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t=100,height:i=t,depth:r=t,widthSegments:a=64,heightSegments:o=64,phiStart:l,phiLength:h,thetaStart:c,thetaLength:d}=e.parameters,p;return 0===d?(p=new rQ).setAttribute("position",new rV([],3)):p=new oW(.5*t,a,o,l,h,c,d*t8.DEG2RAD),p.scale(1,i/t,r/t),Object.assign(p,{userData:{...e,type:"SphereGeometry"}})}},Sm=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:a=8}=e.parameters,o=new s_(t,i,r,a);return o.scale(1,1,1),Object.assign(o,{userData:{...e,type:"PlaneGeometry"}})}},Sg=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,angle:a,cornerRadius:o,cornerSegments:l}=e.parameters;return Object.assign(new Sv(t,i,r,a,o,l),{userData:{...e,type:"BackdropGeometry"}})}},Sv=class extends rQ{constructor(e=1,t=1,i=1,r=90,a=10,o=24){super(),this.type="BackdropGeometry";let l=[],h=[],c=[];0==a&&(o=1),o=Math.max(1,Math.floor(o)),a=Math.min(a,100),r=Math.PI/180*Math.min(179.999,r);let d=[],p=Math.PI/2,f=(e=0,t=0,i=0)=>new iD(e,t,i),m=f(),g=f(),[v,y,x]=[t/2,e/2,i/2],b=-y,w=+y,[S,_,A]=[f(b,-v,+x),f(b,-v,-x),f(b,+v,-x)],M=(e,t=!1)=>Math.sin(e-Math.PI/(1+ +t)),E=(e,t=!1)=>Math.cos(e-Math.PI/(1+ +t));A.y=Math.sin(r)*t-v;let C=Math.cos(r)*t-x,T=S.z-.001;r<=p?(A.z=Math.min(C,T),A.z==T&&(A.y-=(C-T)/Math.tan(p-r))):_.z=Math.min(_.z-C-x,S.z-.001),m.subVectors(S,_),g.subVectors(A,_);let P=Math.min(m.length(),g.length())*a/100,D=P*Math.tan(r/2),O=P/Math.cos(r/2),I=m.clone().normalize().add(g.normalize()).setLength(O).add(_);m.set(0,M(r,!0),E(r,!0)),d.push([A,m.clone()]);let R=(Math.PI-r)/o;for(let e=0;e<=o;e++){let t=p+r+e*R;m.set(0,Math.sin(t)*D,Math.cos(t)*D),m.add(I),g.set(0,M(t),E(t)),d.push([m.clone(),g.clone()])}d.push([S,f(0,1,0)]);let L=Math.sin(R/2)*D*2,B=d.length-1,z=d[0][0].distanceTo(d[1][0]),F=z+L*o+d[B-1][0].distanceTo(d[B][0]);d[0].push(1);for(let e=0;e<=o;e++)d[e+1].push(1-(z+e*L)/F);d[B].push(0);let[N,U,k]=d[0],V,j,G;for(let e=1;e<d.length;e++)[V,j,G]=d[e],l.push(b,N.y,N.z,b,V.y,V.z,w,N.y,N.z,w,N.y,N.z,b,V.y,V.z,w,V.y,V.z),h.push(0,U.y,U.z,0,j.y,j.z,0,U.y,U.z,0,U.y,U.z,0,j.y,j.z,0,j.y,j.z),c.push(0,k,0,G,1,k,1,k,0,G,1,G),[N,U,k]=[V,j,G];this.setAttribute("position",new rV(l,3)),this.setAttribute("normal",new rV(h,3)),this.setAttribute("uv",new rV(c,2))}},Sy=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof wl?e.shape:new wl,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,innerRadiusPercent:r,spikes:a,cornerRadius:o,angle:l,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}=e.parameters,p=e.shape,f=.5*t,m=.5*i,g=l*Math.PI/360/a,v=-(Math.PI/2*3),y=f*r/100,x=m*r/100;if(3===a&&50===r){g=2*Math.PI/a;for(let e=0;e<a;e++){let t=g*e,i=0+Math.sin(t)*f,r=0+Math.cos(t)*m;p.addPoint(p.createPoint(i,r))}}else for(let e=0;e<a;e++){let e=0+Math.cos(v)*f,t=0+Math.sin(v)*m;p.addPoint(p.createPoint(e,t)),v+=g,e=0+Math.cos(v)*y,t=0+Math.sin(v)*x,p.addPoint(p.createPoint(e,t)),v+=g}p.isClosed=!0;for(let e=0,t=p.points.length;e<t;e++)p.points[e].roundness=o;return p.roundness=o,p.update(),Object.assign(wF.create({shape:p,parameters:{roundness:o,depth:h,extrudeBevelSize:c,extrudeBevelSegments:d}}),{userData:{...e,type:"StarGeometry"}})}},Sx=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i}=e.parameters;return Object.assign(new s_(t,i),{userData:{...e,type:"TextFrameGeometry"}})}},Sb=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),a=Math.abs(i.height??i.width);i.shapeBlendNode&&(a=r);let o=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:a,depth:o})}}static build(e){let{width:t,height:i,depth:r,radialSegments:a,tubularSegments:o,arc:l,cornerRadius:h,cornerSegments:c}=e.parameters,d=function(e,t,i,r,a,o,l,h,c,d,p){[t,i]=[i,t],l=t/2;let f=t8.clamp(a/360,0,1);if(0===f){let e=new rQ;return e.setAttribute("position",new rV([],3)),e}return 1===f&&(d=0),new wY(!0,e,t,i,r,f,o,l,0,c,d,p)}(t,i,r,.5*t,l,o,0,0,a,h,c);return d.scale(1,i/t,1),Object.assign(d,{userData:{...e,type:"TorusGeometry"}})}},Sw=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(e){let{width:t,tube:i,tubularSegments:r,radialSegments:a,p:o,q:l}=e.parameters,h=.5*t;
3140return h!==i&&(h-=i),Object.assign(new oX(h,i,r,a,o,l),{userData:{...e,type:"TorusKnotGeometry"}})}},SS=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof wl?e.shape:new wl,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t=100,height:i,cornerRadius:r,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,isRect:h}=e.parameters,c=e.shape,d=.5*t,p=.5*i;h?c.addPoint(c.createPoint(-d,p)):c.addPoint(c.createPoint(0,p)),c.addPoint(c.createPoint(d,-p)),c.addPoint(c.createPoint(-d,-p)),c.isClosed=!0;for(let e=0,t=c.points.length;e<t;e++)c.points[e].roundness=r;return c.roundness=r,c.update(),Object.assign(wF.create({shape:c,parameters:{roundness:r,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}}),{userData:{...e,type:"TriangleGeometry"}})}},S_={hexStringToRgb:function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(e,t,i,r)=>String(t+t+i+i+r+r));let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}},SA=class{add(e,t,i){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}},SM=class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}},SE=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+SE.version}static addUnaryOp(e){return SE.max_unop_len=Math.max(e.length,SE.max_unop_len),SE.unary_ops[e]=1,SE}static addBinaryOp(e,t,i){return SE.max_binop_len=Math.max(e.length,SE.max_binop_len),SE.binary_ops[e]=t,i?SE.right_associative.add(e):SE.right_associative.delete(e),SE}static addIdentifierChar(e){return SE.additional_identifier_chars.add(e),SE}static addLiteral(e,t){return SE.literals[e]=t,SE}static removeUnaryOp(e){return delete SE.unary_ops[e],e.length===SE.max_unop_len&&(SE.max_unop_len=SE.getMaxKeyLen(SE.unary_ops)),SE}static removeAllUnaryOps(){return SE.unary_ops={},SE.max_unop_len=0,SE}static removeIdentifierChar(e){return SE.additional_identifier_chars.delete(e),SE}static removeBinaryOp(e){return delete SE.binary_ops[e],e.length===SE.max_binop_len&&(SE.max_binop_len=SE.getMaxKeyLen(SE.binary_ops)),SE.right_associative.delete(e),SE}static removeAllBinaryOps(){return SE.binary_ops={},SE.max_binop_len=0,SE}static removeLiteral(e){return delete SE.literals[e],SE}static removeAllLiterals(){return SE.literals={},SE}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new SE(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return SE.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!SE.binary_ops[String.fromCharCode(e)]||SE.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return SE.isIdentifierStart(e)||SE.isDecimalDigit(e)}throwError(e){let t=Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(SE.hooks[e]){let i={context:this,node:t};return SE.hooks.run(e,i),i.node}return t}searchHook(e){if(SE.hooks[e]){let t={context:this};return SE.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===SE.SPACE_CODE||e===SE.TAB_CODE||e===SE.LF_CODE||e===SE.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:SE.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],i,r;for(;this.index<this.expr.length;)if((i=this.code)===SE.SEMCOL_CODE||i===SE.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(i===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,SE.max_binop_len),t=e.length;for(;t>0;){if(SE.binary_ops.hasOwnProperty(e)&&(!SE.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!SE.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,i,r,a,o,l,h,c;if(!(o=this.gobbleToken())||!(t=this.gobbleBinaryOp()))return o;for(a={value:t,prec:SE.binaryPrecedence(t),right_a:SE.right_associative.has(t)},(l=this.gobbleToken())||this.throwError("Expected expression after "+t),r=[o,a,l];t=this.gobbleBinaryOp();){if(0===(i=SE.binaryPrecedence(t))){this.index-=t.length;break}a={value:t,prec:i,right_a:SE.right_associative.has(t)},c=t;let h=e=>a.right_a&&e.right_a?i>e.prec:i<=e.prec;for(;r.length>2&&h(r[r.length-2]);)l=r.pop(),t=r.pop().value,o=r.pop(),e={type:SE.BINARY_EXP,operator:t,left:o,right:l},r.push(e);(e=this.gobbleToken())||this.throwError("Expected expression after "+c),r.push(a,e)}for(h=r.length-1,e=r[h];h>1;)e={type:SE.BINARY_EXP,operator:r[h-1].value,left:r[h-2],right:e},h-=2;return e}gobbleToken(){let e,t,i,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);
3140if(e=this.code,SE.isDecimalDigit(e)||e===SE.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===SE.SQUOTE_CODE||e===SE.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===SE.OBRACK_CODE)r=this.gobbleArray();else{for(i=(t=this.expr.substr(this.index,SE.max_unop_len)).length;i>0;){if(SE.unary_ops.hasOwnProperty(t)&&(!SE.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!SE.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=i;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:SE.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--i)}SE.isIdentifierStart(e)?(r=this.gobbleIdentifier(),SE.literals.hasOwnProperty(r.name)?r={type:SE.LITERAL,value:SE.literals[r.name],raw:r.name}:r.name===SE.this_str&&(r={type:SE.THIS_EXP})):e===SE.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===SE.PERIOD_CODE||t===SE.OBRACK_CODE||t===SE.OPAREN_CODE||t===SE.QUMARK_CODE;){let i;if(t===SE.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==SE.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===SE.OBRACK_CODE?(e={type:SE.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),(t=this.code)!==SE.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===SE.OPAREN_CODE?e={type:SE.CALL_EXP,arguments:this.gobbleArguments(SE.CPAREN_CODE),callee:e}:(t===SE.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),e={type:SE.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),i&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,i;for(;SE.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===SE.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);SE.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if("e"===(t=this.char)||"E"===t){for(e+=this.expr.charAt(this.index++),("+"===(t=this.char)||"-"===t)&&(e+=this.expr.charAt(this.index++));SE.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);SE.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return i=this.code,SE.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(i===SE.PERIOD_CODE||1===e.length&&e.charCodeAt(0)===SE.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:SE.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,i=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===i){r=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++)){case"n":e+=` 3141`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:SE.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(SE.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,SE.isIdentifierPart(e));)this.index++;return{type:SE.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],i=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){i=!0,this.index++,e===SE.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===SE.COMMA_CODE){if(this.index++,++r!==t.length){if(e===SE.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===SE.CBRACK_CODE)for(let e=t.length;e<r;e++)t.push(null)}}else if(t.length!==r&&0!==r)this.throwError("Expected comma");else{let e=this.gobbleExpression();e&&e.type!==SE.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return i||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(SE.CPAREN_CODE);if(this.code===SE.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:SE.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:SE.ARRAY_EXP,elements:this.gobbleArguments(SE.CBRACK_CODE)}}};Object.assign(SE,{hooks:new SA,plugins:new SM(SE),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),SE.max_unop_len=SE.getMaxKeyLen(SE.unary_ops),SE.max_binop_len=SE.getMaxKeyLen(SE.binary_ops);
3141var SC=e=>new SE(e).parse();function ST(e){return{all:e=e||new Map,on:function(t,i){var r=e.get(t);r?r.push(i):e.set(t,[i])},off:function(t,i){var r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var r=e.get(t);r&&r.slice().map(function(e){e(i)}),(r=e.get("*"))&&r.slice().map(function(e){e(t,i)})}}}Object.getOwnPropertyNames(SE).forEach(e=>{void 0===SC[e]&&"prototype"!==e&&(SC[e]=SE[e])}),SC.Jsep=SE,SC.plugins.register({name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let i=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let a=this.gobbleExpression();if(a||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:i,consequent:r,alternate:a},i.operator&&e.binary_ops[i.operator]<=.9){let r=i;for(;r.right.operator&&e.binary_ops[r.right.operator]<=.9;)r=r.right;t.node.test=r.right,r.right=t.node,t.node=i}}else this.throwError("Expected :")}})}});var SP=class{constructor(e,t,i){this.id=e,this.userAPI=t,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise(e=>e()),this.emitter=ST(),this._innerCallUserAPI=async e=>{this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await SD(this.userAPI,e),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(t){let e=t.message?.split("_:_")?.[0]?.replace("status:","")??"null";this.error=e,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},t?.integration?.type==="OpenAI"?this.result={content:""}:"GET"===t.method&&""!==t.url&&(this.prefetchPromise=this.prefetch(i)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=u8(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=void 0!==this.userAPI.debounce&&this.userAPI.debounce>0?u8(this._innerCallUserAPI,this.userAPI.debounce,{leading:!0,trailing:!0}):this._innerCallUserAPI}async prefetch(e){await this.callUserAPI(e)}async callUserAPI(e){await this._debouncedCallUserAPI(e)}update(e,t,i=!0){this.userAPI=e,this._updateDebouncedCallUserAPI(),""!==this.userAPI.url&&"GET"===this.userAPI.method&&i&&this._debouncedPrefetch(t)}retrieveValue(e){if(this.result)try{return fx.zoom(this.result,e)}catch(e){console.error(e)}}retrieveZoomedKeyValues(e){if(this.result){let t=e&&e.length?fx.zoom(this.result,e):this.result;if("object"==typeof t&&null!==t)return Object.entries(t);if(Array.isArray(t))return t.map((e,t)=>[t.toString(),e]);throw"string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t?Error("This path points to a value, use retrieveValue() instead. "+e?.join(".")):Error("Path error"+e?.join("."))}}dispose(){}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}get autostart(){return this.userAPI.autoStart}};async function SD(e,t,i=new AbortController){let r,a,o=e.url,l=e.proxy?.enabled??!1,h;if(e.integration?.type==="OpenAI"){let i=SI(""===e.integration.prompt?[]:JSON.parse(e.integration.prompt),t),r=""===e.integration.behavior?[]:SI(JSON.parse(e.integration.behavior),t);h=`{ 3142 "model": "${e.integration.model}", 3143 "messages": [${e.integration.useBehavior?` 3144 { 3145 "role": "system", 3146 "content": "${r}" 3147 },`:""} 3148 { 3149 "role": "user", 3150 "content": "${i}" 3151 } 3152 ] 3153 }`}if(l){let i;o=`https://apis.spline.design/file/${e.proxy.fileId}/external-api/request?uuidexternalapi=${e.proxy.proxyId}`,void 0!==h?i=h:"POST"===e.method&&e.body&&(i=SI(JSON.parse(e.body),t)),void 0!==i&&(o+=`&data=${encodeURIComponent(i.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else e.integration?.type==="OpenAI"?a=h:"POST"===e.method&&e.body&&(a=SI(JSON.parse(e.body),t));let c=await fetch(o,{method:l?"GET":e.method,headers:l?void 0:(r=new Headers,e.headers.forEach(e=>{""!==e.data.key&&r.append(e.data.key,e.data.value)}),r),signal:i.signal,body:a});if(!c.ok)throw Error("status:"+c.status+"_:_"+c.statusText);if(e.integration?.type==="OpenAI"){let e=await c.json();return l&&(e=e.response),{content:e.choices[0].message.content}}{let e=await c.json();return l&&(e=e.response),e}}var SO=(e,t)=>
3153{if("string"==typeof e){let i=t.getVariable(e);if(i)return SO(i,t)}return xn.isBoolean(e)?xn.getDisplayedValue(e).toLowerCase():xn.getDisplayedValue(e)},SI=(e,t)=>e.map((e,i)=>{if("text"in e)return e.text;if("type"in e){if("paragraph"===e.type)return(i>0?` 3154`:"")+SI(e.children,t);if("variable"===e.type){let i=t.getVariable(e.variableId);if(void 0!==i)return SO(i,t)}}return""}).join(""),SR=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],SL=["0","1","2","3","4","5","6","7","8","9","."],SB=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function Sz(e,t,i="number"){let r,a,o="";for(let r=0;r<e.length;r++){var l;let a=e[r];if("objType"in a&&"api"===a.objType){let e=JSON.parse(a.id),i=e[0],r=t.getUserAPI(i);if(void 0!==r&&r instanceof SP){let t=r.retrieveValue(e.slice(1));void 0!==t&&(o+=t)}continue}if("objType"in a&&"webhook"===a.objType){let[e,i]=JSON.parse(a.id),r=t.getUserWebhook(e);if(void 0!==r){let e=r.getParameterValue(i);void 0!==e&&(o+=e)}continue}if("objType"in a&&"aiAssistant"===a.objType){let e=t.openAIRealtime;if("objId"in a&&void 0!==a.objId){let i;if(t.scene.data.objects.traverse((e,t)=>{let r=t.events?.find(e=>e.id===a.objId);r&&(i=r)}),void 0!==i&&"AIAssistantListener"===i.data.type){let t=e?.computeAnalysisForListenerEvent(i.data);if(void 0!==t){o+=t;continue}}}o+=e?.voice??0;continue}if("id"in a){let l=e[r-1];if(r>0&&"id"in l){console.error("Two variables in a row",e);return}let h=t.getVariable(a.id),c=xn.getDisplayedValue(h);"number"===i&&xn.isTextValue(h)&&Array.isArray(h.textValue)&&1===h.textValue.length?c=parseFloat(c).toString():"boolean"===i&&xn.isBoolean(h)?c=h?"true":"false":"boolean"===i&&xn.isTextValue(h)&&!Array.isArray(h.textValue)&&(c='"'+c+'"'),o+=c;continue}if("string"===i){'"'!==a.name&&("+"!==a.name||a.escaped)&&(o+=a.name),"+"!==a.name||a.escaped||"\\"!==o[o.length-1]||(o=o.slice(0,-1)+a.name);continue}if("and"===a.name){o+="&&";continue}if("or"===a.name){o+="||";continue}if("True"===a.name){o+="true";continue}if("False"===a.name){o+="false";continue}if("boolean"===i&&!("string"==typeof(l=a.name)&&!isNaN(l)&&!isNaN(parseFloat(l)))&&!SL.includes(a.name)&&!SR.includes(a.name)&&!SB.includes(a.name.replace(/\($/g,""))){o+='"'+a.name+'"';continue}o+=a.name}if("string"===i)return o;if(0===e.length){if("number"===i)return 0;if("boolean"===i)return!1}try{r=SC(o)}catch(e){console.error(o,e);return}try{a=function e(t){switch(t.type){case"BinaryExpression":switch(t.operator){case"==":return Number(e(t.left)===e(t.right));case"!=":return Number(e(t.left)!==e(t.right));case">":return Number(e(t.left)>e(t.right));case">=":return Number(e(t.left)>=e(t.right));case"<":return Number(e(t.left)<e(t.right));case"<=":return Number(e(t.left)<=e(t.right));case"+":return e(t.left)+e(t.right);case"-":return e(t.left)-e(t.right);case"*":return e(t.left)*e(t.right);case"/":return e(t.left)/e(t.right);case"%":return e(t.left)%e(t.right);case"&&":return e(t.left)&&e(t.right);case"||":return e(t.left)||e(t.right);case"^":return Math.pow(e(t.left),e(t.right));default:throw Error("Unknown operator: "+t.operator)}case"UnaryExpression":switch(t.operator){case"-":return-e(t.argument);case"!":return Number(!e(t.argument));default:throw Error("Unknown operator: "+t.operator)}case"Identifier":throw Error("Unknown identifier: "+t.name);case"Literal":return t.value;case"CallExpression":if("Identifier"===t.callee.type){if("random"===t.callee.name){let i=0,r=1;if(t.arguments.length>=1)try{i=e(t.arguments[0])}catch(e){console.warn(e)}if(t.arguments.length>=2)try{r=e(t.arguments[1])}catch(e){console.warn(e)}return i=Math.min(r,i),r=Math.max(r,i),i+Math.random()*(r-i)}return Math[t.callee.name].apply(null,t.arguments.map(e))}throw Error("Unknown node");default:throw Error("Unknown node type: "+t.type)}}(r)}catch(e){console.error(o,r,e)}return a}SC.addBinaryOp("^",11,!0);var SF=new i6,SN=new i6,SU=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters),r=Math.abs(i.width),a=Math.abs(i.height??i.width),o=Math.abs(i.depth??0),l=t?.shapeData??wU.create({parameters:{...vs,width:"number"==typeof vs.width?vs.width:100,height:"number"==typeof vs.height?vs.height:100}}).userData.shape;return{path:e.path??vx.defaultData(),parameters:Object.assign(i,{width:r,height:a,depth:o,extrusion:{...va,...i.extrusion}}),shapeData:l}}static build(e){return e.path.points.length>=2?Object.assign(new Sk(e),{userData:{...e,type:"PathGeometry"}}):Object.assign(new rQ,{userData:{...e,type:"PathGeometry"}})}},Sk=class extends rQ{constructor(e){super(),this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&1===this.inputs.parameters.extrusion.depth}_isOpenEnded(){let e,t=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&1===t.depth)||(t.twist%(e=2*Math.PI)+e)%e!=(0%e+e)%e||t.startScale!==t.endScale}build(){let e=this._extractPathPoints();if(e.length<2)return;let t=this._computeBasisMatrices(e),{depth:i,offset:r}=this.inputs.parameters.extrusion;i=Math.max(0,Math.min(i,1)),r=Math.max(0,Math.min(r,1));let a=this.inputs.path.isClosed?e.length:e.length-1,o=Math.floor(r*a),l=Math.min(Math.max(2,(this.inputs.path.isClosed?Math.ceil((i+r)*a):Math.ceil(Math.min(1,i+r)*a))-o+1),a+2),h=[],c=[];for(let i=0;i<l;i++){let r=this.inputs.path.isClosed?(i+o)%e.length:Math.min(i+o,e.length-1);h.push(e[r].clone()),c.push(t[r].clone())}let d=(e,t,i)=>{var r,a;let o,l;h[e]=h[e].clone().lerp(h[t],i),c[e]=(r=c[e],a=c[t],o=[new iD,new iD,new iD],l=[new iD,new iD,new iD],r.extractBasis(o[0],o[1],o[2]),a.extractBasis(l[0],l[1],l[2]),o.forEach((e,t)=>{let r=l[t],a=t8.lerp(e.length(),r.length(),i);e.lerp(r,i).setLength(a)}),new i6().makeBasis(o[0],o[1],o[2]))},p=0,f=r*a%1;(!this.inputs.path.isClosed||i<=1)&&(f||0===r)&&d(0,1,p=f);let m=0,g=(r+i)*a%1;if((this.inputs.path.isClosed&&i<=1||!this.inputs.path.isClosed&&r+i<1)&&g&&(m=g,d(h.length-1,h.length-2,1-m)),0===i){let e=h.length-1;h[e].copy(h[0]),c[e].copy(c[0])}this._applyPathModifiers(c,p,m);let{bevel:v,bevelSides:y}=this.inputs.parameters.extrusion,x=v>0?this.inputs.parameters.extrusion.capType:"flat",b=5;"Custom"===this.inputs.parameters.extrusion.shape.type&&(b="low"===this.inputs.parameters.extrusion.shape.shapeQuality?5:12);let{regions:w,infos:S,vertices:_}=this._computeShapePoints(b),A=0,M;"round"===x&&(A=(M=new wL(this.inputs.shapeData,2*v,v,b,y,void 0,!0)).getAttribute("position").count);let E=0,C=0;S.sort((e,t)=>
3154e.start-t.start),S.forEach(e=>{e.verticesStart=E,e.verticesCount=e.continuous.reduce((e,t,i)=>e+(0!==i&&t?1:2),0),C+=e.verticesCount,E=C});let T=C*l,P,D=0;if(this._isOpenEnded()&&"flat"===x){try{P=wE({windingRule:SW.ODD,elementType:Sq.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:w})}catch{P=wI}D=P.vertexCount}let O=T+2*D+2*A,I=T+2*D,R={positions:new Float32Array(3*O),normals:new Float32Array(3*O),uvs:new Float32Array(2*O)},L=[];if(S.forEach(e=>{this._extrudeRegion(e,_,c,h,R,L,this._isGeometryClosed()&&!this._isOpenEnded())}),P&&(this._closeEnd(P,T,L,R,c[0],h[0],!1),this._closeEnd(P,T+D,L,R,c[c.length-1],h[h.length-1],!0)),M){R.positions.set(M.getAttribute("position").array,3*I),R.normals.set(M.getAttribute("normal").array,3*I),R.uvs.set(M.getAttribute("uv").array,2*I);for(let e=I;e<I+A;e++)R.uvs[2*e+1]=1e-4;let e=L.length;L.push(...M.getIndex().array.map(e=>e+I)),I+=A,R.positions.set(M.getAttribute("position").array,3*I),R.normals.set(M.getAttribute("normal").array,3*I),R.uvs.set(M.getAttribute("uv").array,2*I);let t=L.length;L.push(...M.getIndex().array.map(e=>e+I)),this.setAttribute("position",new rN(R.positions,3)),this.setAttribute("normal",new rN(R.normals,3)),this.setAttribute("uv",new rN(R.uvs,2)),this.setIndex(L),SF.copy(c[c.length-1]).setPosition(h[h.length-1]),this.applyMatrix4OnRange(SF,I,O),SF.copy(c[0]).setPosition(h[0]).multiply(SN.makeScale(1,1,-1)),this.applyMatrix4OnRange(SF,I-A,I),this.reverseIndicesOnRange(e,t)}else this.setAttribute("position",new rN(R.positions,3)),this.setAttribute("normal",new rN(R.normals,3)),this.setAttribute("uv",new rN(R.uvs,2)),this.setIndex(L)}_extractPathPoints(){let e=bM(this.inputs.path),t=this.inputs.path.subdivisions,i="uniform"===this.inputs.path.subdivisionMode?e.getSpacedPoints(4*t):e.getPoints(t);if(i.length<2)return[];let r=[i[0]];return i.forEach(e=>{r[r.length-1].distanceToSquared(e)>.001&&r.push(e)}),this.inputs.path.isClosed&&.001>r[r.length-1].distanceTo(r[0])&&r.pop(),r}_computeBasisMatrices(e){let t=[],i=e.length,r=this.inputs.path.isClosed,a=new iD,o=new iD,l=new iD,h=new iD,c=new iD(0,1,0);for(let d=0;d<i;d++){let p,f=e[d],m;m=0===d?r?e[e.length-2]:f.clone().multiplyScalar(2).sub(e[1]):e[d-1],p=d===i-1?r?e[1]:f.clone().multiplyScalar(2).sub(e[d-1]):e[d+1];let g=f.clone().sub(m).normalize(),v=p.clone().sub(f).normalize(),y=g.clone().add(v).normalize();l.copy(y),0===d&&(y.equals(c)||y.clone().negate().equals(c))&&c.set(0,0,1);let x=c.clone().cross(y).normalize(),b=y.clone().cross(x).normalize();c.copy(b),h.copy(x),0===d&&(a.copy(b),o.copy(y));let w=new i6().makeBasis(x,b,y);t.push(w)}let d=r?o:l,p=r?a:new iD(0,1,0),f=d.clone().cross(h).normalize(),m=Math.acos(p.dot(f));if(isNaN(m))return t;let g=p.clone().cross(f);d.dot(g)>0&&(m*=-1);for(let e=1;e<t.length;e++){let i=new i6().makeRotationZ(m*e/t.length);t[e].multiply(i)}return t}_applyPathModifiers(e,t,i){let r=e.length,{angle:a,twist:o,startScale:l,endScale:h}=this.inputs.parameters.extrusion,c=new i6,d=new i6;return e.forEach((e,p)=>{let f=0===p?0:p===r-1?1:(p-t)/(r-(0===i?0:1)-(t+(1-i)));c.makeRotationZ(t8.lerp(a,a+o,f)*t8.DEG2RAD);let m=t8.lerp(l,h,f);d.makeScale(m,m,m),e.multiply(c).multiply(d)}),e}_computeShapePoints(e=12,t=SW.ODD){let i,r=this.inputs.shapeData,a=r.extractShapePointsToFlatArray([],e),o=r.shapeHoles.map(t=>{let i=t.extractShapePointsToFlatArray([],e),r=[];for(let e=i.length-1;e>=1;e-=2){let t=i[e-1],a=i[e-0];r.push(t,a)}return r}),l;try{l=wE({windingRule:t,elementType:Sq.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]})}catch{l=wD}try{i=wE({windingRule:SW.ODD,elementType:Sq.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...o]})}catch{i=wO}if(!l)throw Error("error generating geometry");let h=l.elementCount;if(i){l.elementCount+=i.elementCount;for(let e=0;e<i.elements.length;e++){let t=i.elements[e],r=e%2==0?l.vertexCount:0;l.elements.push(t+r)}for(let e=0;e<i.vertexIndices.length;e++){let t=i.vertexIndices[e],r=l.vertexCount;l.vertexIndices.push(t+r)}for(let e=0;e<i.vertices.length;e++){let t=i.vertices[e];l.vertices.push(t)}}let c=1/0,d=-1/0,p=1/0,f=-1/0;for(let e=0,t=l.vertexCount;e<t;e++){let t=2*e,i=l.vertices[t+0],r=l.vertices[t+1];i<c&&(c=i),i>d&&(d=i),r<p&&(p=r),r>f&&(f=r)}let m=[];for(let e=l.elementCount-1;e>=0;e--){let t=e>=h,i=2*e,a=l.elements[i+0],o=l.elements[i+1],c=a+o,d={start:a,count:o,normals:[],isHole:t,continuous:[],verticesStart:0,verticesCount:0};m.push(d);
3154let p=a,f=c-1,g=a+1,v=r.roundedCurves.length;do{let e=p-a,i=l.vertices[2*f+0],h=l.vertices[2*f+1],m=l.vertices[2*p+0],y=l.vertices[2*p+1],x=l.vertices[2*g+0],b=l.vertices[2*g+1],w=m-i,S=y-h,_=Math.sqrt(w*w+S*S);w/=_,S/=_;let A=m-x,M=y-b,E=Math.sqrt(A*A+M*M);A/=E,M/=E,d.normals[2*e+0]=-M,d.normals[2*e+1]=A;let C=l.vertexIndices[p];if(Array.isArray(C))d.continuous[e]=!1;else{let[t,i]=r.getCurveIndexFromVertexId(C-1,!0);if(i>0&&i<1)d.continuous[e]=!0;else{let a=1===i?t+1:t-1;a=(a+v)%v;let o=1===i?0:1,l=r.roundedCurves[t].getTangent(i),h=r.roundedCurves[a].getTangent(o);d.continuous[e]=l.dot(h)>.95}}t&&(d.normals[2*e+0]*=-1,d.normals[2*e+1]*=-1),[f,p,g]=[p,g,g+1],g>=c&&(g-=o)}while(g!==a+1)}return{regions:[a,...o],infos:m,vertices:l.vertices}}_insertVertex(e,t,i,r,a){let o=2*t,l=3*t;e.positions[l+0]=i.x,e.positions[l+1]=i.y,e.positions[l+2]=i.z,e.normals[l+0]=r.x,e.normals[l+1]=r.y,e.normals[l+2]=r.z,e.uvs[o+0]=a.x,e.uvs[o+1]=a.y}_extrudeRegion(e,t,i,r,a,o,l){let h=new iD,c=new iD,d=new iD,p=new iD,f=new t9;i.forEach((o,l)=>{let m=r[l],g=e.verticesStart*i.length+e.verticesCount*l;for(let r=0;r<e.count;r++){let v=(e.start+r)*2;if(h.set(t[v+0],t[v+1],0),d.copy(h).applyMatrix4(o).add(m),e.continuous[r])p.set(e.normals[2*r+0],e.normals[2*r+1],0);else{let i=0===r?(e.start+e.count-1)*2:v-2;c.set(t[i+0],t[i+1],0),p.copy(h).sub(c),p.set(-p.y,p.x,0),e.isHole||p.negate()}if(p.applyMatrix4(o).normalize(),f.set(0===r?1:r/e.count,l/(i.length-1)),this._insertVertex(a,g,d,p,f),g++,!e.continuous[r]||0===r){if(0===r)p.set(e.normals[2*r+0],e.normals[2*r+1],0),f.set(0,l/(i.length-1));else{let i=r===e.count-1?2*e.start:v+2;c.set(t[i+0],t[i+1],0),p.copy(c).sub(h),p.set(-p.y,p.x,0),e.isHole||p.negate()}p.applyMatrix4(o).normalize(),this._insertVertex(a,g,d,p,f),g++}}});let m=i.length-1;for(let t=0;t<m;t++){let r=e.verticesStart*i.length+e.verticesCount*t,a=e.verticesStart*i.length+e.verticesCount*(t+1),l=0;for(let t=0;t<e.count;t++){(!e.continuous[t]||0===t)&&l++;let i=t===e.count-1?0:l+1,h=r+l,c=r+i,d=a+i,p=a+l;e.isHole?o.push(h,d,c,h,p,d):o.push(h,c,d,h,d,p),l++}}}_closeEnd(e,t,i,r,a,o,l){let h=e.vertexCount,c=new iD(0,0,l?-1:1).applyMatrix4(a),d=new iD,p=new t9;for(let i=0;i<h;i++){let l=2*i;d.set(e.vertices[l+0],e.vertices[l+1],0).applyMatrix4(a).add(o),this._insertVertex(r,t+i,d,c,p)}let f=e.elements;for(let r=0;r<e.elementCount;r++){let e=3*r,a=f[e+0]+t,o=f[e+(l?1:2)]+t,h=f[e+(l?2:1)]+t;i.push(a,o,h)}}applyMatrix4OnRange(e,t,i){let r=e.elements,a=new t7().getNormalMatrix(e).elements,o,l,h,c,d=this.attributes.position,p=this.attributes.normal;if(!d||!p)return;let f=d.array,m=p.array,g=d.itemSize;for(let e=t*g,d=i*g;e<d;e+=g)o=f[e+0],l=f[e+1],h=f[e+2],c=1/(r[3]*o+r[7]*l+r[11]*h+r[15]),f[e+0]=(r[0]*o+r[4]*l+r[8]*h+r[12])*c,f[e+1]=(r[1]*o+r[5]*l+r[9]*h+r[13])*c,f[e+2]=(r[2]*o+r[6]*l+r[10]*h+r[14])*c,o=m[e+0],l=m[e+1],h=m[e+2],m[e+0]=a[0]*o+a[3]*l+a[6]*h,m[e+1]=a[1]*o+a[4]*l+a[7]*h,m[e+2]=a[2]*o+a[5]*l+a[8]*h;d.needsUpdate=!0,p.needsUpdate=!0}reverseIndicesOnRange(e,t){let i=this.index;if(i){for(let r=e;r<t;r+=3){let e=i.getX(r),t=i.getX(r+1),a=i.getX(r+2);i.setXYZ(r,a,t,e)}i.needsUpdate=!0}}};function SV(){let e=new rQ;return e.setAttribute("position",new rN(new Float32Array([]),3)),e.setIndex(new rN(new Uint16Array([]),1)),e}var Sj,SG,SH,SW,Sq,SX,SY=SV().attributes,SQ=class extends rQ{constructor(e,t){super(),this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,SY),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:r,height:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,text:c,textTransform:d}=e,p=xn.getDisplayedValue(c),f=function(e,t,i,r){let a="string"==typeof e.width?Number(r.getVariable(e.width)):e.width,o=[""],l="";for(let r of i)l+=r," "===r||r===` 3155`?(o[o.length-1]+=l,l="",r===` 3156`&&o.push("")):t.getTextWidth(o[o.length-1]+l,e)>a&&(o[o.length-1].length&&o.push(""),t.getTextWidth(o[o.length-1]+l,e)>a&&(1===l.length?(o[o.length-1]+=l,l=""):(o[o.length-1]+=l.slice(0,-1),l=l[l.length-1],o.push(""))));return o[o.length-1]+=l,o}(e,i,2===d?p.toUpperCase():3===d?p.toLowerCase():p,t),{shapes:m,charWidths:g,charCoords:v}=i.generateShapes(f,e,t),y=("number"==typeof r?r:Number(t.getVariable(r)))*.5,x=("number"==typeof a?a:Number(t.getVariable(a)))*.5,b=m.map(e=>new wl().fromShape(e,!0));this.vectorShapes=b;let w=b.map(e=>wF.create({shape:e,parameters:{depth:o,extrudeBevelSegments:h,extrudeBevelSize:l,windingRule:o<=0?SW.NONZERO:SW.ODD,subdivisions:this.isLowResolution&&o>0?1:12}})),S=w.length?v3(w):SV();S.translate(-y,x,0),this.dispose(),this.wrappedText=f,this.charCoords=v,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(S.attributes).forEac
3156h(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(S.index),this.computeBoundingSphere()}clone(){let e=vh(new rQ,SQ.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}},SZ=new Promise(e=>{SX=e}),SK=!1,SJ=["font"];function S$(e,t,i,r){let a,o,l,h;for(let i of("PathGeometry"===e.type?(o=JSON.parse(JSON.stringify(e)),l=[[],["extrusion"]]):(o={...e},l=[[]]),l)){let e=o;for(let t of i)e=e[t];for(a in e){let o=e[a];gM(o)&&!SJ.includes(a)&&(e[a]=t.getVariable(o,[r.uuid,"geometry",...i,a]),gM(e[a])&&(e[a]=1))}}let c={parameters:o,type:o.type};if("PathGeometry"===o.type)c.path=o.path;else if("VectorGeometry"===o.type){let e=wl.createFromState(o.shape,o.width,o.height);c.shape=e}else if("NonParametricGeometry"===o.type){if(o.data.groups&&o.data.groups?.forEach(e=>e.materialIndex=Math.max(e.materialIndex??0,0)),c.geometry=new lT().parse(o),0===c.geometry.groups.length){let e=c.geometry;e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}}else if("SubdivGeometry"===o.type){let t=new S7(o,i);return t.data=e,t}else{if("TextGeometry"===o.type||"InputGeometry"===o.type)return new SQ(o,t);if("UIGeometry"===o.type)return Sp.create({parameters:{width:o.width,height:o.height,cornerRadius:o.cornerRadius,cornerType:o.cornerType}})}try{h=_v(c)}catch(t){console.error(t),console.error(`Error generating geometry with inputs: ${c}`);let e=wl.createFromState(vy.defaultData(),100,100);c.shape=e,c.type="VectorGeometry",h=_v(c)}return h}var S0=new i6;function S1(e,t,i,r){let a=e.position.array,o=e.normal.array,l=S0.makeScale(t,i,r).invert().elements,h,c,d;for(var p=0,f=a.length;p<f;p+=3)a[p]*=t,a[p+1]*=i,a[p+2]*=r,h=o[p],c=o[p+1],d=o[p+2],o[p]=l[0]*h+l[4]*c+l[8]*d,o[p+1]=l[1]*h+l[5]*c+l[9]*d,o[p+2]=l[2]*h+l[6]*c+l[10]*d;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var S2,S3,S4=new iR,S5=new iD;SZ.then(e=>{S3=e});var S6=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),S8=new Uint32Array([0,1,2,3]),S9=new Uint8Array([4]),S7=class extends rQ{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(e=>"number"==typeof e?e:1),r=gg.div(t.map(e=>"number"==typeof e?e:0),i);if(r.every(e=>1===e))return;this.subdividedGeometry&&S1(this.subdividedGeometry.attributes,...r),this.originalGeometry&&S1(this.originalGeometry.attributes,...r),this.data=e;let a=this.userData.parameters;this.userData.parameters={width:a.width*r[0],height:a.height*r[1],depth:a.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(S5.fromArray(r));let o=S5.set(a.width,a.height,a.depth).length();this.originalGeometry.boundingSphere.radius=o/2}ensureSubdivPointer(){return 0===this.subdivPointer&&this.rebuild(),this.subdivPointer}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=S7.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new st(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0,Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(S7.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new iK,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;S4.setFromBufferAttribute(t),S4.getCenter(i),e.boundingSphere.radius=i.distanceTo(S4.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),S4.getSize(S5);let r={width:S5.x,height:S5.y,depth:S5.z};return this.userData.parameters=r,r}static build(e,t,i,r){let a,o,l,h=e?.phongAngle??35;!1===i&&(h=-1),t&&(S3.free_bvh(t),S3.free_subdivision_surface(t));try{a=S7.allocate(e,r)}catch(t){console.error(t,e),a=S7.allocate({positionWASM:S6,indexWASM:S8,verticesPerFaceWASM:S9},r)}if(S3.set_destination_refinement_level(a,0),o=S7.buildLevel(a,!0,h),e.subdivisions>0)try{S3.set_destination_refinement_level(a,e.subdivisions),l=S7.buildLevel(a,!1,h)}catch{try{S3.set_destination_refinement_level(a,e.subdivisions-1),l=S7.buildLevel(a,!1,h)}catch{l=null}}else l=null;return{subdivPointer:a,originalGeometry:o,subdividedGeometry:l}}static primitiveToQuads(e,t,i){let r,a,o,l,h;e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),"DodecahedronGeometry"===e.type&&(e.detail=0);let c=void 0!==e.shape||void 0!==e.path?t.geometry:S$(e,i,!1,t),d;if(d="TorusGeometry"===e.type&&e.arc===2*Math.PI?c.getClosedTorusIndicesForBooleanOrSubdiv():c.getIndex(),{positions:r,triIndices:l}=_t(c.getAttribute("position"),d),"CylinderGeometry"===e.type&&0===e.cornerRadius&&0===e.hollow&&!1===e.openEnded){let t=e.radialSegments*e.heightSegments*6,i=t
3156+3*e.radialSegments;h=[t,i]}return{indices:a,verticesPerFace:o}=_n(r,l,c,h),{positions:r,indices:a,verticesPerFace:o}}static allocate(e,t){let i,r,a,o,l=[],h=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,a=e.indexWASM,o=e.verticesPerFaceWASM):(r=S6,a=S8,o=S9);let c=r.length,d=a.length,p=o.length,f=r.length+l.length+h.length,m=a.length+o.length,g=f*Float32Array.BYTES_PER_ELEMENT+m*Uint32Array.BYTES_PER_ELEMENT,v=f*Float32Array.BYTES_PER_ELEMENT,y=S3._malloc(g),x=new Float32Array(S3.HEAPF32.buffer,y,f),b=new Uint32Array(S3.HEAPU32.buffer,y+v,m);x.set(r,0),x.set(l,r.length),x.set(h,r.length+l.length),b.set(a,0),b.set(o,a.length),e?.scaleBaked?.some(e=>1!==e)&&(i=new i6().makeScale(...e.scaleBaked.map(e=>"number"==typeof e?e:1))),t&&(i?i.premultiply(t):i=t);let w=i?S3.alloc_subdivision_surface2(y,c,y+v,d,y+v+a.length*Uint32Array.BYTES_PER_ELEMENT,p,i.elements):S3.alloc_subdivision_surface(y,c,y+v,d,y+v+a.length*Uint32Array.BYTES_PER_ELEMENT,p);return S3._free(y),w}static buildLevel(e,t,i,r,a){let o=a?S3.get_mesh_data2(e,t?S3.Level.CONTROL:S3.Level.REFINED,i,a.elements):S3.get_mesh_data(e,t?S3.Level.CONTROL:S3.Level.REFINED,i),l=S3.HEAPU32.subarray(o>>2,(o>>2)+8),h=l.subarray(4,8),c=0,d=S3.HEAPU32[l[c]>>2],p=S3.HEAPF32.subarray(d>>2,(d>>2)+h[c]);c++;let f=S3.HEAPU32[l[c]>>2],m=S3.HEAPF32.subarray(f>>2,(f>>2)+h[c]);c++;let g=S3.HEAPU32[l[c]>>2],v=S3.HEAPU32.subarray(g>>2,(g>>2)+h[c]);c++;let y=S3.HEAPU32[l[c]>>2],x=S3.HEAPU32.subarray(y>>2,(y>>2)+h[c]);if(c++,void 0===r){let e=new rQ;if(e.setIndex(new rk(x,1)),e.setAttribute("position",new rV(p,3)),e.setAttribute("normal",new rV(m,3)),t){e.setAttribute("faceMap",new rk(v,1));let t=new Float32Array(m.length/3*4).fill(0);e.setAttribute("color",new rN(t,4))}return S3.free_mesh_data(o),e.userData.type="SubdivGeometry",e}r.getAttribute("position").copyArray(p),r.getAttribute("normal").copyArray(m),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,S3.free_mesh_data(o)}static freeSubdivPointer(e){S3.free_bvh(e),S3.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=S3.get_wireframe_data_for_base_level(e),a=S3.HEAPU32.subarray(r>>2,(r>>2)+4),o=a.subarray(2,4),l=0,h=S3.HEAPU32[a[l]>>2],c=S3.HEAPF32.subarray(h>>2,(h>>2)+o[l]);l++;let d=S3.HEAPU32[a[l]>>2],p=S3.HEAPU32.subarray(d>>2,(d>>2)+o[l]);if(void 0===t){let e=new rQ;e.setAttribute("position",new rV(c,3));let t=new Float32Array(c.length);for(let e=0,r=c.length;e<r;)t[e++]=i.r,t[e++]=i.g,t[e++]=i.b;return e.setAttribute("color",new rN(t,3)),e.setIndex(new rk(p,1)),S3.free_wireframe_data_for_base_level(r),e}t.getAttribute("position").copyArray(c),t.attributes.position.needsUpdate=!0,S3.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=0===t;r||S3.set_destination_refinement_level(e,t);let a=i?S3.get_topological_data2(e,r?S3.Level.CONTROL:S3.Level.REFINED,i.elements):S3.get_topological_data(e,r?S3.Level.CONTROL:S3.Level.REFINED),o=S3.HEAPU32.subarray(a>>2,(a>>2)+6),l=o.subarray(3,6),h=0,c=S3.HEAPU32[o[h]>>2],d=new Float32Array(S3.HEAPF32.subarray(c>>2,(c>>2)+l[h]));h++;let p=S3.HEAPU32[o[h]>>2],f=new Uint32Array(S3.HEAPU32.subarray(p>>2,(p>>2)+l[h]));h++;let m=S3.HEAPU32[o[h]>>2],g=new Uint8Array(S3.HEAPU32.subarray(m>>2,(m>>2)+l[h]));return S3.free_topological_data(a),{positions:d,indices:f,verticesPerFace:g}}},_e=["getX","getY","getZ"];function _t(e,t){let i={},r=t?t.count:e.count,a=0,o=[],l=[];for(let h=0;h<r;h++){let r=t?t.getX(h):h,c="";for(let t=0;t<3;t++)c+=`${~~(1e4*e[_e[t]](r))},`;if(c in i)o.push(i[c]);else{for(let t=0;t<3;t++)l.push(e[_e[t]](r));i[c]=a,o.push(a),a++}}let h=[];for(let e=0;e<o.length;e+=3)o[e]===o[e+1]||o[e]===o[e+2]||o[e+1]===o[e+2]||h.push(o[e],o[e+1],o[e+2]);return{positions:l,triIndices:h}}var _i=new iD,_r=new iD,_s=new iD,_a=new iD;function _n(e,t,i,r){let a=[],o=[];if(void 0!==i.userData.shape&&0===i.userData.parameters.depth&&0===i.userData.shape.shapeHoles.length){let t=i.userData.shape.extractShapePointsToFlatArray([]),r=i.userData.parameters.spikes;if("EllipseGeometry"===i.userData.type&&r<=24&&r%4==0&&i.userData.parameters.angle>=360){let e=t.length/2/r;t=t.filter((t,i)=>Math.floor(i/2)%e==0)}let l=0;for(let e=0;e<t.length;e+=2)l+=(t[e]-t[(0===e?t.length:e)-2])*(t[e+1]+t[(0===e?t.length:e)-1]);e.length=0;let h=0;if(l<0)for(let i=0;i<t.length;i+=2)e.push(t[i],t[i+1],0),a.push(h++);else for(let i=t.length-2;i>=0;i-=2)e.push(t[i],t[i+1],0),a.push(h++);return o.push(h),{indices:a,verticesPerFace:o}}let l=new Float32Array([i.userData.parameters.depth])[0],h=0;for(;h<t.length;){if(i.useNgonForTopBottomFaceDuringBake){let i=0;if((e[3*t[h]+2]===l||0===e[3*t[h]+2])&&i++,(e[3*t[h+1]+2]===l||0===e[3*t[h+1]+2])&&i++,(e[3*t[h+2]+2]===l||0===e[3*t[h+2]+2])&&i++,3===i)break}if(t[h+1]===t[h+3]&&t[h+2]===t[h+5]||t[h+0]===t[h+3]&&t[h+2]===t[h+4]){_i.set(e[3*t[h]],e[3*t[h]+1],e[3*t[h]+2]),_r.set(e[3*t[h+1]],e[3*t[h+1]+1],e[3*t[h+1]+2]),_s.set(e[3*t[h+4]],e[3*t[h+4]+1],e[3*t[h+4]+2]),_a.set(e[3*t[h+5]],e[3*t[h+5]+1],e[3*t[h+5]+2]),_r.sub(_i).normalize(),_s.sub(_i).normalize(),_a.sub(_i).normalize();let i=_r.cross(_s).dot(_a),l=h;Math.abs(i)>.005||r&&r.some((e,t)=>t%2!=1&&l>
3156=r[t]&&l<r[t+1])?(a.push(t[h],t[h+1],t[h+2]),o.push(3),h+=3):(a.push(t[h],t[h+1],t[h+4],t[h+5]),o.push(4),h+=6)}else a.push(t[h],t[h+1],t[h+2]),o.push(3),h+=3}if(i.useNgonForTopBottomFaceDuringBake){let t=[],r=[],h=0;for(let i=0,a=0;i<e.length;i+=3,a++)0===e[i+2]&&(t.push(a),h++),e[i+2]===l&&r.push(a);if(0===i.userData.parameters.extrudeBevelSize){let e=r[0];r[0]=r[1],r[1]=e}t.reverse(),a.push(...t,...r),o.push(h,h)}return{indices:a,verticesPerFace:o}}var _o={};function _l(e){let t=e.length,i=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,a=Number.isInteger(e[0])?i:r,o=AF._malloc(a);return(Number.isInteger(e[0])?new Uint32Array(AF.HEAPU32.buffer,o,t):new Float32Array(AF.HEAPF32.buffer,o,t)).set(e,0),o}function _h(e){switch(e){case 0:return AF.OP.UNION;case 1:return AF.OP.INTERSECTION;case 2:return AF.OP.A_MINUS_B;default:throw Error("Unknown boolean operation "+e)}}function _c(e,t){void 0===AN&&(AN=AF.init_csg());let i=_l(e),r=AF.csg_calc_topological(AN,i,e.length,_h(t));AF._free(i);let a=AF.HEAPU32.subarray(r>>2,(r>>2)+6),o=a.subarray(3,6),l=0,h=AF.HEAPU32[a[l]>>2],c=new Float32Array(AF.HEAPF32.subarray(h>>2,(h>>2)+o[l]));l++;let d=AF.HEAPU32[a[l]>>2],p=new Uint32Array(AF.HEAPU32.subarray(d>>2,(d>>2)+o[l]));l++;let f=AF.HEAPU32[a[l]>>2],m=new Uint8Array(AF.HEAPU32.subarray(f>>2,(f>>2)+o[l]));return AF.free_mesh_data(r),{positions:c,indices:p,verticesPerFace:m}}function _d(e,t,i,r){void 0===AN&&(AN=AF.init_csg());let a=_l(e),o=AF.csg_calc(AN,a,e.length,r,_h(t));AF._free(a);let l=AF.HEAPU32.subarray(o>>2,(o>>2)+5),h=l.subarray(2,5),c=0,d=AF.HEAPU32[l[c]>>2],p=AF.HEAPF32.subarray(d>>2,(d>>2)+h[c]);c++;let f=AF.HEAPU32[l[c]>>2],m=AF.HEAPF32.subarray(f>>2,(f>>2)+h[c]),g=h[++c];i.setAttribute("position",new rV(p,3)),i.setAttribute("normal",new rV(m,3));let v=AF.HEAPF32.subarray((o>>2)+5,(o>>2)+5+6);return null===i.boundingSphere&&(i.boundingSphere=new iK),i.boundingSphere.center.set(v[0],v[1],v[2]),i.boundingSphere.radius=(v[3]**2+v[4]**2+v[5]**2)**.5,i.userData.parameters={width:2*v[3],height:2*v[4],depth:2*v[5]},AF.free_mesh_data(o),g}function _u(e,t,i){let r,a,o;if(void 0===AF)return -1;if(t&&void 0!==e.userData.positions){let t=e.userData;o=t.verticesPerFace.length,r=t.positions,a=Array(t.verticesPerFace.reduce((e,t)=>e+t,0)+o);for(let e=0,i=0,r=0;e<t.verticesPerFace.length;e++){a[r++]=t.verticesPerFace[e];for(let o=0;o<t.verticesPerFace[e];o++)a[r++]=t.indices[i++]}}else({positions:r,faceIndices:a,nFaces:o}=function(e,t,i){let r,a;a="TorusGeometry"===e.userData.parameters.type&&e.userData.parameters.arc===2*Math.PI?e.getClosedTorusIndicesForBooleanOrSubdiv():e.getIndex();let{positions:o,triIndices:l}=_t(e.getAttribute("position"),a),h;if(t&&i){let{indices:t,verticesPerFace:i}=_n(o,l,e);h=i.length,r=[];for(let e=0,a=0;e<h;e++){r.push(i[e]);for(let o=0;o<i[e];o++)r.push(t[a++])}}else{let e=l.length;r=Array(e+e/3),h=0;for(let e=0,t=0;t<r.length;)r[t++]=3,h++,r[t++]=l[e++],r[t++]=l[e++],r[t++]=l[e++]}return{positions:o,faceIndices:r,nFaces:h}}(e,t,i));let l=r.length,h=a.length,c=r.length,d=a.length,p=c*Float32Array.BYTES_PER_ELEMENT+d*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,m=(Uint32Array.BYTES_PER_ELEMENT,AF._malloc(p)),g=new Float32Array(AF.HEAPF32.buffer,m,c),v=new Uint32Array(AF.HEAPU32.buffer,m+f,d);g.set(r,0),v.set(a,0);let y=AF.get_csg_mesh(m,l,m+f,h,o);return AF._free(m),y}function _p(e){return AF.has_open_edges(e)}function _f(e,t){AF.transform_csg_mesh(e,t.elements)}function _m(e){AF.free_csg_mesh(e)}((e,t)=>{for(var i in t)tE(e,i,{get:t[i],enumerable:!0})})(_o,{calcBoolean:()=>_d,calcBooleanTopological:()=>_c,freeMeshSet:()=>_m,getMeshSet:()=>_u,hasOpenEdges:()=>_p,transformMeshSet:()=>_f}),new Promise(e=>{AB=e}).then(e=>AF=e);var _g={ConeGeometry:bU,CubeGeometry:bk,CylinderGeometry:bB,DodecahedronGeometry:bH,EllipseGeometry:wU,HelixGeometry:wq,IcosahedronGeometry:wQ,LatheGeometry:wK,NonParametricGeometry:So,PolygonGeometry:Sl,PyramidGeometry:Sh,RectangleGeometry:Sp,SphereGeometry:Sf,PlaneGeometry:Sm,BackdropGeometry:Sg,StarGeometry:Sy,TextFrameGeometry:Sx,TorusGeometry:Sb,TorusKnotGeometry:Sw,TriangleGeometry:SS,PathGeometry:SU,VectorGeometry:wF},_v=e=>_g[e.type].create(e);function _y(e){return null!==e&&"booleanOp"in e}var _x=class extends bL(r7){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new i6}updateVisible(e){super.updateVisible(e),this.visible=!_y(this.parent)&&this.visible,_y(this.parent)&&this.parent.invali
vendor: 4,246 bytes, line 3156
3156dateDownstreamBooleanData()}freeBooleanPointer(){-1!==this.booleanMeshSetAddress&&(_o.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),_y(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){for(let e of(this.freeBooleanPointer(),this.children))e instanceof _x&&(e.freeBooleanPointer(),_y(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&_y(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),_y(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},_b=new iR;function _w(e,t=0,i=e.count,r,a){let o=1/0,l=1/0,h=1/0,c=-1/0,d=-1/0,p=-1/0;for(let r=t;r<i;r++){let t=e.getX(r),i=e.getY(r),a=e.getZ(r);t<o&&(o=t),i<l&&(l=i),a<h&&(h=a),t>c&&(c=t),i>d&&(d=i),a>p&&(p=a)}_b.min.set(o,l,h),_b.max.set(c,d,p),_b.getCenter(r),_b.getSize(a).multiplyScalar(.5)}var _S=new rQ,__=new rB,_A=class extends _x{constructor(e,t){super(_S,__),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?_w(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},_M=class{constructor(e){if(this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},null===_M.uuidContext)throw Error("plz startContext");_M.uuidContext===_M.globalContext?this.uuid="_gid"+_M.uuidContext.nodeContextUuid++:this.uuid="_uid"+_M.uuidContext.nodeContextUuid++,this.type=e,this.name=""}static startContext(e){null===this.uuidContext||this.uuidContext===_M.globalContext?this.uuidContext=e:console.error("Can't start context twice")}static endContext(e){this.uuidContext!==e&&console.error("Can't end context twice"),this.uuidContext=null}analyze(e,t){t=t??{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,i){return i=i??{},this.analyze(e,i),this.flow(e,t,i)}flow(e,t,i){i=i??{},e.addFlow(i.slot,i.cache,i.context);let r={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),r}build(e,t,i){t=t??this.getType(e,t);let r=e.getNodeData(i??this);return e.analyzing&&this.appendDepsNode(e,r,t),-1===e.nodes.indexOf(this)&&e.nodes.push(this),void 0!==this.updateFrame&&-1===e.updaters.indexOf(this)&&e.updaters.push(this),this.generate(e,t,i)}updateFrame(e){}generateReadonly(e,t,i,r,a,o){return""}generate(e,t,i,r,a){return""}parse(e,t,i,r){}appendDepsNode(e,t,i){t.deps=(t.deps||0)+1;let r=e.getTypeLength(i);(r>(t.outputMax||0)||this.getType(e,i))&&(t.outputMax=r,t.output=i)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return"sampler2D"===t||"samplerCube"===t?t:this.type}},_E=_M;_E.globalContext={nodeContextUuid:0},_E.uuidContext=_M.globalContext;var _C=class{constructor(e){e=e??{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}},_T=new class{constructor(){this.nodes={},this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,i){i=void 0===i||i,this.keywords[e]={callback:t,cache:i}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return void 0!==this.nodes[e]}containsKeyword(e){return void 0!==this.keywords[e]}},_P=class extends _E{constructor(e,t){super(e),this.scope="",t=t??{},this.shared=void 0===t.shared||t.shared,this.unique=void 0!==t.unique&&t.unique}build(e,t,i,r){if(t=t??this.getType(e),this.getShared(e,t)){let a=this.getUnique(e,t);a&&void 0===this.uuid&&(this.uuid=t8.generateUUID()),i=e.getUUID(i??this.getUUID(),!a);let o=e.getNodeData(i),l=o.output||this.getType(e);if(e.analyzing)return(o.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,o,t),this.generate(e,t,i)):super.build(e,t,i);if(a)return o.name=o.name||super.build(e,t,i),o.name;
vendor: 5,541 bytes, line 3156
3156if(!this.getLabel()&&(!this.getShared(e,l)||e.context.ignoreCache||1===o.deps))return super.build(e,t,i);i=this.getUUID(!1);let h=this.getTemp(e,i);if(h)return e.format(h,l,t);{h=super.generate(e,t,i,o.output,r);let a=this.generate(e,l,i);return e.addNodeCode(h+" = "+a+";"),e.format(h,l,t)}}return super.build(e,t,i)}getShared(e,t){return"sampler2D"!==t&&"samplerCube"!==t&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return"string"==typeof this.scope&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let i=e.getVars()[t];return i?i.name:void 0}generate(e,t,i,r,a){return this.getShared(e,t)||console.error("TempNode is not shared"),i=i??this.uuid,e.getTempVar(i,r??this.getType(e),a,this.getLabel()).name}},_D=class extends _P{constructor(e,t){(t=t??{}).shared=void 0!==t.shared&&t.shared,super(e,t),this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(e,t,i,r,a,o){i=e.getUUID(i??this.getUUID()),r=r??this.getType(e);let l=e.getNodeData(i);return this.getReadonly()&&void 0!==this.generateReadonly?this.generateReadonly(e,t,i,r,a,o):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(r,this,a,o,this.getLabel())),e.format(l.vertex.name,r,t)):(l.fragment||(l.fragment=e.createFragmentUniform(r,this,a,o,this.getLabel())),e.format(l.fragment.name,r,t))}},_O=class extends _D{constructor(e=0,t){super("v2"),this.nodeType="Vector2",this.value=e instanceof t9?e:new t9(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,i,r,a,o){return e.format("vec2("+this.value.x+", "+this.value.y+")",r,t)}},_I=class extends _D{constructor(e=0,t,i){super("v3"),this.nodeType="Vector3",this.value=e instanceof iD?e:new iD(e,t,i)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,i,r,a,o){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",r,t)}},_R=class extends iv{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if("transparent"===e)return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a="rgba"===a?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a="hsla"===a?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}},_L=class extends _D{constructor(e){super("v4"),this.nodeType="Vector4",this.value=e instanceof _R?e:new _R(e.r,e.g,e.b,e.a)}generateReadonly(e,t,i,r,a,o){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",r,t)}},_B=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,_z=/[a-z_0-9]+/gi,_F=class extends _P{constructor(e,t,i,r,a){super(a),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=void 0===a,this.isInterface=!1,this.parse(e,t,i,r)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,i,r,a){let o,l=0,h=this.src;if(this.includes)for(let t=0;t<this.includes.length;t++)e.include(this.includes[t],this);for(let t in this.extensions)e.extensions[t]=!0;let c=[];for(;o=_z.exec(this.src);)c.push(o);for(let t=0;t<c.length;t++){let i=c[t],r=i[0],a=!this.isMethod||!this.getInputByName(r),o=r;if(this.keywords[r]||this.useKeywords&&a&&_T.containsKeyword(r)){let t=this.keywords[r];if(!t){let i=_T.getKeywordData(r);i.cache&&(t=e.keywords[r]),t=t||_T.getKeyword(r,e),i.cache&&(e.keywords[r]=t)}o=t.build(e)}r!==o&&"."!==h[i.index+l-1]&&(h=h.substring(0,i.index+l)+o+h.substring(i.index+r.length+l),l+=o.length-r.length),void 0===this.getIncludeByName(o)&&_T.contains(o)&&e.include(_T.get(o))}return"source"===t?h:this.isMethod?(this.isInterface||e.include(this,void 0,h),this.name):e.format("( "+h+" )",this.getType(e),t)}parse(e,t,i,r){if(this.src=e||"",this.includes=t??[],this.extensions=i??{},this.keywords=r??{},this.isMethod){let e=_B.exec(this.src);if(this.inputs=[],e&&4==e.length){this.type=e[1],this.name=e[2];let t=e[3].match(_z);if(t){let e=0;for(;e<t.length;){let i=t[e++],r;"in"===i||"out"===i||"inout"===i?r=t[e++]:(r=i,i="");let a=t[e++];this.inputs.push({name:a,type:r,qualifier:i})}}this.isInterface=-1===this.src.indexOf("{")}else this.type="",this.name=""}}},_N=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,_U=class extends _P{constructor(e="",t){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(e||_U.PI,void 0,void 0,void 0,t)}
vendor: 12,915 bytes, lines 3156-3235
3156getType(e){return e.getTypeByFormat(this.type)}parse(e,t,i,r,a){this.src=e||"";let o,l,h="",c=_N.exec(e);this.useDefine=a??"#"===this.src.charAt(0),c&&c.length>1?(l=c[1],o=c[2],h=c[3]):(o=this.src,l="f"),this.name=o,this.type=l,this.value=h}build(e,t){if("source"===t){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,i,r,a){return e.format(this.name,this.getType(e),t)}};_U.PI="PI",_U.PI2="PI2",_U.RECIPROCAL_PI="RECIPROCAL_PI",_U.RECIPROCAL_PI2="RECIPROCAL_PI2",_U.LOG2="LOG2",_U.EPSILON="EPSILON";var _k=RegExp(`^structs*([a-z_0-9]+)s*{s*((.| 3157)*?)}`,"gim"),_V=RegExp("s*(w*?)s*(w*?)(=|;)","gim"),_j=class extends _P{constructor(e=""){super(),this.inputs=[],this.src="",this.nodeType="Struct",this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,i,r,a){return"source"===t?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=_k.exec(e);if(t){let e=t[2],i;for(;i=_V.exec(e);)this.inputs.push({type:i[1],name:i[2]});this.name=t[1]}else this.name="";this.type=this.name}},_G=class extends _P{constructor(e){super("v2",{shared:!1}),this.nodeType="UV",this.index=e??0}generate(e,t){e.requires.uv[this.index]=!0;let i=this.index>0?this.index+1:"",r=e.isShader("vertex")?"uv"+i:"vUv"+i;return e.format(r,this.getType(e),t)}};_T.addKeyword("uv",function(){return new _G}),_T.addKeyword("uv2",function(){return new _G(1)});var _H=class extends _P{constructor(e,t){super("v4"),this.nodeType="ColorSpace",this.input=e,this.method=t??_H.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case 3e3:return["Linear"];case 3001:return["sRGB"];default:return[]}}generate(e,t){let i=this.input.build(e,"v4"),r=this.getType(e),a=_H.Nodes[this.method],o=e.include(a);if(o===_H.LINEAR_TO_LINEAR)return e.format(i,r,t);if(a.inputs?.length!==2)return e.format(o+"( "+i+" )",r,t);{let a=this.factor.build(e,"f");return e.format(o+"( "+i+", "+a+" )",r,t)}}fromEncoding(e){let t=_H.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=_H.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}};_H.Nodes={LinearToLinear:new _F(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(` 3158`)),sRGBToLinear:new _F(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(` 3159`)),LinearTosRGB:new _F(["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.w );","}"].join(` 3160`))},_H.LINEAR_TO_LINEAR="LinearToLinear",_H.SRGB_TO_LINEAR="sRGBToLinear",_H.LINEAR_TO_SRGB="LinearTosRGB";var _W=class extends _F{constructor(e="",t,i,r,a){super(e,a,r,i,t),this.nodeType="Expression"}},_q=class extends _D{constructor(e=new i_,t,i,r){super("v4",{shared:!0}),this.nodeType="Texture",this.value=e,this.uv=t??new _G,this.bias=i,this.project=void 0!==r&&r}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){let i,r;if("sampler2D"===t)return this.getTexture(e,t);let a=this.getTexture(e,t),o=this.uv.build(e,this.project?"v4":"v2"),l=this.bias?this.bias.build(e,"f"):void 0;void 0===l&&e.context.bias&&(l=e.context.bias.setTexture(this).build(e,"f")),i=this.project?"texture2DProj":l?"tex2DBias":"tex2D",r=l?i+"( "+a+", "+o+", "+l+" )":i+"( "+a+", "+o+" )";let h={include:e.isShader("vertex"),ignoreCache:!0},c=this.getType(e);return e.addContext(h),this.colorSpace=this.colorSpace??new _H(new _W("",c)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(r),r=this.colorSpace.build(e,c),e.removeContext(),e.format(r,c,t)}},_X=class extends _D{constructor(e){super("f"),this.nodeType="Float",this.value=e??0}generateReadonly(e,t,i,r,a,o){return e.format(this.value+(this.value%1?"":".0"),r,t)}},_Y=class extends _P{constructor(e,t){super(),this.inputs=[],this.nodeType="FunctionCall",this.value=e,this.inputs=t??[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,i,r,a){r=this.getType(e);let o=this.value,l=o.build(e,t)+"( ",h=[];if(o.inputs){for(let t=0;t<o.inputs.length;t++){let i=o.inputs[t],r=this.inputs[t]||this.inputs[i.name];h.push(r.build(e,e.getTypeByFormat(i.type)))}l+=h.join(", ")+" )"}return e.format(l,r,t)}},_Q=class extends _P{constructor(e,t,i=_Q.ADD){super(),this.nodeType="Operator",this.type=e.type,this.a=e,this.b=t,this.op=i}getType(e){let t=this.a.getType(e),i=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(i)>e.getTypeLength(t)?i:t}generate(e,t){let i=this.getType(e);this.type=i;let r=this.a.build(e,i),a=this.b.build(e,i);return e.format("( "+r+" "+this.op+" "+a+" )",i,t)}};_Q.ADD="+",_Q.SUB="-",_Q.MUL="*",_Q.DIV="/";var _Z=class extends _P{constructor(e,t=_Z.ABS,i,r){super(),this.nodeType="Math",this.a=e,"string"!=typeof t?this.b=t:r=t,"string"!=typeof i?this.c=i:r=i,this.method=r,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case _Z.MIX:case _Z.CLAMP:case _Z.REFRACT:case _Z.SMOOTHSTEP:case _Z.FACEFORWARD:return 3;case _Z.MIN:case _Z.MAX:case _Z.MOD:case _Z.STEP:case _Z.REFLECT:case _Z.DISTANCE:case _Z.DOT:case _Z.CROSS:case _Z.POW:return 2;default:return 1}}getInputType(e){let t=e.getTypeLength(this.a.getType(e)),i=this.b?e.getTypeLength(this.b.getType(e)):0,r=this.c?e.getTypeLength(this.c.getType(e)):0;return t>i&&t>r?this.a.getType(e):i>r?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case _Z.LENGTH:case _Z.DISTANCE:case _Z.DOT:return"f";case _Z.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let i,r,a,o=this.a?e.getTypeLength(this.a.getType(e)):0,l=this.b?e.getTypeLength(this.b.getType(e)):0,h=this.c?e.getTypeLength(this.c.getType(e)):0,c=this.getInputType(e),d=this.getType(e);switch(this.type=d,this.method){case _Z.NEGATE:return e.format("( -"+this.a.build(e,c)+" )",c,t);case _Z.INVERT:return e.format("( 1.0 - "+this.a.build(e,c)+" )",c,t);case _Z.CROSS:i=this.a.build(e,"v3"),r=this.b.build(e,"v3");break;case _Z.STEP:i=this.a.build(e,1===o?"f":c),r=this.b.build(e,c);break;case _Z.MIN:case _Z.MAX:case _Z.MOD:i=this.a.build(e,c),r=this.b.build(e,1===l?"f":c);break;case _Z.REFRACT:i=this.a.build(e,c),r=this.b.build(e,c),a=this.c.build(e,"f");break;case _Z.MIX:i=this.a.build(e,c),r=this.b.build(e,c),a=this.c.build(e,1===h?"f":c);break;default:i=this.a.build(e,c),this.b&&(r=this.b.build(e,c)),this.c&&(a=this.c.build(e,c))}let p=[];p.push(i),r&&p.push(r),a&&p.push(a);let f=this.getNumInputs(e);if(p.length!==f)throw Error(`Arguments not match used in "${this.method}". Require ${f}, currently ${p.length}.`);return e.format(this.method+"( "+p.join(", ")+" )",d,t)}};_Z.RAD="radians",_Z.DEG="degrees",_Z.EXP="exp",_Z.EXP2="exp2",_Z.LOG="log",_Z.LOG2="log2",_Z.SQRT="sqrt",_Z.INV_SQRT="inversesqrt",_Z.FLOOR="floor",_Z.CEIL="ceil",_Z.NORMALIZE="normalize",_Z.FRACT="fract",_Z.SATURATE="saturate",_Z.SIN="sin",_Z.COS="cos",_Z.TAN="tan",_Z.ASIN="asin",_Z.ACOS="acos",_Z.ARCTAN="atan",_Z.ABS="abs",_Z.SIGN="sign",_Z.LENGTH="length",_Z.NEGATE="negate",_Z.INVERT="invert",_Z.MIN="min",_Z.MAX="max",_Z.MOD="mod",_Z.STEP="step",_Z.REFLECT="reflect",_Z.DISTANCE="distance",_Z.DOT="dot",_Z.CROSS="cross",_Z.POW="pow",_Z.MIX="mix",_Z.CLAMP="clamp",_Z.REFRACT="refract",_Z.SMOOTHSTEP="smoothstep",_Z.FACEFORWARD="faceforward";var _K=class extends _P{constructor(e,t,i){super("v4"),this.nodeType="TextureCubeUV",this.value=e,this.uv=t,this.bias=i}bilinearCubeUV(e,t,i,r){let a=new _Y(_K.Nodes.bilinearCubeUV,[t,i,r]);this.colorSpaceTL=this.colorSpaceTL??new _H(new _W("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(a.build(e)+".tl"),this.colorSpaceTR=this.colorSpaceTR??new _H(new _W("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(a.build(e)+".tr"),this.colorSpaceBL=this.colorSpaceBL??new _H(new _W("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(a.build(e)+".bl"),this.colorSpaceBR=this.colorSpaceBR??new _H(new _W("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(a.build(e)+".br");let o={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(o),this.colorSpaceTLExp=new _W(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new _W(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new _W(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new _W(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let l=new _W("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return l.keywords.cubeUV_TL=this.colorSpaceTLExp,l.keywords.cubeUV_TR=this.colorSpaceTRExp,l.keywords.cubeUV_BL=this.colorSpaceBLExp,l.keywords.cubeUV_BR=this.colorSpaceBRExp,l.keywords.cubeUV=a,l}generate(e,t){if(!e.isShader("fragment"))return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t);{let i=this.uv,r=this.bias||e.context.roughness,a=new _Z(new _Y(_K.Nodes.roughnessToMip,[r]),_K.Nodes.m0,_K.Nodes.cubeUV_maxMipLevel,_Z.CLAMP),o=new _Z(a,_Z.FLOOR),l=new _Z(a,_Z.FRACT),h=new _Z(this.bilinearCubeUV(e,this.value,i,o),this.bilinearCubeUV(e,this.value,i,new _Q(o,new _X(1).setReadonly(!0),_Q.ADD)),l,_Z.MIX);return e.format(h.build(e),"v4",t)}}};_K.Nodes=(eE=new _j(`struct TextureCubeUVData { 3161 vec4 tl; 3162 vec4 tr; 3163 vec4 br; 3164 vec4 bl; 3165 vec2 f; 3166 }`),eC=new _U("float cubeUV_maxMipLevel 8.0",!0),eT=new _U("float cubeUV_minMipLevel 4.0",!0),eP=new _U("float cubeUV_maxTileSize 256.0",!0),eD=new _U("float cubeUV_minTileSize 16.0",!0),(eO=new _F(`float getFace(vec3 direction) { 3167 vec3 absDirection = abs(direction); 3168 float face = -1.0; 3169 if (absDirection.x > absDirection.z) { 3170 if (absDirection.x > absDirection.y) 3171 face = direction.x > 0.0 ? 0.0 : 3.0; 3172 else 3173 face = direction.y > 0.0 ? 1.0 : 4.0; 3174 } else { 3175 if (absDirection.z > absDirection.y) 3176 face = direction.z > 0.0 ? 2.0 : 5.0; 3177 else 3178 face = direction.y > 0.0 ? 1.0 : 4.0; 3179 } 3180 return face; 3181 }`)).useKeywords=!1,(eI=new _F(`vec2 getUV(vec3 direction, float face) { 3182 vec2 uv; 3183 if (face == 0.0) { 3184 uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x 3185 } else if (face == 1.0) { 3186 uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y 3187 } else if (face == 2.0) { 3188 uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z 3189 } else if (face == 3.0) { 3190 uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x 3191 } else if (face == 4.0) { 3192 uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y 3193 } else { 3194 uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z 3195 } 3196 return 0.5 * (uv + 1.0); 3197 }`)).useKeywords=!1,(eR=new _F(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) { 3198 float face = getFace(direction); 3199 float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0); 3200 mipInt = max(mipInt, cubeUV_minMipLevel); 3201 float faceSize = exp2(mipInt); 3202 float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize); 3203 vec2 uv = getUV(direction, face) * (faceSize - 1.0); 3204 vec2 f = fract(uv); 3205 uv += 0.5 - f; 3206 if (face > 2.0) { 3207 uv.y += faceSize; 3208 face -= 3.0; 3209 } 3210 uv.x += face * faceSize; 3211 if(mipInt < cubeUV_maxMipLevel){ 3212 uv.y += 2.0 * cubeUV_maxTileSize; 3213 } 3214 uv.y += filterInt * 2.0 * cubeUV_minTileSize; 3215 uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize); 3216 uv *= texelSize; 3217 vec4 tl = texture2D(envMap, uv); 3218 uv.x += texelSize; 3219 vec4 tr = texture2D(envMap, uv); 3220 uv.y += texelSize; 3221 vec4 br = texture2D(envMap, uv); 3222 uv.x -= texelSize; 3223 vec4 bl = texture2D(envMap, uv); 3224 return TextureCubeUVData( tl, tr, br, bl, f ); 3225 }`,[eE,eO,eI,eC,eT,eP,eD])).useKeywords=!1,{bilinearCubeUV:eR,roughnessToMip:new _F(`float roughnessToMip(float roughness) { 3226 float mip = 0.0; 3227 if (roughness >= r1) { 3228 mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0; 3229 } else if (roughness >= r4) { 3230 mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1; 3231 } else if (roughness >= r5) { 3232 mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4; 3233 } else if (roughness >= r6) { 3234 mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5; 3235 } else {
3236 mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25 3237 } 3238 return mip; 3239 }`,[new _U("float r0 1.0",!0),new _U("float v0 0.339",!0),eL=new _U("float m0 -2.0",!0),new _U("float r1 0.8",!0),new _U("float v1 0.276",!0),new _U("float m1 -1.0",!0),new _U("float r4 0.4",!0),new _U("float v4 0.046",!0),new _U("float m4 2.0",!0),new _U("float r5 0.305",!0),new _U("float v5 0.016",!0),new _U("float m5 3.0",!0),new _U("float r6 0.21",!0),new _U("float v6 0.0038",!0),new _U("float m6 4.0",!0)]),m0:eL,cubeUV_maxMipLevel:eC});var _J=class extends _P{constructor(e){super("v3"),this.nodeType="Normal",this.scope=e??_J.VIEW}getShared(){return this.scope===_J.WORLD}build(e,t,i,r){let a=e.context[this.scope+"Normal"];return a?a.build(e,t,i,r):super.build(e,t,i)}generate(e,t,i,r,a){let o;switch(this.scope){case _J.VIEW:o=e.isShader("vertex")?"transformedNormal":"geometryNormal";break;case _J.LOCAL:e.isShader("vertex")?o="objectNormal":(e.requires.normal=!0,o="vObjectNormal");break;case _J.WORLD:e.isShader("vertex")?o="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,o="vWNormal")}return e.format(o,this.getType(e),t)}};_J.LOCAL="local",_J.WORLD="world",_J.VIEW="view",_J.NORMAL="normal",_T.addKeyword("viewNormal",function(){return new _J(_J.VIEW)}),_T.addKeyword("localNormal",function(){return new _J(_J.NORMAL)}),_T.addKeyword("worldNormal",function(){return new _J(_J.WORLD)});var _$=class extends _P{constructor(e){super("v3"),this.nodeType="Position",this.scope=e??_$.LOCAL}getType(){return this.scope===_$.PROJECTION?"v4":this.type}getShader(){switch(this.scope){case _$.LOCAL:case _$.WORLD:return!1}return!0}generate(e,t,i,r,a){let o;switch(this.scope){case _$.LOCAL:e.isShader("vertex")?o="transformed":(e.requires.position=!0,o="vPosition");break;case _$.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,o="vWPosition";break;case _$.VIEW:o=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case _$.PROJECTION:o=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )"}return e.format(o,this.getType(),t)}};_$.LOCAL="local",_$.WORLD="world",_$.VIEW="view",_$.PROJECTION="projection",_T.addKeyword("position",function(){return new _$}),_T.addKeyword("worldPosition",function(){return new _$(_$.WORLD)}),_T.addKeyword("viewPosition",function(){return new _$(_$.VIEW)});var _0=class extends _P{constructor(e){super("v3"),this.nodeType="Reflect",this.scope=e??_0.CUBE}getUnique(e){return!e.context.viewNormal}getType(){return this.scope===_0.SPHERE?"v2":this.type}generate(e,t){let i=this.getUnique(e);if(!e.isShader("fragment"))return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t);{let r;switch(this.scope){case _0.VECTOR:{let t=new _J(_J.VIEW),a=e.context.roughness,o=t.build(e,"v3"),l=new _$(_$.VIEW).build(e,"v3"),h=a?a.build(e,"f"):void 0,c=`reflect( -normalize( ${l} ), ${o} )`;h&&(c=`normalize( mix( ${c}, ${o}, ${h} * ${h} ) )`);let d=`inverseTransformDirection( ${c}, viewMatrix )`;i?(e.addNodeCode(`vec3 reflectVec = ${d};`),r="reflectVec"):r=d;break}case _0.CUBE:{let t=new _0(_0.VECTOR).build(e,"v3"),a="vec3( -"+t+".x, "+t+".yz )";i?(e.addNodeCode(`vec3 reflectCubeVec = ${a};`),r="reflectCubeVec"):r=a;break}case _0.SPHERE:{let t="normalize( ( viewMatrix * vec4( "+new _0(_0.VECTOR).build(e,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(e.addNodeCode(`vec2 reflectSphereVec = ${t};`),r="reflectSphereVec"):r=t}}return e.format(r,this.getType(),t)}}};_0.CUBE="cube",_0.SPHERE="sphere",_0.VECTOR="vector";var _1=class extends _P{constructor(e=new _q,t,i){super("v4"),this.nodeType="TextureCube",this.value=e,this.radianceNode=new _K(this.value,t??new _0(_0.VECTOR),i),this.irradianceNode=new _K(this.value,new _J(_J.WORLD),new _X(1).setReadonly(!0))}generate(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),("irradiance"===e.slot?this.irradianceNode:this.radianceNode).build(e,t)):(console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t))}},_2=class extends _D{constructor(e=new su,t,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=e,this.uv=t??new _0,this.bias=i}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){let i;if("samplerCube"===t)return this.getTexture(e,t);let r=this.getTexture(e,t),a=this.uv?.build(e,"v3"),o=this.bias?this.bias.build(e,"f"):void 0;void 0===o&&e.context.bias&&(o=e.context.bias.setTexture(this).build(e,"f")),i=o?"texCubeBias( "+r+", "+a+", "+o+" )":"texCube
3239( "+r+", "+a+" )";let l={include:e.isShader("vertex"),ignoreCache:!0},h=this.getType(e);return e.addContext(l),this.colorSpace=this.colorSpace??new _H(new _W("",h)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(i),i=this.colorSpace.build(e,h),e.removeContext(),e.format(i,h,t)}},_3=` 3240uniform int frameIndex; 3241uniform vec2 resolution; 3242uniform mat4 previousModelViewMatrix; 3243uniform mat4 previousProjectionMatrix; 3244 3245varying vec4 vCurrentPosition; 3246varying vec4 vPreviousPosition; 3247`,_4=` 3248layout(location = 1) out vec4 gVelocity; 3249 3250uniform int frameIndex; 3251uniform vec2 resolution; 3252 3253varying vec4 vCurrentPosition; 3254varying vec4 vPreviousPosition; 3255 3256const vec2 haltonSequence[16] = vec2[16]( 3257vec2( 0.000000,-0.333334), 3258vec2(-0.500000, 0.333334), 3259vec2( 0.500000,-0.777778), 3260vec2(-0.750000,-0.111112), 3261vec2( 0.250000, 0.555556), 3262vec2(-0.250000,-0.555556), 3263vec2( 0.750000, 0.111112), 3264vec2(-0.875000, 0.777778), 3265vec2(0.125000, -0.925926), 3266vec2(-0.375000, -0.259260), 3267vec2(0.625000, 0.407408), 3268vec2(-0.625000, -0.703704), 3269vec2(0.375000, -0.037038), 3270vec2(-0.125000, 0.629630), 3271vec2(0.875000, -0.481482), 3272vec2(-0.937500, 0.185186)); 3273 3274vec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) { 3275 const float goldenAngle = 2.399963f; // radians 3276 float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount)); 3277 float theta = float(sampleIndex) * goldenAngle + angle; 3278 float sine = sin(theta); 3279 float cosine = cos(theta); 3280 return vec2(cosine, sine) * r; 3281} 3282 3283// Derived from the interleaved gradient function from Jimenez 2014 http:goo.gl/eomGso 3284float getNoiseInterleavedGradient(vec2 screenPos) { 3285 vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f); 3286 return fract(magic.z * fract(dot(screenPos, magic.xy))); 3287} 3288 3289`,_5=` 3290// TODO: This could be generated CPU side and passed to the shader every frame 3291const vec2 haltonSequence[16] = vec2[16]( 3292vec2( 0.000000,-0.333334), 3293vec2(-0.500000, 0.333334), 3294vec2( 0.500000,-0.777778), 3295vec2(-0.750000,-0.111112), 3296vec2( 0.250000, 0.555556), 3297vec2(-0.250000,-0.555556), 3298vec2( 0.750000, 0.111112), 3299vec2(-0.875000, 0.777778), 3300vec2(0.125000, -0.925926), 3301vec2(-0.375000, -0.259260), 3302vec2(0.625000, 0.407408), 3303vec2(-0.625000, -0.703704), 3304vec2(0.375000, -0.037038), 3305vec2(-0.125000, 0.629630), 3306vec2(0.875000, -0.481482), 3307vec2(-0.937500, 0.185186)); 3308 3309// TODO: Pass correct view size 3310vec2 offset = haltonSequence[frameIndex]; 3311offset.x /= resolution.x; 3312offset.y /= resolution.y; 3313 3314vec4 currentPosition = gl_Position; 3315vec4 currentPositionJittered = currentPosition + (vec4(offset.x, offset.y, 0.0, 0.0) * currentPosition.w); 3316 3317// We want to calculate the velocity with unjittered positions 3318// so that things that are not moving get a velocity = 0 3319vCurrentPosition = currentPosition; 3320vPreviousPosition = previousProjectionMatrix * previousModelViewMatrix * vec4(transformed, 1.0); 3321#ifdef OUTLINE_COMPENSATION 3322vPreviousPosition.xy += OUTLINE_COMPENSATION; 3323#endif 3324gl_Position = currentPositionJittered; 3325 3326`,_6=` 3327vec2 oldPos = vPreviousPosition.xy; 3328 oldPos /= vPreviousPosition.w; 3329 oldPos.xy = (oldPos.xy+1.)/2.0; 3330 3331vec2 newPos = vCurrentPosition.xy; 3332 newPos /= vCurrentPosition.w; 3333 newPos.xy = (newPos.xy+1.)/2.0; 3334 3335vec2 velocity = (newPos - oldPos); 3336 3337// Discard fully transparent pixels 3338if (gl_FragColor.a <= 0.0) discard; 3339 3340gVelocity = vec4(velocity, 0.0, 1.0); 3341`,_8=` 3342layout(location = 1) out vec4 gVelocity; 3343`,_9=` 3344 // Discard fully transparent pixels 3345 if (gl_FragColor.a <= 0.0) discard; 3346 3347 gVelocity = vec4(0.0, 0.0, 0.0, 1.0); 3348`,_7=["x","y","z","w"],Ae=["float","vec2","vec3","vec4"],At={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},Ai={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"},Ar=class{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.needsJitter=!0,this.getIncludesCode=function(){function e(e,t){return e.deps.length-t.deps.length}return function(t,i){let r=this.getIncludes(t,i);if(!r)return"";let a="";r=r.sort(e);for(let e=0;e<r.length;e++)r[e].src&&(a+=r[e].src+` 3349`);return a}}(),this.slots=[],this.caches=[],this.contexts=[],this.keywords={},this.nodeData={},this.fragmentVariables={},this.fragmentParsVariables={},this.vertexParsVariables={},this.requires={uv:[],color:[],transparent:!1,irradiance:!1,position:!1,worldPosition:!1,normal:!1,worldNormal:!1,vWorldViewDir:!1,modelMatrix:!1,viewMatrix:!1,projectionMatrix:!1},this.includes={consts:[],functions:[],structs:[]},this.attributes={}
vendor: 4,744 bytes, lines 3349-3392
3349,this.prefixCode=["#ifdef TEXTURE_LOD_EXT"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCube(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2D(a, b, c)","#endif",` 3350 // NOTE: Include Spline's blending modes. This could be part of BlendNode 3351 #define SPE_BLENDING_NORMAL 0 3352 #define SPE_BLENDING_MULTIPLY 1 3353 #define SPE_BLENDING_SCREEN 2 3354 #define SPE_BLENDING_OVERLAY 3 3355 3356 vec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) { 3357 return mix( a, b, alpha ); 3358 } 3359 3360 vec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) { 3361 return mix( a, a * b, alpha ); 3362 } 3363 3364 vec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) { 3365 vec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b ); 3366 return mix( a, tmp, alpha ); 3367 } 3368 3369 vec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) { 3370 vec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) ); 3371 return clamp( mix( a, tmp, alpha ), 0.0, 1.0 ); 3372 } 3373 3374 vec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) { 3375 if ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha ); 3376 else if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha ); 3377 else if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha ); 3378 else if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha ); 3379 return vec3( 1.0 ); 3380 } 3381 `,"#include <packing>","#include <common>"].join(` 3382`),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join(` 3383`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) { 3384 accumAlpha += (1.0 - accumAlpha) * alpha; 3385 }`,""].join(` 3386`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.addVertexParsCode(_3),this.addFragmentParsCode(_4),this.buildShader("vertex",e),this.buildShader("fragment",t);for(let e=0;e<this.requires.uv.length;e++)if(this.requires.uv[e]){let t=e>0?e+1:"";this.addVaryCode("varying vec2 vUv"+t+";"),e>0&&this.addVertexParsCode("attribute vec2 uv"+t+";"),this.addVertexFinalCode("vUv"+t+" = uv"+t+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition,this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode(` 3387 #ifndef SHAPEBLEND 3388 vObjectNormal = normal; 3389 #else 3390 vObjectNormal = objectNormal; 3391 #endif 3392 `)),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ? ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.needsJitter&&(this.addVertexFinalCode(_5),this.addFragmentFinalCode(_6)),this}buildShader(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}setMaterial(e,t){return this.defines={},this}addFlow(e,t,i){return this.addSlot(e).addCache(t).addContext(i)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(e){return this.cache=e??"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}
vendor: 6,724 bytes, lines 3392-3399
3392removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(e){return this.slot=e||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(e,t){void 0===this.fragmentVariables[e]&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addFragmentParsVariable(e,t){void 0===this.fragmentParsVariables[e]&&(this.addFragmentParsCode(`${t} ${e};`),this.fragmentParsVariables[e]="")}addVertexParsVariable(e,t){void 0===this.vertexParsVariables[e]&&(this.addVertexParsCode(`${t} ${e};`),this.vertexParsVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[t??this.shader]+=e+` 3393`}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t??this.shader]+=e+` 3394`}clearNodeCode(e){e=e??this.shader;let t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[t??this.shader]+=e+` 3395`}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t??this.shader]+=e+` 3396`}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return -1!==this.caches.indexOf(e)}isSlot(e){return -1!==this.slots.indexOf(e)}define(e,t){this.defines[e]=void 0===t?1:t}require(e){this.requires[e]=!0}isDefined(e){return void 0!==this.defines[e]}getVar(e,t,i,r="varying",a="V",o=""){let l=this.getVars(r),h=l[e];if(!h){let r=l.length;h={name:i||"node"+a+r+(o?"_"+o:""),type:t},l.push(h),l[e]=h}return h}getTempVar(e,t,i,r){return this.getVar(e,t,i,this.shader,"T",r)}getAttribute(e,t){if(!this.attributes[e]){let i=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(i.name+" = "+e+";"),this.attributes[e]={varying:i,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join(` 3397`)}getVarListCode(e,t){t=t??"";let i="";for(let r=0,a=e.length;r<a;++r){let a=e[r],o=a.type,l=a.name,h=a.size,c=this.getFormatByType(o);if(void 0===c)throw Error("Node pars "+c+" not found.");c.includes("[]")?i+=t+" "+c.substring(0,c.length-2)+" "+l+`[${h}]; 3398`:i+=t+" "+c+" "+l+`; 3399`}return i}getVars(e){return this.inputs.vars[e??this.shader]}getNodeData(e){let t=e instanceof _E?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,i,r,a,o){if(t.includes("[]")){let l=this.inputs.arrayUniforms,h=l.list.length,c=new _C({type:t,size:i.size,name:r||"nodeUA"+h+(o?"_"+o:""),node:i,needsUpdate:a});return l.list.push(c),l[e].push(c),l[e][c.name]=c,this.uniforms[c.name]=c,c}{let l=this.inputs.uniforms,h=l.list.length,c=new _C({type:t,name:r||"nodeU"+h+(o?"_"+o:""),node:i,needsUpdate:a});return l.list.push(c),l[e].push(c),l[e][c.name]=c,this.uniforms[c.name]=c,c}}createVertexUniform(e,t,i,r,a){return this.createUniform("vertex",e,t,i,r,a)}createFragmentUniform(e,t,i,r,a){return this.createUniform("fragment",e,t,i,r,a)}include(e,t,i){let r;if(e="string"==typeof e?_T.get(e):e,!1===this.context.include)return e.name;e instanceof _F?r=this.includes.functions:e instanceof _U?r=this.includes.consts:e instanceof _j&&(r=this.includes.structs);let a=r[this.shader]=r[this.shader]||[];if(e){let r=a[e.name];if(r||(r=a[e.name]={node:e,deps:[]},a.push(r),r.src=e.build(this,"source")),e instanceof _F&&t&&a[t.name]&&-1===a[t.name].deps.indexOf(e)&&(a[t.name].deps.push(e),e.includes?.length)){let i=0;do this.include(e.includes[i++],t);while(i<e.includes.length)}return i&&(r.src=i),e.name}throw Error("Include not found.")}colorToVectorProperties(e){return e.replace("r","x").replace("g","y").replace("b","z").replace("a","w")}colorToVector(e){return e.replace(/c/g,"v3")}getIncludes(e,t){return this.includes[e][t||this.shader]}getConstructorFromLength(e){return Ae[e-1]}isTypeMatrix(e){return/^m/.test(e)}getTypeLength(e){return"f"===e?1:parseInt(this.colorToVector(e).substr(1))}getTypeFromLength(e){return 1===e?"f":"v"+e}findNode(...e){for(let t=0;t<arguments.length;t++){let i=e[t];if(i?.isNode)return i}}resolve(...e){for(let t=0;t<arguments.length;t++){let i=e[t];if(void 0!==i){if(i.isNode)return i;if(i.isTexture)switch(i.mapping){case 301:case 302:return new _2(i);case 306:return new _1(new _q(i));default:return new _q(i)}else{if(i.isVector2)return new _O(i);if(i.isVector3)return new _I(i);if(i.isVector4)return new _L(i)}}}}format(e,t,i){switch(this.colorToVector(i+" <- "+t)){case"f <- v2":case"f <- v3":case"f <- v4":return e+".x";case"f <- i":case"f <- b":return"float( "+e+" )";case"v2 <- f":return"vec2( "+e+" )";case"v2 <- v3":case"v2 <- v4":return e+".xy";case"v2 <- i":case"v2 <- b":case"v3 <- i":case"v3 <- b":return"vec2( float( "+e+" ) )";case"v3 <- f":return"vec3( "+e+" )";case"v3 <- v2":return"vec3( "+e+", 0.0 )";case"v3 <- v4":return e+".xyz";case"v4 <- f":return"vec4( "+e+" )";case"v4 <- v2":return"vec4( "+e+", 0.0, 1.0 )";case"v4 <- v3":return"vec4( "+e+", 1.0 )";case"v4 <- i":case"v4 <- b":return"vec4( float( "+e+" ) )";case"i <- f":case"i <- b":return"int( "+e+" )";case"i <- v2":case"i <- v3":case"i <- v4":return"int( "+e+".x )";case"b <- f":return"( "+e+" != 0.0 )";case"b <- v2":return"( "+e+" != vec2( 0.0 ) )";case"b <- v3":return"( "+e+" != vec3( 0.0 ) )";case"b <- v4":return"( "+e+" != vec4( 0.0 ) )";case"b <- i":return"( "+e+" != 0 )"}return e}getTypeByFormat(e){return At[e]||e}getFormatByType(e){return Ai[e]||e}getUUID(e,t){return(t=void 0===t||t)&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return _7[e]}getIndexByElement(e){return _7.indexOf(e)}isShader(e){return this.shader===e}setShader(e){return this.shader=e,this}mergeDefines(e){for(let t in e)this.defines[t]=e[t];return this.defines}mergeUniform(e){for(let t in e)this.uniforms[t]=e[t];return this.uniforms}getTextureEncodingFromMap(e){let t;return e?e.isTexture&&(t=e.encoding):t=3e3,3e3===t&&this.context.gamma&&(t=3001),t}},As=class extends _D{constructor(e=0,t,i,r){super("c"),this.nodeType="Color",this.value=e instanceof _R?e:ne
3399w _R(e||0,t,i,r)}setRGBA(e){this.value.setRGBA(e.r,e.g,e.b,e.a)}generate(e,t,i,r,a,o){i=e.getUUID(i??this.getUUID()),r=r??this.getType(e);let l=e.getNodeData(i),h=this.getReadonly()&&void 0!==this.generateReadonly;if(this.alpha){let t=this.alpha.build(e,"f");e.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${t};`)}return h?this.generateReadonly(e,t,i,r,a,o):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(r,this,a,o,this.getLabel())),e.format(l.vertex.name,r,t)):(l.fragment||(l.fragment=e.createFragmentUniform(r,this,a,o,this.getLabel())),e.format(l.fragment.name,r,t))}generateReadonly(e,t,i,r,a,o){return e.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",r,t)}},Aa=class extends _D{constructor(e){super("i"),this.nodeType="Int",this.value=Math.floor(e??0)}generateReadonly(e,t,i,r,a,o){return e.format(this.value.toString(),r,t)}},An=class extends _D{constructor(e){super("b"),this.nodeType="Bool",this.value=e??!1}generateReadonly(e,t,i,r){return e.format(this.value?"true":"false",r,t)}},Ao=class extends _D{constructor(e=1,t){super("f[]"),this.nodeType="FloatArray",this.size=e,this.value=Array.isArray(t)?t:"number"==typeof t?Array(e).fill(t):Array(e).fill(0)}},Al=class extends _D{},Ah=class extends Al{constructor(e){super("v3"),this.image=e,this._value=new iD}get value(){return this._value.x=this.image.isVideo?this.image.img.videoWidth??0:this.image.img.width,this._value.y=this.image.isVideo?this.image.img.videoHeight??0:this.image.img.height,this._value}},Ac=class extends Al{constructor(e,t,i=1008,r=1006){super("t"),this.image=e,this.wrap=t,this.minFilter=i,this.magFilter=r}get value(){return this.image.getTexture(this.wrap,this.minFilter,this.magFilter)}},Ad=class extends _D{constructor(e){super("m3"),this.nodeType="Matrix3",this.value=e??new t7}generateReadonly(e,t,i,r,a,o){return e.format("mat3("+this.value.elements.join(", ")+")",r,t)}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}},Au=class extends _D{constructor(e){super("m4"),this.nodeType="Matrix4",this.value=e??new i6}generateReadonly(e,t,i,r,a,o){return e.format("mat4("+this.value.elements.join(", ")+")",r,t)}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}};function Ap(e,t,i,r=0){e.setUvTransform(i[0],i[1],t[0],t[1],0,0,0).premultiply(new t7().makeRotation(r*t8.DEG2RAD))}var Af=class extends Ad{constructor(e,t,i=0){super(new t7),this.repeat=e,this.offset=t,this.rotation=i,Ap(this.value,e,t,i)}updateMatrix(){Ap(this.value,this.repeat,this.offset,this.rotation)}},Am=class extends _D{constructor(e=1,t){super("v4[]"),this.nodeType="Vector4Array",this.size=e,this.value=Array.isArray(t)?t:t instanceof iA?Array(e).fill(t):Array(e).fill(new iA(0))}},Ag=class extends _P{constructor(e,t,i,r){super("v3"),this.nodeType="Blend",this.a=e,this.b=t,this.alpha=i,this.mode=r}generate(e,t){if(!e.isShader("fragment"))return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{let i=[];return i.push(this.a.build(e,"c")),i.push(this.b.build(e,"c")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),e.format("spe_blend("+i.join(",")+")",this.getType(e),t)}}},Av=class extends _P{constructor(e,t){super("v3"),this.nodeType="CustomColor",this.color=e,this.alpha=t,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(!e.isShader("fragment"))return console.warn("CustomColorNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{let i=e.include(Av.Nodes.customColor);e.addFragmentVariable(this.calpha,"float");let r=[];return r.push(this.color.build(e,"v3")),r.push(this.mask?`luminance(${this.mask.build(e,"v3")})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};Av.Nodes={customColor:new _F(`vec3 customColor(vec3 color, float mask, float alpha, out float calpha) { 3400 float lalpha = alpha * mask; 3401 calpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0); 3402 accumAlpha += (1.0 - accumAlpha) * lalpha; 3403 3404 return color; 3405 }`)};var Ay=class extends _P{constructor(e,t){super("v3"),this.nodeType="CustomNormal",this.cnormal=e,this.alpha=t,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(!e.isShader("fragment"))return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{let i=e.include(Ay.Nodes.customNormal);e.addFragmentVariable(this.calpha,"float");let r=[];return r.push(this.cnormal.build(e,"v3")),r.push("normal"),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};Ay.Nodes={customNormal:new _F(`vec3 customNormal(vec3 cnormal, vec3 norm, float mask, float alpha, out float calpha) { 3406 vec3 normal = packNormalToRGB( norm ).rgb; 3407 normal *= step( vec3(0.5), cnormal ); 3408
3409 float lalpha = alpha * mask; 3410 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3411 accumAlpha += ( 1.0 - accumAlpha ) * lalpha; 3412 3413 return normal; 3414 }`)};var Ax=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d,p,f){super("v3"),this.nodeType="CustomTexture",this.texture=e,this.textureSize=t,this.crop=i,this.projection=r,this.axis=a,this.side=o,this.size=l,this.blending=h,this.mat=c,this.isMask=f,this.alpha=d,this.mode=p,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){e.require("position"),e.require("normal"),e.require("uv"),e.requires.uv=[!0],e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0;let i=`g${this.uuid.toString().replace(/-/g,"")}`,r;switch(this.projection.value){case 3:r=e.include(Ax.Nodes.cylindrical);break;case 2:r=e.include(Ax.Nodes.spherical);break;case 1:let a=["vec3(1.0, 0.0, 0.0)","vec3(0.0, 1.0, 0.0)","vec3(0.0, 0.0, 1.0)"][this.axis.value],o=["zy","xz","xy"][this.axis.value],l=new _F(` 3415 vec3 ${i}_planarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3416 vec2 projected = (1. + (position.${o})) / 2.; 3417 vec2 uvs = ( mat * vec3( (projected * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy; 3418 writeUv = uvs; 3419 3420 vec4 tmp = texture2D( tex, uvs ); 3421 3422 vec3 col = tmp.rgb; 3423 float lalpha = alpha * tmp.a; 3424 ${2===this.side.value?"":`lalpha *= step(0.0, ${1===this.side.value?"-1.0 * ":""}dot(vObjectNormal, ${a}));`} 3425 3426 if ( crop > 0.5 ) { 3427 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3428 lalpha = 0.0; 3429 } 3430 } 3431 3432 lalpha *= mask; 3433 3434 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3435 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3436 3437 return col; 3438 }`);r=e.include(l);break;case 4:r=e.include(Ax.Nodes.triplanar);break;case 0:let h=new _F(Ax.Nodes.uv.src.replace("uvTexture",`${i}_uvTexture`));r=e.include(h);break;default:r=e.include(Ax.Nodes.uv)}e.addFragmentVariable(this.calpha,"float");let c=[];if(c.push("normal"),c.push(this.texture.generate(e,"t")),c.push(this.textureSize.build(e,"v2")),c.push(this.crop.build(e,"f")),c.push(this.mat.build(e,"mat3")),c.push(this.size.build(e,"v2")),c.push(this.blending.build(e,"f")),c.push(this.isMask.build(e,"b")),c.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),c.push(this.alpha.build(e,"f")),c.push(this.mode.build(e,"i")),c.push(this.calpha),4===this.projection.value){let t=`${i}_writeUvs`,r=t+"0",a=t+"1",o=t+"2",l=`${i}_triplanarWeights`;e.addFragmentVariable(r,"vec2"),e.addFragmentVariable(a,"vec2"),e.addFragmentVariable(o,"vec2"),e.addFragmentVariable(l,"vec3"),c.push(r),c.push(a),c.push(o),c.push(l)}else{let t=`${i}_writeUvs`;e.addFragmentVariable(t,"vec2"),c.push(t)}return e.format(r+"("+c.join(",")+")",this.getType(e),t)}};Ax.Nodes={cylindrical:new _F(` 3439vec3 cylindricalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3440 vec3 posN = normalize(position); 3441 float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415); 3442 float scaledHeight = position.y / (size.y * 0.5); 3443 float v = (scaledHeight / 2.) + .5; 3444 3445 vec2 calculatedUv = vec2(u,v); 3446 vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy; 3447 writeUv = uvs; 3448 3449 vec2 df = fwidth(uvs); 3450 if(df.x > 0.5) df.x = 0.; 3451 3452 #ifdef GL_EXT_shader_texture_lod 3453 vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3454 #else 3455 vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3456 #endif 3457 3458 vec3 col = tmp.rgb; 3459 float lalpha = alpha * tmp.a; 3460 if ( crop > 0.5 ) { 3461 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3462 lalpha = 0.0; 3463 } 3464 } 3465 3466 lalpha *= mask; 3467 3468 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3469 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3470 3471 return col; 3472 } 3473`),spherical:new _F(` 3474vec3 sphericalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3475 vec3 posN = normalize(vPosition); 3476 float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415); 3477 float v = 0.5 + asin(posN.y) / 3.1415; 3478 3479 vec2 calculatedUv = vec2(u,v); 3480 vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy; 3481 writeUv = uvs; 3482 3483 vec2 df = fwidth(uvs); 3484 if(df.x > 0.5) df.x = 0.; 3485 #ifdef GL_EXT_shader_texture_lod 3486 vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3487 #else 3488 vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3489 #endif 3490 3491 vec3 col = tmp.rgb;
3492 float lalpha = alpha * tmp.a; 3493 if ( crop > 0.5 ) { 3494 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3495 lalpha = 0.0; 3496 } 3497 } 3498 3499 lalpha *= mask; 3500 3501 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3502 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3503 3504 return col; 3505 } 3506`),uv:new _F(`vec3 uvTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3507 vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy; 3508 writeUv = uvs; 3509 3510 vec4 tmp = texture2D( tex, uvs ); 3511 3512 vec3 col = tmp.rgb; 3513 3514 float lalpha = alpha * tmp.a; 3515 if ( crop > 0.5 ) { 3516 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3517 lalpha = 0.0; 3518 } 3519 } 3520 3521 lalpha *= mask; 3522 3523 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3524 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3525 3526 return col; 3527 }`),triplanar:new _F(`vec3 triplanarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUvs0, out vec2 writeUvs1, out vec2 writeUvs2, out vec3 writeWeights) { 3528 vec3 p = position; 3529 vec2 uv0 = (1.0 + p.xy) / 2.0; 3530 vec2 uv1 = (1.0 + p.zy) / 2.0; 3531 vec2 uv2 = (1.0 + p.xz) / 2.0; 3532 3533 uv0 = (mat * vec3((uv0 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy; 3534 uv1 = (mat * vec3((uv1 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy; 3535 uv2 = (mat * vec3((uv2 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy; 3536 3537 // Range from 3 to 128 seems to be good 3538 float exponent = (1.0 - blending) * 125.0 + 3.0; 3539 3540 vec3 n = vObjectNormal; 3541 vec3 weights = abs(normalize(n)); 3542 weights = pow(weights, vec3(exponent)); 3543 weights /= dot(weights, vec3(1.0)); 3544 3545 // Write out all sets of UVs that we generated 3546 writeUvs0 = uv0; 3547 writeUvs1 = uv1; 3548 writeUvs2 = uv2; 3549 writeWeights = weights; 3550 3551 // Derivatives for LOD 3552 vec2 df0 = fwidth(uv0); 3553 vec2 df1 = fwidth(uv1); 3554 vec2 df2 = fwidth(uv2); 3555 if (df0.x > 0.5) df0.x = 0.0; 3556 if (df1.x > 0.5) df1.x = 0.0; 3557 if (df2.x > 0.5) df2.x = 0.0; 3558 3559 #ifdef GL_EXT_shader_texture_lod 3560 vec4 tmp = 3561 texture2DLodEXT(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 3562 texture2DLodEXT(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 3563 texture2DLodEXT(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y; 3564 #else 3565 vec4 tmp = 3566 textureLod(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 3567 textureLod(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 3568 textureLod(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y; 3569 #endif 3570 3571 vec3 col = tmp.rgb; 3572 float lalpha = alpha * tmp.a; 3573 3574 // Apply cropping across all 3 planes 3575 if ( crop > 0.5 ) { 3576 if ( uv0.x < 0.0 || uv0.x > 1.0 || uv0.y < 0.0 || uv0.y > 1.0 ) { 3577 lalpha = 0.0; 3578 } 3579 if ( uv1.x < 0.0 || uv1.x > 1.0 || uv1.y < 0.0 || uv1.y > 1.0 ) { 3580 lalpha = 0.0; 3581 } 3582 if ( uv2.x < 0.0 || uv2.x > 1.0 || uv2.y < 0.0 || uv2.y > 1.0 ) { 3583 lalpha = 0.0; 3584 } 3585 } 3586 3587 lalpha *= mask; 3588 calpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0); 3589 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3590 3591 return col;//n * 0.5 + 0.5; 3592 } 3593 `)};var Ab=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d,p,f){super("v3"),this.nodeType="Depth",this.gradientType=e,this.smooth=t,this.near=i,this.far=r,this.isVector=a,this.isWorldSpace=o,this.origin=l,this.direction=h,this.colors=c,this.steps=d,this.isMask=f,this.alpha=p,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`,r=new _F(`vec3 ${i}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${i}_MAX_COLORS], float steps[${i}_MAX_COLORS], bool isMask, float mask, float alpha, out float calpha) { 3594 vec4 color = colors[0]; 3595 #ifdef ${i}_IS_VECTOR 3596 #ifdef ${i}_LINEAR 3597 #ifdef ${i}_WORLDSPACE 3598 float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far); 3599 #else 3600 float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far); 3601 #endif 3602 #else 3603 #ifdef ${i}_WORLDSPACE 3604 float depth = vectorSphericalWorldSpaceDepth(origin, near, far); 3605 #else 3606 float depth = vectorSphericalObjectSpaceDepth(origin, near, far); 3607 #endif 3608 #endif 3609 #else 3610 float dist = length(vWPosition - cameraPosition); 3611 float depth = ( dist - near ) / ( far - near ); 3612 #endif 3613 3614 3615 float p; 3616 #ifdef ${i}_SMOOTH 3617 for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) { 3618 p = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 ); 3619 color = mix(color, colors[i], smoothstep(0.0, 1.0, p)); 3620 } 3621 #else 3622 for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) { 3623 p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0); 3624 color = mix(color, colors[i], p); 3625 } 3626 #endif 3627
3628 float lalpha = alpha * color.a * mask; 3629 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3630 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3631 3632 return color.rgb; 3633 }`,[Ab.Nodes.vectorLinearWorldSpaceDepth,Ab.Nodes.vectorLinearObjectSpaceDepth,Ab.Nodes.vectorSphericalObjectSpaceDepth,Ab.Nodes.vectorSphericalWorldSpaceDepth]);if(!e.isShader("fragment"))return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define(`${i}_MAX_COLORS`,this.colors.value.length),this.smooth.value&&e.define(`${i}_SMOOTH`),this.isVector.value>.5&&e.define(`${i}_IS_VECTOR`),0===this.gradientType.value&&e.define(`${i}_LINEAR`),this.isWorldSpace.value>.5&&e.define(`${i}_WORLDSPACE`),e.require("worldPosition"),e.addFragmentVariable(this.calpha,"float");let a=e.include(r),o=[];return o.push(this.near.build(e,"f")),o.push(this.far.build(e,"f")),o.push(this.origin.build(e,"v3")),o.push(this.direction.build(e,"v3")),o.push(this.colors.build(e,"v4[]")),o.push(this.steps.build(e,"f[]")),o.push(this.isMask.build(e,"b")),o.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),o.push(this.alpha.build(e,"f")),o.push(this.calpha),e.format(a+"("+o.join(",")+")",this.getType(e),t)}}};Ab.Nodes={vectorLinearWorldSpaceDepth:new _F(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) { 3634 vec3 n = normalize(direction); 3635 float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z)); 3636 return ( dist - near ) / ( far - near ); 3637 }`),vectorLinearObjectSpaceDepth:new _F(`float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) { 3638 vec3 n = normalize(direction); 3639 float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z)); 3640 return ( dist - near ) / ( far - near ); 3641 }`),vectorSphericalWorldSpaceDepth:new _F(`float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) { 3642 float dist = length(vWPosition - origin); 3643 return ( dist - near ) / ( far - near ); 3644 }`),vectorSphericalObjectSpaceDepth:new _F(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) { 3645 float dist = length(position - origin); 3646 return ( dist - near ) / ( far - near ); 3647 }`)};var Aw=class extends _P{constructor(e,t,i,r,a,o,l,h){super("v3"),this.nodeType="Fresnel",this.color=e,this.bias=t,this.scale=i,this.intensity=r,this.factor=a,this.isMask=h,this.alpha=o,this.mode=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),!e.isShader("fragment"))return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.addFragmentVariable(this.calpha,"float");let i=new _F(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, bool isMask, float mask, float alpha, int mode, out float calpha) { 3648 float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity ); 3649 3650 float lalpha = clamp(fresnel, 0.0, 1.0) * alpha * mask; 3651 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3652 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3653 3654 return color; 3655 }`),r=e.include(i),a=[];return a.push(this.color.build(e,"c")),a.push(this.bias.build(e,"f")),a.push(this.scale.build(e,"f")),a.push(this.intensity.build(e,"f")),a.push(this.factor.build(e,"f")),a.push(this.isMask.build(e,"b")),a.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),a.push(this.alpha.build(e,"f")),a.push(this.mode.build(e,"i")),a.push(this.calpha),e.format(r+"("+a.join(",")+")",this.getType(e),t)}}},AS=class extends _P{constructor(e,t,i,r,a,o,l,h,c){super("v3"),this.nodeType="Gradient",this.gradientType=e,this.smooth=t,this.colors=i,this.steps=r,this.offset=a,this.morph=o,this.angle=l,this.isMask=c,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(!e.isShader("fragment"))return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(AS.Nodes.gradient),r=[];return r.push(this.gradientType.build(e,"i")),r.push(this.smooth.build(e,"b")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.offset.build(e,"v2")),r.push(this.morph.build(e,"v2")),r.push(this.angle.build(e,"f")),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};AS.Nodes={gradient:new _F(`vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, bool isMask, float mask, float alpha, out float calpha) { 3656 vec4 color = colors[0]; 3657 vec2 m = morph / vUv.xy; 3658 vec2 rot = vec2( 0.5 + m.x, m.y ); 3659 vec2 dt = vec2( 3660 cos( angle ) * rot.x - sin( angle ) * rot.y, 3661 sin( angle ) * rot.x + cos( angle ) * rot.y 3662 ); 3663 vec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0; 3664 float t = dot( pt, dt ) / dot( dt, dt ); 3665 if ( gradientType == 1 ) { 3666 t = distance ( 3667 ( vUv + morph ) * 3.0, 3668 ( vUv + offset ) + 1.0 3669 ) + angle; 3670 } else if ( gradientType == 2 ) { 3671 float polar = atan( 3672 vUv.x + morph.x - 0.5 + offset.x, 3673 vUv.y + morph.y - 0.5 + offset.y 3674 ) * -1.0; 3675 t = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) ); 3676 } 3677 3678 float p; 3679 if (smoothed) { 3680 for ( int i = 1; i < GRAD_MAX; i++ ) { 3681 p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 ); 3682 color = mix(color, colors[i], smoothstep(0.0, 1.0, p)); 3683 } 3684 3685 } else { 3686 for ( int i = 1; i < GRAD_MAX; i++ ) { 3687 p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 ); 3688 color = mix(color, colors[i], p); 3689 } 3690 } 3691
3692 float lalpha = alpha * color.a * mask; 3693 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3694 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3695 3696 return color.xyz; 3697 }`)};var A_=class extends _P{constructor(e,t,i,r,a){super("v3"),this.nodeType="Matcap",this.texture=e,this.isMask=r,this.alpha=t,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`,this.rotation=a}generate(e,t){if(!e.isShader("fragment"))return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.addFragmentVariable(this.calpha,"float");let i=e.include(A_.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let r=[];return r.push(this.texture.generate(e,"t")),r.push("normal"),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),r.push(this.calpha),r.push(this.rotation.build(e,"f")),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};A_.Nodes={matcap:new _F(`vec3 matcap(sampler2D matcapTex, vec3 normal, bool isMask, float mask, float alpha, int mode, out float calpha, float rotation) { 3698 vec3 viewDir = normalize( vViewPosition ); 3699 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3700 vec3 y = cross( viewDir, x ); 3701 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ); 3702 uv = mat2( cos(rotation), sin(rotation), -sin(rotation), cos(rotation) ) * uv; 3703 uv = uv * 0.495 + 0.5; 3704 vec4 matcapColor = texture2D( matcapTex, uv ); 3705 3706 float lalpha = alpha * mask; 3707 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3708 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3709 3710 return matcapColor.rgb; 3711 }`)};
3711var AA=(eB=new _F(`vec3 random3(vec3 c) { 3712 float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); 3713 vec3 r; 3714 r.z = fract(512.0*j); 3715 j *= .125; 3716 r.x = fract(512.0*j); 3717 j *= .125; 3718 r.y = fract(512.0*j); 3719 return r-0.5; 3720 }`),(ez=new _F(`float simplexFast(vec3 p) { 3721 vec3 s = floor(p + dot(p, vec3(F3))); 3722 mediump vec3 x = p - s + dot(s, vec3(G3)); 3723 mediump vec3 hs = s; 3724 3725 mediump vec3 e = step(vec3(0.0), x - x.yzx); 3726 mediump vec3 i1 = e*(1.0 - e.zxy); 3727 mediump vec3 i2 = 1.0 - e.zxy*(1.0 - e); 3728 3729 mediump vec3 x1 = x - i1 + G3; 3730 mediump vec3 x2 = x - i2 + 2.0*G3; 3731 mediump vec3 x3 = x - 1.0 + 3.0*G3; 3732 3733 mediump vec4 w, d; 3734 3735 w.x = dot(x, x); 3736 w.y = dot(x1, x1); 3737 w.z = dot(x2, x2); 3738 w.w = dot(x3, x3); 3739 3740 w = max(0.6 - w, 0.0); 3741 3742 d.x = dot(random3(hs), x); 3743 d.y = dot(random3(hs + i1), x1); 3744 d.z = dot(random3(hs + i2), x2); 3745 d.w = dot(random3(hs + 1.0), x3); 3746 3747 w *= w; 3748 w *= w; 3749 d *= w; 3750 3751 return dot(d, vec4(52.0)); 3752 }
3752`,[eB])).keywords.F3=new _U("float F3 0.3333333"),ez.keywords.G3=new _U("float G3 0.1666667"),(eF=new _F(`float simplexPrecise(vec3 p) { 3753 vec3 s = floor(p + dot(p, vec3(F3))); 3754 vec3 x = p - s + dot(s, vec3(G3)); 3755 3756 vec3 e = step(vec3(0.0), x - x.yzx); 3757 vec3 i1 = e*(1.0 - e.zxy); 3758 vec3 i2 = 1.0 - e.zxy*(1.0 - e); 3759 3760 vec3 x1 = x - i1 + G3; 3761 vec3 x2 = x - i2 + 2.0*G3; 3762 vec3 x3 = x - 1.0 + 3.0*G3; 3763 3764 vec4 w, d; 3765 3766 w.x = dot(x, x); 3767 w.y = dot(x1, x1); 3768 w.z = dot(x2, x2); 3769 w.w = dot(x3, x3); 3770 3771 w = max(0.6 - w, 0.0); 3772 3773 d.x = dot(random3(s), x); 3774 d.y = dot(random3(s + i1), x1); 3775 d.z = dot(random3(s + i2), x2); 3776 d.w = dot(random3(s + 1.0), x3); 3777 3778 w *= w; 3779 w *= w; 3780 d *= w; 3781 3782 return dot(d, vec4(52.0)); 3783 }`,[eB])).keywords.F3=new _U("float F3 0.3333333"),eF.keywords.G3=new _U("float G3 0.1666667"),eN=new _F(`float simplexFractal(vec3 m) { 3784 mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4); 3785 mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63); 3786 mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56); 3787 return 0.5333333 * simplexFast(m * rot1) 3788 + 0.2666667 * simplexFast(2.0 * m * rot2) 3789 + 0.1333333 * simplexFast(4.0 * m * rot3) 3790 + 0.0666667 * simplexFast(8.0 * m); 3791 }`,[ez]),eU=new _F("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),ek=new _F("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),eV=new _F(`float simplexAshima(vec3 v) { 3792 const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 3793 const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 3794 vec3 i = floor(v + dot(v, C.yyy) ); 3795 vec3 x0 = v - i + dot(i, C.xxx) ; 3796 vec3 g = step(x0.yzx, x0.xyz); 3797 vec3 l = 1.0 - g; 3798 vec3 i1 = min( g.xyz, l.zxy ); 3799 vec3 i2 = max( g.xyz, l.zxy ); 3800 vec3 x1 = x0 - i1 + 1.0 * C.xxx; 3801 vec3 x2 = x0 - i2 + 2.0 * C.xxx; 3802 vec3 x3 = x0 - 1. + 3.0 * C.xxx; 3803 i = mod(i, 289.0 ); 3804 vec4 p = permute( permute( permute( 3805 i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 3806 + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 3807 + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 3808 float n_ = 1.0/7.0; // N=7 3809 vec3 ns = n_ * D.wyz - D.xzx; 3810 vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N) 3811 vec4 x_ = floor(j * ns.z); 3812 vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 3813 vec4 x = x_ *ns.x + ns.yyyy; 3814 vec4 y = y_ *ns.x + ns.yyyy; 3815 vec4 h = 1.0 - abs(x) - abs(y); 3816 vec4 b0 = vec4( x.xy, y.xy ); 3817 vec4 b1 = vec4( x.zw, y.zw ); 3818 vec4 s0 = floor(b0)*2.0 + 1.0; 3819 vec4 s1 = floor(b1)*2.0 + 1.0; 3820 vec4 sh = -step(h, vec4(0.0)); 3821 vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 3822 vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 3823 vec3 p0 = vec3(a0.xy,h.x); 3824 vec3 p1 = vec3(a0.zw,h.y); 3825 vec3 p2 = vec3(a1.xy,h.z); 3826 vec3 p3 = vec3(a1.zw,h.w); 3827 vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 3828 p0 *= norm.x; 3829 p1 *= norm.y; 3830 p2 *= norm.z; 3831 p3 *= norm.w; 3832 vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 3833 m = m * m; 3834 return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 3835 dot(p2,x2), dot(p3,x3) ) ); 3836 }`,[eU,ek]),ej=new _F("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),eG=new _F("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[ej]),eH=new _F(`float noise(vec3 p){ 3837 vec3 a = floor(p); 3838 vec3 d = p - a; 3839 d = d * d * (3.0 - 2.0 * d); 3840 vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0); 3841 vec4 k1 = perm(b.xyxy); 3842 vec4 k2 = perm(k1.xyxy + b.zzww); 3843 vec4 c = k2 + a.zzzz; 3844 vec4 k3 = perm(c); 3845 vec4 k4 = perm(c + 1.0); 3846 vec4 o1 = fract(k3 * (1.0 / 41.0)); 3847 vec4 o2 = fract(k4 * (1.0 / 41.0)); 3848 vec4 o3 = o2 * d.z + o1 * (1.0 - d.z); 3849 vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x); 3850 return o4.y * d.y + o4.x * (1.0 - d.y); 3851 }`,[eG]),(eW=new _F(`float fbm(vec3 x) { 3852 float v = 0.0; 3853 float a = 0.5; 3854 vec3 shift = vec3(100); 3855 for (int i = 0; i < NUM_OCTAVES; ++i) { 3856 v += a * noise(x); 3857 x = x * 2.0 + shift; 3858 a *= 0.5; 3859 } 3860 return v; 3861 }`,[eH])).keywords.NUM_OCTAVES=new _U("int NUM_OCTAVES 5"),eq=new _F("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),eX=new _F(`float perlin(vec3 P){ 3862 vec3 Pi0 = floor(P); 3863 vec3 Pi1 = Pi0 + vec3(1.0); 3864 Pi0 = mod(Pi0, 289.0); 3865 Pi1 = mod(Pi1, 289.0); 3866 vec3 Pf0 = fract(P); 3867 vec3 Pf1 = Pf0 - vec3(1.0); 3868 vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 3869 vec4 iy = vec4(Pi0.yy, Pi1.yy); 3870 vec4 iz0 = Pi0.zzzz; 3871 vec4 iz1 = Pi1.zzzz; 3872 vec4 ixy = permute(permute(ix) + iy); 3873 vec4 ixy0 = permute(ixy + iz0); 3874 vec4 ixy1 = permute(ixy + iz1); 3875 vec4 gx0 = ixy0 / 7.0; 3876 vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5; 3877 gx0 = fract(gx0); 3878 vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); 3879 vec4 sz0 = step(gz0, vec4(0.0)); 3880 gx0 -= sz0 * (step(0.0, gx0) - 0.5); 3881 gy0 -= sz0 * (step(0.0, gy0) - 0.5); 3882 vec4 gx1 = ixy1 / 7.0; 3883 vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5; 3884 gx1 = fract(gx1); 3885 vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); 3886 vec4 sz1 = step(gz1, vec4(0.0)); 3887 gx1 -= sz1 * (step(0.0, gx1) - 0.5); 3888 gy1 -= sz1 * (step(0.0, gy1) - 0.5); 3889 vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); 3890 vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); 3891 vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); 3892 vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); 3893 vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); 3894 vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); 3895 vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); 3896 vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); 3897 vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 3898 g000 *= norm0.x; 3899 g010 *= norm0.y; 3900 g100 *= norm0.z; 3901 g110 *= norm0.w; 3902 vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 3903 g001 *= norm1.x; 3904 g011 *= norm1.y; 3905 g101 *= norm1.z; 3906 g111 *= norm1.w; 3907 float n000 = dot(g000, Pf0); 3908 float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); 3909 float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); 3910 float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); 3911 float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); 3912 float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); 3913 float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); 3914 float n111 = dot(g111, Pf1); 3915 vec3 fade_xyz = fade(Pf0); 3916 vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); 3917 vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); 3918 float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 3919 return 2.2 * n_xyz; 3920 }
3920`,[eU,ek,eq]),eY=new _F(`float hashwithoutsine13(vec3 p3) 3921 { 3922 p3 = fract(p3 * .1031); 3923 p3 += dot(p3, p3.yzx + 33.33); 3924 return fract((p3.x + p3.y) * p3.z); 3925 }`),eQ=new _F(`vec3 hashwithoutsine33(vec3 p3) 3926 { 3927 p3 = fract(p3 * vec3(.1031, .1030, .0973)); 3928 p3 += dot(p3, p3.yxz+33.33); 3929 return fract((p3.xxy + p3.yxx)*p3.zyx); 3930 }`),eZ=new _F(`float metric(in vec3 p) 3931 { 3932 // L2 3933 return length(p); 3934 3935 // Chebyshev 3936 // vec3 a = abs(p); 3937 // return max(a.x, max(a.y, a.z)); 3938 }`),eK=new _F(`float smin( float a, float b, float k ) 3939 { 3940 float h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (b - a) / k); 3941 float correction = k * h * (1.0 - h); 3942 return mix(b, a, h) - correction; 3943 }`),eJ=new _F(`float smax( float a, float b, float k ) 3944 { 3945 float h = smoothstep(1.0, 0.0, 0.5 + 0.5 * (a - b) / k); 3946 float correction = k * h * (1.0 - h); 3947 return mix(a, b, h) + correction; 3948 }`),e$=new _F(`float remap(float value, float input_min, float input_max, float output_min, float output_max) { 3949 // Compute width of each interval 3950 float input_width = input_max - input_min; 3951 float output_width = output_max - output_min; 3952 3953 // Convert input range into a 0-1 range 3954 float scaled = (value - input_min) / input_width; 3955 3956 // Convert the 0-1 range into a value in output range 3957 return output_min + (scaled * output_width); 3958 }`),{simplexFast:ez,simplexPrecise:eF,simplexFractal:eN,simplexAshima:eV,fbm:eW,perlin:eX,voronoi:new _F(`float voronoi(in vec3 x, in int style, in float smoothness, in float seed, in int quality) 3959 { 3960 // Integer and fractional parts of this point's coordinates 3961 ivec3 p = ivec3(floor(x)); 3962 vec3 f = fract(x); 3963 3964 // Different variables that we will use to construct noise: 3965 // 3966 // f1: distance to the closest feature point 3967 // f2: distance to the second closest feature point 3968 // e: distance to the closest edge (cell boundary) 3969 // 3970 // We also compute "smooth" versions of all of the above quantites, essentially 3971 // replacing "hard" minimums with "smooth" minimums (described by IQ) 3972 float f1_smooth = 8.0; 3973 float f1 = 8.0; 3974 float f2_smooth = 8.0; 3975 float f2 = 8.0; 3976 float e_smooth = 8.0; 3977 float e = 8.0; 3978 3979 // Variables stored from closest cell 3980 ivec3 mb; 3981 vec3 mr; 3982 3983 int steps = quality; 3984 3985 for (int x = -steps; x <= steps; x++) 3986 for (int y = -steps; y <= steps; y++) 3987 for (int z = -steps; z <= steps; z++) 3988 { 3989 ivec3 b = ivec3(x, y, z); 3990 vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f; 3991 float d = length(r); 3992 3993 f1_smooth = smin(d, f1_smooth, smoothness); 3994 3995 // Store un-smoothed distances too 3996 if (d < f1) 3997 { 3998 f2 = f1; 3999 f1 = d; 4000 4001 mb = ivec3(x, y, z); 4002 mr = r; 4003 } 4004 else if (d < f2) 4005 { 4006 f2 = d; 4007 } 4008 } 4009 4010 // Second pass for edge distance 4011 // skip for styles don't need 4012 if (style != 0 && style != 5 && style != 7) 4013 for (int x = -steps; x <= steps; x++) 4014 for (int y = -steps; y <= steps; y++) 4015 for (int z = -steps; z <= steps; z++) 4016 { 4017 // Start search at the cell that contains the closest point to "x" (found in 1st pass) 4018 ivec3 b = mb + ivec3(x, y, z); 4019 vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f; 4020 float d1 = dot(0.5 * (mr + r), (r - mr)); // IQ normalizes "r - mr" but that breaks things for the smooth version? 4021 float d2 = dot(0.5 * (mr + r), normalize(r - mr)); 4022 4023 e_smooth = smin(d1, e_smooth, smoothness); 4024 4025 e = min(e, d2); 4026 4027 // Also compute a smooth version of F2 in this pass 4028 { 4029 ivec3 b = ivec3(x, y, z); 4030 if (b != mb) 4031 { 4032 vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f; 4033 float d = length(r); 4034 4035 f2_smooth = smin(d, f2_smooth, smoothness); 4036 } 4037 } 4038 } 4039 4040 // Different visualization modes 4041 if (style == 0) 4042 { 4043 return f1_smooth; 4044 } 4045 if (style == 1) 4046 { 4047 return f2_smooth; 4048 } 4049 if (style == 2) 4050 { 4051 return f2_smooth - f1_smooth; 4052 4053 // "Pebbles" also cool 4054 //return step(0.2, f2_smooth - f1_smooth); 4055 } 4056 if (style == 3) 4057 {
4058 // This one is really good for rock / stone effects 4059 float a = f1; 4060 float b = f2; 4061 float k = 3.0; 4062 float h = max(k - abs(a - b), 0.0) / k; 4063 float final = min(a, b) - h * h * k * (1.0 / 4.0); 4064 return final; 4065 } 4066 if (style == 4) 4067 { 4068 // Some random adjustments to make this style stand out more 4069 return exp(5.0 * e_smooth); 4070 } 4071 if (style == 5) 4072 { 4073 return pow(f1_smooth, 3.0); 4074 } 4075 if (style == 6) 4076 { 4077 const float eps = 0.0125; 4078 4079 // Thicker lines as the user increases the smoothness slider 4080 float thickness = smoothness * 0.25 + eps; 4081 4082 // Blurrier lines as the user increases the smoothness slider 4083 float blur = pow(smoothness, 3.0) * 0.25 + eps; 4084 4085 return smoothstep( 4086 thickness - thickness * blur, 4087 thickness + thickness * blur, 4088 e 4089 ); 4090 } 4091 if (style == 7) 4092 { 4093 return hashwithoutsine13(vec3(p + mb) + seed); 4094 } 4095 } 4096 `,[eY,eQ,eZ,eK,eJ,e$])}),AM=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d,p,f,m,g,v,y,x,b,w){super("v3"),this.nodeType="Noise",this.scale=e,this.size=t,this.move=i,this.fA=r,this.fB=a,this.distortion=o,this.colorA=l,this.colorB=h,this.colorC=c,this.colorD=d,this.noiseType=f,this.voronoiStyle=g,this.highCut=v,this.lowCut=y,this.smoothness=x,this.seed=b,this.quality=w,this.isMask=m,this.alpha=p,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t,i,r,a){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let o=["simplexFast","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseType.value],l="voronoi"==o?` 4097 float v = ${o}(st + move, voronoiStyle, smoothness, seed, quality); 4098 4099 // Apply clipping to colors 4100 v = remap(v, lowCut, highCut, 0.0, 1.0); 4101 v = smax(v, 0.0, smoothness * 0.25); 4102 v = smin(v, 1.0, smoothness * 0.25); 4103 4104 // Note that the voronoi mode only uses colors "A" and "C" from the UI 4105 vec4 color = mix(colorA, colorC, v); 4106 `:` 4107 vec3 q = vec3(${o}(st), 4108 ${o}(st + vec3(1.0)), 4109 ${o}(st + vec3(1.0))); 4110 vec3 r = vec3(${o}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move), 4111 ${o}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), 4112 ${o}(st * q)); 4113 float f = ${o}(st + r); 4114 vec4 color; 4115 color = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0)); 4116 color = mix(color, colorC, clamp(length(q), 0.0, 1.0)); 4117 color = mix(color, colorD, clamp(length(r.x), 0.0, 1.0)); 4118 `,h=new _F(`vec3 ${o}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, int voronoiStyle, float highCut, float lowCut, float smoothness, float seed, int quality, bool isMask, float mask, float alpha, out float calpha) 4119 { 4120 // Prevent scale of zero 4121 scale = max(abs(scale), 0.001); 4122 4123 vec3 st = position / size; 4124 st /= scale; 4125 4126 ${l} 4127 4128 float lalpha = alpha * color.a * mask; 4129 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 4130 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 4131 4132 return clamp(color, 0.0, 1.0).rgb; 4133 }`,[AA.simplexFast,AA.simplexFractal,AA.simplexAshima,AA.fbm,AA.perlin,AA.voronoi]),c=e.include(h),d=[];return d.push(this.scale.build(e,"f")),d.push(this.size.build(e,"v3")),d.push(this.move.build(e,"f")),d.push(this.fA.build(e,"v2")),d.push(this.fB.build(e,"v2")),d.push(this.distortion.build(e,"v2")),d.push(this.colorA.build(e,"v4")),d.push(this.colorB.build(e,"v4")),d.push(this.colorC.build(e,"v4")),d.push(this.colorD.build(e,"v4")),d.push(this.voronoiStyle.build(e,"i")),d.push(this.highCut.build(e,"f")),d.push(this.lowCut.build(e,"f")),d.push(this.smoothness.build(e,"f")),d.push(this.seed.build(e,"f")),d.push(this.quality.build(e,"i")),d.push(this.isMask.build(e,"b")),d.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),d.push(this.alpha.build(e,"f")),d.push(this.calpha),e.format(c+"("+d.join(",")+")",this.getType(e),t)}};AM.numOctaves=5;var AE=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d,p,f,m,g,v,y){super("v3"),this.nodeType="Outline",this.firstTime=!0,this.outlineColor=e,this.contourColor=t,this.outlineWidth=i,this.contourWidth=r,this.contourThreshold=a,this.outlineThreshold=o,this.contourFrequency=l,this.outlineSmoothing=h,this.contourDirection=c,this.positionalLines=d,this.compensation=p,this.resolution=f,this.normalMap=m,this.depthMap=g,this.pixelRatio=v,this.alpha=y,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`;if(e.require("vWorldViewDir"),e.require("worldNormal"),e.extensions.derivatives=!0,this.compensation.value&&e.define("OUTLINE_COMPENSATION",`${i}_offset`),this.firstTime){let t=this.outlineWidth.build(e,"f"),r=this.resolution.build(e,"v2"),a=this.compensation.build(e,"b"),o=this.pixelRatio.build(e,"f");e.addVertexParsVariable("randomColor","attribute vec3"),e.addVertexParsVariable("extrudeNormal","attribute vec3"),e.addVertexParsVariable(t,"uniform float"),e.addVertexParsVariable(r,"uniform vec2"),e.addVertexParsVariable(a,"uniform bool"),e.addVertexParsVariable(o,"uniform float"),e.addVertexParsVariable("vID","flat out float"),e.addFragmentParsVariable("vID","flat in float"),e.addVertexFinalCode(` 4134 vID = randomColor.r; 4135 vec2 ${i}_offset = vec2(0.0); 4136 if (${a}) { 4137 vec4 ${i}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0)); 4138 // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the 4139 // normals face the camera directly. So we hackily fix this by offsetting the normal 4140 // by a tiny amount. 4141 vec3 ${i}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001; 4142 ${i}_offset = normalize(${i}_clipNormal.xy) / ${r} * (${t} / 2.0) * ${i}_clipPosition.w * 2.0 * ${o}; 4143 ${i}_clipPosition.xy += ${i}_offset; 4144 // TODO(MAX): To handle multiple outline layers, we only want to extrude 4145 // if this offset is the biggest of all the potential offsets 4146 gl_Position = ${i}_clipPosition; 4147 } 4148 `)}if(!e.isShader("fragment"))return console.warn("OutlineNode is not compatible with "+e.shader+" shader."),"";{e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(AE.Nodes.outline),r=[];return r.push(this.outlineColor.build(e,"c")),r.push(this.contourColor.build(e,"c")),r.push(this.outlineWidth.build(e,"f")),r.push(this.contourWidth.build(e,"f")),r.push(this.contourThreshold.build(e,"f")),r.push(this.outlineThreshold.build(e,"f")),r.push(this.contourFrequency.build(e,"f")),r.push(this.outlineSmoothing.build(e,"f")),r.push(this.contourDirection.build(e,"v3")),r.push(this.positionalLines.build(e,"b")),r.push(this.resolution.build(e,"v2")),r.push(this.normalMap.getTexture(e,"t")),r.push(this.depthMap.getTexture(e,"t")),r.push(this.pixelRatio.build(e,"f")),r.push(this.compensation.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),this.firstTime=!this.firstTime,e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};AE.Nodes=(e0=new _F(` 4149float sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio) 4150{ 4151 vec2 halton = haltonSequence[frameIndex]; 4152 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 4153 float temporalAngle = temporalOffset * PI2; 4154 4155 vec2 texelSize = (vec2(1.0) / resolution); 4156 vec2 offsetSize = texelSize * outlineWidth * pixelRatio; 4157 4158 vec2 uvSamples[9]; 4159 vec4 normalSamples[9]; 4160 4161 uvSamples[0] = uv + vec2( -offsetSize.x, -offsetSize.y) + (vogelDiskSample(0, 9, temporalAngle) * texelSize); 4162 uvSamples[1] = uv + vec2(0.0, -offsetSize.y) + (vogelDiskSample(1, 9, temporalAngle) * texelSize); 4163 uvSamples[2] = uv + vec2( offsetSize.x, -offsetSize.y) + (vogelDiskSample(2, 9, temporalAngle) * texelSize);
4164 uvSamples[3] = uv + vec2( -offsetSize.x, 0.0) + (vogelDiskSample(3, 9, temporalAngle) * texelSize); 4165 uvSamples[4] = uv; 4166 uvSamples[5] = uv + vec2( offsetSize.x, 0.0) + (vogelDiskSample(5, 9, temporalAngle) * texelSize); 4167 uvSamples[6] = uv + vec2( -offsetSize.x, offsetSize.y) + (vogelDiskSample(6, 9, temporalAngle) * texelSize); 4168 uvSamples[7] = uv + vec2(0.0, offsetSize.y) + (vogelDiskSample(7, 9, temporalAngle) * texelSize); 4169 uvSamples[8] = uv + vec2( offsetSize.x, offsetSize.y) + (vogelDiskSample(8, 9, temporalAngle) * texelSize); 4170 4171 4172 normalSamples[0] = texture2D(t, uvSamples[0]); 4173 normalSamples[1] = texture2D(t, uvSamples[1]); 4174 normalSamples[2] = texture2D(t, uvSamples[2]); 4175 normalSamples[3] = texture2D(t, uvSamples[3]); 4176 normalSamples[4] = texture2D(t, uvSamples[4]); 4177 normalSamples[5] = texture2D(t, uvSamples[5]); 4178 normalSamples[6] = texture2D(t, uvSamples[6]); 4179 normalSamples[7] = texture2D(t, uvSamples[7]); 4180 normalSamples[8] = texture2D(t, uvSamples[8]); 4181 4182 float depthBias = 0.0001; 4183 // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?! 4184 if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) { 4185 float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias; 4186 if (gl_FragCoord.z > depthAtSample) { 4187 return 0.0; 4188 } 4189 } 4190 4191 if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) { 4192 float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias; 4193 if (gl_FragCoord.z > depthAtSample) { 4194 return 0.0; 4195 } 4196 } 4197 4198 if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) { 4199 float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias; 4200 if (gl_FragCoord.z > depthAtSample) { 4201 return 0.0; 4202 } 4203 } 4204 4205 if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) { 4206 float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias; 4207 if (gl_FragCoord.z > depthAtSample) { 4208 return 0.0; 4209 } 4210 } 4211 4212 4213 if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) { 4214 float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias; 4215 if (gl_FragCoord.z > depthAtSample) { 4216 return 0.0; 4217 } 4218 } 4219 4220 if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) { 4221 float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias; 4222 if (gl_FragCoord.z > depthAtSample) { 4223 return 0.0; 4224 } 4225 } 4226 4227 if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) { 4228 float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias; 4229 if (gl_FragCoord.z > depthAtSample) { 4230 return 0.0; 4231 } 4232 } 4233 4234 if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) { 4235 float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias; 4236 if (gl_FragCoord.z > depthAtSample) { 4237 return 0.0; 4238 } 4239 } 4240 4241 if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) { 4242 float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias; 4243 if (gl_FragCoord.z > depthAtSample) { 4244 return 0.0; 4245 } 4246 } 4247 4248 vec3 sobel_edge_h = normalSamples[2].rgb + (2.0*normalSamples[5].rgb) + normalSamples[8].rgb - (normalSamples[0].rgb + (2.0*normalSamples[3].rgb) + normalSamples[6].rgb); 4249 vec3 sobel_edge_v = normalSamples[0].rgb + (2.0*normalSamples[1].rgb) + normalSamples[2].rgb - (normalSamples[6].rgb + (2.0*normalSamples[7].rgb) + normalSamples[8].rgb); 4250 4251 float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v)); 4252 return edgeNormal; 4253} 4254`),{outline:new _F(`vec3 outline(vec3 outlineColor, vec3 contourColor, float outlineWidth, float contourWidth, float outlineThreshold, float contourThreshold, float outlineSmoothing, float contourFrequency, vec3 contourDirection, bool positionalLines, vec2 resolution, sampler2D normalMap, sampler2D depthMap, float pixelRatio, bool compensation, float mask, float alpha, out float calpha) { 4255 vec3 result = outlineColor; 4256 float resultAlpha = 0.0; 4257 4258 vec3 N = normalize(vWNormal); 4259 vec2 nuv = (gl_FragCoord.xy / resolution); 4260 float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio); 4261 resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample); 4262 4263 //resultAlpha = 1.0; 4264 //result = vec3(sobelSample); 4265 4266 float t = 1.0 - contourThreshold; 4267 if(positionalLines) { 4268 vec3 NDir = position * contourDirection; 4269 float NT = NDir.x + NDir.y + NDir.z; 4270 float f = fract(NT * contourFrequency * 0.01); 4271 float df = fwidth(NT * contourFrequency); 4272 4273 float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f); 4274 if (g < 1.0 && resultAlpha == 0.0) { 4275 result = contourColor; 4276 resultAlpha = 1.0; 4277 } 4278 } 4279 else { 4280 vec3 NDir = N * contourDirection; 4281 float NT = NDir.x + NDir.y + NDir.z; 4282 float df = fwidth(NT * contourThreshold); 4283 float f = sin(NT * 1.0 * contourFrequency); 4284 float g = smoothstep(0.0, df * contourWidth, 1.0 - f); 4285 4286 if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) { 4287 result = contourColor; 4288 resultAlpha = 1.0 - g; 4289 } 4290 } 4291
4292 float lalpha = alpha * resultAlpha * mask; 4293 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 4294 accumAlpha += ( 1.0 - accumAlpha ) * lalpha; 4295 4296 return result; 4297 }`,[e0])});var AC=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d,p,f,m,g,v,y,x,b){super("v3"),this.nodeType="Pattern",this.style=e,this.projection=t,this.axis=i,this.blending=r,this.offset=a,this.colorA=o,this.colorB=l,this.frequency=h,this.size=c,this.variation=d,this.smoothness=p,this.zigzag=f,this.rotation=m,this.vertical=g,this.horizontal=v,this.sides=y,this.isMask=b,this.alpha=x,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(!e.isShader("fragment"))return console.warn("PatterNode is not compatible with "+e.shader+" shader."),e.format("vec3(0.0)",this.getType(e),t);{let i;switch(e.require("position"),e.require("uv"),e.requires.uv=[!0],e.require("normal"),e.requires.normal=!0,e.addFragmentVariable(this.calpha,"float"),this.style.value){case 0:default:i="circle";break;case 1:i="ring";break;case 2:i="polygon";break;case 3:i="xcross";break;case 4:i="diamond";break;case 5:i="checkerboard";break;case 6:i="line";break;case 7:i="wave"}let r=`g${this.uuid.toString().replace(/-/g,"")}`,a=new _F(`float hashwithoutsine12(vec2 p) 4298 { 4299 vec3 p3 = fract(vec3(p.xyx) * .1031); 4300 p3 += dot(p3, p3.yzx + 33.33); 4301 return fract((p3.x + p3.y) * p3.z); 4302 }`),o=new _F(`vec2 rotate_uv(in vec2 uv, float a, bool repeat) 4303 { 4304 const float mid = 0.5; 4305 float radians = a * (PI / 180.0); 4306 vec2 rotated = vec2( 4307 cos(radians) * (uv.x - mid) + sin(radians) * (uv.y - mid) + mid, 4308 cos(radians) * (uv.y - mid) - sin(radians) * (uv.x - mid) + mid 4309 ); 4310 return repeat ? fract(rotated): rotated; 4311 }`),l="";if(4===this.projection.value){let e=2===this.style.value?`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,t=2===this.style.value?`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,r=2===this.style.value?`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)`;l=` 4312 vec3 p = position; 4313 float factor = 0.0125; 4314 vec2 uv0 = fract(p.xy * factor); 4315 vec2 uv1 = fract(p.zy * factor); 4316 vec2 uv2 = fract(p.xz * factor); 4317 4318 uv0 = rotate_uv(uv0 + offset, rotation, true); 4319 uv1 = rotate_uv(uv1 + offset, rotation, true); 4320 uv2 = rotate_uv(uv2 + offset, rotation, true); 4321 4322 float d0 = ${e}; 4323 float d1 = ${t}; 4324 float d2 = ${r}; 4325 4326 // Range from 3 to 128 seems to be good 4327 float exponent = (1.0 - blending) * 125.0 + 3.0; 4328 4329 vec3 n = vObjectNormal; 4330 vec3 weights = abs(normalize(n)); 4331 weights = pow(weights, vec3(exponent)); 4332 weights /= dot(weights, vec3(1.0)); 4333 d0 *= weights.z; 4334 d1 *= weights.x; 4335 d2 *= weights.y; 4336 float draw = d0 + d1 + d2; 4337 4338 vec2 custom_uv = uv0 * weights.z + uv1 * weights.x + uv2 * weights.y; 4339 `}else{let e=2===this.style.value?`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,t="";0===this.axis.value?t=`float radius = length(p); 4340 float theta = atan(p.y, p.z); 4341 float phi = acos(p.x / radius);`:1===this.axis.value?t=`float radius = length(p); 4342 float theta = atan(p.x, p.z); 4343 float phi = acos(p.y / radius);`:(this.axis.value,t=`float radius = length(p); 4344 float theta = atan(p.y, p.x); 4345 float phi = acos(p.z / radius);`);let r="";switch(this.projection.value){case 0:r="custom_uv = vUv.st;";break;case 1:case 3:break;case 2:r=` 4346 vec3 p = position; 4347 ${t} 4348 custom_uv = vec2(theta, phi); 4349 custom_uv /= PI; 4350 `}l=` 4351 vec2 custom_uv; 4352 ${r} 4353 4354 custom_uv += offset; 4355 custom_uv = fract(custom_uv); 4356 custom_uv = rotate_uv(custom_uv, rotation, true); 4357 4358 float draw = ${e}; 4359 `}let h=new _F(`vec3 ${r}_pattern(vec3 normal, float blending, int style, vec2 offset, vec4 colorA, vec4 colorB, vec2 frequency, float size, float variation, float smoothness, float zigzag, float rotation, vec2 vertical, vec2 horizontal, int sides, bool isMask, float mask, float alpha, out float calpha) { 4360 const float TWO_PI = PI * 2.0; 4361 float smoothness_remapped = pow(smoothness, 5.0); 4362 4363 ${l} 4364 4365 // Construct final output color 4366 vec4 color = mix(colorA, colorB, draw); 4367 color.a = clamp(color.a, 0.0, 1.0); 4368 4369 // Apply cuts 4370 color.a *= 4371 step(vertical.x, custom_uv.y) * 4372 step(custom_uv.y, vertical.y); 4373 color.a *= 4374 step(horizontal.x, abs(custom_uv.x)) * 4375 step(abs(custom_uv.x), horizontal.y); 4376 4377 // Accumulate alpha
4378 float lalpha = alpha * clamp(color.a, 0.0, 1.0) * mask; 4379 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 4380 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 4381 4382 return clamp(color, 0.0, 1.0).rgb; 4383 }`,[o,a,AC.DrawFunctions.circle,AC.DrawFunctions.ring,AC.DrawFunctions.polygon,AC.DrawFunctions.cross,AC.DrawFunctions.diamond,AC.DrawFunctions.checkerboard,AC.DrawFunctions.line,AC.DrawFunctions.wave]),c=e.include(h),d=[];return d.push("normal"),d.push(this.blending.build(e,"f")),d.push(this.style.build(e,"i")),d.push(this.offset.build(e,"v2")),d.push(this.colorA.build(e,"v4")),d.push(this.colorB.build(e,"v4")),d.push(this.frequency.build(e,"v2")),d.push(this.size.build(e,"f")),d.push(this.variation.build(e,"f")),d.push(this.smoothness.build(e,"f")),d.push(this.zigzag.build(e,"f")),d.push(this.rotation.build(e,"f")),d.push(this.vertical.build(e,"v2")),d.push(this.horizontal.build(e,"v2")),d.push(this.sides.build(e,"i")),d.push(this.isMask.build(e,"b")),d.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),d.push(this.alpha.build(e,"f")),d.push(this.calpha),e.format(c+"("+d.join(",")+")",this.getType(e),t)}}};AC.DrawFunctions=(e1=new _F(`float hashwithoutsine12(vec2 p) { 4384 vec3 p3 = fract(vec3(p.xyx) * 0.1031); 4385 p3 += dot(p3, p3.yzx + 33.33); 4386 return fract((p3.x + p3.y) * p3.z); 4387 }`),e2=new _F(`vec2 tile_and_center(in vec2 uv, in vec2 frequency, in float variation, in float zigzag, in float rotation) { 4388 // Create tiles in UV-space 4389 uv *= frequency; 4390 4391 // Integer coords 4392 vec2 i = floor(uv); 4393 4394 // Offset every other row based on zigzag param, then compute fractional coords 4395 float row_offset = mod(i.y, 2.0); 4396 uv.x += row_offset * zigzag; 4397 vec2 f = fract(uv); 4398 4399 // Rotate the tile itself: 4400 // const float mid = 0.5; 4401 // f = vec2( 4402 // cos(rotation) * (f.x - mid) + sin(rotation) * (f.y - mid) + mid, 4403 // cos(rotation) * (f.y - mid) - sin(rotation) * (f.x - mid) + mid 4404 // ); 4405 // f = fract(f); 4406 4407 f = f * 2.0 - 1.0; 4408 4409 // Recompute integer coords after shifting - then, random value per tile 4410 i = floor(uv); 4411 float rand = (hashwithoutsine12(i) * 5.0 + 1.0); 4412 float jitter = mix(1.0, rand, variation); 4413 f *= jitter; 4414 4415 return f; 4416 }`,[e1]),e3=new _F(`float circle(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4417 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4418 return smoothstep( 4419 -smoothness, 4420 smoothness, 4421 length(f) - size 4422 ); 4423 }`,[e2]),e4=new _F(`float ring(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4424 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4425 4426 float d = length(f); 4427 const float inner_width = 0.5; 4428 4429 float outer = smoothstep(-smoothness, smoothness, d - size); 4430 float inner = smoothstep(-smoothness, smoothness, d - size * inner_width); 4431 return outer + (1.0 - inner); 4432 }`,[e2]),e5=new _F(`float sdf_ngon(in vec2 p, in float r, in int n) { 4433 float an = (PI * 2.0) / float(n); 4434 float he = r * tan(0.5 * an); 4435 4436 // Rotate to first sector 4437 p = -p.yx; 4438 float bn = an * floor((atan(p.y, p.x) + 0.5 * an) / an); 4439 vec2 cs = vec2(cos(bn), sin(bn)); 4440 p = mat2(cs.x, -cs.y, cs.y, cs.x)*p; 4441 4442 // Side of polygon 4443 return length(p - vec2(r, clamp(p.y, -he, he))) * sign(p.x - r); 4444 } 4445 4446 float polygon(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation, in int sides) { 4447 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4448 return smoothstep(-smoothness, smoothness, sdf_ngon(f, size, sides)); 4449 }`,[e2]),e6=new _F(`float sdf_cross(in vec2 p, in vec2 b, float r ) { 4450 p = abs(p);
4451 p = (p.y > p.x) ? p.yx : p.xy; 4452 vec2 q = p - b; 4453 float k = max(q.y, q.x); 4454 vec2 w = (k > 0.0) ? q : vec2(b.y - p.x, -k); 4455 return sign(k) * length(max(w, 0.0)) + r; 4456 } 4457 4458 // Avoid namespace conflicts 4459 float xcross(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4460 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4461 return smoothstep(-smoothness, smoothness, sdf_cross(f, vec2(size, size * 0.25), smoothness)); 4462 }`,[e2]),e8=new _F(`float ndot(vec2 a, vec2 b) { 4463 return a.x*b.x - a.y*b.y; 4464 } 4465 4466 float sdf_diamond(in vec2 p, in vec2 b) { 4467 p = abs(p); 4468 float h = clamp(ndot(b - 2.0 * p, b) / dot(b, b), -1.0, 1.0); 4469 float d = length(p - 0.5 * b * vec2(1.0 - h, 1.0 + h)); 4470 return d * sign(p.x * b.y + p.y * b.x - b.x * b.y); 4471 } 4472 4473 float diamond(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4474 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4475 return smoothstep(-smoothness, smoothness, sdf_diamond(f, vec2(size))); 4476 }`,[e2]),e9=new _F(`float checkerboard(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4477 uv *= frequency; 4478 vec2 i = floor(uv); 4479 4480 float offset = mod(i.y, 2.0); 4481 4482 uv.x += offset + zigzag * offset; 4483 float x = floor(uv.x); 4484 4485 return mod(x, 2.0); 4486 }`),e7=new _F(`float line(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4487 vec2 f = tile_and_center(uv, frequency, 0.0, zigzag, rotation); 4488 4489 // Different approach for variation param here 4490 float row = floor(uv * frequency).y; 4491 float rand = hashwithoutsine12(vec2(row)); 4492 float s = mix(size, size * rand, variation); 4493 4494 return smoothstep( 4495 s - smoothness, 4496 s + smoothness, 4497 abs(f.y) 4498 ); 4499 }`,[e2]),{tileAndCenter:e2,circle:e3,ring:e4,polygon:e5,cross:e6,diamond:e8,checkerboard:e9,line:e7,wave:new _F(`// Uses bisection 4500 float udf_cos(in vec2 p, in float a, in float b, in float c, in float d) { 4501 // Convert all data to a primitive cosine wave 4502 p = c * (p - vec2(d, a)); 4503 4504 const float TWO_PI = PI * 2.0; 4505 4506 // Reduce to principal half cycle 4507 p.x = mod(p.x, TWO_PI); 4508 if (p.x > PI) { 4509 p.x = TWO_PI - p.x; 4510 } 4511 4512 // Find zero of derivative (minimize distance) 4513 float xa = 0.0; 4514 float xb = TWO_PI; 4515 4516 // 24 bit precision 4517 for (int i = 0; i < 24; i++) { 4518 float x = 0.5 * (xa + xb); 4519 float y = x - p.x + b * c * sin(x) * (p.y - b * c * cos(x)); 4520 if (y < 0.0) xa = x; 4521 else xb = x; 4522 } 4523 float x = 0.5 * (xa + xb); 4524 4525 // Compute distance 4526 vec2 q = vec2(x, b * c * cos(x)); 4527 return length(p - q) / c; 4528 } 4529 4530 float wave(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4531 float repeat = frequency.x; 4532 uv *= repeat; 4533 vec2 i = floor(uv); 4534 float row_offset = mod(i.y, 2.0); 4535 uv.x += row_offset * zigzag; 4536 vec2 f = vec2(uv.x, fract(uv.y)); 4537 4538 // Generalized cosine: y(x) = a + b * cos(cx + d) 4539 const float amplitude = 0.125; 4540 float wave_frequency = frequency.y * 0.1; 4541 float distance_estimate = udf_cos(f, 0.50, amplitude, wave_frequency * (2.0 * PI), 0.0); 4542 4543 // Different approach for variation param here 4544 float rand = hashwithoutsine12(vec2(i.y)); 4545 float s = mix(size, size * rand, variation); 4546 4547 return smoothstep(-smoothness, smoothness, distance_estimate - s * 0.5); 4548 }`)});var AT=class extends _P{constructor(e,t,i,r,a,o,l,h){super("v3"),this.nodeType="Rainbow",this.filmThickness=e,this.movement=t,this.wavelengths=i,this.noiseStrength=r,this.noiseScale=a,this.offset=o,this.isMask=h,this.alpha=l,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),!e.isShader("fragment"))return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(AT.Nodes.rainbow),r=[];return r.push(this.filmThickness.build(e,"f")),r.push(this.movement.build(e,"f")),r.push(this.wavelengths.build(e,"v3")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.offset.build(e,"v3")),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};AT.Nodes=(te=new _F(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) { 4549 float f = 0.0; 4550 4551 if (noiseStrength != 0.0) { 4552 vec3 st = position / noiseScale; 4553 float noise = simplexFast(1.6 * st + vec3(1.8, 1.5, 1.9) * simplexFast(st) + vec3(1.7, 9.2, 1.0)); 4554 f = noise * noiseStrength; 4555 } 4556 4557 vec3 waves = wavelengths * vec3(1.0, 0.8, 0.6) + 1.0; 4558 float angle = dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal)); 4559 4560 mediump vec3 color = cos((((filmThickness + f) / waves) * angle) + movement); 4561 return .5 + .5 * color; 4562 }`,[AA.simplexFast]),{rainbow:new _F(`vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, bool isMask, float mask, float alpha, out float calpha) { 4563 mediump vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0); 4564 4565 float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0); 4566
4567 float lalpha = alpha * rainbowContribution * mask; 4568 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 4569 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 4570 4571 return res; 4572 }`,[te])});var AP=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d){super("v3"),this.nodeType="Toon",this.positioning=e,this.colors=t,this.steps=i,this.source=r,this.isWorldSpace=a,this.noiseStrength=o,this.noiseScale=l,this.shadowColor=h,this.offset=c,this.alpha=d,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("worldNormal"),e.require("worldPosition"),!e.isShader("fragment"))return console.warn("ToonNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("COLORS_MAX",10),e.addFragmentVariable(this.calpha,"float");let i=e.include(AP.Nodes.toon),r=[];return r.push(this.positioning.build(e,"i")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.source.build(e,"v3")),r.push(this.isWorldSpace.build(e,"b")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.shadowColor.build(e,"v4")),r.push(this.offset.build(e,"v3")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};AP.Nodes=(tt=new _F(`float rand(float n) { 4573 return fract(sin(n) * 43758.5453123); 4574 }`),ti=new _F(`float hash1(float p) { 4575 p = fract(p * 0.011); 4576 p *= p + 7.5; 4577 p *= p + p; 4578 return fract(p); 4579 }`),tr=new _F(`float valueNoise(vec3 x) { 4580 const vec3 step = vec3(110, 241, 171); 4581 4582 vec3 i = floor(x); 4583 vec3 f = fract(x); 4584 4585 // For performance, compute the base input to a 1D hash from the integer part of the argument and the 4586 // incremental change to the 1D based on the 3D -> 1D wrapping 4587 float n = dot(i, step); 4588 4589 vec3 u = f * f * (3.0 - 2.0 * f); 4590 return mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x), 4591 mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y), 4592 mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x), 4593 mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z); 4594 }`,[ti]),ts=new _F(`vec3 hash3(vec3 x) { 4595 x = vec3(dot(x,vec3(127.1, 311.7, 74.7)), 4596 dot(x,vec3(269.5, 183.3, 246.1)), 4597 dot(x,vec3(113.5, 271.9, 124.6))); 4598 4599 return fract(sin(x)*43758.5453123); 4600 }`),ta=new _F(`vec3 voronoiNoise(in vec3 x) 4601 { 4602 vec3 p = floor(x); 4603 vec3 f = fract(x); 4604 4605 float id = 0.0; 4606 vec2 res = vec2(100.0); 4607 4608 for(int k=-1; k<=1; k++) 4609 for(int j=-1; j<=1; j++) 4610 for(int i=-1; i<=1; i++) 4611 { 4612 vec3 b = vec3(float(i), float(j), float(k)); 4613 4614 // Comment out the "+ hash(p + b);" part below to get "square" cells 4615 vec3 r = vec3(b) - f + hash3(p + b); 4616 float d = dot(r, r); 4617 4618 if (d < res.x) 4619 { 4620 id = dot(p + b, vec3(1.0, 57.0, 113.0)); 4621 res = vec2(d, res.x); 4622 } 4623 else if (d < res.y) 4624 { 4625 res.y = d; 4626 } 4627 } 4628 4629 return vec3(sqrt(res), abs(id)); 4630 } 4631 `,[ts]),{toon:new _F(`vec3 toon(int positioning, vec4 colors[COLORS_MAX], float steps[COLORS_MAX], vec3 source, bool isWorldSpace, float noiseStrength, float noiseScale, vec4 shadowColor, vec3 offset, float mask, float alpha, out float calpha) { 4632 float t = 0.0; 4633 float shadow = 1.0; 4634 4635 if (positioning == 0) { 4636 4637 // Can't do this mode if lighting is "none" 4638 #if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD)) 4639 4640 // Algorithm from Chapter 10 of Graphics Shaders 4641 const vec3 weights = vec3(0.2125, 0.7154, 0.0721); 4642 vec3 lpos; 4643 vec3 l; 4644 float dproduct; 4645 4646 #if (NUM_POINT_LIGHTS > 0) 4647 4648 #if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0) 4649 PointLightShadow pointLightShadow; 4650 #endif 4651 4652 #pragma unroll_loop_start 4653 for (int i = 0; i < NUM_POINT_LIGHTS; i++) { 4654 // Light positions are in view-space for some reason? 4655 lpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0
4655)).xyz; 4656 l = normalize(lpos - worldPosition); 4657 4658 dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5; 4659 4660 // TODO: we want to use "intensity" but it isn't available in the shader code 4661 //dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights); 4662 4663 t = max(t, dproduct); 4664 4665 // Accumulate shadow contribution 4666 #if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS) 4667 pointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX]; 4668 shadow *= getPointShadow( 4669 pointShadowMap[UNROLLED_LOOP_INDEX], 4670 pointLightShadow.shadowMapSize, 4671 pointLightShadow.shadowBias, 4672 pointLightShadow.shadowRadius, 4673 vPointShadowCoord[UNROLLED_LOOP_INDEX], 4674 pointLightShadow.shadowCameraNear, 4675 pointLightShadow.shadowCameraFar); 4676 #endif 4677 } 4678 #pragma unroll_loop_end 4679 4680 #endif 4681 4682 #if NUM_DIR_LIGHTS > 0 4683 4684 #if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0) 4685 DirectionalLightShadow directionalLightShadow; 4686 #endif 4687 4688 #pragma unroll_loop_start 4689 for (int i = 0; i < NUM_DIR_LIGHTS; i++) { 4690 // Use the direction vector for directional lights instead 4691 l = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz; 4692 4693 dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5; 4694 t = max(t, dproduct); 4695 4696 // Accumulate shadow contribution 4697 #if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS) 4698 directionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX]; 4699 shadow *= getShadow( 4700 UNROLLED_LOOP_INDEX, 4701 directionalShadowMap[UNROLLED_LOOP_INDEX], 4702 directionalLightShadow.shadowMapSize, 4703 directionalLightShadow.shadowBias, 4704 directionalLightShadow.shadowRadius, 4705 vDirectionalShadowCoord[UNROLLED_LOOP_INDEX]); 4706 #endif 4707 } 4708 #pragma unroll_loop_end 4709 4710 #endif 4711 4712 #if NUM_SPOT_LIGHTS > 0 4713 4714 #if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0) 4715 SpotLightShadow spotLightShadow; 4716 #endif 4717 4718 #pragma unroll_loop_start 4719 for (int i = 0; i < NUM_SPOT_LIGHTS; i++) { 4720 lpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz; 4721 l = normalize(lpos - worldPosition); 4722 4723 dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5; 4724 t = max(t, dproduct); 4725 4726 // Accumulate shadow contribution 4727 #if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS) 4728 spotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX]; 4729 shadow *= getShadow( 4730 UNROLLED_LOOP_INDEX, 4731 spotShadowMap[UNROLLED_LOOP_INDEX], 4732 spotLightShadow.shadowMapSize, 4733 spotLightShadow.shadowBias, 4734 spotLightShadow.shadowRadius, 4735 vSpotLightCoord[UNROLLED_LOOP_INDEX]); 4736 #endif 4737 } 4738 #pragma unroll_loop_end 4739 4740 #endif 4741 4742 t = clamp(t, 0.0, 1.0); 4743 4744 #endif 4745 4746 } else if (positioning == 1) { 4747 4748 vec3 origin = mix(position, worldPosition, float(isWorldSpace)); 4749 vec3 direction = normalize(source - origin); 4750 t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5; 4751 4752 } else { 4753 4754 vec3 origin = worldPosition; 4755 vec3 source = cameraPosition - offset; 4756 vec3 direction = normalize(source - origin); 4757 t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5; 4758 4759 } 4760 4761 if (noiseStrength > 0.0) { 4762 // Distort with noise 4763 vec3 st = position / noiseScale; 4764 4765 // Voronoi "smooth" noise 4766 float noise = 1.0 - voronoiNoise(st).x; 4767 4768 // Voronoi cellular noise 4769 //float noise = 1.0 - rand(voronoiNoise(st).z); 4770 4771 // Position warp noise 4772 // vec3 offset = vec3( 4773 // simplexFast(st), 4774 // simplexFast(st + vec3(111.1, 143.89, 217.19)), 4775 // simplexFast(st + vec3(171.1, 247.89, 117.23)) 4776 // ); 4777 // st += offset; 4778 // float noise = valueNoise(st); 4779 4780 t += noise * noiseStrength; 4781 } 4782 4783 t = clamp(t, 0.0, 1.0); 4784 4785 // Compute ramp color 4786 float p; 4787 vec4 color = colors[0]; 4788 for (int i = 1; i < COLORS_MAX; i++) { 4789 p = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0); 4790 color = mix(color, colors[i], smoothstep(0.0, 1.0, p)); 4791 } 4792 4793 // Incorporate custom shadow color 4794 if (positioning == 0) { 4795 4796 vec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a); 4797 color.rgb = mix(blendedShadow, color.rgb, shadow); 4798 4799 } 4800 4801 // Accumulate alpha as usual
4802 float lalpha = alpha * color.a * mask; 4803 calpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0); 4804 accumAlpha += (1.0 - accumAlpha) * lalpha; 4805 4806 return color.xyz; 4807 4808 }`,[AA.simplexFast,tt,tr,ta])});var AD={textureBicubic:new _F(`float w0( float a ) { 4809 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 4810 } 4811 4812 float w1( float a ) { 4813 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 4814 } 4815 4816 float w2( float a ){ 4817 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 4818 } 4819 4820 float w3( float a ) { 4821 return ( 1.0 / 6.0 ) * ( a * a * a ); 4822 } 4823 4824 // g0 and g1 are the two amplitude functions 4825 float g0( float a ) { 4826 return w0( a ) + w1( a ); 4827 } 4828 4829 float g1( float a ) { 4830 return w2( a ) + w3( a ); 4831 } 4832 4833 // h0 and h1 are the two offset functions 4834 float h0( float a ) { 4835 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 4836 } 4837 4838 float h1( float a ) { 4839 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 4840 } 4841 4842 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 4843 uv = uv * texelSize.zw + 0.5; 4844 4845 vec2 iuv = floor( uv ); 4846 vec2 fuv = fract( uv ); 4847 4848 float g0x = g0( fuv.x ); 4849 float g1x = g1( fuv.x ); 4850 float h0x = h0( fuv.x ); 4851 float h1x = h1( fuv.x ); 4852 float h0y = h0( fuv.y ); 4853 float h1y = h1( fuv.y ); 4854 4855 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 4856 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 4857 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 4858 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 4859 4860 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 4861 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 4862 } 4863 4864 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 4865 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 4866 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 4867 vec2 fLodSizeInv = 1.0 / fLodSize; 4868 vec2 cLodSizeInv = 1.0 / cLodSize; 4869 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 4870 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 4871 return mix( fSample, cSample, fract( lod ) ); 4872 }`)},AO=class extends _P{constructor(e,t,i,r,a,o,l,h){super("v3"),this.nodeType="Transmission",this.thickness=e,this.ior=t,this.roughness=i,this.transmissionSamplerSize=r,this.transmissionSamplerMap=a,this.transmissionDepthMap=o,this.aspectRatio=l,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,!e.isShader("fragment"))return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("NUM_SAMPLES",6),e.define("BLUR_SLOD",Math.pow(2,AL.transmissionLod.value)),e.require("worldPosition"),e.requires.worldNormal=!0,e.requires.modelMatrix=!0,e.requires.projectionMatrix=!0,e.addFragmentVariable(this.calpha,"float");let i=e.include(AO.Nodes.transmission),r=[];return r.push(this.thickness.build(e,"f")),r.push(this.ior.build(e,"f")),r.push(this.roughness.build(e,"f")),r.push(this.transmissionSamplerSize.build(e,"v2")),r.push(this.transmissionSamplerMap.getTexture(e,"t")),r.push(this.transmissionDepthMap.getTexture(e,"t")),r.push(this.aspectRatio.build(e,"v2")),r.push("normal"),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};AO.Nodes=(tn=new _F(`vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) { 4873 // Slightly modified version of this: 4874 // https://www.shadertoy.com/view/ltScRG 4875 4876 // Special case for blur == 0.0 4877 if (lod == 0.0) { 4878 #ifdef TEXTURE_LOD_EXT 4879 return texture2DLodEXT( sp, U, 0.0).rgb; 4880 #else 4881 return textureLod( sp, U, 0.0).rgb; 4882 #endif 4883 } 4884 4885 vec2 texelSize = vec2(1.0) / resolution; 4886 vec2 halton = haltonSequence[frameIndex]; 4887 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 4888 float temporalAngle = temporalOffset * PI2; 4889 vec3 res = vec3(0.0); 4890 vec2 uv = vec2(0.0); 4891 vec2 offset = vec2(0.0); 4892 vec2 vogelSample = vec2(0.0); 4893 for (int i = 0; i < NUM_SAMPLES; i++) { 4894 vogelSample = vogelDiskSample(i, NUM_SAMPLES, temporalAngle) * texelSize; 4895 offset = vogelSample * scale * (lod * 10.0); // TODO: used to be hardcoded to 20 4896 uv = U + offset; 4897 float opaqueDepth = unpackRGBAToDepth(textureLod(dm, uv, lod)); 4898 if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) { 4899 uv = unrefractedU; 4900 lod = lod > 4.0 ? lod : lod / 2.0; 4901 } 4902 res += textureLod(sp, uv, lod).rgb; 4903 } 4904 return res / float(NUM_SAMPLES); 4905 }`),to=new _F(`vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) { 4906 // Direction of refracted light. 4907 vec3 refractionVector = refract( -v, n, 1.0 / ior ); 4908 4909 // Compute rotation-independant scaling of the model matrix. 4910 vec3 modelScale; 4911 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 4912 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 4913 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 4914 4915 // The thickness is specified in local space 4916 return normalize( refractionVector ) * thickness * modelScale; 4917 }`),tl=new _F(`float applyIorToRoughness( float roughness, float ior ) { 4918 // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and 4919 // an IOR of 1.5 results in the default amount of microfacet refraction. 4920 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 4921 }`),th=new _F(`vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) { 4922 // Threejs exports do not pass a depth map to this shader, so we have to fallback to the "Threejs method of blurring" - see 4923 // also the code in convertTransmission.ts, which runs during export 4924 #ifdef IS_THREEJS_EXPORT 4925 float lod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness / 5.0, ior); 4926 return textureBicubic(transmissionSamplerMap, fragCoord.xy, lod).rgb; 4927 #else 4928 float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 4929 float lod = applyIorToRoughness(roughness, ior); 4930 return blur(transmissionSamplerMap, fragCoord, vec2(lod), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio); 4931 #endif 4932 }`,[AD.textureBicubic,tl,tn]),tc=new _F(`vec3 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) { 4933 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 4934 vec3 refractedRayExit = position + transmissionRay; 4935 4936 // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. 4937 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 4938 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 4939 refractionCoords += 1.0; 4940 refractionCoords /= 2.0; 4941 4942 vec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 ); 4943 vec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w; 4944 unrefractedCoords += 1.0; 4945 unrefractedCoords /= 2.0; 4946 4947 // Sample framebuffer to get pixel the refracted ray hits. 4948 return getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio ); 4949 }`,[th,to]),{transmission:new _F(`vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float mask, float alpha, out float calpha) { 4950 vec3 v = vec3(0.); 4951 if (isOrthographic) { 4952 v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 4953 } else { 4954 v = normalize(vWPosition - cameraPosition); 4955 } 4956 vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness, vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio ); 4957
4958 float lalpha = alpha * mask; 4959 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 4960 accumAlpha += ( 1.0 - accumAlpha ) * alpha; 4961 4962 return transmission; 4963 }`,[tc])});var AI=((td=AI||{}).NOISE="noise",td.MAP="map",td),AR=class extends _P{constructor(e,t,i,r,a,o,l,h,c,d,p){super("v3"),this.displacementTypeIndex=new Aa(0),this.nodeType="VertexDisplacement",this.intensity=e,this.movementOrTexture=t,"map"===Object.values(AI)[this.displacementTypeIndex.value]&&(this.mat=new Ad(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=d,this.noiseFunctionIndex=p,this.voronoiStyle=r,this.smoothness=a,this.seed=o,this.highCut=l,this.lowCut=h,this.quality=c}generate(e,t){if(!e.isShader("vertex"))return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t);{e.define("USE_LAYER_DISPLACE");let i,r=[];switch(r.push("displaced_position"),r.push("displaced_normal"),Object.values(AI)[this.displacementTypeIndex.value]){case"map":i=e.include(AR.Nodes.map),r.push(this.movementOrTexture.getTexture(e,"t")),r.push("uv"),r.push(this.cropOrOffset.build(e,"f")),this.mat&&r.push(this.mat.build(e,"mat3"));break;case"noise":{let t=["simplexPrecise","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseFunctionIndex.value],a=new _F(`vec3 orthogonal(vec3 v) { 4964 return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y)); 4965 }`),o="voronoi"==t?` 4966 float v = ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1), voronoiStyle, smoothness, seed, quality); 4967 v = remap(v, lowCut, highCut, 0.0, 1.0); 4968 v = smax(v, 0.0, smoothness * 0.25); 4969 v = smin(v, 1.0, smoothness * 0.25); 4970 4971 return p + n * v * intensity; 4972 `:` 4973 return p + n * ${t}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity; 4974 `,l=new _F(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality) { 4975 ${o} 4976 }`,[AA.simplexPrecise,AA.simplexFractal,AA.simplexAshima,AA.fbm,AA.perlin,AA.voronoi]),h=new _F(`vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality, float intensity, out vec3 displaced_normal) { 4977 vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality); 4978 vec3 tangent1 = orthogonal(normal); 4979 vec3 tangent2 = normalize(cross(normal, tangent1)); 4980 4981 // TODO(Max): The distance to the neighbors was originally scaled by 0.1. 4982 // This caused some small oval/circular visual artifacts in the lighting. 4983 // For now, simply using neighbors further away betters the problem, 4984 // but we should figure out the underlying cause when we have some time. 4985 // Maybe its related to how we calculate the tangent and bitangent? 4986 vec3 nearby1 = position + tangent1; 4987 vec3 nearby2 = position + tangent2; 4988 vec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality); 4989 vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality); 4990 displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position)); 4991 return displaced_position; 4992 }`,[l,a]);i=e.include(h),r.push(this.scale.build(e,"f")),r.push(this.cropOrOffset.build(e,"v3")),r.push(this.movementOrTexture.build(e,"f")),r.push(this.voronoiStyle.build(e,"i")),r.push(this.smoothness.build(e,"f")),r.push(this.seed.build(e,"f")),r.push(this.highCut.build(e,"f")),r.push(this.lowCut.build(e,"f")),r.push(this.qual
4992ity.build(e,"i"))}}return r.push(this.intensity.build(e,"f")),r.push("displaced_normal"),e.format(i+"("+r.join(",")+")",this.getType(e),t)}}};AR.Nodes=(tu=new _F(`vec3 orthogonal(vec3 v) { 4993 return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y)); 4994 }`),tp=new _F(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) { 4995 vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset; 4996 vec4 tmp = texture2D(tex, uvs); 4997 vec3 col = tmp.rgb; 4998 if (crop > 0.5) { 4999 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 5000 return 0.0; 5001 } 5002 } 5003 return col.r; 5004 }`),{map:new _F(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) { 5005 vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity; 5006 vec3 tangent1 = normalize(orthogonal(normal)); 5007 vec3 tangent2 = normalize(cross(normal, tangent1)); 5008 vec3 nearby1 = position + tangent1 * 0.1; 5009 vec3 nearby2 = position + tangent2 * 0.1; 5010 vec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity; 5011 vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity; 5012 displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position)); 5013 return displaced_position; 5014 }`,[tu,tp])});var AL={normalRenderTarget:new _q,normalRenderTargetDepth:new _q,transmissionRenderTarget:new _q,aspectRatio:new _O,transmissionSize:new _O(2048,2048),transmissionRenderTargetDepth:new _q,aoRenderTarget:new _q,aoEnabled:new An,pixelRatioNode:new _X(1),resolution:new _O,penumbraSize:new Ao(5,.5),frameIndex:new Aa(0),transmissionLod:new Aa(2),taaEnabled:new An(!0)};for(let e of Object.values(AL))e.isRenderGlobal=!0;var AB,Az,AF,AN,AU,Ak={skiaWasmUrl:"https://unpkg.com/@splinetool/[email protected]/build/ui.wasm"},AV=class extends _E{constructor(){super("basic"),this.nodeType="Basic",this.color=new As(5526619),this.shadingAlpha=new _X(1),this.shadingBlend=new Aa(0),this.previousModelViewMatrix=new Au,this.previouseProjectionMatrix=new Au}get category(){return"phong"}generate(e){let t;if(e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({resolution:AL.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(sa.merge([sM.fog])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>"].join(` 5015`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5016 #include <skinbase_vertex> 5017 #include <skinnormal_vertex> 5018 #if !defined( USE_LAYER_DISPLACE ) 5019 #include <defaultnormal_vertex> 5020 #endif 5021 5022 vec3 displaced_position = position; 5023 vec3 displaced_normal = normal; 5024 5025 #if defined( USE_LAYER_DISPLACE ) 5026 vec3 transformed; 5027 vec3 transformedNormal; 5028 #endif 5029 `,"#include <normal_vertex>",` 5030 #if !defined( USE_LAYER_DISPLACE ) 5031 #include <begin_vertex> 5032 #endif /* !USE_LAYER_DISPLACE */ 5033 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5033":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5034`)}else{void 0===this.color&&(this.color=new As(5526619)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});let i=this.color.flow(e,"c",{slot:"color"}),r=this.alpha?this.alpha.flow(e,"f"):void 0,a=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,o=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=void 0!==r,e.addParsCode(["varying vec3 vWPosition;","#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#include <normal_pars_fragment>"].join(` 5035`));let l=["#include <normal_fragment_begin>",i.code];r&&l.push(r.code,"#ifdef ALPHATEST"," if ( "+r.result+" <= ALPHATEST ) discard;","#endif"),o?l.push(o.code,`vec3 outgoingLight = ${i.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${o.result}, 1.0, SPE_BLENDING_NORMAL);`):l.push(`vec3 finalColor = ${i.result};`);let h="1.0";this.mask&&(this.mask.analyze(e),h=`luminance(${this.mask.flow(e,"v3").result})`),r?l.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${r.result} * ${h} );`):l.push("gl_FragColor = vec4("+i.result+", 1.0 );"),a&&l.push(`gl_FragColor.a *= ${a.result};`),l.push("#include <fog_fragment>","#include <dithering_fragment>"),t=l.join(` 5036`)}return t}},Aj=class extends _E{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new As(5526619),this.emissive=new As(0),this.emissiveIntensity=new _X(1),this.previousModelViewMatrix=new Au,this.previouseProjectionMatrix=new Au,this.shadingAlpha=new _X(1),this.shadingBlend=new Aa(0),this.occlusion=new An(!0)}get category(){return"lambert"}build(e){let t;if(e.define("LAMBERT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({resolution:AL.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(sa.merge([sM.fog,sM.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <color_pars_vertex>","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5037`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5038 #include <skinbase_vertex> 5039 #include <skinnormal_vertex> 5040 #ifndef USE_LAYER_DISPLACE 5041 #include <defaultnormal_vertex> 5042 #endif 5043 5044 vec3 displaced_position = position; 5045 vec3 displaced_normal = objectNormal; 5046 5047 #ifdef USE_LAYER_DISPLACE 5048 vec3 transformed; 5049 vec3 transformedNormal; 5050 #endif 5051 `,"#include <normal_vertex>",` 5052 #ifndef USE_LAYER_DISPLACE 5053 #include <begin_vertex> 5054 #endif 5055 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5055":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>",` 5056 vec3 diffuse = vec3( 1.0 ); 5057 GeometricContext geometry; 5058 geometry.position = mvPosition.xyz; 5059 geometry.normal = normalize( transformedNormal ); 5060 geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); 5061 `),r.push(` 5062 GeometricContext backGeometry; 5063 backGeometry.position = geometry.position; 5064 backGeometry.normal = -geometry.normal; 5065 backGeometry.viewDir = geometry.viewDir; 5066 vLightFront = vec3( 0.0 ); 5067 vIndirectFront = vec3( 0.0 ); 5068 #ifdef DOUBLE_SIDED 5069 vLightBack = vec3( 0.0 ); 5070 vIndirectBack = vec3( 0.0 ); 5071 #endif 5072 IncidentLight directLight; 5073 float dotNL; 5074 vec3 directLightColor_Diffuse; 5075 vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); 5076 vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal ); 5077 #ifdef DOUBLE_SIDED 5078 vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); 5079 vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal ); 5080 #endif 5081 #if NUM_POINT_LIGHTS > 0 5082 #pragma unroll_loop_start 5083 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 5084 getPointLightInfo( pointLights[ i ], geometry, directLight ); 5085 dotNL = dot( geometry.normal, directLight.direction ); 5086 directLightColor_Diffuse = directLight.color; 5087 vLightFront += saturate( dotNL ) * directLightColor_Diffuse; 5088 #ifdef DOUBLE_SIDED 5089 vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; 5090 #endif 5091 } 5092 #pragma unroll_loop_end 5093 #endif 5094 #if NUM_SPOT_LIGHTS > 0 5095 #pragma unroll_loop_start 5096 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 5097 getSpotLightInfo( spotLights[ i ], geometry, directLight ); 5098 dotNL = dot( geometry.normal, directLight.direction ); 5099 directLightColor_Diffuse = directLight.color; 5100 vLightFront += saturate( dotNL ) * directLightColor_Diffuse; 5101 #ifdef DOUBLE_SIDED 5102 vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; 5103 #endif 5104 } 5105 #pragma unroll_loop_end 5106 #endif 5107 #if NUM_DIR_LIGHTS > 0 5108 #pragma unroll_loop_start 5109 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 5110 getDirectionalLightInfo( directionalLights[ i ], geometry, directLight ); 5111 dotNL = dot( geometry.normal, directLight.direction ); 5112 directLightColor_Diffuse = directLight.color; 5113 vLightFront += saturate( dotNL ) * directLightColor_Diffuse; 5114 #ifdef DOUBLE_SIDED 5115 vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; 5116 #endif 5117 } 5118 #pragma unroll_loop_end 5119 #endif 5120 #if NUM_HEMI_LIGHTS > 0 5121 #pragma unroll_loop_start 5122 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 5123 vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 5124 #ifdef DOUBLE_SIDED 5125 vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal ); 5126 #endif 5127 } 5128 #pragma unroll_loop_end 5129 #endif 5130 `," #include <shadowmap_vertex>"," #include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5131`)}else{e.mergeUniform({penumbraSize:AL.penumbraSize}),e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({aoMap:AL.aoRenderTarget}),e.mergeUniform({aoEnabled:AL.aoEnabled}),void 0===this.color&&(this.color=new As(5526619)),this.color.analyze(e,{slot:"color"}),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let i=this.color.flow(e,"c",{slot:"color"}),r=this.emissive.flow(e,"c",{slot:"emissive"}),a=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),o=this.occlusion.flow(e,"b",{slot:"occlusion"}
vendor: 6,231 bytes, lines 5131-5197
5131),l=this.shadingAlpha.flow(e,"f"),h=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,d=this.alpha?this.alpha.flow(e,"f"):void 0,p=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==d,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#include <normal_pars_fragment>","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <fog_pars_fragment>","#include <shadowmap_pars_fragment>","#include <shadowmask_pars_fragment>","#include <clipping_planes_pars_fragment>","#include <dithering_pars_fragment>"].join(` 5132`));let f=["#include <normal_fragment_begin>",` 5133 // NOTE: gl_FrontFacing alternative using face normal estimation. 5134 vec3 viewdx = dFdx(vViewPosition); 5135 vec3 viewdy = dFdy(vViewPosition); 5136 vec3 faceNormal = normalize(cross(viewdx, viewdy)); 5137 bool isFrontFacing = (dot(normal, faceNormal) >= 0.0); 5138 `,"#include <clipping_planes_fragment>"];f.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),d&&f.push(d.code,"#ifdef ALPHATEST","if ( "+d.result+" <= ALPHATEST ) discard;","#endif"),f.push("#ifdef DOUBLE_SIDED"," reflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else"," reflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED"," reflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else"," reflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),r&&f.push(r.code,"reflectedLight.directDiffuse += "+r.result+" * "+a.result+";"),f.push("vec3 ao = aoEnabled && "+o.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");let m="1.0";this.mask&&(this.mask.analyze(e),m=`luminance(${this.mask.flow(e,"v3").result})`),f.push(` 5139 if (outgoingLight != diffuseColor) { 5140 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5141 accumAlpha += ( 1.0 - accumAlpha ) * ${l.result} * ${m} * lightAccu; 5142 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result} * ${m}, ${h.result} ); 5143 5144 outgoingLight *= ao; 5145 } 5146 `),c&&f.push(c.code,`outgoingLight = spe_blend(outgoingLight, ${c.result}, 1.0, SPE_BLENDING_NORMAL);`),d?f.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${d.result} );`):f.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),p&&f.push(`gl_FragColor.a *= ${p.result};`),f.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=f.join(` 5147`)}return t}},AG={dHdxy:new _F(`vec2 dHdxy(sampler2D bumpMap, vec2 bumpMapUv, float bumpScale) { 5148 5149 // Gradient of UVs w.r.t. X coordinate (in screen-space) 5150 vec2 dSTdx = dFdx(bumpMapUv); 5151 5152 // Gradient of UVs w.r.t. Y coordinate (in screen-space) 5153 vec2 dSTdy = dFdy(bumpMapUv); 5154 5155 // Forward differencing 5156 float Hll = bumpScale * luminance(texture(bumpMap, bumpMapUv).rgb); 5157 float dBx = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdx).rgb) - Hll; 5158 float dBy = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdy).rgb) - Hll; 5159 5160 return vec2( dBx, dBy ); 5161 }`),perturbNormalArb:new _F(`vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 5162 vec3 vSigmaX = dFdx( surf_pos.xyz ); 5163 vec3 vSigmaY = dFdy( surf_pos.xyz ); 5164 vec3 vN = surf_norm; // normalized 5165 5166 vN = normalize(vN); 5167 5168 vec3 R1 = cross( vSigmaY, vN ); 5169 vec3 R2 = cross( vN, vSigmaX ); 5170 5171 R1 = normalize(R1); 5172 R2 = normalize(R2); 5173 5174 float fDet = dot( vSigmaX, R1 ) * faceDirection; 5175 5176 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 5177 return normalize( abs( fDet ) * vN - vGrad ); 5178 }`)},AH=class extends _E{constructor(){super("phong"),this.nodeType="Phong",this.color=new As(5526619),this.specular=new As(1118481),this.shininess=new _X(30),this.previousModelViewMatrix=new Au,this.previouseProjectionMatrix=new Au,this.shadingAlpha=new _X(1),this.shadingBlend=new Aa(0),this.occlusion=new An(!0)}get category(){return"phong"}build(e){let t;if(e.define("PHONG"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({resolution:AL.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(sa.merge([sM.fog,sM.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5179`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5180 #include <skinbase_vertex> 5181 #include <skinnormal_vertex> 5182 #ifndef USE_LAYER_DISPLACE 5183 #include <defaultnormal_vertex> 5184 #endif 5185 5186 vec3 displaced_position = position; 5187 vec3 displaced_normal = objectNormal; 5188 5189 #ifdef USE_LAYER_DISPLACE 5190 vec3 transformed; 5191 vec3 transformedNormal; 5192 #endif 5193 `,"#include <normal_vertex>",` 5194 #ifndef USE_LAYER_DISPLACE 5195 #include <begin_vertex> 5196 #endif 5197 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5197":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5198`)}else{e.mergeUniform({penumbraSize:AL.penumbraSize}),e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({aoMap:AL.aoRenderTarget}),e.mergeUniform({aoEnabled:AL.aoEnabled}),void 0===this.color&&(this.color=new As(5526619)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e);let i=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),a=this.specular.flow(e,"c"),o=this.shininess.flow(e,"f"),l=this.shadingAlpha.flow(e,"f"),h=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,d=this.alpha?this.alpha.flow(e,"f"):void 0,p=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==d,e.addParsCode(["varying vec3 vWPosition;","uniform vec3 emissive;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include <normal_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_phong_pars_fragment>","#include <shadowmap_pars_fragment>","#include <dithering_pars_fragment>"].join(` 5199`));let f=["#include <normal_fragment_begin>",` 5200 // NOTE: gl_FrontFacing alternative using face normal estimation. 5201 vec3 viewdx = dFdx(vViewPosition); 5202 vec3 viewdy = dFdy(vViewPosition); 5203 vec3 faceNormal = normalize(cross(viewdx,viewdy)); 5204 if (dot(normal, faceNormal) < 0.0) { 5205 normal *= -1.0; 5206 } 5207 `," BlinnPhongMaterial material;"];if(this.bumpMap){e.include(AG.dHdxy),e.include(AG.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",a="";a=4===this.bumpMap.projection.value?` 5208 vec3 bumpNormal = vec3(0.0); 5209 { 5210 vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5211 vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5212 vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5213 vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5214 5215 vec2 grad0 = dHdxy(${t.result}, uv0, ${r}); 5216 vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection); 5217 5218 vec2 grad1 = dHdxy(${t.result}, uv1, ${r}); 5219 vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection); 5220 5221 vec2 grad2 = dHdxy(${t.result}, uv2, ${r}); 5222 vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection); 5223 5224 bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y; 5225 bumpNormal = normalize(bumpNormal); 5226 } 5227 5228 normal = bumpNormal; 5229 `:` 5230 vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5231 vec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r}); 5232 normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection ); 5233 `,f.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5234 ${i.result}; 5235 ${a} 5236 `)}f.push(r.code," vec3 diffuseColor = "+r.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"," vec3 totalEmissiveRadiance = emissive;",a.code," vec3 specular = "+a.result+";",o.code," float shininess = max( 0.0001, "+o.result+" );"," float specularStrength = 1.0;"),d&&f.push(d.code,"#ifdef ALPHATEST","if ( "+d.result+" <= ALPHATEST ) discard;","#endif"),f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),f.push("vec3 ao = aoEnabled && "+i.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;");let m="1.0";this.mask&&(this.mask.analyze(e),m=`luminance(${this.mask.flow(e,"v3").result})`),f.push(` 5237 if (outgoingLight != diffuseColor) { 5238 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5239 accumAlpha += ( 1.0 - accumAlpha ) * ${l.result} * ${m} * lightAccu; 5240 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result} * ${m}, ${h.result} ); 5241 5242 outgoingLight *= ao; 5243 } 5244 `),c&&f.push(c.code,`outgoingLight = spe_blend(outgoingLight, ${c.result}, 1.0, SPE_BLENDING_NORMAL);`),d?f.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${d.result});`):f.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),p&&f.push(`gl_FragColor.a *= ${p.result};`),f.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=f.join(` 5245`)}return t}},AW=class extends _E{constructor(){super("standard"),this.nodeType="Standard",this.color=new As(5526619),this.roughness=new _X(.3),this.metalness=new _X(0),this.reflectivity=new _X(.5),this.previousModelViewMatrix=new Au,this.previouseProjectionMatrix=new Au,this.shadingAlp
vendor: 1,586 bytes, lines 5245-5264
5245ha=new _X(1),this.shadingBlend=new Aa(0),this.occlusion=new An(!0)}get category(){return"physical"}build(e){let t;if(e.define("STANDARD"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({resolution:AL.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(sa.merge([sM.fog,sM.lights])),sM.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5246`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5247 #include <skinbase_vertex> 5248 #include <skinnormal_vertex> 5249 #if !defined( USE_LAYER_DISPLACE ) 5250 #include <defaultnormal_vertex> 5251 #endif 5252 5253 vec3 displaced_position = position; 5254 vec3 displaced_normal = objectNormal; 5255 5256 #if defined( USE_LAYER_DISPLACE ) 5257 vec3 transformed; 5258 vec3 transformedNormal; 5259 #endif 5260 `,"#include <normal_vertex>",` 5261 #if !defined( USE_LAYER_DISPLACE ) 5262 #include <begin_vertex> 5263 #endif /* !USE_LAYER_DISPLACE */ 5264 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5264":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5265`)}else{e.mergeUniform({penumbraSize:AL.penumbraSize}),e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({aoMap:AL.aoRenderTarget}),e.mergeUniform({aoEnabled:AL.aoEnabled});let i={gamma:!0};void 0===this.color&&(this.color=new As(5526619)),this.color.analyze(e,{slot:"color",context:i}),this.roughness.analyze(e),this.metalness.analyze(e);let r=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.reflectivity&&this.reflectivity.analyze(e);let a=this.color.flow(e,"c",{slot:"color",context:i}),o=this.roughness.flow(e,"f"),l=this.metalness.flow(e,"f"),h=this.shadingAlpha.flow(e,"f"),c=this.shadingBlend.flow(e,"i"),d=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,p=this.alpha?this.alpha.flow(e,"f"):void 0,f=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,m=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=void 0!==p,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include <normal_pars_fragment>","#include <dithering_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_physical_pars_fragment>","#include <shadowmap_pars_fragment>"].join(` 5266`));let g=["#include <clipping_planes_fragment>"," #include <normal_fragment_begin>",` 5267 // NOTE: gl_FrontFacing alternative using face normal estimation. 5268 vec3 viewdx = dFdx(vViewPosition); 5269 vec3 viewdy = dFdy(vViewPosition); 5270 vec3 faceNormal = normalize(cross(viewdx,viewdy)); 5271 if (dot(normal, faceNormal) < 0.0) { 5272 normal *= -1.0; 5273 } 5274 `," PhysicalMaterial material;"," material.diffuseColor = vec3( 1.0 );"];if(this.bumpMap){e.include(AG.dHdxy),e.include(AG.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",a="";a=4===this.bumpMap.projection.value?` 5275 vec3 bumpNormal = vec3(0.0); 5276 { 5277 vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5278 vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5279 vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5280 vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5281 5282 vec2 grad0 = dHdxy(${t.result}, uv0, ${r}); 5283 vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection); 5284 5285 vec2 grad1 = dHdxy(${t.result}, uv1, ${r}); 5286 vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection); 5287 5288 vec2 grad2 = dHdxy(${t.result}, uv2, ${r}); 5289 vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection); 5290 5291 bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y; 5292 bumpNormal = normalize(bumpNormal); 5293 } 5294 5295 normal = bumpNormal; 5296 `:` 5297 vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5298 vec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r}); 5299 normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection ); 5300 `,g.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5301 ${i.result}; 5302 ${a} 5303 `)}if(g.push(a.code," vec3 diffuseColor = "+a.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",l.code," float metalnessFactor = "+l.result+";"),this.roughnessMap){let t=this.roughnessMap.texture.flow(e,"t"),i=this.roughnessMap.flow(e,"v3"),r="";r=4===this.roughnessMap.projection.value?` 5304 float roughnessChange = 1.0; 5305 { 5306 vec2 uv0 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5307 vec2 uv1 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5308 vec2 uv2 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5309 vec3 weights = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5310 5311 float r0 = luminance(texture(${t.result}, uv0).rgb) * roughnessScale; 5312 float r1 = luminance(texture(${t.result}, uv1).rgb) * roughnessScale; 5313 float r2 = luminance(texture(${t.result}, uv2).rgb) * roughnessScale; 5314 5315 roughnessChange = (r0 * weights.z + r1 * weights.x + r2 * weights.y); 5316 } 5317 float roughnessFactor = roughnessChange * ${o.result}; 5318 `:` 5319 vec2 roughnessMapCachedUv = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5320 5321 vec4 vals = texture(${t.result}, roughnessMapCachedUv); 5322 float roughnessFactor = luminance(vals.rgb) * ${o.result}; 5323 `,g.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5324 ${i.result}; 5325 5326 const float roughnessScale = 1.0; 5327 5328 ${r} 5329 `)}else g.push(o.code," float roughnessFactor = "+o.result+";");p&&g.push(p.code,"#ifdef ALPHATEST"," if ( "+p.result+" <= ALPHATEST ) discard;","#endif"),g.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),g.push("material.diffuseColor = diffuseColor * ( 1.0 - metalnessFactor );","material.roughness = max( roughnessFactor, 0.0525 );","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.roughness = clamp( roughnessFactor, 0.04, 1.0 );"),m?g.push(m.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+m.result+" ) ), diffuseColor, metalnessFactor );"):g.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),g.push("#include <lights_fragment_begin>"),g.push("#include <lights_fragment_end>"),g.push("vec3 ao = aoEnabled && "+r.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular;");let v="1.0";this.mask&&(this.mask.analyze(e),v=`luminance(${this.mask.flow(e,"v3").result})`),g.push(` 5330 if (outgoingLight != diffuseColor) { 5331 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5332 accumAlpha += ( 1.0 - accumAlpha ) * ${h.result} * ${v} * lightAccu; 5333 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${h.result} * ${v}, ${c.result} ); 5334 5335 outgoingLight *= ao; 5336 } 5337 `),d&&g.push(d.code,`outgoingLight = spe_blend(outgoingLight, ${d.result}, 1.0, SPE_BLENDING_NORMAL);`),p?g.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${p.result} );`):g.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),f&&g.push(`gl_FragColor.a *= ${f.result};`),g.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=g.join(` 5338`)}return t}},Aq=class extends _E{constructor(){super("toon"),this.nodeType="Toon",this.color=new As(5526619),this.specular=new As(1118481),this.shininess=new _X(30),this.previousModelViewMatrix=new Au,this.previouseProjectionMatrix=new Au,this.shadingAlp
vendor: 1,393 bytes, lines 5338-5357
5338ha=new _X(1),this.shadingBlend=new Aa(0)}get category(){return"toon"}build(e){let t;if(e.define("TOON"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({resolution:AL.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(sa.merge([sM.fog,sM.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5339`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5340 #include <skinbase_vertex> 5341 #include <skinnormal_vertex> 5342 #ifndef USE_LAYER_DISPLACE 5343 #include <defaultnormal_vertex> 5344 #endif 5345 5346 vec3 displaced_position = position; 5347 vec3 displaced_normal = objectNormal; 5348 5349 #ifdef USE_LAYER_DISPLACE 5350 vec3 transformed; 5351 vec3 transformedNormal; 5352 #endif 5353 `,"#include <normal_vertex>",` 5354 #ifndef USE_LAYER_DISPLACE 5355 #include <begin_vertex> 5356 #endif 5357 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5357":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push(" #include <project_vertex>"," #include <fog_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5358`)}else{e.mergeUniform({penumbraSize:AL.penumbraSize}),e.mergeUniform({frameIndex:AL.frameIndex}),e.mergeUniform({aoMap:AL.aoRenderTarget}),e.mergeUniform({aoEnabled:AL.aoEnabled}),void 0===this.color&&(this.color=new As(5526619)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let i=this.color.flow(e,"c",{slot:"color"}),r=this.specular.flow(e,"c"),a=this.shininess.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),l=this.shadingBlend.flow(e,"i"),h=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,d=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==c,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vWPosition;","#include <normal_pars_fragment>","#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",` 5359 varying vec3 vViewPosition; 5360 struct ToonMaterial { 5361 vec3 diffuseColor; 5362 vec3 specularColor; 5363 float specularShininess; 5364 float specularStrength; 5365 }; 5366 void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 5367 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 5368 5369 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 5370 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 5371 } 5372 void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 5373 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 5374 } 5375 #define RE_Direct RE_Direct_Toon 5376 #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon 5377 #define Material_LightProbeLOD( material ) (0) 5378 `,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(` 5379`));let p=["#include <normal_fragment_begin>",` 5380 // NOTE: gl_FrontFacing alternative using face normal estimation. 5381 vec3 viewdx = dFdx(vViewPosition); 5382 vec3 viewdy = dFdy(vViewPosition); 5383 vec3 faceNormal = normalize(cross(viewdx,viewdy)); 5384 if (dot(normal, faceNormal) < 0.0) { 5385 normal *= -1.0; 5386 } 5387 `," ToonMaterial material;"];if(this.bumpMap){e.include(AG.dHdxy),e.include(AG.perturbNormalArb);let t=this.bumpMap.texture.flow(e,"t"),i=this.bumpMap.flow(e,"v3"),r=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",a="";a=4===this.bumpMap.projection.value?` 5388 vec3 bumpNormal = vec3(0.0); 5389 { 5390 vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5391 vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5392 vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5393 vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5394 5395 vec2 grad0 = dHdxy(${t.result}, uv0, ${r}); 5396 vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection); 5397 5398 vec2 grad1 = dHdxy(${t.result}, uv1, ${r});
5399 vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection); 5400 5401 vec2 grad2 = dHdxy(${t.result}, uv2, ${r}); 5402 vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection); 5403 5404 bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y; 5405 bumpNormal = normalize(bumpNormal); 5406 } 5407 5408 normal = bumpNormal; 5409 `:` 5410 vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5411 vec2 grad = dHdxy(${t.result}, bumpMapCachedUv, ${r}); 5412 normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection ); 5413 `,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5414 ${i.result}; 5415 ${a} 5416 `)}p.push(i.code," vec3 diffuseColor = "+i.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",r.code," vec3 specular = "+r.result+";",a.code," float shininess = max( 0.0001, "+a.result+" );"," float specularStrength = 1.0;"),c&&p.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),p.push("material.diffuseColor = diffuseColor;"),p.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),p.push("vec3 ao = aoEnabled ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * ao) + reflectedLight.directSpecular;");let f="1.0";this.mask&&(this.mask.analyze(e),f=`luminance(${this.mask.flow(e,"v3").result})`),p.push(` 5417 if (outgoingLight != diffuseColor) { 5418 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5419 accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu; 5420 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${l.result} ); 5421 } 5422 `),h&&p.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),c?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d&&p.push(`gl_FragColor.a *= ${d.result};`),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(` 5423`)}return t}},AX=class{constructor(e=1e4){this.timeout=e,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let e=t;(t=t.next).prev=this.head,this.head.next=t,e.next=null,e.prev=null,e.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return void 0===i?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){null!==this.cleanupTimer&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}},AY=class extends AX{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}},AQ=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,0===this.refCount&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},AZ=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return void 0===t&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}},AK=class extends AQ{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo="video"===e.type,this.isBuffer=!0===e.isWebGLRenderTarget,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1;let t=()=>{for(let e of(this.loaded=!0,Object.values(this._cache)))for(let t of Object.values(e))for(let e of Object.values(t))e&&(e.image=this.img,e.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInl
5423ine=!0,this.img.currentTime=.01,"string"!=typeof e){let t;var i=new FileReader;i.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise(e=>{i.onloadend=i=>{t=i.target?.result,e(null)}}),this.img.src=t}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else this.img=new Image,this.img.src="string"==typeof e?e:(AU||(AU=new AY),AU.load(e)),this.img.onload=t,await new Promise(e=>{this.img.onload=()=>{t(),e(null)}})}getTexture(e,t=1008,i=1006){let r=this._cache[e]?.[t]?.[i];if(r)return r;{let r;return r=this.isBuffer?this.img.texture:this.isVideo?new n5(this.img,void 0,e,e):new i_(this.img,void 0,e,e,i,t),this.loaded&&(r.needsUpdate=!0),void 0===this._cache[e]&&(this._cache[e]={}),void 0===this._cache[e][t]&&(this._cache[e][t]={}),this._cache[e][t][i]=r,r}}setNeedsUpdate(e){for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let t of Object.values(i))t&&(t.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,r]of Object.entries(t))for(let[t,a]of Object.entries(r))a?.dispose(),void 0!==this._cache[e]&&void 0!==this._cache[e][i]&&(this._cache[e][i][t]=void 0)}dispose(){super.dispose(),this.disposeTextures()}},AJ=class extends AK{},A$={year:0,month:1,day:2,hour:3,minute:4,second:5},A0={};function A1(e,t,i,r,a,o,l){var h=new Date(0);return h.setUTCFullYear(e,t,i),h.setUTCHours(r,a,o,l),h}var A2={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function A3(e,t,i){if(!e||(r=A2.timezoneZ.exec(e)))return 0;if(r=A2.timezoneHH.exec(e))return A5(o=parseInt(r[1],10))?-(36e5*o):NaN;if(r=A2.timezoneHHMM.exec(e)){o=parseInt(r[1],10);var r,a,o,l=parseInt(r[2],10);return A5(o,l)?(a=36e5*Math.abs(o)+6e4*l,o>0?-a:a):NaN}if(function(e){if(A6[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),A6[e]=!0,!0}catch{return!1}}(e)){t=new Date(t||Date.now());var h,c=A4(i?t:A1((h=t).getFullYear(),h.getMonth(),h.getDate(),h.getHours(),h.getMinutes(),h.getSeconds(),h.getMilliseconds()),e);return-(i?c:function(e,t,i){var r=e.getTime()-t,a=A4(new Date(r),i);if(t===a)return t;var o=A4(new Date(r-=a-t),i);return a===o?a:Math.max(a,o)}(t,c,e))}return NaN}function A4(e,t){var i,r,a,o=(a=function(e){if(!A0[e]){var t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));A0[e]="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return A0[e]}(t)).formatToParts?function(e,t){try{for(var i=e.formatToParts(t),r=[],a=0;a<i.length;a++){var o=A$[i[a].type];o>=0&&(r[o]=parseInt(i[a].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(a,e):(i=a.format(e).replace(/\u200E/g,""),[(r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i))[3],r[1],r[2],r[4],r[5],r[6]]),l=A1(o[0],o[1]-1,o[2],o[3]%24,o[4],o[5],0).getTime(),h=e.getTime(),c=h%1e3;return l-(h-=c>=0?c:1e3+c)}function A5(e,t){return -23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var A6={},A8=tL(tN(),1),A9=tL(tU(),1),A7={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function Me(e,t,i){t=t||0,i=i||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var a=7*t+i+1-(r.getUTCDay()||7);return r.setUTCDate(r.getUTCDate()+a),r}var Mt=[31,28,31,30,31,30,31,31,30,31,30,31],Mi=[31,29,31,30,31,30,31,31,30,31,30,31];function Mr(e){return e%400==0||e%4==0&&e%100!=0}function Ms(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var r=Mr(e);if(r&&i>Mi[t]||!r&&i>Mt[t])return!1}return!0}function Ma(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function Mn(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}function Mo(e,t){return t.color(e)}function Ml(e=new Date,t){var i,r,a,o,l,h;let c,d,p=t.format,f=e.getSeconds(),m=e;t&&null!==t.timeZone&&(i=new Date,r=t.timeZone,a=function(e,t){if(arguments.length<1)throw TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var i=t||{},r=null==i.additionalDigits?2:(0,A8.default)(i.additionalDigits);if(2!==r&&1!==r&&0!==r)throw RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if(!("string"==typeof e||"[object String]"===Object.prototype.toString.call(e)))return new Date(NaN);var a=function(e){var t,i={},r=A7.dateTimePattern.exec(e);if(r?(i.date=r[1],t=r[3]):(r=A7.datePattern.exec(e))?(i.date=r[1],t=r[2]):(i.date=null,t=e),t){var a=A7.timeZone.exec(t);a?(i.time=t.replace(a[1],""),i.timeZone=a[1].trim()):i.time=t}return i}(e),o=function(e,t){var i,r=A7.YYY[t],a=A7.YYYYY[t];if(i=A7.YYYY.exec(e)||a.exec(e)){var o=i[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(i=A7.YY.exec(e)||r.exec(e)){var l=i[1];return{year:100*parseInt(l,10),restDateString:e.slice(l.length)}}return{year:null}}(a.date,r),l=o.year,h=function(e,t){if(null===t)return null;
5423if(0===e.length)return(r=new Date(0)).setUTCFullYear(t),r;if(i=A7.MM.exec(e))return r=new Date(0),Ms(t,a=parseInt(i[1],10)-1)?(r.setUTCFullYear(t,a),r):new Date(NaN);if(i=A7.DDD.exec(e)){r=new Date(0);var i,r,a,o,l=parseInt(i[1],10);return!function(e,t){if(t<1)return!1;var i=Mr(e);return!(i&&t>366||!i&&t>365)}(t,l)?new Date(NaN):(r.setUTCFullYear(t,0,l),r)}if(i=A7.MMDD.exec(e)){r=new Date(0),a=parseInt(i[1],10)-1;var h=parseInt(i[2],10);return Ms(t,a,h)?(r.setUTCFullYear(t,a,h),r):new Date(NaN)}if(i=A7.Www.exec(e))return Ma(t,o=parseInt(i[1],10)-1)?Me(t,o):new Date(NaN);if(i=A7.WwwD.exec(e)){o=parseInt(i[1],10)-1;var c=parseInt(i[2],10)-1;return Ma(t,o,c)?Me(t,o,c):new Date(NaN)}return null}(o.restDateString,l);if(isNaN(h)||!h)return new Date(NaN);var c,d=h.getTime(),p=0;if(a.time&&isNaN(p=function(e){var t,i,r;if(t=A7.HH.exec(e))return Mn(i=parseFloat(t[1].replace(",",".")))?i%24*36e5:NaN;if(t=A7.HHMM.exec(e))return Mn(i=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")))?i%24*36e5+6e4*r:NaN;if(t=A7.HHMMSS.exec(e)){i=parseInt(t[1],10),r=parseInt(t[2],10);var a=parseFloat(t[3].replace(",","."));return Mn(i,r,a)?i%24*36e5+6e4*r+1e3*a:NaN}return null}(a.time)))return new Date(NaN);if(a.timeZone||i.timeZone){if(isNaN(c=A3(a.timeZone||i.timeZone,new Date(d+p))))return new Date(NaN)}else c=(0,A9.default)(new Date(d+p)),c=(0,A9.default)(new Date(d+p+c));return new Date(d+p+c)}(i,void 0),o=A3(r,a,!0),l=new Date(a.getTime()-o),(h=new Date(0)).setFullYear(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()),h.setHours(l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),l.getUTCMilliseconds()),m=h);let g=m.getHours(),v=m.getMinutes(),y;"12ampm"===t.format12h24h&&(y=g>=12?"PM":"AM");let x=g;switch("24"!==t.format12h24h&&0==(x=g%12)&&(x=12),p){case"HH:mm:ss":c=[x,v,f];break;case"HH:mm":c=[x,v];break;case"HH":c=[x],y=void 0;break;case"mm":c=[v],y=void 0;break;case"ss":c=[f],y=void 0;break;case"year":d=m.getFullYear();break;case"month":d=m.getMonth()+1;break;case"dayOfYear":d=Math.floor((m.getTime()-new Date(m.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":d=m.getDate();break;case"secondOfDay":d=3600*g+60*v+f;break;default:console.error("Unknown time format",p),d=0}return void 0!==c?{textValue:c,suffix:y}:d}function Mh(e,t){let{alpha:i,mode:r,isMask:a}=e,o="string"==typeof i?(Number(t.getVariable(i))??100)/100:i;return{type:e.type,alpha:o,mode:r,isMask:a}}var Mc=class extends _R{},Md={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},Mu={depth:["colors"]};function Mp(e,t){if(Array.isArray(t)){if(!Array.isArray(e)||e.length!==t.length)return!1;for(let[i,r]of t.entries()){let t=e[i];if("string"==typeof r||"number"==typeof r&&"string"==typeof t)return!0}return!1}let i="string"==typeof e,r="string"==typeof t;return i!==r||i&&r}function Mf(e,t,i){let r=i.uniforms[`f${i.id}_texture`];if(!r)return!1;let a=!1;if("image"in e){let i=e.image,a=t.image(i);r.image instanceof AJ||r.image.deref(),r.image=a}if("video"in e){let i=e.video,a=t.video(i);r.image instanceof AJ||r.image.deref(),r.image=a}if("wrapping"in e&&(r.wrap=e.wrapping),"minFilter"in e&&(r.minFilter=e.minFilter),"magFilter"in e&&(r.magFilter=e.magFilter),"rotation"in e&&i.uniforms[`f${i.id}_rotation`])return i.uniforms[`f${i.id}_rotation`].value=(Mg(e.rotation??0,t)??0)*t8.DEG2RAD,a;if("repeat"in e||"offset"in e||"rotation"in e){let r=i.uniforms[`f${i.id}_mat`];if(!r)return a;
5423if("repeat"in e){let o=e.repeat;Mp(i.data.texture.repeat,o)&&(a=!0),r.repeat=Mx(o,t).map((e,t)=>"string"==typeof o[t]?1/e:e)}if("offset"in e){let o=e.offset;Mp(i.data.texture.offset,o)&&(a=!0),r.offset=Mx(o,t).map((e,t)=>"string"==typeof o[t]?-e:e)}if("rotation"in e){let o=i.data.texture.rotation,l=e.rotation??0;(void 0===o||Mp(o,l))&&(a=!0),r.rotation=Mg(l,t)??0}r.updateMatrix()}return a}var Mm=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,Mg=(e,t,i)=>"number"==typeof e?e:t.getVariable(e,i),Mv=(e,t)=>(e||(e=new iD),e.x=Mg(e.x,t)??0,e.y=Mg(e.y,t)??0,e.z=Mg(e.z,t)??0,e),My=(e,t)=>(e||(e=new t9),e.x=Mg(e.x,t)??0,e.y=Mg(e.y,t)??0,e),Mx=(e,t)=>{let i=e.map(e=>Mg(e,t)??0);return[i[0],i[1]]},Mb=class{constructor(e,t,i,r,a){for(let a in this.id=e,this.uuid=t,this.data=i,this.uniforms={},r)this.uniforms[`f${this.id}_${a}`]=r[a];for(let e in i)MM(e,this,i,a)}get type(){return this.data.type}static create(e,t,i,r){if("light"===i.type)return M_.createLightLayer(e,t,i,r);if("texture"===i.type||"video"===i.type){let a="texture"===i.type?r.uiBuffer(i.texture.image)??r.image(i.texture.image):r.video(i.texture.video),o=new Ac(a,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),l=new Ah(a),h=new Af(Mx(i.texture.repeat,r),Mx(i.texture.offset,r),Mg(i.texture.rotation??0,r)),c=new _X(i.crop?1:0),d=new Aa(i.projection??0),p=new Aa(["x","y","z"].indexOf(i.axis)??0),f=new Aa(i.side??0),m=new _O(i.size?new t9(...Mx(i.size,r)):new t9(100,100)),g=new _X(i.blending??0),v=new _X(Mm(i.alpha,r)),y=new Aa(i.mode??0),x=new An(i.isMask??!1),b=new Ax(o,l,c,d,p,f,m,g,h,v,y,x),w=new _W(b.calpha,"f");return new Mw(e,t,i,{texture:o,textureSize:l,crop:c,projection:d,axis:p,side:f,size:m,blending:g,mat:h,alpha:v,mode:y,isMask:x},b,y,w,x,r)}if("matcap"===i.type){let a=new Ac(r.image(i.texture.image),i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),o=new _X(Mm(i.alpha,r)),l=new Aa(i.mode??0),h=new An(i.isMask??!1),c=new _X((Mg(i.texture.rotation??0,r)??0)*t8.DEG2RAD),d=new A_(a,o,l,h,c),p=new _W(d.calpha,"f");return new Mw(e,t,i,{texture:a,alpha:o,mode:l,isMask:h,rotation:c},d,l,p,h,r)}if("displace"!==i.type){let a;return a=function(e,t){switch(e.type){case"fresnel":return function(e,t){let{bias:i,scale:r,intensity:a,factor:o,color:l}=e;return{...Mh(e,t),color:Mo(l,t),bias:i,scale:r,intensity:a,factor:o}}(e,t);case"gradient":return function(e,t){let{gradientType:i,smooth:r,colors:a,steps:o,angle:l,offset:h,morph:c}=e;return{...Mh(e,t),gradientType:i,smooth:r,colors:a.map(e=>new iA(e[0],e[1],e[2],e[3])),num:a.length,steps:o,offset:new t9(...h.map(e=>"number"==typeof e?e:0)),morph:new t9(...c.map(e=>"number"==typeof e?e:0)),angle:l}}(e,t);case"depth":return function(e,t){let{gradientType:i,near:r,far:a,isVector:o,isWorldSpace:l,origin:h,direction:c,colors:d,steps:p,smooth:f}=e;return{...Mh(e,t),gradientType:i,near:r,far:a,isVector:o,isWorldSpace:l,origin:new iD(...h),direction:c?new iD(...c):new iD(1,0,0),colors:d.map(e=>void 0!==e?new iA(e[0],e[1],e[2],e[3]):new iA(0,0,0,0)),steps:p.slice(0,d.length),smooth:f}}(e,t);case"normal":return function(e,t){let{cnormal:i}=e;return{...Mh(e,t),cnormal:new iD(i[0],i[1],i[2])}}(e,t);case"noise":return{...Mh(e,t),scale:e.scale,move:e.move,fA:new t9(...e.fA.map(e=>"number"==typeof e?e:0)),fB:new t9(...e.fB.map(e=>"number"==typeof e?e:0)),size:new iD(...e.size),distortion:new t9(...e.distortion.map(e=>"number"==typeof e?e:0)),colorA:Mo(e.colorA,t),colorB:Mo(e.colorB,t),colorC:Mo(e.colorC,t),colorD:Mo(e.colorD,t),noiseType:e.noiseType,voronoiStyle:e.voronoiStyle,highCut:e.highCut,lowCut:e.lowCut,smoothness:e.smoothness,seed:e.seed,quality:e.quality};case"rainbow":return{...Mh(e,t),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new iD(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new iD(...e.offset)};case"toon":return{...Mh(e,t),positioning:e.positioning,colors:e.colors.map(e=>new iA(e[0],e[1],e[2],e[3])),num:e.colors.length,steps:e.steps,source:new iD(...e.source),isWorldSpace:e.isWorldSpace,noiseStrength:e.n
5423oiseStrength,noiseScale:e.noiseScale,shadowColor:Mo(e.shadowColor,t),offset:new iD(...e.offset)};case"outline":return{...Mh(e,t),outlineColor:Mo(e.outlineColor,t),contourColor:Mo(e.contourColor,t),outlineWidth:e.outlineWidth,contourWidth:e.contourWidth,outlineThreshold:e.outlineThreshold,contourThreshold:e.contourThreshold,outlineSmoothing:e.outlineSmoothing,contourFrequency:e.contourFrequency,contourDirection:new iD(...e.contourDirection),positionalLines:e.positionalLines,compensation:e.compensation};case"transmission":return{...Mh(e,t),thickness:e.thickness,ior:e.ior,roughness:e.roughness};case"pattern":return{...Mh(e,t),style:e.style,projection:e.projection,axis:e.axis,blending:e.blending,offset:new t9(...e.offset.map(e=>"number"==typeof e?e:0)),colorA:Mo(e.colorA,t),colorB:Mo(e.colorB,t),frequency:new t9(...e.frequency.map(e=>"number"==typeof e?e:0)),size:e.size,variation:e.variation,smoothness:e.smoothness,zigzag:e.zigzag,rotation:e.rotation,vertical:new t9(...e.vertical.map(e=>"number"==typeof e?e:0)),horizontal:new t9(...e.horizontal.map(e=>"number"==typeof e?e:0)),sides:e.sides};default:return{...Mh(e,t),color:Mo(e.color,t)}}}(i,r),function(e,t,i,r,a){switch(e.type){case"color":{let o=new As(r.color??5526619),l=MA(r),h=new Av(o,l.alpha),c=new _W(h.calpha,"f");return new Mw(t,i,e,{color:o,...l},h,l.mode,c,l.isMask,a)}case"fresnel":{let o=new As(r.color??16777215),l=new _X(Mg(r.bias,a)??.1),h=new _X(Mg(r.scale,a)??1),c=new _X(Mg(r.intensity,a)??2),d=new _X(Mg(r.factor,a)??1),p=MA(r),f=new Aw(o,l,h,c,d,p.alpha,p.mode,p.isMask),m=new _W(f.calpha,"f");return new Mw(t,i,e,{color:o,bias:l,scale:h,intensity:c,factor:d,...p},f,p.mode,m,p.isMask,a)}case"rainbow":{let o=new _X(Mg(r.filmThickness,a)??30),l=new _X(Mg(r.movement,a)??0),h=new _I(Mv(r.wavelengths,a)),c=new _X(Mg(r.noiseStrength,a)??0),d=new _X(Mg(r.noiseScale,a)??1),p=new _I(Mv(r.offset,a)),f=MA(r),m=new AT(o,l,h,c,d,p,f.alpha,f.isMask),g=new _W(m.calpha,"f");return new Mw(t,i,e,{filmThickness:o,movement:l,wavelengths:h,noiseStrength:c,noiseScale:d,offset:p,...f},m,f.mode,g,f.isMask,a)}case"transmission":{let o=new _X(Mg(r.thickness??10,a)),l=new _X(Mg(r.ior??1.5,a)),h=new _X(Mg(r.roughness??.5,a)),c=AL.transmissionSize,d=AL.transmissionRenderTarget,p=AL.transmissionRenderTargetDepth,f=window.innerWidth,m=window.innerHeight,g=f>=m?new _O(m/f,1):new _O(1,f/m),v=MA(r),y=new AO(o,l,h,c,d,p,g,v.alpha),x=new _W(y.calpha,"f");return new Mw(t,i,e,{thickness:o,ior:l,roughness:h,aspectRatio:g,...v},y,v.mode,x,v.isMask,a)}case"toon":{let o,l=new Aa(r.positioning??0),h;r.colors?h=new Am(r.colors.length,r.colors):(h=new Am(10,new iA(0,0,0,1))).value[1]=new iA(1,1,1,1),r.steps?o=new Ao(r.steps.length,r.steps):(o=new Ao(10,1)).value[0]=0;let c=new _I(Mv(r.source??new iD(0,0,0),a)),d=new An(r.isWorldSpace??!0),p=new _X(Mg(r.noiseStrength??0,a)),f=new _X(Mg(r.noiseScale??1,a)),m=new _L(r.shadowColor),g=new _I(Mv(r.offset??new iD(0,0,0),a)),v=MA(r),y=new AP(l,h,o,c,d,p,f,m,g,v.alpha),x=new _W(y.calpha,"f");return new Mw(t,i,e,{positioning:l,colors:h,steps:o,source:c,isWorldSpace:d,noiseStrength:p,noiseScale:f,shadowColor:m,offset:g,...v},y,v.mode,x,v.isMask,a)}case"outline":{let o=new As(r.outlineColor??16777215),l=new As(r.contourColor??16777215),h=new _X(Mg(r.outlineWidth??.1,a)),c=new _X(Mg(r.contourWidth??.1,a)),d=new _X(Mg(r.outlineThreshold??.1,a)),p=new _X(Mg(r.contourThreshold??.1,a)),f=new _X(Mg(r.outlineSmoothing??.1,a)),m=new _X(Mg(r.contourFrequency??.1,a)),g=new _I(Mv(r.contourDirection??new iD(0,1,0),a)),v=new An(r.positionalLines??!1),y=new An(r.compensation??!0),x=AL.normalRenderTarget,b=AL.normalRenderTargetDepth,w=AL.pixelRatioNode,S=AL.resolution,_=MA(r),A=new AE(o,l,h,c,d,p,f,m,g,v,y,S,x,b,w,_.alpha),M=new _W(A.calpha,"f");return new Mw(t,i,e,{outlineColor:o,contourColor:l,outlineWidth:h,contourWidth:c,outlineThreshold:d,contourThreshold:p,outlineSmoothing:f,contourFrequency:m,contourDirection:g,positionalLines:v,compensation:y,..._},A,_.mode,M,_.isMask,a)}case"depth":{let o,l=new Aa(r.gradientType??0),h=new An(r.smooth??!1),c=new _X(Mg(r.near,a)??50),d=new _X(Mg(r.far,a)??200),p=new _X(r.isVector??1),f=new _X(r.isWorldSpace??0),m=new _I(Mv(r.origin,a)),g=new _I(Mv(r.direction,a)),v;r.colors?v=new Am(r.colors.length,r.colors):(v=new Am(2,new iA(0,0,0,1))).value[1]=new iA(1,1,1,1),r.steps?o=new Ao(r.steps.length,r.steps):(o=new Ao(2,1)).value[0]=0;let y=MA(r),x=new Ab(l,h,c,d,p,f,m,g,v,o,y.alpha,y.isMask),b=new _W(x.calpha,"f");return new Mw(t,i,e,{gradientType:l,smooth:h,near:c,far:d,isVector:p,isWorldSpace:f,origin:m,direction:g,colors:v,steps:o,...y},x,y.mode,b,y.isMask,a)}case"noise":{let o=new _X(Mg(r.scale,a)??1),l=new _I(Mv(r.size??new iD(100,100,100),a)),h=new _X(Mg(r.move,a)??1),c=new _O(My(r.fA??new t9(1.7,9.2),a)),d=new _O(My(r.fB??new t9(8.3,2.8),a)),p=new _O(My(r.distortion??new t9(1,1),a)),f=new _L(r.colorA),m=new _L(r.colorB),g=new _L(r.colorC),v=new _L(r.colorD),y=new Aa(r.noiseType??0),x=new Aa(r.voronoiStyle??0),b=new _X(Mg(r.highCut,a)??1),w=new _X(Mg(r.lowCut,a)??0),S=new _X(Mg(r.smoothness,a)??.5),_=new _X(Mg(r.seed,a)??.5),A=new Aa(r.quality??1),M=MA(r),E=new AM(o,l,h,c,d,p,f,m,g,v,M.alpha,y,M.isMask,x,b,w,S,_,A),C=new _W(E.calpha,"f");return new Mw(t,i,e,{scale:o,size:l,move:h,fA:c,fB:d,distortion:p,colorA:f,colorB:m,colorC:g,colorD:v,noiseType:y,...M,voronoiStyle:x,highCut:b,lowCut:w,smoothness:S,seed:_,quality:A},E,M.mode,C,M.isMask,a)}
5423case"normal":{let o=new _I(r.cnormal??new iD(1,1,1)),l=MA(r),h=new Ay(o,l.alpha),c=new _W(h.calpha,"f");return new Mw(t,i,e,{cnormal:o,...l},h,l.mode,c,l.isMask,a)}case"gradient":{let o,l=new Aa(r.gradientType??0),h=new An(r.smooth??!1),c;r.colors?c=new Am(r.colors.length,r.colors):(c=new Am(10,new iA(0,0,0,1))).value[1]=new iA(1,1,1,1),r.steps?o=new Ao(r.steps.length,r.steps):(o=new Ao(10,1)).value[0]=0;let d=new _O(My(r.offset??new t9(0,0),a)),p=new _O(My(r.morph??new t9(0,0),a)),f=new _X(Mg(r.angle??0,a)),m=MA(r),g=new AS(l,h,c,o,d,p,f,m.alpha,m.isMask),v=new _W(g.calpha,"f");return new Mw(t,i,e,{gradientType:l,smooth:h,colors:c,steps:o,offset:d,morph:p,angle:f,...m},g,m.mode,v,m.isMask,a)}case"pattern":{let o=new Aa(r.style??0),l=new Aa(r.projection??0),h=new Aa(["x","y","z"].indexOf(r.axis)??0),c=new _X(Mg(r.blending??0,a)),d=new _O(My(r.offset,a)),p=new _L(r.colorA),f=new _L(r.colorB),m=new _O(My(r.frequency??new t9(10,10),a)),g=new _X(Mg(r.size??.5,a)),v=new _X(Mg(r.variation??0,a)),y=new _X(Mg(r.smoothness??.5,a)),x=new _X(Mg(r.zigzag??0,a)),b=new _X(Mg(r.rotation??0,a)),w=new _O(My(r.vertical??new t9(0,1),a)),S=new _O(My(r.horizontal??new t9(0,1),a)),_=new Aa(r.sides??6),A=MA(r),M=new AC(o,l,h,c,d,p,f,m,g,v,y,x,b,w,S,_,A.alpha,A.isMask),E=new _W(M.calpha,"f");return new Mw(t,i,e,{style:o,projection:l,axis:h,blending:c,offset:d,colorA:p,colorB:f,frequency:m,size:g,variation:v,smoothness:y,zigzag:x,rotation:b,vertical:w,horizontal:S,sides:_,...A},M,A.mode,E,A.isMask,a)}default:{let o=new As(1,0,0,1),l=MA(r),h=new Av(o,l.alpha),c=new _W(h.calpha,"f");return new Mw(t,i,e,{color:o,...l},h,l.mode,c,l.isMask,a)}}}(i,e,t,a,r)}if("noise"===i.displacementType){let a=new _I(new iD(...i.offset.map(e=>Mg(e,r)??0))),o=new _X(Mg(i.scale,r)??10),l=new _X(Mg(i.intensity,r)??8),h=new _X(Mg(i.movement,r)??1),c=new Aa(i.noiseType??0),d=new Aa(i.voronoiStyle??0),p=new _X(Mg(i.smoothness,r)??.5),f=new _X(Mg(i.seed,r)??0),m=new _X(Mg(i.highCut,r)??1),g=new _X(Mg(i.lowCut,r)??0),v=new Aa(Mg(i.quality,r)??1),y=new AR(l,h,a,d,p,f,m,g,v,o,c);return new MS(e,t,i,{offset:a,scale:o,intensity:l,movement:h,noiseType:c,voronoiStyle:d,smoothness:p,seed:f,highCut:m,lowCut:g,quality:v},y,r)}throw Error()}updateByOp(e,t,i){let r=!1;if(void 0===e.path[0]){for(let i of Object.keys(e.props))try{let e=this.data[i],a=t[i];if(Array.isArray(e)&&Array.isArray(a)){for(let[t,i]of a.entries()){let a=e[t];if("string"==typeof i||"number"==typeof i&&"string"==typeof a){r=!0;break}}if(r)break}else if("string"==typeof a&&"number"==typeof e||"number"==typeof a&&"string"==typeof e||"string"==typeof a&&"string"==typeof e&&a!==e){r=!0;break}}catch(e){console.error(e)}if(0===e.type)return"type"in e.props||"category"in e.props||"visible"in e.props||"noiseType"in e.props?(i.scene.markNeedsUpdateRendererDirty(),!0):function(e,t,i,r){let a=!1;for(let[o,l]of Object.entries(e)){if("bumpMap"===o||"roughnessMap"===o){a=!0;continue}if(!o||void 0===l)continue;if(MM(o,i,r,t)){"visible"===o&&"light"===i.type&&(a=!0);continue}i.visible=r.visible;let e=i.uniforms[`f${i.id}_${o}`];if(e&&!(e instanceof Al))switch(a=a||function(e,t,i){if("isMask"===t)return!0;let r=Md[e.type],a=Mu[e.type];if(void 0!==a){let r=e.color;if(a.includes(t)){let e=r[t]?.value?.length;if(void 0!==e&&e!==i.length)return!0}}return void 0!==r&&r.includes(t)}(i,o,l),e.constructor){case As:if("string"==typeof l){let i=t.getColor(l);i&&(e.value=i);break}e.value instanceof Mc?e.value=new _R(l.r,l.g,l.b,l.a):e.setRGBA(l);break;case _L:if("string"==typeof l){let i=t.getColor(l);i&&(e.value=i);break}e.value instanceof Mc?e.value=new _R(l.r,l.g,l.b,l.a):e.value.setRGBA(l.r,l.g,l.b,l.a);break;case _O:e.value.setX(l[0]),e.value.setY(l[1]);break;case _I:e.value.setX(l[0]),e.value.setY(l[1]),e.value.setZ(l[2]);break;case _q:Mf(l,t,i);break;case Am:e.value=l.map(e=>new iA(...e));break;default:e.value=l}}return a}(e.props,i.shared,this,t)||r}else if("texture"===e.path[0])return!("texture"in t)&&!("video"in t)||Mf(e.props,i.shared,this)||r;return r}dispose(){let e;if("texture"===(e=this instanceof Mb?this.type:this)||"video"===e||"displace_map"===e||"matcap"===e){let e=this.uniforms[`f${this.id}_texture`];if(!e)return!1;e.image instanceof AJ||e.image.deref()}}hasValueByKey(e){return void 0!==this.uniforms[e]}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let i=`f${this.id}_${e}`;this.hasValueByKey(i)&&void 0!==t&&(this.uniforms[i].value=t)}
5423getNode(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t]}getValue(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getName(e){let t=/f\d+_(.*)/.exec(e);if(t&&t.length>1)return t[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let i=this.getName(t);i&&e.push(i)}return e}},Mw=class extends Mb{constructor(e,t,i,r,a,o,l,h,c){super(e,t,i,r,c),this.params=r,this.color=a,this.mode=o,this.alpha=l,this.isMask=h}},MS=class extends Mb{constructor(e,t,i,r,a,o){super(e,t,i,r,o),this.position=a}},M_=class extends Mb{constructor(e,t,i,r,a,o){super(e,t,i,a,o),this.node=r}static createLightLayer(e,t,i,r){let a,o=new _X(Mm(i.alpha,r)),l=new Aa(i.mode),h=new _X(i.bumpMapIntensity),c=new _X(Mm(i.alphaOverride,r)),d;if(i.visible){if("lambert"===i.category){a=new Aj;let e=new As(r.color(i.emissive)??0),t=new An(i.occlusion??!0);d={emissive:e,occlusion:t},a.emissive=e,a.occlusion=t}else if("toon"===i.category){a=new Aq;let e=new _X(i.shininess??30),t=new As(r.color(i.specular)??1118481);d={shininess:e,specular:t},a.shininess=e,a.specular=t}else if("physical"===i.category){a=new AW;let e=new _X(i.roughness??.3),t=new _X(i.metalness??0),r=new _X(i.reflectivity??.5),o=new An(i.occlusion??!0);d={roughness:e,metalness:t,reflectivity:r,occlusion:o},a.roughness=e,a.metalness=t,a.reflectivity=r,a.occlusion=o}else{a=new AH;let e=new _X(i.shininess??30),t=new As(void 0!==i.specular?r.color(i.specular)??1118481:1118481),o=new An(i.occlusion??!0);d={shininess:e,specular:t,occlusion:o},a.shininess=e,a.specular=t,a.occlusion=o}}else a=new AV,d={};return a.alpha=new _X(1),a.shadingAlpha=o,a.shadingBlend=l,a.bumpMapIntensity=h,a.alphaOverride=c,d.alpha=a.shadingAlp
vendor: 2,141 bytes, line 5423
5423ha,d.mode=a.shadingBlend,d.bumpMapIntensity=a.bumpMapIntensity,d.alphaOverride=a.alphaOverride,new M_(e,t,i,a,d,r)}get category(){return this.node.category}};function MA(e){return{alpha:new _X(e.alpha??1),mode:new Aa(e.mode??0),isMask:new An(e.isMask??!1)}}function MM(e,t,i,r){if("displace"===i.type&&("intensity"===e||"visible"===e)){let e=t.uniforms[`f${t.id}_intensity`];return e?(e.value=(Mg(i.intensity,r)??1)*(i.visible?1:0),e):void 0}if("displace"!==i.type&&("alpha"===e||"visible"===e)){let a=t.uniforms[`f${t.id}_alpha`];if(!a)return;if(a.value=Mm(i.alpha,r)*(i.visible?1:0),"outline"===i.type&&"visible"===e){let e=t.uniforms[`f${t.id}_compensation`];e&&(e.value=i.compensation&&i.visible)}return a}}function ME(e,t,i,r,a,o,l=[]){let h=i;for(let e of l)e in h&&(h=h[e]);for(let t of e)t in h&&a.getVariable(h[t],["material",o,"layer",r,...l,String(t)]);for(let e of t)e in h&&h[e].forEach((t,i)=>{a.getVariable(t,["material",o,"layer",r,...l,String(e),0===i?"x":1===i?"y":"z"])})}function MC(e,t){let i=0,r=e.layers.find(e=>"light"===e.data.type);if(r){let e=r.data,i=Number(t.getVariable(e.alphaOverride));if(("string"==typeof e.alphaOverride?i/100:e.alphaOverride)<1)return!0}for(let r of e.layers){if("displace"!==r.data.type&&r.data.isMask)return!0;if("displace"!==r.data.type&&"alpha"in r.data&&"light"!==r.data.type&&"fresnel"!==r.data.type&&"texture"!==r.data.type&&"matcap"!==r.data.type&&"rainbow"!==r.data.type&&"outline"!==r.data.type&&"pattern"!==r.data.type){let e=r.data.visible?r.data.alpha:0;if("string"==typeof e&&(e=Math.max(0,Math.min(1,Number(t.getVariable(e)??100)/100))),1===e&&"depth"===r.data.type||"gradient"===r.data.type){for(let t of r.data.colors)if(t[3]<1){e=t[3];break}}else if(1===e&&"noise"===r.data.type){let i=Math.min(t.color(r.data.colorA).a,Math.min(t.color(r.data.colorB).a,Math.min(t.color(r.data.colorC).a,t.color(r.data.colorD).a)));i<1&&(e=i)}i+=(1-i)*e}}return i<1}var MT=class extends sl{constructor(){super(void 0),this.flatShading=!1,this.needsJitter=!0,this.shadersPatchedForShapeBlend=!1,this.nodeContextUuid=0,this.fog=!0,this.dithering=!0,this.vertexColors=!0,this.setTransparent
5423(!0)}customProgramCacheKey(){return""}setTransparent(e){this.transparent=e;let t=!1;if(e)try{t=this.getLayersOfType("transmission").length>0}catch{t=!1}this.depthWrite=!e||t}},MP=class extends MT{constructor(e,t,i,r){super(),this.flatShading=e,this.side=t,this.wireframe=i,this.root=r}updateAfterBuild(){let e=this.root;this.lights=e.lights,this.vertexShader=e.vertexShader,this.fragmentShader=e.fragmentShader,Object.assign(this.defines,e.defines),Object.assign(this.uniforms,e.uniforms),this.extensions=e.extensions,this.setTransparent(e.transparent),this.cacheKey=e.customProgramCacheKey()+"flat"+this.flatShading+this.side}onBeforeCompile(e,t){this.root.onBeforeCompile(e)}get data(){return this.root.data}get category(){return this.root.category}get hasAO(){return this.root.hasAO}getFlavor(e,t,i,r){return this.root.getFlavor(e,t,i,r)}get layers(){return this.root.layers}get fragment(){return this.root.fragment}getLayersOfType(e){return this.root.getLayersOfType(e)}getLayerByUuid(e){return this.root.getLayerByUuid(e)}updateByOp(e,t,i){this.root.updateByOp(e,t,i)}nodeMaterialDispose(){this.root.nodeMaterialDispose()}},MD=class extends MT{constructor(e,t,i=!0){super(),this.data=e,this.allowVariableSaves=i,this.layerIdGen=0,this.flavors=[],this.masks={},this.type="NodeMaterial",this.updaters=[],this.needsJitter=t.shared.needsJitter,_E.startContext(this),this.reset0(e,t),_E.endContext(this)}get nodeMaterial(){return this}getFlavor(e,t,i,r){let a=i?6:(e?3:0)+t;if(0===(a+=((r?.resolutionLevel??0)-(r?.useChildrenColors?4:0))*7))return this;void 0===this.flavors&&(this.flavors=[]),a-=1;let o=this.flavors[a];return void 0===o&&((o=new MP(e,t,i,this)).needsJitter=this.needsJitter,this.flavors[a]=o,o.flatShading=e,o.side=t,o.updateAfterBuild(),r&&(o.defines.SHAPEBLEND=r.resolutionLevel,o.defines.SHAPEBLEND_C=r.useChildrenColors?1:0)),o}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.category}get hasAO(){return this.lightLayer.getNode("occlusion")?.value??!1}reset(e,t,i=!1){_E.startContext(this),(this.data!==e||i)&&this.reset0(e,t),_E.endContext(this)}reset0(e,t){this.data=e;let i=e.layers??vv.defaultTwoLayerData("phong").layers;try{this.layers=i.map(e=>Mb.create(this.layerIdGen++,e.id,e.data,t.shared))}catch{this.layers=[]}this.layers.reverse(),this.name=e.name??"Untitled Material",this.onUpdate(t.shared),this.setTransparent
5423(MC(e,t.shared)),this.saveVariableLocations(t)}onVariableUpdate(e,t,i){if("alphaOverride"===e[0])this.setTransparent(MC(this.data,i.shared)),this.lightLayer.setValue("alphaOverride",Math.max(0,Math.min(Number(t)/100,1)));else if("layer"===e[0]){let r=e[1],a=e[2];if(r&&a){let o=this.layers.find(e=>e.uuid===r);if(o?.hasValue(a)){if("alpha"===a)this.setTransparent(MC(this.data,i.shared)),o.setValue(a,Math.max(0,Math.min(Number(t)/100,1)));else{let r=o.getValue(a),l=e[3],h=e[4];if(r instanceof i_){let e=r[l],a;"number"==typeof e?a=Number(t):e.isVector2&&(a=e.toArray(),"x"===h?a[0]=Number(t):"y"===h&&(a[1]=Number(t))),Mf({[l]:a},i.shared,o);return}("x"===l||"y"===l||"z"===l)&&r.isVector3||("x"===l||"y"===l)&&r.isVector2?r[l]=Number(t):o.setValue(a,t)}}}}}saveVariableLocations(e){if(!this.allowVariableSaves)return;let t=this.data.layers.find(e=>"light"===e.data.type);t&&e.shared.getVariable(t.data.alphaOverride,["material",this.uuid,"alphaOverride"]),this.data.layers.forEach(t=>{"alpha"in t.data&&"string"==typeof t.data.alpha&&e.shared.getVariable(t.data.alpha,["material",this.uuid,"layer",t.id,"alpha"]),"displace"===t.data.type?"noise"===t.data.displacementType?ME(["intensity","scale","movement","smoothness","seed","highCut","lowCut"],["offset"],t.data,t.id,e.shared,this.uuid):ME(["intensity"],[],t.data,t.id,e.shared,this.uuid):"depth"===t.data.type?ME(["near","far"],["origin","direction"],t.data,t.id,e.shared,this.uuid):"fresnel"===t.data.type?ME(["bias","scale","intensity","factor"],[],t.data,t.id,e.shared,this.uuid):"rainbow"===t.data.type?ME(["filmThickness","movement","noiseStrength","noiseScale"],["offset","wavelengths"],t.data,t.id,e.shared,this.uuid):"noise"===t.data.type?ME(["scale","move","seed","highCut","lowCut","smoothness"],["size","distortion","fA","fB"],t.data,t.id,e.shared,this.uuid):"pattern"===t.data.type?ME(["blending","size","variation","smoothness","zigzag","rotation"],["offset","frequency","vertical","horizontal"],t.data,t.id,e.shared,this.uuid):"outline"===t.data.type?ME(["outlineWidth","contourWidth","outlineThreshold","contourThreshold","outlineSmoothing","contourFrequency"],["contourDirection"],t.data,t.id,e.shared,this.uuid):"toon"===t.data.type?ME(["noiseStrength","noiseScale"],["offset","source"],t.data,t.id,e.shared,this.uuid):"transmission"===t.data.type?ME(["roughness","thickness","ior"],[],t.data,t.id,e.shared,this.uuid):"texture"===t.data.type||"video"===t.data.type?(ME([],["size"],t.data,t.id,e.shared,this.uuid),ME(["rotation"],["repeat","offset"],t.data,t.id,e.shared,this.uuid,["texture"])):"gradient"===t.data.type?ME(["angle"],["offset","morph"],t.data,t.id,e.shared,this.uuid):"matcap"===t.data.type&&ME(["rotation"],[],t.data,t.id,e.shared,this.uuid,["texture"])})}getLayersOfType(e){return this.layers.filter(t=>t.type===e)}getLayerByUuid(e){return this.layers.find(t=>t.uuid===e)}onUpdate(e){for(let t of(this.lightLayer=this.layers.find(e=>e instanceof M_),void 0===this.lightLayer&&(this.lightLayer=new M_(0,"",{...g3.defaultData("light","phong"),visible:!1},new AV,{},e)),this.dispose(),this.flavors))t&&t.dispose();this.applyTextureMaps(),this.applyMasks(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.build(),this.nodeContextUuid=0}applyTextureMaps(){let e=this.layers.find(e=>e instanceof M_);if(!e)return;let t=e.data,i=t.bumpMap,r=t.roughnessMap;e.node.bumpMap=void 0,e.node.roughnessMap=void 0;for(let t=0;t<this.layers.length;++t){let a=this.layers[t];a instanceof Mw&&a.color instanceof Ax&&(a.uuid===i&&(e.node.bumpMap=a.color),a.uuid===r&&(e.node.roughnessMap=a.color))}}updateByOp(e,t,i){if(_E.startContext(this),void 0!==t?this.data=t:t=this.data,this.setTransparent
vendor: 4,253 bytes, line 5423
5423(MC(t,i.shared)),"layers"===e.path[0]){let r=i.shared,a=e.path[1];if(void 0===a)i.scene.markNeedsUpdateRendererDirty(),this.reset0(t,i);else{0===e.type&&void 0!==e.props.occlusion&&i.scene.markNeedsUpdateRendererDirty();let o=this.layers.find(e=>e.uuid===a);if(o){let l=t.layers.data(a),h;0===e.type&&("alpha"in e.props||"alphaOverride"in e.props)&&(h="alpha"in e.props?{...e.props,alpha:Mm(e.props.alpha,r,["material",this.uuid,"layer",a,"alpha"])}:{...e.props,alphaOverride:Mm(e.props.alphaOverride,r,["material",this.uuid,"alphaOverride"])}),o.updateByOp({...e,...h?{props:h}:{},path:e.path.slice(2)},l,i)&&this.reset0(t,i)}}}else this.reset0(t,i);_E.endContext(this)}applyMasks(){for(let e=0;e<this.layers.length;++e){let t=this.layers[e];t instanceof Mw?t.color.mask=void 0:t instanceof M_&&(t.node.mask=void 0)}for(let e=0;e<this.layers.length;++e){let t=this.layers[e];if(t instanceof Mw&&t.isMask.value&&t.data.visible&&e>0){let i=e-1,r=this.layers[i];r instanceof M_?r.node.mask=new _Q(t.color,t.alpha,_Q.MUL):r instanceof Mw&&(r.isMask.value||(r.color.mask=new _Q(t.color,t.alpha,_Q.MUL)))}}}blendColors(){let e=this.layers.findIndex(e=>e instanceof Mw),t=this.layers.findIndex(e=>e instanceof M_);if(-1!==e&&e<t){let i=this.layers[e].color;for(let r=e+1;r<t;++r){let e=this.layers[r];if(e instanceof Mw){if(e.isMask.value)continue;i=new Ag(i,e.color,e.alpha,e.mode)}}this.fragment.color=i}else this.fragment.color=void 0}blendAfterColors(){let e=new _W("outgoingLight","f"),t=this.layers.findIndex(e=>e instanceof M_);if(this.layers.length>t+1){for(let i=t+1;i<this.layers.length;++i){let t=this.layers[i];if(t instanceof Mw){if(t.isMask.value)continue;e=new Ag(e,t.color,t.alpha,t.mode)}}this.fragment.afterColor=e}else this.fragment.afterColor=void 0}blendPositions(){let e=this.layers.filter(e=>e instanceof MS);if(e.length>0){let t=e[0].position;for(let i=1;i<e.length;++i)e[i]&&(t=new _Q(t,e[i].position,_Q.ADD),t=new _Q(t,new _X(.5).setReadonly(!0),_Q.MUL));this.fragment.position=t}else this.fragment.position=void 0}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}onBeforeCompile(e){this.shapeBlendhack&&this.shapeBlendhack(this),e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=!0===this.extensions.derivatives,e.extensionFragDepth=!0===this.extensions.fragDepth,e.extensionDrawBuffers=!0===this.extensions.drawBuffers,e.extensionShaderTextureLOD=!0===this.extensions.shaderTextureLOD}clampUniformsForPreview(e,t){let i=(e,t,i)=>Math.min(Math.max(e,t),i);for(let r of this.layers)if("displace"===r.type){let a=i(r.uniforms[`f${r.id}_intensity`].value,e,t);r.uniforms[`f${r.id}_intensity`].value=a}}updateFrame(e){for(let t=0;t<this.updaters.length;++t)e.updateNode(this.updaters[t])}build(){let e=new Ar;for(let t of(e.needsJitter=this.needsJitter,this.lights=this.lightLayer.data.visible,e.build(this.fragment,this.fragment),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms=e.uniforms,this.extensions=e.extensions,this.updaters=e.updaters,this.flavors))t&&t.updateAfterBuild();return this.shadersPatchedForShapeBlend=!1,this}nodeMaterialDispose(){for(let e of(this.layers.forEach(e=>e.dispose()),super.dispose(),this.flavors))e&&e.dispose()}assetsLoaded(){for(let e of this.layers)if(e instanceof Mw){let t=e.params.texture;if(t instanceof Ac&&!t.image.loaded)return!1}return!0}};Object.defineProperties(MT.prototype,{properties:{get:function(){return this.fragment.properties}}});var MO,MI=class extends MD{constructor(e,t,i){super(e,t,!1),this.uuid=i,this.allowVariableSaves=!0,this.saveVariableLocations(t)}},MR=new Map,ML=new Promise(e=>{MO=e}),MB=!1;function Mz(e,t){e.forEach(e=>{"dragDropActions"in e.data?(t.push(...e.data.dragDropActions.drag),t.push(...e.data.dragDropActions.drop)):"inActions"in e.data?(t.push(...e.data.inActions),t.push(...e.data.outActions)):"gameActions"in e.data?(t.push(...e.data.gameActions.idle),t.push(...e.data.gameActions.move),t.push(...e.data.gameActions.jump),t.push(...e.data.gameActions.run)):"breakpoints"in e.data?e.data.breakpoints.forEac
5423h(e=>{t.push(...e.data.actions)}):"actions"in e.data&&(t.push(...e.data.actions),e.data.actions.forEach(e=>{"Conditional"===e.data.type&&e.data.ifActions&&(t.push(...e.data.ifActions),t.push(...e.data.elseActions))}))})}ML.then(e=>MN=e);var MF,MN,MU,Mk=class{constructor({src:e,volume:t,delay:i,loop:r}){let a;this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)},a="string"==typeof e?{src:e}:{src:function(e){if("string"==typeof e)return e;let t=MR.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},MR.set(e,t)),t.url}(e),format:"wav"},this.sound=new MN.Howl(a),this.sound.on("end",this.onEnd),this.src=e,void 0!==t&&(this.volume=t),void 0!==i&&(this.delay=i),void 0!==r&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,t),this.clearFade()},e)):this.sound.fade(this._volume,0,t)}on(e,t,i){this.sound.on(e,t,i)}off(e,t,i){this.sound.off(e,t,i)}play(){"playing"===this._status||this.sound.playing()||("paused"===this._status?(0===this.sound.seek()?this.replay():this.sound.play(),this._status="playing"):"stopped"===this._status&&(this.replay(),this._status="playing"))}pause(){"playing"===this._status&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}},MV=class{constructor(){this.type="ShapePath",this.color=new iv,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new oy,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,a,o){return this.currentPath?.bezierCurveTo(e,t,i,r,a,o),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},t={loc:e.ORIGIN,t:0};function i(i,r,a){let o,l=a.x-r.x,h=a.y-r.y,c=i.x-r.x,d=i.y-r.y,p=l*d-c*h;if(i.x===r.x&&i.y===r.y){t.loc=e.ORIGIN,t.t=0;return}if(i.x===a.x&&i.y===a.y){t.loc=e.DESTINATION,t.t=1;return}if(p<-Number.EPSILON){t.loc=e.LEFT;return}if(p>Number.EPSILON){t.loc=e.RIGHT;return}if(l*c<0||h*d<0){t.loc=e.BEHIND;return}if(Math.sqrt(l*l+h*h)<Math.sqrt(c*c+d*d)){t.loc=e.BEYOND;return}o=0!==l?c/l:d/h,t.loc=e.BETWEEN,t.t=o}let r=0,a=999999999,o=-999999999,l=[];this.subPaths.forEach(e=>{let t=e.getPoints(),i=-999999999,h=999999999,c=-999999999,d=999999999;for(let e=0;e<t.length;e++){let r=t[e];r.y>i&&(i=r.y),r.y<h&&(h=r.y),r.x>c&&(c=r.x),r.x<d&&(d=r.x)}o<=c&&(o=c+1),a>=d&&(a=d-1),t.length&&l.push({curves:e.curves,points:t,isCW:oV.isClockWise(t),identifier:r++,boundingBox:new lQ(new t9(d,h),new t9(c,i))})});let h=l.map(r=>(function(r,a,o,l,h){(null==h||""===h)&&(h="nonzero");let c=new t9;r.boundingBox.getCenter(c);let d=function(r,a,o){let l=new t9;a.getCenter(l);let h=[];return o.forEach(a=>{a.boundingBox.containsPoint(l)&&(function(r,a){let o=[],l=[];for(let h=1;h<r.length;h++){let c=r[h-1],d=r[h];for(let r=1;r<a.length;r++){let h=function(r,a,o,l){let h=r.x,c=a.x,d=o.x,p=l.x,f=r.y,m=a.y,g=o.y,v=l.y,y=(p-d)*(f-g)-(v-g)*(h-d),x=(v-g)*(c-h)-(p-d)*(m-f),b=y/x,w=((c-h)*(f-g)-(m-f)*(h-d))/x;if(0===x&&0!==y||b<=0||b>=1||w<0||w>1)return null;if(0===y&&0===x){for(let d=0;d<2;d++)if(i(0===d?o:l,r,a),t.loc===e.ORIGIN){let e=0===d?o:l;return{x:e.x,y:e.y,t:t.t}}else if(t.loc===e.BETWEEN)return{x:+(h+t.t*(c-h)).toPrecision(10),y:+(f+t.t*(m-f)).toPrecision(10),t:t.t};return null}for(let h=0;h<2;h++)if(i(0===h?o:l,r,a),t.loc===e.ORIGIN){let e=0===h?o:l;return{x:e.x,y:e.y,t:t.t}}return{x:+(h+b*(c-h)).toPrecision(10),y:+(f+b*(m-f)).toPrecision(10),t:b}}(c,d,a[r-1],a[r]);null!==h&&void 0===o.find(e=>e.t<=h.t+Number.EPSILON&&e.t>=h.t-Number.EPSILON)&&(o.push(h),l.push(new t9(h.x,h.y)))}}return l}
5423)(r,a.points).forEach(e=>{h.push({identifier:a.identifier,isCW:a.isCW,point:e})})}),h.sort((e,t)=>e.point.x-t.point.x),h}([new t9(o,c.y),new t9(l,c.y)],r.boundingBox,a);d.sort((e,t)=>e.point.x-t.point.x);let p=[],f=[];d.forEach(e=>{e.identifier===r.identifier?p.push(e):f.push(e)});let m=p[0].point.x,g=[],v=0;for(;v<f.length&&f[v].point.x<m;)g.length>0&&g[g.length-1]===f[v].identifier?g.pop():g.push(f[v].identifier),v++;if(g.push(r.identifier),"evenodd"===h){let e=g.length%2==0,t=g[g.length-2];return{identifier:r.identifier,isHole:e,for:t}}if("nonzero"===h){let e=!0,t=null,i=null;for(let r=0;r<g.length;r++){let o=g[r];a[o]&&(e?(i=a[o].isCW,e=!1,t=o):i!==a[o].isCW&&(i=a[o].isCW,e=!0))}return{identifier:r.identifier,isHole:e,for:t}}console.warn('fill-rule: "'+h+'" is currently not implemented.')})(r,l,a,o,this.userData?.style.fillRule)),c=[];return l.forEach(e=>{let t=h[e.identifier];if(t&&!t.isHole){let t=new oA;t.curves=e.curves,h.filter(t=>t?.isHole&&t.for===e.identifier).forEach(e=>{if(e){let i=l[e.identifier],r=new oy;r.curves=i.curves,t.holes.push(r)}}),c.push(t)}}),c}},Mj=!1,MG=new Promise(e=>{MU=e}),MH=!1;async function MW(e){return await (await fetch(e)).arrayBuffer()}var Mq=new class{async load(e,t,i=()=>{}){let{load:r}=await MG;r(e,(e,r)=>{e||!r?i(e??"Something went wrong"):t(r)})}async parse(e){let{parse:t,Bidi:i}=await MG;try{let r=t(e),a=new i;return a.registerModifier("glyphIndex",null,e=>r.charToGlyphIndex(e.char)),a.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:a}}catch(e){console.error(e)}}};async function MX(e){let t,i,r=!1;if(e.url?(t=await MW(e.url),i=e.url,r=e.url.startsWith("/")):e.data&&(t=e.data.buffer.slice(e.data.byteOffset,e.data.byteOffset+e.data.byteLength)),t){if(!Mj)return{font:void 0,url:i,intercepted:r,arr:t,bidi:null};{let e=await Mq.parse(t);if(e)return{font:e.font,url:i,intercepted:r,arr:t,bidi:e.bidi}}}}var MY=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=MX(e).then(e=>{e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)})}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=MX(e).then(e=>{e&&(this._arrayBuffer=e.arr,this._url=e.url,this.font=e.font,this._intercepted=e.intercepted,this._isLoaded=!0,this._bidi=e.bidi)})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let a=r.tokenizer.tokens,o=[],l=0,h=i.length===a.length;for(let r=0;r<i.length;r++){let c=i[r].index,d=String.fromCharCode(i[r].unicode),p=a[l];if(p.state.glyphIndex===c||p.state.fina===c||p.state.medi===c||p.state.init===c||h)o.push({char:d,index:c,replacements:[p.state.glyphIndex],replacementChars:[p.char]}),l++;else{let i=p.char,r="",a=[p.state.glyphIndex],h=[],f=!1;for(;!f;)l++,i+=r=t.charAt(l),a.push(e.charToGlyphIndex(r)),1===(h=e.stringToGlyphs(i)).length&&h[0].index===c&&(f=!0),l>t.length&&(f=!0);o.push({char:d,index:c,replacements:a,replacementChars:Array.from(i)}),l++}}return o}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,a=t.fontSize/this.unitsPerEm,o=t.fontSize*t.lineHeight,l=e.map(e=>this.getTextWidth(e,t)),h="string"==typeof t.width?Number(i.getVariable(t.width)):t.width,c="string"==typeof t.height?Number(i.getVariable(t.height)):t.height,d=this.getCharWidth(` 5424`,t),p=1===t.horizontalAlign?d:0,f=this.getLineInitialOffsetX(l[0],h,t.horizontalAlign,e[0],d),m=this.getLineInitialOffsetY(o,e.length,c,a,t.verticalAlign),g=[],v=e.map(e=>[]),y=e.map(e=>[]);for(let c=0;c<e.length;c++){let x=e[c],b={features:{liga:!0},letterSpacing:t.letterSpacing},w=[];try{w=r.stringToGlyphs(x,b)}catch(e){console.warn(e)}f=this.getLineInitialOffsetX(l[c],h,t.horizontalAlign,x,d);let S=[];try{S=this.reverseLigaturesTable(r,x,w)}catch(e){console.warn(e)}let _=this.computeSpaceWidthForLine(e,c,t,i),A=0,M=w[0];M&&2===t.horizontalAlign&&void 0!==M.leftSideBearing&&(f-=M.leftSideBearing*a),this.font?.forEachGlyph(x,f,m,t.fontSize,b,(e,i,o,l,h)=>{let d=0===e.index?` 5425`:e.unicode?String.fromCharCode(e.unicode):void 0,f=S[A],m=0;if(d===` 5426`)m=p;else if(" "===d)m=_;else{let r=this.createPath(e,a,i,o,t);r&&(m=r.offsetX,g.push(r.path))}if(1===f.replacements.length)y[c].push([i,o]),v[c].push(m);else{let e=f.replacements.map(e=>(r.glyphs.get(e).advanceWidth??0)*a),t=e.reduce((e,t)=>
5426e+=t,0),l=e.map(e=>e/t),h=i;for(let e=0;e<l.length;e++){let t=m*l[e];y[c].push([h,o]),v[c].push(t),h+=t}}A++}),m-=o}let x=[];for(let e=0,t=g.length;e<t;e++)x.push(...g[e].toShapes());return{shapes:x,charWidths:v,lineWidths:l,charCoords:y}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(e,t,i,r,a){return(3===i||2===i)&&r.indexOf(` 5427`)>=0&&(e-=a),3===i?.5*t-.5*e:2===i?t-e:0}getLineInitialOffsetY(e,t,i,r,a){let o=t*e,l=Math.abs(this.ascender-this.descender)*r,h=-this.ascender*r-(e-l)/2;return 3===a?-(i-o-h):2===a?-(.5*i-.5*o-h):h}createPath(e,t,i,r,a){let o=e.getPath(i,-r,a.fontSize,{kerning:!1,letterSpacing:a.letterSpacing});if(!o){console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");return}let l=new MV,h=(e.advanceWidth??1)*t;if(e)for(let e of o.commands){let t=l.currentPath?.currentPoint;if(!(t&&"Z"!==e.type&&t.x===e.x&&-t.y===e.y))switch(e.type){case"M":l.moveTo(e.x,-e.y);break;case"L":l.lineTo(e.x,-e.y);break;case"Q":l.quadraticCurveTo(e.x1,-e.y1,e.x,-e.y);break;case"C":l.bezierCurveTo(e.x1,-e.y1,e.x2,-e.y2,e.x,-e.y)}}return l.subPaths.forEach(e=>{let t=function(e){if(e.length){let t=e[0];if(t instanceof od)return t.v1;if(t instanceof oh||t instanceof op)return t.v0}}(e.curves);void 0!==t&&e.currentPoint.distanceTo(t)>0&&e.lineTo(t.x,t.y)}),{offsetX:h,path:l}}getCharWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}getTextWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}computeSpaceWidthForLine(e,t,i,r){let a=this.getCharWidth(" ",i),o=e[t];if(o){let l=this.countSpaces(o.trimEnd());if(4===i.horizontalAlign&&t<e.length-1&&l)return(("string"==typeof i.width?Number(r.getVariable(i.width)):i.width)-(this.getTextWidth(o,i)-l*a))/l}return a}countSpaces(e){return(e.match(/ /g)||[]).length}},MQ=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return void 0===r?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&!0!==i.isShared)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},MZ=class extends MQ{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=S$(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},MK={markNeedsUpdateRendererDirty:()=>{}},MJ=class{constructor(e,t){this.id=e,this.userWebhook=t,this.result=void 0,this._connected=!1,this.emitter=ST(),this.reconnectWaitFor=1e3,this._onError=e=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=e=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=1e3,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=1e3,this._connected=!1},this._onMessage=e=>{let t=e.data,i;try{i=JSON.parse(t)}catch(e){console.error("Error parsing webhook message",e)}if(i){let e=!1;this.userWebhook.parametersSchemas.forEach(({data:t})=>{var r,a;let o;void 0!==i[t.name]&&(r=i[t.name],a=t.type,o=typeof r,("string"===a||"number"===a)&&o===a||"boolean"===a&&("true"===r||"false"===r||!0===r||!1===r)||"image"===a&&"string"===o&&r.startsWith("http"))&&(void 0===this.result&&(this.result={}),this.result[t.name]=i[t.name],e=!0)}),e&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource("https://hooks.spline.design/events?hashFile="+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>512e3&&(this.reconnectWaitFor=512e3),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(e){this.userWebhook=e}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(e=>e.data.name)}getParameterValue(e){if(this.getParametersKeys().includes(e)){if(this.result)return this.result?.[e];for(let t of this.userWebhook.parametersSchemas)if(t.data.name===e)return xs.defaultParameterValueByType(t.data.type)}}},M$=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],M0=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],M1=[],M2=[];for(let e=1;e<=8;e++)for(let t=0;t<M$.length;t++){let i=M$[t];M1.push(i/Math.pow(2,8-e)),M2.push(M0[t]+e)}var M3=M1.filter((e,t)=>
5427M1[t]>32&&M1[t]<2e3),M4=M2.filter((e,t)=>M1[t]>32&&M1[t]<2e3),M5=class{static getFrequencies(e,t,i,r="frequency",a=-100,o=-30){i||(i=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(i));let l=1/i.length*(t/2),h,c,d;if("music"===r||"voice"===r){let e="voice"===r?M3:M1,t=Array(e.length).fill(a);for(let r=0;r<i.length;r++){let a=r*l,o=i[r];for(let i=e.length-1;i>=0;i--)if(a>e[i]){t[i]=Math.max(t[i],o);break}}h=t,c="voice"===r?M3:M1,d="voice"===r?M4:M2}else d=(c=(h=Array.from(i)).map((e,t)=>l*t)).map(e=>`${e.toFixed(2)} Hz`);return{values:new Float32Array(h.map(e=>Math.max(0,Math.min((e-a)/(o-a),1)))),frequencies:c,labels:d}}},M6=()=>"https://relayserver.spline.design/";async function M8(e){try{return(await (await fetch(M6()+"session?uuidfile="+e)).json()).token}catch(e){console.error("Token generation error:",e)}}var M9=class{constructor(e){this.value=0,this.frequencies=new Float32Array(0);let t=new AudioContext;this.source=t.createMediaStreamSource(e),this.analyser=t.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(e=-100,t=-30){if(!this.analyser)throw Error("Not connected, please call .connect() first");return M5.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}update(){let e=this.getFrequencies(),t=e.values.reduce((e,t)=>e+t,0)/e.values.length;this.value=t,this.frequencies=e.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},M7=class{constructor(e,t,i){this.data=e,this.id=t,this.shared=i,this.emitter=ST(),this.rafId=0,this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onMessage=e=>{let t=JSON.parse(e.data);if(this.appendEvent(t),"session.created"===t.type&&this.onSessionCreated(),"response.done"===t.type&&t.response?.output){for(let e of t.response.output)if("function_call"===e.type)for(let[t,i]of this.tools)e.name===t.name&&(i(JSON.parse(e.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))}},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})},this.animate=()=>{if(this.rafId=requestAnimationFrame(this.animate),this.isConnected&&this.analyser){this.analyser.update();let e=this.analyser.value,t=this.analyser.frequencies;this.voice=e,this.frequencies=t,this.emitter.emit("voice",{value:e,frequencies:t})}}}update(e){this.data=e}setColorByName(e,t){let i=this.shared.getColorByName(e);if(i){let{id:e}=i,{r:r,g:a,b:o}=S_.hexStringToRgb(t)??{r:0,g:0,b:0};this.shared.updateColor(e,{r:r/255,g:a/255,b:o/255})}}async connect(){if(this.isConnected)return;let e=await M8(this.data.integration.hash);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=e=>{let t=e.streams[0];this.audioElement.srcObject=t,this.analyser=new M9(t)};let t=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(t.getAudioTracks()[0],t),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let i=await this.pc.createOffer();await this.pc.setLocalDescription(i);let r={type:"answer",sdp:await (await fetch("https://api.openai.com/v1/realtime/calls",{method:"POST",body:i.sdp,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(r),this.animate()}appendEvent(e){this.events=[e,...this.events]}sendClientEvent(e){this.dc?(e.event_id=e.event_id||crypto.randomUUID(),this.dc.send(JSON.stringify(e)),this.appendEvent(e)):console.error("Failed to send message - no data channel available",e)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:e})=>{this.setColorByName("Voice Assistant Color",e)});let e=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${e}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:e,value:t})=>{let i=this.shared.getVariableByName(e);
5427if(i){let e=this.shared.getVariable(i.id),r;r="number"==typeof e?parseFloat(t):"boolean"==typeof e?"true"===t.toLowerCase():{textValue:t},this.shared.updateVariable(i.id,r)}});let t=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${t}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:e,value:t})=>{this.setColorByName(e,t)});let i=this.shared.scene,r=[];i.traverseEntity(e=>{e.data.events.forEach(e=>{if("AIAssistantTrigger"===e.data.type){let{description:t}=e.data;r.push(t)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(r)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:e,direction:t})=>{this.emitter.emit("trigger_event",{description:e,direction:t})}),this.sendClientEvent({type:"session.update",session:{type:"realtime",model:"gpt-realtime-2",tools:this.tools.map(([e])=>e),audio:{input:{turn_detection:{type:"server_vad"}}}}})}registerTool(e,t){this.tools.push([e,t])}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(e=>{e.track&&e.track.stop()}),this.pc?.close(),this.pc=void 0}computeAnalysisForListenerEvent(e){if("range"===e.analysis){let t=this.frequencies.slice(...e.analysisRange);return t.reduce((e,t)=>e+t,0)/t.length}return"single"===e.analysis?this.frequencies[e.analysisSingle]:this.voice}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}};function Ee(e){return"variable_"+e}var Et=class extends AZ{constructor(e){super(),this.shared=e}create(e){return new AK(e,this.shared)}},Ei=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new MZ(!0),this.geometryCache2=new MZ(!1),this.imageHolderCache=new Et(this),this.thisContext={scene:MK,shared:this},this.deletedMaterial=new MI(vv.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new AJ(xm.emptyImage,this),this.deletedVideo=new AJ(g0.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},t.images)for(let[e,i]of Object.entries(t.images))this.addImage(e,i);if(t.videos)for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i);if(t.audios)for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i);if(t.particles)for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i);this.reset(e)}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){for(let{id:i,data:r}of(this.data=e,this.resetLib(e.lib),e.variables))this.addVariableHolder(i,r),t&&this.updateVariableHolder(i,r);for(let[t,i]of Object.entries(e.userAPIs??{}))this.addUserAPI(t,i);for(let[t,i]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(t,i);if(!i){for(let[t,i]of Object.entries(e.images))this.addImage(t,i);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i)}
5427for(let[t,i]of Object.entries(e.colors))this.addColor(t,i);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i);for(let[t,i]of Object.entries(e.timelineAnimations??{}))this.addAnimation(t,i)}addMaterial(e,t){if(void 0!==t.layers){if(this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=new MI(t,this.thisContext,e);this.materials[e]=i}}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return"string"==typeof e?this.getMaterialOrDeletedPlaceholder(e):null==e?(console.error("material is undefined or null"),this.deletedMaterial):new MD(e,this.thisContext)}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new AJ(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return"string"==typeof e?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new AJ(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new AJ(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return"string"==typeof e?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Mc(t.r,t.g,t.b,t.a):this.colors[e]=new Mc(t.r,t.g,t.b,1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if("string"!=typeof e)return"a"in e?new _R(e.r,e.g,e.b,e.a):new _R(e.r,e.g,e.b,1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new _R(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof Mk)return t;{let i=new Mk({src:t.data});return this.audios[e]=i,i}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof Mk&&t.dispose(),delete this.audios[e])}addFont(e,t){this.fonts[e]=new MY(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}addAnimation(e,t){this.timelineAnimations[e]=t}getAnimation(e){return this.timelineAnimations[e]}deleteAniamtion(e){this.timelineAnimations[e]&&delete this.timelineAnimations[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof Mk&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(void 0===this.variables[e]){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(Ee(e));i=null!==r?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)void 0!==this.variables[e].dynamicVariablePlayState&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}
vendor: 4,164 bytes, line 5427
5427updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(void 0===this.variables[e])return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(Ee(e),JSON.stringify(t));let i=t;for(;"string"==typeof i;)i=this.variables[i].value;let r=this.entityOpContext.scene;for(let t=this.variables[e].locations.length-1;t>=0;t--){let a=this.variables[e].locations[t];if("material"===a[0]){let e=a[1],t=i,o={scene:r,shared:this},l=a.slice(2);r.traverseMaterial(i=>{let r=i.root??i;r.uuid===e&&r.onVariableUpdate(l,t,o)});let h=this.materials[e];h&&h.onVariableUpdate(l,t,o)}else{let o=r.find(a[0]);if(void 0===o){this.variables[e].locations.splice(t,1);continue}if("geometry"!==a[1]&&"particles"!==a[1]){for(let e=1;e<a.length-1;e++)o=o[a[e]];"rotation"===a[1]?o[a[a.length-1]]=i*t8.DEG2RAD:o[a[a.length-1]]=i}if("ParticleEmitter"===(o=r.find(a[0])).type&&o.updateVariableState(i,a),SH.is(o)){if("position"===a[1]||"rotation"===a[1]||"scale"===a[1])o.onVariableUpdate();else if("geometry"===a[1]){let e=o;o.component&&(e=o.component);let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),e.instances.forEach(e=>{let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData()})}else"morphTargetInfluences"===a[1]&&o.updateMorphInfluences(a[2],i)}}}return this.requestRender(),!0}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if("mouse"===e[0])return this.mouseProperty?.[e[1]]??0;if("raycast"===e[0])return this.raycastProperty?.[e[1]]??0;let t=this.entityOpContext.scene.find(e[0]);if("width"===e[1]||"height"===e[1]||"depth"===e[1])return t.geometry.userData.parameters[e[1]];for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=t8.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],r=i.locations?.findIndex(e=>fx.equal(e,t));void 0!==r&&-1!==r&&i.locations.splice(r,1)}if("string"!=typeof e)return e;{let i=e,r=e;do{if(r=i,void 0===this.variables[i])break;let e=this.variables[i].value;t&&void 0!==this.variables[r]&&this.variables[r].locations.push(t),i=e}while("string"==typeof i);return i}}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){"images"===e.path[0]?1===e.path.length&&1===e.type?this.addImage(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteImage(e.id):"videos"===e.path[0]?1===e.path.length&&1===e.type?this.addVideo(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVideo(e.id):"audios"===e.path[0]?1===e.path.length&&1===e.type?this.addAudio(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteAudio(e.id):"particles"===e.path[0]?1===e.path.length&&1===e.type?this.addParticle(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteParticle(e.id):"c
5427olors"===e.path[0]?1===e.path.length&&1===e.type?this.addColor(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteColor(e.id):"materials"===e.path[0]?1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteMaterial(e.id):"fonts"===e.path[0]?1===e.path.length&&1===e.type?this.addFont(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteFont(e.id):"variables"===e.path[0]?1===e.path.length&&1===e.type?this.addVariableHolder(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVariable(e.id):"components"===e.path[0]&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,"images"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addImage(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteImage(e.id);else if("videos"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addVideo(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteVideo(e.id);else if("audios"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):1===e.path.length&&1===e.type?this.addAudio(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteAudio(e.id);else if("particles"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):1===e.path.length&&1===e.type?this.addParticle(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteParticle(e.id);else if("colors"===e.path[0])2===e.path.length&&0===e.type?this.updateColor(e.path[1],e.props):1===e.path.length&&1===e.type?this.addColor(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteColor(e.id);else if("materials"===e.path[0])1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data):1===e.path.length&&2===e.type?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(fv.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if("fonts"===e.path[0])2===e.path.length&&0===e.type?this.updateFont(e.path[1],e,i):1===e.path.length&&1===e.type?this.addFont(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteFont(e.id);else if("variables"===e.path[0])2===e.path.length&&0===e.type?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):1===e.path.length&&4===e.type?this.addVariableHolder(e.id,e.data):1===e.path.length&&5===e.type&&this.deleteVariable(e.id);else if("userAPIs"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserAPI(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserAPI(e.id);else if("string"==typeof e.path[1]){let i=t.userAPIs[e.path[1]];if(i){let t=0===e.type&&void 0===e.props.debounce,r=this.getUserAPI(e.path[1]);r instanceof M7?r.update(i):r?.update(i,this,t)}}}else if("userWebhooks"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserWebhook(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserWebhook(e.id);else if("string"==typeof e.path[1]){let i=t.userWebhooks[e.path[1]];i&&this.getUserWebhook(e.path[1])?.update(i)}}else"lib"===e.path[0]&&this.updateLibByOp(fv.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),a={...this.data.fonts[e],url:t.props.url};r.update(a),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){return this.userAPIs[e]?(this.userAPIs[e].update(t,this),!0):this.openAIRealtime?.id===e?(this.openAIRealtime.update(t),!0):(t.integration?.type==="VoiceAssistant"?this.openAIRealtime=new M7(t,e,this):this.userAPIs[e]=new SP(e,t,this),!1)}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){return this.userWebhooks[e]?(this.userWebhooks[e].update(t),!0):(this.userWebhooks[e]=new MJ(e,t),!1)}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}};new Ei(xd.emptyData());var Er=class extends _A{updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),null!==function(e,t){let i=[];if(t.length!==e.length)return null;for(var r=0;r<e.length;){if("*"===t[r])i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}return i}(e.path,["materials"])&&0===e.type&&Array.isArray(this.material))for(let[t,r]of Object.entries(e.props)){let e=i.shared.material(r);this.material[Number(t)]=e}else if(fd(e.path,["material"])&&this.material instanceof MT)"material"in t&&"string"!=typeof t.material&&this.material.updateByOp(fv.drop(e,1),t.material,i);else if(fd(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let a=t.materials[r];"string"!=typeof a&&this.material[r].updateByOp(fv.drop(e,2),a,i)}}}get needsAO(){return void 0!==this.material&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}updateState(e,t){let i;super.updateState(e,t),void 0!==e.castShadow&&(this.castShadow=e.castShadow),void 0!==e.receiveShadow&&(this.receiveShadow=e.receiveShadow);let r=this.dataPatched;"Mesh"===this.dataPatched.type&&this.dataPatched.geometry.shapeBlendNode&&this.layers.set(9),"Mesh"===this.dataPatched.type&&"ShapeBlendGeometry"===this.dataPatched.geometry.type&&(i={resolutionLevel:this.dataPatched.geometry.resolutionLevel,useChildrenColors:this.dataPatched.geometry.useChildrenColors}),e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&void 0!==e.materials?(this.disposeMaterial(),this.material=e.materials.map(e=>t.shared.material(e).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let a=this.data;if(a.geometry?.type!=="NonParametricGeometry"&&"materials"in a&&void 0!==a.materials&&(this.disposeMaterial(),this.material=t.shared.material(a.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),void 0!==e.flatShading||void 0!==e.wireframe||void 0!==e.side){if(Array.isArray(this.material))for(let e=0;e<this.material.length;e++)this.material[e]=this.material[e].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i)}}
5427disposeMaterial(){this.material&&vc(this.material).forEach(e=>{e instanceof MT&&(e instanceof MI||e.nodeMaterialDispose())})}dispose(){this.disposeMaterial(),super.dispose()}},Es=new iD,Ea=new iA,En=new iA,Eo=new iD,El=new i6,Eh=class extends Er{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=new i6().fromArray(t.bindMatrix),this.bindMatrixInverse=new i6)}chooseGeoemtryCache(e){return e.geometryCache}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof rQ&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Ei){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e);this.geometryCreateDeleyed=t.get(this.dataPatched.geometry,e,this)}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return vw.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return vw.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),fd(e.path,["geometry"])&&this.updateByPatchedOpGeometry(fv.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,r,a;if(void 0===this.localGeometry){let i={...this.data.geometry,...e};this.localGeometry=S$(i,t,this.data.flatShading,this)}e.scaleBaked?[i,r,a]=e.scaleBaked:{width:i,height:r,depth:a}=e;let o=this.localGeometry.userData,l="number"==typeof i?i:1,h="number"==typeof r?r:1,c="number"==typeof a?a:1;void 0!==o.sxPrev&&S1(this.localGeometry.attributes,l/o.sxPrev,h/o.syPrev,c/o.szPrev),o.sxPrev=l,o.syPrev=h,o.szPrev=c}else{let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=S$(i,t,this.data.flatShading,this)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;0===e.type&&0===e.path.length&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof S7&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}updateState(e,t){void 0!==e.geometry&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i)for(let{data:{name:e,value:r}}of(this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0,i))this.updateMorphInfluences(e,t.shared.getVariable(r,[this.uuid,"morphTargetInfluences",e]));super.updateState(e,t)}updateMorphInfluences(e,t){if(void 0===this.morphTargetDictionary)return;let i=this.morphTargetDictionary[e];void 0!==i&&(this.morphTargetInfluences[i]=t)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&0===this.geometry.groups.length&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new iA,i=this.geometry.attributes.skinWeight;for(let e=0,r=i.count;e<r;e++){t.fromBufferAttribute(i,e);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),i.setXYZW(e,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(void 0===i)return;let r=this.geometry;Ea.fromBufferAttribute(r.attributes.skinIndex,e),En.fromBufferAttribute(r.attributes.skinWeight,e),Es.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=En.getComponent(e);
vendor: 5,404 bytes, line 5427
5427if(0!==r){let a=Ea.getComponent(e);El.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(Eo.copy(Es).applyMatrix4(El),r)}}return t.applyMatrix4(this.bindMatrixInverse)}};function Ec(e){if(Array.isArray(e.material)){for(let t of e.material)if(0===t.getLayersOfType("outline").length)return}else if(!(e.material instanceof MT)||0===e.material.getLayersOfType("outline").length)return;e instanceof Eh&&e.is2DAndNoDepth?function(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let t=e.geometry.attributes.position.array,i=new Float32Array(t.length),r=new iD;for(let e=0;e<t.length;e+=3)r.set(t[e],t[e+1],t[e+2]).normalize(),i[e]=r.x,i[e+1]=r.y,i[e+2]=r.z;e.geometry.setAttribute("extrudeNormal",new rV(i,3))}(e):function(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let t=new Map,i=e.geometry.attributes,r=i.position.array,a=i.normal.array,o=new Float32Array(r.length);for(let e=0;e<r.length;e+=3){let i=`${r[e]}_${r[e+1]}_${r[e+2]}`,o=new iD(a[e],a[e+1],a[e+2]);t.has(i)?t.get(i)?.normals.push(o):t.set(i,{normals:[o],result:new iD})}t.forEach((e,t)=>{for(let t of e.normals)e.result.add(t);e.result.divideScalar(e.normals.length)});for(let e=0;e<r.length;e+=3){let i=`${r[e]}_${r[e+1]}_${r[e+2]}`,a=t.get(i)?.result;a&&(o[e]=a.x,o[e+1]=a.y,o[e+2]=a.z)}e.geometry.setAttribute("extrudeNormal",new rV(o,3))}(e)}function Ed(e){if(!e.geometry.attributes.position)return;let t=e.geometry.attributes.position.array,i=new Float32Array(t.length),r=parseInt(e.uuid.replace(/\D/g,"")),a=[t8.seededRandom(r),t8.seededRandom(r+1e4),t8.seededRandom(r+2e4)];for(let e=0;e<t.length;e++)i[e]=a[e%3];e.geometry.setAttribute("randomColor",new rN(i,3))}var Eu=new iR,Ep=new iD,Ef=class extends Eh{constructor(e,t,i){super(e,t,i),this.data=t,this.hiddenMatrixOld=new i6,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(!0===this.skipReactionUpdate)return;let t=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:r,subdivPointer:a}=S7.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=a,void 0!==i&&(this.originalGeometry?.dispose(),this.originalGeometry=i),void 0!==r&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,Ec(this),Ed(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}updateState(e,t){if(super.updateState(e,t),void 0!==e.flatShading){let i=this.material;this.material=Array.isArray(i)?i.map(e=>e.getFlavor(!1,e.side,e.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(t)}}updateMesh(e=!1){S7.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&S7.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=S7.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=S7.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry}raycast(e,t){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,_A.prototype.raycast.call(this,e,t),this.localGeometry=i}activateSVDCompensation(){this.hasNonUniformScale&&(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.hasNonUniformScale&&(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new iK,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Eu.setFromBufferAttribute(t),Eu.getCenter(i),e.boundingSphere.radius=i.distanceTo(Eu.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Eu.getSize(Ep),this.hasNonUniformScale&&Ep.divide(this.scale);let r={width:Ep.x,height:Ep.y,depth:Ep.z};return this.geometry.userData.parameters=r,r}updateBoundingSphere(e){let t=this.originalGeometry;Eu.min.set(e[0],e[2],e[4]),Eu.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(Eu.min.applyMatrix4(this.shearScaleInv),Eu.max.applyMatrix4(this.shearScaleInv)),null===t.boundingSphere&&(t.boun
5427dingSphere=new iK);let i=t.boundingSphere.center;Eu.getCenter(i),t.boundingSphere.radius=i.distanceTo(Eu.max)}freeSubdivPointer(){this.subdivPointer&&(S7.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),this.localGeometry&&this.createGeometryByControls(t)}},Em={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},Eg={polygon_center:0,edge:1,vertex:2},Ev=(e,t)=>(i,r)=>t&&0!==i&&0!==e?e*r/100:0,Ey=(e,t)=>{let i=Math.abs(t),r=-1*i;return(e- -1)*(i-r)/2+r},Ex=new iD,Eb=new iD,Ew=new iD,ES=new iD;function E_(e,t){let i=Ew.fromArray(e),r=ES.fromArray(t);Eb.copy(r).sub(i);let a=Eb.length();return Eb.normalize().multiplyScalar(.5*a),Ex.copy(i).add(Eb).toArray()}var EA=new rI,EM=new iD,EE=new iD,EC=new iD,ET=e=>.5*(1-Math.cos(e*Math.PI)),EP=class{constructor(){this.perlin=Array(4096)}noise(e,t=0,i=0){if(null==this.perlin){this.perlin=Array(4096);for(let e=0;e<4096;e++)this.perlin[e]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),i<0&&(i=-i);let r=Math.floor(e),a=Math.floor(t),o=Math.floor(i),l=e-r,h=t-a,c=i-o,d,p,f=0,m=.5,g,v,y;for(let e=0;e<4;e++){let e=r+(a<<4)+(o<<8);d=ET(l),p=ET(h),g=this.perlin[4095&e],g+=d*(this.perlin[e+1&4095]-g),v=this.perlin[e+16&4095],v+=d*(this.perlin[e+16+1&4095]-v),g+=p*(v-g),e+=256,v=this.perlin[4095&e],v+=d*(this.perlin[e+1&4095]-v),y=this.perlin[e+16&4095],y+=d*(this.perlin[e+16+1&4095]-y),v+=p*(y-v),g+=ET(c)*(v-g),f+=g*m,m*=.5,r<<=1,a<<=1,h*=2,o<<=1,c*=2,(l*=2)>=1&&(r++,l--),h>=1&&(a++,h--),c>=1&&(o++,c--)}return f}noiseSeed(e){let t,i;let r={setSeed(e){i=t=(e??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(i=(1664525*i+1013904223)%4294967296)/4294967296};r.setSeed(e),this.perlin=Array(4096);for(let e=0;e<4096;e++)this.perlin[e]=r.rand()}},ED=new iD,EO=new i6,EI=new i5;function ER(e){let t=!1;return e.scene.objects.traverse((e,i)=>{"Mesh"===i.type&&("TextGeometry"===i.geometry.type||"InputGeometry"===i.geometry.type)&&(t=!0)}),t}var EL,EB,Ez,EF,EN,EU=class extends Eh{constructor(e,t,i){super(e,t,i),this.data=t}get textGeometry(){return this.geometry}get charWidths(){return this.textGeometry.charWidths}get charCoords(){return this.textGeometry.charCoords}get wrappedText(){return this.textGeometry.wrappedText}get font(){return this.textGeometry.font}get initialOffsetY(){let e=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,"number"==typeof e.geometry.height?e.geometry.height:1,this.fontScale,e.geometry.verticalAlign)??0}get fontScale(){let e=this.dataPatched;return this.font?e.geometry.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){let e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}raycast(e,t){let{matrixWorld:i}=this;if(!(isNaN(e.ray.origin.x)||0===this.scale.x||0===this.scale.y||0===this.scale.z)&&(EO.copy(i).invert(),EI.copy(e.ray).applyMatrix4(EO),EI.intersectBox(this.singleBBox,ED))){let r=ED.applyMatrix4(i),a=e.ray.origin.distanceTo(r);t.push({distance:a,point:r.clone(),object:this})}}},Ek=new iD,EV=new iD;SZ.then(e=>{Ez=[(EB=e).get_face_center,EB.get_edge_midpoint,EB.get_vertex_position],EF=[EB.get_face_normal,EB.get_edge_normal,EB.get_vertex_normal],EN=[EB.face_count,EB.edge_count,EB.vertex_count]});var Ej=new i6,EG=new i6,EH=new iD,EW=new iD,Eq=new iD,EX=new iD,EY=new iD,EQ=new iD;function EZ(e,t){return["number"==typeof e?.[0]?e[0]:"string"==typeof e?.[0]&&t?parseFloat(String(t.shared.getVariable(e[0])??"0")):0,"number"==typeof e?.[1]?e[1]:"string"==typeof e?.[1]&&t?parseFloat(String(t.shared.getVariable(e[1])??"0")):0,"number"==typeof e?.[2]?e[2]:"string"==typeof e?.[2]&&t?parseFloat(String(t.shared.getVariable(e[2])??"0")):0]}var EK=class{constructor(e,t){this.data=e,this.is3D=t,this.perlin=new EP,"perlin"===e.n
5427oiseType?(this.perlin.noiseSeed(e.seed),t?this.noise=(e,t,i)=>this.perlin.noise(e,t,i):this.noise=e=>this.perlin.noise(e)):t?this.noise=function(e=Math.random){let t=bt(e),i=new Float64Array(t).map(e=>be[e%12*3]),r=new Float64Array(t).map(e=>be[e%12*3+1]),a=new Float64Array(t).map(e=>be[e%12*3+2]);return function(e,o,l){let h,c,d,p,f=(e+o+l)*x6,m=x9(e+f),g=x9(o+f),v=x9(l+f),y=(m+g+v)*x8,x=e-(m-y),b=o-(g-y),w=l-(v-y),S,_,A,M,E,C;x>=b?b>=w?(S=1,_=0,A=0,M=1,E=1,C=0):(x>=w?(S=1,_=0,A=0):(S=0,_=0,A=1),M=1,E=0,C=1):b<w?(S=0,_=0,A=1,M=0,E=1,C=1):x<w?(S=0,_=1,A=0,M=0,E=1,C=1):(S=0,_=1,A=0,M=1,E=1,C=0);let T=x-S+x8,P=b-_+x8,D=w-A+x8,O=x-M+2*x8,I=b-E+2*x8,R=w-C+2*x8,L=x-1+3*x8,B=b-1+3*x8,z=w-1+3*x8,F=255&m,N=255&g,U=255&v,k=.6-x*x-b*b-w*w;if(k<0)h=0;else{let e=F+t[N+t[U]];k*=k,h=k*k*(i[e]*x+r[e]*b+a[e]*w)}let V=.6-T*T-P*P-D*D;if(V<0)c=0;else{let e=F+S+t[N+_+t[U+A]];V*=V,c=V*V*(i[e]*T+r[e]*P+a[e]*D)}let j=.6-O*O-I*I-R*R;if(j<0)d=0;else{let e=F+M+t[N+E+t[U+C]];j*=j,d=j*j*(i[e]*O+r[e]*I+a[e]*R)}let G=.6-L*L-B*B-z*z;if(G<0)p=0;else{let e=F+1+t[N+1+t[U+1]];G*=G,p=G*G*(i[e]*L+r[e]*B+a[e]*z)}return 32*(h+c+d+p)}}((0,x3.default)(e.seed)):this.noise=function(e=Math.random){let t=bt(e),i=new Float64Array(t).map(e=>x7[e%12*2]),r=new Float64Array(t).map(e=>x7[e%12*2+1]);return function(e,a){let o=0,l=0,h=0,c=(e+a)*x4,d=x9(e+c),p=x9(a+c),f=(d+p)*x5,m=e-(d-f),g=a-(p-f),v,y;m>g?(v=1,y=0):(v=0,y=1);let x=m-v+x5,b=g-y+x5,w=m-1+2*x5,S=g-1+2*x5,_=255&d,A=255&p,M=.5-m*m-g*g;if(M>=0){let e=_+t[A],a=i[e],l=r[e];M*=M,o=M*M*(a*m+l*g)}let E=.5-x*x-b*b;if(E>=0){let e=_+v+t[A+y],a=i[e],o=r[e];E*=E,l=E*E*(a*x+o*b)}let C=.5-w*w-S*S;if(C>=0){let e=_+1+t[A+1],a=i[e],o=r[e];C*=C,h=C*C*(a*w+o*S)}return 70*(o+l+h)}}((0,x3.default)(e.seed??""))}},EJ=class extends bh(rw){constructor(e,t){super(),this.parameters=t,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.object=e}resetOnMove(){this.removeFromParent(),this.parent=null}expandClones(e){if(null===this.parent)this.updateState(this.parameters,e);else for(let e of this.children)e instanceof bu&&e.expand()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0,this.traverse(t=>{t instanceof bu&&t.object===e&&(t.matrixWorldNeedsUpdate=!0)})}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(e){switch(this._updateCount(e),this.parameters.type){case"radial":this._updateRadial(this.parameters,e);break;case"linear":this._updateLinear(this.parameters,e);break;case"grid":this._updateGrid(this.parameters,e);break;case"toObject":this._updateToObject(this.parameters,e)}for(let e of this.children)e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD())}_updateCount(e,t){let i;if(void 0!==t)i=t;else{let t=EZ(this.parameters.grid.count,e);i="grid"===this.parameters.type?Math.round(t[0])*Math.round(t[1])*Math.round(t[2]):this.parameters.count}if("toObject"===this.parameters.type){if(this.parameters.toObject.object){if(void 0===t&&"random"!==this.parameters.toObject.spreadType)return}else i=0}if("toObject"===this.parameters.type&&this.objectForSample){let e=this.children;if(e.length===i)return;if(e.length<i)for(let t=0,r=i-e.length;t<r;++t){let e=new bu(this.object);e.expand(),this.add(e)}else for(let t=0,r=e.length-i;t<r;++t)this.remove(e[t])}else{if(this.children.length===i)return;if(this.children.length<i)for(let e=0,t=i-this.children.length;e<t;++e){let e=new bu(this.object);e.expand(),this.add(e)}else for(let e=0,t=this.children.length-i;e<t;++e)this.remove(this.children[e])}}getRandom(e,t=!1){return(null===this.random||this.random.data.seed!==e.seed||this.random.is3D!==t)&&(this.random=new EK(e,t)),this.random}_updateRadial(e,t){let i=e.radial,r=i.start*t8.DEG2RAD,a=r-i.end*t8.DEG2RAD,o=EZ(i.rotation,t),l=new rn(o[0],o[1],o[2]),h;switch(i.axis){case"z":h=new iD(0,0,1);break;case"y":h=new iD(0,1,0);break;default:h=new iD(1,0,0)}let c=e.randomnessObject??gV.defaultData([1,1,1]).randomnessObject,d=this.getRandom(c),p=Ev(c.strength,this.parameters.randomness);for(let[o,f]of this.children.entries()){let m=c.freqScale/10*o+c.movement,g=d.noise(m,m,m),v=o+1,y=EZ(i.scale,t),x=EZ(c.scale,t);f.scale.x=y[0]+p(v,Ey(g,x[0]))||1e-4,f.scale.y=y[1]+p(v,Ey(g,x[1]))||1e-4,f.scale.z
5427=y[2]+p(v,Ey(g,x[2]))||1e-4,f.position.setScalar(0);let b=a/e.count*o-r;switch(i.axis){case"x":f.rotation.set(0,b,0);break;case"y":f.rotation.set(0,0,b);break;case"z":f.rotation.set(b,0,0)}f.translateOnAxis(h,i.radius);let w=EZ(i.position,t),S=EZ(c.position,t);f.position.x+=w[0]+p(v,Ey(g,S[0])),f.position.y+=w[1]+p(v,Ey(g,S[1])),f.position.z+=w[2]+p(v,Ey(g,S[2]));let _=EZ(c.rotation,t),A=p(v,Ey(g,_[0])),M=p(v,Ey(g,_[1])),E=p(v,Ey(g,_[2]));!0===i.alignment?(f.rotation.x+=l.x+A,f.rotation.y+=l.y+M,f.rotation.z+=l.z+E):f.rotation.set(l.x+A,l.y+M,l.z+E)}}_updateLinear(e,t){if("linear"!==e.type)throw Error();let i=e.linear,r=EZ(i.rotation,t),a=EZ(i.scale,t),o=EZ(i.position,t),l=new rn(r[0]??0,r[1]??0,r[2]??0),h=e.randomnessObject??gV.defaultData([1,1,1]).randomnessObject,c=EZ(h.rotation,t),d=EZ(h.scale,t),p=EZ(h.position,t),f=this.getRandom(h),m=Ev(h.strength,this.parameters.randomness);for(let[e,t]of this.children.entries()){let i=h.freqScale/10*e+h.movement,r=f.noise(i,i,i),g=e+1,v=m(g,Ey(r,c[0])),y=m(g,Ey(r,c[1])),x=m(g,Ey(r,c[2]));t.scale.x=1+(a[0]-1)*e+m(g,Ey(r,d[0]))||1e-4,t.scale.y=1+(a[1]-1)*e+m(g,Ey(r,d[1]))||1e-4,t.scale.z=1+(a[2]-1)*e+m(g,Ey(r,d[2]))||1e-4,t.rotation.x=l.x*e+v,t.rotation.y=l.y*e+y,t.rotation.z=l.z*e+x,t.position.x=o[0]*e+m(g,Ey(r,p[0])),t.position.y=o[1]*e+m(g,Ey(r,p[1])),t.position.z=o[2]*e+m(g,Ey(r,p[2]))}}_updateGrid(e,t){let i=0,r=e.grid,a=e.randomnessObject??gV.defaultData([1,1,1]).randomnessObject,o=EZ(a.scale,t),l=EZ(a.rotation,t),h=EZ(a.position,t),c=this.getRandom(a,!0),d=Ev(a.strength,this.parameters.randomness),p=EZ(r.count,t),f=EZ(r.size,t);if(!0===r.useCenter){let e={x:p[0]%2==0?2:1,y:p[1]%2==0?2:1,z:p[2]%2==0?2:1},t=new iD(f[0]*(p[0]-e.x)*.5,f[1]*(p[1]-e.y)*.5,f[2]*(p[2]-e.z)*.5);for(let e=0;e<p[0];e++)for(let r=0;r<p[1];r++)for(let m=0;m<p[2];m++){let p=c.noise(a.freqScale/10*(e+1)+a.movement,a.freqScale/10*(r+1)+a.movement,a.freqScale/10*(m+1)+a.movement),g=this.children[i++];if(!g)continue;g.scale.x=1+d(i,Ey(p,o[0]))||1e-4,g.scale.y=1+d(i,Ey(p,o[1]))||1e-4,g.scale.z=1+d(i,Ey(p,o[2]))||1e-4;let v=d(i,Ey(p,l[0])),y=d(i,Ey(p,l[1])),x=d(i,Ey(p,l[2]));g.rotation.set(v,y,x),g.position.x=f[0]*e-t.x+d(i,Ey(p,h[0])),g.position.y=f[1]*r-t.y+d(i,Ey(p,h[1])),g.position.z=f[2]*m-t.z+d(i,Ey(p,h[2]))}}else for(let e=0;e<p[0];e++)for(let t=0;t<p[1];t++)for(let r=0;r<p[2];r++){let p=c.noise(a.freqScale/10*(e+1)+a.movement,a.freqScale/10*(t+1)+a.movement,a.freqScale/10*(r+1)+a.movement),m=this.children[i++];if(!m)continue;m.scale.x=1+d(i,Ey(p,o[0]))||1e-4,m.scale.y=1+d(i,Ey(p,o[1]))||1e-4,m.scale.z=1+d(i,Ey(p,o[2]))||1e-4;let g=d(i,Ey(p,l[0])),v=d(i,Ey(p,l[1])),y=d(i,Ey(p,l[2]));m.rotation.set(g,v,y),m.position.x=f[0]*e+d(i,Ey(p,h[0])),m.position.y=-f[1]*t+d(i,Ey(p,h[1])),m.position.z=-f[2]*r+d(i,Ey(p,h[2]))}}_updateToObject(e,t){if("toObject"!==e.type)throw Error();let{toObject:i}=e,r=EZ(i.rotation,t),a=EZ(i.position,t),o=EZ(i.scale,t),l=new rn(r[0],r[1],r[2]),h=e.randomnessObject??gV.defaultData([1,1,1]).randomnessObject,c=EZ(h.rotation,t),d=EZ(h.position,t),p=EZ(h.scale,t),f=this.getRandom(h),m=Ev(h.strength,this.parameters.randomness);if(!i.object){for(let[,e]of this.children.entries())e.position.set(0,0,0),e.scale.setScalar(1),e.rotation.set(0,0,0);this.objectForSample=void 0;return}if(!this.objectForSample)return;if(this.objectForSample instanceof EU){if(this.objectForSample.font?.isLoaded&&void 0!==this.objectForSample.geometry.attributes.position)this._pendingMediaLoad=!1;else{this._pendingMediaLoad=!0;return}}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid)){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);return}let g=this.getSubdivData();if(g.length>0){let e=Math.round(g.length*i.count/100);this._updateCount(t,e)}else{let e=this.objectForSample.geometry.getAttribute("position");if(!e||isNaN(e.count)||0===e.count){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`);return}}this.objectForSample.updateMatrixWorld();let v=new bs(this.objectForSample).build(),y=Em[i.axis],x=this.children;for(let[e,t]of(v.setRandomGenerator((0,x3.default)(this.object.uuid+i.seed)),x.entries())){let r=h.freqScale/10*e+h.movement,x=f.noise(r,r,r),b=e+1,w=m(b,Ey(x,c[0])),S=m(b,Ey(x,c[1])),_=m(b,Ey(x,c[2]));"random"===i.spreadType?v.sample(Eq,EX):(g.length&&(Eq.fromArray(g[e].pos),EX.fromArray(g[e].norm)),this.objectForSample instanceof Ef&&Eq.applyM
5427atrix4(Ej.copy(this.objectForSample.matrixWorld).invert())),Eq.applyMatrix4(this.object.hiddenMatrix.clone().invert()),t.position.copy(Eq),EH.fromArray(y);let A="normal"===i.align?EX:this.object.getWorldDirection(EQ),M=EW.fromArray(a);EW.x+=m(b,Ey(x,d[0])),EW.y+=m(b,Ey(x,d[1])),EW.z+=m(b,Ey(x,d[2]));let E=Math.acos(A.dot(EH)),C=EY.crossVectors(EH,A).normalize(),T=EG.makeRotationAxis(C,E),P=A.clone().cross(this.object.up).normalize(),D=P.clone().cross(A).normalize(),O=new i6().makeBasis(P,A,D),I=new iD(EH.y,EH.z,EH.x).normalize(),R=I.clone().cross(EH).normalize(),L=new i6().makeBasis(I,EH,R).invert(),B=new i6().multiplyMatrices(O,L);t.rotation.setFromRotationMatrix(B),M.applyMatrix4(T),t.position.add(M),t.rotation.x=t.rotation.x+l.x+w,t.rotation.y=t.rotation.y+l.y+S,t.rotation.z=t.rotation.z+l.z+_,t.scale.setScalar(1),t.scale.x=t.scale.x+o[0]+m(b,Ey(x,p[0]))||1e-4,t.scale.y=t.scale.y+o[1]+m(b,Ey(x,p[1]))||1e-4,t.scale.z=t.scale.z+o[2]+m(b,Ey(x,p[2]))||1e-4,t.scale.multiply(this.object.scale),t.hiddenMatrix=this.object.hiddenMatrix}}getSubdivData(){if(!this.objectForSample)return[];let e=this.parameters.toObject.spreadType,t=new Map,i=(e,i)=>{let r=Math.round(1e4*e[0])+"_"+Math.round(1e4*e[1])+"_"+Math.round(1e4*e[2]),a=t.get(r);a?(a.pos[0]+=e[0],a.pos[1]+=e[1],a.pos[2]+=e[2],a.norm[0]+=i[0],a.norm[1]+=i[1],a.norm[2]+=i[2],a.count+=1):t.set(r,{pos:[...e],norm:[...i],count:1})};if("random"===e)return[];if(this.objectForSample instanceof Ef){let t=this.objectForSample,r=Eg[e],a=EN[r],o=Ez[r],l=EF[r],h=a(t.subdivPointerNew);for(let e=0;e<=h-1;e++){let r=o(t.subdivPointerNew,e),a=l(t.subdivPointerNew,e);Ek.fromArray(r).applyMatrix4(t.matrixWorld),EV.fromArray(a),i(Ek.toArray(),EV.toArray())}}else(this.objectForSample.geometry.index?function(e){let t=[];for(let i=0;i<=e.index.count;i++)if(EM.fromArray(e.index.array,3*i),EA.setFromAttributeAndIndices(e.attributes.position,EM.x,EM.y,EM.z),EA.getNormal(EE),EA.getMidpoint(EC),!(isNaN(EC.x)||isNaN(EC.y)||isNaN(EC.z))){let{a:e,b:i,c:r}=EA,a=e.toArray(),o=i.toArray(),l=r.toArray(),h=e.distanceTo(i),c=i.distanceTo(r),d=r.distanceTo(e),p=E_(a,o),f=E_(o,l),m=E_(l,a),g=[h,c,d],v=Math.max(...g),y=g.filter(e=>Math.round(e)===Math.round(v)).length>1,x=[],b=EA.getMidpoint(EC).toArray();v!==h||y||(x=[f,m,m],b=p),v!==c||y||(x=[p,m,m],b=f),v!==d||y||(x=[p,f,f],b=m),y&&(x=[p,f,m]),t.push({vertices:[a,o,l],faceCenters:x,midpoint:b,norm:EA.getNormal(EE).toArray()})}return t}(this.objectForSample.geometry):function(e){let t=[],{position:i}=e.attributes;for(let e=0;e<i.count;e++){EA.setFromAttributeAndIndices(i,3*e,3*e+1,3*e+2),EA.getNormal(EE),EA.getMidpoint(EC);let r=EA.a.toArray(),a=EA.b.toArray(),o=EA.c.toArray();t.push({vertices:[r,a,o],faceCenters:[E_(r,a),E_(a,o),E_(o,r)],midpoint:EC.toArray(),norm:EE.toArray()})}return t}(this.objectForSample.geometry)).forEach((t,r)=>{"polygon_center"===e&&i(t.midpoint,t.norm),"vertex"===e&&(i(t.vertices[0],t.norm),i(t.vertices[1],t.norm),i(t.vertices[2],t.norm)),"edge"===e&&(i(t.faceCenters[0],t.norm),i(t.faceCenters[1],t.norm),i(t.faceCenters[2],t.norm))});let r=Array.from(t.values());for(let e of r)e.pos[0]/=e.count,e.pos[1]/=e.count,e.pos[2]/=e.count,e.norm[0]/=e.count,e.norm[1]/=e.count,e.norm[2]/=e.count;return r}updateState(e,t){if(this.parameters=uk(e),"toObject"!==this.parameters.type)(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent();let e=t.scene.find(this.parameters.toObject.object);e instanceof _A?this.objectForSample=e:this.objectForSample=void 0,this.matrix=new i6,this.hiddenMatrix=new i6,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,e&&e.add(this)}this.update(t)}get pendingMediaLoad(){return this._pendingMediaLoad}},E$=e=>{var t;return(t=class extends e{}).geometryHelper=new st(30,30,30),t},E0=new i5,E1=new iK,E2=new i6,E3=(e,t,i,r,a=!1,o=e)=>{let l=o.matrixWorld;if(null===t.boundingSphere&&t.computeBoundingSphere(),E1.copy(t.boundingSphere),E1.applyMatrix4(l),!1===i.ray.intersectsSphere(E1)||(E2.copy(l).invert(),E0.copy(i.ray).applyMatrix4(E2),null!==t.boundingBox&&!1===E0.intersectsBox(t.boundingBox)))return;let h,c=t.index,d=t.attributes.position,p=t.drawRange,f;if(!1===a){let t=Math.max(0,p.start),a=Math.min(c.count,p.start+p.count);for(f=t;f<a;f+=3)if(h=function(e,t,i,r,a,o,l){let h=new iD,c=new iD,d=new iD,p=new iD,f=new iD;if(h.fromBufferAttribute(r,a),c.fromBufferAttribute(r,o),d.fromBufferAttribute(r,l),null===i.intersectTriangle(h,c,d,!1,p))return null;
5427f.copy(p),f.applyMatrix4(e.matrixWorld);let m=t.ray.origin.distanceTo(f);return m<t.near||m>t.far?null:{faceIndex:1,distance:m,point:f.clone(),object:e}}(e,i,E0,d,c.getX(f),c.getX(f+1),c.getX(f+2))){h.faceIndex=Math.floor(f/3),r.push(h);return}}else{let a=t.attributes.position,l=new iD,h=new iD,c=new iD,d=new iD,f=1/((o.scale.x+o.scale.y+o.scale.z)/3),m=f*f,g=Math.max(0,p.start),v=Math.min(a.count,p.start+p.count);for(let t=g,p=v-1;t<p;t+=2){if(l.fromBufferAttribute(a,t),h.fromBufferAttribute(a,t+1),E0.distanceSqToSegment(l,h,d,c)>m)continue;d.applyMatrix4(o.matrixWorld);let p=i.ray.origin.distanceTo(d);p<i.near||p>i.far||r.push({distance:p,point:c.clone().applyMatrix4(o.matrixWorld),object:e})}}},E4=new iD,E5=new sh,E6=class extends n4{constructor(e){let t=new rQ,i=new nQ({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],a=[],o={},l=new iv(15711266),h=new iv(15711266),c=new iv(2857471);function d(e,t,i){p(e,i),p(t,i)}function p(e,t){r.push(0,0,0),a.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(r.length/3-1)}d("n1","n2",l),d("n2","n4",l),d("n4","n3",l),d("n3","n1",l),d("f1","f2",l),d("f2","f4",l),d("f4","f3",l),d("f3","f1",l),d("n1","f1",l),d("n2","f2",l),d("n3","f3",l),d("n4","f4",l),d("p","n1",h),d("p","n2",h),d("p","n3",h),d("p","n4",h),d("u1","u2",c),d("u2","u3",c),d("u3","u1",c),t.setAttribute("position",new rV(r,3)),t.setAttribute("color",new rV(a,3)),super(t,i),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(){let e=this.geometry,t=this.pointMap;E5.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001],E8("n1",t,e,E5,-1,-1,.8),E8("n2",t,e,E5,1,-1,.8),E8("n3",t,e,E5,-1,1,.8),E8("n4",t,e,E5,1,1,.8),E8("f1",t,e,E5,-1,-1,.8),E8("f2",t,e,E5,1,-1,.8),E8("f3",t,e,E5,-1,1,.8),E8("f4",t,e,E5,1,1,.8),E8("u1",t,e,E5,.35,1.1,.8),E8("u2",t,e,E5,-.35,1.1,.8),E8("u3",t,e,E5,0,1.55,.8),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function E8(e,t,i,r,a,o,l){E4.set(a,o,l).unproject(r);let h=t[e];if(void 0!==h){let e=i.getAttribute("position");for(let t=0,i=h.length;t<i;t++)e.setXYZ(h[t],E4.x,E4.y,E4.z)}}var E9=class extends E$(E6){constructor(e){super(e),this.object=e,this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){E3(this.object,this.geometry,e,t,!0)}};(PL||(PL={})).is=e=>"objectHelper"in e;var E7=(e,t)=>class extends bL(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(e,t){this.objectHelper.raycast(e,t)}showGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof he&&(t.visible=!0)}}updateEntityBoxSize(e,t){this.objectHelper.visible&&this.geometryHelper instanceof st?(e.setScalar(0),t.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(e,t)}hideGizmos(){for(let e in this.gizmos){let t=this.gizmos[e];t instanceof he&&(t.visible=!1)}}},Ce=new iD,Ct=new iD,Ci=new iP,Cr=new iD,Cs=new iD,Ca=new iD,Cn=class extends E7(sh,E9){constructor(e="",t={...y$.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=gk.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this.super_Entity(e,t),this.previousProjectionMatrix=new i6,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new sL(-.5*i,.5*i,.5*r,-.5*r,-5e4,1e4),this.perspCamera=new sc(45,i/r,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update(
vendor: 4,234 bytes, line 5427
5427)}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){"PerspectiveCamera"===e?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&("PerspectiveCamera"===e?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}set near(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){"number"==typeof e&&(e=new iD(e,t,i)),super.lookAt(e),this.getWorldPosition(Ce),this.targetOffset=Ce.distanceTo(e)}getTarget(e=new iD){return this.getWorldDirection(Ct),this.getWorldPosition(Ce),Ct.multiplyScalar(this.targetOffset),e.copy(Ce).add(Ct),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Ce),Ce.distanceTo(e)}updateUp(){this.getWorldQuaternion(Ci),Cr.set(0,0,1).applyQuaternion(Ci),Cs.copy(rw.DEFAULT_UP),this.isUpVectorFlipped&&Cs.negate(),Cs.applyQuaternion(Ci),Ca.copy(rw.DEFAULT_UP).projectOnPlane(Cr),this.angleOffsetFromUp=Ca.angleTo(Cs),this.angleOffsetFromUp*=Ca.cross(Cs).dot(Cr)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new iD),i=e.getWorldDirection(new iD).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new iD).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new iD;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let i=e>t?this.aspect:1,r=e>t?1:this.aspect;this.left=-395*i,this.right=395*i,this.top=1/r*395,this.bottom=-(1/r*395)}else this.left=-(.5*e),this.right=.5*e,this.top=.5*t,this.bottom=-(.5*t);this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,a,o){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,i,r,a,o):this.orthoCamera.setViewOffset(e,t,i,r,a,o)}clearViewOffset(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"Orthogra
5427phicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=null===e.view?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){return ps({type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped},e)}updateCameraSubtype(e,t){let i="perspective"===e?"PerspectiveCamera":"OrthographicCamera";void 0!==t.zoom&&this.setZoom(i,t.zoom),void 0!==t.near&&this.setNear(i,t.near),void 0!==t.fov&&"PerspectiveCamera"===i&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),void 0!==e.far&&(this.far=e.far),void 0!==e.orthographic&&this.updateCameraSubtype("orthographic",e.orthographic),void 0!==e.perspective&&this.updateCameraSubtype("perspective",e.perspective),void 0!==e.type&&(this.cameraType=e.type),void 0!==e.up&&this.up.fromArray(e.up.map(e=>"number"==typeof e?e:0)),void 0!==e.targetOffset&&(this.targetOffset=e.targetOffset),void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),1===e.path.length&&0===e.type&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},Co=new i6,Cl=new i6;function Ch(e){let t=!1;return e.scene.objects.traverse((e,i)=>{i.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}var Cc=class extends Er{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new rQ,this.onAfterRender=(e,t,i,r,a,o)=>{super.onAfterRender(e,t,i,r,a,o),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(-1!==this.booleanMeshSetAddress&&!e)return;for(let i=0;i<this.children.length;i++){let r=this.children[i];r instanceof Cc&&!0===r.dataPatched.visible&&r.recomputeBoolean(!0===e,t)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let r=this.children[i];if(r instanceof _A&&!0===r.dataPatched.visible&&r.geometry.attributes.position?.count>0&&r.geometry.drawRange.count>0&&0!==r.booleanMeshSetAddress){Co.multiplyMatrices(r.hiddenMatrix,r.matrix).multiply(r.pivotMatrix);try{if(-1===r.booleanMeshSetAddress){if((r.geometry.index??r.geometry.getAttribute("position")).count/3<15e5&&(r.booleanMeshSetAddress=_o.getMeshSet(r.geometry,!0===e,t)),-1===r.booleanMeshSetAddress)return;_o.transformMeshSet(r.booleanMeshSetAddress,Co),r.booleanMatrixInvOld.copy(Co).invert(),r.booleanWasTransformed=!1}else r instanceof Cc&&!0===r.needsTransformForDownstream?(_o.transformMeshSet(r.booleanMeshSetAddress,Co),r.needsTransformForDownstream=!1):!0===r.booleanWasTransformed&&(_o.transformMeshSet(r.booleanMeshSetAddress,Cl.multiplyMatrices(Co,r.booleanMatrixInvOld)),r.booleanMatrixInvOld.copy(Co).invert(),r.booleanWasTransformed=!1)}catch(e){console.error(e),r.booleanMeshSetAddress=0,r.geometry.userData.booleanOperationDidFail=!0;continue}!1===_o.hasOpenEdges(r.booleanMeshSetAddress)||i===this.children.length-1&&2===this.booleanOp?(this.meshSetAddresses.push(r.booleanMeshSetAddress),r.geometry.userData.booleanOperationDidFail=!1):r.geometry.userData.booleanOperationDidFail="openEdges"}}if(0===this.meshSetAddresses.length){this.geometry.setAttribute("position",new rV([],0)),this.geometry.setDrawRange(0,0);return}if(!0===e)return _o.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new rQ,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=_o.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(e){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(e)}
vendor: 16,384 bytes, lines 5427-5548
5427this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Ec(this),Ed(this)}dispose(){super.dispose(),this.geometry.dispose()}};(PB||(PB={})).is=function(e){return SH.is(e)&&e instanceof lu};var Cd=(e,t)=>class extends E7(e,t){updateState_Light(e,t){this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity),void 0!==e.depth&&(this.shadow.camera.far=e.depth,this.shadow.needsUpdate=!0),void 0!==e.shadows&&(this.castShadow=e.shadows)}},Cu=e=>e instanceof _A,Cp=e=>null!==e&&e instanceof Cc,Cf=e=>PL.is(e),Cm=new iD(1,1,1),Cg=new iD,Cv=new iD,Cy=new iP,Cx=class extends E$(ht){constructor(e,t=15){super(t),this.object=e,this.dummy=new nA,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){E3(this.object,Cx.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(Cg,Cy,Cv),this.matrix.compose(Cg,Cy,Cm),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}},Cb=class extends E7(nA,Cx){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&1===Object.keys(e).length&&t.scene.reloadSplats()}},Cw=class extends E7(nA,Cx){constructor(e,t,i){super(),this.super_Entity(e,t),this.context=i,this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t)}},CS="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",C_=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5428uniform mediump sampler2D inputBuffer; 5429#else 5430uniform lowp sampler2D inputBuffer; 5431#endif 5432uniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;uniform vec4 kernel64[32];varying vec2 vUv;void main(){ 5433#ifdef FOREGROUND 5434vec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale; 5435#else 5436float CoC=texture2D(cocBuffer,vUv).g*scale; 5437#endif 5438if(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{ 5439#ifdef FOREGROUND 5440vec2 step=texelSize*max(CoC,CoCNearFar.g*scale); 5441#else 5442vec2 step=texelSize*CoC; 5443#endif 5444vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;}}`,CA=class extends sl{constructor(e=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{kernel64:new lG(null),kernel16:new lG(null),inputBuffer:new lG(null),cocBuffer:new lG(null),texelSize:new lG(new t9),scale:new lG(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:C_,vertexShader:CS}),this.toneMapped=!1,t&&(this.defines.FOREGROUND="1"),this.generateKernel()}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set cocBuffer(e){this.uniforms.cocBuffer.value=e}setCoCBuffer(e){this.uniforms.cocBuffer.value=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(e){return this.uniforms.scale.value=e}setScale(e){this.uniforms.scale.value=e}generateKernel(){let e=new Float32Array(128),t=new Float32Array(32),i=0,r=0;for(let a=0;a<80;++a){let o=2.39996323*a,l=Math.sqrt(a)/Math.sqrt(80),h=l*Math.cos(o),c=l*Math.sin(o);a%5==0?(t[r++]=h,t[r++]=c):(e[i++]=h,e[i++]=c)}let a=[],o=[];for(let t=0;t<128;)a.push(new iA(e[t++],e[t++],e[t++],e[t++]));for(let e=0;e<32;)o.push(new iA(t[e++],t[e++],t[e++],t[e++]));this.uniforms.kernel64.value=a,this.uniforms.kernel16.value=o}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}};function CM(e,t,i){return Math.min(Math.max((e+t)/(t-i),0),1)}var CE=`#include <common> 5445#include <packing> 5446#ifdef GL_FRAGMENT_PRECISION_HIGH 5447uniform highp sampler2D depthBuffer; 5448#else 5449uniform mediump sampler2D depthBuffer; 5450#endif 5451uniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){ 5452#if DEPTH_PACKING == 3201 5453return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 5454#else 5455return texture2D(depthBuffer,uv).r; 5456#endif 5457}void main(){float depth=readDepth(vUv); 5458#ifdef PERSPECTIVE_CAMERA 5459float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar); 5460#else 5461float linearDepth=depth; 5462#endif 5463float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,CC=class extends sl{constructor(e){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new lG(null),focusDistance:new lG(0),focusRange:new lG(0),cameraNear:new lG(.3),cameraFar:new lG(1e3)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:CE,vertexShader:CS}),this.toneMapped=!1,this.uniforms.focalLength=this.uniforms.focusRange,this.adoptCameraSettings(e)}get near(){return this.uniforms.cameraNear.value}get far(){return this.uniforms.cameraFar.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=3200){this.depthBuffer=e,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(e){this.uniforms.focusDistance.value=e}get worldFocusDistance(){var e;return-(this.focusDistance*((e=this.near)-this.far)-e)}set worldFocusDistance(e){this.focusDistance=CM(-e,this.near,this.far)}getFocusDistance(e){this.uniforms.focusDistance.value=e}setFocusDistance(e){this.uniforms.focusDistance.value=e}get focalLength(){return this.focusRange}set focalLength(e){this.focusRange=e}get focusRange(){return this.uniforms.focusRange.value}set focusRange(e){this.uniforms.focusRange.value=e}get worldFocusRange(){var e;return-(this.focusRange*((e=this.near)-this.far)-e)}set worldFocusRange(e){this.focusRange=CM(-e,this.near,this.far)}getFocalLength(e){return this.focusRange}setFocalLength(e){this.focusRange=e}adoptCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof sc?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},CT=`#include <common> 5464#include <dithering_pars_fragment> 5465#ifdef FRAMEBUFFER_PRECISION_HIGH 5466uniform mediump sampler2D inputBuffer; 5467#else 5468uniform lowp sampler2D inputBuffer; 5469#endif 5470varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; 5471#include <encodings_fragment> 5472#include <dithering_fragment> 5473}`,CP=class extends sl{constructor(e=new t9){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new lG(null),texelSize:new lG(new t9),halfTexelSize:new lG(new t9),kernel:new lG(0),scale:new lG(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:CT,vertexShader:"uniform vec2 texelSize;uniform vec2 halfTexelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize*vec2(kernel)+halfTexelSize)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.setTexelSize(e.x,e.y)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}setSize(e,t){let i=this.uniforms;i.texelSize.value.set(1/e,1/t),i.halfTexelSize.value.copy(i.texelSize.value).multiplyScalar(.5)}},CD=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5474uniform mediump sampler2D inputBuffer; 5475#else 5476uniform lowp sampler2D inputBuffer; 5477#endif 5478uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel; 5479#include <encodings_fragment> 5480}`,CO=class extends sl{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new lG(null),opacity:new lG(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:CD,vertexShader:CS}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},CI=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1; 5481#if THREE_REVISION < 143 5482#define luminance(v) linearToRelativeLuminance(v) 5483#endif 5484#if EDGE_DETECTION_MODE != 0 5485varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5; 5486#endif 5487#if EDGE_DETECTION_MODE == 1 5488#include <common> 5489#endif 5490#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1 5491#ifdef GL_FRAGMENT_PRECISION_HIGH 5492uniform highp sampler2D depthBuffer; 5493#else 5494uniform mediump sampler2D depthBuffer; 5495#endif 5496float readDepth(const in vec2 uv){ 5497#if DEPTH_PACKING == 3201 5498return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 5499#else 5500return texture2D(depthBuffer,uv).r; 5501#endif 5502}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);} 5503#elif PREDICATION_MODE == 2 5504uniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);} 5505#endif 5506#if PREDICATION_MODE != 0 5507vec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);} 5508#endif 5509#if EDGE_DETECTION_MODE != 0 5510uniform sampler2D inputBuffer; 5511#endif 5512void main(){ 5513#if EDGE_DETECTION_MODE == 0 5514const vec2 threshold=vec2(DEPTH_THRESHOLD); 5515#elif PREDICATION_MODE != 0 5516vec2 threshold=calculatePredicatedThreshold(); 5517#else 5518const vec2 threshold=vec2(EDGE_THRESHOLD); 5519#endif 5520#if EDGE_DETECTION_MODE == 0 5521vec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0); 5522#elif EDGE_DETECTION_MODE == 1 5523float l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0); 5524#elif EDGE_DETECTION_MODE == 2 5525vec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0); 5526#endif 5527}`,CR=`uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1; 5528#if EDGE_DETECTION_MODE != 0 5529varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5; 5530#endif 5531void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0); 5532#if EDGE_DETECTION_MODE != 0 5533vUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0); 5534#endif 5535gl_Position=vec4(position.xy,1.0,1.0);}`,CL=class extends sl{constructor(e=new t9,t=2){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:"149".replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new lG(null),depthBuffer:new lG(null),predicationBuffer:new lG(null),texelSize:new lG(e)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:CI,vertexShader:CR}),this.toneMapped=!1,this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=3200){this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},CB=`#include <common> 5536#include <packing> 5537#include <dithering_pars_fragment> 5538#define packFloatToRGBA(v) packDepthToRGBA(v) 5539#define unpackRGBAToFloat(v) unpackRGBAToDepth(v) 5540#ifdef FRAMEBUFFER_PRECISION_HIGH 5541uniform mediump sampler2D inputBuffer; 5542#else 5543uniform lowp sampler2D inputBuffer; 5544#endif 5545#ifdef GL_FRAGMENT_PRECISION_HIGH 5546uniform highp sampler2D depthBuffer; 5547#else 5548u
5548niform mediump sampler2D depthBuffer; 5549#endif 5550uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv; 5551#if THREE_REVISION < 143 5552#define luminance(v) linearToRelativeLuminance(v) 5553#endif 5554#if THREE_REVISION >= 137 5555vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);} 5556#endif 5557float readDepth(const in vec2 uv){ 5558#if DEPTH_PACKING == 3201 5559return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 5560#else 5561return texture2D(depthBuffer,uv).r; 5562#endif 5563}float getViewZ(const in float depth){ 5564#ifdef PERSPECTIVE_CAMERA 5565return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); 5566#else 5567return orthographicDepthToViewZ(depth,cameraNear,cameraFar); 5568#endif 5569}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0; 5570#ifdef ENCODE_OUTPUT 5571#include <encodings_fragment> 5572#endif 5573#include <dithering_fragment> 5574}`,Cz={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},CF=class extends sl{constructor(e,t,i,r,a=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:"149".replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new lG(null),depthBuffer:new lG(null),resolution:new lG(new t9),texelSize:new lG(new t9),cameraNear:new lG(.3),cameraFar:new lG(1e3),aspect:new lG(1),time:new lG(0)},blending:0,depthWrite:!1,depthTest:!1,dithering:a}),this.toneMapped=!1,e&&this.setShaderParts(e),t&&this.setDefines(t),i&&this.setUniforms(i),this.adoptCameraSettings(r)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=3200){this.depthBuffer=e,this.depthPacking=t}setShaderParts(e){return this.fragmentShader=CB.replace(Cz.FRAGMENT_HEAD,e.get(Cz.FRAGMENT_HEAD)).replace(Cz.FRAGMENT_MAIN_UV,e.get(Cz.FRAGMENT_MAIN_UV)).replace(Cz.FRAGMENT_MAIN_IMAGE,e.get(Cz.FRAGMENT_MAIN_IMAGE)),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}".replace(Cz.VERTEX_HEAD,e.get(Cz.VERTEX_HEAD)).replace(Cz.VERTEX_MAIN_SUPPORT,e.get(Cz.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(e){for(let t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(let t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){for(let t of(this.extensions={},e))this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof sc?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let i=this.uniforms;i.resolution.value.set(e,t),i.texelSize.value.set(1/e,1/t),i.aspect.value=e/t}static get Section(){return Cz}},CN=`#include <common> 5575#if THREE_REVISION < 143 5576#define luminance(v) linearToRelativeLuminance(v) 5577#endif 5578#ifdef FRAMEBUFFER_PRECISION_HIGH 5579uniform mediump sampler2D inputBuffer; 5580#else 5581uniform lowp sampler2D inputBuffer; 5582#endif 5583#ifdef RANGE 5584uniform vec2 range; 5585#elif defined(THRESHOLD) 5586uniform float threshold;uniform float smoothing; 5587#endif 5588varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb); 5589#ifdef RANGE 5590float low=step(range.x,l);float high=step(l,range.y);l*=low*high; 5591#elif defined(THRESHOLD) 5592l=smoothstep(threshold,threshold+smoothing,l); 5593#endif 5594#ifdef COLOR 5595gl_FragColor=vec4(texel.rgb*l,l); 5596#else 5597gl_FragColor=vec4(l); 5598#endif 5599}`,CU=class extends sl{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:"149".replace(/\D+/g,"")},uniforms:{inputBuffer:new lG(null),threshold:new lG(0),smoothing:new lG(1),range:new lG(null)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:CN,vertexShader:CS}),this.toneMapped=!1,this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},Ck=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5600uniform mediump sampler2D inputBuffer; 5601#else 5602uniform lowp sampler2D inputBuffer; 5603#endif 5604#ifdef MASK_PRECISION_HIGH 5605uniform mediump sampler2D maskTexture; 5606#else 5607uniform lowp sampler2D maskTexture; 5608#endif 5609#if MASK_FUNCTION != 0 5610uniform float strength; 5611#endif 5612varying vec2 vUv;void main(){ 5613#if COLOR_CHANNEL == 0 5614float mask=texture2D(maskTexture,vUv).r; 5615#elif COLOR_CHANNEL == 1 5616float mask=texture2D(maskTexture,vUv).g; 5617#elif COLOR_CHANNEL == 2 5618float mask=texture2D(maskTexture,vUv).b; 5619#else 5620float mask=texture2D(maskTexture,vUv).a; 5621#endif 5622#if MASK_FUNCTION == 0 5623#ifdef INVERTED 5624mask=step(mask,0.0); 5625#else 5626mask=1.0-step(mask,0.0); 5627#endif 5628#else 5629mask=clamp(mask*strength,0.0,1.0); 5630#ifdef INVERTED 5631mask=1.0-mask; 5632#endif 5633#endif 5634#if MASK_FUNCTION == 2 5635gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask); 5636#else 5637gl_FragColor=mask*texture2D(inputBuffer,vUv); 5638#endif 5639}`,CV=class extends sl{constructor(e=null){super({name:"MaskMaterial",uniforms:{maskTexture:new lG(e),inputBuffer:new lG(null),strength:new lG(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:Ck,vertexShader:CS}),this.toneMapped=!1,this.setColorChannel(0),this.setMaskFunction(0)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set maskTexture(e){this.uniforms.maskTexture.value=e,delete this.defines.MASK_PRECISION_HIGH,1009!==e.type&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(e){this.maskTexture=e}set colorChannel(e){this.defines.COLOR_CHANNEL=e.toFixed(0),this.needsUpdate=!0}setColorChannel(e){this.colorChannel=e}set maskFunction(e){this.defines.MASK_FUNCTION=e.toFixed(0),this.needsUpdate=!0}setMaskFunction(e){this.maskFunction=e}get inverted(){return void 0!==this.defines.INVERTED}set inverted(e){this.inverted&&!e?delete this.defines.INVERTED:e&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(e){this.inverted=e}get strength(){return this.uniforms.strength.value}set strength(e){this.uniforms.strength.value=e}getStrength(){return this.strength}setStrength(e){this.strength=e}},Cj
vendor: 7,736 bytes, lines 5639-5664
5639=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize) 5640#if __VERSION__ < 300 5641#define round(v) floor(v + 0.5) 5642#endif 5643#ifdef FRAMEBUFFER_PRECISION_HIGH 5644uniform mediump sampler2D inputBuffer; 5645#else 5646uniform lowp sampler2D inputBuffer; 5647#endif 5648uniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){ 5649#if !defined(DISABLE_CORNER_DETECTION) 5650vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0); 5651#endif 5652}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){ 5653#if !defined(DISABLE_CORNER_DETECTION) 5654vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0); 5655#endif 5656}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){ 5657#if !defined(DISABLE_DIAG_DETECTION) 5658weights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){ 5659#endif 5660vec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d); 5661#if !defined(DISABLE_DIAG_DETECTION) 5662}else{e.r=0.0;} 5663#endif 5664}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}`,
vendor: 4,345 bytes, line 5664
5664CG=class extends sl{constructor(e=new t9,t=new t9){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new lG(null),searchTexture:new lG(null),areaTexture:new lG(null),resolution:new lG(t),texelSize:new lG(e)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:Cj,vertexShader:"uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){let t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){let t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){let t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){let i=this.uniforms;i.texelSize.value.set(1/e,1/t),i.resolution.value.set(e,t)}},CH=new sh,CW=null,Cq=class{constructor(e="Pass",t=new nR,i=CH){this.name=e,this.renderer=null,this.scene=t,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.getFullscreenMaterial();null!==t&&(t.needsUpdate=!0),this.rtt=!e}}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;null!==t?t.material=e:((t=new r7(function(){if(null===CW){let e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);void 0!==(CW=new rQ).setAttribute?(CW.setAttribute("position",new rN(e,3)),CW.setAttribute("uv",new rN(t,2))):(CW.addAttribute("position",new rN(e,3)),CW.addAttribute("uv",new rN(t,2)))}return CW}(),e)).frustumCulled=!1,null===this.scene&&(this.scene=new nR),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}
5664setDepthTexture(e,t=3200){}render(e,t,i,r,a){throw Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(null!==t&&"object"==typeof t&&"function"==typeof t.dispose){if(t instanceof nR||t===this.renderer)continue;this[e].dispose()}}}},CX=class extends Cq{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new CO,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new iM(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,i,r,a){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,i){void 0!==i&&(this.renderTarget.texture.type=i,1009!==i?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":3001===e.outputEncoding&&(this.renderTarget.texture.encoding=3001))}},CY=class extends Cq{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,i,r,a){let o=e.state.buffers.stencil;o.setLocked(!1),o.setTest(!1)}},CQ=new iv,CZ=class extends Cq{constructor(e=!0,t=!0,i=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=i,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,i){this.color=e,this.depth=t,this.stencil=i}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,i,r,a){let o=this.overrideClearColor,l=this.overrideClearAlpha,h=e.getClearAlpha(),c=null!==o,d=l>=0;c?(CQ.copy(e.getClearColor(CQ)),e.setClearColor(o,d?l:h)):d&&e.setClearAlpha(l),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),c?e.setClearColor(CQ,h):d&&e.setClearAlpha(h)}},CK=class extends tX{constructor(e,t=-1,i=-1,r=1){super(),this.resizable=e,this.base=new t9(1,1),this.preferred=new t9(t,i),this.target=this.preferred,this.s=r}get width(){let{base:e,preferred:t,scale:i}=this;return -1!==t.width?t.width:-1!==t.height?Math.round(t.height*(e.width/Math.max(e.height,1))):Math.round(e.width*i)}set width(e){this.preferredWidth=e}get height(){let{base:e,preferred:t,scale:i}=this;return -1!==t.height?t.height:-1!==t.width?Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):Math.round(e.height*i)}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferred.setScalar(-1),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.base.width}set baseWidth(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseWidth(){return this.base.width}setBaseWidth(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get baseHeight(){return this.base.height}set baseHeight(e){this.base.height!==e&&(this.base.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.base.width!==e||this.base.height!==t)&&(this.base.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get preferredWidth(){return this.preferred.width}set preferredWidth(e){this.preferred.width!==e&&(this.preferred.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferred.height}set preferredHeight(e){this.preferred.height!==e&&(this.preferred.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferred.width!==e||this.preferred.height!==t)&&(this.preferred.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}copy(e){this.base.set(e.getBaseWidth(),e.getBaseHeight()),this.preferred.set(e.getPreferredWidth(),e.getPreferredHeight()),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height)}static get AUTO_SIZE(){return -1}},CJ=!1,C$=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case 2:t=this.materialsFlatShadedDoubleSide;break;case 1:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case 2:t=this.materialsDoubleSide;break;case 1:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){let t=this.materials=[e.clone(),e.clone(),e.clone()];for(let i of t)i.uniforms=Object.assign({},e.uniforms),i.side=0;t[2].skinning=!0,this.materialsBackSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=1,i}),this.materialsDoubleSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.side=2,i}),this.materialsFlatShaded=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=1,i}),this.materialsFlatShadedDoubleSide=t.map(t=>{let i=t.clone();return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=2,i})}}render(e,t,i){let r=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,CJ){let r=this.originalMaterials;for(let a of(this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,i),r))a[0].material=a[1];this.meshCount!==r.size&&r.clear()}else{let r=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,i),t.overrideMaterial=r}e.shadowMap.enabled=r}disposeMaterials(){if(null!==this.material)for(let e of this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide))e.dispose()}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return CJ}static set workaroundEnabled(e){CJ=e}},C0=class extends Cq{constructor(e,t,i=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new CZ,this.overrideMaterialManager=null===i?null:new C$(i),this.ignoreBackgroun
vendor: 4,331 bytes, line 5664
5664d=!1,this.skipShadowMapUpdate=!1,this.selection=null}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){let e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new C$(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,i,r,a){let o=this.scene,l=this.camera,h=this.selection,c=l.layers.mask,d=o.background,p=e.shadowMap.autoUpdate,f=this.renderToScreen?null:t;null!==h&&l.layers.set(h.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(o.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(f),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,o,l):e.render(o,l),l.layers.mask=c,o.background=d,e.shadowMap.autoUpdate=p}},C1=class extends Cq{constructor(e,t,{resolutionScale:i=1,width:r=CK.AUTO_SIZE,height:a=CK.AUTO_SIZE,renderTarget:o}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new C0(e,t,new nm({depthPacking:3201}));let l=this.renderPass;l.skipShadowMapUpdate=!0,l.ignoreBackground=!0;let h=l.getClearPass();h.overrideClearColor=new iv(16777215),h.overrideClearAlpha=1,this.renderTarget=o,void 0===this.renderTarget&&(this.renderTarget=new iM(1,1,{minFilter:1003,magFilter:1003,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let c=this.resolution=new CK(this,r,a,i);c.addEventListener("change",e=>this.setSize(c.baseWidth,c.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,i,r,a){let o=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,o)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height)}};new Float32Array([255/256/16777216,255/256/65536,255/256/256,255/256]);var C2={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18},C3=new Map([[C2.SKIP,null],[C2.ADD,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}"],[C2.ALPHA,"vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}"],[C2.AVERAGE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}"],[C2.COLOR_BURN,"float blend(const in float x,const in float y){return(y==0.0)?y:max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[C2.COLOR_DODGE,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[C2.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[C2.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[C2.EXCLUSION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}
5664"],[C2.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[C2.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[C2.DIVIDE,"float blend(const in float x,const in float y){return(y>0.0)?min(x/y,1.0):1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[C2.NEGATION,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}"],[C2.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}"],[C2.OVERLAY,"float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[C2.REFLECT,"float blend(const in float x,const in float y){return(y==1.0)?y:min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[C2.SCREEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}"],[C2.SOFT_LIGHT,"float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}"],[C2.SUBTRACT,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}"]]),C4=class extends tX{constructor(e,t=1){super(),this.f=e,this.opacity=new lG(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this.f}set blendFunction(e){this.f=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return C3.get(this.blendFunction)}},C5={NONE:0,DEPTH:1,CONVOLUTION:2},C6=class extends tX{constructor(e,t,{attributes:i=C5.NONE,blendFunction:r=C2.SCREEN,defines:a=new Map,uniforms:o=new Map,extensions:l=null,vertexShader:h=null}={}){super(),this.name=e,this.renderer=null,this.attributes=i,this.fragmentShader=t,this.vertexShader=h,this.defines=a,this.uniforms=o,this.extensions=l,this.blendMode=new C4(r),this.blendMode.addEventListener("change",e=>this.setChanged())}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=3200){}update(e,t,i){}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(null!==t&&"object"==typeof t&&"function"==typeof t.dispose){if(t instanceof nR||t===this.renderer)continue;this[e].dispose()}}}};function C8(e,t,i){for(let r of t){let t="$1"+e+r.charAt(0).toUpperCase()+r.slice(1),a=RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let e of i.entries())null!==e[1]&&i.set(e[0],e[1].replace(a,t))}}var C9=class extends Cq{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new CF(null,null,null,e),this.effects=t.sort((e,t)=>t.attributes-e.attributes),this.skipRendering=!1,this.uniformCount=0,this.varyingCount=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){let t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}verifyResources(){let e=this.renderer.capabilities,t=Math.min(e.maxFragmentUniforms,e.maxVertexUniforms);this.uniformCount>t&&console.warn("The current rendering context doesn't support more than "+t+" uniforms, but "+this.uniformCount+" were defined"),t=e.maxVaryings,this.varyingCount>t&&console.warn("The current rendering context doesn't support more than "+t+" varyings, but "+this.varyingCount+" were defined")}updateMaterial(){let e=CF.Section,t=new Map([[e.FRAGMENT_HEAD,""],[e.FRAGMENT_MAIN_UV,""],[e.FRAGMENT_MAIN_IMAGE,""],[e.VERTEX_HEAD,""],[e.VERTEX_MAIN_SUPPORT,""]]),i=new Map,r=new Map,a=new Map,o=new Set,l=0,h=0,c=0,d=!1,p=!1;for(let e of this.effects)if(e.blendMode.blendFunction===C2.SKIP)c|=e.getAttributes()&C5.DEPTH;else if((c&e.getAttributes()&C5.CONVOLUTION)!=0)console.error("Convolution effects cannot be merged",e);else{c|=e.getAttributes();let f=function(e,t,i,r,a,o,l){let h=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),c=void 0!==h.get("fragment")&&/mainImage/.test(h.get("fragment")),d=void 0!==h.get("fragment")&&/mainUv/.test(h.get("fragment")),p=[],f=[],m=!1,g=!1;if(void 0===h.get("fragment"))console.error("Missing fragment shader",t);
5664else if(d&&(l&C5.CONVOLUTION)!=0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(c||d){let v=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,y=CF.Section;if(d){let t=` ${e}MainUv(UV); 5665`;i.set(y.FRAGMENT_MAIN_UV,i.get(y.FRAGMENT_MAIN_UV)+t),m=!0}if(null!==h.get("vertex")&&/mainSupport/.test(h.get("vertex"))){let t=` ${e}MainSupport(`;t+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(h.get("vertex"))?`vUv); 5666`:`); 5667`,i.set(y.VERTEX_MAIN_SUPPORT,i.get(y.VERTEX_MAIN_SUPPORT)+t),p=p.concat([...h.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(e=>e[1])),f=f.concat(p).concat([...h.get("vertex").matchAll(v)].map(e=>e[1]))}f=(f=(f=f.concat([...h.get("fragment").matchAll(v)].map(e=>e[1]))).concat([...t.defines.keys()].map(e=>e.replace(/\([\w\s,]*\)/g,"")))).concat([...t.uniforms.keys()]),t.uniforms.forEach((t,i)=>o.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)),t.defines.forEach((t,i)=>a.set(e+i.charAt(0).toUpperCase()+i.slice(1),t)),C8(e,f,a),C8(e,f,h);let x=t.blendMode;if(r.set(x.blendFunction,x),c){let t=`${e}MainImage(color0, UV, `;(l&C5.DEPTH)!=0&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(h.get("fragment"))&&(t+="depth, ",g=!0),t+=`color1); 5668 `;let r=e+"BlendOpacity";o.set(r,x.opacity),t+=`color0 = blend${x.blendFunction}(color0, color1, ${r}); 5669 5670 `,i.set(y.FRAGMENT_MAIN_IMAGE,i.get(y.FRAGMENT_MAIN_IMAGE)+t),t=`uniform float ${r}; 5671 5672`,i.set(y.FRAGMENT_HEAD,i.get(y.FRAGMENT_HEAD)+t)}i.set(y.FRAGMENT_HEAD,i.get(y.FRAGMENT_HEAD)+h.get("fragment")+` 5673`),null!==h.get("vertex")&&i.set(y.VERTEX_HEAD,i.get(y.VERTEX_HEAD)+h.get("vertex")+` 5674`)}
vendor: 12,315 bytes, lines 5674-5684
5674else console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);return{varyings:p,transformedUv:m,readDepth:g}}("e"+l++,e,t,i,r,a,c);if(h+=f.varyings.length,d=d||f.transformedUv,p=p||f.readDepth,null!==e.extensions)for(let t of e.extensions)o.add(t)}let f=/\bblend\b/g;for(let r of i.values()){let i=r.getShaderCode().replace(f,`blend${r.blendFunction}`);t.set(e.FRAGMENT_HEAD,t.get(e.FRAGMENT_HEAD)+i+` 5675`)}if((c&C5.DEPTH)!=0){if(p){let i=`float depth = readDepth(UV); 5676 5677 `;t.set(e.FRAGMENT_MAIN_IMAGE,i+t.get(e.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=null===this.getDepthTexture()}else this.needsDepthTexture=!1;if(d){let i=`vec2 transformedUv = vUv; 5678`;t.set(e.FRAGMENT_MAIN_UV,i+t.get(e.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")}else r.set("UV","vUv");t.forEach((e,t,i)=>i.set(t,e.trim().replace(/^#/,` 5679#`))),this.uniformCount=a.size,this.varyingCount=h,this.skipRendering=0===l,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(t).setExtensions(o).setUniforms(a).setDefines(r)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=3200){for(let i of(this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t,this.effects))i.setDepthTexture(e,t)}render(e,t,i,r,a){for(let i of this.effects)i.update(e,t,r);if(!this.skipRendering||this.renderToScreen){let a=this.fullscreenMaterial;a.inputBuffer=t.texture,a.time+=r,e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}}setSize(e,t){for(let i of(this.fullscreenMaterial.setSize(e,t),this.effects))i.setSize(e,t)}initialize(e,t,i){for(let r of(this.renderer=e,this.effects))r.initialize(e,t,i),r.addEventListener("change",e=>this.handleEvent(e));this.updateMaterial(),this.verifyResources(),void 0!==i&&1009!==i&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){for(let e of(super.dispose(),this.effects))e.dispose()}handleEvent(e){"change"===e.type&&this.recompile()}},C7=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Te=class extends Cq{constructor({resolutionScale:e=.5,width:t=CK.AUTO_SIZE,height:i=CK.AUTO_SIZE,kernelSize:r=Ta.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new iM(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let a=this.resolution=new CK(this,t,i,e);a.addEventListener("change",e=>this.setSize(a.baseWidth,a.baseHeight)),this.blurMaterial=new CP,this.ditheredBlurMaterial=new CP,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=r}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,i,r,a){let o=this.scene,l=this.camera,h=this.renderTargetA,c=this.renderTargetB,d=C7[this.kernelSize],p=this.blurMaterial,f=t,m,g;for(this.fullscreenMaterial=p,m=0,g=d.length-1;m<g;++m){let t=(1&m)==0?h:c;p.kernel=d[m],p.inputBuffer=f.texture,e.setRenderTarget(t),e.render(o,l),f=t}this.dithering&&(p=this.ditheredBlurMaterial,this.fullscreenMaterial=p),p.kernel=d[m],p.inputBuffer=f.texture,e.setRenderTarget(this.renderToScreen?null:i),e.render(o,l)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t);let r=i.width,a=i.height;this.renderTargetA.setSize(r,a),this.renderTargetB.setSize(r,a),this.blurMaterial.setSize(r,a),this.ditheredBlurMaterial.setSize(r,a)}initialize(e,t,i){void 0!==i&&(this.renderTargetA.texture.type=i,this.renderTargetB.texture.type=i,1009!==i?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):3001===e.outputEncoding&&(this.renderTargetA.texture.encoding=3001,this.renderTargetB.texture.encoding=3001))}static get AUTO_SIZE(){return CK.AUTO_SIZE}},Tt=class extends Cq{constructor({width:e=CK.AUTO_SIZE,height:t=CK.AUTO_SIZE,renderTarget:i,luminanceRange:r,colorOutput:a}={}){super("LuminancePass"),this.fullscreenMaterial=new CU(a,r),this.needsSwap=!1,this.renderTarget=i,void 0===this.renderTarget&&(this.renderTarget=new iM(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let o=this.resolution=new CK(this,e,t);o.addEventListener("change",e=>this.setSize(o.baseWidth,o.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,i,r,a){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height)}initialize(e,t,i){void 0!==i&&1009!==i&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Ti=class extends Cq{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new CZ(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,i,r,a){let o=e.getContext(),l=e.state.buffers,h=this.scene,c=this.camera,d=this.clearPass,p=this.inverted?0:1;l.color.setMask(!1),l.depth.setMask(!1),l.color.setLocked(!0),l.depth.setLocked(!0),l.stencil.setTest(!0),l.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),l.stencil.setFunc(o.ALWAYS,p,4294967295),l.stencil.setClear(1-p),l.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?d.render(e,null):(d.render(e,t),d.render(e,i))),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.render(h,c),e.setRenderTarget(i)),e.render(h,c),l.color.setLocked(!1),l.depth.setLocked(!1),l.stencil.setLocked(!1),l.stencil.setFunc(o.EQUAL,1,4294967295),l.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),l.stencil.setLocked(!0)}},Tr=class extends Cq{constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.inputBufferUniform=null,this.setInput(t)}setInput(e){if(this.inputBufferUniform=null,null!==this.fullscreenMaterial){let t=this.fullscreenMaterial.uniforms;void 0!==t&&void 0!==t[e]&&(this.inputBufferUniform=t[e])}}render(e,t,i,r,a){null!==this.inputBufferUniform&&null!==t&&(this.inputBufferUniform.value=t.texture),e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}initialize(e,t,i){void 0!==i&&1009!==i&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Ts=class{constructor(){this.previousTime=0,this.currentTime=0,this.delta=0,this.fixedDelta=1e3/60,this.elapsed=0,this.timescale=1,this.fixedDeltaEnabled=!1,this.autoReset=!1}setFixedDeltaEnabled(e){return this.fixedDeltaEnabled=e,this}isAutoResetEnabled(e){return this.autoReset}setAutoResetEnabled(e){return"u">typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=e),this}getDelta(){return .001*this.delta}getFixedDelta(){return .001*this.fixedDelta}setFixedDelta(e){return this.fixedDelta=1e3*e,this}getElapsed(){return .001*this.elapsed}getTimescale(){return this.timescale}setTimescale(e){return this.timescale=e,this}update(e){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=void 0!==e?e:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}reset(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}handleEvent(e){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}},Ta={MEDIUM:2,LARGE:3,HUGE:5},Tn=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5680uniform mediump sampler2D map; 5681#else 5682uniform lowp sampler2D map; 5683#endif 5684uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}`,To=class extends C6{constructor({blendFunction:e=C2.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:i=.025,resolutionScale:r=.5,intensity:a=1,width:o=CK.AUTO_SIZE,height:l=CK.AUTO_SIZE,kernelSize:h=Ta.LARGE}={}){super("BloomEffect",Tn,{blendFunction:e,uniforms:new Map([["map",new lG(null)],["intensity",new lG(a)]])}),this.renderTarget=new iM(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.renderTarget.texture.generateMipmaps=!1,this.uniforms.get("map").value=this.renderTarget.texture,this.luminancePass=new Tt({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothingFactor=i,this.blurPass=new Te({resolutionScale:r,width:o,height:l,kernelSize:h});let c=this.blurPass.getResolution();c.addEventListener("change",e=>this.setSize(c.baseWidth,c.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,i){let r=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(e,t,r),this.blurPass.render(e,r,r)):this.blurPass.render(e,t,r)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height),this.luminancePass.resolution.copy(i)}initialize(e,t,i){this.blurPass.initialize(e,t,i),void 0!==i&&(this.renderTarget.texture.type=i,3001===e.outputEncoding&&(this.renderTarget.texture.encoding=3001))}},Tl=class extends C6{constructor({blendFunction:e=C2.NORMAL,brightness:t=0,contrast:i=0}={}){super("BrightnessContrastEffect","uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["brightness",new lG(t)],["contrast",new lG(i)]])})}get brightness(){return this.uniforms.get("brightness").value}set brightness(e){this.uniforms.get("brightness").value=e}getBrightness(e){return this.brightness}setBrightness(e){this.brightness=e}get contrast(){return this.uniforms.get("contrast").value}set contrast(e){this.uniforms.get("contrast").value=e}getContrast(e){return this.contrast}setContrast(e){this.contrast=e}},Th=class extends C6{constructor(e=C2.NORMAL){super("ColorAverageEffe
5684ct","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(vec3(average(inputColor.rgb)),inputColor.a);}",{blendFunction:e})}},Tc=class extends C6{constructor({blendFunction:e=C2.NORMAL,offset:t=new t9(.001,5e-4)}={}){super("ChromaticAberrationEffect","varying vec2 vUvR;varying vec2 vUvB;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 ra=texture2D(inputBuffer,vUvR).ra;vec2 ba=texture2D(inputBuffer,vUvB).ba;outputColor=vec4(ra.x,inputColor.g,ba.x,max(max(ra.y,ba.y),inputColor.a));}",{vertexShader:"uniform vec2 offset;varying vec2 vUvR;varying vec2 vUvB;void mainSupport(const in vec2 uv){vec2 shift=offset*vec2(1.0,aspect);vUvR=uv+shift;vUvB=uv-shift;}",blendFunction:e,attributes:C5.CONVOLUTION,uniforms:new Map([["offset",new lG(t)]])})}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}},Td=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5685uniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer; 5686#else 5687uniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer; 5688#endif 5689uniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}`,Tu=class extends C6{constructor(e,{blendFunction:t=C2.NORMAL,worldFocusDistance:i,worldFocusRange:r,focusDistance:a=0,focalLength:o=.1,focusRange:l=o,bokehScale:h=1,width:c=CK.AUTO_SIZE,height:d=CK.AUTO_SIZE}={}){super("DepthOfFieldEffect",Td,{blendFunction:t,attributes:C5.DEPTH,uniforms:new Map([["nearColorBuffer",new lG(null)],["farColorBuffer",new lG(null)],["nearCoCBuffer",new lG(null)],["scale",new lG(1)]])}),this.camera=e,this.renderTarget=new iM(1,1,{minFilter:1006,magFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTarget.texture.generateMipmaps=!1,this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new Tr(new CC(e));let p=this.cocMaterial;p.focusDistance=a,p.focusRange=l,void 0!==i&&(p.worldFocusDistance=i),void 0!==r&&(p.worldFocusRange=r),this.blurPass=new Te({kernelSize:Ta.MEDIUM,width:c,height:d});let f=this.blurPass.getResolution();f.addEventListener("change",e=>this.setSize(f.getBaseWidth(),f.getBaseHeight())),this.maskPass=new Tr(new CV(this.renderTargetCoC.texture));let m=this.maskPass.fullscreenMaterial;m.maskFunction=1,m.colorChannel=1,this.bokehNearBasePass=new Tr(new CA(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new Tr(new CA(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new Tr(new CA(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new Tr(new CA(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null,this.bokehScale=h}get cocTexture(){return this.renderTargetCoC.texture}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.circleOfConfusionMaterial}getBlurPass(){return this.blurPass}get resolution(){return this.blurPass.getResolution()}getResolution(){return this.blurPass.getResolution()}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){for(let t of[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass])t.fullscreenMaterial.setScale(e);this.maskPass.fullscreenMaterial.setStrength(e),this.uniforms.get("scale").value=e}getBokehScale(){return this.bokehScale}setBokehScale(e){this.bokehScale=e}getTarget(){return this.target}setTarget(e){this.target=e}calculateFocusDistance(e){let t=this.camera;return CM(-t.position.distanceTo(e),t.near,t.far)}
5689setDepthTexture(e,t=3200){this.circleOfConfusionMaterial.depthBuffer=e,this.circleOfConfusionMaterial.depthPacking=t}update(e,t,i){let r=this.renderTarget,a=this.renderTargetCoC,o=this.renderTargetCoCBlurred,l=this.renderTargetMasked;if(null!==this.target){let e=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=e}this.cocPass.render(e,null,a),this.blurPass.render(e,a,o),this.maskPass.render(e,t,l),this.bokehFarBasePass.render(e,l,r),this.bokehFarFillPass.render(e,r,this.renderTargetFar),this.bokehNearBasePass.render(e,t,r),this.bokehNearFillPass.render(e,r,this.renderTargetNear)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t);let r=i.width,a=i.height,o=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];o.push(this.renderTargetCoC,this.renderTargetMasked),o.forEach(i=>i.setSize(e,t)),(o=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred]).forEach(e=>e.setSize(r,a)),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(e=>e.fullscreenMaterial.setSize(r,a))}initialize(e,t,i){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(r=>r.initialize(e,t,i)),this.blurPass.initialize(e,t,1009),void 0!==i&&(this.renderTarget.texture.type=i,this.renderTargetNear.texture.type=i,this.renderTargetFar.texture.type=i,this.renderTargetMasked.texture.type=i,3001===e.outputEncoding&&(this.renderTarget.texture.encoding=3001,this.renderTargetNear.texture.encoding=3001,this.renderTargetFar.texture.encoding=3001,this.renderTargetMasked.texture.encoding=3001))}};new iD,new i6;var Tp=class extends C6{constructor({blendFunction:e=C2.NORMAL,hue:t=0,saturation:i=0}={}){super("HueSaturationEffect","uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",{blendFunction:e,uniforms:new Map([["hue",new lG(new iD)],["saturation",new lG(i)]])}),this.hue=t}get saturation(){return this.uniforms.get("saturation").value}set saturation(e){this.uniforms.get("saturation").value=e}getSaturation(){return this.saturation}setSaturation(e){this.saturation=e}get hue(){return Math.acos((3*this.uniforms.get("hue").value.x-1)/2)}set hue(e){let t=Math.sin(e),i=Math.cos(e);this.uniforms.get("hue").value.set((2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3)}getHue(){return this.hue}setHue(e){this.hue=e}};new iv;var Tf=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time)); 5690#ifdef PREMULTIPLY 5691outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a); 5692#else 5693outputColor=vec4(noise,inputColor.a); 5694#endif 5695}`,Tm=class extends C6{constructor({blendFunction:e=C2.SCREEN,premultiply:t=!1}={}){super("NoiseEffect",Tf,{blendFunction:e}),this.premultiply=t}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(e){this.premultiply!==e&&(e?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}isPremultiplied(){return this.premultiply}setPremultiplied(e){this.premultiply=e}},Tg=class extends C6{constructor(e=30){super("PixelationEffect","uniform bool active;uniform vec2 d;void mainUv(inout vec2 uv){if(active){uv=vec2(d.x*(floor(uv.x/d.x)+0.5),d.y*(floor(uv.y/d.y)+0.5));}}",{uniforms:new Map([["active",new lG(!1)],["d",new lG(new t9)]])}),this.resolution=new t9,this.d=0,this.granularity=e}get granularity(){return this.d}set granularity(e){let t=Math.floor(e);t%2>0&&(t+=1),this.d=t,this.uniforms.get("active").value=t>0,this.setSize(this.resolution.width,this.resolution.height)}getGranularity(){return this.granularity}setGranularity(e){this.granularity=e}setSize(e,t){this.resolution.set(e,t),this.uniforms.get("d").value.setScalar(this.d).divide(this.resolution)}};new iD,new iD;var Tv="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",Ty="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYfMHEIGFsAxgjApQqACYQORjtd/B7Axt/z79sC0+cMPgjjlwPwVwHcA+
5695DfAHzTxcVgWBroqMN8+cYBeM71wH0TwKExYHYUWCIAHYRLTlkCYgcIBcAgU/n3qy8GRu4HRgnAOWBkERhddPAJhGJDBxkvw7cqimr+zFM/ZLnZF64cgL8BYD+AWwB8x/dlWuWagHiYL984AJ/0RWBy1AE4AizyM1yxYAcTigW55xMbAkxEiwEdkJ/ZCQxPAiOHgBECcKEC4TBZcKkSv+mTieNcNPNC26mLNsj45QD8LQDTAO4GcJt/7iw2bfoG4WG+vAGwm9ExiEg69zpg/wgwPQLMjgALzn4E4aIzoJjQ9g4024uygkj+pyuAoX0VAIfngOH5NgCHMhAm8Sv2y3XDZeBhNIp8OzJE8OsBzAKYBHAXgDt8/4O+MVT0j4f58o0D8Pxrgf3DwMwIMEPQEYRkNwfgsuuDZLskip0No0gWMD/9HGDoADAkAC4Aw/wsAgZAgs2Z0ABI0GU6IVmKv+f28KDnHxkA/G0A8y6G73N9kOCjXnh/Ebb6OvgwX75xAF5wLTA1VIHPADgMLDj4yIA5AAm6aCUnv4oz46eeDwxNAUMzwJAz4BABSNDFTwSfg7DDKHE23MG5PqIY8A1u/dINs9dBdy8AgnGPM2NfUBrsnw7z5RsH4IXXAAcJviFgluAbygBINnSLWOAjGxJ4pgOKDV0v/OSLKp8iGXBovhLBBOCQM2ACoTOhnYrAdItYbCij5JFzRyIAqRccAnDAQUjg6UNQ7hsMXP0cRQAexss3DsCLCECCLwCQzMcPwUi2MwAScAKbfnY/YRLFQ8DHX+IAJAMSfDkAF13kLvleIjhjQQHxUVS3jjgGpKeeNzYVQEjgUS8k+PghONdhIwAP4+XXBYCHKIJbwJyDTgaIAdCBJx3Q2M8tYAHP9m4df/ylQOsQ0JqtRLCx30K1wtLBggScQOgsKBGcWHAJeOwRC0BSM1mQIKRbhh+Bj98JQP6t4U0APEyXXxcAEnxkQAFwoVUxID9kvQg+c1C7vidRbIDkc24B//hTQGumDcCWA5DgMxASdNIFBUI5pCML8v8API5zfEQx4BudgqiczviSnJhQwCP4BMCGl+wO8+U7AJi/W4O4YS6+pmK/2ciADsAOBhTIIiAJnPB7AvNjP+0AnANaYkAHX2JBAc+tYaJXOqBZv24Vc386XW5dtkHGW+4HFAJonpOe+YYQZAShgKjv3PNvPQaxVoI8zJdfFwASfPzMUwS3Kt1v0UFIlos6oDFdAGFcliMAP/ryAEAGNwQRnDOgLbdlIEwrIs6AZ/QgkMMHQF6ZAKQcJAsSYPwIeAIk9wJgoPK1gi7+PwF4GC/fOAAvIQPSs0URTPBJ/Pp3GSEGRHfBCIQ0xowBtUbcAj7ys5X4Jfu1HIAGQrIgQRXEsAFQIORDFhiDY/rMHmrU4QUgR08AkgUjCAW6CD6CkwBsAIQC4GG6fPMA3OXiNzCg2I9gNCMksmAAoemDzoimFwL48M85AKkiuQVMAAp8CYRRDAt8GQiJ67N6GJODAXAHlsGguscA2AJg1IPGYmxOpBxFWkRN9LsATgIwXnNs/v/5z/9XCf8BO3YAtxbc/46/KDt+5+ea1Yku2VUxHz/z0v24FwMGK1gWsK2OUUxHHdCBeRUB6OxHABr4ZICIBd0QWSF+XRdMTAjgCdTrG9cBNwE4F8CpDkICyYLGsuhFt6zs+gISwUen8zEAjgMw4cfx2H6O/90yAFo84Cbg4ID3/9TfLTt+5+ebnRABkODjx0SwPi5ec/FrYpmqSAxM8Dn60CsqAFI6GfhqAMiDE/gokmvEr0C4PgDkBQm40wE8zMFEUDKEVoxIMLl/KS73mE7H9d+vcKHQQcjwW0Yu9nP8m8sAmOIBuWY6wP2/4s0ezjjg8TuvaR6ABJ70vxUApGrm7EbGE+i472BAB+WHfqHS/eoAaEwY2E9+wLSXTqhI7CXgnB6LCoOJ4BiST+hTnG0HcCwAglCx3ARoZEVFXnBPp/O/A/hXACc7CPs9/i1lAOyIB+RDX+P9/+pbQjjjAMfv/PL6AFDs1wFAgs/9fgKfgdE/ZEpuiQlbwAde6QAMBgiRmsSwA9BY0JfjovGRDBMH4TlcXGhcBOc6HkF0gjPhZgchxTLZMAci/04W/B6Ab3t09EPXcPyflgFwRTwgJ2MN9/8bf5qFM67x+B/aW4XQz42FeL0YrRyikztUFw0704mf9kXgxhOAqc3AAsPyRxxQCs/PdXOFY0W1KHy3QIUGtx+6vdnx1vsB+dsTncm2AogglFgVEAlUWrOMB2RyEmMCGQ/Y7/HvKns6tfGAnJQ+r/9b76oJZ1zD8WdyQjYBh8aBhVEHjELouQ8ukQ7VRSCJAALwkr+sALhnGzDD3JAJYJHg9uhoi4bx8ytkWUtvHT/7+Zc4dw1uZ3612fH2dkQf7yxIEEockwkJQn4IQoq8unhAhmPRKKFx0uv4K8ueTs94wD7u//VX9ghn7OP4c+4G7h8HpseB+dF2AKlFLwuAIZ8jD6NPrOhAffmfA9/ZBuzZCkyRWSeqBCWyoYGQ5yQrBpDbum/ME1HoPo0XEkSD2zlfbna8q6+EUJcTCxKEtHL5EQjP6BEPyIgYAZBvYt3xHyx7OqvGA65y/7/9wVXCGVc5/sl7qxD66dEqiYgRzAqhN1A4CBNAAlDyAFI+iZ9/N3DLJuC+jcDUBmCWyUnOrmTYCMIOkNclLg0B8/RsNLg9+UvNjnd1APLmmQpFHyEBROuWACQT8nN+H/GAvY7/VNnT6SsesMf13/CpahGnZzhjj+PPmwX2MYdDIfQexWyBAwEUOQDrRDN/98p3A7dvAO6fAA5sqHJDBEAyoUVGkwEd6HR12XU4kwzfl6fCXTZzjy57vvnR513X7Hj7AyDvggAUi9EyFgiZqNxPQF6345nOWbD1HQ/Y5fpvuLa/2+82/vNHgAPDFQDnhoF5j2C2qBWCI8bw1eRw5CL5l94L3DEOTI4DB8Y9OWmsEu/zBJ3rgsaybqBob/7A4C7jtWcooRrczr+u2fH2D0AOQgAUCxKEP7aGgLy64+m6KdjWFA9Yc/03/Osa4glrjr+AupqHz1sEs0cxG0BC9HIePLoit9eNkVf9L+DuUWByDJgaq4ybGYLPAWgiXmLedUE7dwC7saL7CqfPKXi4NYdaykCD410bAHlDEsNiwZ9wAPYbkJcfz6T2gm3N8YDZ9d/wHxUA+739fPwXPrSKYGb+BuP3jAFDElFH9HIWwbzCIGkBr/or4J4RYO8oMOW6ZVcAuvi1Cgoha04BCwT5gfMKHm7NoRde2+x41w5A3hQZkADk5+cGiAeMx3+/7AENFA8Yrv/G71cAXFM4Yzj+otOAaQLQA0gZxaIIZtMDFTigKJV8H9Iq6aZ59ZXAvSPAvpEKgBTtBODcSCWCZeRYtpzrmLyeGNCAyFl1v+Hei8qeb370Rdc2O97BAMi7EgB/2QG41nhAHU9LuWAbOB7Qr//GPRUA13r7Gv9FZwIMoVcEswEwfDoimEP0shKKtIphaZQAXv1+YM+wA3DEdcvRKkGJADQQEsQuhi1Tjt95vBsh5nx2IO59SsHDrTmUOStNjndwAAqEry0IyCMICkOyiuIBNwBvPFQQT7gBuPjc9oRYAIHyOEL4vIFEYVNaOou5vCGE/tV/A0wOVcnpzI47NOri3QFIBpSeaSDUdYLOSWvYImSGgftpJDa4MWJbAGxivGUA5MAOc0Be6eVLj7/4Mk+hzCOYPYpZDBiNkLh+G/M3yFyv/ltgL3W3YQfgcFUhgRY2PwY+Z7/EhAR1SFyXCOb57r28QfQBsJQBMn5D4y0HYLPje9Cd7RIC0PM3EiMofF4gVCBp1P840ix/gyz56r+vAMjk9Gl375iB4+CzveuZdLkkEPJ8ZEfX/6R73vOjzT5Si9hucLxHAVg4PwJgRwh9CKOXK8YA4ZEqKZXSQWh5P+5AftXfA/uGKvYjCKn72cctbFrZNECka5L5CPwIPtMH3TVz17MLB5gdLgA2Nd6jACycHwLQxFEUSR5ASvARDB0h9AQb9bXIgCGk6lUfAPYTgEPAITKgg1BObk58srTJgG58WMkWMaAbQQT1nc8rHGANAJsc71EAFs4PAagQestgC1lsBJ4BMCSOK6dDUcwqqaFiQr/0QeAAAdjy+jBiQQeeMSBZT3nCPUDIa9z+/MIB1gCwyfEeBWDh/BCAeQSzgkjFfGLBBD5nxQ4DxN0wv3hVxX5TBGDwL5obxvVA5YqYL5BeMLd66YYxJpRB0gK+96LCAdYAsMnxHgVg4fwIgMrhUPKQ2C+Bz0PmBTqBMQehAbDlIjj4F80KJguSVZ0FuXpjoCOgXawLjALhbT9eOMAuAGxqvEcBWDg/l1IE05Ed0ygZnyHdz0VwCqEPIfNyx0QQvvLDFQCp+8nfZk5und8tXwIgWcHSNX0N2CJmnAl3v6RwgNnhl17T7HiPArBwfghAS7mV/hey2JS9FvM3BLpUUi1YwDRMXvkRYJoAlAh2l0dcZ04s6JUTDIjyBcrl4yDc/dLCAdYAsMnxHgVg4fxwKVwJgGEJNmWtxpQMpX9on2eRhVA+O56AjMfnP+e3Xvf3NwG4xIPTleiY55bpGh6UbafNU0l0z0p+5Jh5HqYJ6b51nP6XP8cx12XNHQVgIQB/bFPVg2OC7Q+WgVFWng/FvtWLI06uWh5oguKEcXVS/9sEAF//VGD7t4ETDgJbF4CNi8CGZWBs2fPL/H6Vwp2KEtVk4fJ+v/EIYPN9wKa5qu+IncfPwXHVZe/aOL3EbwS7xv8A1rQvnO0j8PArTgTGZ4BxFv9mIxhOCGsv+0OPYDRghcLfkWkEuq0+G00x4OtfDGz+d2DbHmDLjL8si8AYP/7CGIAiEEMTG92zXqSbH+d9R2aA0XnvO+JjthiIrOVDHHPOkBrzUQAWAPsZp3oPDpa/Xag6EVkLBK+5rAnJC3/nYk/APD704WiEAV8OTHwX2LQH2DgFbJgFNrBhjd8r79deGoEwsllgNBOzy8CdjweG9wBj08AIAci2D6HafmyAk4/Z7SJ72hGYRwFYAMDLTwOGp4FRFgD3HhzqRGQiyeurqOdG6r0Rm8IEZjzRlkiqCWoEgK8Axm4BJu4HJhyAbFhDxmbDGnZO4j0SgLGDkpibgEq66TJw/1nA0F5gdLpq+zDqFfd5LMeWqu5HNST0uJOIllg+qgMWgI+HPv0xwLA3gWHpW2sC441gCECbmKziaGrnUdMO4aHeh6MxAP4SMHI7ML4HGD8AjHvHJGNAgpDgY/ck3stipRemvVhc+uASMPUEYGh/9dIRgGx8Y+MNbR/00uVtH0wEx94j/v0oAxaA8Ed+GBieAYZZg5kADC0QWGOFzGJlcGPzl1BxNLXD8sk4xftwNAbA/wwM3wGMUmxOOQBnHXzetIYvibonmSiuYTNjriVg7glAiwBk0fNZH6+PmX9P6kfNmCXGpftJ7TgKwBIAnln14BAAYxMYm5C6RjCyCoOyr0qkD/c+HI0B8DXA8N3AyCQwesD1VQKH7EcASm1Q+y4CkN9pUKiVF5nLvy+fBbTUd8QBaH1HvNBROiZvfsNnrF4kcvPwpdsBLBeU18Nf7AB23Dp4ecHC8oBgUlJJecLS+7+WOpE3gbE+HKw+yoevCYkMGKqPJrdEKARutaFYRs1fiEZ0wP8CDN8LDO8FRqYq3W10pgKgfYLaYCzootgA6KXaTA90y374TKB1sBozy77xHFZ536utRgAmEaw6g5kUSFZwSXnA330qsOlfgHMPDlZesLA8IOjoLypPWHj/11EnCiVwkz7kAExtsGraYUWdSDX5TmsagL8KDBGA7Bd30JsW0oWivnEOQNP7yGTSB
5695R101AlZSUtGyfgZDkCWY1HnJdcBVe6325hTvelg2CQjZNDygG/2An0j1wKnL6y9vGBheUC8prQ8YeH9X39OVQSc7Mc6fCaKvAeHdCIVf4yMYCynTpX+nb97NJmlSQb8r8DQHm9YOFUZTKOzoXGhs6AxF0HIexcLBvWBuiHN8s2ne98R3qc6L4Vyb2oBVjfm9MIFHbjDCh6kPOBbQoG+oW8CO5bWVl6wsDwgfr20PGHh/X/1iaEIuDcCTIW/1Q4rFv8OnYiW3c+W2iKwUjKbyjQNwL1uuR6sAEgDgq1brXOmV81PxhNB6DUDBSYzQJwFtz623XcktX1Q1VWKaTF/zZhVazBVYA1tX5MazsGvobwe/jQr0Ne6BTh5uf/ygoXlAfG60vKEhff/rSe1i4DnTWDUACY1guFTDqLYdCBvf6DJYSMYATBfOx1kLfj1v1axH10nQ3Sd0GUkBnTfpemtBJgseIKQAHLQcVxa2TnuMW0Aqui5es8xBIegVdVVE8VhzHnLh65WMB9An+X18K6aAn2tO4ETl6vqbKuVFywsDwhevqg8YeH93/Rk70JE90nowxZbIJjvS3WYNSGUwGHJTpPxwwcbBuBrgRYBeKACn7VtpdUu/c0NJxO9BIxcKu4TTODzbkonPLoaL0vyUQRb2y8HsL1ckfWzMeuFi40Qezqi+yiPhyt7FOjr6/gCFwgP7Xb5vssTFt7/nQRg6MGRWmDRoeyTlpgw68GRTwgZgo1gGmXAX6/8dtaylSKY/koyID9BhzML3q1gAos2AcOrZYSoq/pJp1VtODRm9Z3LS/7WjVkvXOzEtOpKyGrlAT+4SoG+VY8vBGCvy/dVnrDw/vee65NBJiAjBIVcAJQjOm+DkCZEeiGAMw6sAwDZsJrAdhFM9rPGhd4904Co5oVuCZPV6kD40Ec6+9W8dBTBsfdc3nkpvnB82fp2RPcs79dHgb51LA9ofsDV6vut5/3PnxcAmLVBiDqgevDaJLkYrpuQxzcNwN8AWgIgRbB8loEBzXDwl4cGiDGft58SCOWGedgjvOJ+bPvgRkiuA+ZjzhnQQOiFNVbloa7l/fos0LdO5QENgEXlCfs8Qbf7HyMA3QVjYihYhLENgjX9y/qwxQmRU/asfd0ZcLU2CHVGyusJQLKfVi98CS12T5f7iECkHpsMkAhCF8+nshWH2I/jXsOYO144GV/9ApAIrS3vt4YCfetQHtAA2G+/4PW4/2PPbzMgmUMi2NoeSCRxIt2/FvuxWURIWCXg357gfTjEDNIHnTRXRCpH5ugKwGl3HpMBXQc0v6WLYVm/5limj04rG762K2uYY9jBkr9+rI03NL5ZbczS/dJ+LQyoga4o77fGAn0NlwdMAOy3vl/T938KAcj121z8Bn+Y9eWQJRz8Y6kNagDh2ey5EvxjxQD8TWdAuneCCO4An1vw5vdzQMmdktwq7pLZQR+dM34+ZumAxvY1Y04uqOAJ6FsExzeto7zfAAX6GiwPaLWR1lrfr8n7f/Rl3QGzmsis+/uO71V9OFgP2gpPhgr7TGRqRUT6dyvr4aIs/pm/2zVUNbBSv6G8e5pEv0Cvec7Po7+bTtjlBRlkvAMBkDeQyvsNWKCvofKACYBrre/X1P0/oWEAnnFD1YdjhtXxR73mX10FfCHHE9pVWcGAI/S0gKsfA2y+twrFZw6Hxf/F0Pk8Ri/kpGSnMuDx5T0iACgQHioo0NdAecBUHW6QdsV2/cL7v/Cyqr5gnc42CCOcfX1VIZ/V8We9IDmTzVXwPDJiXuKXPxtDBma8+lzP4WAgKkPxCUAPE4v5GzEuMX0PYJPLhB6FJsc7MAMmkVxaYC/K9gG+F1++8AQ7Gwbgk78I7GFpXgIwFiRXOwaJZPUbiR0yCUDRk+cHf+YpwMj9HgfI8ClGPyvsSiH0WSKRuYlitLb/zHM/JOSs5C/YIC9cMQDZr/dwxgOW9gtGYUBi0wA8l304vDQvAchilFbpIBQhZ7Ejq6ZQ0/Yhil8y4j89Axie9DAsD6FX9HOK3QtROTFkviN83kG4felIY8DCeLrSeMDSfsEovAECUFsTjHD+tcB+tkFgcXKvBRir7qtFl9owmO4Xy/1G3bAFfPrZHorFNWBFwHjQAFctIghj2kBarw06If/+MM9ZqTN6DgsDojCerjQesLRfMApvoGkAWh8Ob/tgAPSKWCp8ngNQtadjmTdltvNvn3peFYhgQQgh+iUmEaUAUoXM1yRLmWuFLaE9Z+XIAWBhPF1pPGBpv2AU3kDTALzwmqo6qtVh9kJErAudABia38TC5wJgS2xIhAwBn3yhByL4EhzXfRXxYsDTJ4IvrNN2JFMxZcBzVo4cABbG05XGA5b2C0bhDTQNQLZBYH1AVsQSAAU+imI1obHyblnjG/kJk3U8BHz8xVUQAhnQIl5CyNgKAGp5LKSSCoAySh5Jj79vTagcxUaIBeRNe79g9gq+DXig4wGzy+PONfT7RWFA4noAkGXZVAhcBckJQgNgrLiaNb3paIDo1vHHX+oA9LQBi4DxJcOUPJUnTgU2NJUyROs8irGARxQAC+PpCtsFd40H/AEf0gMQkLgeACT41PiGoLOKqyrJq3K/Ya9mNyr5FusN/uPLPIeDa8Bc+w3rtyl4VFHaMZc3i9RWBM9jjzgAFsbTFbYLRmm/YBTeQNMAtD4cBKDXBTQGdAB2MGBo8SCLmEuS1AFVAJ3A/NhPt0PoCcA8bSDG76XI7aySg6JYuGfKwJHFgH0E5B3ueMCe/Y4L+xVHAOZ+9EHcEgQgwbeiEYx6jwTdz4qfu7EhEJqxGqruf/RnHIAEnxgwBM0aC8aUAYWNBRCmoIll4HTqO122QcZbrgMWxtMVtgvuOx6wa7/jwhtoGoDWh4MBJ16WN4lfr8AqI0TVV1O1fa9BbQzovkAy4Ed+NgCQUSxZCFWvCOaOFREXyUwZOPIA2GdA3uGOB6wPaOz+QPv5S+MA3OXiN9aclghW+d3IgupBF2pPqxcxGenDPxfSRh2ASiKKiVP2PaZScvAKoA0VDc6cOlIB2GdA3uGOB1zR77iwX/F6AFB9ONSOQW0frA50sILVcckWJyIDSgwPAVcJgFbYuZ3FJvAlEHbJ3IsgJLGedeBIA+AAAXmHOx6wo99xYb/i9QKg2iAIfDJEJHqj4SExbEty0gkdhB/6P9oZbBZIGiKYVb9GKaN50lRHBLOvhDxh/5EKwDUG5B3ueMB2QGM/grb7/6wHAPNGMAY+GSGUjC52VX2f2CD4+HO0gqkZfegXKgBaHkcWtS0AWii9xG1ImrLlN5XR8L8fmQD05BVrmEENmpYSP9QX+KHiqj2/82+HqqDWwnbBRfGATdzAegGwru2DpRq7Mzq2fpAf0Nq0Rl2wBXzglZ4yUAPAmDSVWDBPHQjLcgTqOZ6zUvdKHh4ruDCerox/Dnu7YqwXAC1NI/QcEQuK6WK/kdgCTGC0PYAP/KIDMBgglq+hIkrOfsaCviLSofcJgJ5AdM7kkSaCj/HqQKVIGvD4swF8bcBjmzjsaQ2H5D/6acBd9wALB4DFWWB5AVherMp4GKIYEOp7+26UF0aSfT/xYuDG7wDjrIpAERytXf2vajj7ueryQXSFl10K/ON3gIWDwCLvjfGB8Z54O+Ee4ve6513uB2R1yzsqC+twbC8HcNVhfAeaBuDP/TvwtS3A/ePAIfYFVlPq2HHTuyulZCTlhbjhETF5yxTQGgPGhoHhIWC4VSXGD3n0tLkMHXHxu+YyB+MlPwDuZs5K6FlsbCzdVO9DuKfkHM8AEkP7B8fOkwDcD+B7np42+JkGOvKdAL4E4K8P0zvQdET0b14D3DgB3D0B7B8HZka9WzrD88N6sFm+YcUjrn7E1ZDvMtF9DBgeAYaHgSGB0PNHCD4BLwLRsByAyX/ij0/dDUxuqlIG5hix7eFhvLcOVUAtyPSydAFmOQNe6EYGV/9ZESiKgIEgtbaD/gHALQC4ovY5r5KwtjOU/XfTAHzzLuCmIeDuMWDvKHBwpMoN0WQzNtAaYSs0K4ZlOSAjGG9kPjCBRwZ0ABKEBJexYAZEAU3A7Oi1BeDym4EDnjQ1TwCGWMW8MXcKks0YOyZNlQOQjcgYIUHllEzYQ0ktm+r6oz8G4F4AXwXwRd8/kO9A0wB8y65KmPxgGJgcqYJTKYpTv2CCzyddQJRDOjKivn+Deh8BF8BnwBtaCUA+YYEyAU8h+c6Az9gNHHRmrgOgmDA3jHQ+iWupCeUAvNSrA9HNwqx+muk9nJVNg/CTfrmbAPwbgK8D+PcHkIibjob5o13A3XypWsAkG1cPA9PDFQDZM1id0i1KxsWfOrKnAFXlifCFFMMRcASigOcs2MGAIfE9iWXplS6On7UbmPaUUTXQrgsVMzcRj5Folg2V5ayUA5BWYKwOxKUafnosWjcJwk+7W5F2EKvlE3xcXaNYfiCYsGkA/smuqug6hcleAnAImPbO6YwRpMgjCAVAm/yQmKTv5hNsAf/i7SyNBSl2a8Qv/4/M1yF+BZSYlNQCnnVrpbC+mToAACAASURBVJcaI7sOSEY2NpaDXLqpR+vE/OVksDgImgGgghH
5695oYJbTWc7oJtFWc65/cg2AYvh2ALsB3AzgVv95nS/f4QdsIkT9T3cBrGtITWZfC5hqtQHInsEGQn3UDDvEDEY/ICf7SxMOrAg8T+c00JGkvHGd2DABUYZIAONzCUDppCFhSukCBsLQrFtZe/IixYQpSyEoJoqnuPWrVRAubQh83HNlZB23z7j1ywmj6CIIqUPxw2Xeu9bx2jx10wz4Z7sqTYZaDD8EIDuoE3hMVEphWg66JIp90k0sBxBcy+iPIIaT1RtEsHS/yIAqw+VSNPWQfe5tlVEk8auXgVa5BUsEJuT5uoliAbE5AGotmIAjCPnR9xDG3TQernYAUupTdBGEFMf83OkApHG+XlvTAPwfuyrgSZOhas3u6cwTsUBVn2gTwyFMi8wjHZAA1M9fYGHDULJD1m8Cpa8fRxDad+l+Ykf/3XNvd11U+qiL39SxXevSsshdDFvgbI1O2AwAtRZMZzTBRuDFjxe1Xg8QEIB8yyj5yYIUxfQIkfkIRnmHCM712JoG4FsdgHHp3ACoMH2G6jM4lWzoQarSvwQ6MSB/vporVaFkh+mCLlpVR8Z+dqDZLoDOpHSiQeAFDkBjPrlgCHgCUaFifg67H/9uYjn4Ai1vpTERTAASBaoQJBAKeNqHlL6mwPDZYAOROag/EYRkPX34MwHIvzW9rQcA+TLpI22G7EcQKlJGsYIJhC6ClUMiXfBTbFUQAej6nPS/OuAl9pOOqIc2BLzg++3VmWgIEUz82cRuCAtLIHQQm0gO52uOAb22sC3JEWgRfPpZf2sQBQIgLydPEIFGwPEj8MlF2bSbsulghLftqsCXq9HGgHysznrGgi5qzTUTFH8FLhAUn3hIJwCN0HLncw37qaF2zoYvuKNivmQIuUNc7GvWt6sHNs26twA6vhyq8NEMAHlyntFrDCcQehyaPTl+FwAbXDcmAKMRThakEk8Q8kPg8SPL0qzLBl+A9QCgR6uZGs3vfHz8TtBZvkgGQrEPBVAUg2Sij50QAOjiVKI3saADJRm7dSLYWfSFDkCem/dhZeMy9pPY5QvSDYQyUJoDIK8qMezh3wY6fSL49PcGgCAA8pScJLIgAUYQEmz8RPA17StvGoBv39W24eREiBoNQSgWNI1HBkdgxJSw1AI+dFIbgOYmkjimQ1r6XXC3rAbCHycAgytohf8vsB/r2KRaRq7zpZ+D37HMX0s3DDcCUGLYaw53MJ4YUODzusqlGCQAOQCejuxA8UULUkxIwAmMAp8Wa3qkN/R9W+sBwOhIEPjk5SLr8HeKFbTQfb77csPIMHGl/4MPbReslPhNe4+MiTpi9AFGV4nI7MfvagNQLh/pfrYnDAS8aJQ42A2w4em2cAyWQUuJVQTGWLs1uL7DG9J1RjhA+jvYk4t3KXeMqijpzrud4At9z3XtP16yGfjKZmCGooYh1tZzvv8xXPFl4PoJYC97k9FlwZWD+Azi/deMZWeP13eQCGEyoERudChIjbb3mJYwH7V0QIKuCwj/gfMj0asn2I0FXRSHXfL/iRkNgLyeVj8ccMY//J1fyxzTAXT2+xoQViKYD/1hDqLxPiYxTgSvQrphphG97tz4Slqafnj7uk1kIQDZrvWTw8B3jwEW+RLxPgSiCERdPwPR7+wCPg/gulFgfruDkOMQkFc5x84e708JAMmCuRNBXi4TIg5CGRzGiBGE/D4E/C2r2vcAYJoify62i0aJSMhB+2IHoNwu0fkcjQ85pu3ack5nIBREqneYFyWLkAXIJHESe00Cyx5QyeL6F/tyEcDcrOW2n7fX8df0mME+/vQ/PQjhoy3gzo3AISYf80MQaQx1peH9wb7v2mrtmCBkIMMejp3jIJD1MsaxaMZ8v5N/67INAsB3BAYU4JL4DSo1J15AFPAEwuQHZJzkKfUAtOHLJSOQRWndBYQvCQA01cfnNopfsaCJaD2baBn79QjSTiOEP1EcawIpkq2kegBTNgHWEpOKF8Uwq2NRFPM4AqCf46/rA2U9/uVDvurB01zvAJpiiwOl3fEeciCGF+Ij11f+QkbSfMPfIzqw57mEFZ9Dl3Ps5HXWAYByHJAJKV7N+s0cCQQhwSlfm4lGZ0KB8C/rABgZUS6ZHITBSEhCowUYAAksF7cStWREyxRwtuPpOlgw+5s9sq6OaIJIIlUgEhA1edoTgHxa9HVw5jibZNF+j/9yGQA/7pbujZ4bwv2+cWB6tFo0NzYnkxFA+cvEAo43VBoEo2e+48EMXEOmD9F6xhCE8RwZEJ80VblKvDlmzwicfqy93/o+8K8TwB2jVSgW138FrJQTXBNlnJgmrjZwanow9CBP/rL9wF0jwAGWDtFyoN9PHutnIHT05mPXz93dMGQAPniJsjiBXiTbxDZFMF9NLUPQxKR5qezz1Y6/YZDH0D6GkdAkYJIvRalAdHAMmPZoYhb6NhDWvEyf/ma737CXN7R1ZC7hUbPgcFgqt/ZZjADnM1xqEVhYBpb4CUk5UsL7jQvj///5buDrLeCOEeD+YQchYwG9VIfyg1NaZszFiCH6DkRGLze5/dgk8IMWcMCjdCiCzR8od1B8OTwvJM8JEShFut1fzMhi+eRJr6LI7hYP2M/xVLwKNoZjUTwRMAQQmYyhWGQxsSADOflZ4kukj7PhZ75bETjBpkAGahMkcrGgwhsXeCyBHBj1wmOBQwvAwqKzoFeRV8ZaerjKYAuirmPY/o9X7q5Cyr7fAvYMAftCPGAEoYlBiVtFwLjtp2U4irj7yOANbi+crHyrfCbTquJV44O0F1FrwQGIMZFqdQDyP/gGSZ8TC0ZRRsOlVzzgasd/u+zpMByLehAfCgMQCDyGZJHFCCgLZ2f8mgI5qauEcVx9e5vACTgCTwEMWr5TdIpWKJb5MvrnoocDswvAPAG4VLGg6UKeqmi4iuDz4er30oX0FP7u5moMvIf7W8B+jwlUNAzFnlZCIhvGFRCeWzrgXSSIBreXTFZSgVLHAp4UHOFuociEEsn2PJwl/XEk0dzfSojeerFg1IOo5BKAveIBex1P67lgUzgWQaJwLAKRH04i14ItgDKEtGsRnWx49b2Vkk9wUefTGrKCF7R0JxZMqxN8cmPAxWcAcxGABKEAKPA5u9lEaAbCmKMI+sDN1X3z+ro24wEZFc0VEE64ABgT180PF9ZdBcDb6JpqcPtPk+1ACbmKjJnllwyuILunEAWjZHkBsrsRUnfD0qEiC5IJfyisgMhzWhcP2O14Ro4WbASgAMQJ48SJwchmBCDFa8qpyBbSP7OvU4PQ0p2W7+LSnSJUFOrI4V7w5IoBTQQTfJ6oTSYk2mQcpGRyH2syGjIF6EM3V/fM++C1CfwUExhCsmzCaQT43lZC3e1hBpEHh36XEqrB7Scmq5dV0XZxmV8WuDFzAF9iwhow9seAGoBcGtKjqAc+1l9rLb/1igesO55ysmCrC8ei6IxRMAKTWNBi6Xw98xNTFUi0jEcmpYgRAPhddpVi9OIEPP5cYD4CcLkCooHPwaW9kV+iwWrQHT8uA1fd3F7DFvgUHUP2k8jTiogAqLoxFpDgbMj9jXSuN7i9dLIdaxzBp5XVBMIMgFEnFAPKT9qPd6A9BIGI7MfPmf4U+40HzI8nWgq2PBxL4FEkjKJixGRRFyQQPzzd1iAUzCAQas1YOmAEoFjwkecDC/PAwhKw6CxIkCXwOdVJLxTobMjBdyIgfvimNvNJ7Evf4jWtdnRYD1YNGVuG93VWuWs4Jf+mlZCCZxwP/cnJ6mXVKk2+tK8lQQVHRTGc64SDAZB3Ey3JcxyACkToJx4wHl+YwqloGDICmYmTFgMQFBET8yyYzyAG/AfWX8mCGQg0BTRoHwt9KVaPE/HQ890AIfgWK+CRAaMRYnVdxHbhdY8Wslw1V93UDsmPIj9GxgiAioRRMIJNvoti+SW/Ikd0gwAU8+XxJcbGITJPDvI6XdCFREFSknTB83xka40H1PGF9dnycCxFwygkK0bASJQSVAbAYeD98xUAe5U3jKIwBosSgNsuABYogl3/IwgFPrOIg1Xc4ZrpAsSrvruykl2ucykapkMMh4CExD5DwJfWAYAxwk4MKPAJgOIjGSEGwuCakRhemw6Yv0UUwRf7L00L9pnsNx6Qx4feY4O8pDEcixOjsoTKKpMYjSFYYjOC8Eq3Wnnr0YYS+0Tmi2HysrPGLqwASNYzBnT2Mz2QD91laxLB0gs12GAh81cf/o/OcHyJ+qj0S/zxnhUZbSyYWaL8+Rq2S29wowiWkJPan4MvgrDDGAlRe7KIywDIgR3meEDWg9HbJgApNTkXo8o0i7oVgxnEgFr8F7jEdnU5GvqfJQKQKyEOPlsNIQvyvupAGHS/Okv4qv9oh+PHxMLk8ggBCRxvAmEN+AiEzz2iQfQBeNmkh4K52hJBKOaNe/FSLobLRXCz43rQnu2yi9oMSMDxs2jo8303ERz1wsCGZECF4kd3DwEYYwJjhoNlQrgIjlYodbBPrwMAZfEmyzcIv27gs6XDzC/IR1DOgA9a6DRz4wZAsZ+LYXvQYsHoD4ziOFklna6YD3+nnU6dZ7bGDAcBUImIAmEUw/zbJ1i/scGNDJiLXmle3RhQ+l/aq57gUQCWzwwBKPeLsZ/LFrGg/ShRXAe64Ajkv30kALAjF8R11Dy3K7KRwJcsUTaqWScARou3w/INVnCH+A36n8RvM3nB5XP4oD6DATBYwGb5ajlOLOh6X8JaBKRG77+7ygGYp1bn+V25/01AzBnwQ1ypanD7KWfA1QDYC3zJIj7KgOUzc9nFbetX/r+O5biwNhyX5uSEDr5o0xsJwLp8/m4A7GaJUv/j3/5+HQFYJ3oFPPkho/hNeqBcMkcB2BAA6XrxmMBkfFAci/m0JpwzXw0TXvXtzrz+PKc/Ml/ugzM9MDqCAbz/keVjjGcQA/YLvjoguo1mRslRI6RwfsiA5nqhL5D6nscF8gfTdfxpS+/hLzvWfzMQCoB1Fq/8b3
5695VWaPIDZqsRV64DALsZHVHs1gEvsqFAeBSApQC8pHK90Oql4UEAyvCwNeGcBXNLOPMLftgZsI75ouUr9ousp2TEyIJ/sU4AzC1e+WIFshyAHPZREVwItrrD3wGAhibTYBhxVpe/xePyrNBuWaoNp3DgFwC81O+RAepK/a5Lfe51jxr7JwA83nPXYgq1asl0yX5N48+f4VEGLATlK1vAo5YB1gBSRmsM+NFE57lcfPD5pPFWCJImtyvGgGfOAacBYO59zFglgHgPefZsXV6/gPXBYeC0RVgyJNOGYuJjPka9eHWgjL9bWzhWk0/n/wPn+k8bgFNmgYcsVflZnBRmIShtJM/m7JGibGBoOIIez9wKPP4AcNpylfbNlGfdI+9NjBjz8JVzppckZuJ+dBw4aQ44drk6j1LIY9JkPD7P4s2lwVEGLHwJnncscNIh4Nh5YMsSsHm5ndOu1BGFThJ8/K6JrZtoslST2+XHA6ftB05ZAE5crgAups5TfaL6EF+UyIif3gAcOwtsXep82eIYY9JkXpMgMp/AeZQBC2b8OduBYw8C2+aALQvARgJwGZhY7swEzbNa88IRvAVO1qkF91J36DNOBE7eD2yfB45fqphLnevzdGeBKBfL8UX5/CZgyyyweRHYsFwxYHzRNK6oetSBMDLjUQAWTPqPngpsnQK2zgKbCMAlYMMSME4ALrcnR6JYQIwsoUnjpDRstOLy7cBJB4CHUGwuAtuW2nUDVH1EFUhycSwWjGD64mZg0xywcaECoI0z5P3X5P6nWlHdgHgUgAUAfOYOYMtBYNMssHEe2LgITBCADkIzSJZXpCOnIg25uPrhgnupO/TyhwLHHwSOmwW2LVSik2pCrDsQskzNIBGIpBdGI+VfNgMb5oENCxX4yPRjPj4xaJ0+WGeEHRXBDUz2Mx4FbDoIbJypADixUAFwzAFI8KUJChMV2SUaAGc1cE/xFJef3FYRti64nkqWDrqqEhbrsm5zvZCdPCd8nHzJOLZuABRz9hTHZwPL7LnLnoNMIY2VyaKcjtZLHOAbNgNPngKe4BacfGF1pnydD+hphQ/8XV5UiEueLGnDN1tWXj/3/4cTwAUzwGPcRcFJiDpPt3FLmf5vjwE2HAQ2zPrEzDv7OQg5OSM+ScYQy5Xbo8465u/ZfLTJ7fKHAdumKxVh8wKwealSE6inEoSy2MWCdbUHIghv3AqMzwHji9VLZuDzD8cXxxWZs5c7apmW0fMBnIHKn5X7d6I5npvRz94O7LgXuGIReJSb+Xl1tzqflybwRwqf9i97BQRWomWJQ7oZVFtJoqDX/b/oGODsvcBTATB9gsfGqmzdjtVz+G+PAyamgYmZCoDjFE2anCVg1CeJwOMnTRB/DmUINVkkgia3y08BtkwDW+YqAFJFMD1VAAw6XG61R31O9/fdrcDYPDDmY0zjc1UjivBuAMx1QdMB+WAYXU8dhEU16dOSkppbcHFSrng8MHwnsGMPcN5ypURHp2xMIa7zDz2z8Gn/kVe0YomO0wEwBYKujL7v/zHA6C3AxfOVh58g5AsZxx4fZM7sf3h6BcDxWWeGBZ+cMEFiwGEHHRnDzun7ONHs/djkRgBunql0VDOSHIDU3cxSD4aEajhFXS4H4S1bgVGN0V8we7E0Fh9jVDG6Obr1LJMRwn+kOCaTEYT0dsfqZHXl/p7PrLi9wIY7gO0H2yAgCAWCWCowKrYE8nMLn/a7PQn9X7zIJPPkCcK+758y7x7guNsB6l98gZjLLYet3Ay5n0sv4R+fCYxPA2MOwLEAQLIDPyP8uBg2cRYmzFweAYilKkn+OC8/Fdh0CNhEA4nGA40kd6FES13WLO8v1qHKAfh9B+DoYjU2Ak/js/8NAIwg7OUb7LCC+WAfB4CpBJoIiTRNRmS1l13kqWh3Adv2A8cdqqp1MB+aIOSxWv6pq5D2kkIAvt8rF7BLJksN/jMqfa7v+7/Ak4B3A6ceqpasKMq5akAmlLWY37t8ZW97PDB2qALg2BxgAFwANEGcnI5JcrDZRPlkaXL4u1KJUAfAjbTQ59x6dSvdLPXAgGYshZWR6JIRaXB/NwFI8C1WwLMXzMeSwLfcXuKrA2G+wrLCDcN/IIg4ERRn0qvyySAQX6mG1XuA4fuAbTOVwktRRr2MLCoQyvEZ/UY/WwjA
5695j3jtFJZkU79g1ghkgEBf98+0Umb/3A2M3lkBl/fOcdMok2EjkZyv8773LAfgHDDKjwNwxEUw9yailpwdxBAEYhBbAuGzG3aKkQEJwAkCkOCjlb7Y6SYyf2UwlAS+vKYnAXjfNmDEX7DEfA5CjUcsnzvbu1nDtUMmCDkRZEEyGdlAk6G6lQTSa6m0MP6HuY73AxNTlcJLZ6WOJYC5/CNxLpHMgdKIKNl69Qvu6/75AjHOiTU87gKOOViJb748BKCWrnK/maTA+58AjM0Ao7PA6Lx/xBAupoYDC9okBRAmPdBZ47lNA/DhwMRsxX7mPgl+SrmK5EaRNRslXFQ9CKB9DkADn79cZtkHFkysJ103eBbqlh97DpmTQTYgk9VNxu+xYbXKU3lhFoJPOgdFGY+lPkgQxokkgF9Xgj4AvfoFs84eX4Ke9x9fIC+tRfDxvvniif358sSir2LCj5wNjBKAc8CIi2AxxLCzIAGY9L7AhGIKgpATw4l8wToB0JjPrfTkp+SLQbHrOqm5jNyajS6VCMIpApDAWwQ4LrGgXqzIfnq5cv0vN0ZXHTInME5GBNLb1DGdOYQsI7AfGKFjlgqve8wJwG4T+fuFAFytXzCLb+VgWnH/fIGYfc46Hs7iHC8ZkPcdXx4VfVXJw8+cA4wIgM6AHSLKWZCTESfLfg7WsIyRF3ckiRQ+HACXkwHptyP4KHrpJvKVGnOhRF9eBF9wE0mUEogz2wC+WGI/vVxiQQIxAs9+rmHA6E1YFYB8DJwQMZl0OrLZ++i7sfT8zroYHLS9df4RACWKxSZvLXzG/fQLZqk2gqn2/vUCUQ9UZaM9wDaPeSPrC4A5C1KV+NITKwCS/SiCR/jRBDlLmP7nHynsxno1IPwJSyRpbiMADXzuPDYfZfBTEoAmcuVQdiaW0zwXwQsCYDYmMaDA1wG8TBSvaoR0G77EcGSET6hjOvVApfRPAUN0zjr45JzVcSqiTxD+VeGzXku/4Nr7JwDJOkxFIwt6j6+RqUrlkO4bXzp1gCAAv04AzgLDDsBhKugLFUvQUhTwCEKbnKCw14HwJ9cDgGQ9WegRgDI8XEcVEDvAl7lVlglAgi+I4CR+Zf1mLGgMmDFhBGFfDCicRJFERviSABjLS7FC0MFKMU+07wOPE0kGvaoQgGvtF9z1/iODkwn3VWoEXxres5ib9xx1wZufBAwLgAQexbAD0JiQwJOuJBA68/
5695H3Zhk6+3CifqqwWNMKN8wjKgbk6gWJgC+FMaBb5vJVmsUbV2vCqo3cRWZcCIACoax53+ulkqNd7iqOcU1WcC9cxEm5kQBUdZ+sTnSL/jEtTWngi21jhJNJBivZBukXvOL+yYBkcOqxKjJ4AGgxzMrBVwdAMmHrZOAYF2l6y/mwV6xD17zmWo6MbRyeWtOHwxJ91IIhr6rqZS70DPPLXDVUrfBwzHKr1EUp6/h0T/6L/GcCqslt4IhoTcwdAqDSs7I60WQH6R329pHuFyuXDJmEjuOSbdB+wSvuP5bGUjmsA5XoUvcvBXKKAQnApUdXwah0b8jXR2YzJTsC0ZHB33FL+2yiX3h/1YeD1fFZGT81g/H6yqkVa9YEpqMhTADle8erHA6t7Mh6j4ZBXdBGjFyO4CSIm9wGBiBvgqxwIAJQlXIyEJLyI/i0SkAG/FbhaEr6BXfcv+5dLKhCg4z1C1HEBJ8+BODQGZXfk/quAZC6ketAZEQCTWAU8PIJt0fgwHzZvVWNaKqi7JLOmtDWFy42g1FxH/XfqGkII0C+a0tnDkfsGxQjn3VPsk7tXmuy+Xp0JhtoJosAaFcUAJUYKiYJxcqHqKAH9rPlG2cMrmCUbMX9guMLpGTcCMKDlZGhMK8IPnPIn1X5PA2AwegwEEYmDGBMjOI5whGQP3NPBT7VJlRNaKvF4t2IWHbDErtDlSk1p4lJ7/zd246tglGZryIfrFhQ7pU8WCAX0ZENG+57U14Z4YrCeLrSxXdev6TfLwrbxT7znMrfKQXfHLQCnyvmRIv0Q3430ezMmL98P393G3wqz6am1NYzzoGn+svqRmTAU2citctqAX/2EI8F9ACEmLHXLZGoFxtSl2xyK2bAYwrj6Xr12+1noL/jUTCD9vvFrn6u0v1/nvGkaoVBAQi0eummMAuXQHMWJAA7gCixG8U0gFfcXdlBKk4Z6zELgAJfZEKrxpC1xOIl/+Sk7jkcdYlSco90y9+gK6vJrRiADD0piad7RuFo3udNCgft94vCdrGXn+tujgV3QAcHLcFnroelivHkchEL8ue0uQ74S3eubAITS3IQhKkMRjBMokgWG3L//2z3VSnP4VDgQWxUEEUxAZFHL0eR3HDfm3IRbDHkBfF0zy4EIKNhSvr9goGEBdvTz/MIYQLQdVsTwRTFDj5jQmdArRDYJQNDSs961R3tPhx5NXoVgoxleHnarjohgLec3D2HI492yQNvIwvqO9fJm9zKGbAwnu6FhaP5pFuMg/b7tTbpBdvTz68cz/zI8azVj8iAHTqgmFHXDUB89R2dtaC7tUGw4kDOgFb0R2wYRDGZ8g9O8aU4XwPOczhiwGlMjqqLWiFYGu570wADFsbTvaxg8nkow7E8nM/atfKzln6/1mS4YHv6BQ4+Z0BbqHcd0NwwYbVD3+1yWhXJxPBrbq8AqE/XApSqAxiBV2MZ/54DMOZwKE00rnDUWcR5KiV/brjtSAMALIyn+/mCyeehjIYp6fdrvVELth8RAClyHXxmhPi6r1m8FM0ucgk8+y4RHC1kAK/5XgW+2hZYofafWcPq1B5AqDqEYsQ3nepR2gqhV2yiol1COkD0C+aOaoGx4aL7DQCwMJ7uVwomn4fm7VrX2u/XAlELth+5sHPtN+l/Ap6sX2dCsZ/phZkIJgv9l++1wbcq+2WFv2NXIjNKAPzuw7MUAV8DTuynFIEsQy83RgTAhiv+NgBABaQOGE/3mwWTLwAqHnaQfr9GnwUbARgDNBUlkpzQboyYCyYDYdILdf0l4NduW9kGoa4geNdazLElKoA3Prx7DofiETtC6XvE7hGEzJlpcis3Qgrj6d5UOJoYDcMglrX2+y0NPtl5UZUjkfx/Hqbecoe0OZzdF1gHQrln9Bhee4s3f3Zxm4MvAk9VSFdUIw0i+Q2PaBtISiBSSFgCYMjMW00MP7pwvvLDmwFgQTzdHxcOSGvBg/b7ZRZByWYAlOERluKM3Ra9CKWc0q73dTBhMFT4ZwIw9l5Lrpes+HjeBiGCUOKXeuBvPcKTiEIOR0f+RhDBMYi0Lhea4GTaa5NbOQAVDzhgPB1La5RssV3rIP1+7yy5OAADoAchEHBkFbKfGRpiweAPtMs5IFNokyOGk/7rAYC9OhBFwNXVY1at5tftCBHaWVS2AJdEcEinrDNC+Lumiyc1B8AB4+muLARAXTDCWvr93lR4/Z0Xt6ODFQkj8WtumEwHTKDLQejAfN3uds/dfjoQdatGLxb8jQBAYz6/boxiFgAVudzNIc2/s3xLk1szAORoB4yn+2DhaATAGJCtbpkCYq9+v4V+aBgAQ4i66XtaC85YkDog/zdZvzUgfN1N7a633Xqv6fe9msDIHfNaB6Ay2JRE1AHAEDIfI5nzZCLeN4Nbm9yaA+CA8XSsul6yqV0rJ2WQfr+splCyCYBR/HJyKX4phs0PKBZ0lqOYTpvniAiUAmAd+HKjo1cvDjHgr+3wPJQsVCymUZrPMuRsRBDG4AQCsunyJtFGHwAAIABJREFUcc0BUJlxQoH62q8ST8cggpKNAFRGwCD9fkuvbwAkyGgJE3C+Nz1P1q9/T3F1EZBxvZh50s6AEYC5yyUHXt5/Q8zI5/KrAmAIkkipkyGPYwXz1aRT8v5ZO6jJrRyAvKOvNXlLazsXs9bo/ztc29Pohgotp5J49Rcj/pzfIwGS//3OM4CNd1dpntQpFUmjEH4LYIgnyn/OLjL8FeDGhwJbNgFjI8DIEDA8BAy1PFK7FSKf43cNKrvHx+8C/vmxwMgmYHgEaA35J0StpvvzL/nP8RbLAfhyT207TChgDRiu/ZL9DsfWNABvYzbhCDBKoBAk/pEobGWTqp819hzQ1/0k0PoaMDEJbJjxVZFgDad0SaUO5LksWVj+XScDmw5UEUDJ6U4d0nVbC91S3ovfVHp5al64cgC+k7mZAP768KCA0WD3A/ieLz090CDceVmlAuhBljLgrfcAw6PAyDAwPFwBkCAbItM4a/FiNtERjBl76W9ffD2AbwJDdwFj+6syImRXrd5Y2FjIYcnzWPLEqnsfC0zsr6qBMQmfIDR/pyJ6xMhKyMrSDiKD2xja6TADTt0/AGAs1KcAUCFrOLF6tbtiRVFavT/wuMCa7MfVTlH098YBeBcwNAIMEYAUlS4uBULOmK3LCnwOPANlEIOSoF9+C4DvVoWXhvdWZVOYqWgi3vOXDUQhgieB0EElViMYJ08HxqeqnG8D4IIDkAzo51DKQQJvBKUmKACzbM4+5hUivwrgiwC4LzvjmgCh6nBcgiMTcv9Abo0D8E6g5eCjfpUA6AxoQIzgi8ALmWwC4z//DxcPPwBak8DQFDB8yJPpPZHeGCyC0KN5DFCByfh9/+OAsekKgEzCTwD047X0SCPM1IYQjCv2E/MJoGVwUUQoPboq0MdqkWVn7RtDDMahB4g+P6qhXFpjVtkDtRGA2nKjos7IyOyHFUbIrXe0FXsTuzIYfNb4O2M3ATGIYQOmPn6hG6gi3eUkQQAeAIYOAUOzALMVh2pAlESqGFBAXAYOMQVjxll03iO/yYKRAT0FQXkwZkjp1pz51LO2XAT3KtD3AIAwj4Wg05kfiuUHYlsXAJLVnP0INLM0OYFx78AzcRySeTsw2AJueI+Dj2Fne4EWKz5MA0MzDkCCkAByUWqsJzarEanzj2zXwjEGFHuGY+pYsMojzZL1G9EBexXou339IRBrC3lJGmNDuSHX+w7WC4Cm6wWxm8DngLTImgC8pBcGBuTXf/1fXnyTugnFwxTQOgi0CECyIFlsvvJfEnh0mhsYI/s5uxFYi1xZof7oOqSAawwYjRGBzYGXbtWXaCIrlvHUagX6SP/ruMVYCEbEqECXAMjfree2HgA0ESur1/0vtnNwGSsG0RsZME20/+/XWH6Mugk/yngPAGy5GDYALjiIHIgRUIrsZjM7Ax+BSx1S4pfffQVIep8dL7dMDsTGjJB+CvQxTHmdtrw4l0CovFruC2NOe975egDQsCXRK/eK634JhBK90q2C7I1i+Gt0jxF40k1cPJAB7UP2m3MGJAAFQrGei9iUTH9yBUDTHfU3B5+BOIKQ43BWtNtPcWIOzEZE8FoK9K0DCGNxLi3FqaKA9gTgeoFwPQAoI0OulWT11oEwiFz7cwbErzNxWtEYBB+VY76Vh4DWrH8IOoGQ7Ocg1CqMRLPltmxvs1/SHaP4dcAJePYyyUCRIzrTB8tE8FoL9DUMwl61kQQ87Rmy2PS2rgB0a1ci18RudEJH57OsY02y/+83/sZdBKr4FXQTApBvprGgQCg9UEAM+h9F6ugJDkC3gJPBEvRGrYoYCBX9IxEcS5K4i6cZAHIw8oXQ4mL
5695Bb35YH5d7OekadtTV1UZSjaEIPH4nQzYNwgjAHNwDuWGYpZc7lzPfX1cQur5oBorfzDf+zi0yVTuSkuxBI2Q+PhQDIUEnMLo1TBCZLufGw/ixbQa0KB8CTODjPohdY78IQmfDjmW7Yo/doAX6GqIiAtDHaYswSmeMubV81kp11L6hy2PdAcgblfslOKC1IiKRmyRxZgV/8++DS8BFrxXi5Hd/U6MeSKdqEsEKhpBRsgRMbAtuG4KU/+9ry5brzP/lPVMv1EPOQegharrVcgZUhVHFxNPcp9VFtlOWkL437C0WABWypFRGsV0sb5Hn2zYBwvUGoKl10v1knDgo0y7XA8Pfv0UACnjaK33Co9gJQAOe64FkNvtZAHQdjz9v2Nz2GSa3jYej2W3KGuZ9ixGdIVSoKT13B2s5AHkGheST6qn0erHv5AIgAAU+LVfw/wq3CEAV7clBKDDGZG9/5oVXx/oyYARczcqH5GyH8eFplTawFvAtrtXLGpNrQDGbejupB3omlIHQGc/ErzOcGSRs8zrhAbbuL1Tco/JfbLlNwHOmi2kIcs3owbdwNpYtynDQhsFcgvuG9/YapGFvYX22zZcAU0/GwA2LJ/4AmGF9mwEbBu98Y3cMF+uAGQCj2HVp3BbPuo3IlqxAy5wHAq4OfARmEBXGfNIBa0BIsG0ecwC67merHgRpZLwocrWaovuTxew/V0txJQ2DWeae3WAGbdhb2DB4+wRw7w5g8Qpv88liyGtoWHzMi4C9fAEHbBi8kwUKu2xNAdBxaGBLbJdZux1LwAGECYAEm6wyfpelJrEgFnRDxESwgyUxIUsVMwjVy5AYO0bG89Auu1/5BF38KqjBHlUAYXsteNCGwTeWNuwtk4JMkrlzGNizA1hm69g1Nix+zDOBW0aBeRZZGqBh8M4emfWNADDT+zqMjQyESdQFHfDbZECCLRgdHeCTe8CBaKJY1rDnBRCIAuGW4TYAZeFG8ZuMkGiQ1IEwGCJtHZBmy1obBsvVMnDD3jIAerti3LEBOMjGcOpa3WfD4ic9t6oveDtLfw7QMHjnH6wPAybW6yaG4+8D4HIQfvtDIVtLejpBFsVvUI7NIBHw3DUjRzL3rDVtsYPOkAScuX3coNDynT2VYJCkn+PjqvUD8hVbS8NgjphGxcANe8sAGNoVY/824BCBtIaGxRe8pLKZdpMkTvXiJ2toGHzSNHDPScAyq3er4qPyGaNc7JCRXWLT2TjwGmCOeQashq6+qSpZmp8vojQpheF58ncdZVjLnjWPHr4VWKTKxrHGUqq97qXu3jp0wPy+eEC/DYNZsZAO6IEb9pY9lNCuGPcNV830ZmkM9dmw+OKfbdcXvJMPdY0Ng0/7GnDXKcDMccBS7MwdKz8KCAKQIgY0MWGCtr4TOHAasMwOkTqf6unyuLykfd254nkb7qsw/iVg7jhgmSX31Vpd9yRHeLx+zRhjEGRbB6wDYT8NdymyubzDzCCGfpMJWfSRYfr9HP/aMgBm7YoxNQHMbQHm+ID6aFh8yS93tAvGQb7da2gYfPoXgbtPAqaPA+a3AEubgGU1RM6B060fgkRoCzj+TcD+04CFE4BldZdRc4/YxlxgjJMewSiwN1zWfsOngdljq3EmY08vm5i/7j5yIMqpvupKyGoNg9lngYosl9wY/0dZdrMzYl8Ne8sAWNOu2MA3zw/F2CoNiy99XbvftrcLriz6PhsGn3U9cM9xMODObQYWCMANwPJ49UliuW6SaqqBn/gGYP8pwPyJwNIxwDK76ahDeN6uXYCuYyABkEza4LbpY5WEWdSLxjF26/dQB0SJ6r4ByAN6NQxmkWcqrnQ00x1DEDJFjR8CcNWGvWVPp6ZdMQ6OVOCb3wAscPJ6NCy+7PerkP5Q3tBY1PrT9tEw+JwbgPu2AlNbgVkCcCOwtAFYcgAuiwWlM/XqDjMEbP9t4MB2YO54YJFMo/5gHIcALV1TRZ17FXOhPtvgtvkqf9H4kvHDlyKK4l6VzvVSBF22uwjOb7pbw+CfcwBSkyeFEHAUx/yw9JTyEbo27C17Ol3aFWNuAlgIn9QxO2tYfNlbK6MvaxeMRYquvL9rTcPgJ30TuH8LcHAzMOugX3QALo21WXBZLEHwRF1OgHS2eOgbgIPHA7PHAezNu7QFWFZ7JnXJ5rnqxHEulvlzwyVNN3+wern5Yovl7SXLGwvn4riLWO4fgMRJXcPd/+pmOymELEhRzBxJAo9gVL4kwVnbsLccgHEpWi3epocCAMeBRU5eTcPiy/6qtl0wpvhA+2gYfO7NwOQm4OBGYGaDs+5ExYDGgqP+ccAkINaVpB8GTv4d4OBxwNw2YGFrxYCmV0YxLNYheCXau7EhV3ga3Lb8g4+R45uoGLADgHWqhsBXA8K1AZADyRvuvtkBSArh+i9DsQhCOtf0UUgW/7aiYW/Z0+nRrhizoxXwFhyAi5y4rGHxU66qAFhT3rDSIVdpGHzencDejcDBDcDsBDBP1uX1CMJRwFiQIBzxieL3KIY1YW5MPOxNwLRb8gs0aghAss1GZ1O+SFHsdRPt0i/PLHu++dFb/x4mXfhcbWxhfCtYMFr/uWvKxfDaAcg7ipPCvFOVpuo3HrCjYW/ZA+rRrti6TS6MVQ+L4NPH2nx698GnXF0BsKa8Iab4dFZpGHz+JLBvApieqAA4J8CPOQuOBBAOV0CUYbIskRkAecrvAdNbXc/aDCxSpyT4CEIyTgRgneiLIp3nP6fs+a4A4N8B8/48CUC+ZGJA29fpuLmxJW+5h5kNFg2jiWHSi0r0Uv4pCoZsxw8DUfnhd4Vk0XGdGvaWPaBV2hVjdjgA0BlpkQ/K9bmn/HOVqtClvKEBqlfD4AtmgP3jDsBxB6DA7tdbcvYzJvQJkii2n4NOeMpbgJktbYPGACiF3wFoEx1ZMNe/4jnPLXu+KwD4t/5SO/iMBcXuesHylyACMBPDgzGg7opM8mEHIGdwrfGA1rC37AH10a64Yr4APvvOSdwEPOVbKxu+K2pdKRTmdI3dqkPPVgbSTBGAY8AsATjWniBdx0QxJylOFCcr6HBiw1P/CDgU3EgEIMW52M8YkLolQRddIN1AyKWiBretf9MJQN6HsaCPxe4rvgDdHOcOxDIAcmDFDXvLnk4f7Yqt63gEIB/Yoj+4p9xaAbBHeUPM8qF2aRh84QQwNQYcGgdmx4C50WqCFngNsgSvQ+Dxu4MuiawhwIAXVk1O+e/A7CZgThY1dcno1nHL2oDIyZULpBsAFTBZ9pjT0QQgn2V6ufRicS8QRgbs5ZYpEsENDejBfpoLrwAOjgIzZMBRZ0AHoUC+SOA56xJwNlEyTFw5FxBPeWvlzpnbANCdQ1eSGTRybMuydgMggVBsKmtYoC6Mt8znZxsZMLzAxoAOvsh+ydDqtXx4FIDl8L/omQ7A0QqA82S/ERdTI22mNfaTuBIIxR4BhKe+y61punQC+MytI/Zz/c9EuvyBeetLAfGZ5WOMZ9j2/gqABB1fMLsHAVBqhfTcyH5d9MByEdzs+B50Z7voGZX+NzNSsd8cwUcG5ASRKYbdHRNYwhhDIHRgGmO0gFP+HJh15jOXjnyKblVT5Cbfoq+yJOszF8P8+VnNPlICkMAzds/YLxlYznrJwIpO6egTPMqA5ZNDAB6iCCYAyYBcBqTRQ0e4630SxZyQJQIvMJ8mSeLrYe+p/GzGfnTpEIBy6US/out+K1wg+brs88rHmDOgAVCMnrEfxxMte1Mt6j7u9zzKgIXzczEBOJIB0BnCJoqgIfDEhM58SWzJEPGJe9hfVH42un/Mfxl9bgSiBySIBWnAJBDGEDAB8QWFA8wO3/a+wH4+rg4RLPYLul8tCI8CsJmJMQAOuwFC9qMI9g9Z0CxhZz65K0wfFBPqu7PEyVdWAOTHVlTcpxhXHZLz1w0ZA6EDLhkCskRf0sw4dRYC0PQ/vVSRAYPo7QCdj7GqVOSMeBSAzUzMxZcDMwLgcKX/zbv45SQlHXDIgagJc+bjZBqAWhUoH/Y+B2D0J7rFa6LYDRmzomsAaOeKqxEvbWacHQB08JkRIteSXiSBLYJOLB+X4xrzAzY7vgfd2S4RAKkDDgPzNEAIxMASSWF38WsgkuXLyXTRSRCe/DduSZMBMwe6ObTd8JBj24Aot07uDObPP9XsIzUGFPs5+JJ/M6oT4buxHv9X7BeY8KgOWDg/Z58GTC9Xq5FxTXOw9c3Cm6k5fPcjgbHbgAlvVG2tH1T3Oavoq6BlniZ+12n5u/2sDbOvasqoFg8x2Lnbcd1GdhSAhXN+7qMrAC4sA8sORJ6yHwD28z+Ft4fdv8UyqUDrDmCEBcpZ39kLS6aq9l4D2rLb/KYsFTPWdfbvh86vQu2s1K/K+zIjTsXIVQ9a59Egs4Y6sZfIA/EcSp/jEXv8BWcAhxaA+SVgSQAkGAMICcwVlNLlqTc9Gbv/HAA7MrL4+f1VlXwrUq7SvCoyGcrrWpGhuur2fNGYwM8YT67hT3s1LaZvqn5MLM0bzmHMmIFSgdFNj/mIBct63
5695NhFZwEzDsBFgpDPeanNgATfCtGsX9TIKwNrg9tuVkhlng7TI/YArX1VkXKrEe1l2SynN1RCsFJsqnQv3UIMxhwIRjU5AGN9QUteVz3BUAvahuNgjC3HxLAND7nBp/cgONXF5wCz8xUDGgCjKPbvevlzcKUHH2ag6cnYzepYBB9Zi2FxDJdjoXJv1WDFiLJ6MKqKZUzoQFTfj2HmwTKcTpVWvcxHKm6kKgoORAEvVclPD6NdzLXpMT8IYNPcLV7yJGB2AVhYrAC4SNA5AxKM9ryDPE5fs6eeVKWGZ2M3S3MQfEyJUKV8L1ZpJXpVJ9pLilmlAxWkVJHKwIhjjD9TtVXVm1HdOy/pJiaMFRWM+bo0rWl4yM1N7oPhTJecC8wRgAttBjQWdBBGESwgSiV0Pb9DRgu0TY19N+M1mRKh8niqFx3rRDsLqjgl9yaGXT80vcL1wnE252PAZCzAHQCoiqoW3yYWFIt664fUpKaREr1NPakH6XkuOQ+YDwy4FMSwgU8GSRSz0UJx3Vx/5vFNbrs/EiLRY+v4ACITww6iJEodQKwBIyBRv9vwhKzUW6z66TUGEwhDS3ezqusAyNxnJn8xa1KRPSFts9YfFB/QDZcAm78CnDBT5U8rCqjfc3yh8Gn/hGd/MsKf1+QzYJ4891Jye13iy1cAE9cDJ+6FpYrEkidxDN3OtXR+FwBGMezoMmxJLOumAuD4J4rxJrfdH/XCoLGFVKiUbw+LAPQqWWaMMLrd6/+JycSIm85w9lOpt1j1MwAwFTiqAWEUxeYH5ENn/jInUVHeMXQ/f/jRePvCa4DhTwLHfBc4frGqqaNJzLPw6iZxV+HTplFGvZrXZT45N39+HW3TujlZv8D6fp8HRq8Dts9XIOR5YtakgBgdrrrt5Qsq8Ssd0BhQ4HMwmVitAWHAY/LbLDQNQDaTVJ8Q6W4qVB51OOqDZDPVB3TLOBepW5jmqaLbec3jGgBGMSxvvemDYkQ9GoKF1ShUCSKCqBeQrvmfVZPC1keBjXcCmw911tTJ8q5XgOLaQgA+x/OdWA2EGZ98gbjleTHdQHQN+2iwls3nK3/Zhj3VeQhovYzdxmArSwQgDRA3QiSCJUrTnjfl4KozRCSCCeYmt90EoJJbVCk/1+FiCwFZxLk4dRfLFia6x8LbYkD9v9cXtLG6+O4AYQRfrgPygVIcqyhTXcWFOJH8fh3rz7EKwnUArq8mcGwK2MCC1i7WY7Zenh56feHT/jE3yliE4TZncd636gPFCKWavGhcRx2J+cvs9MlSw0Ty3cCm+c7n0G0MExdW4BMIbTXE9UCynvyCCX+Ovm4gbByA/xisVgJPpXrzLj4EoRJjJIZrWHArS9iprK+KcefgiyB0XVKGjOmCmW9xhRVMUSyRFnNeFGEdI2q+/HFXclkp9WsAbgTG9wGj08CI64WxRk/OTDcUAvBHXSLQxcVCDMQSWbzv+1e7WVbz+k5w2tJtsbcCYV6WJY7hmAsDA7r1Sz3OgOgoM+KTOJbcjSI5yGIaNE1uuwlAAU/MF+tF5/0sIghVLdVdM2S0bSzHx2Mi+FTxXf8X925NC4BycK8QwfmgVX1LlcFiykEMcL2BndJJ7aQfijKfxLGDwAhByM7aC5U4qwPzNwufNnNuOH4VZaCPlPo2AahqFqoPVFc14ga2m+WEEL0cAz9kdPrOmMu8r1o/rTsXz7f9oswFs+jO6LAqkvC3Ggg5Fg6mwW03CUI6X12h8lyfcz3QHqr3DIl64DbqaQKc9mI87QXACD6vpJqY0EVxz2CEyCI5eMSGX2e7VtI5J4yTRyZhscrvt1nQuivOAaNLlYESwcySgiVbr37Bfd0/u31yEgg2FVaiPCeVOguqAfGov0iR0R9JABJ0bnwk9nMxw+fOh55EbgRhzozrBUA1polN9CLwok5HEEUQBjFMQB7D+j656PW+IrJ8O/bBCo4sGFdGejqiyYCx3mKe9/JtTiBvmI5OFiTisg9LtJFF7gZGDrUbHKs79+hyu5hSaUvh1foFr3r/6vZJCiXgCDwVVFJ7MVmRLsrGltuFCc68yFdACMDAflwR4QM3HPoKgIExt4gz42SuaQb8hBOE2oZmlu+KFlKR3QSssMJxDPWbbjpfLoJrxG8CYT8MKGZSVTCxYFTIb84nkCxCIPLDiby30gXFghaF4c2ReR466Uu2fvoFr3r/fKAEFxvpqMcd9yonIrkuK5LLV7MVCM+/uDJCyIC2J8a0z1iwqyESgMl15Sa33QKgmtPEBnp11mwuXgO70Ud4DHWzfgDYC3zBEOk7HlA6XKyHQzb8HgGoCSQLqsxorIy1Bxie7Wx0rFaf+wr9Xv32C+56/7HbJ5VHtRYT+GJrsehHcya57PyKAQk6+vBkBZPpjPEExlwU59awg3C24W6KBsC6tqHR+MidyVG3i3rdAnAsH2T093XT+zLr197MTA80h3SfsZP2UqpCrPQ46oF317VrpeiKXTJ9MhMLkgGdCacKG/mupV9w1/vnwyGgCDCKWzJe3lqsyzLWZWe6/kc/oKzgKH4jC7oolhdC4jiuzM0WPo+cPQ2AsX1obFCTO5Jzn566PwbReiwnfTWjI4KvDoh1juh+aT+WKSYD3i8Aql2rJk+VsVQly5kkddv2FvHT61icqO7Fr71/IkLNXOi0FQjV0046oBy6wZ922Q95ICqDEaL4XWw3COcf9Mw73DFB9AqE6wZAAS8XuzGQIDKf+oVkqxt00ttAc+YT0PJ9qRFSB8xoye5Xu1ZVeCSgCLbYLVNswoncHxoeLwCzBGjBNki/4BX3z9lXgUCyIIGmhova83cRgO5Te9yLgP3MfmsBS8xs8/U67ePQOqy9umBUruDchqo8sHSd3PMfT5ifo+ack8eFHI6QEcnT5GvdOnVdXof+ptJ+BVPWceiaRHA8Us/nkACo8mzqlqmWrbFDppT5A5UIZm7CPA2Vgm3QfsEd909kKIqB1qJAKCBG8ZstZz3xHOAAiwmpDIdng1maZQAkZzsHZ537YfQrwNyxoQ+HakrnS0h1mUA1C96TdJTmORyhC3oeqdwROi+GDhkFI6bYNrcNDEDeAkXwQizPRpmnIs3OdqZPSaRFUcbchHlgie6agq2kX7Dd/+d8lUJVXuUzk8ERmS+2vfd4uvN2VOV5rSwb0y3JhgIh9wJeN3YMQCIgR78Q+nDEVYBYZUrUpbXFnM7COSdf7N4IPvtDnT2BY/h8Chh10MXQeYGS+7GGjaQiABpuNIFiECnzdWJMIUHcazLptC7YivsF8/7FgLFMqpiQL5TuNbKfA/DC46rqqAbAwIKWK+timRUBEiNGsOQsyQm+Gpjd4n046hbT84KPuYjOmHHyp92gcgDS2OoIuVIeh/xyUkaVwyEWdLrewHE3uBUDcKIwnq40HpDXL+n3CzbaKdguel5VnFJl2awaghLQBTzteZ0cjLq2A2n0M6EPh2pC57Wg41poLzZsAZNso0Hw6eVR/J8bF9YjWGmVCpGKwQLBRCcrbiSxNLgVAxCF8XSl8YDHHFPW7xeFBRwv/rGqOKUBkODzqgdWPYAM53vTASMQu4Bx9J+69OHIF+N71F1O1gUB+AsBfFqKC+4Wi4BWX+CYgOTAU36wdMVNVKka3MoBWBhPxyiuko3xkSX9fvGMkqsDlzzHC1N6SQ4DoINOe7KelWWTheziObeKCdARApD1AdVnRH048gKUAmAEYi6Oh4DJV4VoGDWqjq4XLbO5o1jBoimEPhPJmwu9FvnTLgdgYTwd2wyXbMyRKen3i2eXXB245FlVYUpVxUpGiLtmGBlrTEhVUwV8dEkVKAq3MHJ1uzRbRx+OOgDWFX6MsXJU/36lJoEoA2AKvw8+uwTEDIBbStdOs8ddDsDCeDom7ZdszBIs6fcL9ror2C75US9IxJJsEsHdGFBil4yYuUwknofJgF4XcEUfjrz+X7fKo4EJJ//PkMORO6FrVjQMeL5kJhZMMXzLwNZCt1nzDFgYT8cQwpLt4hDON0i/X7ys5OrAJVe0S/ISgFY7j9ZvnQ7I3+lyqpYaL98CWp/N+nDkZdhi6bW8An1kP3fRTLKVWlwF6RZCH2L4zDDR0k1IqeTNb2OQSYNbOQMWxtMxeqtkY6I+ny9VEz6btfb7xc+XXB249AoXv85+tIBVgJJ6n4lf6oV+mfjdDJNMH0wAVFX90GMk1f5TxlS3Fggh92DyN0IORy5665KIfCktsl+K3VsGtpVOWOMiuDCerlSnjQ2rB+n3C+pIBdulz8wqonrNPLKgwKaC5B3s53qhXVq6oDNg6sOhqvqhEr3V2VNLBjmnSSNdrOLJ1zkAu6VPRjFcFz4fXDJ8i45hG94Gt3IGjOFYA8TTlQZ/qGH1oP1+8ZtlT1MAtHK8mQg25zOZUSCLIliWcbw8wfW5Ln04ssqnHX04euiCk6/3de66MPpuAQVZAEFkw2MKFw6a1wEL4+lSBvmAOMhD8vkOkFX77feLNw14YT/ssmc4A6oOdHBEkwXlgjH2k4Nal6wB4fIuX9LzZjAmorNeHMo5Tc0OewHwDTUh9HXxfGJsYkAbAAAgAElEQVS/uvCpoAcew6zBBrdyBlQwwoDxdLZWXLDFkHyF8xGE/fb7xR8XXByAAVC1oB18HQYIT+8uGfP75SCUs1o64he8v4j6cIQ+IqkPhxrBCHjdjBH6AblQkAeY1ondukSiELmsUPpjbyp7XuvDgAXxdNZVvWCLIfmKg6Bbhrjup98v3lVwcQLw8gqA5v9zC9jErutltg8gMxDWWMBaMVkmANWFyEV6R0uH2I1IzW7ypbkQOTP5f2ch9KsFkwp0kQlDAOmxzHpscGuGAQvi6VD4RgmAg/b7xZVlT5MATNXwqQc6KGwf2U2uGV2uzg3D4ua7fDnPwZcKgIdq9GaIBPZb0YdD7hgyIFWMXiH0eQ5vXS5HcMkc++9lz2t9GLAgns7KxxZsCkgdtN8vWD+vYDMAUpcja7lOR9eLVcIP4tcuob/3AOHCdW02VTX62ApB4Mv1v24gnPy9HiH03fJ366KYHYTHsgBBg1s5AxbG0+HLZaOp65i+ln6/YM5EwdYBwGj1cmUkE7+8THLNdAHhwrUOXtcrO/pwhF4cct2oN68BMDCfmsJM/n6PEPoYPp8bH3kCkbtjji2tJJA962YAWBBPZ0WBCrbYsFoOf9pDAiENk179fkuvf9nTXewKcBSjsn7ldonWbgQpx+26otaLIwAlfi2QQSJY3Yjy5i9dmsFM/oEDMM/Z7Uf0RiYUA7J+ToNbOQC3e0WBBm9qLad6HICG1ZK1XB5PoxnuOOIcxSXe/Of8xHV/P+FpwN47gKUpYHmuSve0pKZgCKSq5wqniWE1WZz/xouBm74KTMwBI17lVBXwtWSs+8/vL45Ff3vhpcAnvwos8d48DZX3M2hx9X
5695IAnu0IIO0chu35AOgLL0yuG/jOmwbg028G/mNz1YWdETbm4I5BrFlov+EtD2wIo7l+Atg8D2xY7iw3V5diEqO54mnj6XdMAYcU+6gon7A3NSO2qFjlyZYDkAX6uD5Iam44YaUfVNDNxaJcLIPXcGGpfi6PnZdVD1wPspQBX/wl4OaNwN6Jqg+xwrxslcVFuYJblehkcYYZGPS3L20BxueBcS8nwg5H5kZkx6TQSbXFZcCQKadx5Cz5mPurAFxrRaa17pAR2PFC+ElSHKQ/0QjQcgCyGyM9v3SnsDBRJgL6msWCf6IfWeUJac8UFlpY8500DcCfvgb43hiwZwyYVhd2D/VSrKGAmIDnBkiafEcN9cprHgKMzgNjS1V7rRjRlceyrqif6KAkMgXIM+6tAnDl+zSL36O9+U8p9jGHQo285/2XA/AnXeNnKAorDXH/AILwbSvLEz6Ql2+cAf/3XcCdw8DkKHBwpOpFbE2wadzIdyh3jjNQirYWEwYq+/zJwMh8pf+xKNSwM6DZMmzNRRbM2K+2Ii6TlFrAWfd5V3i/F7IgT2LBF5LbIdkqxLPWvtzlAGQ3RpU3Y7AiixMxLOUB2t7pKQ8M0qCTnp8HkojJgNqaMEJesQv4AR3Iw8DB4QqAs+6SWRiqgJgY0HVDAdBA4Ba4xN7ndlSFAAjAYX4IPO5dBDMAdS2i+Jx7XTf1eEdTDfgAQnR34p/wQkRmjNAoByDT/ugFphXAmjAEn8qaPQAgZCs0lSckCNmVigEbFMsPBBE3DcBX7gLuawH7hoAD7EM8DMw48AhATrjtQwiXoqkTEwWd7LOneXNCbz6Tiq/TInb2M8ZzIFrTQbGiy92oGz7pXl/7jvdAJnb2470IbB3T77Sai+hyAP5voTqW6sKwFAc/TAdc5+3dvcsTrvPVYSK4SQb8xV3+6IaAqSHg0FDVh3iOIFTIFxtit9orL5Z/LD1Q4s+B8OnHVuXwhhdd5DoLGsgCCJ04q66X/Ju/vSaeAxDPvbdtmdtKDV90gVEPIl/xySkviOhmAEjrlzSkwj40SlQZYZ39I+8JBMx8mZryhOsKwqYB+KpdVSDFvhYwPVR9BD7uyX4SwRS59nNI+bRck/DzJ05v12M0nY8fAk8iWL5BB5qASPGRCi8EVjzv3mqpkC9ACrrwhKukB67GhpqRRowQMqCiYbj8oOoHeUWpdYIBAUj8c8WjrjyhNIJ1unzjDPjqXdUjJAAP8TMEzLYq9uOHICQALe/EwWe+QgddAqCzzD8+vgIgg0qp+5nYjaDzCgjmnCYone0klqP4JSgvvK+6LoFPoFMlkPGh+0rPWta4RHTNJJQz4M8EAGoNTPVU8opS64CC9zoAWTFChcq7lCdch6s3L4J/2QFIEBKA1P9mHIBmhPh3Ai354RyAAmWsR/PRs6vOR8Z8FMPS97yxtIlYgVB/I7jC0rIKSfLXF1EEB+BFFjQ3jCLA49OWsRTTEPzvzQEwry7VrZ5KwzAQAPssT9jw1dcHgCrORQCS/bgn+1HsCYQSveaHkzvGv1scgU/6R55Y1YIxhvOm1EZekQWl8wVDxJgwc88QiJc6AKX/meHDawX9z16M/Em7bO8Q08GBP/jEkAEVjMBoAFWXUjRA3KtNwOBXW3EkAZhrALktpC6lKtTV4OU7RHB+3kHWgv/zrnYZl2kCkF4uF8MGQGc+MqEYUCA0n1tkwxbw4ScHAHr71Q7W4++c8czwcBAmHVB/c7Bcek9b3FuwbdD/kjGWgzJjQ3thGmVA3jhfOyU+RxB6FamOFp8NrhsTgLy8Cpzm5QlVptAU+6CiNgXCaIQ0BcDYV8b0P4pi30vfIxD5+w72C9aliegW8MHzqrmh/meuFhYi0pKbs6D9fsh/n1XFMrYMbPgUByCZz6J+uEknDA9AornWFRb01WZEsACoHhOqyC7wdetT0QAK2KqOb5MCUvPyhLE0oQxzqaYNXL5xBvyVXe12vByLADjXAvgxBvSPGFGMIjCmJbEW8HfntxtQmxT0cmxp9UPAdKAZ1upA6EB7qgDo6oCUxXRtPVSpAwJpnUhuxAqWCCYK1MBExZljY5S8SYr+pxAFAuBayhNG26jw8usCQLX0SAAkwwcAEngyQizaXoziIli+Oe7/9kJvNk1LmBMe9ECO3XRB7aPeF0EYHNVPdT8gj016YBcWtBfBVYJuz7mF7VgGY/pO8f5WdQ1/7U67nIKNS7j0wIbDPFZsyNHHY7od/xdlEHj8CcC3TgCWHgGAPSxiSdt4312u/8SPAl8/Dlh4pDeZW2PD4J1c9+uyDaIDkgEJQKnTfG/N8nUAmu5HUnMW5ARbPfEuIHy/ACjRK7FL5pOR4RaxgTHofKl8r/S1ZWBnAGDKefbn3AFIPRPXB7sFiVQimKVgGdl5ooNwLQ1/1U+DQGSXQ9r5Evy1q9rZbP1lGQDZsPpzI8APHgXgod7qUx11YtBbFzC+/C+BL7SAWwhgdoLkONSLqy5oLogYft3ZI1F7EAC+phsAnekokhP4HIzml/PvthQWmPB9LJ7jxkcSr14jWj4/0wFlgJD5eoDw6fe4DzAYPHokWhHJZ3TFSkn4h7YOSOBwEtiMTv1aY0uktFYTmI2/43EMQmCuAJmUE0gmVD8EFdPpdnxhVhqzDr8F4NMtYM9Jfg98EVTeNu9Q2OFZBX7vr9vtgm/lcezczZ61ZNN8DCvilYCdPXqNDQpAlfGTKm0M6AA0PTAyoMSx64cRfPQHXsniOTI+fEWDFGp+Qb9BeySRBV2kpl0QxxGAlHDmkI56X6z+EP7UDYSdRgh/IouwIZ36lHabBE0GJ0r10Rgb/xA/tt/j/6aMAf+7R4CxzuBXWRGULwBfIrY6UNfpvLae7n0I+LO/reoLMqiVMbW38oUhkNkQIzZO7tIweGePcmWlAFTjAYHPVGwXxWoLYblEDkLuTT8MDPhXLJ4jALpaJB+ggU6xfgJknT7IKXIQXh4Y0FZCog+wxiUTwSkXUbSMV1rB/A31OXWuFpPUda/mRHKi1e6U+hA7Zq7l+A+UAfDtHg/LrptkQpZ727cRWOL9542Pa3rOvuOqagUltgtmJM08j4/PILbIDKz6w5PAHsbraTnMGdZWIwIzxIfeK0rn578J3LAVuH8CODRahV/FFQ/1IumIvXP1QudNfyNT8oVqcHviPcBd48A0g2RDuoDqHdb2SalZAdG9dnfDkAE0gXnH5ijWCDbKCq5/MRiV0QD8HgHQ63jG0hdsLGxA3x9Bw1Asli7hO3BwApgng/Gjvq01IHrXJ7q3Cz7E++YziF2rs1ZLZ+8H9jJsSoECWXj6igmR87aLgfbGq4GvbgLu2gjsHwdmCEIPSI1h+SkCRjpfUC3iNWcpoRrcnrYbuGsUOMBo7QBCxSTG/igxVcBIVGPWM1h1JYQPnyKNExGZMDIJ9b66eEBGxPDY1Y5nv+GCjfGAxD+DDpiawphABWZPjwNzNLAEIH4XCH0M7/5c93bBfI8Yk2cgVAdvdT10ifDkBWC/r9lGH51NhIsnsWHOfPmEUKT94WeAG8eAO8aAfWPAwVEHISNQlKQUglJjJExqC+H6Nq93kOpUg9szbwLuHa66QzFWkaFieXxi6hgVHOMCYGRuJ+5V4jYJIDKI9KlsAvFDq8QDrnb8NWVPh9EwdFkQ79TlSMIsN0Mi5s9MoOGno4U6f3YAvefL7Y7rvdoFLxOANSA8f7xSgWmd0kCQbmZ6mTLEnJ0UqWLhUkxlrBn6n3wWuGkYuGukCsufGq2iojnRFpafsU7MDxErJuZhYCsJosHtWTcBe1oeq+hxigJgXBrMmTBPnJKLrr+VED54ibHYvZos8sO+DNcrHrDX8YVVyglAKud0LtMjFPtNMz6QLDY7VomLJd671AEH4Xu+3g7nWq28ISvX58/hguOBg8vtFQvV/hEzxfqOevuTfpjri8vAWz8L3NYCfjBc6ZYHmBcitnFd06pxyb8W4gPlgonBqffTtdTg9pybqiVNBssyUsdUD7eGO9amnf3sXtxQipl7Wg/sD4A8AwHIyZMYky50Tp/xgN2OL8y051qw2hXzwRCEdT2nmck1RxHG+w5jeO9NFQBpR6ldMIMXlFWgVndqF2dVFsJzuOgRwMElB6DcI6rznemD0RnbwQiSRS3g7Z+tVIl7PC9kahiYZm6IizuLigliT/VoUog+p8P9l3wJ7qGEanB77k3VczroUToWLCsABud4ypaLCUoxf9i/9w9ADiICULrQRWuIB6w7nuZrwaZwLBGwClSqSyz3AhHbaRGEFGOmC44D72UVgjW2C2Z4lIF4ArjodODQcqUGqAxfcpG4mJVuVqcL
56955tbs2z/veV0tYK/nhTAqesYNHdO5PCJZos+WuzxHJIViuXFyJxupNLg976ZK2lizUKodilGUgzyGhokF8yw5Mf+qRkjdjfuDtwkkm7DTkNaBaQ2ox1q3eMD8+B6O3H6em8Kx1Ccx9ptWl9iYIUAAWrI3I3nHgPdOtsO5eOuxXXBdj0V1vOL/so3Cxef60tlSpYwveKf0pAu6ohfdJ8k4CUqgvr5jV6VGTBKALeCAh+VbZLTnh5gu6D44A6H8cVlkNK95O1WkBrfn31R5HSy+JCwPplAxRegE/2T+AloGncNmbQyogUQx/KwB4gHj8YWNTwRAOW0FIIIndoqNkTAxz/bd09XDGLBdMM6/pLKi5whAX60gCK2ujxzEAqGL2pQ1Jis5AJEAFHvTujYAKjRf+SEugm1d2COQLU/DAwQ44caEw8AtZzSIPgAvuKkdrWMM6M7xCMBoiBn4YpCE2NCfxWAA5MEuwvCCEICwlnhAHV+YORfDsWJGgPpMKwg1b9QpFnzHbD2BK2JGul9s8KkYW17vLALQRTCBpzXZpS4gtCXXMAkduuAy8E7PijPWprXJ5CR38ygw1fJDohh2BlRAgq2OeN7uTWc1D0AFNtmL54ESBsCaJcLkDajxj5ZXRiCIGA0waDwgjy8sk5+HY+X9ppUbJSCp6TnFCMXwny1WAFQ8rUAc2wUrRL6mXTAefWnFfnz3FpbagQKLAqAzoZjAKkkpXkNO5GCEvOMLFXOnnC4xIKOjnQGNdWSM+GqHQGd7JSsxUf+JzQLwhTdV4je1nQvr1MkPGtlf9yP2Dy+gAqZ6rQytfvdHSDxgLwBF8AmAYjHWluEDiKGMiqOVvtejXTBOuRSYJwDJAARgZAGWL9Nk+IM3SzgTydE4eec1nZHbtDaNAf1Dpd/SMx2END6kD0oXtFhBXmcY+OY6AFChnKnzl7NfdMR3qCAae2B+VVMYXASvDs3/X/zHJZcB84vuiqABEo0QPnhnwqQLyRURmZBPytnwHde0M1vN2lR6picoKULaxHDIEdHkW2iWg4/7b5zb7DSQAVd0/griV2JYojfpwRGEYsGBrOBmx/OgP5sAKANkcbFzNWTRnX/GSGImMYH/LYlk+gGvdT+bW+SWH+Ig1GqL5QeTtR2EYj5LVHfjw/ZDwL8yJ6TB7UU3VVoTjTYxYDK+Ivv7dzNAZIxpZSiU8jjKgIWTcykZkBawDBBnQdMr5QeTKI5iWCB09AmEb7+ucnOQ/aTPWn6wuzyS4u+R0Ob6CUGqJpIDA97AdqINbgRgBJ69CG4Jp6q/ckjXqB/RKla4WpkO2ODgHoynigA0JiLwaNiEt95YQKJ4FRC+7brKzRH9jZbN6iJYuSHm9I5iOAOhHNJfZkh+gxsBKPbLu3+JgaWDdojhMO5kkDWSlNTg4B6MpyIAjf3IggJgMD4MCARjFMU9QCgAykhSKnUCYHB9JB0wy5aTRUxmup4h+Q1uAmDs+hpXgFLnB6ULONOn5xACNJqxghsc3IPxVBGAiQG9aLeilWUJW1FvVXEN0TKp1C6At19TMSCBpz1dHtT/JH7N9yaxp6QkF73KBxYIr10nAMproB44qQGTj6sjUrtOFPtLeFQHLES9AdDFrq1E6M13MaxVCTNAXNFThIylLcor40zxtgDAPKuVwDMrOKw+SBTbtR2MND7sZwC7Qvm4wqHa4T/uIrhb+7n0EgbQdTijoyg+agWXT8llDsAFWr/B8qP1K7bT0pvtVwHhW6+t2C/m8svvZlawi2CKe37nhFtapkDnILRqBQA+v04AjMyn79EIkXO/DnzyCBwVweX4wxs9B4rRZgyPVFqykgDd+5JSpBU5r0vHyHz+jsc3ub0KABsZMCyQgeExKyFPVIz3lmcM6OfPAGCADYPE67Jfs6h7G0o+xvi7oyK4cLZfOgpsXwC2Lq9MwuuVERonKn4nSJrcXnQKcM7dwMMXgYcsVxkSebJgzOWPqdB1ad2f3gpsnwK2LXWeR9m3danUIV1lBSCPArBwtp+7DThuBti6UDWDmWA/DvXk8LRptfPtNUlihYZTOPCi04GH3wFsnwGOW6iAs5n3GeJJ+KLoE+9VDClQ8R6vOQHYegDYwuY3S6H/iJ8jb11ck0q9Qhoc9QMWgPBZJwFbpoFN88DGRWBiqQIgWyJY3lPozaGJ1KTEPh36zpTkJrcXPRE44S7g+Cng2DlgyyKwaclfFoIwvCwx9Zn3Q1DmIPx/2/sSaMuusszvjfXq1ZRUElJkKsBEGQyYhJCBSkUqAW1tsBdpuxEVaBzowXZqe1g90G2LotjQdmMjKqtBxQERdAWUAkUlZNBGkQRNyIAEMAkxpFKpqjfUG3t9//m/c/+737njPq9uVeqcte66b7jnnn32/s6///3v//++Tz0dmD0KzC4DM6vAFpd/0L3Gh6yTDgnvLwKzAWDGiH/ThcC2OWDrErB1pRgQisIQhAa+AED+HEEY6uNLyrRnZLSl6tSbrgLOeBQ44yiw8ziwfaV4UGbdegmA5QMTLFlqsfn7XecDW+eAmePAltXiXnkuZSBkRcm4UGXtU2uo3xsAZgz6y54JzMwDWzkgBOAqMMVBCSAUObh8QuN/CiTgcWAuyWhL1amvvBbY+VgxbW477paa7gIBqCnUrbUBiQuhAKDUot13IbBlDtiyBEyvtO5VDxvvVfxW/JkWNFrCeK8NAGsY7BsvKQC4hQCkJNaKy2LRIsg6SJ3IQSe1onKKC2CsOYMeN+0Dtj0ObDsGbFsEZmWp5S74g2Ir2uA22BScAJGA+dJFwPQ8ML0ETAUAkgDTPq9zdK/+sMWpPF19NxYwA4g3PtsHxAE4SQC6FdSgmGWRRIJLZJll8EGKjHiX1jwaN10HzD4BbD0GzC4WrsKMW2pNobZoCu6CLCDfCTqzgg6sr+wFphaAKQfgZHKvpRSYg7HN5XCL2AbAZwPrZGaj6ippXhgn0kqmU1woxnHedg5AATuWHig2FE1uVRwoxoX+Wcbg89S3AqCKPONcCi8oPtVP+9++G3j+oSK2xRBFDElUxbTS+3nvc4FpDsjxllXQoJg8FgdCQoGJJTTicLcQ6vPL6wbg9cDM4cJv27oAzFA5ky9/UOSvmg8oP86n0dICBn25JwjARWDSAUgBHN6vfdbv10AbARh8X91vDM2ss+NvAECKPVLCsHoyUgRqrlbnRwB933OBc+4DXrIC0IEmiLnE75di8HsyAcjzWUVGUi6uICMpVwwJVMXdeOk3XAxc+Hng+vV2esAYw+sWoP31r3eLcLwQBeQUrEHh4Jo2h4vDmJPuAyMLGAeEn7uqbgB+I7DlSWBGCwe31Gb9aL20kGDb/EGRxY6WTz8f2wtM8l4pgL1SgM8esHCvsuylME4nn9cfQLtldg6TZ0kUKorAfij23vAPCmqp3fcCl60XFINid1PlZrf41/dnApB6wSQjutUfIDJR8CGIQOwWEH7DywpKrWc8CFzqRLHkVYrB2jS2FQH5vkuBycXCAlIUUAAkCM2iRBA6+ARCe7DjYmQduLYTleiQ/XTTS4DpI+6nLhZW2nzVCEBaMLd+soIGqjD1ampdugiYWCpeBKA9bBJC9ActAk8LES26SqsftInLZ44dQif4Igdhym5WLrPDyuYH/7HTCNwDnPko8LXrBccjQaioe6BiKad3+QY/MGTH6rS3OBvCnQDuAIyqhiDkQ9RX+29yE3on8IwjxQPI8zkTiApGU3oVkD/4fGDieAuAdMw5MFQjEgg1DYsUku+a3uI0TGBfV7PotwHwaOEmbHEATvuDIutni6UAQoFRIFRYhfe/dhEw7tbe9Of0Si1g8HkrwRcevDajz07gIJ7n05rYyWIpb4ya/7vv8PRdFpj/LXDmkQLAnA4jCCOlTBRN/rFMAJKgkkVHpGUjySSBSFeg7/azqk8EgbSEq8UDRACLKDXSyaQ7Br//DcA4LSCtwnKhTEkQcmAIQhtM+Uaajl0uS9NatITXWzpzfcdNB4DpY+6nBgDaCtanYLN6fCj4u1ay0QIqtML/EYC61wSA9tAJeP6eWsAoDysFpg1eB0HIQRCIIkVeCqQf/05P3WCB+UPA+CPAzvmCaFWDKEuYcl1yMN+Y2dckqGTeHPEvvWDSNhOAfbefX0A6rS8CUw8X9066bFIfdqMHJID++DJgLACQumyc3gyAEYRRKFCLD1eu5ODLF6QvXedx0w3A1BwwxdAJLTXjd8seQnGrZ9bPFxLyA7WIKON63tYtCQBN/sv9QPm6BkLp0vl9t/m6ietR6fbyBA4gnXtORwRRpNnTtPpW6gWLH83lKqcOFTEnDiKtoHwy8RNFhrefyeztbnrBfbWfgttsP+kIyO32ELD1cHHvInrlvWs6TsnB7qAUlg/suFtAWkE55zYQ0QpqcALoNCXTEt7A3KoaDwGQfqoAOEUBa7fUbKctltwCajVbxvSiyvoasM0BaBKwwdKb9fN7NfcqBWGiSWykWXER0umeacUEonQgCKRfIgDFjya5yq8Wfsfs8dYgiuMxgpAg/vnMzu6mF0z6Zj5APdvPQec0TEosnvQosGOhaLuIYvnwEYSithE52F1XFAA0p5yigD4otCqygFKnpHUpLYP0OcKURYv6Mj4MNR433QhM0gL6QongawOg+6rl9CswKoSkEIxPyTsuAPigCYBmAXVfYcVf+n0SRYw6dP1YwNgHsgSajiJP429RrpWOM6cxDiJB6NINM4w7LbUGMQUwB/M9mZ3dSy+YVG0EoBiDBST5ddZ+PkCsAiIlQZDa3LVatJ0WXG2PbL98AB+4omB3oP/HgTUhmGgBfRqWf2TTrUSjExDSP/qWzQDgfAFAWyzR8rkFtDAKX75jo6nUguZxZ8
5695NByHbvvqBQ36T1swcsBaBAGGRg40Ir+rt9WUDhQ5ZAU7Es2e9LLzglqHRxNkbeuW+oQRRls5jaMjnK0a9ecNf2R4LAwO829kQB3LTtEYQPUwzQAWgW0AGo8AQH0ljp/V17pm0KRcEifGuNOnocO1rACQbKPXhs8TtNwVr5uh+n6Zf3wDgu29g2FdMtOc8B6PdpFj08ZFrplw+ZA5FTvAQQ0/BT36FPDkRqBT9Jag7xYlQItY0f88j78sZzCcKPZlrAQfSCK9uvB4h577SCotUiEJ8opq8IQFl/PUBPEoBLxbRE62LSqG4dFB8r5bHcOtiOQSqT5T7RKzYDgJx+BUCCTxZQCwhaQc9oKcEnEBKknj5FsJ1LAPo9xoWWPWDy+6IIoqbeaO0VA+zHB0zxIQDKkn1GgtXiRxMIAx0Vn0Db+lkuFjLRCt5WEwD71Qvu2H5OfekD5FaciQay/GIbFgBXriwAyGmJADR1ck3DwTE3TQ4B0LetzBJErTYAr2BBSI3HTS8tLKBZPo/fWQDZp197Z3scjGb5BDp/L3+njMweB6B83Gj9wj3atOsPWin9WgXCFlVO/3ctf4iD8XkBkH5USlAZlNPZAQqARr5vxu1yjmH0givbX0UQKI63o0Wun/xHuR8E4VnPK5JQLd4VNttTBvK2uoiKOUf/f+GjwMNBh0NMV6J0c0NpcRv7mrYv3kh8/uHxYp+bVpwLp3R7sts2YzouSq3KGa+q7+x7Co4nazAerRKsVlV1QitF59dyyFZaYY0HMu9mWL3gtvZXMbymBIFMZ1ov2h0B+LTLisxgW+Eq5uU92iZ72ud9vvR+4JFp4NjkRh2ONi0OB1/UBCkvEYRhfuNs4OmhhiPKnFQlx6aAjMnSXJUAACAASURBVPjmz1w41nnwO4cCIBvBwZgTAOUHRq3gyDExD4zRGVYEnpm5LqmQc0M5esFt7acFl0SlHiBxuTkYxxdaihUC4QVXFu5FCUD5QtJl85sjGA0ziQxqeu/fem+hw0F2fLLQGxFlYMRvo7v1WmIVtpt1DFkXvOR7LwJ2HSkyoZmEypoVVe8p7b6qEMnidGG/Vl/L2aPOIwuA1pAIQE3DAmFa4j9f7CPaFpCHKujr5xzZesGdHqAqKz5X+FLRAl58le+jui+kTBALMcgZ73CDBkpN2/7+bfcWOhwUyCEAjQTcAVhKdjkPc2RajewKyu/n1//qJcA2uhBMRGXQOcn9U6JIOjXHQqSYOsVoQp1HNgAvz8yny80H5PVz9H6RqVd849WtXQ/zA0Ow2ayGLJ474L0G79vvbulwkJi8BGCg4S01SKqofoNvSIC+5zkhFUupV8rUTpJN06KpaBkFQm5M1HlkA3AyM5/u9Zl38zrk6f0iU6/4hmscgK5ISUtCTowyDqb7UxwsqFJW3fo/vbuIBJEZ1YRgyHwQKNi0KEl1OKTCZJdxtPDn//v8ooaDaVgqFyiTD2IKfcjZS4Fo+7g+HXOPv84jG4DIzKfLzQf8KVfI/FNKrQ6h94tfz+vOA9cGAAbrpylY2SDlVTTt+uCnV3/V3a7DQQAysJAwobZJgUXi78Qayhd812WeiOAZzEyUiAkHMeu5BF5FwZQAWLPwknkLQy9CrPMy8+lIHZFzvN3T+YbV+8X7c64OHHix74V6zIxB+RJ0wQ+UU992tYoFy3fcXcTDxQkoPsCUhFIczKVCegSg5B8A/PILN9ZwxBSxtiKiUAOi7JW0dLTustF8AGbm0/1o3vjjnSGdj+lYlGwdRO8XN+c1wABIoHk6k61yuSCJITq3jDY9Vx0BqK++uwAfX6JkI/hME0SC1EGguiQ+isqcQRLrF6/0jO2w+6FMnZhyZYsQ1W50qOHgPX1NXndtODsfgMwHzMin+0+ZN0S9YOllMzWfLwKQSS396P3iY3kNOLDPM1y065H4gOW3p4uTDkB8zWdb7FgbdDhEgJkCUDRvogTmd/vPv3BVAUBuvylNzAAYi4hisVQnEHoIqWblrxqm4Mx8ujfljT+YjsWBYgIOc0oJPsq1slCpH71fKybJOEoAuuVTRSCnYlmU6P/Z4iSJEcbLv+Yu9/1EAh7JKEXDKxq4ChUiKymRbwjgHdcUWTARgLYXHSr2LOU+BV7MVwzxwOfkOWybYAGZD5iRT0edjpxD6VhcOQ6j94tP51wdOHBdMeXa9OqWRcmWXA1XLUIUH6zyCwlAs3z+YBkfs1u+VIejJEF3ckrjI9T0y/aMA2+/tgAg08VURKT8vbKMUgAMIGzzAcOi5HknHQAz8+l+MW/829KxhtH7tTz+jIMAJPCYMULAWd6fvi+EY9ouoZBM/Kx/4LUBgFLgNC5o16FrE8JJVJgkiFhaQQBv3+dVbMrWVsC8UxFRkjjaVsW2DtRdOJ/vAyohVYK7A+bTvTdj8HlqTMcaRu/XxHkzjgNkIOWuDr8jnYYDKDutgpUhra0uAlAyCCUAK8BXcjBXgLCk/h0D/hcByDxFAdAzoFUqUBYRJTUcMWdPP7ONL6i5bLQeALJRQ+bT/W7G4AuAOXq/lsGdcRgAY+glLkYclJVTsa6ptCX3uQjAKINQstFrAZKIwWxQIhIJuovB/Nx+r2LzFCwlj8Y0evl/MYk0kieVtcvrwGUnHQCVjjVkPl3mItQsIPuElx9G79dOzDgMgGkAWlNyBJn8xKprBRC+zgEo4LWRgcdVcOCjjlNvmx84DrzNAahaFZWLygKWxUNibIhTcPD9BMLLa65bzreAMSGVoXvJ/Cgh1WUfO+XTZS5CDYDs9GH1fnOrIDcAkABTTDCCLYK0Cwi/586WcKJUiEpC8CCBYDsiiSplqUIUmOjf+o2tIiKVUJbgU5uSWl4DWwX4+PcXnrQATBNS+8yny1yEopdcay+930y5YhgAg+9n2OoUeI5TdQer+32fdhmGoOBZanBo+g1yEKU4dYgFSvqB//vZBIBt9RshkTbW8ZZZ2hUgvDL3iU3uux4LSBM0ZD7dPRnTH08VAIfV+2XAOucQAMuVcKfFSD/+IAABsEoGwYAoHZIKEEYxRIHwLS8pUuhjFVs6/ZZhIVWyxVKBBIRXnbQATBNS+8ynI4tBzkEACv+chlUVIKE/5cRGsWmlKfIzudc3APLQSlg3E2OCyVRc1kpU3DgBmKoQsWtlBcswjPu+nfTYtBL+GQdgOf16GCZW6pXlBCqWSgqJypoOAFfXXDifbwFJLvi5HAjlnUsiIe6AjOp4iQNQHRlT2PlgJCUbbc2s+v/hFwFb/q7gm6HlYpBbmTV2sscQyy/qFBj2v0/cAdz/HGD7NDA1AUyOOU+1CwWOewNjKj6/O03F1/WuugW4/XJgfBoYmwDGdH7IxB5kLPIB+I8AfNwZgga5ck2fJbEm8V9zNWPfrasbgMuPAcuseJ8Exsb9FdBhA+7gaQNKB6TfcgCYug+YJT+g89aoBDMmIMScP12uTKj13uDv8zsKig/uJ1uQOsnojm3qB5P5ACRBH3OhPuzzRN9DV88HqQLEWPJnvTy5nm/t/1s4BcuSpRZtGAu4fi+wtBVYEyccrYwn6hF8/FkJp9bKxAKVFsn/d8urgbHPA9NPOEOWl4+2cfoFHhfVrJTZPKHSj5daOtup6JyCpPx8rHWRVQ7WOlrYCMx8AHIzlxkALPD9c0VB+x/A3E/+E2fUYHXdF7KTGwdvTd0AHP9r4PgWYG0KWBdfsBdsMPfPrKKsoL9XAVLAvO2fFylCE4cKliyrDVZNcGS1CqEYhWFiAZV+XntaURdTLmpCEbpchTYLqi6NrkMCzLzt5Xc4HwyJmmkJ+Z73jQOh4NWeDUZiK1K08f0EXt7CMHVawIk7gaVpYJUA9LI1Ao8bzKX1cytoFtFfpdCIWz7rgzHgth8u0oPGDwETc8CEMySUzFaikgtlpW1Ta8JqNba7lVljSRgW+Q6ZP/57WQvj6fydBjXfAjKbgEvMLwWCvhNoipgNpnQshlS4IGFWzIk6ylWwAz93ETLxGWB5ClidLABoIOS7pmGfG+33YAG5mND0G8F4678vkiPJczNOAC4UyQm2N8w94kirFlfIAl7i402d6dbPWWAtrsjOFiuCvAJZOQE0pHTFsckHYDeCvhNgipQNxoAz8/8IPr5nbvH2jd+6AThJAE4AqwTdZKEBLDoDgU4+YVkPHIBoPwareOt/BkDexsMFAFnbzNJYm0IDnVwbt4uyur1kwL7Tp+iZM/08WT9Rc7DHUmuYTr/x+6o4ovvu9fjBbgR9JyA+omwwxvZI5ULg6ZW7y9FPf9QNwKm/CgCcKABovh8ByVy/UCtJq2f+X1yYJPGU27lIZLbuEWDsWBHesZeDz4iURLUWa1TE47LqK12fZmd3OXidFctqm92KatVs1jAEsNv6sdymaa2g8+xUL4I+Pn2beCgbLGWHI/h8G3oTr45iK86POlbBU9yKI/AcfLR+ouQwH9BfmmbLlTHboOnZ/T9+5vaf8FUaAThXsFOQ45mUcgZCWTAxe0UQ+urYMO1/37GtxQmoLCBtRSp30LrDp2SFdzYMgk/R+VNwvwR9mwQDsaspGSfJgYDYNTbp8psCQFJxEIBkQjDrxt8dXCUIY+COH5MVFPi8SOn2n/QYLZ9Gp0cxANIP5IvAkzVzxivRydnKNzBa8fddM84b6AFyAriMF2pajk9kYIeoClXmA3AQgr5NQEHMBqMVFMNaIOayNRL/vhlH3RZwmhbQQUcAasrVVGz4EtjCu/3dfb/ID3PbT7uKAZ/MhcIC0vqRTo4W0IBIEAmEtFwCYqjW03bcmdwBYeoWgetUbrR8snrloiR2drpACf+rD4D9EvTVjIJu7HBV+781X752Czj9lwUZkTEgcPoNPp5Nv4oBRhCG6dd+1DkMz1JIhR1BAHJ7zwqO3fIRRM5tmDK5CoQKsSgOeBYBKFZULTqcB9r6Ni5KYmd3WKDUA0BlhNLM8EbT1Q
5695BXBU72aI5ZjUcVOxz7WLkQ8d37vsart/uA6RcPsxNSAtAXHDYNC1AEpf9s01kKwuBwGU7HgVt/1jtD1e60fgQigSe/j5bQp+KYpGB+H62jT7P8/ZypBIC8Dhcx8eY9wF015abhmnoAyJ5WSrKeNgKO9SHxnT/LSasJBim5lRjWBEIVeROInKL1qunybRawLgASdEy74qjaNNzJCgqEEYzBGvK0297mAFSHEIB6ebKDgc8J1ksmV8t29f1en6L5v6cxIK5iK6Xne/5jCTiFcTqVn/r/tWDPWwXnEPTVgIKUHU7ljASawKefIwDpMdRxRB+wFgD+RREDJABpwSzz2c0LfxczVjkVKwaYgtBBezu3SvX08d39P5uO3QKahXMQciourZRAGKZWar/YZ1xXRPe8wQr2AUK7TvbOVTZBXx4MBECRnConUBSFEXT6mf/TK+/qmzAF/0UBOPqBZYF52HrTFCw2LH5G8UCzJEko5nZqmRnPh/uCXmpnVpDTsIPPwKApOaSA2QLDLSHf97iPx0tpISLfz7bl4iFfsUsnj+HZWEeOYDCDnDmCvZkEgedcCjxGseIhBYt3vx049HwMLRh8gA9gh2MoH9ABqKJzxf0McO7XlSAU4HzhYYFq+5D7hwBu/98OQLlIBCKnW39SlXNY+nqeiq2dkQg+gnGPb9/ZpT0lq6MV5D96gLCwgDmCwbdnCvZmCgY/dxy47xxg5SWuUjigYPHFbwA+fyGwfr2rXrMvPB+vp3L3GHCgi9JOHQCkRVPppeUBigXLFymyejYTB4YsgfA20ofRAlYB0FfAlvQqP0/TsX5PLOB5DNu471cmIwiBaRww/F01J+mz2pqChxUMZvpJlmBv3iTocsW4dzewfhkGFix+2febXDAeJO/YEILBB7pU1g8LQFo98QASVGYNQ6DZfEG3fnEqrgLhbf/HV15anbkFNCvohWSl9XPQ2XTM/2s3I4DwPIZwBEDfgitH0Ek6N6x+u/iD7T4g/YdBBYPpWHEaHlqwNw+AQa4Yj54JrJO+aQDB4pt+oCAyYvOPEIQDCgYfeF/9U3AbAMX7ItAlVtAspKZdz5SOlvA2pstxjES3wJ+92NgAGK2gwi78QoVfEhBeQACqNNP1RdoA18kKdgDhxkUI/zKIYDCnqyzB3jwAJnLFOEIW7QEEi1/1Y21ywVglCAcQDD5/Efj7M4CVrZ5AKlkhxeQUaxBI4nvFzxf8IfCVC4HV7cC6ZEX5nen3VX1vAGLZq8ysrvHY+QBwbGfI2E6JpLvdX+ksthpUvQrmX/sVDGZVUJZgb17vJHLFeGQcmCdVb5+Cxd/5xjZ6QzzMLOQBBIOfTV2Ps4HFHQ7CLQUQmUrV0rgKJMsCjsxGAqTn/hzw0EXA4tnAyg5gbTYBorKkUyLnkB9YVhTxu+kT13iccwtwdBewPAus+b2ar9xJAafqfgMQO4dh+J9+BHe5gqZZZzYok1JJUcpaR6bp93P+W/N6p0KuGIemgEWKgPQhWPxdP7NBLhiHKYHUp2DwpZ8rLOD8tmJQVplOLxAqmbRKC6EDYC7/CeCRPcCx3cDSrsISrs04CPm9ArZk55UvKAspYLqPaPdR4/H0g8DRHcDyVr/X6VabLHk2PhjpPVZY7d5xwF6CwS9y/4LbbVyQsEKIufGiKe0p2JvXOx3kinF0GjhOQY+oNRtljji9TQPf/fOV9IZY4Gq4D8Hgy/4W+Oo2YG5bUUy04vUcLCqSJVRWszJbNgxSmMau+q/Ao2cBR88EjtOqbgNWWaTkIFz3YiWrF4nAjtN0nBZrJnU+/8PA3CxwfMYB6LUra3oglL0tps6wlVha5rLiqd9AdDfB4Je6U0s/0BXTDYh80Sr2FOzNA2AXuWIszABL1JaKWq1R+nwGeM17OsoFY5XTVw/B4Cv+Djg0C8xvLYqJCECzgsxmZlq9T8e0XGUyaUizavPtxoFr/zvw2BnA0Z3A8e2FVV3x6c4sqwObckeyhiXAowUSADhD1XhceDMwx37lvU4XxVN2n3rJIocygkr/Vbs7fe+EdBLcfaXXQ3IPWIrpBB6XlnwpR76jYG9e7/SQKzarxM7qJFj8mg8UarMV9IZ4gvNDD8HgKx8HDs8A8zMFAFnPYQPDl0Co2g4fpDZLqKCxT0/7fhJ4fCdwbFvhRiwRgJruCOwUgCpeCvUjZmEFxhfk9W969kW/B8xvKQqnVgg+B6CB0MsI7P70AHgmd2n1NQ0rv7FvALIlVYK73MnQCDLThSGZoDpuP7uCeuX5n8zroB5yxThGnQ0CgyBMxY63Aq/5aBHG6EBviDlOLV0Eg1+0AByZLgbl+HRxnZXJoqqttA4ODovlJZVuSjTQFtq+NwNPbHMAzramdVpVs6wEoPtdNg37wJfvsYiJP9NFqvHY+7vAwjSwxAeNxVO8T6aNVRRRlT6hHrJ0Ovaw0WDJCKng7g86APvNB9wg2JvXO33IFWOBgn8EIf2nRLD4tbe1+AU7yAWbZeskGHwVdd2mgAUCcNKnJgLQrZ/V9/Jnn5JUYmnAE3hCmv3+t8AWQfSzyPK/POOgJgDdsgqA5nfJAvLdLV+bz0kK4RqPZ3wQWJxyAPqDVhZQyQr7gyaXI9axWCFVAGLvRUhV46PgLnUWBs0HbBPszeudPuWKsTRZAJDTo8l8ui/42juL5veQC7ZpsEow+OrZQlqVVuH4FLA8WVyDAOTAmHUQCAWQkOlsQAwDt/9/AE8SgPQpNa07+AhAA6HLXbb5Xr4IaAMfv/eGvP5NzyYA7UGjBWTWjh40v9fSyscHLtaxhJWxFVsNNAXH1khw983+DYPmA5aCvXkdNIBccemfceooAfhAAcA+6A2xLuAGucxrzgKOMexDfV9OwbS2BB/BEoqLSrBoYGgJ3E8qLcIEsP/ngCPuUy7S13L3wb6PU56/m/Xj4Ps0TKCXQA6AXuNeZY3HMz5QANAeND1kwcKXlj6wOZQ+b7R+Pi0PD0DeFAfk590CKg8qncfoFzIRVWVqfFfBhgn25vXOAHLFWCDbvPstBsJZ4LUPt+jdesgFg+qVptWq11bg2gtgfuLiRAAgQeg+oEmsOujsXb5SsAoCIN/3vx04OlNM6Yv0tdx1MKvK7/TFjVmeCD4HQQQhf159eV7/pmc/kwCcKABoeYvR0oept7SEoZQ0Tr1lPuPQFlAtO0nyAcWhpzw/FSjFzGjLx+RGvxzoSeC1hwsA9klvaFN5FAy+9mJgnhaQ0qqagglADo4c9AhCDpJPl5ZommQ8738HcGw6AJBW1VecZv0cePwOY0/wl1lAD/WUCx0mMlDLr8bjmb+Dwp3x4nkDYbD0thIO5aNtfmDi/xGEeRawxhs7Vb/q2huABQJwAlhyy2cC0xoggjAAUCWWAkksOiIY978TmOOqeqqwqAx3WGhHK06n7TDwOcAV/iipPAKjwgrZm2o8nkUA0gKmAHTrp+o9MTrEYvq44o9pZIOtgmu8mafCV72YAKT/RwAy5OPOuVlAAk9Oule6xQRTWUKlWtkU/IvAHAHti5oIwDK841ZPFtCmdr0U8PaC9hVultd4CIC8P2Ztt/m5/qC11TJXlJDGGpfGAmYODgFoCxACkLpuWh3KCgqE8gNVZK4KtxgjJAB/2X1Krao1rfN7CWZf3LSBT4uAEIyWBVpipL7GgwA0AW25GbGENBTRx3rm1M2w39mmrFVwjTd1Kn+VAZALEE5LtIDyMWUBvbLNLGHgd5H/V07BDp7r3uU+Jadgn3ptxekA5MBri0/Wp4wzBjDbCnkMWMqVpE8GJwLQqvfc0pqbkVj5aNk7gbCxgJno30cAjntowtXNaZ1suvSKNhsYTcVKmw9F5xGE+94dfEoP+JYhD/8OC8eIPUsUHokVVKB78XszbzAF4Pvd//PCKVGIpOAr78mn4DZOm8YC1jco+w6EFTDDPJqeCEBZBa5GffVbhmQ8DtZW5TYOvPhXip0GTuu22lTMLSw+aAVl9QhEWjurI/aQiLJkTMLsX9R3r/ymZ73fp1+37OU9hunXSkdl7T3QrhKCtlCM59k2i5CMMSIAGdqxEIwrmptzTsCEut5yilKoJLAcxCq3fe8tLCDBFwO+tKjyuxSCMdYEXoeDrHcHvu0tTwLzmwHA4N/Gh6zNCqqeOSxC2lb8tQSiMwbuqXIqAcjFh2JjBKGJyShQG6ygVbfJegULWBYcMR3rvb6oCRaQwFPgl1M5rR7/JtBZOIZWx/0+s4QeY5z/1/X2tFnAxPpFELaVkdLN8MWGVr4pCBsfMHN8bmTKfCjZ0Ncp456/x58zLzfw6Qf3ABd8pUgEYmqk5bG
5695yek06IQl1bkXScnlN/u8L24Gdx1qVq91KQvrpgwaAAw9p+wnXPw1YjyWMGtDo2ASOFGMU7SIEUzdYD34vMPmXwLbHgdkFYAtlGiim6DpxJtvq9LtlVr/aWKEB8pUXAOOPAFPzwBTZ9r04vdQ9Ts4pAZ3cd+yHxgfMAOH+vcA69/9Uxijmz/AerYpdar1lNSMYzV+vWY/34I8DY58Gph8Bpo8A04vAFEFIknIHohGVR62QhFRSYjQE6qFri2z3iaPAhHNNlxKwArI0Q1IAxwfReacbC5gBPp66/5ICgLKCtqnsrKKlrFZUFPKOr7osMTtdsxzqQRZ93Q1MPARMPllohUxRqkEK6gShOP0S+dY2hlRv99y+ovRi7IiTnTvLqmg6xDPYpqAUgRgsoR7MxgJmgHD/c4E1FXu7FRRbvEgd7evXWlbPpp9EgUjiJpwe6zwOMlvpAWCMVusJYPIYMOlSDZRpoGiNxKzbdIQlXONMWJbGtw4svdgz3El47nzTRvPrrKptAJT6ZrzfintvAJgx4vsvdQvIXK5VYF3sUZxmJUvgA1FOvwF8spKyBtM1y6EepI4LqVMedbEaTp0EIKdPKh5FqYYqSxgo2jgFr13j6XXHnOiSZOeBVSvyC8qC2r05FVvVw9cAMAOA178AWPMp2LJaaekiCPXExwHw660n1oB/niGQazwOkkSepbJ/72I1x4CJ+cJ6lYI1riccrVicUuVSmIW82pkwnHHVOKbFsOozQGkFkwewnBES37ABYMaAX39ZAUCCb82nIlo+40p2gNnvsoKunxH1xGwA/LOzdQOQJPIuHzV2GBg7Cow7AI0l33XfjOsv6oVodes6ISbBsAZMX+kJxU56KY7pkmFVhOciuvTzSt05v0+ryuT/9gDrZNe4wPMsI7VJP3GcP7gUOOdvgL1rRYJ0ZI5IV3hV4/wrGYPPU3/AiRhYusy2K7mU999P+z90ObD7LuBZK0Xdkeq9NSX2+o4HLwfWlopFCC0fgciBMtAFC8CGrYXVoVjnU2G7rTXrzh4kfRzLY1kyGwBoeiGcPiXb5eAzdXWnazPCSScb4j3xfmav8Cx2p50lAMW0VXINitCogl2r9H2dcctWwQxQsn6ZTBbMNtcgdKIbiZj51VcBk38CXPxoQcfCUg8pjcYgZScw/momACnXyr4leBhs5QaBTHpf7X8dMPYJYO8XgAv9e8QJlAZZq8D4xSuANYKPJQn0AR2AHKy1MACKe9nfFI6IEqduEWoHIJ9wlsVKLekoMCa9EAegSTYQeM4TXco2SEMkAHEbBZoj4bbYtdyCVrFqGXgTSxgXYTZeHLi9AMjEQRCVUXP/n4KUaaT8vVTi+Rtg7GPAuYcAWlMCgUVkQfJ2Q12yBvPXMwHImhDWwf81imsTiLSEvHZkr+jY/p9CQRD4p8DOBwteItai05qn31FFdfLlFxYWgCDUIkRkj/TxbCEi/89jfPZ3X2VqYSJQbmUNQY3HQT7hbv2sLoerVwKQHNEEoCsm8R4MhPRjXUGzVEIKIoY7yaEYuY4dgGb5RXruoSgtSCLLarkICQ9f6QNykGjFdjsIBaI4kGlt8W+Rg5g0HJ8qAp47nihAzFpuWtPIMBZJlASILvR6fQ0DCVbJCkJOJCqnk4pGpb99tZ8MopyiKDX7WWDiwYKXiEQOehCrgKh+eJQ+EQHo1Lby/zRlyf8TIbf9XS5ftIb8I92YugH4ay2pLusorl7dAoonWtMwQSTdOFuQSLTGHyIC8kxSIQuA4hwU2WUAoO4/grBcDbsfWElSzg+JCoYDoEGM1ixSkHzgF/wG7y8sIa3J7JPAGWuFJSQIaU01iJHUiYP4e33BrPOHmG/JMaOfTZVYRhwGav87vWKPJ9/rSH4IOGO5sITqg/ggxXs4TOaBAECbeoOsgfl+DrQShFqcEIhyyt0MbMusEkx76iAZXKM8BvXiZAGlF+Ka
5695IbaadYpem4aDgpJZQz6YJABV5VcHAJZ0v4FxX6KG5UpYs0KnqjhRuagEVgPglYAl9ciHf8mdUrJh0Qx9vkDBzBywfbkYQIGwahA/kglATsHsDzKA0BATiPyZ4NEDwIeoa/uFYKKXL2f24nQoIgd9R3yQCMTFqwIAfdBWI7+yB5ZLECYLETd85YJl+2YAUNosLIel/xYlu4Jsl6bhNhD6it4WJCvA2Zc4Gxo73RcgJeOqFmGR6rcChLYACyGojmEYdj59KnZ+tIQRhH9IvWA2hiREjDeRI9Cly7fMF3EtWRFawhQIf5IJwE56wdTIYdt7tp9ys1K8JnoJvod9Wn682PNkP4hUy1ndWgstAtBDMLYN5/6PAc5DGNoF4SrZfN+4+IhT8jqwg2Cp8ThIJ5vfSWBXAVCrWN9SMxDK+skaOvhoAc8me654pmUB3f0wyt+E8FyRAGmPlOEoiSD2qgvmAKoOm52fAuiTDHSyIRxx+lI0QxxADubfF5vffMmSajrWlP7nmZ3dSy+4r/ZzAUEHnQ8R70HsXlK+PgJsW68G4XYGZj0EY2EYATCAT6tAhmE0DXcC4faapcwMgAIfLb0kuzT9Qmw5uwAAIABJREFUSi+EfeALkSrpBovbrQDnkm8wAo8/E3i+CCsZ98NCpAp8cUekZyBavI4ET/TnaAk/RQCyAXy6uNSPA0i+wMeB6ePA5HFgZq2wpNGK3FUDAHmv3fSCe7afX8CB4UNEEOolVi/3obastNwJ9cO5BOBKEQMsAcifHWzRAigWWAlCn5K2bQYAOe1KMjTIR2kRUhKVS7IrLia0v+3xwHMZMCbYNP0KfG79zAqK5DxOvyEuWu6VD5KSHy2YAEQAfpaRdl5UkuUctIpBnCIIl4psD03FtIIP1ADAlBuJM47EqqUX3LX9kSBQcuuyftK78xUkHyQ+RLqHZ3Fv1KcgLj5kAQ1s0Qo6IA1nHhNLQzA8ZxvBXuNx8DcS5UYpNnoYxsCnUIqvZo0F3wPTMa7Hv53HOJVbS/l+5bumX7d+5WLE44hxIRJB2NMCqj9ixwuE90svWCaIA6bAp959EKeWChAyA0PTOV2unGMQveCO7bfqHbcS4rJR7Ewqnw5AWhLuImg2uFQAXAVs8RGmntW4+g2hB3P79L/EJ9zGvqrxOPibiVi
5695hAOgrWQOf/EBfBcsPNBBqW9Hv6zzGqFzmoXz3B9AePgXiq6bgiv4YOB9QHS8AfpkAFMMjrWAcQA0iO9XJiQyAnos2vV7ESHOOQfWCO7Zf7F40mZFQScRKAYBaSU6vAVcTgN7xXHiUFpDTMK2dFh56912BTiDcvpkATIXzCL4g3WXTZ4jpGfjoF/oihL+fx+0yWUABLwIwtYKKIabgCzHQvi2ggBKn0McEQDaKT5cGkIOo6SuyYzEfjQB0EM5nZgAPoxe8of3sgSqCQM3jkdFLvpRvR13+7UVRuhUFSavNO6otwp88ZZ3+t4M6HLtch6OT9AG/q9cmtf//gV1JDYcnQ2zY6/YakfSrU+Pg1M45NqPt3IEtoM7WFHokyrWKkooglCMWLYjiUXMtK3g8Uzd1WL3gDe3vRRCoUEYCwGtYFxxqgA2E/jI20F5hhmQod98BHNnlxOTig1aGiDanO21yV4DygWuB8YeB6fnC9WEtiKVVKeE0ZGiXWczeJoWMIig5a9V5DA1ANoKDeDylZ9NSXxyAsiKawrQqmCv2HVf5e8aRoxfc1n7xs+khItAUvojvyWryxVcWJZksVSyZoQRA3dcAoHzax4Gj2wtu6FVKM7gMgti02jbV476oUJJs1j/AbA1mQ3Pm8eTRsoZDtR+xZKCiEKmMXTIeXHPGdhYArX8FwG4DGMEnAHIK4yvT58nWC2b73cexaZgWWaEKgU1gjNbPP7PvOYGsUSBkv3hBtmRWNzxjTk9RWktvxp6POj0vARjY9sWkFel8RWxegjIF4RjwAOnZWMPBTGjqvHmszxJOBUD3xyznL2bqROvoP3N3q84jG4C7M/PpcvMBef0cvV9k6hXv+2Yno5QfGArRbaCC0mWv2YtF3ecerNDhkNZIIsXQRv5dlTtGADJSz2gEE1EJQM//026HdIEZLC8B6A0tk0g1Ja8DuzJdphS82QBEZj5dbj7gxZN5er/IZI+67pscgE7QaDOUMyC0Wb8+gXjuR4F5J6YsaXnFhBoAGEVvUhb60jISgCQnoh/OLBgvIrL8v7DdFkEYM5dtNg97tvz5zJqzdfIBmJlPl5sP+DJP5xtW7xffnzeh7H+Z+3+RpkyWT1YxuURJYVtx6T0fCTocouQV85VkHRIGegEuEv/YKpkA/JceVmL8kv6t5/9pu62tfiPWcFQVEa0DZ9WcLJEPwMx8uvfnjT9IgZyj94t/ldeA/S9tMaGa9SNdmsIxbvVscVJ1GScoMt4UPwhAsmMZ0aXzQBsvdGRBjQz0FUpEJRAJQOq4KAnBdz+sfiPJ3bOYn8fsykyVWMfiN3BOzckS+QDMzKe7OW/88aqQzsfE5kH1fvGjeQ0wADodmVGwOeiMsUqHrGOnS4UFy9P/wAEojkEnI+IqOIJQNLgpCXhcmLAtD/D+kgQE235L93tj+YBqgTX9BiCeW/NedT4AmQ+YkU/3sbzxBymQuZhm8g1T+QbV+wWFdjKO/Te2mEFNlCb6gPF708VJ1TXHgKd91GnZpDfi1k/gM2vqU3DUnCuBmNQe3P9vw6pe229KOvB0K1k+ZS+rnrfM2AlA3JMZtah/EZKZT3drxuDz1O/yxAwu9JgJxr3lQfR+8aa8Buy/wdWQZAVl+ZzCrG3q9c/YrkmHy3IRYryAAqAkEBIlopJxNNUbER+fA/H+/+AAdP9PmS9dazicJybm7mlB8nR2dI1HvgVkOlZGPt2nM29GCamcGZjAwlQ+vvrV+8X/zGsAAUiLVPp/wd+zaTMFWw+/kAA0GQQnpCw5mDsAMIrcRB5mC/+MAffTwgfwKY2KfmCZ6ZIkUShrxXxBX4yYaV8Hzmcn13jUA8CMfDqWYeQcSkhVOl8U6uxH7xekrsg49h8oiCENgC5TUG5vKxxT8f2aRtOtcAKQ1s8soPuOVUIwpchNlEEIOyNSIrrvv3hwnckWIZPZsnbcDyzTpvg3lU8mpZQqozyfK74aj3wAKh1LgrsD5tMxiz/nkGD1sHq/YNFOxkEAcuW7oqmXlisuQOT7VV2jwi/kTgj1RkoZhBje8Z83SCAEEJZW0C3gff8tADCt4VASaWIBK0HI9q8BF5yUAMzIp8tNx5Jg9bB6v/jdDPSRns0BWIZeUitIo9IhHmhXTvzCPQddccnZ76U1V/IvC4SBCFyg26DFNg7c++Mhhb6qiCikT7WVUmr6lYn2nRKyrdZ51GMBlZIc07GUBdMjny6XCiUmpA6j94vMZbgBMFo552pu27PXAqXTyAUQcitOQjAm9xX0N9pIwIPmSCmH5QuPqER0L4kDYgp9zOUL6fYxkbZcFceyAreAF3GlV+NRDwAz8uksnT3jiILVSmpWNlhMze+k94vMZfgGAPJeHDjpCrgM01Tdry9OzvmYAzAqLVWIwEShwzbRwwSEn+MqP6bQK5tZlWyhjCCCsC19Xv7gOnBRbgp7cu/5AOyVjqVMmA75dJZ9nHF0yohWNlhMxKnS+0XmMtwAmFq4imnYbrEqNJPc+9kfd62RKh0On8qV9hXZ9askEPgAfI56ziocUgVbzGT28lEtRMoKtg7lBHtznfZNA+CQ+XQWM8k4uglWK/NLYKzS+8U9GReXD0g/Tyvh4Ne17Yb4Zbr6g6y7/aNWcoPpjKRTsJIags5IJwkEAv6en05S6GUBfRWsUExZyVZVQCQwrgN7Wfdd41GPBczIp8ODeXfTSbBa6YYxlY8/p3q/udc3C+jTbtvqt2oadnB2m4oNgMn0W0p+hYWHWbwg9yU/0Kb9EIy+5y2hiCit4UgKyTeAkN8Valk4Le/ldlONRz4AWWBRM6fdIPfHstw/G+SE5rMnVQ/kA5AkLHS0ak7V7reXfhgACaBqDtD3e/nmc5k9kA/A80JReq+U38zGVp3ObJo/BvAOD3dtwiWar9zEHsgHIGlFubqSx7+Jja36anLLcDvvgwA+NDpDfILv+qlzuXwAXuSjrkKemlO2e3U1uWUYnL8dwB/5e2apca9LNv+vsQfyAUheX4VguB+mzIsaG9ntqxhF4Xbe3QD+n7/uHLAW9wQ1tblMRQ/UA0CaHC7plXEh+q4T0OWcfhleYTSHBK0EH/mi+fcRuKQn4I6fWpeoB4AevCz3HOOm9yb3F5mBlZBNclYCj1aRfyfrbgPCTR6AzK+vD4CyglX7jpmN7HY66d1E0ctdIrEEE4wEIMlam+Pk7YF6AMj7EwAVbU82vTerCwhAXopJN9zVI+AYrOeULLZgErY2x8nZA/kAJGWr0naUWdFpy2cT+oCWjpdjLFxE5UzYIBBpEUX5nLnlvAktb76SPVAfAOUHpiAMm96bsVtCAMaKALICMyxDq6cXfycA+b/mOLl6oF4AiqBRIEzBp7/X2Af0+fi1XIioMIlAI+AIPIGPmeROWV3j1Zuvyu2B+gHoFfZiDS2lC0LiY52WUADkQoTTMH1BFSYRdHoRfKSu5v9qrizMHYPT+vx6ARhSuDcAzzmDo5ZGHT1PAKYMwQxME2jiSo/gEwBrrq+u41ZOy++oD4BaCcsXTPiSI3ey8s4KGoG8QwCMFM+0ggQhLR0BF19SXuD/ayakz7uR0/TsMcxg3SjfqWNA0hsrga/ojaq/8WPcC+YIk4Ke4CMSuB2XVht1Oj8zIfXlU8BtU8DhmYRXWdfrdF1fgr3+S8At48CD04DVjXQSDO70PTUnaJ5uOCwsIIFHSSFy1pKPWCDsZxCpw8UVgKSPxLXM937OzxxAljzcPAbcswU4Qh4V3UN8mKoeKm/bu78IfKJQa8VD48CylHQiL3O3/qg5Rf30BKACMtJXjXKQcfBSK8Dfqc3KVCwuN2VFGRnm/yKZtq4Re5ifyQQgM2A+BeB3GHaZBo5MAIue0l7Kt3cC4xhw+5eL7TuCkJk1jBtyerbUfYG5ExjZ/pqrxE5fAOrOq5SmowVIrRp1IyT2R6+fg0bgVYG4CsyZe2UsaiOGKXr4Sfp9k8CxCYAFSKyvXeY1o1BxQux91yMtfsHPutgnnyUuUvhc0ZsgUXib+nVkq6+ZKaABIHsgVZnuwD9sVo66rrR4ImdhLGSQ8zPL/JgBQxeU1ouWkO9PTgDzbgmXxrzMkatl3keivfG5x4r4IRcz5BfkO5vEZ0kgpIfBZ8yKjlL17syy0tMNcOn9dl4Fy6dLFabj1Mpvow9Ify+I4Nlo9Xt+ZqU9VdJpqZh4QDDyxUyYOYJwHDg+DhgI/WUVZl7aSEt93+GO9Ia2iuZKOfA7lhp9JpvAVy61w2mOwO5hmCgMHC1H9O24gu6UD9jP+ZmbtLRaSsei9SL4XDPbAEh/kGQ/pSUcc0lbApFWb67lQUhpVnLBsoKqqZclFMmUtrxPcwxl3X7vOCAtYLSCcugFQmqhdssH7HU+RznjiOlYXA8wqkOfkItTAom+oKygca4ES8jY+N3z7fSG4hfUtp3ihUHruVSsFy1iRvNP+1N7A5BdJACmVpAgZPhGOyCigEjlPLudn7kvFtOxuB4g6OjD8UWLRkCZFRwrLCEXJQQhp2K+37lQeBCRX1A7KPQto1prFEmSYn2mB9EAsO+kYfk8KQhZF8yjVz5gp/MztyOUjiW9bCUhEBhKRCCgSis45uQ/PhX/xfFWMgOnWu2gxB0TF/o0kEZ/kCDM1Ts+3RHYnwVUL6XhDFrAswfIB6w6P1MrTulY0sum1VICglKwCEACqvQFCUK3gHcsFQCM/ILayqP1k9JshVqrncMalOYYvgcGAyCvIwuod8YBJQmZpmGJeyRwkGw4n8jJOJQNw3idLFhMRNB0SgASTJyKoy/4ieXCeFfJBUeV2SoAclFyR0bbm1OHTUiN0/DTAw
5695D7zQeM52dqj8VsGEkVE2jKetG7AEhQ0frJAv6RC0trC1skl+IWlNinGLbSaZg7Mc0xfA8MbgF1LQV1z08A2G8+oM7PVF9Ms2GUE0gQyp+Lwu2yagLgR9ZaYpkSypQ6a6Q2DCqzpkvietXIFdoZfuieGmcOD0DeP0HEbBhNwYPmA/L8zJQsATAKnguEqS+XTqkE4YfWWwCUFZTksYAYwZfIBeN9Tw0cjOwu8gDIZqsoSSvhEeQDiiGYFoyWiSDRypWgi69UP5sc5fIcquSCNeXqe2X9ZAHfM7Khe2pcOB+AT41+aO5iRD3QAHBEHd9ctuiBBoANEkbaAw0AR9r9zcUbADYYGGkPNAAcafc3F28A2GBgpD3QAHCk3d9cvAFgg4GR9kADwJF2f3PxBoANBkbaAw0AR9r9zcUbADYYGGkPNAAcafc3F28A2GBgpD3QAHCk3d9cfOxqYJ2au9RdPtdp/khoEOlglDYT39V1PzQFXLsMXAlgt9PCxJKPbufyf8/KHIPfBPAZABf79Xc5XQ0ZQ1Q7360NbxoHrlsDvs5ZRsgo0une06by6X1mZvtP99PNAp4F4LsBXA5gjw8EGTeqaGF4QhzQF80CX7cAvGIdeDYAfhdZ2sTKUcVrpE7nd31N5gj8e2dIo2osk7NZpMdK0Z19tv+bJ4F9K8D1ACj8yfNSikHeg+5Z969m57Y/8/ZP+dPLKZhP/rcA+AYAF7g1oRUhEMUzFMt6eSJfX78b2DkPfM0i8GIAX+uWlAMppreUUErn8p2gzTl+2flg/sDbTkvIOik+CP20//mzwAXzwDcCuNTPJeFXpEpM6QEjIHm/zTF8D7T5gATYNQCe69aAloRTGulfBESBSYNyxR5g/Bhw7hKwZwl4vk9LnM5JmsBzUyDGAX3B8G23Mz/g9BuUa/0IiutfMkj7zwKmngAuXSvOpUvAWYBtF4BTnspIj/O8zPaf7qdvWITw6eZA0JLQEhKEGgxZhUj/dz3NzSKwbR44exnYvVKcy+mM5Km0JhxInUtrGkmzCPicg3W5LMGkQiZZTm9xS9Z3+4m2o8C5c4X15pTKW2Lb+fCx7WLtjYxzqiql29Icw/dA5SqYf6RTTilg+lYCIXmICKQ4IK9wxfSJY8AZK8CuFWDnanEua9ZTAMsaCog3Dt92O/MvnRGBtGwkqKRmMEkqCaa+2k+0LQDTh4rP88UHj74kF1WaATo9QHQ7mmP4HugYhtEKj4PB6ZQ+FS0hQahpldPya1kXTOqNY8DscgG+HavAttUCvBxInitrkgL4lcO33c7spBdM3kAuSnq2nx9gQfAh4JyVwvrxwel2z3p4aMlzH6DM2z/lT+8aB+Q/OT4EEqckWQSBkGD6EQKQnDCLwBSnYgcf32fXioGUFawC4esyu7CXXnDP9tOCsyD4KLB1rmgvX7zfbu2WG/Jtme0/3U/vKxBNAMoi0KcjkATCN3HOEr3UAjDrwOP71rXixYEkeKMFlSX8ocwR6KUXTJ7AaNE2tF8WfA4Ye7Kw1mwvX/yZn+eKnvcrfzC6IK/ObP/pfnpfAGQnySoISBqUXyAASS1AK0JfagWYcRDOrAF66TxZQU7jBOEbM0egH71gcgXSFZAV54NQtj9YcNIpbONCyh8Ygi8CVospApDuB63g92W2/3Q/vW8AsqM4gLIKBBIH8bcJwMCNMX68BTqBb8s6sGWtsIA6jwDk662ZI9CvXjA5A6NVa2t/IAicnC/aGV+8T74IQPm/AmGuBc+8/VP+9IEAyLslAKMV/LgAyIUInfnjwPQqMOOgI/DstQ5Mr7UAqMF8V2YXDqoXXNl+EQQ6N9v29aKdesUpWJZbAPyPme0/3U8fGIDssDid/pUASCvCaXgJmFguAEfgEXT27gDkuwaUg/nbmSMwjF7whvbLhSDL5TwwvdRqo9oqHzACkCB8U2b7T/fThwIgO01T1IMCoAZxGRhbKoAXQUcQTjkI+a4B5e5FzjGsXvCG9gdqrLGFYrpVG/UuHzBOw2/LaXxzbh43DKeoJwlAHqLndSs4udoCoIBHQE45EPk3DuitmYOQoxdctp8+rFwIWsGFYiFFoLGNchcEQC6e+OJC5J2Z7T/dTx/aApYdJ37AyJK/DIwvFxYvWr0IwEn/H1Opco5sveDUhSAAF4HJpQJkWixp6k2n4IYfMGf0amDHev2I8+l4/UbvNw8Eozw72wJePOJ8und7EkKj9ztKGA1/7WwATo44n45pWI3e7/AAGPWZ2QBkYHCU+XTMfGGQmYIxjd7vqOE0+PXzATjifDrKtTZ6v4MP/MlyRj4AR5xPF+VaqZLJF1UzKdPV6P2eLDDr3I58AI44n07ZMARbo/d78gMubWE+AEecT8e9YOn2Uheu0fs9tUCYD8AR59MpG6bR+z21gKfW1gNAz4geRT5dTEZo9H5PPRDmAzBmRM8BJzqfLiYjSKKr0fs9dYBYDwBHmE9XtRfMsIz04aQZ1+j9npygrA+Akqs8wfl0BCCTWRq935MTYL1aVQ8Ao1zlAnAi8+kEQGZTNXq/vYb75Pt/fQAcUT5dBGCj93vyAaxXi+oDoFLyT3A+3Rcavd9eY3xS/z8fgCQX/LPR3SOzkon55jg1eyAfgD8M4NcAPD6aDmBtB1e4NMDNcer1QD4AbwbwxwDe4UvRE9wHZG1gNSXDLlwLNcep1QP5APxzzwj9IIAPnXhT5ORc5EYCA9HNcWr1QD4AmRH6FQBMTSZZH98ZmD5Bh5g1FopiNns1x6nTA/kAvAfAEwDudnI+EvQxPfkEzYfaCXRSBluQMB7YHKdGD+QDsBNBH/9+AkAobqTADGK7Inw1x8nfA/kA7EXQt8kgrGAGMfBxZ5Cv5ji5eyAfgL0I+r68uR0QmUFoBQU8vfNvzXHy9kA9AORoMw7CdGQCjoUZDwL4kv/+8OZ1gJhBIjGDgMh3vTavBc035/RAPgD7JegjODfhiMwgoqeJwNPPTaB6Ezq/hq+sB4AcXeXEP+ZhGVo9vRimIQD5v5oPAZCupgDI9wg8/qz/1Xz55usyeyAfgMMQ9GU2Op4eAchpOIJQQEz/VuPlm6/K7IH6AMjgGzdl6QtyX5jWjpQFevF3lq3xf6yhrOlIAUgQCojR8gmE+l9Nl2++JrMH6gEgR5UA5KYsc+AZmCbQCDi+IvgEQMob1XBEAHIajgBMLV+0kCdws6aGu3zqfkV9AGTwjftg3JRVVRAtHQEXX/wbAcoXP5d5CID8GoJKvqDAloKOoIz/y7x8c3pmD4zhaqwjRzCYyQg5gr2ZgsFTLweWr8XQgsXjbwLWrnNtMlKgNoLBmZAa7PTCAuYIBlMvlWQswwr2UlUw45jdDSx8HbD+Ctd+HVCwePKbgJV9aASDM8Yg59TWFDysYPBtmYK91IbNOHaPA/M7gUXKXA4hWDz79cA8+W0aweCMURj+1HYfcBjBYO54MMY3tGDv8I3nmWSHOzYOLJ0LLPGXAQWLz3oB8MQUsEa16kYwOG8whjh74yJkUMFgbsNlCfYO0epwissVY34bsHw2sEIRkAEEi/dcU0SP5qhF1ggG5w3GEGdXr4L5134Fg4kAjuDQgr1DtDqcUmZETwArZwAru4BVqsv0KVh8/o3F4v0QXZBGMDhvMIY4u3MYhv95Zh+Cu1xBcxuOU/HfeDIq5cv7FuwdotXhlCBXjOXZAnyrO4BV6in0IVh8wStLuWCsUAyvEQzOG5ABz+4eB+R/ewnu/kOP/3G/l4kJTERlljQtIot2e53/IwO2OPl4FLtcnCqAp9cahT56CBZf+LpSLhhz1N5qBIPzBmTAs/sLRHcTDKbiNHdBGGymOC/3hglEvgjAnoK9A7Y4+XgiV4zVWYDAs/etxaubYPFFP1QkLtCIP8neaASD8wZkwLP7AyC/tJNg8L/xLNBu+YBdBXsHbHEFAINcMVamgdWZAoRrfPdXm8KitLdmgYveWAq+2y7iMqfuRjA4b1AGOLt/APJLqwSD3+y5T1yI0AoSbAxMMzGV1o8/My2ro2DvAK2t+GgiV4zj4+3AIwDXtwBrVJeuECze+9aW4Dut4PxkIhYsdetGMDhvoDqcPRgA+SWp4O4veQ5Uv/mAGwR78+6rQq4Yq9PAOi2fA4/vBkKudKVU7VZw77uKvWFuZbtcMNb5v0YwOG9g+jx7cADyi6Pg7gccgIxlcA5TKhaD01yYKBmVFpBZMfx/m2Bvny3t8LGqoqTliZbVI+gMgHwnMAnCIFi897cLAAZ6QyzFzzSCwXkD1OPs4QDIL5XgLmk5JHk/SD5gKdibd38VcsVYGmuBTaAzEHLHgyCcaokB7/1IkUET5IKxwF5pBIPzBqbPs4cHIC/AaeqvPL9pmHxAE+zts6VdLCD/lcgVY3UyWD0Bj1ZwqgCggXA7sPfWAoAJvaEtZBrB4Lyx6efsPADyCtmCvf00s/NnOsgVY3m8BTRZPZuGBUACdArY+5lWDqGmYbIrLHEx0ggG5w1OH2fnA7CPizQfaXqgUw80AGywMdIeaAA40u5vLt4AsMHASHugAeBIu7+5eAPABgMj7YEGgCPt/ubiDQAbDIy0BxoAjrT7m4s3AGwwMNIeaAA40u5vLt4AsMHASHugAeBIu7+5eAPABgMj7YEGgCPt/ubiDQAbDIy0B8ZYNMbkX+ZekpuIiOQrPar+xs889HJg6jZg5jAwvVZ8B+ll9PlO5/Fc/o+ECjnHfi8zYfkvM5ulmp4qJXVqx5deD4zfAkw/CGxdAZgoHfuh131QkaI5hu8Bs4Ds8B0AWLnIRGCBsFfn87JffDMwdjOw5R5g8giwZa34jnQQUwDo99wBfJ4TM7COiNdlaj2rA/jeV/vfDeATAP4UGH8I2Lrc6gc+SHqY4oMZ74VSKM0xfA+UUzB/oBUUCKMl6zSQ/PsXqZD5KQC/A0w/DEwcAcYXgYnVwppwADuBkefnCim90FmBWXwnK87Uen53BI8sbuwqaz9p5UgnQhBS+ZN1zE8Ak0utviCwq8DI8/nx5hi+Bzb4gJzKZE1SEFZZgS9/2pWR/gTAJ4HJQ8DEMWB8ARhfBsaWCwDquwQKvvNgHXvOcYVbPFJPkw+dDxC/W1Y4tWDpw/Rlgo4lo1T4/KxTihDNpJwj3/UiMLXemprjffC7eWpzDN8DlYsQDiKtVxzEqoHkyX9HRizW+nIgaQnvAiaeBCbmC0s4tgSMu2rMePAR9X252jXklaTFU108K0MHav/nvJ6ZxVVk9OI7GR2IZoGQNc/HgbHgIwqILIVujuF7oOMqWFawCoRxkfEIB5CWgkREBCNf9wMTc8A4QciBWyoGz16rwNgaML5eWKpctYZL3N+TWLX0gvtuP0HHk2n16JDyxXmVhfU0qywbJbr5GSuXKxA/sV5Y9UYWdnjwyS3qKKgarWA69Wg6fjQOIK0HadnIjPVFB+AiME4AuiUkCFnESyCSkmAuU7Cjm15wX+2X2ifBRn9A8mKcW2UFjULVQcgVDl80u40SYh763FfvquhLCxitoBYUsoJfjXKttByMq9CKcHn4sPuCbgXNJwyWkECcz5Q376UX3LNncZyQAAADEklEQVT9fFgIJ
5695s6lBBwtn3Tt6FpIz4RWnuQxPh2XIGzm4CwQ9hWIFgBTK0gQHiIAJddKq0ELQh+KL1qUR4MvSEsoENIKrgALHNiMox+94K7tl9qnnMio8MSf6SNwGpYVjCDk/Ju7isq496fCqX0BkDeqlWwKwic1gAQSpzGREnFgREz01eALLvvq2Kfi45m6cf3qBXdsfxRbJMho8dimqOhEK8cXQRr9QVpvPoDNMXQP9A3ACELFxPh+jACkP0fLIKFCCRRqKuPUdqjlC9o07JZwKVNHeBC94DQcZO0XAAkmgotAk9QYrR9f/BvByYfMSATDVMzwTXMM3QMDAVAgVHCZ7/MaQK4QZUHiNCbBQlqUw74YCb7gcmYkelC9YFlwvVv7RRAorTuBkECU9asCID9/x9B935zYzyKkqpfiNHxcA0gLQgvBAaPVkCqm3h2AtC5m/RyEqzw/4xhGL3hD++MmslgqCbgUfLKAcRrmTlBzDN0DA1tAXUlWcDm1IOIIJAjlT/Fd05lbFQFwjdtgGcewesFt7Rc/Gx8iWjUCjGCT1YvWT1MwgUqrf3NG45tTbcu0aximWx9xENcEQHGbcYAEwtSXSqY0gnCdgeuMI0cvuGx/FUGgFhwEYrR80QckWN+X0fjm1DwAWv8RgJFilJZBznz0pQg+AZAAlVWh1GvGka0XzB0cCQi30aSGVa9AF62fLOB7MhrfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC",Tx={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},Tb=class extends C6{constructor({preset:e=Tx.MEDIUM,edgeDetectionMode:t=2,predicationMode:i=0}={}){let r,a;super("SMAAEffect","uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",{vertexShader:"varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",blendFunction:C2.NORMAL,attributes:C5.CONVOLUTION|C5.DEPTH,uniforms:new Map([["weightMap",new lG(null)]])}),arguments.length>1&&(r=arguments[0],a=arguments[1],arguments.length>2&&(e=arguments[2]),arguments.length>3&&(t=arguments[3])),this.renderTargetEdges=new iM(1,1,{minFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new CZ(!0,!1,!1),this.clearPass.overrideClearColor=new iv(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new Tr(new CL),this.edgeDetectionMaterial.edgeDetectionMode=t,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new Tr(new CG);let o=new ls;o.onLoad=()=>{let e=new i_(r);e.name="SMAA.Search",e.magFilter=1003,e.minFilter=1003,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!0,this.weightsMaterial.searchTexture=e;let t=new i_(a);t.name="SMAA.Area",t.magFilter=1006,t.minFilter=1006,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!1,this.weightsMaterial.areaTexture=t,this.dispatchEvent({type:"load"})},o.itemStart("search"),o.itemStart("area"),void 0!==r&&void 0!==a?(o.itemEnd("search"),o.itemEnd("area")):"u">typeof Image&&(r=new Image,a=new Image,r.addEventListener("load",()=>o.itemEnd("search")),a.addEventListener("load",()=>o.itemEnd("area")),r.src=Tv,a.src=Ty),this.applyPreset(e)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}
5695get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){let t=this.edgeDetectionMaterial,i=this.weightsMaterial;switch(e){case Tx.LOW:t.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case Tx.MEDIUM:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case Tx.HIGH:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case Tx.ULTRA:t.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0}}setDepthTexture(e,t=3200){this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,i){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){let{searchTexture:e,areaTexture:t}=this.weightsMaterial;null!==e&&null!==t&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return Tv}static get areaImageDataURL(){return Ty}},Tw=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb; 5696#if VIGNETTE_TECHNIQUE == 0 5697float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset)); 5698#else 5699vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord)); 5700#endif 5701outputColor=vec4(color,inputColor.a);}`,TS={DEFAULT:0,ESKIL:1},T_=class extends C6{constructor({blendFunction:e=C2.NORMAL,technique:t=TS.DEFAULT,eskil:i=!1,offset:r=.5,darkness:a=.5}={}){super("VignetteEffect",Tw,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new lG(r)],["darkness",new lG(a)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}get eskil(){return this.technique===TS.ESKIL}set eskil(e){this.technique=e?TS.ESKIL:TS.DEFAULT}getTechnique(){return this.technique}setTechnique(e){this.technique=e}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}get darkness(){return this.uniforms.get("darkness").value}set darkness(e){this.uniforms.get("darkness").value=e}getDarkness(){return this.darkness}setDarkness(e){this.darkness=e}};function TA(e,t,i,r){var a;return(a=e+(t-e)*.75)+(i+(r-i)*.75-a)*.875}new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),TA(0,0,0,0),new Float32Array([0,0,0,0]),TA(0,0,0,1),new Float32Array([0,0,0,1]),TA(0,0,1,0),new Float32Array([0,0,1,0]),TA(0,0,1,1),new Float32Array([0,0,1,1]),TA(0,1,0,0),new Float32Array([0,1,0,0]),TA(0,1,0,1),new Float32Array([0,1,0,1]),TA(0,1,1,0),new Float32Array([0,1,1,0]),TA(0,1,1,1),new Float32Array([0,1,1,1]),TA(1,0,0,0),new Float32Array([1,0,0,0]),TA(1,0,0,1),new Float32Array([1,0,0,1]),TA(1,0,1,0),new Float32Array([1,0,1,0]),TA(1,0,1,1),new Float32Array([1,0,1,1]),TA(1,1,0,0),new Float32Array([1,1,0,0]),TA(1,1,0,1),new Float32Array([1,1,0,1]),TA(1,1,1,0),new Float32Array([1,1,1,0]),TA(1,1,1,1),new Float32Array([1,1,1,1]);var TM=class{constructor(e,t){this.enabled=!1,this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(e){this.effect.blendMode.opacity.value=e},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(e){this.effect.blendMode.setBlendFunction(Number(e))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=C2.NORMAL}dispose(){this.effect.dispose()}},TE=class extends TM{constructor(){super(To),this.blendFunction=C2.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}},TC=class extends TM{constructor(){super(Tl)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}},TT=class extends TM{constructor(){super(Tc),this.effect.offset=new t9(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[1e3*this.effect.offset.x,1e3*this.effect.offset.y]}},TP=class extends TM{constructor(){super(Th)}},TD=class extends TM{constructor(){super(Tp),this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}},TO=class extends TM{constructor(){super(Tm),this.blendFunction=C2.OVERLAY}},TI=class extends TM{constructor(){super(T_)}get eskil(){return this.effect.eskil}
vendor: 5,773 bytes, lines 5701-5728
5701set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}},TR=class extends TM{constructor(e){super(Tu)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e/2e3}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=this.isPerspectiveCamera?e/2e3:(e+992)/2e3}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}setCamera(e){let t=!1;(e.isPerspectiveCamera&&!1===this.isPerspectiveCamera||!e.isPerspectiveCamera&&!0===this.isPerspectiveCamera)&&(t=!0),e.isPerspectiveCamera?(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e.perspCamera),this.isPerspectiveCamera=!0):(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e),this.isPerspectiveCamera=!1),t&&this.effect.setChanged()}},TL=class extends TM{constructor(){super(Tg)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}},TB=`#define GLSLIFY 1 5702varying vec2 vUv;varying vec2 vTexCoords[9];uniform vec2 resolution;void main(){vUv=position.xy*0.5+0.5;vec2 texelSize=vec2(1.0)/resolution;vTexCoords[0]=vUv+vec2(-texelSize.x,-texelSize.y);vTexCoords[1]=vUv+vec2(0.0,-texelSize.y);vTexCoords[2]=vUv+vec2(texelSize.x,-texelSize.y);vTexCoords[3]=vUv+vec2(-texelSize.x,0.0);vTexCoords[4]=vUv+vec2(0.0,0.0);vTexCoords[5]=vUv+vec2(texelSize.x,0.0);vTexCoords[6]=vUv+vec2(-texelSize.x,texelSize.y);vTexCoords[7]=vUv+vec2(0.0,texelSize.y);vTexCoords[8]=vUv+vec2(texelSize.x,texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}`,Tz=`#define GLSLIFY 1 5703#include <common> 5704varying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution; 5705#define USE_YCOCG 5706#define USE_CATMULL_ROM 5707const float feedback_min=0.5;const float feedback_max=0.95;vec3 RGB_YCoCg(vec3 c){return vec3(c.x/4.0+c.y/2.0+c.z/4.0,c.x/2.0-c.z/2.0,-c.x/4.0+c.y/2.0-c.z/4.0);}vec3 YCoCg_RGB(vec3 c){return clamp(vec3(c.x+c.y-c.z,c.x+c.z,c.x-c.y-c.z),vec3(0.0),vec3(1.0));}vec4 sample_color(sampler2D tex,vec2 uv){ 5708#ifdef USE_YCOCG 5709vec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a); 5710#else 5711return texture(tex,uv); 5712#endif 5713}vec4 sample_catmull_rom(sampler2D tex,vec2 uv,vec2 texSize){vec2 samplePos=uv*texSize;vec2 texPos1=floor(samplePos-0.5)+0.5;vec2 f=samplePos-texPos1;vec2 w0=f*(-0.5+f*(1.0-0.5*f));vec2 w1=1.0+f*f*(-2.5+1.5*f);vec2 w2=f*(0.5+f*(2.0-1.5*f));vec2 w3=f*f*(-0.5+0.5*f);vec2 w12=w1+w2;vec2 offset12=w2/(w1+w2);vec2 texPos0=texPos1-1.0;vec2 texPos3=texPos1+2.0;vec2 texPos12=texPos1+offset12;texPos0/=texSize;texPos3/=texSize;texPos12/=texSize;vec4 result=vec4(0.0);result+=texture2D(tex,vec2(texPos12.x,texPos0.y))*w12.x*w0.y;result+=texture2D(tex,vec2(texPos0.x,texPos12.y))*w0.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos12.y))*w12.x*w12.y;result+=texture2D(tex,vec2(texPos3.x,texPos12.y))*w3.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos3.y))*w12.x*w3.y;return result;}vec3 choose_motion_vector(){ 5714#ifdef CHOOSE_LONGEST_MOTION_VECTOR 5715float longest=-1.0;vec3 v_choose=vec3(-1.0);for(int i=0;i<9;i++){vec3 v=texture2D(velocityBuffer,vTexCoords[i]).rgb;float l=length(v.xy);if(l>longest){longest=l;v_choose=v;}}return v_choose; 5716#else 5717float closest_depth=1000.0;vec2 closest_uv_offset=vec2(0.0);for(int i=0;i<9;i++){float neighbor_depth=texture2D(depthBuffer,vTexCoords[i]).r;if(neighbor_depth<closest_depth){closest_uv_offset=vTexCoords[i];closest_depth=neighbor_depth;}}return texture2D(velocityBuffer,closest_uv_offset).rgb; 5718#endif 5719}vec4 clipAabb(vec3 aabb_min,vec3 aabb_max,vec4 avg,vec4 input_texel){const float FLT_EPS=0.00000001;vec3 p_clip=0.5*(aabb_max+aabb_min);vec3 e_clip=0.5*(aabb_max-aabb_min)+FLT_EPS;vec4 v_clip=input_texel-vec4(p_clip,avg.w);vec3 v_unit=v_clip.xyz/e_clip;vec3 a_unit=abs(v_unit);float ma_unit=max(a_unit.x,max(a_unit.y,a_unit.z));if(ma_unit>1.0){return vec4(p_clip,avg.w)+v_clip/ma_unit;}else{return input_texel;}}vec3 clip_aabb_variance(in vec3 cOld,in vec3 cNew,in vec3 centre,in vec3 halfSize){if(all(lessThanEqual(abs(cOld-centre),halfSize))){return cOld;}vec3 dir=(cNew-cOld);vec3 near=centre-sign(dir)*halfSize;vec3 tAll=(near-cOld)/dir;float t=0.0001;for(int i=0;i<3;i++){if(tAll[i]>=0.0&&tAll[i]<t){t=tAll[i];}}if(t>=0.0001){return cOld;}return cOld+dir*t;}void main(){vec3 v=choose_motion_vector();vec2 velocity=v.rg;vec2 previousPixelPos=vUv-velocity;vec4 currentColor=sample_color(inputBuffer,vUv); 5720#ifdef USE_CATMULL_ROM 5721vec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution); 5722#else 5723vec4 previousColor=sample_color(historyBuffer,previousPixelPos); 5724#endif 5725#ifdef USE_YCOCG 5726previousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a); 5727#endif 5728vec4 ctl=sample_color(inputBuffer,vTexCoords[0]);vec4 ctc=sample_color(inputBuffer,vTexCoords[1]);vec4 ctr=sample_color(inputBuffer,vTexCoords[2]);vec4 cml=sample_color(inputBuffer,vTexCoords[3]);vec4 cmc=sample_color(inputBuffer,vTexCoords[4]);vec4 cmr=sample_color(inputBuffer,vTexCoords[5]);vec4 cbl=sample_color(inputBuffer,vTexCoords[6]);vec4 cbc=sample_color(inputBuffer,vTexCoords[7]);vec4 cbr=sample_color(inputBuffer,vTexCoords[8]);vec4 cmin=min(ctl,min(ctc,min(ctr,min(cml,min(cmc,min(cmr,min(cbl,min(cbc,cbr))))))));vec4 cmax=max(ctl,max(ctc,max(ctr,max(cml,max(cmc,max(cmr,max(cbl,max(cbc,cbr))))))));
5728vec4 cavg=(ctl+ctc+ctr+cml+cmc+cmr+cbl+cbc+cbr)/9.0;vec4 cmin5=min(ctc,min(cml,min(cmc,min(cmr,cbc))));vec4 cmax5=max(ctc,max(cml,max(cmc,max(cmr,cbc))));vec4 cavg5=(ctc+cml+cmc+cmr+cbc)/5.0;cmin=0.5*(cmin+cmin5);cmax=0.5*(cmax+cmax5);cavg=0.5*(cavg+cavg5); 5729#ifdef USE_YCOCG 5730vec2 chroma_extent=vec2(0.25*0.5*(cmax.r-cmin.r));vec2 chroma_center=currentColor.gb;cmin.yz=chroma_center-chroma_extent;cmax.yz=chroma_center+chroma_extent;cavg.yz=chroma_center; 5731#endif 5732vec4 previousColorClipped=clamp(previousColor,cmin,cmax); 5733#ifdef LUMINANCE_DIFFERENCES 5734#ifdef USE_YCOCG 5735float lum0=currentColor.r;float lum1=previousColorClipped.r; 5736#else 5737float lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb); 5738#endif 5739float unbiased_diff=abs(lum0-lum1)/max(lum0,max(lum1,0.2));float unbiased_weight=1.0-unbiased_diff;float unbiased_weight_sqr=unbiased_weight*unbiased_weight;float k_feedback=mix(feedback_min,feedback_max,unbiased_weight_sqr);vec4 result=mix(currentColor,previousColorClipped,vec4(k_feedback)); 5740#else 5741const float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha); 5742#endif 5743#ifdef USE_YCOCG 5744gl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a); 5745#else 5746gl_FragColor=result; 5747#endif 5748}`,TF=`#define GLSLIFY 1 5749varying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}`,TN=`#define GLSLIFY 1 5750layout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}`,TU=class extends sl{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new lG(null)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:TF,fragmentShader:TN})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}},Tk=class extends Cq{constructor(){super("TAAResolvePass"),this.MRTCompatible=!0,this.needsSwap=!1,this.passThroughMaterial=new TU,this.resolutionVector=new t9,this.resolveMaterial=new sl({name:"TAAResolveMaterial",uniforms:{inputBuffer:new lG(null),historyBuffer:new lG(null),velocityBuffer:new lG(null),depthBuffer:new lG(null),resolution:new lG(new t9)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:TB,fragmentShader:Tz}),this.historyRenderTarget=new iM(1024,1024,{minFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new iM(1024,1024,{minFilter:1006,stencilBuffer:!1,depthBuffer:!1}),this.resultRenderTarget.texture.name="TAA.Output"}setSize(e,t){this.historyRenderTarget.setSize(e,t),this.resultRenderTarget.setSize(e,t)}render(e,t){this.fullscreenMaterial=this.resolveMaterial,this.resolveMaterial.uniforms.inputBuffer.value=t.texture[0],this.resolveMaterial.uniforms.velocityBuffer.value=t.texture[1],this.resolveMaterial.uniforms.depthBuffer.value=t.depthTexture,this.resolveMaterial.uniforms.historyBuffer.value=this.historyRenderTarget.texture,this.resolveMaterial.uniforms.resolution.value.set(t.width,t.height),e.setRenderTarget(this.resultRenderTarget),e.render(this.scene,this.camera),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(this.historyRenderTarget),e.render(this.scene,this.camera);let i=this.renderToScreen?null:t;this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(i),e.render(this.scene,this.camera)}dispose(){super.dispose(),this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}},TV=class extends Cq{constructor(e,t,i){super("TransmissionPass",void 0,t),this.MRTCompatible=!0,this.depthPass=new C1(e,t,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new TU,this.splineScene=e,this.needsSwap=!1}updatePasses(e){this.passThroughMaterial.dispose(),this.passThroughMaterial=new TU,this.depthPass.dispose(),this.depthPass=new C1(this.splineScene,this.camera,{renderTarget:e.transmissionDepthTarget})}setCamera(e){this.camera=e}setScene(e){this.splineScene=e}render(e,t,i){let r=this.camera.layers.mask;e.setRenderTarget(e.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=t.texture[0],e.clear(),e.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(e,t,i),e.shadowMap.needsUpdate=!1,e.shadowMap.autoUpdate=!1;let a=this.renderToScreen?null:t;this.camera.layers.set(3),e.setRenderTarget(a),e.render(this.splineScene,this.camera),this.camera.layers.mask=r}dispose(){super.dispose(),this.depthPass?.renderPass.dispose(),this.depthPass.dispose(),this.passThroughMaterial.dispose(),this.depthPass=void 0,this.passThroughMaterial=void 0,this.splineScene=void 0,this.scene=void 0,this.camera=void 0}},Tj=new nR,TG=new sl({transparent:!0,vertexShader:` 5751 void main() { 5752 gl_Position = vec4(0.0); 5753 } 5754 `,fragmentShader:` 5755 layout(location = 1) out vec4 gVelocity; 5756 5757 void main() { 5758 gl_FragColor = vec4(0.0); 5759 gVelocity = vec4(0.0); 5760 } 5761 `}),TH=class extends Cq{constructor(e,t,i){super("OpaquePass",t??Tj,i),this.MRTCompatible=!0,this.originalMaterials=[],this.hasTransmissionPass=!1,this.clear=!0,this.clearColorOnly=!1,this.clearDepth=!1,this.needsSwap=!1,this.MRTCompatible=e}setCamera(e){this.camera=e}setScene(e){this.scene=e??Tj}getScene(){return this.scene}render(e,t){this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.length=0,this.scene.traverse(e=>{e.layers.isEnabled(3)&&e instanceof _A&&(this.originalMaterials.push([e,e.material]),e.material=TG)}),e.shadowMap.needsUpdate=!0,e.shadowMap.autoUpdate=!0),this.camera.layers.enable(8);let i=this.renderToScreen?null:t;e.setRenderTarget(i),this.clearColorOnly&&e.clear(!0,!1,!0),this.clear&&e.clear(),e.render(this.scene,this.camera),this.clearDepth&&e.clear(!1,!0,!1),this.hasTransmissionPass&&this.originalMaterials.forEac
5761h(e=>{e[0].material=e[1]})}dispose(){super.dispose(),this.originalMaterials.length=0,this.scene=void 0,this.camera=void 0}},TW=new nR,Tq=new sl({transparent:!0,vertexShader:` 5762 void main() { 5763 gl_Position = vec4(0.0); 5764 } 5765 `,fragmentShader:` 5766 layout(location = 1) out vec4 gVelocity; 5767 5768 void main() { 5769 gl_FragColor = vec4(0.0); 5770 gVelocity = vec4(0.0); 5771 } 5772 `}),TX=class extends Cq{constructor(e,t){super("DepthFillPass",e??TW,t),this.MRTCompatible=!0,this.forcedOn=[],this.ghosted=[],this.needsSwap=!1}setCamera(e){this.camera=e}setScene(e){this.scene=e??TW}render(e,t){let i=this.camera.layers.mask,r=e.shadowMap.autoUpdate;this.forcedOn.length=0,this.ghosted.length=0;try{this.scene.traverse(e=>{if(!(e instanceof _A))return;let t=Array.isArray(e.material)?e.material:[e.material];if(e.layers.isEnabled(3)||t.some(e=>e instanceof MT&&e.getLayersOfType("transmission").length>0)){this.ghosted.push([e,e.material]),e.material=Tq;return}for(let e of t)e instanceof MT&&e.transparent&&!e.depthWrite&&(e.depthWrite=!0,this.forcedOn.push(e))}),this.camera.layers.enable(3),this.camera.layers.enable(8),e.shadowMap.autoUpdate=!1,e.setRenderTarget(t),e.state.buffers.color.setMask(!1),e.render(this.scene,this.camera)}finally{for(let t of(e.state.buffers.color.setMask(!0),e.shadowMap.autoUpdate=r,this.camera.layers.mask=i,this.forcedOn))t.depthWrite=!1;for(let[e,t]of this.ghosted)e.material=t;this.forcedOn.length=0,this.ghosted.length=0}}dispose(){super.dispose(),this.forcedOn.length=0,this.ghosted.length=0,this.scene=void 0,this.camera=void 0}},TY=class{constructor(e,{depthBuffer:t=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:a=0}={}){this.renderer=e,this.helperStartIndex=0,this.copyPass=new CX,this.depthTexture=null,this.timer=new Ts,this._width=1,this._height=1,this.passes=[],this.helperPasses=[],this.autoRenderToScreen=!0,this.inputBuffer=this.createBuffer(t,i,a,r,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(t,i,a,r,!1," input buffer single"),this.inputBufferSingle.texture.dispose(),this.inputBufferSingle.depthTexture.dispose(),this.inputBufferSingle.texture=this.inputBuffer.texture[0],this.inputBufferSingle.depthTexture=this.inputBuffer.depthTexture,this.outputBuffer=this.inputBuffer.clone(),this.outputBuffer.name="output buffer mrt",this.outputBufferSingle=this.createBuffer(t,i,a,r,!1,"output buffer single"),this.outputBufferSingle.texture.dispose(),this.outputBufferSingle.depthTexture.dispose(),this.outputBufferSingle.texture=this.outputBuffer.texture[0],this.outputBufferSingle.depthTexture=this.outputBuffer.depthTexture,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){let t=this.inputBuffer,i=this.multisampling;i>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("creating new input buffer"),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){let t=e.getSize(new t9),i=e.getContext().getContextAttributes()?.alpha??!1,r=this.inputBuffer.texture[0].type;for(let a of(1009===r&&3001===e.outputEncoding&&(this.inputBuffer.texture[0].encoding=3001,this.outputBuffer.texture[0].encoding=3001,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),e.autoClear=!1,this.setSize(t.width,t.height,!1),this.passes))a.initialize(e,i,r)}}replaceRenderer(e,t=!0){let i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(e),t&&null!==r&&(r.removeChild(i.domElement),r.appendChild(e.domElement)),i}createDepthTexture(){let e=this.depthTexture=new nC(this._width,this._height);return this.inputBuffer.depthTexture=e,this.inputBuffer.stencilBuffer?(e.format=1027,e.type=1020):e.type=1014,e}deleteDepthTexture(){if(null!==this.depthTexture)for(let e of(this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose(),this.passes))e.setDepthTexture(null)}createBuffer(e,t,i,r,a,o){let l=this.renderer,h=null===l?new t9:l.getDrawingBufferSize(new t9),c={minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,stencilBuffer:t,depthBuffer:e},d;return r>0?(d=new iM(h.width,h.height,c)).samples=r:(a?(d=new iT(h.width,h.height,2,c)).texture[1].type=1016:d=new iM(h.width,h.height,c),d.depthTexture=new nC(2048,2048),d.depthTexture.type=1015),1009===i&&null!==l&&3001===l.outputEncoding&&(Array.isArray(d.texture)?d.texture.forEach(e
5772=>e.encoding=3001):d.texture.encoding=3001),Array.isArray(d.texture)?d.texture.forEach((e,t)=>{e.name=`EffectComposer.Buffer ${a} ${t}`,e.generateMipmaps=!1}):(d.texture.name=`EffectComposer.Buffer ${a}`,d.texture.generateMipmaps=!1),d.name=o,d}addPass(e,t){let i=this.passes,r=this.renderer,a=r.getDrawingBufferSize(new t9),o=r.getContext().getContextAttributes()?.alpha??!1,l;if(e.MRTCompatible&&(l=this.inputBuffer.texture[0].type),e.MRTCompatible||(l=this.inputBuffer.texture.type),e.setRenderer(r),e.setSize(a.width,a.height),e.initialize(r,o,l),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?i.splice(t,0,e):i.push(e),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture){if(null===this.depthTexture){let t=this.createDepthTexture();for(e of i)e.setDepthTexture(t)}else e.setDepthTexture(this.depthTexture)}}setHelperStartIndex(e){this.helperStartIndex=e}removePass(e){let t=this.passes,i=t.indexOf(e);-1!==i&&t.splice(i,1).length>0&&(null!==this.depthTexture&&(t.reduce((e,t)=>e||t.needsDepthTexture,!1)||e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null)),this.autoRenderToScreen&&i===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0)))}removeAllPasses(){let e=this.passes;e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){let t=this.renderer,i=this.copyPass,r=this.inputBuffer,a=this.outputBuffer,o=this.inputBufferSingle,l=this.outputBufferSingle,h=!1,c,d,p,f;
5772for(let m of(void 0===e&&(e=this.timer.update().getDelta()),this.passes))m.enabled&&(m.MRTCompatible?m.render(t,r,a,e,h):m.render(t,o,l,e,h),m.needsSwap&&(h&&(i.renderToScreen=m.renderToScreen,c=t.getContext(),(d=t.state.buffers.stencil).setFunc(c.NOTEQUAL,1,4294967295),i.render(t,r,a,e,h),d.setFunc(c.EQUAL,1,4294967295)),p=r,f=o,r=a,o=l,a=p,l=f),m instanceof Ti?h=!0:m instanceof CY&&(h=!1))}setSize(e,t,i){let r=this.renderer;if(this._width=e,this._height=t,void 0===e||void 0===t){let i=r.getSize(new t9);e=i.width,t=i.height}r.setSize(e,t,i);let a=r.getDrawingBufferSize(new t9);for(let e of(this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height),this.inputBufferSingle.setSize(a.width,a.height),this.outputBufferSingle.setSize(a.width,a.height),this.passes))e.setSize(a.width,a.height)}reset(){let e=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(e)}dispose(){for(let e of this.passes)e.dispose();this.passes=[],null!==this.inputBuffer&&this.inputBuffer.dispose(),null!==this.outputBuffer&&this.outputBuffer.dispose(),null!==this.inputBufferSingle&&this.inputBufferSingle.dispose(),null!==this.outputBufferSingle&&this.outputBufferSingle.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}},TQ=new sl({name:"CombineMaterial",uniforms:{inputBufferA:new lG(null),inputBufferB:new lG(null)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:` 5773varying vec2 vUv; 5774void main() { 5775 gl_Position = vec4(position.xy, 1.0, 1.0); 5776 vUv = position.xy * 0.5 + 0.5; 5777} 5778`,fragmentShader:` 5779 varying vec2 vUv; 5780 uniform sampler2D inputBufferA; 5781 uniform sampler2D inputBufferB; 5782 5783 // TODO: Why do we need these when postpro of framemode is enabled??? 5784 layout(location = 1) out vec4 gVelocity; 5785 5786 void main() { 5787 vec4 resA = texture2D(inputBufferA, vUv); 5788 vec4 resB = texture2D(inputBufferB, vUv); 5789 float a = resA.a + resB.a * ( 1.0 - resA.a ); 5790 5791 vec4 res; 5792 res.rgb = resA.rgb + (resB.rgb * (1.0 - resA.a)); 5793 res.a = resA.a + resB.a * (1.0 - resA.a); 5794 gl_FragColor = res; 5795 gVelocity = vec4(0.0); 5796 } 5797`}),TZ=class extends Cq{constructor(e){super("HelperPass",void 0,e),this.MRTCompatible=!1,this.fullscreenMaterial=TQ,this.helperPass=new TH(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new TH(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let t=new Tb({preset:Tx.LOW,edgeDetectionMode:2});this.effectPass=new C9(this.camera,t),this.rt=new iM(10,10,{minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!0})}setSize(e,t){this.rt.setSize(e,t),this.effectPass.setSize(e,t)}set sceneHelpers(e){this.helperPass.setScene(e)}get sceneHelpers(){return this.helperPass.getScene()}set sceneHelpersOnTop(e){this.helperPassOnTop.setScene(e)}get sceneHelpersOnTop(){return this.helperPassOnTop.getScene()}setCamera(e){this.helperPass.setCamera(e),this.helperPassOnTop.setCamera(e)}initialize(e,t,i){super.initialize(e,t,i),this.effectPass.initialize(e,t,i)}dispose(){super.dispose(),this.rt.dispose(),this.effectPass.dispose(),this.helperPass.dispose(),this.helperPassOnTop.dispose()}render(e,t,i){this.rt.depthTexture=t.depthTexture;let r=e.getClearAlpha();e.setClearAlpha(0),this.helperPass.clearDepth=!0,this.helperPass.clearColorOnly=!0,this.helperPass.render(e,this.rt),this.helperPassOnTop.render(e,this.rt),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.rt,i),this.fullscreenMaterial.uniforms.inputBufferA.value=i.texture,this.fullscreenMaterial.uniforms.inputBufferB.value=t.texture,e.setClearAlpha(r),e.setRenderTarget(null),e.clear(),e.render(this.scene,this.camera)}},TK=`#define GLSLIFY 1 5798out vec2 v_uv;void main(){v_uv=uv;gl_Position=vec4(position.xy,1.0,1.0);}`,TJ=`precision highp float;precision highp int;precision highp sampler2D; 5799#define GLSLIFY 1 5800in vec2 v_uv;const float pi=3.14159265;const float num_steps=4.0;const float num_directions=4.0;uniform float near;uniform float far;uniform float fov;uniform vec4 proj_info;uniform bool is_ortho;uniform vec2 resolution;uniform float radius_of_influence;uniform float radius_in_screen_space;uniform float exponent;uniform vec3 ao_color;uniform float bias;uniform sampler2D texture_depth;uniform sampler2D texture_normals;uniform sampler2D texture_blue_noise;uniform sampler2D texture_blue_noise_in_disk;uniform sampler2D texture_color_pass;uniform int frame_index;uniform bool fog_enabled;uniform float fog_near;uniform float fog_far;vec3 uv_to_view_space(vec2 uv,float eye_z){return vec3((uv*proj_info.xy+proj_info.zw)*(is_ortho ? 1.0 : eye_z),eye_z);}float linearize_depth(float depth_sampled){float z=is_ortho ? depth_sampled : depth_sampled*2.0-1.0;return mix((2.0*near*far)/(far+near-z*(far-near)),near+z*(far-near),float(is_ortho));}vec3 get_view_position(vec2 uv_coords){float linear_depth=linearize_depth(texture(texture_depth,uv_coords).x);return uv_to_view_space(uv_coords,linear_depth);}vec3 min_difference(vec3 p,vec3 right,vec3 left){vec3 v1=right-p;vec3 v2=p-left;return(dot(v1,v1)<dot(v2,v2))? v1 : v2;}vec3 rebuild_normal(in vec2 uv,in vec3 p){vec2 one_over_resolution=1.0/resolution;vec3 r=get_view_position(uv+vec2(one_over_resolution.x,0));vec3 l=get_view_position(uv+vec2(-one_over_resolution.x,0));vec3 t=get_view_position(uv+vec2(0,one_over_resolution.y));vec3 b=get_view_position(uv+vec2(0,-one_over_resolution.y));return normalize(cross(min_difference(p,r,l),min_difference(p,t,b)));}float falloff(float distance_squared){float neg_inv_r2=-1.0/(radius_of_influence*radius_of_influence);return distance_squared*neg_inv_r2+1.0;}float ao_contribution(vec3 P,vec3 N,vec3 S){vec3 to_sample=S-P;float norm_squared=dot(to_sample,to_sample);float norm=sqrt(norm_squared);float cos_theta=dot(N,to_sample)/norm;return clamp(cos_theta-bias,0.0,1.0)*clamp(falloff(norm_squared),0.0,1.0);}float compute_ambient_occlusion(vec2 uv,float radius_in_screen_space,vec3 pc,vec3 view_space_n){vec2 one_over_resolution=1.0/resolution;ivec2 noise_uv=ivec2(gl_FragCoord.xy)&ivec2(127);float noise=texelFetch(texture_blue_noise,noise_uv,0).r;noise=fract(noise+0.61803398875*float(frame_index));float theta=noise*2.0*3.1415;float ct=cos(theta);float st=sin(theta);float step_size=radius_in_screen_space/(num_steps+1.0);const float angle_step=2.0*pi/num_directions;float contribution=0.0;for(int i=0;i<int(num_directions);++i){float current_pixel=step_size+1.0;for(int j=0;j<int(num_steps);++j){int index=i*int(num_steps)+j;vec2 blue_noise_sample=texelFetch(texture_blue_noise_in_disk,ivec2(index,0),0).rg;vec2 disk_point;disk_point.x=blue_noise_sample.x*ct-blue_noise_sample.y*st;disk_point.y=blue_noise_sample.x*st+blue_noise_sample.y*ct;vec2 sample_direction=disk_point;vec2 snapped_uv=round(current_pixel*sample_direction)*one_over_resolution+uv;vec3 ps=get_view_position(snapped_uv);current_pixel+=step_size;contribution+=ao_contribution(pc,view_space_n,ps);}}float mult=1.0/(1.0-bias);contribution*=mult/(num_directions*num_steps);return clamp(1.0-contribution*2.0,0.0,1.0);} 5801#define USE_GBUFFER_NORMALS 5802void main(){vec3 view_space_p=get_view_position(v_uv); 5803#ifdef USE_GBUFFER_NORMALS 5804vec3 view_space_n=texture(texture_normals,v_uv).rgb;view_space_n.z*=-1.0; 5805#else 5806vec3 view_space_n=-rebuild_normal(v_uv,view_space_p); 5807#endif 5808float radius_ss=radius_in_screen_space/(is_ortho ? 1.0 : view_space_p.z);float ao=compute_ambient_occlusion(v_uv,radius_ss,view_space_p,view_space_n);float final=pow(ao,exponent);if(view_space_p.z>
5808=far){final=1.0;}vec3 color=mix(ao_color,vec3(1.0),final);if(fog_enabled){float fog_factor=smoothstep(fog_near,fog_far,view_space_p.z);color=mix(color,vec3(1.0),fog_factor);}gl_FragColor=vec4(color,1.0);}`,T$=`#define GLSLIFY 1 5809out vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}`,T0=`#define GLSLIFY 1 5810in vec2 v_uv;uniform sampler2D texture_ao_lrez;uniform sampler2D texture_depth_lrez;uniform sampler2D texture_depth_hrez;uniform float near;uniform float far;float linearize_depth(float depth_sampled){float z=depth_sampled*2.0-1.0;return(2.0*near*far)/(far+near-z*(far-near));}vec2 nearest_depth_filter(in vec2 uv){vec2 resolution=vec2(textureSize(texture_depth_lrez,0));vec2 texel_size=1.0/resolution;vec2 offset=uv-0.5*texel_size;float d_hrez=texture(texture_depth_hrez,uv).r;float a=abs(d_hrez-texture(texture_depth_lrez,offset).r);float b=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,0.0)).r);float c=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(0.0,texel_size.y)).r);float d=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,texel_size.y)).r);float min_diff=min(a,min(b,min(c,d)));if(min_diff==a)return offset;if(min_diff==b)return offset+vec2(texel_size.x,0.0);if(min_diff==c)return offset+vec2(0.0,texel_size.y);if(min_diff==d)return offset+vec2(texel_size.x,texel_size.y);}void main(){ 5811#ifdef DEBUG 5812float d_lrez=texture(texture_depth_lrez,v_uv).r;float d_hrez=texture(texture_depth_hrez,v_uv).r;float output_d=mix(linearize_depth(d_lrez)/far,linearize_depth(d_hrez)/far,step(0.5,v_uv.x));gl_FragColor=vec4(vec3(output_d),1.0); 5813#else 5814vec2 filtered_uv=nearest_depth_filter(v_uv);vec4 ao=texture(texture_ao_lrez,filtered_uv);gl_FragColor=vec4(ao.rgb,1.0);gl_FragColor=ao; 5815#endif 5816}`,T1=[[.478712,.875764],[-.337956,-.793959],[-.955259,-.028164],[.864527,.325689],[.209342,-.395657],[-.106779,.672585],[.156213,.235113],[-.413644,-.082856],[-.415667,.323909],[.141896,-.93998],[.954932,-.182516],[-.766184,.410799],[-.434912,-.458845],[.415242,-.078724],[.728335,-.491777],[-.058086,-.066401],[.20299,.686837],[-.808362,-.556402],[.507386,-.640839],[-.723494,-.22924],[.48974,.317826],[-.622663,.765301],[-.01064,.929347],[.663146,.647618],[-.096674,-.413835],[.525945,-.321063],[-.122533,.366019],[.195235,-.687983],[-.563203,.098748],[.418563,.561335],[-.378595,.800367],[.826922,.001024],[-.085372,-.766651],[-.92192,.183673],[-.590008,-.721799],[.167751,-.164393],[.032961,-.56253],[.6329,-.107059],[-.46408,.569669],[-.173676,-.958758],[-.242648,-.234303],[-.275362,.157163],[.382295,-.795131],[.562955,.115562],[.190586,.470121],[.770764,-.297576],[.237281,.93105],[-.666642,-.455871],[-.905649,-.298379],[.33952,.157829],[.701438,-.7041],[-.062758,.160346],[-.220674,.957141],[.642692,.432706],[-.77339,-.015272],[-.671467,.24688],[.158051,.062859],[.806009,.527232],[-.05762,-.247071],[.333436,-.51671],[-.550658,-.315773],[-.652078,.589846],[.008818,.530556],[-.210004,.519896]],T2=new sl({vertexShader:`#define GLSLIFY 1 5817#include <skinning_pars_vertex> 5818#include <morphtarget_pars_vertex> 5819out vec3 n;void main(){ 5820#include <beginnormal_vertex> 5821#include <morphnormal_vertex> 5822#include <skinbase_vertex> 5823#include <skinnormal_vertex> 5824#include <defaultnormal_vertex> 5825#include <begin_vertex> 5826#include <morphtarget_vertex> 5827#include <skinning_vertex> 5828vec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}`,fragmentShader:`#define GLSLIFY 1 5829in vec3 n;void main(){gl_FragColor=vec4(n,1.0);}`}),T3=new sl({vertexShader:T$,fragmentShader:T0,uniforms:{texture_ao_lrez:new lG(null),texture_depth_lrez:new lG(null),texture_depth_hrez:new lG(null),near:new lG(null),far:new lG(null)}}),T4=class extends Cq{constructor(e,t){super("AmbientOcclusionPass",void 0,t),this.fogEnabled=!1,this.fogNear=1,this.fogFar=1e3,this.frameIndex=0,this.sanitizeViewport=!1,this._runHalfRes=!0,this._width=1,this._height=1,this.gBuffer=new iM(1024,1024,{type:pp?1016:1015,depthTexture:new nC(1024,1024),minFilter:1006,magFilter:1006}),this.depthBufferHighRes=new iM(1024,1024,{depthTexture:new nC(1024,1024)}),this.aoBuffer=new iM(1024,1024,{minFilter:1006,magFilter:1006}
5829),this.splineScene=e,this.splineCamera=t;let i=new Float32Array(2*T1.length);for(let e=0;e<T1.length;e++){let t=2*e;i[t+0]=T1[e][0],i[t+1]=T1[e][1]}this.blueNoiseInDiskTexture=new nN(i,T1.length,1,1030,1015),this.blueNoiseInDiskTexture.wrapS=1e3,this.blueNoiseInDiskTexture.wrapT=1e3,this.blueNoiseInDiskTexture.needsUpdate=!0,this.hbaoMaterial=new sl({vertexShader:TK,fragmentShader:TJ,uniforms:{near:new lG(null),far:new lG(null),fov:new lG(null),proj_info:new lG(new iA),is_ortho:new lG(!1),resolution:new lG(new t9),radius_of_influence:new lG(8),radius_in_screen_space:new lG(1),exponent:new lG(1),ao_color:new lG(new iD),bias:new lG(.5),texture_depth:new lG(null),texture_normals:new lG(null),texture_blue_noise:new lG(null),texture_blue_noise_in_disk:new lG(this.blueNoiseInDiskTexture),frame_index:new lG(0),fog_enabled:new lG(!1),fog_near:new lG(1),fog_far:new lG(1e3)}}),this.radius=128,this.aoColor={r:0,g:0,b:0},this.bias=.5,this.hbaoMaterial.uniforms.texture_depth.value=this.gBuffer.depthTexture,this.hbaoMaterial.uniforms.texture_normals.value=this.gBuffer.texture,this.needsSwap=!0,this.aaBuffer=new iM(1024,1024,{minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!1,type:1015});let r=new Tb({preset:Tx.ULTRA,edgeDetectionMode:2});this.effectPass=new C9(this.camera,r)}initialize(e,t,i){super.initialize(e,t,i),this.effectPass.initialize(e,t,i)}setBlueNoiseTexture(e){this.hbaoMaterial.uniforms.texture_blue_noise.value=e}setSize(e,t){this._width=e,this._height=t,this.depthBufferHighRes.setSize(e,t);let i=this._runHalfRes?.5:1,r=e*i,a=t*i;this.gBuffer.setSize(r,a),this.aoBuffer.setSize(r,a),this.hbaoMaterial.uniforms.resolution.value.set(r,a),this.aaBuffer.setSize(r,a),this.effectPass.setSize(r,a)}get runHalfRes(){return this._runHalfRes}set runHalfRes(e){this._runHalfRes=e,this.setSize(this._width,this._height)}setCamera(e){this.splineCamera=e}setScene(e){this.splineScene=e}setDepthTexture(e){this.depthBufferHighRes.depthTexture=e,T3.uniforms.texture_depth_hrez.value=e,T3.needsUpdate=!0}render(e,t,i){let r=null,a=null,o=null,l=null,h=t=>{e.setViewport(0,0,t.width,t.height)};this.sanitizeViewport&&(r=new iA,a=new iA,e.getViewport(r),e.getScissor(a),o=e.getScissorTest(),l=e.getRenderTarget(),e.setScissorTest(!1)),this.splineScene.overrideMaterial=T2;let c=this.splineCamera.layers.mask;if(this.splineCamera.layers.set(5),e.setRenderTarget(this.gBuffer),this.sanitizeViewport&&h(this.gBuffer),e.clear(),e.render(this.splineScene,this.splineCamera),e.setRenderTarget(this.depthBufferHighRes),this.sanitizeViewport&&h(this.depthBufferHighRes),e.clear(),e.render(this.splineScene,this.splineCamera),this.splineScene.overrideMaterial=null,this.splineCamera.layers.mask=c,this.hbaoMaterial.uniforms.radius_of_influence.value=this.radius,this.hbaoMaterial.uniforms.ao_color.value.set(this.aoColor.r,this.aoColor.g,this.aoColor.b),this.hbaoMaterial.uniforms.bias.value=this.bias,this.hbaoMaterial.uniforms.fog_enabled.value=this.fogEnabled,this.hbaoMaterial.uniforms.fog_near.value=this.fogNear,this.hbaoMaterial.uniforms.fog_far.value=this.fogFar,this.hbaoMaterial.uniforms.frame_index.value=this.frameIndex,this.frameIndex++,this.splineCamera.isPerspectiveCamera){this.hbaoMaterial.uniforms.near.value=this.splineCamera.perspCamera.near,this.hbaoMaterial.uniforms.far.value=this.splineCamera.perspCamera.far;let e=this.splineCamera.perspCamera.projectionMatrix.elements,t=2/e[0],i=2/e[5],r=-(1-e[8])/e[0],a=-(1+e[9])/e[5];this.hbaoMaterial.uniforms.proj_info.value.set(t,i,r,a);let o=this.splineCamera.perspCamera.fov*(Math.PI/180),l=this.hbaoMaterial.uniforms.resolution.value.y/(2*Math.tan(.5*o)),h=.5*this.hbaoMaterial.uniforms.radius_of_influence.value*l;this.hbaoMaterial.uniforms.radius_in_screen_space.value=h,this.hbaoMaterial.uniforms.is_ortho.value=!1}else{this.hbaoMaterial.uniforms.near.value=this.splineCamera.orthoCamera.near,this.hbaoMaterial.uniforms.far.value=this.splineCamera.orthoCamera.far;let e=this.splineCamera.orthoCamera.projectionMatrix.elements,t=2/e[0],i=2/e[5],r=-(1+e[12])/e[0],a=-(1-e[13])/e[5];this.hbaoMaterial.uniforms.proj_info.value.set(t,i,r,a);let o=this.hbaoMaterial.uniforms.resolution.value.y/i*.5,l=this.hbaoMaterial.uniforms.radius_of_influence.value*o;this.hbaoMaterial.uniforms.radius_in_screen_space.value=l,this.hbaoMaterial.uniforms.is_ortho.value=!0}let d=e.aoRenderTarget;this.runHalfRes?(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aoBuffer),this.sanitizeViewport&&h(this.aoBuffer),e.clear(),e.render(this.scene,this.camera),this.fullscreenMaterial=T3,T3.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,T3.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,T3.uniforms.texture_depth_hrez.value=this.depthBufferHighRes.depthTexture,e.setRenderTarget(d),this.sanitizeViewport&&h(d),e.clear(),e.render(this.scene,this.camera)):(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aaBuffer),this.sanitizeViewport&&h(this.aaBuffer),e.clear(),e.render(this.scene,this.camera),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.aaBuffer,d)),this.sanitizeViewport&&r&&a&&null!==o&&(e.setRenderTarget(l),e.setViewport(r.x,r.y,r.z,r.w),e.setScissor(a.x,a.y,a.z,a.w),e.setScissorTest(o))}dispose(){super.dispose(),this.gBuffer.dispose(),this.depthBufferHighRes.dispose(),this.aoBuffer.dispose(),this.aaBuffer.dispose(),this.effectPass.dispose(),this.hbaoMaterial.dispose(),this.blueNoiseInDiskTexture.dispose(),this.splineScene=null,this.splineCamera=null}},T5=` 5830varying vec2 vUv; 5831void main() { 5832 vUv = uv; 5833 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5834}`,T6=` 5835uniform sampler2D tInput; 5836uniform sampler2D tMap; 5837uniform vec2 resolution; 5838varying vec2 vUv; 5839 5840uniform vec2 uResolution; 5841uniform vec2 uCoords; 5842 5843// Draws a rectangle at center <st> with size <size> 5844float rectangle(vec2 st, vec2 size) { 5845 size = vec2(0.5) - size * 0.5; 5846 vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y)); 5847 uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y)); 5848 5849 return uv.x * uv.y; 5850} 5851 5852uniform vec2 uSize; 5853uniform float uScale; 5854uniform float uDPR; 5855uniform float uCurrent; 5856uniform vec3 uSceneColor; 5857 5858void main() { 5859 vec2 screenUv = gl_FragCoord.xy / uResolution.xy; 5860 screenUv *= 1.0 / uDPR; 5861 5862 vec2 center = vec2(0.5, -0.5); 5863 vec2 outsideUv = screenUv; 5864 outsideUv += center; 5865 outsideUv -= uCoords.xy / uResolution.xy; 5866 outsideUv = (outsideUv - 0.5) + 0.5; 5867 outsideUv -= center; 5868 vec2 s = (uSize / uResolution) * uScale; 5869 float isOutside = 1.0 - rectangle(outsideUv, s); 5870 5871 vec2 mid = vec2(0.5); 5872 vec2 insideUv = (screenUv - mid + s * mid) / s; 5873 vec4 background = texture2D(tInput, screenUv); 5874 vec4 image = texture2D(tMap, insideUv); 5875 gl_FragColor = mix(image, background, isOutside); 5876} 5877`,T8=class extends Tr{constructor(){super(new sl({vertexShader:T5,fragmentShader:T6,uniforms:{tInput:new lG(null),tMap:new lG(null),uResolution:new lG(new t9),uSize:new lG(new t9),uCoords:new lG(new t9),uScale:new lG(1),uSceneColor:new lG(new iv(16711680)),uDPR:new lG(1),uCurrent:ne
5877w lG(0)}}),"tInput"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tMap.value}set texture(e){this.uniforms.tMap.value=e}},T9=` 5878void main() { 5879 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5880}`,T7=` 5881uniform sampler2D toScene; 5882uniform sampler2D fromScene; 5883uniform vec2 resolution; 5884 5885uniform vec2 uResolution; 5886uniform float uDPR; 5887 5888uniform float mixRatio; 5889uniform sampler2D tMixTexture; 5890uniform int useTexture; 5891uniform float threshold; 5892 5893void main() { 5894 vec2 screenUv = gl_FragCoord.xy / uResolution.xy; 5895 screenUv *= 1.0 / uDPR; 5896 5897 vec4 texel1 = texture2D( fromScene, screenUv ); 5898 vec4 texel2 = texture2D( toScene, screenUv ); 5899 5900 if (useTexture==1) { 5901 5902 vec4 transitionTexel = texture2D( tMixTexture, screenUv ); 5903 float r = mixRatio * (1.0 + threshold * 2.0) - threshold; 5904 float mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0); 5905 5906 gl_FragColor = mix( texel1, texel2, mixf ); 5907 } else { 5908 5909 gl_FragColor = mix( texel1, texel2, mixRatio ); 5910 5911 } 5912} 5913`,Pe=class extends Tr{constructor(){super(new sl({vertexShader:T9,fragmentShader:T7,uniforms:{toScene:new lG(null),fromScene:new lG(null),uResolution:new lG(new t9),uDPR:new lG(1),mixRatio:new lG(0),threshold:new lG(.1),useTexture:new lG(0),tMixTexture:{value:[][0]}}}),"toScene"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.fromScene.value}set texture(e){this.uniforms.fromScene.value=e}},Pt=` 5914void main() { 5915 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5916}`,Pi=` 5917uniform sampler2D inputBuffer; 5918uniform sampler2D blurredInputBuffer; 5919uniform sampler2D overlay; 5920uniform float blurIntensity; 5921 5922uniform vec2 uResolution; 5923uniform float uDPR; 5924 5925void main() { 5926 vec2 screenUv = gl_FragCoord.xy / uResolution.xy; 5927 screenUv *= 1.0 / uDPR; 5928 5929 vec4 texel1 = texture2D( overlay, screenUv ); 5930 vec4 texel2 = texture2D( inputBuffer, screenUv ); 5931 vec4 texel3 = texture2D( blurredInputBuffer, screenUv ); 5932 5933 float blurMask2 = max(sign(texel1.a), 0.0) * blurIntensity; 5934 gl_FragColor = mix( mix(texel2, texel3, blurMask2), texel1, texel1.a ); 5935} 5936`,Pr=class extends Tr{constructor(){super(new sl({vertexShader:Pt,fragmentShader:Pi,uniforms:{inputBuffer:new lG(null),blurredInputBuffer:new lG(null),overlay:new lG(null),uResolution:new lG(new t9),uDPR:new lG(1),blurIntensity:new lG(0)}})),this._blurEnabled=!1,this.blurTarget=new iM(1,1,{minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001}),this.blurPass=new Te({width:window.innerWidth,height:window.innerHeight,kernelSize:Ta.HUGE,resolutionScale:.25}),this.blurPass.renderToScreen=!1,this.uniforms.blurredInputBuffer.value=this.blurTarget.texture}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.overlay.value}set texture(e){this.uniforms.overlay.value=e}setResolution(e,t,i=1){this.uniforms.uResolution.value.set(e,t),this.uniforms.uDPR.value=i,this.blurPass.setSize(e,t),this.blurTarget.setSize(e,t),this.blurPass.setSize(e,t)}get uiCanvas(){return this._uiCanvas}set uiCanvas(e){this._uiCanvas=e,e.texture&&(this.uniforms.overlay.value=e.texture);let t=e.frame;if(t){let e=t.data.backgroundBlur,i=e.radius;this._blurEnabled=e.enabled,this.uniforms.blurIntensity.value=this._blurEnabled?1:0,this.blurPass.scale=i/3}}render(e,t,i,r,a){this._blurEnabled&&(this.blurPass.setDepthTexture(this.getDepthTexture()),this.blurPass.render(e,t,this.blurTarget,r,a)),super.render(e,t,i,r,a)}dispose(){super.dispose(),this.blurTarget.dispose(),this.blurPass.dispose(),this.fullscreenMaterial.dispose(),this._uiCanvas=void 0}},Ps=` 5937varying vec2 vUv; 5938void main() { 5939 vUv = uv; 5940 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5941}`,Pa=` 5942uniform sampler2D tInput; 5943uniform sampler2D tOverlayImage; 5944varying vec2 vUv; 5945uniform vec2 uResolution; 5946uniform vec2 uRightBottom; 5947uniform vec2 uImageSize; 5948uniform float uScale; 5949uniform float uDPR; 5950 5951vec3 blendNormal(vec3 base, vec3 blend) { 5952 return blend; 5953} 5954 5955vec3 blendNormal(vec3 base, vec3 blend, float opacity) { 5956 return (blendNormal(base, blend) * opacity + base * (1.0 - opacity)); 5957} 5958 5959vec4 drawFixedSizeImage(sampler2D image, vec2 screenUV, vec2 imageSize, vec2 imageCoords, vec2 screenSize, float dpr) { 5960 vec2 uv = (screenUV * screenSize * dpr - imageCoords) / (imageSize * dpr); 5961 if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { 5962 return vec4(0.0); 5963 } 5964 return texture2D(image, uv); 5965} 5966 5967void main() { 5968 vec2 screenUV = gl_FragCoord.xy / (uResolution.xy * uDPR); 5969 vec2 imageCoords = vec2(uResolution.x * uDPR - uImageSize.x * uScale * uDPR - uRightBottom.x * uDPR, uRightBottom.y * uDPR); 5970 vec4 background = texture2D(tInput, screenUV); 5971 vec4 image = drawFixedSizeImage(tOverlayImage, screenUV, uImageSize * uScale, imageCoords, uResolution, uDPR); 5972 gl_FragColor = vec4(blendNormal(background.rgb, image.rgb, image.a), max(background.a, image.a)); 5973} 5974`,Pn=class extends Tr{constructor(){super(new sl({vertexShader:Ps,fragmentShader:Pa,uniforms:{tInput:new lG(null),tOverlayImage:new lG(null),uResolution:new lG(new t9),uImageSize:new lG(new t9),uRightBottom:new lG(new t9(20,20)),uScale:new lG(.25),uDPR:new lG(1)}}),"tInput")}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tOverlayImage.value}set texture(e){this.uniforms.tOverlayImage.value=e,this.uniforms.uImageSize.value.set(e.image.width,e.image.height)}};function Po(e,t){return t&&t.enabled&&e.push(t.effect),e}var Pl=e=>Object.values(C2).includes(e)?e:C2.NORMAL,Ph=class extends tX{constructor(e,t){super(),this._needsDOFResize=t,this.postprocessingState=vM.defaultData,this._scene=new nR,this._camera=new Cn,this.effects=new Map,this.blueNoiseTexture=new nN,this._renderToScreen=!0,this._isUIOverlayEnabled=!1,this.clock=new lP,this.renderer=e,this.debug=!1,this.effects.set("bloom",new TE),this.effects.set("chromaticAberration",new TT),this.effects.set("vignette",new TI),this.effects.set("noise",new TO),this.effects.set("colorAverage",new TP),this.effects.set("hueSaturation",new TD),this.effects.set("brightnessContrast",new TC),this.effects.set("depthOfField",new TR),this.effects.set("pixelation",new TL),this.effectComposer=new TY(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new TH(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.depthFillPass=new TX(this.scene,this.camera),this.transmissionPass=new TV(this.scene,this.camera,this.renderer),this.aoPass=new T4(this.scene,this.camera),this.taaPass=new Tk,this.taaPass.renderToScreen=!1,this.helperPass=new TZ(this.camera),this.helperPass.renderToScreen=!1,this.stylesOverlayPass=new T8,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new Pr,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new Pn,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new Pe,this.sceneTransitionPass.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(e){void 0!==e?(this.stylesOverlayPass.texture=e,this.stylesOverlayPass.enabled=!0):this.stylesOverlayPass.enabled=!1}get overlayTexture(){return this.stylesOverlayPass.texture}set sceneHelpers(e){this.helperPass.sceneHelpers=e}get sceneHelpers(){return this.helperPass.sceneHelpers}set sceneHelpersOnTop(e){this.helperPass.sceneHelpersOnTop=e}get sceneHelpersOnTop(){return this.helperPass.sceneHelpersOnTop}get scene(){return this._scene}set scene(e){this._scene=e,this.opaquePass.setScene(e),this.depthFillPass.setScene(e),this.transmissionPass.setScene(e),this.aoPass.setScene(e)}get camera(){return this._camera}set camera(e){let t=this._camera!==e;this._camera=e,this.opaquePass.setCamera(e),this.depthFillPass.setCamera(e),this.transmissionPass.setCamera(e),t&&this.transmissionPass.updatePasses(this.renderer),this.aoPass.setCamera(e),this.helperPass.setCamera(e),this.effects.get("depthOfField").setCamera(e)}updateRenderToScreen(){let e=!1;for(let t=this.effectComposer.passes.length-1;t>=0;t--){let i=this.effectComposer.passes[t];if(!0===i.enabled&&!e&&this._renderToScreen){i.renderToScreen=!0,e=!0;continue}i.renderToScreen=!1}}get isUIOverlayEnabled(){return this._isUIOverlayEnabled}disableUIOverlay(){this._isUIOverlayEnabled=!1}enableUIOverlay(){this._isUIOverlayEnabled=!0}disableHelpers(){this.helperPass.enabled=!1,this.updateRenderToScreen()}enableHelpers(){this.helperPass.enabled=!0,this.updateRenderToScreen()}updateBlueNoiseTexture(e){this.blueNoiseTexture=new nN(e,128,128),this.blueNoiseTexture.wrapS=1e3,this.blueNoiseTexture.wrapT=1e3,this.blueNoiseTexture.minFilter=1003,this.blueNoiseTexture.magFilter=1003,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(e,t,i,r,a,o,l,h){this.aoPass.enabled=e,this.aoPass.radius=t,this.aoPass.bias=i,this.aoPass.aoColor=r,this.aoPass.fogEnabled=a,this.aoPass.fogNear=o,this.aoPass.fogFar=l,!h!==this.aoPass.runHalfRes&&(this.aoPass.runHalfRes=!h)}setTransmissionPassEnabled(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}
5974_initPasses(){if(this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.removeAllPasses(),this.transmissionPass.updatePasses(this.renderer),this.effectComposer.addPass(this.aoPass),this.effectComposer.addPass(this.opaquePass),this.effectComposer.addPass(this.depthFillPass),this.effectComposer.addPass(this.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let e=[this.effects.get("pixelation")].reduce(Po,[]);e.length>0&&(this.uvEffectPass=new C9(this.camera,...e),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("depthOfField"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(Po,[]);if(t.length>0&&(this.effectPass=new C9(this.camera,...t),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&this.effects.get("depthOfField")?.enabled&&void 0!==window)){let e=this.renderer.viewportWidth,t=this.renderer.viewportHeight;this.renderer.setSize(e-1,t-1),this.renderer.setSize(e,t)}}this.effectComposer.addPass(this.stylesOverlayPass),this.effectComposer.addPass(this.uiOverlayPass),this.effectComposer.addPass(this.sceneTransitionPass),this.effectComposer.addPass(this.helperPass),this.effectComposer.addPass(this.logoOverlayPass)}_initCopyPass(){if(this._savePass)return;let e=new t9;this.renderer.getDrawingBufferSize(e),this._rt=new iM(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:1e3,wrapT:1e3}),this._rt.samples=0,this._savePass=new CX(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new CX(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){if(this._renderToScreen===e)return;let t=this.effectComposer;t&&(!0===e?t.removePass(this._savePass):t.addPass(this._savePass),this._renderToScreen=e,this.updateRenderToScreen())}set sceneTransitionFromTexture(e){e!==this.sceneTransitionPass.texture&&(null!==e?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=e)}setWatermark(e){this.logoOverlayPass.enabled=null!==e,e&&(this.logoOverlayPass.texture=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}updatePostprocessing(e){let{enabled:t,...i}=e,r=!1;for(let e of(t!==this.postprocessingState.enabled&&(r=!0),Object.entries(i))){let t=e[1],i=this.effects.get(e[0]);if(i)for(let[e,a]of(i.enabled!==t.enabled&&(r=!0),i.enabled=t.enabled,Object.entries(t)))"blendFunction"===e?i.blendFunction=Pl(a):i[e]=a}this.postprocessingState=e,r&&this._initPasses()}render(){this.depthFillPass.enabled=this.taaPass.enabled||this.postprocessingState.enabled&&this.effects.get("depthOfField")?.enabled===!0,this.effectComposer.render(this.clock.getDelta())}setScissor(e,t,i,r){e instanceof iA?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,i,r),this.effectComposer.outputBuffer.scissor.set(e,t,i,r));let a=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(a),this.effectComposer.outputBuffer.scissor.multiplyScalar(a),this.renderer.setScissor(e,t,i,r)}setScissorTest(e){this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e)}setViewport(e,t,i,r){e instanceof iA?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,i,r),this.effectComposer.outputBuffer.viewport.set(e,t,i,r))}resize(e,t,i){if(this.effectComposer.setSize(e,t,i),this._rt){let i=this.renderer.getPixelRatio();this._rt.setSize(e*i,t*i)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose(),this.blueNoiseTexture.dispose(),this._rt?.dispose(),this.effects.forEac
5974h(e=>e.dispose()),this.effects.clear(),this._scene=void 0,this._camera=void 0,this.renderer=void 0}},Pc=e=>` 5975 5976// PCSS implementation based on: 5977// https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/ 5978// NOTE: This number affects how big the shadow blur can 5979// possibly get. Bigger number == bigger blur, but less precise results 5980 5981const float gPenumbraFilterSize = 80.0; 5982const int gPenumbraSamples = ${e}; 5983const int gShadowSamples = ${e}; 5984const float gShadowSamplesRpc = 1.0f / float(gShadowSamples); 5985 5986#ifdef USE_SHADOWMAP 5987 #if NUM_DIR_LIGHT_SHADOWS > 0 5988 5989 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 5990 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 5991 5992 struct DirectionalLightShadow { 5993 float shadowBias; 5994 float shadowNormalBias; 5995 float shadowRadius; 5996 vec2 shadowMapSize; 5997 }; 5998 5999 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 6000 6001 #endif 6002 6003 #if NUM_SPOT_LIGHT_SHADOWS > 0 6004 6005 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 6006 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ]; 6007 6008 struct SpotLightShadow { 6009 float shadowBias; 6010 float shadowNormalBias; 6011 float shadowRadius; 6012 vec2 shadowMapSize; 6013 }; 6014 6015 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 6016 6017 #endif 6018 6019 #if NUM_POINT_LIGHT_SHADOWS > 0 6020 6021 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 6022 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 6023 6024 struct PointLightShadow { 6025 float shadowBias; 6026 float shadowNormalBias; 6027 float shadowRadius; 6028 vec2 shadowMapSize; 6029 float shadowCameraNear; 6030 float shadowCameraFar; 6031 }; 6032 6033 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 6034 6035 #endif 6036 6037 /* 6038 #if NUM_RECT_AREA_LIGHTS > 0 6039 6040 // TODO (abelnation): create uniforms for area light shadows 6041 6042 #endif 6043 */ 6044 6045float computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius) 6046{ 6047 float penumbra = 1.0; 6048 float blockerDepthAvg = 0.0; 6049 float blockerCount = 0.0; 6050 6051 #pragma unroll_loop_start 6052 for(int i = 0; i < gPenumbraSamples; i ++) 6053 { 6054 vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar; 6055 float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ); 6056 6057 if(depth < compare + 0.0001) 6058 { 6059 blockerDepthAvg += depth; 6060 blockerCount++; 6061 } 6062 } 6063 #pragma unroll_loop_end 6064 6065 if (blockerCount > 0.0) 6066 { 6067 blockerDepthAvg /= blockerCount; 6068 6069 // Compute penumbra 6070 penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg); 6071 penumbra *= penumbra; 6072 penumbra *= 200.0 * penumbraSize[min(index, 5 - 1)]; // Magic number that affects how quickly the penumbra grows 6073 6074 return clamp(penumbra, 0.00, 1.0); 6075 } 6076 return 0.0; 6077} 6078 6079float vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius) 6080{ 6081 float shadow = 0.0f; 6082 6083 // NOTE: When using TAA, we should use screen space interleaved gradient noise 6084 vec2 halton = haltonSequence[frameIndex]; 6085 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 6086 float temporalAngle = temporalOffset * PI2; 6087 6088 float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.); 6089 float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius); 6090 if (penumbra == -1.0) { 6091 return 1.0; 6092 } 6093 6094 #pragma unroll_loop_start 6095 for (int i = 0; i < gShadowSamples; i++) 6096 { 6097 vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; 6098 // Overall blurring offset 6099 vec2 offset = vogelSample * (shadowRadius * 2.); 6100 6101 // Penumbra offset 6102 offset += vogelSample * (penumbra * texelScalar); 6103 6104 shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) ); 6105 } 6106 #pragma unroll_loop_end 6107 6108 return shadow * gShadowSamplesRpc; 6109} 6110 6111 6112 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 6113 6114 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 6115 6116 } 6117 6118 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 6119 6120 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 6121 6122 } 6123 6124 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 6125 6126 float occlusion = 1.0; 6127 6128 vec2 distribution = texture2DDistribution( shadow, uv ); 6129 6130 float hard_shadow = step( compare , distribution.x ); // Hard Shadow 6131 6132 if (hard_shadow != 1.0 ) { 6133 6134 float distance = compare - distribution.x ; 6135 float variance = max( 0.00000, distribution.y * distribution.y ); 6136 float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality 6137 softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed 6138 occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 6139 6140 } 6141 return occlusion; 6142 6143 } 6144 6145 float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 6146 6147 float shadow = 1.0; 6148 6149 shadowCoord.xyz /= shadowCoord.w; 6150 shadowCoord.z += shadowBias; 6151 6152 // if ( something && something ) breaks ATI OpenGL shader compiler 6153 // if ( all( something, something ) ) using this instead 6154 6155 bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); 6156 bool inFrustum = all( inFrustumVec ); 6157 6158 bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); 6159 6160 bool frustumTest = all( frustumTestVec ); 6161 6162 if ( frustumTest ) { 6163 6164 #if defined( SHADOWMAP_TYPE_PCF ) 6165 6166 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 6167 return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius ); 6168 6169 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 6170 6171 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 6172 float dx = texelSize.x; 6173 float dy = texelSize.y; 6174 6175 vec2 uv = shadowCoord.xy;
6176 vec2 f = fract( uv * shadowMapSize + 0.5 ); 6177 uv -= f * texelSize; 6178 6179 shadow = ( 6180 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 6181 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 6182 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 6183 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 6184 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 6185 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 6186 f.x ) + 6187 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 6188 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 6189 f.x ) + 6190 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 6191 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 6192 f.y ) + 6193 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 6194 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 6195 f.y ) + 6196 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 6197 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 6198 f.x ), 6199 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 6200 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 6201 f.x ), 6202 f.y ) 6203 ) * ( 1.0 / 9.0 ); 6204 6205 #elif defined( SHADOWMAP_TYPE_VSM ) 6206 6207 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 6208 6209 #else // no percentage-closer filtering: 6210 6211 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 6212 6213 #endif 6214 6215 } 6216 6217 return shadow; 6218 6219 } 6220 6221 // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D 6222 // vector suitable for 2D texture mapping. This code uses the following layout for the 6223 // 2D texture: 6224 // 6225 // xzXZ 6226 // y Y 6227 // 6228 // Y - Positive y direction 6229 // y - Negative y direction 6230 // X - Positive x direction 6231 // x - Negative x direction 6232 // Z - Positive z direction 6233 // z - Negative z direction 6234 // 6235 // Source and test bed: 6236 // https://gist.github.com/tschw/da10c43c467ce8afd0c4 6237 6238 vec2 cubeToUV( vec3 v, float texelSizeY ) { 6239 6240 // Number of texels to avoid at the edge of each square 6241 6242 vec3 absV = abs( v ); 6243 6244 // Intersect unit cube 6245 6246 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 6247 absV *= scaleToCube; 6248 6249 // Apply scale to avoid seams 6250 6251 // two texels less per square (one texel will do for NEAREST) 6252 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 6253 6254 // Unwrap 6255 6256 // space: -1 ... 1 range for each square 6257 // 6258 // #X## dim := ( 4 , 2 ) 6259 // # # center := ( 1 , 1 ) 6260 6261 vec2 planar = v.xy; 6262 6263 float almostATexel = 1.5 * texelSizeY; 6264 float almostOne = 1.0 - almostATexel; 6265 6266 if ( absV.z >= almostOne ) { 6267 6268 if ( v.z > 0.0 ) 6269 planar.x = 4.0 - v.x; 6270 6271 } else if ( absV.x >= almostOne ) { 6272 6273 float signX = sign( v.x ); 6274 planar.x = v.z * signX + 2.0 * signX; 6275 6276 } else if ( absV.y >= almostOne ) { 6277 6278 float signY = sign( v.y ); 6279 planar.x = v.x + 2.0 * signY + 2.0; 6280 planar.y = v.z * signY - 2.0; 6281 6282 } 6283 6284 // Transform to UV space 6285 6286 // scale := 0.5 / dim 6287 // translate := ( center + 0.5 ) / dim 6288 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 6289 6290 } 6291 6292 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 6293 6294 float shadow = 1.0; 6295 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 6296 6297 // for point lights, the uniform @vShadowCoord is re-purposed to hold 6298 // the vector from the light to the world-space position of the fragment. 6299 vec3 lightToPosition = shadowCoord.xyz; 6300 6301 // dp = normalized distance from light to fragment position 6302 float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp? 6303 compare += shadowBias; 6304 6305 // bd3D = base direction 3D 6306 vec3 bd3D = normalize( lightToPosition ); 6307 6308 vec2 halton = haltonSequence[frameIndex]; 6309 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 6310 float temporalAngle = temporalOffset * PI2; 6311 6312 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM ) 6313 for (int i = 0; i < gShadowSamples; i++) { 6314 vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; 6315 6316 // Overall blurring offset 6317 vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.); 6318 6319 // NOTE: Removed for now 6320 // Penumbra offset 6321 //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y) * (penumbra * gPenumbraFilterSize); 6322 6323 shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare ); 6324 6325 } 6326 return shadow * gShadowSamplesRpc; 6327 6328 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 6329 for (int i = 0; i < 16; i++) { 6330 vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; 6331 6332 // Overall blurring offset 6333 vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.); 6334 6335 shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare ); 6336 6337 } 6338 return shadow * (1.0 / 16.0); 6339 #else // no percentage-closer filtering 6340 6341 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare ); 6342 6343 #endif 6344 6345 } 6346 6347#endif 6348`,Pd=sA.lights_fragment_begin,Pu=sA.shadowmask_pars_fragment,Pp=null,Pf=e=>{switch(e){case"low":return 8;case"medium":default:return 16;case"high":return 32}},Pm=(e="medium")=>{if(Pp===e)return!1;Pp=e;let t=Pf(e);sA.shadowmap_pars_fragment=Pc(t);let i=Pd.slice();i=(i=i.replace("getShadow( spotShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX + 3, spotShadowMap[ i ]")).replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),sA.lights_fragment_begin=i;let r=Pu.slice();return r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),sA.shadowmask_pars_fragment=r,!0},Pg=new sl({vertexShader:` 6349attribute vec3 randomColor; 6350varying vec3 vNormal; 6351flat out vec3 vColor; 6352#include <skinning_pars_vertex> 6353#include <morphtarget_pars_vertex> 6354 6355void main() 6356{ 6357#include <beginnormal_vertex> 6358#include <morphnormal_vertex> 6359#include <skinbase_vertex> 6360#include <skinnormal_vertex> 6361vec3 transformed = vec3(position); 6362#include <morphtarget_vertex> 6363#include <skinning_vertex> 6364 6365vNormal = normal; 6366vColor = randomColor; 6367gl_Position = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0)); 6368} 6369`,fragmentShader:` 6370uniform float depthContrast; 6371varying vec3 vNormal; 6372flat in vec3 vColor; 6373void main() 6374{ 6375vec3 normal = (normalize(vNormal)).rgb; 6376 6377float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5; 6378 6379vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4); 6380gl_FragColor = vec4(resultColor, vColor.r); 6381gl_FragColor = vec4(resultColor, vColor.r); 6382} 6383`,uniforms:{depthContrast:{value:1}}}),Pv=new i_,Py=new t9,Px=class extends nO{constructor(e){super(e),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHe
6383ight=1,this.resolution=new t9,this.dummyCamera=new Cn,this.sceneTransitionDuration=0,this.sceneTransitionTimeRemaining=-1,this.isXRCopyPassSet=!1,this.clear=(e=!0,t=!0,i=!0)=>{let r=this.getContext(),a=0;e&&(a|=r.COLOR_BUFFER_BIT),t&&(a|=r.DEPTH_BUFFER_BIT),i&&(a|=r.STENCIL_BUFFER_BIT),r.clear(a),r.clearBufferfv(r.COLOR,1,[0,0,0,1])},this.pipeline=new Ph(this,e?.needsDOFResize??!1),this.autoClear=!1;let t=this.setPixelRatio.bind(this),i=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=1,this.dummyCamera.matrixAutoUpdate=!1,this.domElement.removeAttribute("data-engine");let r=this.getContext();if(r&&"drawingBufferColorSpace"in r)try{r.drawingBufferColorSpace="display-p3"}catch(e){console.warn(e)}this.setPixelRatio=e=>{this._pixelRatio!==e&&(this._pixelRatio=e,t(e))},this.setSize=(e,t,r=!0)=>{(this.viewportWidth!==e||this.viewportHeight!==t)&&(this.viewportWidth=e,this.viewportHeight=t,i(e,t,r),this.normalRenderTarget?.setSize(e*this._pixelRatio,t*this._pixelRatio),this._resizeTransmission(e,t),this.transmissionDepthTarget?.setSize(e*this._pixelRatio/2,t*this._pixelRatio/2),this.pipeline.resize(e,t,r))},this._superDispose=this.dispose,this.dispose=this._currentDispose}createAORenderTarget(){void 0===this.aoRenderTarget&&(this.aoRenderTarget=new iM(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:1006,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!1}))}_resizeTransmission(e,t){this.transmissionRenderTarget?.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}get hdTransmission(){return 1===AL.transmissionLod.value}set hdTransmission(e){AL.transmissionLod.value=!0===e?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){void 0===this.transmissionRenderTarget&&(this.transmissionRenderTarget=new iM(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:1008,magFilter:1006,wrapS:1001,wrapT:1001,depthBuffer:!1}),this.transmissionDepthTarget=new iM(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:1003,magFilter:1003,depthBuffer:!1}))}createNormalRenderTarget(){void 0===this.normalRenderTarget&&(this.normalRenderTarget=new iM(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:1003,magFilter:1003,type:1015,depthTexture:new nC(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}))}renderNormal(e,t,i){this.normalRenderTarget&&(this.setClearColor(0),i.layers.enable(8),i.layers.disable(0),i.layers.disable(3),t.traverseEntity(e=>{e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!1)}),this.setRenderTarget(this.normalRenderTarget),this.clear(),i instanceof Cn?Pg.uniforms.depthContrast.value=(i.far-i.near)/1e4:Pg.uniforms.depthContrast.value=1,t.overrideMaterial=Pg,this.render(t,i),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?OD:null,i.layers.enable(0),i.layers.enable(3),t.traverseEntity(e=>{e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!0)}))}renderSplineSceneWithDummyCamera(e,t,i=1){this.dummyCamera.updateCameraState(t.dataPatched),this.dummyCamera.matrix.copy(t.matrixWorld);let r=t.height,a=t.width,o=this.viewportWidth/this.viewportHeight;a<r?a=r*o:r=a/o,this.dummyCamera.setViewplaneSize(a,r);for(let t=0;t<i;t++)this.renderSplineScene(e,this.dummyCamera)}renderSplineScene(e,t,{sceneHelpers:i=this.sceneHelpers,sceneHelpersOnTop:r=this.sceneHelpersOnTop,overrideTransmission:a,overrideNormal:o}={}){let l=e instanceof OI?e.activePage:e,h=l.visible;l.visible=!0;let c=l.scene;this.xr.enabled&&(!1===this.isXRCopyPassSet&&null!==this.getRenderTarget()&&(this.pipeline.setCopyPass(this.getRenderTarget()),this.isXRCopyPassSet=!0),this.xr.updateCamera(t)),this.setClearColor(l.bgColor,l.bgColor.a),l.penumbraSizeArray.forEach((e,t)=>{AL.penumbraSize.value[t]=e}),AL.pixelRatioNode.value=this.getPixelRatio(),0!==this.resolution.x&&0!==this.resolution.y?AL.resolution.value.set(this.resolution.x,this.resolution.y):AL.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHe
6383ight*this._pixelRatio),void 0!==o?(AL.normalRenderTarget.value=o,AL.normalRenderTargetDepth.value=Pv):c.needsNormal()&&(this.createNormalRenderTarget(),AL.normalRenderTarget.value=this.normalRenderTarget.texture,AL.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(c,l,t));let d=l.data.ao,p=d.occlusion;if(p&&(this.createAORenderTarget(),AL.aoRenderTarget.value=this.aoRenderTarget.texture),AL.aoEnabled.value=p,this.pipeline.setAmbientOcclusionParams(d.occlusion,d.radius,d.bias,l.aoColor,null!==l.fog,l.backupFog.near,l.backupFog.far,d.aoFullRes&&!pp),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&l.uiCanvas?.enabled&&l.uiCanvas.texture&&l.uiCanvas.texture.image.width>0){let e=this.getSize(Py),t=this.getPixelRatio();(l.uiCanvas.width!==this.viewportWidth||l.uiCanvas.height!==this.viewportHeight||l.uiCanvas.dpr!==t)&&l.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},t),l.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=l.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(e.x,e.y,t),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let e=this.getSize(Py),t=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(e.x,e.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=t}let f=!1;if(void 0!==a)AL.transmissionRenderTarget.value=a,AL.transmissionRenderTargetDepth.value=Pv,this.pipeline.setTransmissionPassEnabled(!1);else{var m,g;let e=c.needsTransmission();e&&(void 0===this.transmissionRenderTarget&&(f=!0),this.createTransmissionRenderTarget(),AL.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,AL.aspectRatio.value=(m=this.viewportWidth)>=(g=this.viewportHeight)?new t9(g/m,1):new t9(1,m/g),AL.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(e)}t.layers.enable(3),t.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=r,this.pipeline.taaPass.enabled=AL.taaEnabled.value,this.pipeline.scene=l,this.pipeline.camera=t,f&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState===l.postprocessing||(this.pipeline.updatePostprocessing(l.postprocessing),i||r||this.pipeline.disableHelpers()),void 0!==this.clearAlphaOverride&&this.setClearAlpha(this.clearAlphaOverride),c.shapeBlendIntances.forEach(e=>{e.onBeforeShadowPass(this)}),l.overrideMaterial=c.wireframeState?OD:null,this.pipeline.render(),AL.taaEnabled.value&&(AL.frameIndex.value=(AL.frameIndex.value+1)%16),t instanceof Cn&&t.copyHistory(),l.visible=h}renderFromSceneForSceneTransitionPass(e,t,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,t),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let r=this.pipeline.sceneTransitionPass.uniforms;r.uDPR.value=window.devicePixelRatio,r.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.aoRenderTarget=void 0,this.transmissionRenderTarget?.dispose(),this.transmissionRenderTarget=void 0,this.transmissionDepthTarget?.dispose(),this.transmissionDepthTarget=void 0,this.normalRenderTarget?.depthTexture?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget=void 0,this.dummyCamera.dispose(),this.dummyCamera=void 0,AL.normalRenderTarget.value=Pv,AL.normalRenderTargetDepth.value=Pv,AL.transmissionRenderTarget.value=Pv,AL.transmissionRenderTargetDepth.value=Pv,AL.aoRenderTarget.value=Pv}},Pb=class extends E$(l5){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){E3(this.object,Pb.geometryHelper,e,t)}}
6383,Pw=class extends E$(l1){constructor(e,t=15,i=6710886){super(e,t,i),this.object=e,this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){E3(this.object,Pw.geometryHelper,e,t)}},PS=class extends E$(l0){constructor(e,t=6710886){super(e,t),this.object=e,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){E3(this.object,PS.geometryHelper,e,t)}update(){if(void 0!==this.object){let e=PS._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=void 0!==this.color?this.color:this.light.color;if(this.cone.material instanceof Array)for(let e=0,t=this.cone.material.length;e<t;e++)this.cone.material[e].color.set(r);else this.cone.material.color.set(r)}}},P_=PS;P_._vector=new iD;var PA=class extends nA{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new r7(new s_(1,1),new rB({transparent:!0,opacity:0,side:2})),this.add(this.caretMesh),this.selectionMesh=new r7(new s_(1,1),new rB({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:2})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(e){this.visible=!0,this.object=e,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=-(.5*this.caretHeight),this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(void 0===this.object)return;this.updateHelperMatrix();let{depth:e}=this.object.geometry.userData.parameters;this.caretMesh.position.z=e,this.selectionMesh.position.z=e}updateHelperMatrix(){if(void 0===this.object)return;let e=this.object,t=e.parent;for(let i of(null!==t&&t.updateWorldMatrix(!0,!1),e.matrixAutoUpdate&&e.updateMatrix(),null!==t?(this.matrixWorld.multiplyMatrices(t.matrixWorld,e.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,e.matrix)):this.matrixWorld.multiplyMatrices(e.hiddenMatrix,e.matrix),this.matrix.copy(this.matrixWorld),this.children))i.matrixWorld.copy(this.matrixWorld);e.updateWorldMatrix(!0,!0)}setCaretColor(e){let t=this.caretMesh.material;t.color.setRGB(e.r,e.g,e.b);let i=this._caretVisibleAlpha===t.opacity;this._caretVisibleAlpha=e.a,i&&(t.opacity=this._caretVisibleAlpha)}setSelectionColor(e){this.selectionMesh.material.color.setRGB(e.r,e.g,e.b)}setCaretPosition(e,t={}){if(void 0===this.object)return;this.caretIndex=e;let i=this.object.wrappedText,[r,a]=PE(i,e),[o,l]=e>0?PE(i,e-1):[null,null];(e>0&&i.length?i[o].charAt(l):null)===` 6384`&&(r++,a=0),this.current.start=e,this.current.end=void 0;let[h,c]=PM(this.object,r,a),{AD:d,descender:p}=this.object,{width:f,height:m,depth:g}=this.object.geometry.userData.parameters;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(h-.5*("string"==typeof f?0:f),c+(p+.5*d)+.5*("string"==typeof m?0:m),g),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(e,t){if(void 0===this.object)return;let i=this.object.wrappedText;this.current.start=e,this.current.end=t;let r=[],a=[],o=function(e,t,i){let[r,a]=PE(e,t),[o,l]=PE(e,i),h=[];a>=e[r].length&&(r++,a=0);for(let t=r;t<=o;t++){let i=e[t],c=t===r?a:0,d=t===o?l:i.length;h.push([t,c,d])}return h}(i,e,t),{lineHeight:l,AD:h,descender:c}=this.object,d=c+.5*h-.5*l;for(let[e,t,i]of o)if(t!==i){let[o,h]=PM(this.object,e,t),[c,p]=PM(this.object,e,i);h+=d,p+=d+l;let f=r.length/3;r.push(o,h,0),r.push(c,h,0),r.push(c,p,0),r.push(o,p,0),a.push(f+0,f+1,f+2),a.push(f+2,f+3,f+0)}let p=new rQ;p.setIndex(a),p.setAttribute("position",new rV(r,3));let{width:f,height:m,depth:g}=this.object.geometry.userData.parameters;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=p,this.selectionMesh.position.x=-(.5*("string"==typeof f?0:f)),this.selectionMesh.position.y=.5*("string"==typeof m?0:m),this.selectionMesh.position.z=g,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(e,t,i="previous"){if(void 0===this.object||void 0===this.object.font)return;let r=this.object.wrappedText,a=r.length,o=this.object.lineHeight,l=a*o,{height:h,verticalAlign:c}=this.object.geometry.userData.parameters,d="string"==typeof h?0:h,p=0;3===c?p=d-l:2===c&&(p=.5*d-.5*l);let f=Math.min(Math.floor(Math.max(Math.min(-t-p,l),0)/o),a-1),m=this.object.charCoords[f],g=this.object.charWidths[f],v=0,y=!1;if("previous"===i){for(let t=0;t<m.length;t++)if(m[t][0]+.5*g[t]-e>0){v=t,y=!0;break}}else if("closest"===i){let t=1/0;for(let i=0;i<m.length;i++){let r=Math.abs(m[i][0]+.5*g[i]-e);r<t&&(t=r,v=i,y=!0)}}else for(let t=0;t<m.length;t++){let i=m[t][0],r=m[t][0]+g[t];if(e>=i&&e<r){v=t,y=!0;break}}return y||(v=m.length),{index:this.getGlobalIndexFromLineAndCharIndexes(r,f,v),lineIndex:f,characterIndex:v}}getGlobalIndexFromLineAndCharIndexes(e,t,i){return e.slice(0,t).reduce((e,t)=>
6384e+=t.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function PM(e,t,i){let{charCoords:r,charWidths:a,initialOffsetY:o,lineHeight:l}=e;if(r[t]&&0===r[t].length||0===r.length){let i=0,{horizontalAlign:r}=e.data.geometry,a=e.wrappedText,{width:h}=e.geometry.userData.parameters;return 1===a.length&&0===a[0].length&&(3===r?i=.5*h:2===r&&(i=h)),[i,o-l*t]}let h=r[t];if(void 0===h||0===h.length)return[0,0];let[c,d]=h[Math.min(i,h.length-1)];return i>=h.length&&(c+=a[t][i-1]),[c,d]}function PE(e,t){let i=0;for(let r=0;r<e.length;r++){let a=e[r],o=t-i;if(o<=a.length)return[r,o];i+=a.length}return[Math.max(0,e.length-1),e[e.length-1]?.length??0]}var PC=class extends Cd(lE,Pb){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let a=new l9(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a}update(){for(let e in this.shadow.camera.updateProjectionMatrix(),this.gizmos){let t=this.gizmos[e];t instanceof l9&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){var i;this.updateState_Light(e,t);let r=void 0!==e.depth&&e.depth!==this.shadow.camera.far||void 0!==e.size&&e.size/2!==this.shadow.camera.right;void 0!==e.size&&(i=e.size,this.shadow.camera.right=i/2,this.shadow.camera.left=-i/2,this.shadow.camera.top=i/2,this.shadow.camera.bottom=-i/2,this.shadow.needsUpdate=!0),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),void 0!==e.penumbraSize&&t.scene.markPenumbraSizeDirty(),r&&this.update()}},PT=new iD,PP=new iD,PD=new iP,PO=class extends Cd(lx,P_){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=2*t8.RAD2DEG*this.angle,r.aspect=1,r.near=100,r.far=2500;let a=new l9(this.shadow.camera);a.visible=!1,this.gizmos.shadowmap=a,this.update()}update(){for(let e in this.shadow.camera.updateProjectionMatrix(),this.gizmos){let t=this.gizmos[e];t instanceof l9&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),PP.setFromMatrixPosition(this.matrixWorld),PD.setFromRotationMatrix(this.matrixWorld),PT.copy(this.up).applyQuaternion(PD).negate().multiplyScalar(this.distance),this.target.position.copy(PP).add(PT),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.angle&&(this.angle=e.angle),void 0!==e.penumbra&&(this.penumbra=e.penumbra),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.penumbraSize&&t.scene.markPenumbraSizeDirty(),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};function PI(e,t){return[[e[0][0]*t[0][0]+e[0][1]*t[1][0],e[0][0]*t[0][1]+e[0][1]*t[1][1]],[e[1][0]*t[0][0]+e[1][1]*t[1][0],e[1][0]*t[0][1]+e[1][1]*t[1][1]]]}function PR(e){return[[e[0][0],e[1][0]],[e[0][1],e[1][1]]]}(e=>{function t(e){return[e[0],e[3],e[1],e[4],e[2],e[5]]}e.identity=function(){return[1,0,0,0,1,0,0,0,1]},e.copy=function(t,i=e.identity()){for(let e=0,r=t.length;e<r;e++)i[e]=t[e];return i},e.create=function(t,i,r,a,o,l){return e.setAbcdef(e.identity(),t,i,r,a,o,l)},e.setAbcdef=function(e,t,i,r,a,o,l){return e[0]=t,e[1]=r,e[2]=o,e[3]=i,e[4]=a,e[5]=l,e},e.append=function(i,r){let[a,o,l,h,c,d]=t(i),[p,f,m,g,v,y]=t(r);return e.create(p*a+f*l,p*o+f*h,m*a+g*l,m*o+g*h,v*a+y*l+c,v*o+y*h+d)},e.prepend=function(i,r){let[a,o,l,h,c,d]=t(i),[p,f,m,g,v,y]=t(r),x=a,b=o,w=l,S=h;return(1!==p||0!==f||0!==m||1!==g)&&(x=a*p+o*m,b=a*f+o*g,w=l*p+h*m,S=l*f+h*g),e.create(x,b,w,S,c*p+d*m+v,c*f+d*g+y)},e.getAbcdef=t,e.invert=function(t){let[i,r,a,o,l,h]=e.getAbcdef(t),c=i*o-r*a;return e.create(o/c,-r/c,-a/c,i/c,(a*h-o*l)/c,-(i*h-r*l)/c)},e.apply=function([t,i],r){let[a,o,l,h,c,d]=e.getAbcdef(r);return[a*t+l*i+c,o*t+h*i+d]},e.applyInverse=function(t,i){let[r,a,o,l,h,c]=e.getAbcdef(i),d=1/(r*l+-(o*a)),[p,f]=t;return[l*d*p+-o*d*f+(c*o-h*l)*d,r*d*f+-a*d*p+(-c*r+h*a)*d]},e.scale=function(t,i,r=i){let[a,o,l,h,c,d]=e.getAbcdef(t);return e.setAbcdef(t,a*i,o*r,l*i,h*r,c*i,d*r),t},e.rotate=function(t,i){let r=Math.cos(i),a=Math.sin(i),[o,l,h,c,d,p]=e.getAbcdef(t);return e.setAbcdef(t,o*r-l*a,o*a+l*r,h*r-c*a,h*a+c*r,d*r-p*a,d*a+p*r),t}
6384,e.rotateAround=function(t,i,r){let[a,o]=r,l=e.translate(t,-a,-o);return l=e.rotate(l,i),l=e.translate(l,a,o)},e.translate=function(t,i,r){let[a,o,l,h,c,d]=e.getAbcdef(t);return e.setAbcdef(t,a,o,l,h,c+i,d+r),t},e.setTranslate=function(t,i,r){let[a,o,l,h]=e.getAbcdef(t);return e.setAbcdef(t,a,o,l,h,i,r),t},e.setPosition=function(t,i,r){let[a,o,l,h]=e.getAbcdef(t);return e.setAbcdef(t,a,o,l,h,i,r),t},e.getScale=function(t){let[i,r,a,o]=e.getAbcdef(t);return[Math.sqrt(i*i+r*r),Math.sqrt(a*a+o*o)]},e.getPosition=function(t){let[,,,,i,r]=e.getAbcdef(t);return[i,r]},e.getRotation=function(t,i){return e.decompose(t,i).rotation},e.decompose=function(t,i){let[r,a,o,l,h,c]=e.getAbcdef(t),{rotation:d,scale:p,shear:f}=function(e){let t,i,r,a,o,l,h,c,d,p,f,m;let[g,v,y]=(t=(e[0][0]+e[1][1])/2,i=(e[0][0]-e[1][1])/2,r=(e[1][0]+e[0][1])/2,o=Math.sqrt(t*t+(a=(e[1][0]-e[0][1])/2)*a),l=Math.sqrt(i*i+r*r),h=Math.atan2(r,i),d=((c=Math.atan2(a,t))-h)/2,f=[[Math.cos(p=(c+h)/2),Math.sin(p)],[-Math.sin(p),Math.cos(p)]],m=[[Math.cos(d),Math.sin(d)],[-Math.sin(d),Math.cos(d)]],f[0][0]*=-1,f[0][1]*=-1,m[0][0]*=-1,m[1][0]*=-1,[f,[[o+l,0],[0,o-l]],m]),x=PI(g,PR(y)),b=PI(PI(y,v),PR(y));return{rotation:Math.atan2(x[1][0],x[0][0]),scale:[b[0][0],b[1][1]],shear:[b[0][1]/b[1][1],b[1][0]/b[0][0]]}}([[r,o],[a,l]]);return{position:[h+(i[0]*r+i[1]*o)-i[0],c+(i[0]*a+i[1]*l)-i[1]],scale:p,rotation:d,shear:f,pivot:i}},e.compose=function(t,i,r,a,o=[0,0]){let[l,h]=t,[c,d]=a,[p,f,m,g]=function({rotation:e,scale:t,shear:i}){let r=Math.cos(e),a=Math.sin(e),o=PI([[r,-a],[a,r]],[[t[0],i[0]*t[1]],[i[1]*t[0],t[1]]]);return[o[0][0],o[1][0],o[0][1],o[1][1]]}({rotation:r,scale:i,shear:o});return e.create(p,f,m,g,l-(c*p+d*m)+c,h-(c*f+d*g)+d)}})(Pz||(Pz={}));var PL,PB,Pz,PF,PN=Math.PI/180,PU=class{constructor(e,t,i){this.uuid=e,this.data=t,this.localMatrix=Pz.identity(),this.worldMatrix=Pz.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new PH,this._recursiveBBox=new PH,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.stateSelection=null,this.prevState=null,this.currentState=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this.name="",this.position=[0,0],this.scale=[1,1],this.rotation=0,this.shear=[0,0],this.emitter=ST(),this.dpr=i.dpr??1,this.dataPatched=t}project(e,t){let i=this.worldMatrix;return t&&(i=Pz.append(t.worldMatrix,i)),Pz.applyInverse(e,i)}intersects(e,t,i,r=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([e,t],i),r)}intersectsInLocalSpace(e,t,i=!1){let{min:r,max:a}=i?this.recursiveBBox:this.singleBBox;return e>=r[0]&&e<=a[0]&&t>=r[1]&&t<=a[1]}applyTransforms(e){e.setTransform(this.worldMatrix,this.ignoreCameraZoom)}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}updateLocalMatrix(){this.localMatrix=Pz.compose(this.position,this.scale,this.rotation*PN,xI.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(e,t,i){let r=this.parent;t&&null!=r&&r.updateWorldMatrix(e,!0,!1),e&&this.updateLocalMatrix(),this.parent?this.worldMatrix=Pz.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=Pz.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return xI.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{e.resetBBoxNeedsUpdateSelf()})}updateTransformState(e){let t=!1;void 0!==e.position&&(t=!0,this.position=e.position),void 0!==e.rotation&&(t=!0,this.rotation=e.rotation),void 0!==e.scale&&(t=!0,this.scale=e.scale),void 0!==e.shear&&(t=!0,this.shear=e.shear),t&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(e,t,i){0===e.type&&void 0!==e.props.visible&&(this.visible=e.props.visible),this.data=t,this.data=t;let r=e,a=fd(e.path,["states","*"]);if(null!==a){if(0===e.type){let[t]=a;if(this?.stateSelection===t){let t={...e.props};if(delete t.name,Object.values(e.props).some(e=>void 0===e)){let i=this.data;if(void 0!==i){let r=fx.zoom(i,e.path.slice(2));if(r)for(let i in e.props)void 0===e.props[i]&&i in r&&(t[i]=r[i])}}r={...e,props:t,path:e.path.slice(2)}}}}else if(0===e.type){let t=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==t){if(void 0!==e.props.name&&t.name){let{name:e,...i}=t;t=i}let i=fx.removeOverridden(e.path,e.props,t);r={...e,props:i}}}this.updateByPatchedOpBase(r,xw.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i)}changeSelectedState(e,t,i=!1){if(!(0===this.data.states.length&&!i)){for(let e of this.data.states)xw.toOps(this.data,e.data).forEac
vendor: 4,150 bytes, line 6384
6384h(e=>{let i=fg.replaceProps(e,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,t)});if(null!==e){let i=this.data.states.data(e);i&&(this.dataPatched=xw.patch(this.data,i),xw.toOps(this.data,i).forEach(e=>{this.updateByPatchedOp(e,this.dataPatched,t)}))}i&&this.updateTransformState(this.dataPatched),this.stateSelection=e}}updateState(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.visible&&(this.visible=e.visible),this.updateTransformState(e)}updateByPatchedOpBase(e,t,i){this.dataPatched=t,this.updateByPatchedOp(e,t,i)}updateByPatchedOp(e,t,i){0===e.path.length&&0===e.type&&this.updateState(e.props,i),this.requestRender()}traverseFrameAncestors(e){this.traverseAncestors(t=>{"frame2d"===t.data.type&&e(t)})}traverseAncestors(e){let t=this.parent;for(;t;)e(t),t=t.parent}requestRender(){this.traverseFrameAncestors(e=>{e.requestRender()})}clone(e){let t=new PU(this.uuid,this.data,e);return t.parent=void 0,t}addEventListener(e,t){this.emitter.on(e,t)}removeEventListener(e,t){this.emitter.off(e,t)}dispatchEvent(e){this.emitter.emit(e.type,{...e,target:e.target??this})}traverseSortNextHelper(){let e=this.parent;if(e){let t=e.children;if(t){let i=t.indexOf(this)+1;return t[i]?t[i]:e.traverseSortNextHelper()}}}sortNext(){let e=this.children;return e&&e.length>0&&e[0]?e[0]:this.traverseSortNextHelper()}isDescendantOf(e){e instanceof PU&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}},Pk=class extends PU{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.context=i,this.children=[]}add(e){e.parent&&e.parent instanceof Pk&&e.parent.remove(e),this.children.push(e),e.parent=this}remove(e){let t=this.children.indexOf(e);t>=0&&(this.children.splice(t,1),e.parent=void 0)}traverse(e){let t=e(this);if(!0!==t)for(let i of this.children)i instanceof Pk?i.traverse(e):t=e(i)}intersectsChildrenHelper(e,t,i,r,a){for(let o of this.children)if(o.intersects(e,t,i,!1)&&(a.push(o),r)||o instanceof Pk&&o.intersectsChildrenHelper(e,t,i,r,a))return!0;return!1}intersectsChildren(e,t,i,r=!1,a=[],o=!1){return this.intersectsChildrenHelper(e,t,i,r,a),a}intersectsChildrenHelperReverse(e,t,i,r,a){for(let o of this.children)if(o instanceof Pk&&o.intersectsChildrenHelperReverse(e,t,i,r,a)||o.intersects(e,t,i,!1)&&(a.push(o),r))return!0;return!1}intersectsChildrenReverse(e,t,i,r=!1,a=[],o=!1){return this.intersectsChildrenHelperReverse(e,t,i,r,a),a}updateWorldMatrix(e,t,i){if(super.updateWorldMatrix(e,t,i),i&&this.children)for(let t of this.children)t.updateWorldMatrix(e,!1,!0)}find(e){let t;return this.traverse(i=>{i.uuid===e&&(t=i)}),t}innerDrawChildren(e){for(let t=this.children.length-1;t>=0;t--)this.children[t].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let t=new Pk(this.uuid,this.data,e);for(let i of(t.parent=void 0,this.children))t.add(i.clone(e));return t}},PV=class extends Pk{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.updateState(t,i)}draw(e){this.visible&&(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let t=new PV(this.uuid,this.data,e);for(let i of(t.parent=void 0,this.children))t.add(i.clone(e));return t}},Pj=[[-1,1],[-1,-1],[1,-1],[1,1]],PG=(e,t,i)=>{let r=e.getCenter(),a=e.getHalfSize(),o=Pz.append(t,e.worldMatrix);0===a[0]&&0===a[1]?i.push(Pz.apply(r,o)):Pj.forEach(e=>{let t=[e[0]*a[0]+r[0],e[1]*a[1]+r[1]];i.push(Pz.apply(t,o))})},PH=class{constructor(){this.matrix=Pz.identity(),this.min=[1/0,1/0],this.max=[-1/0,-1/0],this.vertices=[],this.edges=[]}setFromObjectSize(e,t=!1){e.updateWorldMatrix(),this.makeEmpty(),Pz.copy(e.worldMatrix,this.matrix);let i=Pz.invert(e.worldMatrix);this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];!0===i&&e instanceof Pk?e.traverse(e=>{e.visible&&PG(e,t,r)}):PG(e,t,r),this.setFromPoints(r)}setFromSize(e,t,i){this.makeEmpty(),Pz.copy(i,this.matrix),this.expandBySize(e,t,i)}expandBySize(e,t,i){[Pz.apply([0,0],i),Pz.apply([0,t],i),Pz.apply([e,t],i),Pz.apply([e,0],i)].forEach(e=>this.expandByPoint(e))}getCenter(){let[e,t]=this.min,[i,r]=this.getHalfSize();
6384return Pz.apply([e+i,t+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(e){for(let t of(this.makeEmpty(),e))this.expandByPoint(t)}expandByPoint(e){this.min=[Math.min(this.min[0],e[0]),Math.min(this.min[1],e[1])],this.max=[Math.max(this.max[0],e[0]),Math.max(this.max[1],e[1])]}computeVertices(){let[e,t]=this.getHalfSize(),i=this.getCenter(),[r,a,o,l]=Pz.getAbcdef(this.matrix),h=Pz.create(r,a,o,l,i[0],i[1]);this.vertices=Pj.map(([i,r])=>Pz.apply([i*e,r*t],h))}computeEdges(){this.edges=[];for(let e=0,t=this.vertices.length;e<t;++e)this.edges.push([this.vertices[e],this.vertices[(e+1)%t]])}project(e,t){let i=this.matrix;return t&&(i=Pz.append(t.worldMatrix,i)),Pz.applyInverse(e,i)}intersects(e,t,i){return this.intersectsInLocalSpace(...this.project([e,t],i))}intersectsInLocalSpace(e,t){let{min:i,max:r}=this;return e>=i[0]&&e<=r[0]&&t>=i[1]&&t<=r[1]}containsPoint(e){let[t,i]=e,[r,a]=this.min,[o,l]=this.max;return t>=r&&t<=o&&i>=a&&i<=l}intersectsBBox2D(e){for(let t=0,i=this.edges.length;t<i;t++){let i=this.edges[t];for(let t=0,r=e.edges.length;t<r;t++)if(function(e,t){let[[i,r],[a,o]]=e,[[l,h],[c,d]]=t,p=(i-a)*(h-d)-(r-o)*(l-c);if(0===p)return!1;let f=((i-l)*(h-d)-(r-h)*(l-c))/p,m=-((i-a)*(r-h)-(r-o)*(i-l))/p;return f>=0&&f<=1&&m>=0&&m<=1}(i,e.edges[t]))return!0}for(let t=0,i=e.vertices.length;t<i;t++){let i=e.vertices[t];if(this.containsPoint(i))return!0}return!1}ensureMinMax(){let e=this.min,t=this.max;this.min=[Math.min(e[0],t[0]),Math.min(e[1],t[1])],this.max=[Math.max(e[0],t[0]),Math.max(e[1],t[1])]}copy(e){this.min=[...e.min],this.max=[...e.max],Pz.copy(e.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let e=new PH;return e.copy(this),e}},PW=new Promise(e=>{PF=e}),Pq=!1;function PX(e){let t=!1;return e.scene.objects.traverse((e,i)=>{("Mesh"===i.type&&"UIGeometry"===i.geometry.type||"Page"===i.type&&void 0!==i.uiFrame)&&(t=!0)}),t}async function PY(e){let t=await PW;P0||(P1||(P1=t({locateFile:()=>e})),P0=await P1)}var PQ=Pz.identity(),PZ=class{constructor(e,t=1){this.canvas=e,this._dpr=t,this._width=0,this._height=0,this._strokeMode="inside",this._layerBlur=0,this._backgroundBlur=0,this._dropShadowBlur=0,this._dropShadowOffsetX=0,this._dropShadowOffsetY=0,this._dropShadowColor=gw.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=gw.transparent,this._fonts=new Map,this._isSizeDirty=!1;try{let i=e.getBoundingClientRect();e.width=i.width*t,e.height=i.height*t}catch{console.log(e.width,t)}this._currentM3Transform=PQ,this._currentTransform=new Float32Array(PQ)}get dpr(){return this._dpr}set dpr(e){this._dpr=e,this._isSizeDirty=!0}
6384async init(){if(!this.wasmURL)throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");await PY(this.wasmURL),this._surface=P0.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas(),this._paint=new P0.Paint,this._paint.setAntiAlias(!0),this._paintFill=this._paint.copy(),this._paintFill.setStyle(P0.PaintStyle.Fill),this._paintStroke=this._paint.copy(),this._paintStroke.setStyle(P0.PaintStyle.Stroke),this.ctx?.scale(this.dpr,this.dpr)}get currentTransform(){return this._currentM3Transform}get currentTransformBuffer(){return this._currentTransform}set currentTransform(e){this._currentM3Transform=e,this._currentTransform.set(e)}async loadFont(e,t){let i=await (await fetch(e)).arrayBuffer();this.registerFont(i,t)}registerFont(e,t){if(this._fonts.has(t))return;let i=P0.FontMgr.FromData(e);if(i)this._fonts.set(t,i);else throw Error("Invalid font data for "+t)}get width(){return this._width}get height(){return this._height}set strokeColor(e){this._paintStroke&&this._paintStroke.setColor(PJ(e),P0.ColorSpace.DISPLAY_P3)}set fillColor(e){this._paintFill&&this._paintFill.setColor(PJ(e),P0.ColorSpace.DISPLAY_P3)}set lineWidth(e){this._paintStroke&&this._paintStroke.setStrokeWidth("center"===this._strokeMode?e:2*e)}set strokeMode(e){this._strokeMode=e}set dropShadowBlur(e){this._dropShadowBlur=e}set dropShadowColor(e){this._dropShadowColor=e}set dropShadowOffsetX(e){this._dropShadowOffsetX=e}set dropShadowOffsetY(e){this._dropShadowOffsetY=e}set innerShadowBlur(e){this._innerShadowBlur=e}set innerShadowColor(e){this._innerShadowColor=e}set innerShadowOffsetX(e){this._innerShadowOffsetX=e}set innerShadowOffsetY(e){this._innerShadowOffsetY=e}set innerShadowSpread(e){this._innerShadowSpread=e}set layerBlur(e){this._layerBlur=e}set backgroundBlur(e){this._backgroundBlur=e}clear(){this.ctx?.clear(P0.TRANSPARENT)}save(){this.ctx?.save()}restore(){this.ctx?.restore()}beginPath(){this._currentPath?.delete(),this._currentPath=new P0.Path}closePath(){let e=this._currentPath;if(e){if(e.isEmpty())return;let t=e.getBounds();(t[3]-t[1]||t[2]-t[0])&&e.close()}}fill(){this._paintInner(this._paintFill,!0)}stroke(){this._paintInner(this._paintStroke,!1)}clipRect(e,t,i,r,a=0,o=0,l=0,h=0){let c=P0.XYWHRect(e,t,i,r);if(0===a&&0===o&&0===h&&0===l)this.ctx?.clipRect(c,P0.ClipOp.Intersect,!0);else{let e=P0.RRectXY(c,a,a);e[4]=e[5]=a,e[6]=e[7]=o,e[8]=e[9]=l,e[10]=e[11]=h,this.ctx?.clipRRect(e,P0.ClipOp.Intersect,!0)}}_applyShadowOffsetMatrix(){if(this.ctx){let e=Pz.invert(this.currentTransform);this.ctx.concat(e);let t=Pz.translate(Pz.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(t),this.ctx.concat(this._currentTransform)}}_applyEffectsToPaint(e,t,i=!0){if(this.ctx&&this._currentPath){let r,a=!1;if(i&&this._hasDropShadow()){let i,r=e.copy();r.setColor(PJ(this._dropShadowColor)),this._dropShadowBlur>0&&(i=P0.MaskFilter.MakeBlur(P0.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(this.camera?.scale??1),!1),r.setMaskFilter(i)),this.ctx.save(),this.ctx.clipPath(this._currentPath,P0.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),t(r),this.ctx.restore(),r.delete(),i?.delete()}if(this._backgroundBlur>0&&i){this.ctx.save(),this.ctx.clipPath(this._currentPath,P0.ClipOp.Intersect,!0);let t=P0.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,P0.TileMode.Clamp,null),i=e.copy();i.setImageFilter(t),i.setAlphaf(1);let r=this._currentPath.computeTightBounds();this.ctx.saveLayer(i,r,null,P0.SaveLayerInitWithPrevious),this.ctx.drawColor(e.getColor()),this.ctx.restore(),this.ctx.restore(),i.delete(),t.delete(),a=!0}if(this._layerBlur>0){let i=e.copy();r=P0.MaskFilter.MakeBlur(P0.BlurStyle.Normal,this._layerBlur*this.dpr*(this.camera?.scale??1),!1),i.setMaskFilter(r),t(i),i.delete(),r.delete(),a=!0}if(a||t(e),i&&this._hasInnerShadow()){let e,t=new P0.Paint;t.setAntiAlias(!0),t.setStyle(P0.PaintStyle.Fill),t.setColor(PJ(this._innerShadowColor)),this._innerShadowBlur>0&&(e=P0.MaskFilter.MakeBlur(P0.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(this.camera?.scale??1),!1),t.setMaskFilter(e));let i=this._currentPath.computeTightBounds(),[r,a,o,l]=i;this.ctx.save(),this.ctx.clipPath(this._currentPath,P0.ClipOp.Intersect,!0),this.ctx.saveLayer(t,i,null,P0.SaveLayerInitWithPrevious),this.ctx?.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(P0.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+(o-r)+Math.abs(2*this._innerShadowOffsetX),2e3+(l-a)+Math.abs(2*this._innerShadowOffsetY)),t),t.setBlendMode(P0.BlendMode.Clear),this.ctx.drawPath(this._currentPath,t),this.ctx.restore(
6384),this.ctx.restore(),t.delete(),e?.delete()}}}_paintInner(e,t=!0){if(this.ctx&&this._currentPath&&e){let i=this.ctx,r=this._currentPath;this._applyEffectsToPaint(e,e=>{let a=!1;t||"center"===this._strokeMode||(i.save(),i.clipPath(r,"outside"===this._strokeMode?P0.ClipOp.Difference:P0.ClipOp.Intersect,!0),a=!0),i.drawPath(r,e),a&&i.restore()},t)}}_hasDropShadow(){return this._dropShadowColor?.a>0}_hasInnerShadow(){return this._innerShadowColor?.a>0}path(e){this._currentPath?.addPath(P0.Path.MakeFromSVGString(e))}ellipse(e,t,i,r,a,o,l,h){if(!PK([e,t,i,r])||!this._currentPath)return;if(i<0||r<0)throw Error("radii cannot be negative");let c=P0.XYWHRect(e-i,t-r,2*i,2*r);this._currentPath?.addOval(c)}rect(e,t,i,r,a=0,o=0,l=0,h=0){let c=P0.XYWHRect(e,t,i,r);if(PK(c)){if(0===a&&0===o&&0===h&&0===l)this._currentPath?.addRect(c);else{let e=P0.RRectXY(c,a,a);e[4]=e[5]=a,e[6]=e[7]=o,e[8]=e[9]=l,e[10]=e[11]=h,this._currentPath?.addRRect(e)}}}getHorizontalAlign(e){switch(e){case 2:return P0.TextAlign.Right;case 3:return P0.TextAlign.Center;case 4:return P0.TextAlign.Justify;default:return P0.TextAlign.Left}}drawTextInner(e,t,i,[r,a,o,l],h,c,d=!0){let p=0,{ctx:f}=this;if(!f)return p;let m=c.copy(),g=c.copy();return g.setAlphaf(0),this._applyEffectsToPaint(m,c=>{t.pushPaintStyle(i,c,g),t.addText(e);let d=t.build();d.layout(o);let m=a;2===h?m+=(l-d.getHeight())/2:3===h&&(m+=l-d.getHeight()),f.drawParagraph(d,r,m),p=d.getHeight(),t.reset(),d.delete()},d),m.delete(),g.delete(),p}drawText(e,t){let i=0,r=this._fonts.get(t.font),{ctx:a,_paintFill:o,_paintStroke:l}=this;if(r&&a){let a=new P0.TextStyle({fontFamilies:[t.font],fontSize:t.fontSize,heightMultiplier:t.lineHeight,letterSpacing:t.letterSpacing}),h=new P0.ParagraphStyle({textStyle:a,textAlign:this.getHorizontalAlign(t.horizontalAlign)}),c=P0.XYWHRect(t.x,t.y,t.width,t.height),d=P0.ParagraphBuilder.Make(h,r);o&&(i=this.drawTextInner(e,d,a,c,t.verticalAlign,o,!0)),l&&(i=this.drawTextInner(e,d,a,c,t.verticalAlign,l,!1)),d.delete()}return{height:i}}render(){this._surface?.flush()}moveTo(e,t){this._currentPath?.moveTo(e,t)}lineTo(e,t){this._currentPath?.lineTo(e,t)}bezierCurveTo(e,t,i,r,a,o){this._currentPath?.cubicTo(e,t,i,r,a,o)}quadraticCurveTo(e,t,i,r){this._currentPath?.quadTo(e,t,i,r)}setTransform(e,t=!1){if(!this.ctx)return;let i=this.ctx.getTotalMatrix(),r=Pz.invert(i);if(r&&this.ctx.concat(r),this.ctx?.scale(this.dpr,this.dpr),this.camera?.enabled&&(this.ctx?.concat(this.camera.worldMatrix),t)){let e=Pz.getScale(this.camera.worldMatrix);this.ctx?.scale(1/e[0],1/e[1])}this.ctx?.concat(e),this.currentTransform=e}transform(e){this.ctx?.concat(e)}setSize(e,t){!this._isSizeDirty&&e===this._width&&t===this._height||(this._isSizeDirty=!1,this._width=e,this._height=t,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.dpr,this.canvas.height=t*this.dpr,this._surface&&(this._surface=P0.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas()))}};function PK(e){for(let t=0;t<e.length;t++)if(void 0!==e[t]&&!Number.isFinite(e[t]))return!1;return!0}function PJ({r:e,g:t,b:i,a:r}){return P0.Color4f(e,t,i,r)}var P$,P0,P1,P2,P3=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=gw.transparent,this.blurRadius=0,this.offset=[0,0],this.spread=0,this.update(t)}update(e){void 0!==e.color&&(this.color=e.color),void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.blurRadius&&(this.blurRadius=e.blurRadius),void 0!==e.offset&&(this.offset=e.offset),void 0!==e.spread&&(this.spread=e.spread)}},P4=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.radius=0,this.update(t)}update(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.radius&&(this.radius=e.radius)}},P5=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=gw.transparent,this.update(t)}update(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.color&&(this.color=e.color)}},P6=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=gw.transparent,this.thickness=0,this.mode="inside",this.update(t)}update(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.color&&(this.color=e.color),void 0!==e.thickness&&(this.thickness=e.thickness),void 0!==e.mode&&(this.mode=e.mode)}},P8=class extends PU{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.autoClose=!0,this.fill=new P5(e+"-fill",t.fill,i),this.stroke=new P6(e+"-stroke",t.stroke,i),this.dropShadow=new P3(e+"-dropShadow",t.dropShadow,i),this.innerShadow=new P3(e+"-innerShadow",t.innerShadow,i),this.backgroundBlur=new P4(e+"-backgroundBlur",t.backgroundBlur,i),this.layerBlur=new P4(e+"-layerBlur",t.layerBlur,i)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:gw.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:gw.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=5*this.layerBlur.radius:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=5*this.backgroundBlur.radius:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=5*this.dropShadow.blurRadius,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=gw.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=5*this.innerShadow.blurRadius,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=gw.transparent}innerDraw(e){}draw(e){this.visible&&(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore(
vendor: 5,368 bytes, line 6384
6384))}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),0===e.type&&(fd(e.path,["fill"])?this.fill.update(e.props):fd(e.path,["stroke"])?this.stroke.update(e.props):fd(e.path,["dropShadow"])?this.dropShadow.update(e.props):fd(e.path,["innerShadow"])?this.innerShadow.update(e.props):fd(e.path,["layerBlur"])?this.layerBlur.update(e.props):fd(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,t){super.updateState(e,t),void 0!==e.fill&&this.fill.update(e.fill),void 0!==e.stroke&&this.stroke.update(e.stroke),void 0!==e.dropShadow&&this.dropShadow.update(e.dropShadow),void 0!==e.innerShadow&&this.innerShadow.update(e.innerShadow),void 0!==e.layerBlur&&this.layerBlur.update(e.layerBlur),void 0!==e.backgroundBlur&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let t=new P8(this.uuid,this.data,e);return t.parent=void 0,t}},P9=class extends P8{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.width=0,this.height=0,this.updateState(t,i)}innerDraw(e){e.ellipse(.5*this.width,.5*this.height,.5*this.width,.5*this.height,0,0,2*Math.PI)}intersectsInLocalSpace(e,t){var i,r,a,o;let l,h;return i=.5*this.width,r=.5*this.height,a=.5*this.width,o=.5*this.height,(l=e-i)*l/(a*a)+(h=t-r)*h/(o*o)<=1}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,t){super.updateState(e,t),this.updateSizeState(e)}clone(e){let t=new P9(this.uuid,this.data,e);return t.parent=void 0,t}},P7=class extends P8{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.width=0,this.height=0,this.cornerRadius=[0,0,0,0],this.updateState(t,i)}innerDraw(e){e.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(e){void 0!==e.cornerRadius&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,t){super.updateState(e,t),this.updateSizeState(e),this.updateCornerState(e)}clone(e){let t=new P7(this.uuid,this.data,e);return t.parent=void 0,t}},De=class extends P8{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this._textHeight=0,this._textHeightDirty=!0,this.width=0,this.height=0,this.updateState(t,i)}get textHeight(){return this._textHeight}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:gw.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:gw.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let t=this.data.textTransform,i=this.data.text.textValue.toString(),r=2===t?i.toUpperCase():3===t?i.toLowerCase():i,{height:a}=e.drawText(r,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=a}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:t}){void 0!==e.font&&(this._fontHolder=t.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,t){super.updateState(e,t),this.updateSizeState(e),this.updateFontState(e,t)}clone(e){let t=new De(this.uuid,this.data,e);return t.parent=void 0,t}},Dt=class extends P8{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.curves=[],this.extremasBBox={min:[0,0],max:[0,0]},this.updateState(t,i)}computeExtremas(){0===this.curves.length&&this.computeCurves();let e=this.curves.map(e=>P2.extremas(e)),t=[1/0,1/0],i=[-1/0,-1/0];for(let r=0,a=e.length;r<a;r++){let a=e[r];a[0][0]<t[0]&&(t[0]=a[0][0]),a[0][1]<t[1]&&(t[1]=a[0][1]),a[1][0]>i[0]&&(i[0]=a[1][0]),a[1][1]>i[1]&&(i[1]=a[1][1])}return this.extremasBBox.min=[t[0],t[1]],this.extremasBBox.max=[i[0],i[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let e=1,t=this.data.points.length;e<t;e++){let t=this.data.points[e].data,i=this.data.points[e-1].data,r={start:i.position,cp1:i.controlNext.position,cp2:t.controlPrevious.position,end:t.position};this.curves.push(r)}let e=this.data.points[0].data,t=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let i={start:t.position,cp1:t.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(i)}}getCenter(){let[e,t]=this.extremasBBox.min,[i,r]=this.getHalfSize();return[e+i,t+r]}getHalfSize(){let{min:e,max:t}=this.extremasBBox;
vendor: 6,904 bytes, line 6384
6384return[(t[0]-e[0])*.5,(t[1]-e[1])*.5]}innerDraw(e){for(let t=0,i=this.data.points.length;t<i;t++){let i=this.data.points[t].data;if(0===t){let[t,r]=i.position;e.moveTo(t,r)}else{let r=this.data.points[t-1].data,[a,o]=r.controlNext.position,[l,h]=i.controlPrevious.position,[c,d]=i.position,p={start:r.position,cp1:r.controlNext.position,cp2:i.controlPrevious.position,end:i.position};P2.derive(p),e.bezierCurveTo(a,o,l,h,c,d)}}let t=this.data.points[0].data,i=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[r,a]=i.controlNext.position,[o,l]=t.controlPrevious.position,[h,c]=t.position;e.bezierCurveTo(r,a,o,l,h,c)}}updateState(e,t){super.updateState(e,t),this.computeExtremas()}clone(e){let t=new Dt(this.uuid,this.data,e);return t.parent=void 0,t}};(e=>{function t(e,t,i,r=!1){let a=e-2*t+i;if(0!==a){let r=-Math.sqrt(Math.abs(t*t-e*i)),o=-e+t;return[-(r+o)/a,-(-r+o)/a]}return t!==i&&0===a?[(2*t-i)/(2*(t-i))]:[]}e.derive=function(e){let t=e.start,i=e.cp1,r=e.cp2,a=e.end,o={start:[3*(i[0]-t[0]),3*(i[1]-t[1])],cp:[3*(r[0]-i[0]),3*(r[1]-i[1])],end:[3*(a[0]-r[0]),3*(a[1]-r[1])]};return e.derivative=o,o.derivative=O_.derive(o),o},e.droot=function(i){let r=i.derivative??e.derive(i),a=r.start,o=r.cp,l=r.end;return[t(a[0],o[0],l[0]),t(a[1],o[1],l[1])]},e.extremas=function(t){let[i,r]=e.droot(t),a=[t.start[0],t.end[0]],o=[t.start[1],t.end[1]];for(let r of i)a.push(e.compute(t,Math.min(1,Math.max(0,r)))[0]);for(let i of r)o.push(e.compute(t,Math.min(1,Math.max(0,i)))[1]);return a.sort((e,t)=>e-t),o.sort((e,t)=>e-t),[[a[0],o[0]],[a[a.length-1],o[o.length-1]]]},e.compute=function(e,t){if(0===t)return[...e.start];if(1===t)return[...e.end];let i=1-t,r=i*i,a=t*t,o=r*i,l=r*t*3,h=i*a*3,c=t*a;return[o*e.start[0]+l*e.cp1[0]+h*e.cp2[0]+c*e.end[0],o*e.start[1]+l*e.cp1[1]+h*e.cp2[1]+c*e.end[1]]}})(P2||(P2={})),(Ow=O_||(O_={})).derive=function(e){let t=e.start,i=e.cp,r=e.end,a={start:[2*(i[0]-t[0]),2*(i[1]-t[1])],end:[2*(r[0]-i[0]),2*(r[1]-i[1])]};return a.derivative=OA.derive(a),e.derivative=a,a},Ow.droot=function(e){let t=e.derivative??Ow.derive(e),i=t.start,r=t.end;return[i[0]!==r[0]?i[0]/(i[0]-r[0]):0,i[1]!==r[1]?i[1]/(i[1]-r[1]):0]},Ow.compute=function(e,t){if(0===t)return[...e.start];if(1===t)return[...e.end];let i=1-t,r=i*i,a=i*t*2,o=t*t;return[r*e.start[0]+a*e.cp[0]+o*e.end[0],r*e.start[1]+a*e.cp[1]+o*e.end[1]]},(OS=OA||(OA={})).derive=function(e){let t=e.start,i=e.end,r=[i[0]-t[0],i[1]-t[1]];return e.derivative=r,e.derivative},OS.compute=function(e,t){if(0===t)return[...e.start];if(1===t)return[...e.end];let i=e.start,r=e.end;return[i[0]+(r[0]-i[0])*t,i[1]+(r[1]-i[1])*t]};var Di=class extends Pk{constructor(e,t,i){super(e,t,i),this.uuid=e,this.width=0,this.height=0,this.clipped=!0,this.background=new P7(e+"-background",xE.defaultData,i),this.background.parent=this,this.updateState(t,i)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,t,i){super.updateWorldMatrix(e,t,i),this.background?.updateWorldMatrix(e,t,i)}draw(e){if(!this.visible)return;e.save();let t=this.width,i=this.height;this.applyTransforms(e),this.background.width=t,this.background.height=i,this.background.draw(e),this.clipped&&e.clipRect(0,0,t,i,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(e){void 0!==e.cornerRadius&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,t){super.updateState(e,t),this.updateSizeState(e),this.updateCornerState(e),void 0!==e.fill&&this.fill.update(e.fill),void 0!==e.stroke&&this.stroke.update(e.stroke),void 0!==e.dropShadow&&this.dropShadow.update(e.dropShadow),void 0!==e.innerShadow&&this.innerShadow.update(e.innerShadow),void 0!==e.layerBlur&&this.layerBlur.update(e.layerBlur),void 0!==e.backgroundBlur&&this.backgroundBlur.update(e.backgroundBlur),void 0!==e.clipped&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),0===e.type&&(fd(e.path,["fill"])?this.fill.update(e.props):fd(e.path,["stroke"])?this.stroke.update(e.props):fd(e.path,["dropShadow"])?this.dropShadow.update(e.props):fd(e.path,["innerShadow"])?this.innerShadow.update(e.props):fd(e.path,["layerBlur"])?this.layerBlur.update(e.props):fd(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let t=new Di(this.uuid,this.data,e);for(let i of(t.parent=void 0,this.children))t.add(i.clone(e));return t}},Dr=tL(tV(),1),Ds=class extends P8{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this._pathBBox=new DOMRect,this.path="",this.updateState(t,i),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){var e;let t=this.path;e=this.path,/NaN/.test(e)&&(console.warn("Invalid SVG path",this.uuid),t="");let i=document.createElementNS("http://www.w3.org/2000/svg","svg"),r=document.createElementNS("http://www.w3.org/2000/svg","path");document.body.appendChild(i),r.setAttribute("d",t),i.appendChild(r),this._pathBBox=r.getBBox(),i.remove()}innerDraw(e){e.path(this.path)}intersectsInLocalSpace(e,t){return e>=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&t>=this._pathBBox.y&&t<=this._pathBBox.y+this._pathBBox.height}getCenter(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}getHalfSize(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}updateState(e,t){super.updateState(e,t),void 0!==e.path&&(this.path=e.path,this.computeSVGBBox())}clone(e){let t=new Ds(this.uuid,this.data,e);return t.parent=void 0,t}};function Da(e){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],i;return e.map(e=>{let r=[];t.forEach(t=>{if(t in e){let i=1*e[t];r.length&&i>=0&&r.push(","),r.push(i)}});let a=(i===e.code?r[0]<0?"":",":e.code)+r.join("");return i=e.code,a}).join("")}var Dn=class{constructor(e,t,i){this.uuid=e,this.data=t,this.group=new PV(Dn.GROUP_ID,{...xD.defaultData},i),this.createChildrenObjects(t.objects,this.group,i)}createObject(e,t,i,r,a,o){let l=function(e,t,i){switch(t.type){case"ellipse2d":return new P9(e,t,i);
6384case"rectangle2d":return new P7(e,t,i);case"text2d":return new De(e,t,i);case"vector2d":return new Dt(e,t,i);case"path2d":return new Ds(e,t,i);case"frame2d":return new Di(e,t,i);default:return new PV(e,t,i)}}(e,t,o);l&&(r.add(l),r.children.splice(a,0,r.children.pop()),l.updateWorldMatrix(),i.length>0&&(l instanceof PV||l instanceof Di)&&this.createChildrenObjects(i,l,o))}createChildrenObjects(e,t,i){let r=0;for(let a of e)this.createObject(a.id,a.data,a.children,t,r,i),r+=1}draw(e){this.group.draw(e)}updateEntityByOp(e,t,i,r){let a=this.find(e);if(a)try{a.updateByOp(t,i,{shared:r})}catch(e){console.error(e)}}updateTreeByOp(e,t){if(0===e.path.length&&7===e.type){let i=null===e.parent?this.group:this.find(e.parent);void 0!==i&&i instanceof Pk&&(this.createObject(e.id,e.data,e.children,i,e.localIndex,t),i.requestRender())}else if(0===e.path.length&&8===e.type){let t=this.find(e.id);if(void 0!==t&&void 0!==t.parent&&t.parent instanceof Pk){let e=t.parent;t.resetBBoxNeedsUpdate(),e?.remove(t),e?.requestRender()}}else if(0===e.path.length&&9===e.type){let t=this.find(e.id);if(void 0!==t){let i=t.parent,r=null===e.parent?this:this.find(e.parent);if(r instanceof Pk||r===this){r.add(t);let a=e.localIndex;r.children.splice(a,0,r.children.pop()),t.updateWorldMatrix(!0,!1,!0),i?.requestRender(),t.requestRender()}t.resetBBoxNeedsUpdate()}}}add(e){this.group.add(e)}remove(e){this.group.remove(e)}traverse(e){this.group.traverse(t=>{t!==this.group&&e(t)})}intersectsChildren(e,t,i,r=!1,a=[]){return this.group.intersectsChildren(e,t,i,r,a,!0)}intersectsChildrenReverse(e,t,i,r=!1,a=[]){return this.group.intersectsChildrenReverse(e,t,i,r,a,!0)}find(e){return this.group.find(e)}get children(){return this.group.children}project(e,t){return this.group.project(e,t)}getWithSortKey(e){let t=this.find(e);if(void 0===t)return;let i=[],r=t;for(;r!==this.group;){let e=r,t=(r=r.parent).children.indexOf(e);i.splice(0,0,t)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push(e)}return t.sort((e,t)=>vd(e.sortKey,t.sortKey)),t.map(e=>e.entity)}};function Do({constraints:e,newParentWidth:t,newParentHeight:i,initialParentWidth:r,initialParentHeight:a,objectInitialWidth:o,objectInitialHeight:l,objectInitialPosition:h}){let{horizontalConstraint:c,verticalConstraint:d}=e,p=t-r,f=i-a,m=o,g=l,v=h[0],y=h[1];if(0!==c){if(1===c)v+=p;else if(3===c)v+=p/2;else if(2===c)m=Math.max(1,m+p);else if(4===c){let e=t/r;m*=e,v*=e}}if(0!==d){if(1===d)y+=f;else if(3===d)y+=f/2;else if(2===d)g=Math.max(1,g+f);else if(4===d){let e=i/a;g*=e,y*=e}}return{width:m,height:g,position:[v,y]}}Dn.GROUP_ID="scene2d",tL(tV(),1);var Dl=` 6385 varying vec2 vUv; 6386 void main() { 6387 vUv = uv; 6388 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 6389 }`,Dh=` 6390 uniform sampler2D tDiffuse; 6391 varying vec2 vUv; 6392 void main() { 6393 vec4 texel = texture2D( tDiffuse, vUv ); 6394 gl_FragColor = texel; 6395 }`,Dc=new sL(-1,1,1,-1,0,1),Dd=new class extends rQ{constructor(){super(),this.setAttribute("position",new rV([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new rV([0,2,0,0,2,0],2))}},Du=class{constructor(e){this._mesh=new r7(Dd,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Dc)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},Dp=new sl({defines:{},uniforms:{tDiffuse:new lG(null)},vertexShader:Dl,fragmentShader:Dh}),Df=new Du(Dp),Dm=null,Dg=null,Dv=()=>(null===Dm&&(Dm=document.createElement("canvas")),Dm),Dy=e=>(null===Dg&&(Dg=new PZ(e)),Dg),Dx=Pz.identity(),Db=class{constructor(e,t,i,r){this.uuid=e,this.width=t,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.context.shared.requestRender()},this._innerApplySize=()=>{let e=this.width,t=this.height,i=this.dpr;this.renderer.dpr=this.isScreenSpace?i:Math.floor(2048/Math.max(e,t)),this.renderer.setSize(e,t)},this.onFrameOverrideObjectEvent=e=>{if(e.target?.uuid!==void 0){let t=this.frameRoot?.find(e.target.uuid);t&&t.dispatchEvent({...e,target:t})}},this.scene2d=new Dn(t8.generateUUID(),xR.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=Dv(),this.renderer=Dy(this.canvas),this.promise=this.init(),this.renderTarget=new iM(1,1,{type:1016,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new n6(this.canvas)),this._canvasTexture}
6395async init(){this.renderer instanceof PZ&&(this.renderer.wasmURL=Ak.skiaWasmUrl),await this.renderer.init()}render(e){if(this.isFrameDirty){this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),Dp.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),Df.render(e),e.setRenderTarget(t),this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=Dx,this.isScreenSpace&&(this.frameOverride.fill.color=gw.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},function e({objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l}){if(t instanceof Di&&i instanceof Di||t instanceof PV&&i instanceof PV)for(let h=0,c=t.children.length;h<c;h++){let c=t.children[h],d=i.children[h];c&&d&&c.uuid===d.uuid&&function({objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l}){let[h,c]=function(e){if(Dw(e))return[e.width,e.height];if(e instanceof Ds){let[t,i]=e.getHalfSize();return[2*t,2*i]}if(e instanceof PV){let[t,i]=e.recursiveBBox.getHalfSize();return[2*t,2*i]}return[0,0]}(i),{width:d,height:p,position:f}=Do({constraints:t.data,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l,objectInitialWidth:h,objectInitialHeight:c,objectInitialPosition:i.position});if(t.position=f,t.data={...t.data,position:f},t.states)for(let e in t.states)!function({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l}){let h=t.states?.[e],c=i.states?.[e];if(h&&c){let{width:i,height:d,position:p}=Do({constraints:t.data,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l,objectInitialWidth:xI.isResizeable(c)?c.width:0,objectInitialHeight:xI.isResizeable(c)?c.height:0,objectInitialPosition:c.position});Object.assign(t.states[e],{position:p}),xI.isResizeable(h)&&Object.assign(t.states[e],{width:i,height:d})}}({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l});if(Dw(t)||t instanceof PV)Dw(t)&&(t.width=d,t.height=p,t.data={...t.data,width:d,height:p}),e({objectOverride:t,objectRoot:i,newParentWidth:d,newParentHeight:p,initialParentWidth:h,initialParentHeight:c});else if(t instanceof Ds){let e=0!==h?d/h:1,r=0!==c?p/c:1;t.path=function(e,t=1,i=1){if(t<=0||i<=0)return e;if(/NaN/.test(e))return console.warn("Cannot scale invalid path",e),Da([]);try{let r=(0,Dr.parseSVG)(e).map(e=>{let r={...e};return"x"in r&&(r.x=r.x*t),"y"in r&&(r.y=r.y*i),"x1"in r&&(r.x1=r.x1*t),"x2"in r&&(r.x2=r.x2*t),"y1"in r&&(r.y1=r.y1*i),"y2"in r&&(r.y2=r.y2*i),"rx"in r&&(r.rx=r.rx*t),"ry"in r&&(r.ry=r.ry*i),r});return Da(r)}catch(e){return console.warn("Error parsing SVG path",e),Da([])}}(i.path,e,r),t.data={...t.data,path:t.path}}}({objectOverride:c,objectRoot:d,newParentWidth:r,newParentHeight:a,initialParentWidth:o,initialParentHeight:l})}}({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let a=1;(i*t<512||r*t<512)&&(a=Math.max(512/(i*t),512/(r*t))),this.renderTarget.setSize(i*t*a,r*t*a),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(!(!t||!(t instanceof Di)))return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(e=>{e.addEventListener("beginState",this.onFrameOverrideObjectEvent)}),this.frameOverride.traverse(e=>{e.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginStateChange",this.onFrameOverrideObjectEvent)}),this.frameOverride?.traverse(e=>{e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function Dw(e){return e instanceof P7||e instanceof Di||e instanceof P9||e instanceof De}var DS=class extends bL(nR){constructor(e,t,i){super(),this.data=t,this.bgColor=new _R(1,1,1,1),this.fog=null,this.backupFog=new nI(16777215,.1,2e3),this.fogUseBGColor=!1,this.isActive=!1,this.aoColor=new iv,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new Cn(gl,{...y$.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new lp(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene?this.uiScene=new Dn((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared}):t.uiFrame&&this.createUICanvas(t.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){this.uiCanvas=new Db(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}
6395setBackgroundColor(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){void 0!==e.color&&(this.ambientLight.color=Mo(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity),void 0!==e.enabled&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(e=>{e instanceof Cc&&e.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Er){if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()}})}updateShadow(e){void 0!==e.softShadowQuality&&this.isActive&&Pm(e.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive&&(this.scene.fog=this.fog),this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Mo(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}updateAo(e,t){void 0!==e.aoColor&&(this.aoColor=Mo(e.aoColor,t))}updateByOp(e,t,i,r){let a=this.data.uiFrame;super.updateByOp(e,t,i,r),fd(e.path,["fog"])?this.updateFog(t.fog,i.shared):fd(e.path,["ao"])?this.updateAo(t.ao,i.shared):fd(e.path,["ambient"])?this.updateAmbientLight(t.ambient,i.shared):fd(e.path,["shadow"])?this.updateShadow(t.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||a!==t.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(Mo(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=[,,,,,].fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof PC&&i.visible&&e<3&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof PO&&i.visible&&e<2&&(this.penumbraSizeArrayCache[3+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let a of r.children){let r=a.cloner;SH.is(a)&&(a.visible||r?.object.data.visible)&&((Cu(a)||Cf(a)&&this.scene.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,t),Of(a,e,t,!0)),i(a))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}},D_=class extends Cd(lA,Pw){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let a=new he(new iR(new iD(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),new iD(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z)),new iv(16755200));a.visible=!1,this.gizmos.shadowmap=a,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let e in this.gizmos){let t=this.gizmos[e];if(t instanceof he){let e=this.shadow.camera,i=new iD(-e.far+this.position.x,-e.far+this.position.y,-e.far+this.position.z),r=new iD(e.far+this.position.x,e.far+this.position.y,e.far+this.position.z);t.box.set(i,r),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update(
6395)}updateState(e,t){this.updateState_Light(e,t),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}},DA=class extends Eh{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?_w(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},DM=class extends Eh{constructor(e,t,i){super(e,t,i),this._shapeId=null,this._context=i}updateState(e,t){super.updateState(e,t),this.updateShape(),this.refreshAttachedCloners(t)}updateShape(){let e,t={...this.data.geometry.extrusion.shape};for(let e in t)"string"==typeof t[e]&&(t[e]=this._context.shared.getVariable(t[e],[this.uuid,"geometry","extrusion","shape",e]));if("Custom"===t.type){let i=t.shapeId;if(i!==this._shapeId&&this.detachShape(),i){this._shapeId=i;let t=this._context.scene.find(i);t?.data&&(t.attachedPaths.add(this),e=t.geometry.userData?.shape),e||this._context.scene.addPendingCommand(()=>this.updateShape())}}else{let i;switch(t.type){case"Rectangle":i=Sp;break;case"Ellipse":i=wU;break;case"Polygon":i=Sl;break;case"Star":i=Sy;break;default:throw Error(`Unknown shape type: ${t.type}`)}e=i.create({parameters:t}).userData.shape}let i=this.geometry;e&&i.inputs&&(i.inputs.shapeData=e,i.build())}detachShape(){null!==this._shapeId&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,t){return super.updateTransformState(e,t)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.updateShape()}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");void 0!==i?_w(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},DE=class extends EU{constructor(e,t,i){super(e,t,i),this.data=t}},DC=class extends E7(nA,Cx){constructor(e,t,i){super(),"Instance"===t.type&&"string"==typeof e&&(t=this.transformAssignData(t,i)),this.super_Entity(e,t),this.objectHelper.update()}get isComponentRoot(){return"Component"===this.data.type&&"string"==typeof this.identity}get isInstanceRoot(){return"Instance"===this.data.type&&"string"==typeof this.identity}transformAssignData(e,t){let i=xf.getComponentData({scene:t.scene.data,shared:t.shared.data},e.component);if(!i)return{...vB.defaultData,...e,...po(vB.defaultData,y2.rootOverrideProps)};{let t,r;for(let a of y2.rootOverrideProps)void 0===e[a]?(void 0===t&&(t={...e}),t[a]=i.data[a]):(void 0===r&&(r={}),r[a]=e[a],void 0===t&&(t={...e}),t[a]=pK.apply(i.data[a],e[a]));return this.overrideData=r,t}}updateByOp(e,t,i,r){let a;if(this.isInstanceRoot&&!r){if(t=this.transformAssignData(t,i),0===e.type&&0===e.path.length&&this.component)for(let t of y2.rootOverrideProps)t in e.props&&void 0===e.props[t]&&(void 0===a&&(a={...e,props:{...e.props}}),a.props[t]=this.component.data[t]);else if(0===e.type&&e.path.length>0&&y2.rootOverrideProps.includes(e.path[0])){let i=e.path[0];void 0===a&&(a={...e,path:[],props:{[i]:t[i]}})}}super.updateByOp(a??e,t,i,r)}updateState(e,t){this.updateState_Entity(e,t)}expandInstanceChildren(e){let t=this.data;if(void 0===this.component){let i=e.scene.find(t.component)??null,r=!1;if(i!==this.oldComponent){if(this.oldComponent){let t=0;for(let i of this.children)if(SH.is(i))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),DT(i),t+=1;else break;this.children.splice(0,t)}r=!0}if(i){let a={};for(let o of(function e(t,i,r,a,o,l,h,c,d){if(h>50)return!1;if(a.component!==o){if(a.component){let e=a.component.instances.indexOf(a);e>=0&&a.component.instances.splice(e,1)}o.instances.find(e=>e===a)||o.instances.push(a),a.component=o}o instanceof DC&&o.isInstanceRoot&&o.expandInstanceChildren(t);let p=0;for(let f of o.children)if(SH.is(f)){let o=[...i,..."string"==typeof f.identity?[f.identity]:f.identity],m=y1.resolve(r,o,1);null==m||m instanceof pJ||(Object.setPrototypeOf(m,pJ.prototype),console.error("wrong prototype"));let g=null,v;if(!c){let e=a.children[p];if(null!==(g=SH.is(e)?e:null)){let e=DP(g,f,m,o);v=e>=1?g.stateSelection:void 0,2!==e&&(g=null)}if(null===g&&null!==(g=t.scene.findInstance(o)??null)){let e=DP(g,f,m,o);if(v=e>=1?g.stateSelection:void 0,2!==e)g=null;else{let e=g.parent.children.indexOf(g);g.parent.children.splice(e,1),a.children.splice(p,0,g),g.parent===a?e<=p&&console.error("not possible"):(g.parent=a,g.matrixWorldNeedsUpdate=!0,g.resetBBoxNeedsUpdate(),g.updateVisible(),t.pendingDeletes.delete(g))}}}if(null===g){let e=m?pK.apply(f.data,m):f.data;gU.is(e.type)&&(e={...e,type:"Empty"}),(g=bw.createEntity(o,e,t)).overrideData=m,a.add(g),a.children.splice(a.children.length-1,1),a.children.splice(p,0,g),g.updateState(g.data,t),v&&g.changeSelectedState(v,t),t.scene.registerInstanceAndSetUuid(g)}g.isBone&&(d[g.identity[g.identity.length-1]]=g.uuid),p+=1,e(t,i,r,g,f,l,h+1,c,d)}if(!c){let e=p;for(;;){let e=a.children[p];if(SH.is(e))t.pendingDeletes.add(e);else break;p+=1}a.children.splice(e,p-e)}return!0}(e,[this.uuid],t.overrides,this,i,i,0,r,a),this.children))if(SH.is(o)){let t=
6395o.data;"Empty"===t.type&&t.animations&&o.traverseEntity(t=>{let i=t.dataPatched;if(t instanceof Eh&&i.bones&&i.boneInverses){let i=t.dataPatched;if(i.bones&&i.boneInverses){let r=new nV(i.bones.map(t=>e.scene.find(a[t])),i.boneInverses.map(e=>new i6().fromArray(e)));t.bind(r,t.bindMatrix)}}else t.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function DT(e){if(e.component){let t=e.component.instances.indexOf(e);for(let i of(t>=0&&e.component.instances.splice(t,1),e.children))SH.is(i)&&DT(i)}}function DP(e,t,i,r){return e.component===t&&pe(e.identity,r)?e.overrideData===i?2:1:0}var DD=class extends E7(nF,Cx){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(e,t){this.updateState_Entity(e,t)}},DO=class extends Eh{constructor(e,t,i){super(e,t,i),this.onBeforeRender=e=>{this.uiCanvas.render(e)},this.uiCanvas=new Db(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),0===e.type&&(void 0!==e.props.frame&&this.applyFrame(e.props.frame,i.shared),(void 0!==e.props.width||void 0!==e.props.height)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=S$(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&0===t.type&&(void 0!==t.props.cornerRadius?this.applyGeometryParametersFromFrame(r):fd(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=S$(i,t,this.data.flatShading,this)}},DI=class{constructor(e,t,i){this.variables=[],this.currentTextureIndex=0;let r=1015,a=new nR,o=new sh;o.position.z=1;let l={passThruTexture:{value:null}},h=p(`uniform sampler2D passThruTexture; 6396 6397void main() { 6398 6399 vec2 uv = gl_FragCoord.xy / resolution.xy; 6400 6401 gl_FragColor = texture2D( passThruTexture, uv ); 6402 6403} 6404`,l),c=new r7(new s_(2,2),h);function d(i){i.defines.resolution="vec2( "+e.toFixed(1)+", "+t.toFixed(1)+" )"}function p(e,t){let i=new sl({uniforms:t=t||{},vertexShader:`void main() { 6405 6406 gl_Position = vec4( position, 1.0 ); 6407 6408} 6409`,fragmentShader:e});return d(i),i}a.add(c),this.setDataType=function(e){return r=e,this},this.addVariable=function(e,t,i){let r={name:e,initialValueTexture:i,material:this.createShaderMaterial(t),dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:1003,magFilter:1003};return this.variables.push(r),r},this.setVariableDependencies=function(e,t){e.dependencies=t},this.init=function(){if(!1===i.capabilities.isWebGL2&&!1===i.extensions.has("OES_texture_float"))return"No OES_texture_float support for float textures.";if(0===i.capabilities.maxVertexTextures)return"No support for vertex shader textures.";for(let i=0;i<this.variables.length;i++){let r=this.variables[i];r.renderTargets[0]=this.createRenderTarget(e,t,r.wrapS,r.wrapT,r.minFilter,r.magFilter),r.renderTargets[1]=this.createRenderTarget(e,t,r.wrapS,r.wrapT,r.minFilter,r.magFilter),this.renderTexture(r.initialValueTexture,r.renderTargets[0]),this.renderTexture(r.initialValueTexture,r.renderTargets[1]);let a=r.material,o=a.uniforms;if(null!==r.dependencies)for(let e=0;e<r.dependencies.length;e++){let t=r.dependencies[e];if(t.name!==r.name){let e=!1;for(let i=0;i<this.variables.length;i++)if(t.name===this.variables[i].name){e=!0;break}if(!e)return"Variable dependency not found. Variable="+r.name+", dependency="+t.name}
6409o[t.name]={value:null},a.fragmentShader=` 6410uniform sampler2D `+t.name+`; 6411`+a.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){let e=this.currentTextureIndex,t=0===this.currentTextureIndex?1:0;for(let i=0,r=this.variables.length;i<r;i++){let r=this.variables[i];if(null!==r.dependencies){let t=r.material.uniforms;for(let i=0,a=r.dependencies.length;i<a;i++){let a=r.dependencies[i];t[a.name].value=a.renderTargets[e].texture}}this.doRenderTarget(r.material,r.renderTargets[t])}this.currentTextureIndex=t},this.getCurrentRenderTarget=function(e){return e.renderTargets[this.currentTextureIndex]},this.getAlternateRenderTarget=function(e){return e.renderTargets[0===this.currentTextureIndex?1:0]},this.dispose=function(){c.geometry.dispose(),c.material.dispose();let e=this.variables;for(let t=0;t<e.length;t++){let i=e[t];i.initialValueTexture&&i.initialValueTexture.dispose();let r=i.renderTargets;for(let e=0;e<r.length;e++)r[e].dispose()}},this.addResolutionDefine=d,this.createShaderMaterial=p,this.createRenderTarget=function(i,a,o,l,h,c){return o=o||1001,l=l||1001,h=h||1003,c=c||1003,new iM(i=i||e,a=a||t,{wrapS:o,wrapT:l,minFilter:h,magFilter:c,format:1023,type:r,depthBuffer:!1})},this.createTexture=function(){let i=new nN(new Float32Array(e*t*4),e,t,1023,1015);return i.needsUpdate=!0,i},this.renderTexture=function(e,t){l.passThruTexture.value=e,this.doRenderTarget(h,t),l.passThruTexture.value=null},this.doRenderTarget=function(e,t){let r=i.getRenderTarget(),l=i.xr.enabled,d=i.shadowMap.autoUpdate,p=i.outputEncoding,f=i.toneMapping;i.xr.enabled=!1,i.shadowMap.autoUpdate=!1,i.outputEncoding=3e3,i.toneMapping=0,c.material=e,i.setRenderTarget(t),i.render(a,o),c.material=h,i.xr.enabled=l,i.shadowMap.autoUpdate=d,i.outputEncoding=p,i.toneMapping=f,i.setRenderTarget(r)}}},DR=new rI,DL=new iD,DB=class{constructor(e){let t=e.geometry;if(!t.isBufferGeometry||3!==t.attributes.position.itemSize)throw Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");t.index&&(console.warn("THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry."),t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.colorAttribute=this.geometry.getAttribute("color"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this}build(){let e=this.positionAttribute,t=this.weightAttribute,i=new Float32Array(e.count/3);for(let r=0;r<e.count;r+=3){let a=1;t&&(a=t.getX(r)+t.getX(r+1)+t.getX(r+2)),DR.a.fromBufferAttribute(e,r),DR.b.fromBufferAttribute(e,r+1),DR.c.fromBufferAttribute(e,r+2),a*=DR.getArea(),i[r/3]=a}this.distribution=new Float32Array(e.count/3);let r=0;for(let e=0;e<i.length;e++)r+=i[e],this.distribution[e]=r;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,i){let r=this.distribution[this.distribution.length-1],a=this.binarySearch(this.randomFunction()*r);return this.sampleFace(a,e,t,i)}binarySearch(e){let t=this.distribution,i=0,r=t.length-1,a=-1;for(;i<=r;){let o=Math.ceil((i+r)/2);if(0===o||t[o-1]<=e&&t[o]>e){a=o;break}e<t[o]?r=o-1:i=o+1}return a}sampleFace(e,t,i,r){let a=this.randomFunction(),o=this.randomFunction();return a+o>1&&(a=1-a,o=1-o),DR.a.fromBufferAttribute(this.positionAttribute,3*e),DR.b.fromBufferAttribute(this.positionAttribute,3*e+1),DR.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(DR.a,a).addScaledVector(DR.b,o).addScaledVector(DR.c,1-(a+o)),void 0!==i&&DR.getNormal(i),void 0!==r&&void 0!==this.colorAttribute&&(DR.a.fromBufferAttribute(this.colorAttribute,3*e),DR.b.fromBufferAttribute(this.colorAttribute,3*e+1),DR.c.fromBufferAttribute(this.colorAttribute,3*e+2),DL.set(0,0,0).addScaledVector(DR.a,a).addScaledVector(DR.b,o).addScaledVector(DR.c,1-(a+o)),r.r=DL.x,r.g=DL.y,r.b=DL.z),this}};function Dz(e,t){let i=new Float32Array(4*t*t);for(let r=0;r<t*t;r++)i[4*r]=e[3*r],i[4*r+1]=e[3*r+1],i[4*r+2]=e[3*r+2],i[4*r+3]=0;let r=new nN(i,t,t,1023,1015);return r.needsUpdate=!0,r}var DF=` 6412// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU 6413// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU 6414// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU 6415uniform sampler2D uOriginalPosition; 6416uniform float uTime; 6417uniform float uSpeed; // update speed of the particles 6418uniform vec3 uWorldOffset; 6419uniform vec4 uWorldQuaternion; 6420uniform float uMaxLifeTime; 6421uniform vec3 uEmitterSize; 6422uniform float uFPSRatio; // 1 for 60 FPS 6423 6424float random (vec2 st) { 6425 return fract(sin(dot(st.xy, 6426 vec2(12.9898,78.233)))* 6427 43758.5453123); 6428} 6429vec3 applyQuaternionToVector( vec4 q, vec3 v ){ 6430 return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); 6431} 6432 6433vec3 applyForce(vec3 force, float mass) { 6434 vec3 acceleration = force / mass; 6435 6436 return acceleration; 6437 } 6438 6439 6440void main() { 6441 vec2 vUv = gl_FragCoord.xy / resolution.xy; 6442 vec3 position = texture2D( uCurrentPosition, vUv ).xyz; 6443 float currentLife = texture2D( uCurrentPosition, vUv ).w; // from 1 to 0
6444 float isSpawning = texture2D( uCurrentEmissionRate, vUv ).r; // 1. = spawning, 0. = not spawning 6445 float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active 6446 float timeStart = texture2D( uCurrentEmissionRate, vUv ).b; // timeStart in seconds when the particle was emitted 6447 vec3 originalPosition = ((texture2D( uOriginalPosition, vUv ).xyz) * uEmitterSize); 6448 vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz; 6449 float collisionFlag = texture2D( uCurrentVelocity, vUv ).w; // 1. = collided, 0. = not collided 6450 float lifeTime = uMaxLifeTime; 6451 6452 // Calculate the position adjustment based on collision 6453 // if (collisionFlag > .5) { 6454 float isColliding = step(0.5, collisionFlag); // 1.0 if collisionFlag > 0.5, otherwise 0.0 6455 float bounceOffset = 3.0 * isColliding; // Becomes 3.0 if colliding, 0.0 otherwise 6456 vec3 collisionAdjustedVelocity = velocity * (1.0 + bounceOffset); 6457 6458 // Update position based on collision or normal movement 6459 vec3 fpsVelocity = velocity * min(uFPSRatio, 5.0); 6460 position += mix(fpsVelocity, collisionAdjustedVelocity, isColliding); 6461 6462 // EMISSION RATE - BIRTH 6463 // if (isSpawning == 1.0) { 6464 // Better Approach to avoid If statement 6465 vec3 newPosition = applyQuaternionToVector(uWorldQuaternion, originalPosition) + uWorldOffset; 6466 originalPosition = mix(originalPosition, newPosition, isSpawning); 6467 position = mix(position, originalPosition, isSpawning);; 6468 timeStart = mix(timeStart, uTime, isSpawning); 6469 6470 // Calculate timeLeft for life normalization
6471 float timeLeft = max(lifeTime - (uTime - timeStart), 0.0); 6472 float life_Normalize = timeLeft / lifeTime; 6473 6474 // Use isActive to blend between the calculated color and black 6475 vec4 activeColor = vec4(position, life_Normalize); 6476 // if (isActive == 1.0) { 6477 gl_FragColor = mix(vec4(0.0), activeColor, isActive); 6478 6479} 6480`,DN=` 6481 #ifdef USE_COLLIDER 6482 float restitution = max(uBounce * 2., .01); // Energy Loss 6483 // SPHERE COLLIDER 6484 // ************************************************************** 6485 #ifdef USE_SPHERE_COLLIDER 6486 // Convert collider size to radii (assuming uColliderSize is the diameter in each axis) 6487 vec3 radii = uColliderSize; 6488 // Adjust position relative to collider 6489 vec3 relPos = position - uColliderPos; 6490 // Apply rotation of the collider to the relative position 6491 relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); 6492 // Scale relative position by radii (for ellipsoid collision detection) 6493 vec3 scaledPos = relPos / radii; 6494 // Calculate ellipsoidal distance 6495 float dist = length(scaledPos); // Distance in terms of ellipsoid 6496
6497 // Check for collision 6498 if (dist <= 1. + particleSize / length(radii) && collisionFlag == 0.0) { 6499 // Compute the normal at the collision point, accounting for particle size 6500 vec3 adjustedPos = scaledPos * (1.0 + particleSize / length(radii)); 6501 // Compute the normal at the collision point 6502 vec3 normal = ellipsoidNormal(adjustedPos, radii); 6503 // Rotate the normal back to world space 6504 normal = applyQuaternionToVector(uColliderQuaternion, normal); 6505 // Reflect the velocity vector off the normal 6506 velocity = reflect(velocity, normal) * restitution; 6507 6508 collisionFlag = 1.0; 6509 } else { 6510 collisionFlag = 0.0; 6511 } 6512 #endif 6513 6514 // BOX COLLIDER or PLANE COLLIDER 6515 // ************************************************************** 6516 #ifdef USE_BOX_COLLIDER 6517 // Box dimensions and repulsion variables 6518 vec3 boxHalfSize = uColliderSize / 2.0; 6519 // Convert world position to box's local space 6520 vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); 6521 // Collision detection 6522 vec3 localDistance = abs(localPos) - boxHalfSize; 6523 float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); 6524 6525 // Collision Detected 6526 if (distToSurface <= particleSize * 0.5 && collisionFlag == 0.0) { 6527 // Find the nearest face normal for bounce direction 6528 vec3 normal; 6529 if (localDistance.x > localDistance.y && localDistance.x > localDistance.z) { 6530 normal = vec3(sign(localPos.x), 0.0, 0.0); 6531 } else if (localDistance.y > localDistance.z) { 6532 normal = vec3(0.0, sign(localPos.y), 0.0); 6533 } else { 6534 normal = vec3(0.0, 0.0, sign(localPos.z)); 6535 } 6536 // Rotate normal back to world space 6537 normal = applyQuaternionToVector(uColliderQuaternion, normal); 6538 // Reflect velocity and apply repulsion force 6539 velocity = reflect(velocity, normal) * restitution; 6540 6541 collisionFlag = 1.0; 6542 } else { 6543 collisionFlag = 0.0; 6544 } 6545 #endif 6546 #endif 6547 // END COLLIDER 6548`,DU=` 6549 #ifdef USE_ATTRACTOR 6550 6551 #ifdef USE_SPHERE_COLLIDER 6552 // Convert collider size to radii (assuming uColliderSize is the diameter in each axis) 6553 vec3 radii = uColliderSize; 6554 // Adjust position relative to collider 6555 vec3 relPos = position - uColliderPos; 6556 // Apply rotation of the collider to the relative position 6557 relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); 6558 // Scale relative position by radii (for ellipsoid collision detection) 6559 vec3 scaledPos = relPos / radii; 6560 // Calculate ellipsoidal distance 6561 float distToSurface = length(scaledPos); // Distance in terms of ellipsoid 6562 float insideCheck = 1.0; 6563 6564 #endif 6565 6566 6567 #ifdef USE_BOX_COLLIDER 6568 // Box dimensions 6569 vec3 boxHalfSize = uColliderSize / 2.0; 6570 // Convert world position to box's local space 6571 vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); 6572 vec3 localDistance = abs(localPos) - boxHalfSize; 6573 float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); 6574 float insideCheck = particleSize; 6575 #endif 6576 6577 // Apply vortex force inside the Helper 6578 #ifdef USE_FORCE_LOCAL_SPACE 6579 if (distToSurface <= insideCheck ) { 6580 // Define parameters for the attractor field 6581 #ifdef USE_SPHERE_COLLIDER 6582 float attractorStrength = (1.0 - distToSurface ) * uForceIntensity; // Adjust as needed 6583 #endif 6584 6585 #ifdef USE_BOX_COLLIDER 6586 float attractorStrength = max((1.0 - insideCheck / distToSurface), 0.) * uForceIntensity; // Adjust as needed 6587 #endif 6588 6589 float attractorDamping = uForceDamping; // Adjust as needed (higher values will attenuate velocity more) 6590 6591 // Use the same radii calculation code as for the collider 6592 vec3 attractorRadii = uColliderSize; 6593 // Adjust position relative to attractor center 6594 vec3 relPos = position - uColliderPos; 6595 // Apply rotation of the collider to the relative position 6596 relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); 6597 // Scale relative position by radii (for ellipsoid attraction) 6598 vec3 scaledPos = relPos / attractorRadii; 6599 6600 // Calculate ellipsoidal distance as attractor radius 6601 float attractorRadius = length(scaledPos); 6602 // Calculate the distance from the attractor center 6603 vec3 relativePosition = position - uColliderPos; 6604 // Calculate the force vector towards the attractor center 6605 vec3 attractorForce = normalize(relativePosition) * attractorStrength; 6606 // Apply the attractor force to the particle 6607 velocity -= attractorForce; 6608 // Attenuate the particle's velocity 6609 velocity *= attractorDamping; 6610 } 6611 #else 6612 // Calculate the distance from the attractor center 6613 vec3 relativePosition = position - uColliderPos; 6614 // Calculate the force vector towards the attractor center 6615 vec3 attractorForce = normalize(relativePosition) * uForceIntensity; 6616 // Apply the attractor force to the particle 6617 velocity -= attractorForce; 6618 // Attenuate the particle's velocity 6619 velocity *= uForceDamping; 6620 #endif 6621 #endif 6622`,Dk=` 6623 #ifdef USE_VORTEX 6624 // Box dimensions 6625 vec3 boxHalfSize = uColliderSize / 2.0; 6626 // Convert world position to box's local space 6627 vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); 6628 vec3 localDistance = abs(localPos) - boxHalfSize; 6629 float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); 6630 6631 // Apply vortex force inside the box 6632 if (distToSurface <= particleSize) { 6633 float vortexStrength = uForceIntensity; 6634 vec3 localTopCenter = vec3(0.0, 0., 0.0); 6635 6636 // Transform the local top center to the world space 6637 vec3 vortexCenter = uColliderPos + applyQuaternionToVector(uColliderQuaternion, localTopCenter); 6638 // Calculate the vector from particle to vortex center 6639 vec3 vortexVector = vortexCenter - position; 6640 6641 // Calculate the rotation axis from the inverse of the collider's quaternion and the fixed up vector 6642 // Note: important to add a tiny z component to the up vector to avoid instability 6643 vec3 upVector = vec3(0.0, 1.0, 0.01); 6644 vec3 rotationAxis = cross(upVector, applyQuaternionToVector(uColliderQuaternion, vortexVector)); 6645 rotationAxis = normalize(rotationAxis); 6646 6647 // Add rotational component to velocity 6648 float rotationSpeed = length(vortexVector * vortexStrength * 3.0) ; 6649 6650 vec3 rotationVelocity = rotationAxis * rotationSpeed; 6651 // velocity += rotationVelocity * 0.005 ; 6652 velocity = rotationVelocity * 0.005 ; 6653 6654 // Calculate vortex force 6655 // vec3 vortexForce = normalize(vortexVector) * uSpeed * .1 ; 6656 // Apply the vortex force to the particle 6657 vec3 originDirection = applyQuaternionToVector(uWorldQuaternion, directions); 6658 velocity += applyForce( originDirection * uSpeed * (1. - uForceDamping) , mass * .5); 6659 } 6660 #endif 6661`,DV=` 6662// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU 6663// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU 6664// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU 6665uniform sampler2D uOriginalPosition; 6666uniform sampler2D uDirections; 6667uniform vec3 uDirectionsAxis; 6668uniform vec4 uWorldQuaternion; 6669uniform vec3 uGravity; 6670uniform float uNoiseStrength; // Variation of the noise 6671uniform float uNoiseScale; // Scale of the noise 6672uniform float uNoiseSeed; // Seed of the noise 6673uniform float particleSize; 6674uniform float uSpeed; // update speed of the particles
6675uniform float uRandomMassFactor; 6676 6677// COLLIDER 6678uniform vec3 uColliderPos; // Collider Position 6679uniform vec3 uColliderSize; // Collider Dimension 6680uniform vec4 uColliderQuaternion; // Collider Rotation 6681uniform vec4 uColliderQuaternionInvert; // Collider Rotation 6682uniform float uBounce; // Bounce factor 6683uniform float uForceDamping; 6684uniform float uForceIntensity; 6685 6686 6687 6688 6689 vec3 mod289(vec3 x) { 6690 return x - floor(x * (1.0 / 289.0)) * 289.0; 6691 } 6692 6693 vec4 mod289(vec4 x) { 6694 return x - floor(x * (1.0 / 289.0)) * 289.0; 6695 } 6696 6697 vec4 permute(vec4 x) { 6698 return mod289(((x*34.0)+1.0)*x); 6699 } 6700 6701 vec4 taylorInvSqrt(vec4 r) 6702 { 6703 return 1.79284291400159 - 0.85373472095314 * r; 6704 } 6705 6706 vec3 fade(vec3 t) { 6707 return t*t*t*(t*(t*6.0-15.0)+10.0); 6708} 6709 6710 float snoise(vec3 v) 6711 { 6712 const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 6713 const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 6714 vec3 i = floor(v + dot(v, C.yyy) ); 6715 vec3 x0 = v - i + dot(i, C.xxx) ; 6716 vec3 g = step(x0.yzx, x0.xyz); 6717 vec3 l = 1.0 - g; 6718 vec3 i1 = min( g.xyz, l.zxy ); 6719 vec3 i2 = max( g.xyz, l.zxy ); 6720 vec3 x1 = x0 - i1 + C.xxx; 6721 vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y 6722 vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y 6723 6724 // Permutations 6725 i = mod289(i); 6726 vec4 p = permute( permute( permute( 6727 i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 6728 + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 6729 + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 6730 6731 // Gradients: 7x7 points over a square, mapped onto an octahedron. 6732 // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) 6733 float n_ = 0.142857142857; // 1.0/7.0 6734 vec3 ns = n_ * D.wyz - D.xzx; 6735 6736 vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) 6737 6738 vec4 x_ = floor(j * ns.z); 6739 vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 6740 6741 vec4 x = x_ *ns.x + ns.yyyy; 6742 vec4 y = y_ *ns.x + ns.yyyy; 6743 vec4 h = 1.0 - abs(x) - abs(y); 6744 6745 vec4 b0 = vec4( x.xy, y.xy ); 6746 vec4 b1 = vec4( x.zw, y.zw ); 6747 6748 vec4 s0 = floor(b0)*2.0 + 1.0; 6749 vec4 s1 = floor(b1)*2.0 + 1.0; 6750 vec4 sh = -step(h, vec4(0.0)); 6751 6752 vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 6753 vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 6754 6755 vec3 p0 = vec3(a0.xy,h.x); 6756 vec3 p1 = vec3(a0.zw,h.y); 6757 vec3 p2 = vec3(a1.xy,h.z); 6758 vec3 p3 = vec3(a1.zw,h.w); 6759 6760 //Normalise gradients 6761 vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 6762 p0 *= norm.x; 6763 p1 *= norm.y; 6764 p2 *= norm.z; 6765 p3 *= norm.w; 6766 6767 // Mix final noise value 6768 vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 6769 m = m * m; 6770 return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 6771 dot(p2,x2), dot(p3,x3) ) ); 6772 } 6773 6774 vec3 snoiseVec3( vec3 x ){ 6775 6776 float s = snoise(vec3( x )); 6777 float s1 = snoise(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 )); 6778 float s2 = snoise(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 )); 6779 vec3 c = vec3( s , s1 , s2 ); 6780 return c; 6781 6782 } 6783 6784 6785 vec3 curlNoise( vec3 p, float seed){ 6786 p += seed; 6787 const float e = .1; 6788 vec3 dx = vec3( e , 0.0 , 0.0 ); 6789 vec3 dy = vec3( 0.0 , e , 0.0 ); 6790 vec3 dz = vec3( 0.0 , 0.0 , e ); 6791 6792 vec3 p_x0 = snoiseVec3( p - dx ); 6793 vec3 p_x1 = snoiseVec3( p + dx ); 6794 vec3 p_y0 = snoiseVec3( p - dy ); 6795 vec3 p_y1 = snoiseVec3( p + dy ); 6796 vec3 p_z0 = snoiseVec3( p - dz ); 6797 vec3 p_z1 = snoiseVec3( p + dz ); 6798 6799 float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y; 6800 float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z; 6801 float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x; 6802 6803 const float divisor = 1.0 / ( 2.0 * e ); 6804 return normalize( vec3( x , y , z ) * divisor ); 6805 6806 } 6807 6808 6809// Classic Perlin noise 6810float cnoise(vec3 P) 6811{ 6812 vec3 Pi0 = floor(P); // Integer part for indexing 6813 vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1 6814 Pi0 = mod289(Pi0); 6815 Pi1 = mod289(Pi1); 6816 vec3 Pf0 = fract(P); // Fractional part for interpolation 6817 vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0 6818 vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 6819 vec4 iy = vec4(Pi0.yy, Pi1.yy); 6820 vec4 iz0 = Pi0.zzzz; 6821 vec4 iz1 = Pi1.zzzz; 6822 6823 vec4 ixy = permute(permute(ix) + iy); 6824 vec4 ixy0 = permute(ixy + iz0); 6825 vec4 ixy1 = permute(ixy + iz1); 6826 6827 vec4 gx0 = ixy0 * (1.0 / 7.0); 6828 vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5; 6829 gx0 = fract(gx0); 6830 vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); 6831 vec4 sz0 = step(gz0, vec4(0.0)); 6832 gx0 -= sz0 * (step(0.0, gx0) - 0.5); 6833 gy0 -= sz0 * (step(0.0, gy0) - 0.5); 6834 6835 vec4 gx1 = ixy1 * (1.0 / 7.0); 6836 vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5; 6837 gx1 = fract(gx1); 6838 vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); 6839 vec4 sz1 = step(gz1, vec4(0.0)); 6840 gx1 -= sz1 * (step(0.0, gx1) - 0.5); 6841 gy1 -= sz1 * (step(0.0, gy1) - 0.5); 6842 6843 vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); 6844 vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); 6845 vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); 6846 vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); 6847 vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); 6848 vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); 6849 vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); 6850 vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); 6851 6852 vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 6853 g000 *= norm0.x; 6854 g010 *= norm0.y; 6855 g100 *= norm0.z; 6856 g110 *= norm0.w; 6857 vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 6858 g001 *= norm1.x; 6859 g011 *= norm1.y; 6860 g101 *= norm1.z; 6861 g111 *= norm1.w; 6862 6863 float n000 = dot(g000, Pf0); 6864 float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); 6865 float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); 6866 float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); 6867 float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); 6868 float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); 6869 float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); 6870 float n111 = dot(g111, Pf1); 6871 6872 vec3 fade_xyz = fade(Pf0); 6873 vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); 6874 vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); 6875 float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 6876 return 2.2 * n_xyz; 6877} 6878 6879 6880vec3 fbm_vec3(vec3 p, float frequency, float offset) 6881{ 6882 return vec3( 6883 cnoise((p+vec3(offset))*frequency), 6884 cnoise((p+vec3(offset+20.0))*frequency), 6885 cnoise((p+vec3(offset-30.0))*frequency) 6886 ); 6887} 6888 6889 6890float rand(vec2 co){ 6891 return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453); 6892} 6893vec3 applyQuaternionToVector( vec4 q, vec3 v ){ 6894 return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); 6895 } 6896vec3 applyForce(vec3 force, float mass) { 6897 vec3 acceleration = force / mass; 6898 6899 return acceleration; 6900} 6901 6902vec4 conjugate(vec4 q) { 6903 return vec4(q.w, -q.x, -q.y, -q.z); 6904} 6905 6906// Function to compute the normal of the ellipsoid at a given point 6907vec3 ellipsoidNormal(vec3 p, vec3 radii) { 6908 return normalize(p / (radii * radii)); 6909} 6910 6911float friction = .3; 6912 6913void main() { 6914 vec2 vUv = gl_FragCoord.xy / resolution.xy; 6915 vec3 position = texture2D( uCurrentPosition, vUv ).xyz; 6916 vec3 originalPosition = texture2D( uOriginalPosition, vUv ).xyz; 6917 float timeLeft = texture2D( uCurrentPosition, vUv ).w; 6918 vec3 directions = texture2D( uDirections, vUv ).xyz; 6919 vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz; 6920 float mass = rand(originalPosition.xy) * 0.5 + 0.5;
6921 float isSpawning = texture2D( uCurrentEmissionRate, vUv ).x; // 1. = spawning, 0. = not spawning 6922 float isActive = texture2D( uCurrentEmissionRate, vUv ).y; // 1. = active, 0. = not active 6923 float collisionFlag =texture2D( uCurrentVelocity, vUv ).w; // Indicate collision 6924 6925 // Randomness Mass 6926 mass = (1.0 - (uRandomMassFactor * mass)); 6927 6928 if (isActive == 1.0) { 6929 // ************************************************************** 6930 // FORCES NOISES 6931 // ************************************************************** 6932 #ifdef USE_CURL_NOISE 6933 if (uNoiseScale > 0.0 ) { 6934 velocity = curlNoise(position * uNoiseScale * .002, uNoiseSeed) * ( uNoiseStrength + 1.0) * .05 * uSpeed; 6935 } 6936 // Variation of the noise Over Time 6937 if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { 6938 velocity += curlNoise( position, uNoiseSeed) * uNoiseStrength * 0.05 * uSpeed; 6939 } 6940 #endif 6941 // ************************************************************** 6942 #ifdef USE_SIMPLEX_NOISE 6943 if (uNoiseScale > 0.0 ) { 6944 velocity = vec3(snoise(position * uNoiseScale * .001) * ( uNoiseStrength + 1.0) * .1); 6945 velocity *= uSpeed; 6946 } 6947 // Variation of the noise Over Time 6948 if (uNoiseStrength > 0.0 && uNoiseScale == 0.0) { 6949 velocity += vec3(snoise(position * uNoiseStrength * .001) * .05 * uSpeed); 6950 } 6951 #endif 6952 // ************************************************************** 6953 #ifdef USE_FBM_NOISE 6954 if (uNoiseScale > 0.0 ) { 6955 velocity = fbm_vec3(position * uNoiseScale * .001, ( uNoiseStrength + 1.0), uNoiseSeed); 6956 velocity *= uSpeed; 6957 } 6958 // Variation of the noise Over Time 6959 if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { 6960 velocity += fbm_vec3(position * uNoiseStrength * .001, ( uNoiseStrength + 1.0), uNoiseSeed) * .1 * uSpeed; 6961 } 6962 #endif 6963 6964 // COLLIDER 6965 ${DN} 6966 // ATTRACTION 6967 ${DU} 6968 // VORTEX 6969 ${Dk} 6970 } 6971 // End isActive 6972 6973 // SPAWN BIRTH 6974 // ************************************************************** 6975 // if (isSpawning == 1.) 6976 #ifdef USE_NORMALS 6977 velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, directions) * uSpeed, isSpawning); 6978 #else 6979 velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, uDirectionsAxis) * uSpeed, isSpawning); 6980 #endif 6981 6982 // if (collisionFlag == 0.0) 6983 velocity += applyForce(uGravity, mass * .5) * (1.0 - collisionFlag); 6984 6985 gl_FragColor = vec4(velocity, collisionFlag); 6986} 6987`,Dj=` 6988 6989 // Linear Fade In 6990 float linearFadeIn(float t) { 6991 return t; 6992 } 6993 6994 6995 // linear fade out 6996 float linearFadeOut(float t) { 6997 return 1.0 - t; 6998 } 6999 7000 float linearInOut(float t) { 7001 return t < 0.5 ? t : (1.0 - t); 7002 } 7003 7004 // lerp 7005 float lerp(float a, float b, float t) { 7006 return a + (b - a) * t; 7007 } 7008 7009 // Ease In Out Quart 7010 float exponentialInOut(float t) { 7011 return t < 0.4 ? lerp(0.0, 1.0, t / 0.4) : 7012 t > 0.6 ? lerp(1.0, 0.0, (t - 0.6) / 0.4) : 7013 1.0; 7014 } 7015 7016 // constant 7017 float constant(float t) { 7018 return 1.0; 7019 } 7020`,DG=` 7021 7022float rand(vec3 co){ 7023 return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 7024} 7025 7026vec3 applyQuaternionToVector( vec4 q, vec3 v ){ 7027 return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); 7028} 7029 7030vec3 applyForce(vec3 force, float mass) { 7031 vec3 acceleration = force / mass; 7032 7033 return acceleration; 7034} 7035`,DH=` 7036vec3 rgb2xyz (in vec3 rgb) { 7037 float r = rgb.r; 7038 float g = rgb.g; 7039 float b = rgb.b; 7040 7041 r = r > 0.04045 ? pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); 7042 g = g > 0.04045 ? pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); 7043 b = b > 0.04045 ? pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); 7044 7045 float x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); 7046 float y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); 7047 float z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); 7048 7049 vec3 xyz = vec3( 7050 (r * 0.4124) + (g * 0.3576) + (b * 0.1805) * 100.0, 7051 (r * 0.2126) + (g * 0.7152) + (b * 0.0722) * 100.0, 7052 (r * 0.0193) + (g * 0.1192) + (b * 0.9505) * 100.0 7053 ); 7054 return(xyz); 7055} 7056 7057vec3 xyz2lab (in vec3 xyz) { 7058 float x = xyz.x / 95.047; 7059 float y = xyz.y / 100.0; 7060 float z = xyz.z / 108.883; 7061 7062 x = x > 0.008856 ? pow(x, 1.0 / 3.0) : (7.787 * x) + (16.0 / 116.0);
7063 y = y > 0.008856 ? pow(y, 1.0 / 3.0) : (7.787 * y) + (16.0 / 116.0); 7064 z = z > 0.008856 ? pow(z, 1.0 / 3.0) : (7.787 * z) + (16.0 / 116.0); 7065 7066 vec3 lab = vec3((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z)); 7067 return(lab); 7068} 7069 7070vec3 rgb2lab(in vec3 rgb) { 7071 vec3 xyz = rgb2xyz(rgb); 7072 vec3 lab = xyz2lab(xyz); 7073 return(lab); 7074} 7075 7076vec3 xyz2rgb (in vec3 xyz) { 7077 float x = xyz.x / 100.0; 7078 float y = xyz.y / 100.0; 7079 float z = xyz.z / 100.0; 7080 7081 7082 float r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); 7083 float g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); 7084 float b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); 7085 7086 r = r > 0.0031308 ? ((1.055 * pow(r, 1.0 / 2.4)) - 0.055) : r * 12.92; 7087 g = g > 0.0031308 ? ((1.055 * pow(g, 1.0 / 2.4)) - 0.055) : g * 12.92; 7088 b = b > 0.0031308 ? ((1.055 * pow(b, 1.0 / 2.4)) - 0.055) : b * 12.92; 7089 7090 r = min(max(0.0, r), 1.0); 7091 g = min(max(0.0, g), 1.0); 7092 b = min(max(0.0, b), 1.0); 7093 7094 return(vec3(r, g, b)); 7095} 7096 7097vec3 lab2xyz (in vec3 lab) { 7098 float l = lab.x; 7099 float a = lab.y; 7100 float b = lab.z; 7101 7102 float y = (l + 16.0) / 116.0; 7103 float x = a / 500.0 + y; 7104 float z = y - b / 200.0; 7105 7106 float y2 = pow(y, 3.0); 7107 float x2 = pow(x, 3.0); 7108 float z2 = pow(z, 3.0); 7109 7110 y = y2 > 0.008856 ? y2 : (y - 16.0 / 116.0) / 7.787; 7111 x = x2 > 0.008856 ? x2 : (x - 16.0 / 116.0) / 7.787; 7112 z = z2 > 0.008856 ? z2 : (z - 16.0 / 116.0) / 7.787; 7113 7114 x *= 95.047; 7115 y *= 100.0; 7116 z *= 108.883; 7117 7118 return(vec3(x, y, z)); 7119} 7120vec3 lab2rgb (in vec3 lab) { 7121 vec3 xyz = lab2xyz(lab); 7122 vec3 rgb = xyz2rgb(xyz); 7123 return(rgb); 7124} 7125 7126`,DW=` 7127 uniform sampler2D uPosition; 7128 uniform float uSize; 7129 uniform float uSizeEnd; 7130 uniform vec3 uWorldOffset; 7131 uniform vec4 uWorldQuaternion; 7132 // Billboard Behavior - Currently at Zero, but we can change that 7133 uniform float uRotation; 7134 uniform float uRotationEnd; 7135 uniform vec2 center; 7136 7137 // Randomness 7138 uniform float uRandScaleFactor; 7139 uniform float uRandRotationFactor; 7140 7141 attribute vec2 ref; 7142 7143 varying float v_LifeLeft; // normalized lifetime 1 to 0 7144 varying vec2 vUv; 7145 varying vec2 vRef; 7146 7147 ${DG} 7148 ${Dj} 7149`,Dq=({easeSize:e="linearFadeOut"})=>` 7150 vUv = uv; 7151 vRef = ref; 7152 // Normalized LifeTime 1 to 0 7153 float lifeLeft = texture2D(uPosition, ref).w; 7154 v_LifeLeft = lifeLeft; 7155 // Position From DataTexture Simulation 7156 vec3 pos = texture2D(uPosition, ref).rgb - uWorldOffset; 7157 // Apply World Quaternion 7158 pos = applyQuaternionToVector(uWorldQuaternion, pos); 7159 7160 #ifdef USE_SIZE_END 7161 // Scaled Over Time 7162 float t = 1. - lifeLeft; 7163 float currentSize = mix(uSize, uSizeEnd, t); // Linearly interpolate between uSize and uSizeEnd 7164 vec3 scaledPosition = position * vec3(currentSize); 7165 #else 7166 // Change Size Behavior over LifeTime 7167 float easeSize = ${e}(1. - lifeLeft); 7168 // Scaled Over Time 7169 vec3 scaledPosition = position * vec3(uSize * easeSize); 7170 #endif 7171 7172 // Billboard Behavior 7173 vec2 scale; 7174 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 7175 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 7176 // Randomness 7177 float randRef = rand(ref); 7178 scale *= (1.0 - (uRandScaleFactor * randRef)); 7179 // Rotation 7180 float randRotation = 2.0 * PI * ( uRandRotationFactor * randRef); 7181 float originalRotation = (1.0 - uRotation) * 2.0 * PI; 7182 float originalRotationEnd = (1.0 - uRotationEnd) * 2.0 * PI; 7183 // OverTime 7184 float finalRotation = mix(originalRotation + randRotation, originalRotationEnd + randRotation, lifeLeft); 7185 7186 vec2 alignedPosition = ( scaledPosition.xy - ( center - vec2( 0.5 ) ) ) * scale; 7187 vec2 rotatedPosition; 7188 rotatedPosition.x = cos( finalRotation ) * alignedPosition.x - sin( finalRotation ) * alignedPosition.y; 7189 rotatedPosition.y = sin( finalRotation ) * alignedPosition.x + cos( finalRotation ) * alignedPosition.y; 7190 7191 mat4 instanceMatrix = mat4( 7192 vec4(1.0, 0.0, 0.0, 0.0), 7193 vec4(0.0, 1.0, 0.0, 0.0), 7194 vec4(0.0, 0.0, 1.0, 0.0), 7195 vec4(pos.x, pos.y, pos.z, 1.0) 7196 ); 7197 7198 mvPosition = modelViewMatrix * instanceMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 7199 mvPosition.xy += rotatedPosition; 7200 gl_Position = projectionMatrix * mvPosition; 7201`,DX=` 7202 uniform vec4 uColor; // start color 7203 uniform vec4 uColor2; // end color 7204 uniform sampler2D uTexture; // texture 7205 varying float v_LifeLeft; // normalized lifetime 1 to 0 7206 varying vec2 vUv; 7207 varying vec2 vRef; 7208 7209 float random(vec2 co) { 7210 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); 7211 } 7212 `+Dj+` 7213 ${DH} 7214 7215`,DY=({easeOpacity:e="linearFadeOut"})=>` 7216 // if Particle is dead, hide it 7217 if (v_LifeLeft <= 0.005 ) { 7218 discard; 7219 } 7220 7221 #ifdef USE_RANDOM_COLORING 7222 float randVal = random(vRef); // Generate a random value based on the reference 7223 vec4 color = mix(uColor, uColor2, randVal); // Interpolate between the two colors 7224 #else 7225 vec4 color = mix(uColor, uColor2, 1. - v_LifeLeft); 7226 #endif 7227 7228 // Opacity over Life Time 7229 float finalAlpha = ${e}(1. - v_LifeLeft); 7230 vec4 textureColor = texture2D(uTexture, vUv).rgba; 7231 finalColor = textureColor.rgb * color.rgb; 7232 finalAlpha = color.a * textureColor.a * finalAlpha; 7233 7234 gl_FragColor = vec4(finalColor, finalAlpha); 7235 7236`,DQ=class extends sl{constructor(e,t){super(),this.needsJitter=!0,this.type="ParticleMaterial",this.easeOpacity="linearFadeIn",this.easeSize="linearFadeIn",this.useSizeEnd=!1,this.isColoringRandom=!1,this.init(e,t),this.context=t}reset(){}init(e,t){this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.easeOpacity=e.ease,this.easeSize=e.easeSize,this.layers=[],_E.startContext(_E.globalContext),this.lightLayer=new M_(0,"",{...g3.defaultData("light","phong"),visible:!1},new AV,{},t.shared),_E.endContext(_E.globalContext),this.build()}updateState(e){void 0!==e.coloring&&(this.isColoringRandom="random"===e.coloring),void 0!==e.color&&(e.color instanceof Array?this.uniforms.uColor.value=e.color:this.uniforms.uColor.value=this.context.shared.color(e.color)),void 0!==e.color2&&(e.color2 instanceof Array?this.uniforms.uColor2.value=e.color2:this.uniforms.uColor2.value=this.context.shared.color(e.color2)),void 0!==e.size&&(this.uniforms.uSize.value=e.size[0],this.uniforms.uSizeEnd.value=e.size[1],e.size[0]!==e.size[1]?this.useSizeEnd=!0:this.useSizeEnd=!1),void 0!==e.ease&&(this.easeOpacity=e.ease,this.build()),void 0!==e.easeSize&&(this.easeSize=e.easeSize,this.build()),this.needsUpdate=!0}onBeforeCompile(e){this.build(),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader}build(){let e=new Ar;return e.needsJitter=this.needsJitter,e.addFragmentParsCode(_8),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.addFragmentFinalCode(_9),this.isColoringRandom&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(DW),e.addFragmentParsCode(DX),e.addVertexFinalCode(Dq({easeSize:this.easeSize})),e.addFragmentFinalCode(DY({easeOpacity:this.easeOpacity})),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms={...e.uniforms,...this.uniforms},this.extensions=e.extensions,this}get nodeMaterial(){return this}get fragment(){return this.lightLayer.node}getDefines(){return this.defines}
7236nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}},DZ=class{constructor(e,t,i,r){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=e,this.type=i,this.textureSize=Math.max(Math.ceil(Math.sqrt(t)),1),this.targetMesh=r?.geometry.type==="BufferGeometry"||r?.type==="Mesh"&&r&&r.geometry.hasAttribute("position")&&r.geometry.hasAttribute("normal")?r:this.getMesh(i,1);let{positions:a,dataTexture:o,dataTextureNormals:l}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(i,1));this.positionsTexture=o,this.positionsAttribute=a,this.directionsTexture=l}createPositions(e,t){let{positions:i,normals:r}=function(e,t){let i=new r7(e.geometry,e.material),r=[],a=[],o=new iD,l=new iD;null!==i.geometry.index&&(i.geometry=i.geometry.toNonIndexed());let h=new DB(i).build();for(let e=0;e<t;e++)h.sample(o,l),r.push(o.x,o.y,o.z),a.push(l.x,l.y,l.z);return{positions:new Float32Array(r),normals:new Float32Array(a)}}(t,e*e);return{dataTexture:Dz(i,e),positions:i,dataTextureNormals:Dz(r,e)}}getMesh(e,t){let i=null;switch(e){case"SphereEmitterShape":i=new oW(.5*t,32,32);break;case"TorusEmitterShape":i=new oq(.5*t,.3,15,40);break;case"ConeEmitterShape":i=new ow(t,t,15);break;case"BoxEmitterShape":i=new st(t,t,t);break;case"PlaneEmitterShape":(i=new s_(t,t)).rotateX(-Math.PI/2);break;default:i=new oW(t,32,32)}return new r7(i,new rB({color:16711680}))}applyToShader(e,t){this.size=new iD().fromArray(t.size.map(e=>"number"==typeof e?e:1)),e.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function DK(e){let t={...e},i=gW.defaultData;t.forceFieldObjectId&&(t.colliderEntityId=t.forceFieldObjectId);let r={...i.shape,...t.shape},a={...i.renderMaterial,...t.renderMaterial};return{...i,...t,shape:r,renderMaterial:a}}var DJ=` 7237// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU 7238// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU 7239// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU 7240 7241uniform sampler2D uIndex; // Texture with corresponding index 7242uniform float uLastIndexEmitted; // Last emitted index 7243uniform float uParticlesToEmit; // Number of particles to emit on that frame 7244uniform float uTime; 7245 7246void main() { 7247 vec2 vUv = gl_FragCoord.xy / resolution.xy; 7248 float particleIndex = texture(uIndex, vUv).x; 7249 float timeLeft = texture2D( uCurrentPosition, vUv ).w; 7250 float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active 7251 float timeStart = texture2D( uCurrentEmissionRate, vUv ).b; 7252 7253 7254 // ********** Detect Colision to Create a flag and use it in position ********** 7255 // We are doing this here, so 7256 7257 // ********** Emit Particles ********** 7258 // X = isSpawning 0.0 or 1.0 7259 // Y = isActive 0.0 or 1.0 7260 // Check if the vertex index is between the first value and the last value 7261 // if (particleIndex >= uLastIndexEmitted && particleIndex < uLastIndexEmitted + uParticlesToEmit) { 7262 // // Emit a particle by writing 1 to the red channel of the color output 7263 // // r: 1. == emit the particle 7264 // // g: 1. == particle is now active 7265 // timeStart = uTime; 7266 // gl_FragColor = vec4(1.0, 1.0, timeStart, 1.0); 7267 // } else { 7268 // // The Particle is either already emitted or not in the range of the particles to emit 7269 // // Do not emit a particle by writing 0 to the red channel of the color output 7270 // gl_FragColor = vec4(0.0, isActive, timeStart, 1.0); 7271 // } 7272 // Determine if the particle is within the emission range 7273 float emitLowerBound = step(uLastIndexEmitted, particleIndex); 7274 float emitUpperBound = step(particleIndex, uLastIndexEmitted + uParticlesToEmit - 1.0); 7275 float emitParticle = emitLowerBound * emitUpperBound; // 1.0 if in range, 0.0 otherwise 7276 7277 // Set timeStart and color 7278 timeStart = mix(timeStart, uTime, emitParticle); 7279 gl_FragColor = vec4(emitParticle, mix(isActive, 1.0, emitParticle), timeStart, 1.0); 7280 7281 7282} 7283`,D$=class extends rw{constructor(e,t){super(),this.type="ParticleEmitter",this.debugMode=!1,this.worldS
vendor: 5,671 bytes, line 7283
7283pace=!0,this.rootObject=null,this.gpuCompute=null,this.positionSimRT=null,this.velocitySimRT=null,this.emissionRateSimRT=null,this.emitterShape=void 0,this.isEmitting=!1,this.hasBeenReset=!1,this.emittedParticlesAmount=0,this.lastEmitTime=0,this.globalTime=0,this.targetFPS=60,this.previousRatio=1,this.lerpFactor=.4,this.particlesAmount=0,this.noiseStrength=0,this.noiseScale=0,this.isBillboardBased=!0,this.simFeaturesDefinition={USE_COLLIDER:!1,USE_ATTRACTOR:!1,USE_VORTEX:!1,USE_SPHERE_COLLIDER:!1,USE_BOX_COLLIDER:!1,USE_FORCE_LOCAL_SPACE:!1,USE_NORMALS:!1,USE_CURL_NOISE:!0,USE_SIMPLEX_NOISE:!1,USE_FBM_NOISE:!1},this.textureLoader=new ld,this.currentWorldPosition=new iD,this.systemQuaternion=new iP,this.worldGravity=new iD(0,0,0),this.directionAxis=new iD(0,0,0),this.colliderV3=new iD(0,0,0),this.colliderQuaternion=new iP(0,0,0,1),this.matrixAutoUpdate=!0,this.renderer=e,this.system=t,this.shared=t.context.shared;let i=t.data;this.material=new DQ(i.renderMaterial,t.context),this.material.uniforms={uSize:{value:0},uSizeEnd:{value:0},uColor:{value:i.renderMaterial.color},uColor2:{value:i.renderMaterial.color2},uPosition:{value:new iD(0,0,0)},uEmissionData:{value:new iD(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new iD(0,0,0)},uWorldQuaternion:{value:new iA(0,0,0,1)},uRandScaleFactor:{value:i.randomScale??0},uRandRotationFactor:{value:i.randomRotation??0},uRotation:{value:i.renderMaterial.spriteRotation[0]??0},uRotationEnd:{value:i.renderMaterial.spriteRotation[1]??0}},this.setTexture(this.material.uniforms,i.renderMaterial.texture),this.init(i)}setTexture(e,t){let i=t.data;if("string"==typeof t){let i=new i_(this.shared.image(t).img);i.needsUpdate=!0,e.uTexture.value=i;return}if("string"!=typeof i){let t=new Image;t.onload=()=>{let i=new i_(t);i.needsUpdate=!0,e.uTexture.value=i};let r=new Blob([i],{type:"image/*"}),a=URL.createObjectURL(r);t.src=a}}updateGeometryAttributes(e,t){let i=function(e){let t=new Float32Array(e*e*2);for(let i=0;i<e;i++)for(let r=0;r<e;r++){let a=i*e+r;t[2*a+0]=i/(e-1),t[2*a+1]=r/(e-1)}return t}(t);this.emitterShape?.positionsAttribute&&e.geometry.setAttribute("ref",new nj(i,2))}applyWorldSpace(){if(!this.system.started||!this.worldSpace||!this.positionSimRT||!this.velocitySimRT)return;let e=this.system;e.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),e.getWorldPosition(this.currentWorldPosition),this.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.positionSimRT.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.systemQuaternion.invert(),this.positionSimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.velocitySimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize())}update(e,t){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset){this.reset();return}this.applyWorldSpace(),this.globalTime=e,this.positionSimRT.material.uniforms.uTime.value=e,this.emissionRateSimRT.material.uniforms.uTime.value=e;let i=this.targetFPS/(1e3/t),r=this.previousRatio+(i-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=r,this.previousRatio=r;let a=this.isEmitting?this.GoEmitSomeParticles(e,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=a,this.material.uniforms.uPosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT)?.texture,this.system.colliderEntities.length>0&&this.renderColliders(),this.gpuCompute.compute()}renderColliders(){if(!this.velocitySimRT)return;let e=this.system.colliderEntities[0],t=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&t&&this.init(DK({...this.system.data,colliderEntityId:null})),!e||e.destroyedInAction)return;e.getWorldPosition(this.colliderV3),0===this.colliderV3.y&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);let i=e.data.size;this.colliderV3.fromArray(i),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),e.getWorldQuaternion(this.colliderQuaternion),this.velocitySimRT.material.uniforms.uColliderQuaternion.value.copy(this.colliderQuaternion.normalize()),this.velocitySimRT.material.uniforms.uColliderQuaternionInvert.value.copy(this.colliderQuaternion.normalize().invert())}updateState(e){this.velocitySimRT&&this.positionSimRT&&(e.renderMaterial&&this.updateMaterialState(e.renderMaterial),this.updateParticleState(e))}updateVariableState(e,t){if(!this.velocitySimRT||!this.positionSimRT)return;"size"===t[2]&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),"sizeEnd"===t[2]&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});let i=(e,t)=>{let i=[...this.system.data.shape.size];i[e]=t,this.updateParticleState({shape:{...this.system.data.shape,size:i}})};"shape_size_0"===t[2]&&i(0,e),"shape_size_1"===t[2]&&i(1,e),"shape_size_2"===t[2]&&i(2,e),"speed"===t[2]&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/10),"gravity"===t[2]&&this.worldGravity.set(0,e/100,0),"noiseStrength"===t[2]&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),"n
7283oiseScale"===t[2]&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),"direction_x"===t[2]&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),"direction_y"===t[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),"direction_z"===t[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}updateMaterialState(e){this.material.updateState({...e,size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}updateParticleState(e){if(!(!this.positionSimRT||!this.velocitySimRT)){if(this.shouldReInitGPUCompute(e)&&this.init(DK(this.system.data)),void 0!==e.life&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),void 0!==e.speed&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10),void 0!==e.collisionBounce&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),void 0!==e.noiseStrength&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),void 0!==e.noiseScale&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),void 0!==e.noiseSeed&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),void 0!==e.randomMass&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),e.renderMaterial?.size!==void 0){let t=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(t)}if(e.renderMaterial?.spriteRotation!==void 0&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),void 0!==e.shape){let t=e.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(t[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t[2],[this.uuid,"particles","shape_size_2"]))],r={...DK(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,r)}if(void 0!==e.gravity&&(this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.velocitySimRT.material.uniforms.uGravity={value:this.worldGravity}),void 0!==e.direction){let t=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(t),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}void 0!==e.randomRotation&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),void 0!==e.randomScale&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}updateForceFieldParameters(e){this.velocitySimRT&&(void 0!==e.forceIntensity&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),void 0===e.forceDambing||(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}getDirectionAxis(e){let t=[Number(e[0])*t8.DEG2RAD,Number(e[1])*t8.DEG2RAD,Number(e[2])*t8.DEG2RAD],i=new rn(t[0],t[1],t[2],"XYZ");return this.directionAxis.set(0,1,0).applyEuler(i).normalize(),this.velocitySimRT&&(this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis),this.directionAxis}shouldReInitGPUCompute(e){let{birthRatePerSec:t,rootObjectType:i,colliderEntityId:r,shape:a,emitTimeDuration:o,emitTimeCycle:l,life:h,directionMode:c,noiseType:d}=e;return void 0!==t||void 0!==i||r||null===r||void 0!==l||void 0!==a||void 0!==h||void 0!==o||void 0!==c||void 0!==d}init(e){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.b
7283irthRatePerSec,particleMaxLifeTime:e.life,loopDuration:"infinity"===e.emitTimeCycle?0:e.emitTimeDuration}),this.particlesAmount>1e5&&(console.warn("The maximum number of particles is limited to 100000."),this.particlesAmount=1e5),this.emitterShape=this.createShape(e.shape,this.particlesAmount);let t=setInterval(()=>{if(this.emitterShape){if(isNaN(this.emitterShape.positionsTexture.source.data.data[0])){this.init(e);return}clearInterval(t)}},100);if(!this.emitterShape)return;let i=new DI(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),r=this.updateSimulationDefinition(e),a=i.addVariable("uCurrentPosition",r+DF,this.emitterShape.positionsTexture),o=i.addVariable("uCurrentVelocity",r+DV,this.emitterShape.directionsTexture),l=i.addVariable("uCurrentEmissionRate",DJ,function(e){let t=new Float32Array(4*e*e);for(let i=0;i<e*e;i++)t[4*i]=0,t[4*i+1]=0,t[4*i+2]=0,t[4*i+3]=0;let i=new nN(t,e,e,1023,1015);return i.needsUpdate=!0,i}(this.emitterShape.textureSize));i.setVariableDependencies(a,[a,o,l]),i.setVariableDependencies(o,[a,o,l]),i.setVariableDependencies(l,[a,o,l]);let h=function({size:e}){let t=new Float32Array(4*e*e);for(let i=0;i<e*e;i++)t[4*i]=i,t[4*i+1]=0,t[4*i+2]=0,t[4*i+3]=0;let i=new nN(t,e,e,1023,1015);return i.needsUpdate=!0,i}({size:this.emitterShape.textureSize}),c={uOriginalPosition:{value:this.emitterShape.positionsTexture},uWorldOffset:{value:new iD(0,0,0)},uWorldQuaternion:{value:new iA(0,0,0,1)},uTime:{value:0},uFPSRatio:{value:1},uMaxLifeTime:{value:e.life},uEmitterSize:{value:new iD(Number(this.shared.getVariable(e.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.shape.size[2],[this.uuid,"particles","shape_size_2"])))},particleSize:{value:0}};a.material.uniforms=c;let d=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(d),this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"]));let p=e.colliderEntityId&&this.system.getColliderData(e.colliderEntityId),f={uOriginalPosition:{value:this.emitterShape.positionsTexture},uDirections:{value:this.emitterShape.directionsTexture},uDirectionsAxis:{value:this.directionAxis},uWorldQuaternion:{value:new iA(0,0,0,1)},uColliderPos:{value:new iD(0,0,0)},uColliderSize:{value:new iD(0,0,0)},uForceIntensity:{value:p?p.forceIntensity:0},uForceDamping:{value:p?p.forceDambing:0},uColliderQuaternion:{value:new iA(0,0,0,1)},uColliderQuaternionInvert:{value:new iA(0,0,0,1)},particleSize:{value:0},uGravity:{value:this.worldGravity},uNoiseStrength:{value:this.noiseStrength},uNoiseScale:{value:this.noiseScale},uNoiseSeed:{value:e.noiseSeed},uRandomMassFactor:{value:e.randomMass},uBounce:{value:e.collisionBounce},uSpeed:{value:Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10}};o.material.uniforms=f,l.material.uniforms={uIndex:{value:h},uTime:{value:0},uLastIndexEmitted:{value:0},uParticlesToEmit:{value:0}};let m=[Number(this.shared.getVariable(e.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.shape.size[2],[this.uuid,"particles","shape_size_2"]))],g={...DK(this.system.data).shape,size:m};this.emitterShape.applyToShader(a.material.uniforms,g),i.init(),this.gpuCompute=i,this.positionSimRT=a,this.velocitySimRT=o,this.emissionRateSimRT=l,this.rootObject=this.createPrimaryEmitter(this.emitterShape.textureSize),this.add(this.rootObject),this.material.needsUpdate=!0}getDirectionFromVariable(e){return[Number(this.shared.getVariable(e[0],[this.uuid,"particles","direction_x"])),Number(this.shared.getVariable(e[1],[this.uuid,"particles","direction_y"])),Number(this.shared.getVariable(e[2],[this.uuid,"particles","direction_z"]))]}updateSimulationDefinition(e){if(this.simFeaturesDefinition.USE_COLLIDER=!1,this.simFeaturesDefinition.USE_ATTRACTOR=!1,this.simFeaturesDefinition.USE_VORTEX=!1,this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!1,this.simFeaturesDefinition.USE_BOX_COLLIDER=!1,this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!1,this.simFeaturesDefinition.USE_NORMALS=!1,this.simFeaturesDefinition.USE_CURL_NOISE=!1,this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!1,this.simFeaturesDefinition.USE_FBM_NOISE=!1,e.colliderEntityId&&this.system.colliderEntities.length>0){let t=this.system.getColliderData(e.colliderEntityId);switch(t?.forceType){case"attractor":this.simFeaturesDefinition.USE_ATTRACTOR=!0;break;case"collider":this.simFeaturesDefinition.USE_COLLIDER=!0;break;case"vortex":this.simFeaturesDefinition.USE_VORTEX=!0}let i=t?.colliderType;"sphere"===i&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),"box"===i&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),t?.forceRange==="helper"&&(this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!0)}"normals"===e.directionMode&&(this.simFeaturesDefinition.USE_NORMALS=!0),"curl"===e.noiseType&&(this.simFeaturesDefinition.USE_CURL_NOISE=!0),"simplex"===e.n
7283oiseType&&(this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!0),"fbm"===e.noiseType&&(this.simFeaturesDefinition.USE_FBM_NOISE=!0);let t="";for(let[e,i]of Object.entries(this.simFeaturesDefinition))i&&(t+=`#define ${e} 7284`);return t}createShape(e,t){this.emitterShape&&this.emitterShape.dispose();let i=new iD(Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.size[2],[this.uuid,"particles","shape_size_2"])));if("MeshEmitterShape"!==e.type)return new DZ(i,t,e.type);{let r=null;return this.system.context.scene.traverseEntity(t=>{t.uuid===e.fromMeshId&&(r=t)}),r?new DZ(i,t,e.type,r):new DZ(i,t,"SphereEmitterShape")}}createPrimaryEmitter(e){let t;return(t=new nY(new s_(1,1,1),this.material,e*e)).renderOrder=1,this.updateGeometryAttributes(t,e),this.material.needsUpdate=!0,t.onBeforeRender=()=>{this.applyWorldSpace()},t}getMaxParticlesAmount({birthRatePerSecond:e,particleMaxLifeTime:t,loopDuration:i=0}){return Math.ceil(e*(t+i))}dispose(){this.gpuCompute&&(this.rootObject?.parent?.remove(this.rootObject),this.gpuCompute.dispose(),this.material.nodeMaterialDispose(),this.emitterShape?.dispose())}GoEmitSomeParticles(e,t){let i=e-this.lastEmitTime,r=1/t;if(i>=r){let t=Math.max(1,Math.floor(i/r));return this.lastEmitTime=e,this.emittedParticlesAmount+t>this.particlesAmount&&(this.emittedParticlesAmount=0),this.emittedParticlesAmount+=t,t}return 0}checkIfAllParticlesAreDead(){return this.lastEmitTime+this.system.data.life+1<this.globalTime}reset(){this.hasBeenReset=!0,this.lastEmitTime=0,this.emittedParticlesAmount=0,this.gpuCompute&&this.init(DK(this.system.data))}startEmitting(e){this.isEmitting=!0,this.hasBeenReset=!1,this.lastEmitTime=e}stopEmitting(){this.isEmitting=!1}},D0=class extends _A{constructor(e,t,i){super(e,t),this.type="ParticleSystem",this.geometry=new rQ,this.actualTime=0,this.currentLoopTime=0,this.started=!1,this.stopped=!1,this.timeoutId=void 0,this.isFrozen=!1,this.isIdle=!0,this.emitter=null,this.colliderEntities=[],this.renderer=null,this.isPreWarm=!1,this._hasOnAfterRenderBeenCalled=!1,this.onAfterRender=e=>{this._hasOnAfterRenderBeenCalled||(this._hasOnAfterRenderBeenCalled=!0,this.init(e))},this.context=i,this.data={...t,...DK(t)},this.geometry.setAttribute("position",new rV([],3)),this.material=new rB({colorWrite:!1}),this.frustumCulled=!1}init(e){this.renderer=e,this.emitter=new D$(e,this),this.add(this.emitter),this.updateParticleState(this.data)}update(e){if(!this.isReady||!this.started||this.isFrozen||this.isIdle)return;this.actualTime+=e,this.stopped||(this.currentLoopTime+=e);let t="one_time"===this.data.emitTimeCycle;if(("loop"===this.data.emitTimeCycle||t)&&this.currentLoopTime>1e3*this.data.emitTimeDuration&&(this.stopped||(this.stop(),t||this.start(1e3*this.data.emitTimeDelay))),this.emitter&&this.started){let t=this.actualTime/1e3;this.emitter.update(t,e)}this.scale.set(1,1,1),this.updateMatrix()}isReady(){return!!this.emitter}hasCollider(e){return this.colliderEntities.some(t=>t.identity===e)}getColliderData(e){let t=this.colliderEntities.find(t=>t.identity===e);return t?t.data:null}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),fd(e.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:{...this.data.renderMaterial,...fv.drop(e,1).props}}),fd(e.path,["shape"])&&this.updateParticleState({shape:{...this.data.shape,...fv.drop(e,1).props}})}updateState(e,t){super.updateState(e,t),this.updateParticleState(e)}updateParticleState(e){if(this.emitter){if(void 0!==e.colliderEntityId&&null!==e.colliderEntityId){let t=this.context.scene.find(e.colliderEntityId);this.colliderEntities=t?[t]:[]}null===e.colliderEntityId&&(this.colliderEntities=[]),this.emitter.updateState(e),e.emitTimeCycle&&this.started&&this.start()}}updateFromColliderEntity(e){this.emitter&&(this.emitter.updateForceFieldParameters(e),this.stop(),this.start())}start(e=0){if(this.currentLoopTime=0,e){this.timeoutId=window.setTimeout(()=>{this.start(0)},e);return}this.started=!0,this.stopped=!1,this.isFrozen=!1,this.emitter?.startEmitting(this.actualTime/1e3)}froze(){this.isFrozen=!0}unFroze(){this.isFrozen=!1}stop(){this.stopped=!0,this.currentLoopTime=0,this.emitter?.stopEmitting(),clearTimeout(this.timeoutId)}reset(){this.started=!1,this.stopped=!1,this.emitter?.reset()}wakeUp(){this.isIdle=!1}sleep(){this.isIdle=!0,this.reset()}},D1=function(){try{let e=window.location.href;if(e.includes("reducesubdiv=")){let t=e.indexOf("reducesubdiv=")+13;return parseInt(e.slice(t,t+1))}}catch{}}();function D2(e,t,i){return console.assert(void 0!==t.type),"Mesh"===t.type?(void 0!==D1&&t?.geometry&&"subdivisions"in t.geometry&&(t.geometry.subdivisions??0)>D1&&Object.assign(t.geometry,{subdivisions:D1}),"TextGeometry"===t.geometry.type?new EU(e,t,i):"InputGeometry"===t.geometry.type?new DE(e,t,i):"SubdivGeometry"===t.geometry.type?new Ef(e,t,i):"PathGeometry"===t.geometry.type?new DM(e,t,i):"VectorGeometry"===t.geometry.type?new DA(e,t,i):"BooleanGeometry"===t.geometry.type?new Cc(e,t,i):"ShapeBlendGeometry"===t.geometry.type?new D7(e,t,i):"UIGeometry"===t.geometry.type?new DO(e,t,i):new Eh(e,t,i)):"Empty"===t.type?new Cb(e,t):"Particle"===t.type?new D0(e,t,i):"ParticleCollider"===t.type?new Cw(e,t,i):"Splat"===t.type?new Cb(e,t):"Bone"===t.type?new DD(e,t):"Page"===t.type?new DS(e,t,i):"PointLight"===t.type?new D_(e,t,i):"SpotLight"===t.type?new PO(e,t,i):"DirectionalLight"===t.type?new PC(e,t,i):"Component"===t.type||"Instance"===t.type?new DC(e,t,i):gU.is(t.type)?new Cn(e,t):(console.error(t),new Cb(e,t))}bw.createEntity=D2,bw.changeEntityProptotype=function(e,t,i){let r=D2(e.identity,t,i),a=e.children,o=e.attachedPaths,l=e.parent,h=e.component,c=e.instances,d=e.overrideData,p=e.uuid,f=e.stateSelection;
7284for(let t of(e.dispose(),Object.keys(e)))delete e[t];for(let t of(Object.setPrototypeOf(e,Object.getPrototypeOf(r)),Object.keys(r)))e[t]=r[t];e.children=[...e.children,...a],e.attachedPaths=o,e.parent=l,e.component=h,e.instances=c,e.uuid=p,e.overrideData=d,e.updateState(e.data,i),f&&e.changeSelectedState(f,i),e.resetBBoxNeedsUpdate()},bw.Cloner=EJ;var D3=new rQ;D3.setAttribute("position",new rN(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var D4=class extends oY{constructor(e){super({...e,depthTest:!1,depthWrite:!1,glslVersion:tq,vertexShader:` 7285 precision highp float; 7286 in vec3 position; 7287 void main() { 7288 gl_Position = vec4(position, 1); 7289 } 7290 `})}customProgramCacheKey(){return""}},D5=new sh,D6=class{constructor(){this.pyramidPassScene=new nR,this.pyramidPassMaterial=new D4({name:"PyramidPass"}),this.pyramidPassUniforms={inputTexture:{value:void 0},inputWidth:{value:0},inputHeight:{value:0},inputShiftX:{value:0},outputShiftX:{value:0}},this.pyramidTopLevelReadPixelBuffer=new Float32Array(4);let e=` 7291 precision highp float; 7292 precision highp sampler2D; 7293 layout(location = 0) out vec4 pc_FragColor; 7294 uniform sampler2D inputTexture; 7295 uniform float inputWidth; 7296 uniform float inputHeight; 7297 uniform float inputShiftX; 7298 uniform float outputShiftX; 7299 const vec2 half_unit_coord = vec2(0.5); 7300 const vec4 one = vec4(1.0); 7301 void main() { 7302 vec2 inputSize = vec2(inputWidth, inputHeight); 7303 vec2 input_pixel_uv = 1. / inputSize; 7304 vec2 coord = gl_FragCoord.xy - half_unit_coord; 7305 coord.x -= outputShiftX; 7306 coord = coord * 2. + half_unit_coord; 7307 coord.x += inputShiftX; 7308 7309 // sample bottom left corner 7310 vec2 input_uv = coord / inputSize; 7311 float bl = texture(inputTexture, input_uv).r; 7312 7313 // sample bottom right corner 7314 input_uv.x += input_pixel_uv.x; 7315 float br = texture(inputTexture, input_uv).r; 7316 7317 // sample top right corner 7318 input_uv.y += input_pixel_uv.y; 7319 float tr = texture(inputTexture, input_uv).r; 7320 7321 // sample top left corner 7322 input_uv.x -= input_pixel_uv.x; 7323 float tl = texture(inputTexture, input_uv).r; 7324 7325 pc_FragColor.a = bl; 7326 pc_FragColor.b = pc_FragColor.a + br; 7327 pc_FragColor.g = pc_FragColor.b + tr; 7328 pc_FragColor.r = pc_FragColor.g + tl; 7329 } 7330 `;this.pyramidPassMaterial.fragmentShader=e,this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new r7(D3,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(e,t,i,r,a){new lQ().min.setScalar(0);let o=t.length-1,l=new iA;i.getViewport(l),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let h=o-1;for(let o=h;o>=0;o--){let l=o%2==h%2?a[0]:a[1],c=o===h?r:o%2==h%2?a[1]:a[0];this.pyramidPassUniforms.inputTexture.value=Array.isArray(c.texture)?c.texture[1]:c.texture,this.pyramidPassUniforms.inputWidth.value="width"in c?c.width:1,this.pyramidPassUniforms.inputHeight.value="height"in c?c.height:1,i.setRenderTarget(l);let d=t[o],p=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,d/p,d/p),2===o&&e%2!=0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,3/p,3/p),i.render(this.pyramidPassScene,D5);let f=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=f,o<h&&(this.pyramidPassUniforms.outputShiftX.value+=t[o+1])}i.setViewport(l);let c=t.length%2==0?0:1;return i.readRenderTargetPixelsAsync(a[c],a[c].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}},D8={shapeInput:()=>` 7331 const float posRowCoord = 0.1; // vec4: px py pz opType 7332 const float quatRowCoord = 0.3; // vec4: qx qy qz qw 7333 const float param1RowCoord = 0.5;// vec4: type param1 param2 param3 7334 const float param2RowCoord = 0.7;// vec4: blendRange roundness scale param4 7335 const float colorRowCoord = 0.9; // vec4: r g b a 7336 uniform sampler2D shapesDataTexture; 7337 vec4 shapePos(float iin) { 7338 vec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord)); 7339 return r; 7340 } 7341 vec4 shapeQuat(float iin) { 7342 vec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord)); 7343 return r; 7344 } 7345 vec4 shapeParams1(float iin) { 7346 vec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord)); 7347 return r; 7348 } 7349 vec4 shapeParams2(float iin) { 7350 vec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord)); 7351 return r; 7352 } 7353 vec4 shapeColor(float iin) {
7354 vec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord)); 7355 return r; 7356 } 7357 `,getxyzi:` 7358 // this code must complement lookup 7359 float xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION); 7360 float yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION); 7361 float zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW; 7362 `,lookup:` 7363 uniform sampler2D potentialPassTexture; 7364 uniform sampler2D voxelPassTexture; // includes normal (in xyz) and key (in w) 7365 7366 // box or marching cube lookup value in value texture, integer box coord inputs 7367 // this code must complement codebits.getxyzi 7368 vec4 look(float xi, float yi, float zi, sampler2D rt) {// range 0 .. numv etc 7369 vec2 uv = vec2( 7370 mod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION, 7371 floor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION 7372 ); 7373 uv /= Z_LAYERS_PER_ROW; 7374 return texture(rt, uv); 7375 } 7376 `,getpart:` 7377 float getpart(inout float a, float b) { 7378 float t = floor(a/b); 7379 float r = a - t*b; 7380 a = t; 7381 return r; 7382 } 7383 `,triTable:new Float32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,1,1,8,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,10,2,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,9,9,2,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,2,8,10,2,8,9,10,-1,-1,-1,-1,-1,-1,-1,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,0,0,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,11,3,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,1,11,9,1,11,8,9,-1,-1,-1,-1,-1,-1,-1,1,10,3,3,10,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,10,0,10,8,0,10,11,8,-1,-1,-1,-1,-1,-1,-1,0,9,3,9,11,3,9,10,11,-1,-1,-1,-1,-1,-1,-1,10,8,9,11,8,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,4,4,3,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,7,4,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,4,1,7,4,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,2,1,7,4,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,4,3,4,0,3,10,2,1,-1,-1,-1,-1,-1,-1,-1,10,2,9,2,0,9,7,4,8,-1,-1,-1,-1,-1,-1,-1,9,10,2,7,9,2,3,7,2,4,9,7,-1,-1,-1,-1,7,4,8,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,4,11,4,2,11,4,0,2,-1,-1,-1,-1,-1,-1,-1,1,0,9,7,4,8,11,3,2,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,9,2,11,9,1,2,9,-1,-1,-1,-1,1,10,3,10,11,3,4,8,7,-1,-1,-1,-1,-1,-1,-1,10,11,1,11,4,1,4,0,1,4,11,7,-1,-1,-1,-1,8,7,4,11,0,9,10,11,9,3,0,11,-1,-1,-1,-1,11,7,4,9,11,4,10,11,9,-1,-1,-1,-1,-1,-1,-1,4,5,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,5,9,3,8,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,5,0,0,5,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,5,8,5,3,8,5,1,3,-1,-1,-1,-1,-1,-1,-1,10,2,1,4,5,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,3,10,2,1,5,9,4,-1,-1,-1,-1,-1,-1,-1,10,2,5,2,4,5,2,0,4,-1,-1,-1,-1,-1,-1,-1,5,10,2,5,2,3,4,5,3,8,4,3,-1,-1,-1,-1,4,5,9,11,3,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,0,11,8,0,5,9,4,-1,-1,-1,-1,-1,-1,-1,4,5,0,5,1,0,11,3,2,-1,-1,-1,-1,-1,-1,-1,5,1,2,8,5,2,11,8,2,5,8,4,-1,-1,-1,-1,11,3,10,3,1,10,4,5,9,-1,-1,-1,-1,-1,-1,-1,5,9,4,1,8,0,1,10,8,10,11,8,-1,-1,-1,-1,0,4,5,11,0,5,10,11,5,3,0,11,-1,-1,-1,-1,8,4,5,10,8,5,11,8,10,-1,-1,-1,-1,-1,-1,-1,8,7,9,9,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,9,3,5,9,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,7,0,7,1,0,7,5,1,-1,-1,-1,-1,-1,-1,-1,3,5,1,7,5,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,7,9,7,5,9,2,1,10,-1,-1,-1,-1,-1,-1,-1,2,1,10,0,5,9,0,3,5,3,7,5,-1,-1,-1,-1,2,0,8,5,2,8,7,5,8,2,5,10,-1,-1,-1,-1,5,10,2,3,5,2,7,5,3,-1,-1,-1,-1,-1,-1,-1,5,9,7,9,8,7,2,11,3,-1,-1,-1,-1,-1,-1,-1,7,5,9,2,7,9,0,2,9,11,7,2,-1,-1,-1,-1,11,3,2,8,1,0,8,7,1,7,5,1,-1,-1,-1,-1,1,2,11,7,1,11,5,1,7,-1,-1,-1,-1,-1,-1,-1,8,5,9,7,5,8,3,1,10,11,3,10,-1,-1,-1,-1,0,7,5,9,0,5,0,11,7,10,0,1,0,10,11,-1,0,10,11,3,0,11,0,5,10,7,0,8,0,7,5,-1,5,10,11,5,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,6,10,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,0,9,6,10,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,1,8,9,1,6,10,5,-1,-1,-1,-1,-1,-1,-1,5,6,1,1,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,6,1,6,2,1,8,0,3,-1,-1,-1,-1,-1,-1,-1,5,6,9,6,0,9,6,2,0,-1,-1,-1,-1,-1,-1,-1,8,9,5,2,8,5,6,2,5,8,2,3,-1,-1,-1,-1,11,3,2,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,11,0,2,11,5,6,10,-1,-1,-1,-1,-1,-1,-1,9,1,0,11,3,2,6,10,5,-1,-1,-1,-1,-1,-1,-1,6,10,5,2,9,1,2,11,9,11,8,9,-1,-1,-1,-1,11,3,6,3,5,6,3,1,5,-1,-1,-1,-1,-1,-1,-1,11,8,0,5,11,0,1,5,0,6,11,5,-1,-1,-1,-1,6,11,3,6,3,0,5,6,0,9,5,0,-1,-1,-1,-1,9,5,6,11,9,6,8,9,11,-1,-1,-1,-1,-1,-1,-1,6,10,5,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,4,3,7,4,10,5,6,-1,-1,-1,-1,-1,-1,-1,0,9,1,6,10,5,7,4,8,-1,-1,-1,-1,-1,-1,-1,5,6,10,7,9,1,3,7,1,4,9,7,-1,-1,-1,-1,2,1,6,1,5,6,8,7,4,-1,-1,-1,-1,-1,-1,-1,5,2,1,6,2,5,4,0,3,7,4,3,-1,-1,-1,-1,7,4,8,5,0,9,5,6,0,6,2,0,-1,-1,-1,-1,9,3,7,4,9,7,9,2,3,6,9,5,9,6,2,-1,2,11,3,4,8,7,5,6,10,-1,-1,-1,-1,-1,-1,-1,6,10,5,2,7,4,0,2,4,11,7,2,-1,-1,-1,-1,9,1,0,8,7,4,11,3,2,6,10,5,-1,-1,-1,-1,1,2,9,2,11,9,11,4,9,4,11,7,6,10,5,-1,7,4,8,5,11,3,1,5,3,6,11,5,-1,-1,-1,-1,11,1,5,6,11,5,11,0,1,4,11,7,11,4,0,-1,9,5,0,5,6,0,6,3,0,3,6,11,7,4,8,-1,9,5,6,11,9,6,9,7,4,9,11,7,-1,-1,-1,-1,9,4,10,10,4,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,10,4,10,9,4,3,8,0,-1,-1,-1,-1,-1,-1,-1,1,0,10,0,6,10,0,4,6,-1,-1,-1,-1,-1,-1,-1,1,3,8,6,1,8,4,6,8,10,1,6,-1,-1,-1,-1,9,4,1,4,2,1,4,6,2,-1,-1,-1,-1,-1,-1,-1,8,0,3,9,2,1,9,4,2,4,6,2,-1,-1,-1,-1,4,2,0,6,2,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,4,2,8,6,2,4,-1,-1,-1,-1,-1,-1,-1,9,4,10,4,6,10,3,2,11,-1,-1,-1,-1,-1,-1,-1,2,8,0,11,8,2,10,9,4,6,10,4,-1,-1,-1,-1,2,11,3,6,1,0,4,6,0,10,1,6,-1,-1,-1,-1,1,4,6,10,1,6,1,8,4,11,1,2,1,11,8,-1,4,6,9,6,3,9,3,1,9,3,6,11,-1,-1,-1,-1,1,11,8,0,1,8,1,6,11,4,1,9,1,4,6,-1,6,11,3,0,6,3,4,6,0,-1,-1,-1,-1,-1,-1,-1,8,4,6,8,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,10,7,10,8,7,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,7,0,7,10,0,10,9,0,10,7,6,-1,-1,-1,-1,7,6,10,7,10,1,8,7,1,0,8,1,-1,-1,-1,-1,7,6,10,1,7,10,3,7,1,-1,-1,-1,-1,-1,-1,-1,6,2,1,8,6,1,9,8,1,7,6,8,-1,-1,-1,-1,9,6,2,1,9,2,9,7,6,3,9,0,9,3,7,-1,0,8,7,6,0,7,2,0,6,-1,-1,-1,-1,-1,-1,-1,2,3,7,2,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,3,2,8,6,10,9,8,10,7,6,8,-1,-1,-1,-1,7,0,2,11,7,2,7,9,0,10,7,6,7,10,9,-1,0,8,1,8,7,1,7,10,1,10,7,6,11,3,2,-1,1,2,11,7,1,11,1,6,10,1,7,
73836,-1,-1,-1,-1,6,9,8,7,6,8,6,1,9,3,6,11,6,3,1,-1,1,9,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,6,0,7,0,11,3,0,6,11,-1,-1,-1,-1,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,3,6,7,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,6,7,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,8,1,3,8,6,7,11,-1,-1,-1,-1,-1,-1,-1,2,1,10,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,1,8,0,3,7,11,6,-1,-1,-1,-1,-1,-1,-1,0,9,2,9,10,2,7,11,6,-1,-1,-1,-1,-1,-1,-1,7,11,6,3,10,2,3,8,10,8,9,10,-1,-1,-1,-1,3,2,7,7,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,7,0,6,7,0,2,6,-1,-1,-1,-1,-1,-1,-1,6,7,2,7,3,2,9,1,0,-1,-1,-1,-1,-1,-1,-1,2,6,1,6,8,1,8,9,1,6,7,8,-1,-1,-1,-1,6,7,10,7,1,10,7,3,1,-1,-1,-1,-1,-1,-1,-1,6,7,10,10,7,1,7,8,1,8,0,1,-1,-1,-1,-1,7,3,0,10,7,0,9,10,0,7,10,6,-1,-1,-1,-1,10,6,7,8,10,7,9,10,8,-1,-1,-1,-1,-1,-1,-1,4,8,6,6,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,6,3,6,0,3,6,4,0,-1,-1,-1,-1,-1,-1,-1,11,6,8,6,4,8,1,0,9,-1,-1,-1,-1,-1,-1,-1,6,4,9,3,6,9,1,3,9,6,3,11,-1,-1,-1,-1,4,8,6,8,11,6,1,10,2,-1,-1,-1,-1,-1,-1,-1,10,2,1,11,0,3,11,6,0,6,4,0,-1,-1,-1,-1,8,11,4,11,6,4,9,2,0,9,10,2,-1,-1,-1,-1,3,9,10,2,3,10,3,4,9,6,3,11,3,6,4,-1,3,2,8,2,4,8,2,6,4,-1,-1,-1,-1,-1,-1,-1,2,4,0,2,6,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,4,3,2,6,4,2,8,3,4,-1,-1,-1,-1,4,9,1,2,4,1,6,4,2,-1,-1,-1,-1,-1,-1,-1,3,1,8,1,6,8,6,4,8,1,10,6,-1,-1,-1,-1,0,1,10,6,0,10,4,0,6,-1,-1,-1,-1,-1,-1,-1,3,6,4,8,3,4,3,10,6,9,3,0,3,9,10,-1,4,9,10,4,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,9,4,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,5,9,4,6,7,11,-1,-1,-1,-1,-1,-1,-1,1,0,5,0,4,5,11,6,7,-1,-1,-1,-1,-1,-1,-1,6,7,11,4,3,8,4,5,3,5,1,3,-1,-1,-1,-1,4,5,9,2,1,10,11,6,7,-1,-1,-1,-1,-1,-1,-1,7,11,6,10,2,1,3,8,0,5,9,4,-1,-1,-1,-1,11,6,7,10,4,5,10,2,4,2,0,4,-1,-1,-1,-1,8,4,3,4,5,3,5,2,3,2,5,10,6,7,11,-1,3,2,7,2,6,7,9,4,5,-1,-1,-1,-1,-1,-1,-1,4,5,9,6,8,0,2,6,0,7,8,6,-1,-1,-1,-1,2,6,3,6,7,3,0,5,1,0,4,5,-1,-1,-1,-1,8,2,6,7,8,6,8,1,2,5,8,4,8,5,1,-1,4,5,9,6,1,10,6,7,1,7,3,1,-1,-1,-1,-1,10,6,1,6,7,1,7,0,1,0,7,8,4,5,9,-1,10,0,4,5,10,4,10,3,0,7,10,6,10,7,3,-1,10,6,7,8,10,7,10,4,5,10,8,4,-1,-1,-1,-1,5,9,6,9,11,6,9,8,11,-1,-1,-1,-1,-1,-1,-1,11,6,3,3,6,0,6,5,0,5,9,0,-1,-1,-1,-1,8,11,0,11,5,0,5,1,0,11,6,5,-1,-1,-1,-1,3,11,6,5,3,6,1,3,5,-1,-1,-1,-1,-1,-1,-1,10,2,1,11,5,9,8,11,9,6,5,11,-1,-1,-1,-1,3,11,0,11,6,0,6,9,0,9,6,5,10,2,1,-1,5,8,11,6,5,11,5,0,8,2,5,10,5,2,0,-1,3,11,6,5,3,6,3,10,2,3,5,10,-1,-1,-1,-1,9,8,5,8,2,5,2,6,5,2,8,3,-1,-1,-1,-1,6,5,9,0,6,9,2,6,0,-1,-1,-1,-1,-1,-1,-1,8,5,1,0,8,1,8,6,5,2,8,3,8,2,6,-1,6,5,1,6,1,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,3,1,10,6,1,6,8,3,9,6,5,6,9,8,-1,0,1,10,6,0,10,0,5,9,0,6,5,-1,-1,-1,-1,8,3,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,5,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,11,11,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,11,5,7,11,0,3,8,-1,-1,-1,-1,-1,-1,-1,7,11,5,11,10,5,0,9,1,-1,-1,-1,-1,-1,-1,-1,5,7,10,7,11,10,1,8,9,1,3,8,-1,-1,-1,-1,2,1,11,1,7,11,1,5,7,-1,-1,-1,-1,-1,-1,-1,3,8,0,7,2,1,5,7,1,11,2,7,-1,-1,-1,-1,5,7,9,7,2,9,2,0,9,7,11,2,-1,-1,-1,-1,2,5,7,11,2,7,2,9,5,8,2,3,2,8,9,-1,10,5,2,5,3,2,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,2,8,2,5,8,5,7,8,5,2,10,-1,-1,-1,-1,1,0,9,3,10,5,7,3,5,2,10,3,-1,-1,-1,-1,2,8,9,1,2,9,2,7,8,5,2,10,2,5,7,-1,5,3,1,5,7,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,1,7,0,5,7,1,-1,-1,-1,-1,-1,-1,-1,3,0,9,5,3,9,7,3,5,-1,-1,-1,-1,-1,-1,-1,7,8,9,7,9,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,5,8,10,5,8,11,10,-1,-1,-1,-1,-1,-1,-1,4,0,5,0,11,5,11,10,5,0,3,11,-1,-1,-1,-1,9,1,0,10,4,8,11,10,8,5,4,10,-1,-1,-1,-1,4,11,10,5,4,10,4,3,11,1,4,9,4,1,3,-1,1,5,2,5,8,2,8,11,2,8,5,4,-1,-1,-1,-1,11,4,0,3,11,0,11,5,4,1,11,2,11,1,5,-1,5,2,0,9,5,0,5,11,2,8,5,4,5,8,11,-1,5,4,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,2,2,5,3,5,4,3,4,8,3,-1,-1,-1,-1,2,10,5,4,2,5,0,2,4,-1,-1,-1,-1,-1,-1,-1,2,10,3,10,5,3,5,8,3,8,5,4,9,1,0,-1,2,10,5,4,2,5,2,9,1,2,4,9,-1,-1,-1,-1,5,4,8,3,5,8,1,5,3,-1,-1,-1,-1,-1,-1,-1,5,4,0,5,0,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,4,8,3,5,8,5,0,9,5,3,0,-1,-1,-1,-1,5,4,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,11,4,11,9,4,11,10,9,-1,-1,-1,-1,-1,-1,-1,3,8,0,7,9,4,7,11,9,11,10,9,-1,-1,-1,-1,11,10,1,4,11,1,0,4,1,11,4,7,-1,-1,-1,-1,4,1,3,8,4,3,4,10,1,11,4,7,4,11,10,-1,7,11,4,4,11,9,11,2,9,2,1,9,-1,-1,-1,-1,4,7,9,7,11,9,11,1,9,1,11,2,3,8,0,-1,4,7,11,2,4,11,0,4,2,-1,-1,-1,-1,-1,-1,-1,4,7,11,2,4,11,4,3,8,4,2,3,-1,-1,-1,-1,10,9,2,9,7,2,7,3,2,9,4,7,-1,-1,-1,-1,7,10,9,4,7,9,7,2,10,0,7,8,7,0,2,-1,10,7,3,2,10,3,10,4,7,0,10,1,10,0,4,-1,2,10,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,4,7,1,4,3,1,7,-1,-1,-1,-1,-1,-1,-1,1,9,4,7,1,4,1,8,0,1,7,8,-1,-1,-1,-1,3,0,4,3,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,10,9,8,11,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,3,11,9,3,10,9,11,-1,-1,-1,-1,-1,-1,-1,10,1,0,8,10,0,11,10,8,-1,-1,-1,-1,-1,-1,-1,10,1,3,10,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,2,1,9,11,1,8,11,9,-1,-1,-1,-1,-1,-1,-1,9,0,3,11,9,3,9,2,1,9,11,2,-1,-1,-1,-1,11,2,0,11,0,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,2,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,10,8,2,9,8,10,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,10,8,2,8,1,0,8,10,1,-1,-1,-1,-1,2,10,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),numTrisTable:new Float32Array([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,2,3,4,4,3,3,4,4,3,4,5,5,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,2,3,3,4,3,4,2,3,3,4,4,5,4,5,3,2,3,4,4,3,4,5,3,2,4,5,5,4,5,2,4,1,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,2,4,3,4,3,5,2,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,3,4,4,3,4,5,5,4,4,3,5,2,5,4,2,1,2,3,3,4,3,4,4,5,3,4,4,5,2,3,3,2,3,4,4,5,4,5,5,2,4,3,5,4,3,2,4,1,3,4,4,5,4,5,3,4,4,5,5,2,3,4,2,1,2,3,3,2,3,4,2,1,3,2,4,1,2,1,1,0])}
7383,D9=class extends Eh{constructor(e,t,i){super(e,t,i),this.data=t,this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!1,this._npart=-1,this.spatialn=1,this.drawRangeNeedsForceUpdate=!0,this._resolutionLevel=-1,this.resolution=64,this.spatialDivisions=25,this.zLayersPerRow=8,this.basePyramidSize=512,this.pyramidTexture1Width=341,this.pyramidTexture1Height=256,this.pyramidTexture2Width=170,this.pyramidTexture2Height=128,this.numLevels=9,this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=0,this.bboxOffset=0,this.shapesDataTexture={value:void 0},this.spatialscene=new nR,this.potentialPassScene=new nR,this.voxelPassScene=new nR,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new rQ,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new r7(D3,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let r=new nN(D8.triTable,16,256,1028,1015);r.needsUpdate=!0;let a=new nN(D8.numTrisTable,256,1,1028,1015);a.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:a}},this.voxelMesh=new r7(D3,this.voxelPassMaterial()),this.voxelMesh.frustumCulled=!1,this.voxelPassScene.add(this.voxelMesh),this.potentialPassUniforms={shapesDataTexture:this.shapesDataTexture,spatialPassTexture:{value:void 0},npart:{value:this.npart},spatialn:{value:this.spatialn}},this.potentialMesh=new r7(D3,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:r},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0},pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=e=>{if(Ol.call(this),0===this.npart){this.geometry.drawRange.count=0;return}let t=this.material.root;if(t.shadersPatchedForShapeBlend){if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new sl({vertexShader:t.vertexShader,fragmentShader:` 7384 #include <packing> 7385 void main() 7386 { 7387 gl_FragColor = packDepthToRGBA(gl_FragCoord.z); 7388 } 7389 `,uniforms:t.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new sl({vertexShader:t.vertexShader,fragmentShader:` 7390 #include <common> 7391 #include <packing> 7392 uniform vec3 referencePosition; 7393 uniform float nearDistance; 7394 uniform float farDistance; 7395 // World-space position 7396 varying vec3 vWPosition; 7397 void main() 7398 { 7399 float dist = length(vWPosition - referencePosition); 7400 dist = (dist - nearDistance) / (farDistance - nearDistance); 7401 dist = saturate(dist); 7402 // Required by Three.js for this to work 7403 gl_FragColor = packDepthToRGBA( dist ); 7404 }`,uniforms:{nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new iD},opacity:{value:0},...t.uniforms},defines:this.material.defines});let e=this.customDistanceMaterial;e.referencePosition=new iD,e.nearDistance=0,e.farDistance=0,e.opacity=1,e.isMeshDistanceMaterial=!0}}else this.patchVertexShaderForShapeBlend(t),t.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!0;if(this.spatialPassUniforms.npart.value=this.npart,this.spatialPassUniforms.spatialn.value=this.spatialn,this.potentialPassUniforms.npart.value=this.npart,this.potentialPassUniforms.spatialn.value=this.spatialn,this.needsRebuild){this.needsRebuild=!1,this.spatialMesh.material.defines.RES=this.resolutionLevel,this.spatialMesh.material.needsUpdate=!0,this.potentialMesh.material.defines.RES=this.resolutionLevel,this.potentialPassUniforms.spatialPassTexture.value=this.spatialPassRenderTarget.texture,this.potentialMesh.material.needsUpdate=!0,this.voxelMesh.material.defines.RES=this.resolutionLevel,this.voxelMesh.material.needsUpdate=!0,this.voxelPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.voxelPassTexture.value=this.voxelPassRenderTarget.texture[0],this.material.defines.RES=this.resolutionLevel,this.material.defines.LEVELS=this.pyramidLevelSizes.length,this.material.defines.LOOP=this.pyramidLevelSizes.length%2==0?this.pyramidLevelSizes.length-3:this.pyramidLevelSizes.length-2,this.material.defines.HALF=this.pyramidLevelSizes.length%2==0?1:0,this.material.needsUpdate=!0;let e=this.pyramidLevelSizes.length%2==0?0:1,t=this.pyramidLevelSizes.length%2==0?1:0;this.marchPassUniforms.pyramidTexture2.value=this.pyramidRenderTarget[e].texture,this.marchPassUniforms.pyramidTexture2
7404Size.value=new t9(this.pyramidRenderTarget[e].width,this.pyramidRenderTarget[e].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[t].texture,this.marchPassUniforms.pyramidTexture1Size.value=new t9(this.pyramidRenderTarget[t].width,this.pyramidRenderTarget[t].height),Object.assign(this.material.uniforms,this.marchPassUniforms)}let i=e.shadowMap.enabled;e.shadowMap.enabled=!1;let r=e.getRenderTarget();e.setRenderTarget(this.spatialPassRenderTarget),e.render(this.spatialscene,D5),e.setRenderTarget(this.potentialPassRenderTarget),e.render(this.potentialPassScene,D5),e.setRenderTarget(this.voxelPassRenderTarget),e.render(this.voxelPassScene,D5),D9.streamCompaction.renderPyramid(this.resolutionLevel,this.pyramidLevelSizes,e,this.voxelPassRenderTarget,this.pyramidRenderTarget).then(e=>{this.material.wireframe&&(3*e>this.geometry.attributes.position.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.dispose(),this.geometry=new rQ,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.geometry.attributes.position=new rN(new Float32Array(6*e),3)),(3*e>this.geometry.drawRange.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.drawRange.count=3*Math.floor(1.2*e)),this.drawRangeNeedsForceUpdate=!1}),e.shadowMap.enabled=i,e.setRenderTarget(r)}}set npart(e){e!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=e,this.spatialn=Math.ceil(e/96))}get npart(){return this._npart}set resolutionLevel(e){let t=Math.min(8,Math.max(5,e));if(t!==this._resolutionLevel){switch(this._resolutionLevel=t,this.resolution=Math.pow(2,t),this.resolutionLevel){case 5:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192],this.bboxSize=496,this.bboxOffset=-8;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=504,this.bboxOffset=-4;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=508,this.bboxOffset=-2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=510,this.bboxOffset=-1}this.pyramidTexture1Width=0,this.pyramidTexture2Width=0,this.pyramidTexture1Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-2],this.pyramidTexture2Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-3];for(let e=this.pyramidLevelSizes.length-2;e>=0;e--)(this.pyramidLevelSizes.length-2)%2==e%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[e]:this.pyramidTexture2Width+=this.pyramidLevelSizes[e];this.basePyramidSize=this.pyramidLevelSizes[this.pyramidLevelSizes.length-1],this.zLayersPerRow=this.basePyramidSize/this.resolution,this.numLevels=this.pyramidLevelSizes.length-1,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!0}}get resolutionLevel(){return this._resolutionLevel}get spatialPassRenderTarget(){let e=this._spatialPassRenderTargets[this.resolutionLevel];return e||(e=new iM(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:1003,magFilter:1003}),this._spatialPassRenderTargets[this.resolutionLevel]=e),e}get potentialPassRenderTarget(){let e=this._potentialPassRenderTargets[this.resolutionLevel];return e||(e=new iM(this.basePyramidSize,this.basePyramidSize,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:1003,magFilter:1003}),this._potentialPassRenderTargets[this.resolutionLevel]=e),e}get voxelPassRenderTarget(){let e=this._voxelPassRenderTargets[this.resolutionLevel];return e||((e=new iT(this.basePyramidSize,this.basePyramidSize,2,{stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:1003,magFilter:1003})).texture[0].format=1023,e.texture[0].type=1015,e.texture[1].format=1028,e.texture[1].type=1015,this._voxelPassRenderTargets[this.resolutionLevel]=e),e}get pyramidRenderTarget(){let e=this._pyramidRenderTargets[this.resolutionLevel];return e||(e=[new iM(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,magFilter:1003,minFilter:1003}),new iM(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:1023,type:1015,stencilBuffer:!1,depthBuffer:!1,magFilter:1003,minFilter:1003})],this._pyramidRenderTargets[this.resolutionLevel]=e),e}updateState(e,t){let i=this.material;super.updateState(e,t),i!==this.material&&(this.needsRebuild=!0),e.geometry&&(this.resolutionLevel=e.geometry.resolutionLevel,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]}),e.wireframe&&!this.geometry.getAttribute("position")?this.geometry.setAttribute("position",new rN(new Float32Array(3*this.geometry.drawRange.count),3)):!e.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){return new D4({name:"Spatial Pass",fragmentShader:` 7405 precision highp float; 7406 out vec4 pc_FragColor; 7407 const float spatialDivisions = ${this.spatialDivisions}.; 7408 uniform float span; 7409 uniform float npart; 7410 uniform float spatialn; 7411 ${D8.shapeInput()} 7412 7413 vec3 low, high; // range of current div; subset of -1 .. 1 with span border 7414 7415 // lookup one element/channel's worth of spheres for current division 7416 // stating with low sphere number lowi 7417 // gives a key to which spheres from lowi..lowi+23 are active within given div (low..high) 7418 float spatialKey(float lowi) { 7419 float t = 0.; 7420 for (float ii = 23.; ii >= 0.; ii--) { 7421 float i = ii + lowi; 7422 float iin = (i + 0.5) / 96.; 7423 vec4 shape = shapePos(iin); 7424 vec3 d = shape.xyz; 7425 float op = shape.w; 7426 7427 t *= 2.; 7428 t += ( 7429 low.x < d.x && d.x < high.x && 7430 low.y < d.y && d.y < high.y && 7431 low.z < d.z && d.z < high.z && 7432 i < npart || op == -2. // always include if op is -2, which is the intersection operation 7433 ) ? 1. : 0.; 7434 } 7435 return t; 7436 } 7437 7438 ${D8.getpart} 7439 7440 void main() { // spatialial fragment shader 7441 // find active div 7442 vec3 div; // which div is current 7443 // out holds x=> x, lowi faster moving and y=> z, y faster moving 7444 float yz = float(gl_FragCoord.y - 0.5); // contains z, y faster moving 7445 div.y = getpart(yz, spatialDivisions); 7446 div.z = yz; // getpart(yz, spatialDivisions.z); // what's left, should be the same as getpart 7447 7448 float lx = float(gl_FragCoord.x - 0.5); // contains x, lowi faster moving 7449 float lowi = getpart(lx, spatialn) * 96.; 7450 div.x = lx; 7451 7452 low = div / spatialDivisions * 2. - 1. - span; 7453 high = (div+1.) / spatialDivisions * 2. - 1. + span; 7454 7455 // find active range of spheres 7456 pc_FragColor.x = spatialKey(lowi); 7457 pc_FragColor.y = spatialKey(lowi+24.); 7458 pc_FragColor.z = spatialKey(lowi+48.); 7459 pc_FragColor.w = spatialKey(lowi+72.); 7460 } 7461 `,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){return new D4({name:"PotentialPass",fragmentShader:` 7462 precision highp float; 7463 out vec4 pc_FragColor; 7464 7465 ${D8.shapeInput()} 7466 uniform sampler2D spatialPassTexture; 7467 7468 const float res = float(RES); 7469 const float VOXEL_RESOLUTION = pow(2., res); 7470 const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.)); 7471 const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; 7472 const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION; 7473 7474 uniform float npart; 7475 uniform float spatialn; 7476 const float spatialDivisions = ${this.spatialDivisions}.; 7477 const float spatialDivisions2 = spatialDivisions * spatialDivisions; 7478 const float spatialDivisionsSub1 = spatialDivisions - 1.; 7479 7480 ${D8.getpart} 7481 7482 vec3 packRGBAToVec3(vec4 color) { 7483 uint r = uint(color.r * 255.); 7484 uint g = uint(color.g * 255.); 7485 uint combined = (r << 8) | g; 7486 return vec3(float(combined) * 0.00001525902, color.b, color.a); // 1/65535 7487 } 7488 7489 void applyQuaternionToVector(in vec4 q, inout vec3 v) { 7490 v += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); 7491 } 7492 7493 /** 7494 * SDF functions (reference: https://iquilezles.org/articles/distfunctions/) 7495 */ 7496 7497 // branchless version of "Smooth Union, Subtraction and Intersection - bound, bound, bound" in above reference 7498 float smoothOperation(float op, float sdf, float d, float k) { 7499 // union: op = 1 =>
7499 signSubtract = 1, signIntersection = 1 7500 // subtract: op = -1 => signSubtract = -1, signIntersection = 1 7501 // intersection: op = -2 => signSubtract = -1, signIntersection = -1 7502 7503 float signSubtract = clamp(op, -1., 1.); 7504 float signIntersection = 2. * (op - signSubtract) + 1.; 7505 float h = clamp( 7506 0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k, 7507 0.0, 7508 1.0 7509 ); 7510 return mix(sdf, signSubtract * signIntersection * d, h) - 7511 signSubtract * k * h * (1.0 - h); 7512 } 7513 7514 float sdSphere( vec3 p, float s ) 7515 { 7516 return length(p)-s; 7517 } 7518 7519 float sdEllipsoid( vec3 p, vec3 r ) 7520 { 7521 float k0 = length(p/r); 7522 float k1 = length(p/(r*r)); 7523 return k0*(k0-1.0)/k1; 7524 } 7525 7526 float sdBox( vec3 p, vec3 b ) 7527 { 7528 vec3 q = abs(p) - b; 7529 return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0); 7530 } 7531 7532 float sdTorus( vec3 p, vec2 t ) 7533 { 7534 vec2 q = vec2(length(p.xy)-t.x,p.z); 7535 return length(q)-t.y; 7536 } 7537 7538 float sdCappedTorus( vec3 p, vec2 sc, float ra, float rb) 7539 { 7540 p.x = abs(p.x); 7541 float k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy); 7542 return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb; 7543 } 7544 7545 float dot2( in vec2 v ) { return dot(v,v); } 7546 float sdCappedCone( vec3 p, float h, float r1, float r2 ) 7547 { 7548 vec2 q = vec2( length(p.xz), p.y ); 7549 vec2 k1 = vec2(r2,h); 7550 vec2 k2 = vec2(r2-r1,2.0*h); 7551 vec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h); 7552 vec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 ); 7553 float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0; 7554 return s*sqrt( min(dot2(ca),dot2(cb)) ); 7555 } 7556 7557 float sdCappedCylinder( vec3 p, float h, float r ) 7558 { 7559 vec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h); 7560 return min(max(d.x,d.y),0.0) + length(max(d,0.0)); 7561 } 7562 7563 float maxBlend = 0.0; 7564 // compute potential from A (=24) spheres, using the bit flags in 'activeKey' 7565 // to avoid lookup/compute for inactive spheres 7566 // return field potential, side effect updates track, 7567 // compute and return +ve and -ve values separately 7568 void fillSpatialInner( 7569 float ii, 7570 float activeKey, 7571 vec3 corner, 7572 inout float sdf, 7573 inout float colorDivisor, 7574 inout vec4 trackColor 7575 ) { 7576 for (float i = 0.; i < 24.; i++) { 7577 if (activeKey < 1.) break; // activeKey exhausted, no more active spheres 7578 activeKey *= 0.5; 7579 if (fract(activeKey) < 0.5) continue; 7580 7581 float iin = (i + ii + 0.5) * 0.010416666666666666; 7582 vec4 shape = shapePos(iin); 7583 vec4 quat = shapeQuat(iin); 7584 vec4 params1 = shapeParams1(iin); 7585 vec4 params2 = shapeParams2(iin); 7586 7587 vec3 p = corner - shape.xyz; 7588 applyQuaternionToVector(quat, p); 7589 p /= params2.z; // scale 7590 float d; // d in -1..1 coordinates 7591 switch (int(params1.x)) { 7592 case 0: d = sdSphere(p, params1.y); break; 7593 case 1: d = sdEllipsoid(p, params1.yzw); break; 7594 case 2: d = sdBox(p, params1.yzw); break; 7595 case 3: d = sdCappedCylinder(p, params1.y, params1.z); break; 7596 case 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break; 7597 case 5: d = sdTorus(p, params1.yz); break; 7598 case 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break; 7599 } 7600 d -= params2.y; // rounded edge 7601 d *= params2.z; // scale 7602 7603 float k = params2.x; 7604 float op = shape.w; 7605 7606 sdf = smoothOperation(shape.w, sdf, d, k); 7607 7608 float isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise 7609 float colorCull = smoothstep(maxBlend, 0., -d); 7610 float cullFactor = mix(1.0, colorCull, isNegativeOne); 7611 trackColor *= cullFactor; 7612 colorDivisor *= cullFactor; 7613 7614 maxBlend = max(maxBlend, k); 7615 7616 k += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k 7617 float nearness = smoothstep(k, 0., d); 7618 7619 vec4 color = shapeColor(iin); 7620 nearness *= float(color.a >= 0.); 7621 7622 colorDivisor += nearness; 7623 trackColor += color * nearness; 7624 } 7625 } 7626 7627 vec3 div; 7628 // compute potential from all spheres; collect +ve and =ve values separately 7629 // work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values 7630 // TODO check if extra vec3 output useful, not really used at present 7631 float fillSpatial(vec3 corner, inout vec4 trackColor) { 7632 float sdf = 1e3; // hack: initialize to large value 7633 float colorDivisor = 0.; 7634 // spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving 7635 float divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2); 7636 for (float ii = 0.; ii < spatialn; ii++) { 7637 float i = ii * 96.; 7638 7639 vec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz)); 7640 fillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor); 7641 fillSpatialInner(i+24., activeKey.y, corner, sdf, colorDivisor, trackColor); 7642 fillSpatialInner(i+48., activeKey.z, corner, sdf, colorDivisor, trackColor); 7643 fillSpatialInner(i+72., activeKey.w, corner, sdf, colorDivisor, trackColor); 7644 } 7645 7646 trackColor /= colorDivisor; 7647 return mix(sdf, 0.0, step(1e20 - 0.1, sdf)); 7648 } 7649 7650 void main() { 7651 ${D8.getxyzi} // get xi yi zi from 2d position 7652 7653 vec3 xyzi = vec3(xi,yi,zi); 7654 vec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.; // -1..1 coords 7655 7656 div = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1); 7657 7658 vec4 c = vec4(0.); 7659 float t = fillSpatial(corner, c); 7660 7661 pc_FragColor = vec4(t, packRGBAToVec3(c)); // RGB texture 7662 } 7663 `,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){return new D4({name:"VoxelPass",fragmentShader:` 7664 precision highp float; 7665 layout(location = 0) out vec4 pc_FragColor; 7666 layout(location = 1) out vec4 numTris; 7667 7668 const float res = float(RES); 7669 const float VOXEL_RESOLUTION = pow(2., res); 7670 const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; 7671 const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.)); 7672 const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION; 7673 uniform sampler2D numTrisTable; // 256 x 1 7674 7675 float keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) { 7676 return (float(f000 < 0.) * 1.) + 7677 (float(f100 < 0.) * 2.) + 7678 (float(f010 < 0.) * 8.) + 7679 (float(f110 < 0.) * 4.) + 7680 (float(f001 < 0.) * 16.) + 7681 (float(f101 < 0.) * 32.) + 7682 (float(f011 < 0.) * 128.) + 7683 (float(f111 < 0.) * 64.); 7684 } 7685 7686 ${D8.lookup} 7687 7688 vec3 compNormi(float xi, float yi, float zi) { 7689 float dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r; 7690 float dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r; 7691 float dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r; 7692 // if we allow (common) 0,0,0 case through then NaN can spread 7693 // eg r = vec4(compNorm i(???), 1.) will pollute r.w 7694 if (dx == 0.0 && dy == 0.0 && dz == 0.0) { 7695 return vec3(0.199, 0.299, 0.399); 7696 } 7697 return normalize(vec3(dx, dy, dz)); 7698 } 7699 7700 void main() { 7701 ${D8.getxyzi} // get xi yi zi from 2d 7702 7703 vec3 normal = compNormi(xi, yi, zi); // even if our key is -1 this may be needed by a neighbouring voxel 7704 7705 if (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) { 7706 pc_FragColor = vec4(normal, 0.); 7707 numTris = vec4(0.); 7708 return; 7709 } 7710 7711 float 7712 f000 = look(xi, yi, zi, potentialPassTexture).r, 7713 f100 = look(xi+1., yi, zi, potentialPassTexture).r, 7714 f010 = look(xi, yi+1., zi, potentialPassTexture).r, 7715 f110 = look(xi+1., yi+1., zi, potentialPassTexture).r, 7716 f001 = look(xi, yi, zi+1., potentialPassTexture).r, 7717 f101 = look(xi+1., yi, zi+1., potentialPassTexture).r, 7718 f011 = look(xi, yi+1., zi+1., potentialPassTexture).r, 7719 f111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r; 7720 float key = keyi(f000, f100, f010, f110, f001, f101, f011, f111); 7721 7722 pc_FragColor = vec4(normal, key); 7723 7724 numTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5)); 7725 } 7726 `,uniforms:this.voxelPassUniforms})}
7726patchVertexShaderForShapeBlend(e){let t=` 7727 #ifdef SHAPEBLEND 7728 precision highp sampler2D; 7729 7730 uniform float isol; 7731 7732 uniform sampler2D triTable; // 256 x 16 7733 uniform sampler2D pyramidTexture1; 7734 uniform vec2 pyramidTexture1Size; 7735 uniform sampler2D pyramidTexture2; 7736 uniform vec2 pyramidTexture2Size; 7737 7738 const vec2 halfPixelOffset = vec2(0.5, 0.5); 7739 7740 const vec2 rShift = vec2(0., 1.); 7741 const vec2 gShift = vec2(1., 1.); 7742 const vec2 bShift = vec2(1., 0.); 7743 7744 const float res = float(RES); 7745 const float VOXEL_RESOLUTION = pow(2., res); 7746 const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.)); 7747 const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION; 7748 7749 const float scale_factor = 2.; 7750 7751 #if SHAPEBLEND == 5 7752 const float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.); 7753 const float scale = 8. * scale_factor; 7754 const vec3 originOffset = vec3(16.); 7755 #elif SHAPEBLEND == 7 7756 const float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); 7757 const float scale = 2. * scale_factor; 7758 const vec3 originOffset = vec3(64.); 7759 #elif SHAPEBLEND == 8 7760 const float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.); 7761 const float scale = scale_factor; 7762 const vec3 originOffset = vec3(128.); 7763 #else 7764 const float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.); 7765 const float scale = 4. * scale_factor; 7766 const vec3 originOffset = vec3(32.); 7767 #endif 7768 7769 ${D8.lookup} 7770 7771 const vec3 offsets[24] = vec3[]( 7772 vec3(0., 0., 0.), vec3(1., 0., 0.), 7773 vec3(1., 0., 0.), vec3(1., 1., 0.), 7774 vec3(0., 1., 0.), vec3(1., 1., 0.), 7775 vec3(0., 0., 0.), vec3(0., 1., 0.), 7776 vec3(0., 0., 1.), vec3(1., 0., 1.), 7777 vec3(1., 0., 1.), vec3(1., 1., 1.), 7778 vec3(0., 1., 1.), vec3(1., 1., 1.), 7779 vec3(0., 0., 1.), vec3(0., 1., 1.), 7780 vec3(0., 0., 0.), vec3(0., 0., 1.), 7781 vec3(1., 0., 0.), vec3(1., 0., 1.), 7782 vec3(1., 1., 0.), vec3(1., 1., 1.), 7783 vec3(0., 1., 0.), vec3(0., 1., 1.) 7784 ); 7785 7786 vec2 computeShiftedPosition1(vec2 xy, float levelOriginX) { 7787 vec2 xyShifted = xy; 7788 xyShifted.x += levelOriginX; 7789 return (xyShifted + halfPixelOffset) / pyramidTexture1Size; 7790 } 7791 7792 vec2 computeShiftedPosition2(vec2 xy, float levelOriginX) { 7793 vec2 xyShifted = xy; 7794 xyShifted.x += levelOriginX; 7795 return (xyShifted + halfPixelOffset) / pyramidTexture2Size; 7796 } 7797 7798 vec4 unpackVec3ToRGBA(vec3 vec) { 7799 uint combined = uint(vec.x * 65535.0 + 0.5); // Add 0.5 for rounding 7800 float g = float(combined & uint(0xFF)) * 0.00392156862; // 1/255 7801 float r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; 7802 7803 return vec4(r, g, vec.y, vec.z); 7804 } 7805 7806 out vec4 marchColor; 7807 // end of marchvertPre 7808 #endif 7809 `,i=` 7810 #ifdef SHAPEBLEND 7811 float triIndex = floor(float(gl_VertexID/3)); 7812 float vertexIndex = float(gl_VertexID); 7813 7814 // Initial pyramid lookup 7815 float levelOriginX1 = pyramidTexture1Size.x - 2.; 7816 float levelOriginX2 = pyramidTexture2Size.x - 1.; 7817 vec2 xy = vec2(0.); 7818 vec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2)); 7819 7820 // Early exit check 7821 if (triIndex >= lookUp.r) return; 7822 7823 // Optimize loop variables 7824 float start = 0.; 7825 vec4 triIndexVec = vec4(triIndex); 7826 7827 // Main position computation loop 7828 for (int i = 0; i < LOOP;) { 7829 // Compute boundaries 7830 vec4 ends = lookUp + vec4(start); 7831 vec4 starts = vec4(ends.gba, start); 7832 vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * 7833 vec4(lessThan(triIndexVec, ends)); 7834 7835 // Update position 7836 xy *= 2.; 7837 xy += check.r * rShift + check.g * gShift + check.b * bShift; 7838 7839 // Update loop variables 7840 start = dot(check, starts); 7841 levelOriginX2 -= levelShiftX[i]; 7842 7843 // Update lookup 7844 lookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1)); 7845 i++; 7846 7847 ends = lookUp + vec4(start); 7848 starts = vec4(ends.gba, start); 7849 check = vec4(greaterThanEqual(triIndexVec, starts)) * 7850 vec4(lessThan(triIndexVec, ends)); 7851 7852 // Update position 7853 xy *= 2.; 7854 xy += check.r * rShift + check.g * gShift + check.b * bShift; 7855 7856 // Update loop variables 7857 start = dot(check, starts); 7858 levelOriginX1 -= levelShiftX[i]; 7859 7860 // Update lookup 7861 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2)); 7862 7863 i++; 7864 } 7865 7866 #if HALF == 1 7867 vec4 ends = lookUp + vec4(start); 7868 vec4 starts = vec4(ends.gba, start); 7869 vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends)); 7870 7871 // Update position 7872 xy *= 2.; 7873 xy += check.r * rShift + check.g * gShift + check.b * bShift; 7874 7875 // Update loop variables 7876 start = dot(check, starts); 7877 #endif 7878 7879 // Compute final coordinates 7880 vec3 gridPos; 7881 gridPos.x = mod(xy.x, VOXEL_RESOLUTION); 7882 gridPos.y = mod(xy.y, VOXEL_RESOLUTION); 7883 gridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + 7884 floor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW; 7885 7886 // Vertex key computation 7887 vertexIndex -= start * 3.; 7888 float vk = vertexIndex * 0.0625 + 0.03125; // Optimized division by 16 and addition of 1/32 7889 7890 // Voxel lookup and edge computation 7891 vec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture); 7892 float key = (voxel.w + 0.5) * 0.00390625; // Optimized division by 256 7893 7894 // Edge lookup and offset computation 7895 float edgeNum = texture(triTable, vec2(vk, key)).x; 7896 int edgeIndex = int(edgeNum) * 2; 7897 7898 // Compute edge positions 7899 vec3 p1 = gridPos + offsets[edgeIndex]; 7900 vec3 p2 = gridPos + offsets[edgeIndex + 1]; 7901 7902 // Compute potentials and normals 7903 vec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture); 7904 vec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture); 7905 7906 // Final position and normal computation 7907 float mu = potential1.r / (potential1.r - potential2.r); 7908 7909 marchColor = mix( 7910 unpackVec3ToRGBA(potential1.gba), 7911 unpackVec3ToRGBA(potential2.gba), 7912 mu 7913 ); 7914 7915 transformed = p1 + (p2 - p1) * mu; 7916 transformed -= originOffset; 7917 transformed *= scale; 7918 vec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture); 7919 vec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture); 7920 objectNormal = normalize(mix(data1.xyz, data2.xyz, mu)); 7921 transformedNormal = normalMatrix * objectNormal; 7922 #ifndef FLAT_SHADED 7923 vNormal = transformedNormal; 7924 #endif 7925 #endif 7926 `;e.vertexShader=t+e.vertexShader.replace("#include <project_vertex>",i+` 7927#include <project_vertex>`);let r=e.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!r)return;let a=` 7928 #ifdef SHAPEBLEND_C 7929 #if SHAPEBLEND_C == 1 7930 ${r[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")} 7931 #else 7932 ${r[0]} 7933 #endif 7934 #else 7935 ${r[0]} 7936 #endif 7937 `;e.fragmentShader=`in vec4 marchColor; 7938`+e.fragmentShader.replace(r[0],a),Object.assign(e.uniforms,this.marchPassUniforms)}initDebugPass(e){console.log("fboToDebug.width",e.width,e.height),this.geometry=new s_(e.width,e.height),this.geometry.userData={parameters:{width:4,height:4}};let t={inputTexture:{value:Array.isArray(e.texture)?e.texture[1]:e.texture},pyramidTextureSize:{value:void 0}},i=e=>{e.vertexShader=` 7939 precision highp float; 7940 7941 varying vec2 vUv; 7942 7943 void main() { 7944 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7945 vUv = uv; 7946 } 7947 `,e.fragmentShader=` 7948 layout(location = 1) out vec4 gVelocity; 7949 7950 precision highp float; 7951 7952 uniform sampler2D inputTexture; 7953 varying vec2 vUv; 7954 7955 uniform vec2 pyramidTextureSize; 7956 7957 void main() { 7958 // Sample the input texture using UV coordinates 7959 gl_FragColor = texture(inputTexture, vUv); 7960 gVelocity = vec4(0.0); 7961 } 7962 `,t.pyramidTextureSize.value=new t9(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(e.uniforms,t)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}},D7=D9;D7.streamCompaction=new D6;var Oe=new i6,Ot=new i6,Oi=new iP,Or=new iD,Os=new iD,Oa=new iP;function On(e,t=0){let i=this.children.length;for(;i--;){let r=this.children[i];bi.is(r)&&Oo.call(r,e,t+1)}}function Oo(e,t=0){if(!0!==e(this,t)){let i=this.children.length;for(;i--;){let r=this.children[i];bi.is(r)&&Oo.call(r,e,t+1)}}}function Ol(){if(void 0===this.shapesDataTexture.value){let e=new nN(new Float32Array(1920),96,5,1023,1015);this.shapesDataTexture.value=e}let e=this.shapesDataTexture.value,t=e.image.data;e.needsUpdate=!0;let i=0,r=this.data.geometry.blendRange,a=Oe.copy(this.matrixWorld).invert(),o=0;On.call(this,e=>{let l;if(!1===e.visible)return!0;
7962if(e instanceof EJ||e instanceof Cw||e instanceof D0)return;l=e instanceof bu?e.object:e;let h=e.data?.cloner;if(SH.is(e)&&h&&!h.hideBase&&"radial"!==h.type&&!0!==h.disabled||!(l instanceof Eh))return;let c=l.geometry.userData.parameters,d=c.shapeBlendNode;if(void 0===d)return;if(Ot.multiplyMatrices(a,e.matrixWorld).decompose(Os,Oi,Or),"TorusGeometry"===c.type&&360!==c.arc){let e=c.arc*Math.PI/180;e/=4,Oi.multiply(Oa.set(0,0,Math.sin(e),Math.cos(e)))}let p=d.overrideGlobalBlend?d.blendRange:r;p=p/this.bboxSize*2,t[4*o]=(Os.x-this.bboxOffset)/this.bboxSize*2,t[4*o+1]=(Os.y-this.bboxOffset)/this.bboxSize*2,t[4*o+2]=(Os.z-this.bboxOffset)/this.bboxSize*2,t[4*o+3]=0===d.operation?1:2===d.operation?-1:-2,t[384+4*o]=-Oi.x,t[384+4*o+1]=-Oi.y,t[384+4*o+2]=-Oi.z,t[384+4*o+3]=Oi.w;let f=new Float32Array(4),m=0;if("SphereGeometry"===c.type)c.width===c.height&&c.width===c.depth?f[0]=0:f[0]=1,f[1]=c.width/this.bboxSize,f[2]=c.height/this.bboxSize,f[3]=c.depth/this.bboxSize,i=Math.max(i,f[1]*Or.x+p,f[2]*Or.x+p,f[3]*Or.x+p);else if("CubeGeometry"===c.type){m=c.cornerRadius;let e=c.width,t=c.height,r=c.depth;f[0]=2,f[1]=(e-2*m)/this.bboxSize,f[2]=(t-2*m)/this.bboxSize,f[3]=(r-2*m)/this.bboxSize,i=Math.max(i,Math.sqrt(e**2+t**2+r**2)/this.bboxSize*Or.x+p)}else if("CylinderGeometry"===c.type){m=c.cornerRadius;let e=c.height,t=c.radiusBottom,r=c.radiusTop;if(r>=t){let i=(Math.PI/2-Math.atan2(r-t,e))/2;r-=m/Math.tan(i),t-=m*Math.tan(i)}else if(t>r){let i=(Math.PI/2-Math.atan2(t-r,e))/2;r-=m*Math.tan(i),t-=m/Math.tan(i)}f[1]=(c.height-2*m)/this.bboxSize,t===r?(f[0]=3,f[2]=t/this.bboxSize*2):(f[0]=4,f[2]=t/this.bboxSize*2,f[3]=r/this.bboxSize*2),i=Math.max(i,4*f[1]*Or.x+p)}else if("TorusGeometry"===c.type){if(f[0]=5,f[1]=(c.width-c.depth)/this.bboxSize,f[2]=c.depth/this.bboxSize,360!==c.arc){f[0]=6,f[3]=f[1],t[1152+4*o+3]=f[2];let e=2*Math.atan2(f[2]/2,f[1]),i=c.arc*Math.PI/180/2-e;f[1]=Math.sin(i),f[2]=Math.cos(i)}i=Math.max(i,c.width*Or.x/this.bboxSize+p)}t.set(f,768+4*o),t[1152+4*o]=p,t[1152+4*o+1]=m/this.bboxSize*2,t[1152+4*o+2]=Or.x;let g=l.material,v=g.uniforms.nodeU0.node.value,y=g.uniforms.nodeU1.value;0===d.operation||d.useColor||(y=-1),t[1536+4*o]=v.r,t[1536+4*o+1]=v.g,t[1536+4*o+2]=v.b,t[1536+4*o+3]=y,y<1&&1===this.material.defines.SHAPEBLEND_C&&this.material.setTransparent
7962(!0),o++}),this.npart=o,this.spatialPassUniforms.span.value=1.4*i}function Oh(e,t){let i=!1,r=512&e.layers.mask,a=t.getLayersOfType("transmission"),o=t.getLayersOfType("outline");return o.length>0&&(e.layers.set(8),a.length>0&&e.layers.enable(3),i=!0,Ed(e),Ec(e)),0===a.length&&0===o.length&&e.layers.set(0),r&&e.layers.set(9),e instanceof Er&&e.needsAO&&e.layers.enable(5),i}function Oc(e,t){if(!t.layers)return!1;let i=512&e.layers.mask,r=!1,a=t.getLayersOfType("transmission").filter(e=>e.data.visible),o=t.getLayersOfType("outline").filter(e=>e.data.visible);return a.length>0&&(e.layers.set(3),o.length>0&&e.layers.enable(8),r=!0),0===a.length&&0===o.length&&e.layers.set(0),i&&e.layers.set(9),e.needsAO&&e.layers.enable(5),r}var Od=new lH,Ou=new i6,Op=new i5;function Of(e,t,i,r=!1){let a=e.cloner;if(a)for(let o of a.children){let a=Ou.copy(o.matrixWorld).invert(),l=Op.copy(t.ray).applyMatrix4(a),h=e.matrixWorld;l.applyMatrix4(h),Od.set(l.origin,l.direction),Od.near=t.near,Od.far=t.far;let c=Od.intersectObject(e,!1);c.length>0&&i.push({...c[0],object:r?o:e})}}var Om=class{constructor(){this._constraints=new Map}setConstraint(e,t){null===t?this._constraints.delete(e):this._constraints.set(e,t)}removeDependencies(e){this._constraints.delete(e)}applyConstraints(e){let t=new Set;this._constraints.forEach((i,r)=>{let a=[r,i],o=i;for(;this._constraints.has(o);){if(o=this._constraints.get(o),a.includes(o)){console.warn(`circular dependency detected: ${a.join(" -> ")}`);break}t.has(o)||a.push(o)}for(let i=a.length-2;i>=0;i--)if(!t.has(a[i])){let r=e.find(a[i]);r?r.applyPathSnapping(e):console.warn(`missing entity ${a[i]}`),t.add(a[i])}})}findDependency(e,t){let i=e;for(;this._constraints.has(i);)if((i=this._constraints.get(i))===t)return!0;return!1}},Og=class{};function Ov(e){let t,i,r,a,o,l,h,c,d,p,f,m,g,v,y;function x(e,t,l){let h=new Float32Array(p,o,3*i);r=0;let c=new Uint32Array(p,a,i);for(let i=0;i<l.length-1;i++){let a=t[i],o=e[i].elements,d=a.filter(e=>e.enabled&&"Include"===e.mode).map(e=>"Box"===e.type?w(e):_(e)),p=a.filter(e=>e.enabled&&"Exclude"===e.mode).map(e=>"Box"===e.type?w(e):_(e));for(let e=l[i];e<l[i+1];e++){let t=m[3*e],i=m[3*e+1],a=m[3*e+2];if((0===d.length||b(t,i,a,d))&&(0===p.length||!b(t,i,a,p))){let l=1/(o[3]*t+o[7]*i+o[11]*a+o[15]);h[3*r]=(o[0]*t+o[4]*i+o[8]*a+o[12])*l,h[3*r+1]=(o[1]*t+o[5]*i+o[9]*a+o[13])*l,h[3*r+2]=(o[2]*t+o[6]*i+o[10]*a+o[14])*l,c[r]=e,r++}}}}function b(e,t,i,r,a){return r["Intersect"===a?"every":"some"](r=>{var a,o,l,h,c,d,p,f;let m,g,v,y,x,b,w;let S=(a=r.invRotationMatrix,m=e-(o=r.cropCenter)[0],g=t-o[1],v=i-o[2],y=1/(a[3]*m+a[7]*g+a[11]*v+a[15]),{x:(a[0]*m+a[4]*g+a[8]*v+a[12])*y+o[0],y:(a[1]
7962*m+a[5]*g+a[9]*v+a[13])*y+o[1],z:(a[2]*m+a[6]*g+a[10]*v+a[14])*y+o[2]});return Array.isArray(r)?(l=S.x,h=S.y,c=S.z,l>=r[0]&&l<=r[3]&&h>=r[1]&&h<=r[4]&&c>=r[2]&&c<=r[5]):(d=S.x,p=S.y,f=S.z,x=(d-r.cropCenter[0])*r.invRadiusX,x*x+(b=(p-r.cropCenter[1])*r.invRadiusY)*b+(w=(f-r.cropCenter[2])*r.invRadiusZ)*w<=1)})}function w(e){let t=e.cropSize[0]/2,i=e.cropSize[1]/2,r=e.cropSize[2]/2;return Object.assign([e.cropCenter[0]-t,e.cropCenter[1]-i,e.cropCenter[2]-r,e.cropCenter[0]+t,e.cropCenter[1]+i,e.cropCenter[2]+r],{invRotationMatrix:S(e.cropRotation),cropCenter:e.cropCenter})}function S(e){let t=[],i=e[0]*Math.PI/180,r=e[1]*Math.PI/180,a=e[2]*Math.PI/180,o=Math.cos(i),l=Math.sin(i),h=Math.cos(r),c=Math.sin(r),d=Math.cos(a),p=Math.sin(a),f=o*d,m=o*p,g=l*d,v=l*p;return t[0]=h*d,t[1]=-h*p,t[2]=c,t[4]=m+g*c,t[5]=f-v*c,t[6]=-l*h,t[8]=v-f*c,t[9]=g+m*c,t[10]=o*h,t[12]=0,t[13]=0,t[14]=0,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}function _(e){let t=2/e.cropSize[0],i=2/e.cropSize[1],r=2/e.cropSize[2],a=S(e.cropRotation);return{invRadiusX:t,invRadiusY:i,invRadiusZ:r,cropCenter:e.cropCenter,invRotationMatrix:a}}e.onmessage=S=>{if(S.data.getCroppedIndexes){let t=new Uint32Array(function(e,t){let i=[],r=t.filter(e=>e.enabled&&"Include"===e.mode).map(e=>"Box"===e.type?w(e):_(e)),a=t.filter(e=>e.enabled&&"Exclude"===e.mode).map(e=>"Box"===e.type?w(e):_(e)),o=e.length;for(let t=0;t<o;t+=3){let o=e[t],l=e[t+1],h=e[t+2];(0===r.length||b(o,l,h,r))&&(0===a.length||!b(o,l,h,a))||i.push(t/3)}return i}(new Float32Array(S.data.positions),S.data.crops)).buffer;e.postMessage({outOfBoundsIndexes:t},[t])}else if(S.data.positions)m=new Float32Array(S.data.positions),v=S.data.meshMatrixWorlds,y=S.data.cropsArray,g=S.data.meshIndexIntervals,x(v,y,g),e.postMessage({sortSetupComplete:!0});else if(S.data.sort||S.data.newMatrixWorlds||S.data.newCropsArray)(S.data.newMatrixWorlds||S.data.newCropsArray)&&(y=S.data.newCropsArray||y,x(v=S.data.newMatrixWorlds||v,y,g)),function(m){let g,v=new Float64Array(p,l,16);for(let e=0;e<16;e++)v[e]=m[e];if(r>1){t.exports.sortIndexes(a,o,d,l,h,c,f.DepthMapRange,r);let e=new Uint32Array(r);g=e.buffer,e.set(new Uint32Array(p,c,r))}else if(1===r){let e=new Uint32Array(r);e[0]=new Uint32Array(p,a,i)[0],g=e.buffer}else g=new ArrayBuffer(0);e.postMessage({sortDone:!0,indexesBuffer:g},[g])}(S.data.sort.view,S.data.sort.cameraPosition);else if(S.data.init){f=S.data.init.Constants,i=S.data.init.splatCount;
7962let r=f.BytesPerInt,m=3*f.BytesPerFloat,g=new Uint8Array(S.data.init.sorterWasmBytes),v=Math.floor((i*(r+m)+(i*f.BytesPerInt*2+f.DepthMapRange*f.BytesPerInt*2)+32*f.MemoryPageSize)/f.MemoryPageSize)+1,y={module:{},env:{memory:new WebAssembly.Memory({initial:2*v,maximum:3*v,shared:!0})}};WebAssembly.compile(g).then(e=>WebAssembly.instantiate(e,y)).then(g=>{t=g,a=0,c=(h=(d=(l=(o=i*r)+i*m)+16*f.BytesPerFloat*2)+i*f.BytesPerInt)+f.DepthMapRange*f.BytesPerInt,p=y.env.memory.buffer,e.postMessage({sortSetupPhase1Complete:!0})})}}}tB(Og,"DepthMapRange",65536),tB(Og,"MemoryPageSize",65536),tB(Og,"BytesPerFloat",4),tB(Og,"BytesPerInt",4);var Oy=(tm=new Int32Array((tf=new Float32Array(1)).buffer),function(e){return tf[0]=e,tm[0]}),Ox=new t9;function Ob(e){let t=!1;return e.scene.objects.traverse((e,i)=>{if(!1===i.visible)return!0;"Splat"===i.type&&(t=!0)}),t}var Ow,OS,O_,OA,OM,OE=class extends r7{constructor(e,t,i,r,a=!1,o=1,l,h){super(i,r),this.splatCount=t,this.meshIndexIntervals=l,this.meshMatrixWorlds=h,this.splatBuffers=e,this.geometry=i,this.material=r,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=a,this.devicePixelRatio=o,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(e,t,i=!1,r=1,a,o){let l=OE.buildGeomtery(t),h=OE.buildMaterial(a);return new OE(e,t,l,h,i,r,a,o)}static buildMaterial(e){let t=` 7963 precision highp float; 7964 #include <common> 7965 7966 attribute uint splatIndex; 7967 7968 uniform highp sampler2D covariancesTexture; 7969 uniform highp usampler2D centersColorsTexture; 7970 uniform vec2 focal; 7971 uniform vec2 viewport; 7972 uniform vec2 basisViewport; 7973 uniform vec2 covariancesTextureSize; 7974 uniform vec2 centersColorsTextureSize; 7975 uniform highp sampler2D meshMatrixWorldsTexture; 7976 uniform uint meshIndexIntervals[257]; 7977 uniform float orthoZoom; 7978 7979 varying vec4 vColor; 7980 varying vec2 vUv; 7981 7982 varying vec2 vPosition; 7983 7984 const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0); 7985 const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000)); 7986 const uvec4 shift4 = uvec4(0, 8, 16, 24); 7987 vec4 uintToRGBAVec (uint u) { 7988 uvec4 urgba = mask4 & u; 7989 urgba = urgba >> shift4; 7990 vec4 rgba = vec4(urgba) * encodeNorm4; 7991 return rgba; 7992 } 7993 7994 vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) { 7995 vec2 samplerUV = vec2(0.0, 0.0); 7996 float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x; 7997 samplerUV.y = float(floor(d)) / dimensions.y; 7998 samplerUV.x = fract(d); 7999 return samplerUV; 8000 } 8001 8002 void main () { 8003 uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize)); 8004 vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba)); 8005 vColor = uintToRGBAVec(sampledCenterColor.r); 8006 8007 vPosition = position.xy * 2.0; 8008 8009 uint meshIndex; 8010 for (int i = 1; i < 257; i++) { 8011 if (splatIndex < meshIndexIntervals[i]) { 8012 meshIndex = uint(i - 1); 8013 break; 8014 } 8015 } 8016 8017 float strideMulmeshIndex = float(4u*meshIndex); 8018 float meshMatrixWorldsTextureLength = float(256*4); 8019 8020 mat4 modelMat = mat4( 8021 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)), 8022 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)), 8023 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)), 8024 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0)) 8025 ); 8026 mat4 modelViewMat = viewMatrix * modelMat; 8027 vec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); 8028 vec4 clipCenter = projectionMatrix * viewCenter; 8029 8030 vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg; 8031 vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg; 8032 vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg; 8033 8034 vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r); 8035 vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg); 8036 8037 // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix 8038 mat3 Vrk = mat3( 8039 cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z, 8040 cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y, 8041 cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z 8042 ); 8043 float s = 1.0 / (viewCenter.z * viewCenter.z); 8044 8045 mat3 W = transpose(mat3(modelViewMat)); 8046 mat3 T = orthoZoom > 0.0 ? W : W * mat3( 8047 focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s, 8048 0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s, 8049 0., 0., 0. 8050 ); 8051 mat3 cov2Dm = transpose(T) * Vrk * T; 8052 cov2Dm[0][0] += 0.3; 8053 cov2Dm[1][1] += 0.3; 8054 8055 // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because 8056 // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0], 8057 // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't 8058 // need cov2Dm[1][0] because it is a symetric matrix. 8059 vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]); 8060 8061 vec3 ndcCenter = clipCenter.xyz / clipCenter.w; 8062 8063 // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix 8064 // so that we can determine the 2D basis for the splat. This is done using the method described 8065 // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html 8066 // 8067 // This is a different approach than in the original work at INRIA. In that work they compute the 8068 // max extents of the 2D covariance matrix in screen space to form an axis aligned boun
8068ding rectangle 8069 // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance 8070 // matrix (called 'conic') to determine fragment opacity. 8071 float a = cov2Dv.x; 8072 float d = cov2Dv.z; 8073 float b = cov2Dv.y; 8074 float D = a * d - b * b; 8075 float trace = a + d; 8076 float traceOver2 = 0.5 * trace; 8077 float term2 = sqrt(trace * trace / 4.0 - D); 8078 float eigenValue1 = traceOver2 + term2; 8079 float eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value 8080 8081 const float maxSplatSize = 1024.0; 8082 vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a)); 8083 // since the eigen vectors are orthogonal, we derive the second one from the first 8084 vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x); 8085 vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize); 8086 vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize); 8087 8088 vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport; 8089 8090 if (orthoZoom > 0.0) { 8091 ndcOffset *= orthoZoom; 8092 } 8093 8094 gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0); 8095 }`,i=` 8096 precision highp float; 8097 #include <common> 8098 8099 uniform vec3 debugColor; 8100 8101 varying vec4 vColor; 8102 varying vec2 vUv; 8103 8104 varying vec2 vPosition; 8105 layout(location = 1) out vec4 gVelocity; 8106 8107 void main () { 8108 // compute the negative squared distance from the center of the splat to the 8109 // current fragment in the splat's local space. 8110 float A = -dot(vPosition, vPosition); 8111 if (A < -4.0) discard; 8112 vec3 color = vColor.rgb; 8113 A = exp(A) * vColor.a; 8114 gl_FragColor = vec4(color.rgb, A); 8115 gVelocity = vec4(0.0); // so it is ignored by TAA 8116 }`;return new sl({uniforms:{covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new t9},viewport:{type:"v2",value:new t9},basisViewport:{type:"v2",value:new t9},debugColor:{type:"v3",value:new iv},covariancesTextureSize:{type:"v2",value:new t9(1024,1024)},centersColorsTextureSize:{type:"v2",value:new t9(1024,1024)},orthoZoom:{type:"f",value:-1}},vertexShader:t,fragmentShader:i,transparent:!0,alphaTest:1,blending:1,depthTest:!0,depthWrite:!1,side:2})}static buildGeomtery(e){let t=new rQ;t.setIndex([0,1,2,0,2,3]);let i=new rN(new Float32Array(12),3);t.setAttribute("position",i),i.setXYZ(0,-1,-1,0),i.setXYZ(1,-1,1,0),i.setXYZ(2,1,1,0),i.setXYZ(3,1,-1,0),i.needsUpdate=!0;let r=new lC().copy(t),a=new nj(new Uint32Array(e),1,!1);return a.setUsage(35048),r.setAttribute("splatIndex",a),r.instanceCount=e,r}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(e=>e.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let e=0,t=0,i=0;for(let r of this.splatBuffers){let a=r.nsplats;this.colors.subarray(e,e+4*a).set(r.colorsA),e+=4*a,this.centers.subarray(t,t+3*a).set(r.decoded.xyz.denormDequant().data),t+=3*a,this.covariances.subarray(i,i+6*a).set(new Float32Array(r.precomputedCovarianceBufferData)),i+=6*a}}allocateAndStoreLocalSplatDataInTextures(){let e,t,i=this.splatCount,r=new t9(4096,1024);for(;r.x*r.y*2<6*i;)r.y*=2;let a=new t9(4096,1024);for(;a.x*a.y*4<4*i;)a.y*=2;if(this.halfPrecisionCovariancesOnGPU){t=new Uint16Array(r.x*r.y*2);for(let e=0;e<this.covariances.length;e++)t[e]=hr.toHalfFloat(this.covariances[e]);e=new nN(t,r.x,r.y,1030,1016)}
8116else(t=new Float32Array(r.x*r.y*2)).set(this.covariances),e=new nN(t,r.x,r.y,1030,1015);e.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=e,this.material.uniforms.covariancesTextureSize.value.copy(r);let o=new Uint32Array(a.x*a.y*4);for(let e=0;e<i;e++){var l;let t=4*e,i=3*e,r=4*e;o[r]=(l=this.colors[t],l+(this.colors[t+1]<<8)+(this.colors[t+2]<<16)+(this.colors[t+3]<<24)),o[r+1]=Oy(this.centers[i]),o[r+2]=Oy(this.centers[i+1]),o[r+3]=Oy(this.centers[i+2])}let h=new nN(o,a.x,a.y,1033,1014);h.internalFormat="RGBA32UI",h.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=h,this.material.uniforms.centersColorsTextureSize.value.copy(a);let c=new Float32Array(4096);for(let e=0;e<this.meshMatrixWorlds.length;e++)c.set(this.meshMatrixWorlds[e].elements,16*e);let d=new nN(c,1024,1,1023,1015);d.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=d,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:t,texture:e,size:r},centerColors:{data:o,texture:h,size:a},meshMatrixWorlds:{data:c,texture:d}}}updateIndexes(e){let t=this.geometry;t.attributes.splatIndex.set(e),t.attributes.splatIndex.needsUpdate=!0,t.instanceCount=e.length}updateUniforms(e,t,i,r){this.splatCount>0&&(Ox.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Ox),this.material.uniforms.basisViewport.value.set(2/Ox.x,2/Ox.y),this.material.uniforms.focal.value.set(t,i),this.material.uniforms.orthoZoom.value=r,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}},OC=new Promise(e=>{OM=e}),OT=!1;OC.then(e=>O0=e);var OP=class{constructor(e={}){let t,i,r,a,o,l;tB(this,"updateView",(t=new i6,i=[],r=new iD(0,0,-1),a=new iD(0,0,-1),o=new iD,l=new iD,function(e=!1,h){let c=this.updateMatrixWorldsInWorkerIfNeeded(),d=this.cropsChanged();if(!e){a.set(0,0,-1).applyQuaternion(h.quaternion);let e=!1,t=!1;if(.95>=a.dot(r)&&(e=!0),l.copy(h.position).sub(o).length()>=1&&(t=!0),!e&&!t&&!c&&!d&&!this.needsInitialRender)return}this.needsInitialRender=!1,o.copy(h.position),r.copy(a),t.copy(h.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),i[0]=h.position.x,i[1]=h.position.y,i[2]=h.position.z;let p={sort:{view:t.elements,cameraPosition:i,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...c?{newMatrixWorlds:this.meshMatrixWorlds}:{},...d?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=p:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(p))})),this.scene=e.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new i6().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(e,t){let i=new t9;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(e.getSize(i),this.cameraFocalLengthX=t.projectionMatrix.elements[0]*this.devicePixelRatio*i.x*.45,this.cameraFocalLengthY=t.projectionMatrix.elements[5]*this.devicePixelRatio*i.y*.45,this.splatMesh.updateUniforms(i,this.cameraFocalLengthX,this.cameraFocalLengthY,t.isPerspectiveCamera?-1:t.zoom*this.devicePixelRatio))}loadSplat(e={}){this.activePage=this.scene.activePage,e.position&&(e.position=new iD().fromArray(e.position)),e.orientation&&(e.orientation=new iP().fromArray(e.orientation)),e.halfPrecisionCovariances=!!e.halfPrecisionCovariances;let t=[];if(this.splatEntries=t,this.activePage.traverseVisibleEntity(e=>{"Splat"===e.data.type&&t.push(e)}),this.splatMesh&&this.splatMesh.dispose(),0===t.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=t.map(e=>e.matrixWorld),this.meshMatrixWorldsOld=t.map(e=>e.matrixWorld.clone()),this.cropsArray=t.map(e=>e.data.crops.map(e=>e.data));let i=t.map(e=>new O0.GSplineBuffer(new Uint8Array(e.data.buffer).buffer)),r=0,a=[0];for(let e of i)r+=e.getSplatCount(),a.push(r);return this.setupSplatMesh(i,r,e.position,e.orientation,e.halfPrecisionCovariances,this.devicePixelRatio,a,this.meshMatrixWorlds),this.setupSortWorker(r),!0}updateMatrixWorldsInWorkerIfNeeded(){let e=this.splatDataTextures.meshMatrixWorlds.data;for(let t=0;t<this.meshMatrixWorlds.length;t++)e.set(this.meshMatrixWorlds[t].elements,16*t);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((e,t)=>e.equals(this.meshMatrixWorldsOld[t]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(e=>e.clone()),!0)}cropsChanged(){let e=!1;
8116return this.splatEntries.forEach((t,i)=>{t.data.crops.forEach((t,r)=>{void 0===this.cropsArray[i][r]?(e=!0,this.cropsArray[i][r]=t.data):Object.entries(t.data).forEach(([t,a])=>{Array.isArray(a)&&a.some((e,a)=>e!==this.cropsArray[i][r][t][a])?(e=!0,this.cropsArray[i][r][t]=a):a!==this.cropsArray[i][r]?.[t]&&(e=!0,this.cropsArray[i][r][t]=a)})}),t.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=t.data.crops.length,e=!0)}),e}setupSplatMesh(e,t,i=new iD,r=new iP,a=!1,o=1,l,h){this.splatMesh=OE.buildMesh(e,t,a,o,l,h),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=t,this.splatMesh.onBeforeRender=(e,t,i)=>this.update(e,i)}setupSortWorker(e){this.sortWorker=function(e){let t=new Worker(URL.createObjectURL(new Blob(["(",Ov.toString(),")(self)"],{type:"application/javascript"}))),i=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),r=new Uint8Array(i.length);for(let e=0;e<i.length;e++)r[e]=i.charCodeAt(e);return t.postMessage({init:{sorterWasmBytes:r.buffer,splatCount:e,Constants:{BytesPerFloat:Og.BytesPerFloat,BytesPerInt:Og.BytesPerInt,DepthMapRange:Og.DepthMapRange,MemoryPageSize:Og.MemoryPageSize}}}),t}(e),this.sortWorker.onmessage=e=>{e.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(e.data.indexesBuffer)),this.lastSortTime=e.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):e.data.sortCanceled?this.sortRunning=!1:e.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):e.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(e,t){null!==this.splatMesh&&(this.updateSplatMeshUniforms(e,t),this.updateView(!1,t))}getSplatMesh(){return this.splatMesh}},OD=new rB;OD.wireframe=!0;var OO=new iD,OI=class extends nR{constructor(e,t){super(),this.data=e,this.sharedAssets=t,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new Om,this.invisibleObjects=new Cb("jflkdsafjasdifjaslk",{...yY.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(e,t),this.matrixAutoUpdate=!1,this.errorPage=new DS("fdasfa",{...y3.defaultData,name:""},{shared:t,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){let e;return this.needsTransmissionDirty&&(this._needsTransmission=(e=!1,this.traverseEntity(t=>{if(t instanceof Er){if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)Oc(t,t.material[i])&&(e=!0);else Oc(t,t.material)&&(e=!0)}}),e),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){let e;return this.needsNormalDirty&&(this._needsNormal=(e=!1,this.traverseEntity(t=>{if(t instanceof Er){if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)Oh(t,t.material[i])&&(e=!0);else Oh(t,t.material)&&(e=!0)}}),e),this.needsNormalDirty=!1),this._needsNormal}registerInstanceAndSetUuid(e){let t=e.identity.join("-"),i=this.entity
vendor: 2,829 bytes, line 8116
8116IdentityToEntity[t];i&&(e.uuid=i.uuid),this.entityIdentityToEntity[t]=e,this.entityByUuid[e.uuid]=e}markPenumbraSizeDirty(){for(let e of this.children)e instanceof DS&&(e.penumbraSizeArrayCache=null)}findInstance(e){return this.entityIdentityToEntity[e.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(e){let t=this.find(e);if(void 0===t)return;let i=[],r=t;for(;r!==this;){let e=r,t=(r=r.parent).children.indexOf(e);i.splice(0,0,t)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let e=this.getWithSortKey(i.id);void 0!==e&&t.push(e)}return t.sort((e,t)=>vd(e.sortKey,t.sortKey)),t.map(e=>e.entity)}nonExistOrDescendantOf(e,t){let i=this.find(e);if(void 0===i)return!0;for(;i;){if(i.uuid===t)return!0;i=i.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent&&("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===e||e===gl))return this.activePage.personalCamera;if(""===e||void 0===e)return;let t=this.entityByUuid[e];return void 0===t?this.getObjectByProperty("uuid",e):t}find2D(e){for(let t of this.children)if(t instanceof DS&&t.uiScene){let i=t.uiScene.find(e);if(i)return i}}findScene2DfromObject2D(e){for(let t of this.children)if(t instanceof DS&&t.uiScene&&t.uiScene.find(e))return t.uiScene}find2DInUIObjects(e){let t;return this.traverseEntity(i=>{void 0===t&&i instanceof DO&&(t=i.uiCanvas.find(e))}),t}traverse2D(e){for(let t of this.children)t instanceof DS&&t.uiScene&&t.uiScene.traverse(e)}debugEnsureEntity(e){let t=this.find(e);t?Array.isArray(t.identity)&&void 0===this.findInstance(t.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(e=>{this.toExpandCloner.add(e)})}doPendingExpandCloner(e){this.toExpandCloner.forEach(t=>{t.expandCloner(e)}),this.toExpandCloner.clear()}doPendingUpdateCloner(e){this.toUpdateCloner.forEach(t=>{t.cloner?.update(e)}),this.toUpdateCloner.clear()}doPendingUpdates(e){this.doPendingExpandCloner(e),this.doPendingUpdateCloner(e),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach(e=>e()),this.pendingCommands.length=0}updateByLibOp(e,t){1===e.path.length&&"components"===e.path[0]&&1===e.type&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,t)}updateTreeByOp(e,t){if(0===e.path.length&&7===e.type){let i=null===e.parent?this:this.find(e.parent);if(void 0===i)throw Error("unexpected");let r=this.createObject(e.id,e.data,e.children,i,e.localIndex,t);r.updateVisible(this),r.resetBBoxNeedsUpdate(),Cu(r)&&Cp(r.parent)&&(r.invali
vendor: 9,731 bytes, line 8116
8116dateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(r),this.markToExpandCloner(r),this.markPenumbraSizeDirty(),r.updatePathSnapping()}else if(0===e.path.length&&8===e.type){let t=this.find(e.id);if(void 0===t)throw Error("unexpected");t.traverseEntity(e=>{e instanceof D7&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(t=>t!==e))}),this.markToExpandCloner(t),t.resetBBoxNeedsUpdate(),this.unregisterObject(t);let i=t.parent;this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(t),this.markPenumbraSizeDirty(),t.parent.remove(t),Cp(t.parent)&&(t.parent.invalidateUpstreamBooleanData(),t.parent.invalidateDownstreamBooleanData().recomputeBoolean()),Cu(t)&&(t.freeBooleanPointer(),i instanceof Cc&&i.invalidateDownstreamBooleanData().recomputeBoolean()),t instanceof DM&&t.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),this.pathConstraints.removeDependencies(t.uuid),t.updatePathSnapping()}else if(0===e.path.length&&9===e.type){let t=this.find(e.id);if(void 0===t)throw Error("unexpected");this.markNeedsRecomputeInstancesForChildren(t);let i=t.parent;this.markNeedsRecomputeInstancesForAncessors(i),t.cloner?.resetOnMove(),this.markToExpandCloner(t);let r=null===e.parent?this:this.find(e.parent);if(void 0===r)throw Error("unexpected");r.add(t),this.markNeedsRecomputeInstancesForAncessors(r),this.markToExpandCloner(t),t.invalidateClonerTransform(t),t.updateVisible(this),t.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let a=e.localIndex;r.children.splice(a,0,r.children.pop()),Cu(t)&&(t.invalidateUpstreamBooleanData(),Cp(t.parent)?t.parent.invalidateDownstreamBooleanData().recomputeBoolean():i instanceof Cc&&i.invalidateDownstreamBooleanData().recomputeBoolean()),t.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){for(let t of(this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage,this.children))t instanceof DS&&(t.visible=t.uuid===e,t.visible&&(this.activePage=t,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,t,i,r){if(0===t.type){if(("overrides"in t.props||"component"in t.props)&&this.markNeedsRecomputeInstances(),"visible"in t.props&&this.markPenumbraSizeDirty(),t.path.includes("overrides")&&"states"in t.props){let{rest:e}=t.props;t={...t,props:e},this.markNeedsRecomputeInstances()}"pathSnapping"===t.path[0]&&void 0!==t.props.pathId&&this.pathConstraints.setConstraint(e,t.props.pathId)}let a=this.find(e);if(a)try{(function(e,t,i,r){e.updateByOp(t,i,r,!1)})(a,t,i,{scene:this,shared:r}),a instanceof Eh&&a.updateGeometryGroupsIfNeeded()}catch(e){console.error(e)}}updateEntity2DByOp(e,t,i,r,a,o=[]){e.updateEntityByOp(t,i,r,a),this.traverseEntity(e=>{(e instanceof DO||e instanceof DS)&&(o.includes(e.frameId??"")||e.frameId===t)&&e.updateEntity2DByOp(t,i,r,a)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,t){let i=Object.entries(t.data.lib.components).map((e,t)=>({data:e[1].asset.data,children:e[1].asset.children,id:e[0],fi:t}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:t}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,t),this.createChildrenObjects(e.objects,this,t),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(t,!0),this.traverseEntity(e=>{e instanceof Cn&&e.updateUp()}),this.doPendingExpandCloner({scene:this,shared:t}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(e=>{("Component"===e.data.type||"Instance"===e.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){SH.is(e)&&("Component"===e.data.type&&this.markNeedsRecomputeInstances(),e.traverseAncestors(e=>{SH.is(e)&&"Component"===e.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,t,i,r,a,o,l){if(e){let h=r.find(e);h&&h!==r&&a.forInstancesRec(r=>{r.data=fh(r.data,a=>{let h=a.events.data(l.id),c=r.goUp(o);if(c){let r=[...vc(c.identity),e].join("-"),a=this.entityIdentityToEntity[r];if(a){let e=a.uuid;fx.zoom(h,t)[i]=e}else console.warn("cannot find instance")}}).data})}}rewriteActions(e,t,i,r,a,o){e.forEach(e=>{"Transition"===e.data.type?this.relativeizeInner(e.data.object,[...t,e.id],"object",i,r,a,o):"Animation"===e.data.type?this.relativeizeInner(e.data.object,[...t,e.id],"object",i,r,a,o):"Conditional"===e.data.type&&(this.rewriteActions(e.data.ifActions,[...t,e.id,"ifActions"],i,r,a,o),this.rewriteActions(e.data.elseActions,[...t,e.id,"elseActions"],i,r,a,o))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(e instanceof DC&&"string"==typeof e.identity&&"Component"===e.data.type)return e.traverseEntity((t,i)=>{t.data.events.forEach(r=>{if("GameControl"===r.data.type){let a=!1;if(t.forInstancesRec(e=>{e.data=fh(e.data,t=>{e.isInstanceRoot||(t.events.delete(r.id),a=!0)}).data}),!1===a)for(let a of xu.list)this.rewriteActions(r.data.gameActions[a],["gameActions",a],e,t,i,r)}else"Conditional"===r.data.type?("Distance"===r.data.condition.type?(this.relativeizeInner(r.data.condition.fromObject,["condition"],"fromObject",e,t,i,r),this.relativeizeInner(r.data.condition.toObject,["condition"],"toObject",e,t,i,r)):"State"===r.data.condition.type?this.relativeizeInner(r.data.condition.object,["condition"],"object",e,t,i,r):"Comparison"===r.data.condition.type&&("Property"===r.data.condition.lOperand.type&&this.relativeizeInner(r.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,t,i,r),"Property"===r.data.condition.rOperand.type&&this.relativeizeInner(r.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,t,i,r)),this.rewriteActions(r.data.inActions,["inActions"],e,t,i,r),this.rewriteActions(r.data.outActions,["outActions"],e,t,i,r)):"actions"in r.data&&this.rewriteActions(r.data.actions,["actions"],e,t,i,r)})}),!0})}expandInstances(e,t,i){let r=new Set;for(let a of(this.traverseEntity(a=>{if(a instanceof DC&&a.isInstanceRoot)return a.expandInstanceChildren({scene:this,shared:e,pendingDeletes:r}),t||a.resetBBoxNeedsUpdate(),i&&a.traverseEntity(e=>{i.addClip(e)}),!0}),r))this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),DT(a)}recomputeInstances(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(e=>{e instanceof DC&&e.isInstanceRoot&&(e.component=void 0)}),this.expandInstances(e,!1,t))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(e=>{let t="string"==typeof e.identity?e.identity:e.identity.join("-");this.entityIdentityToEntity[t]===e&&(delete this.entityByUuid[e.uuid],delete this.entityIdentityToEntity[t]),e.dispose()})}clearScene(){for(let e of this.children)SH.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,t){this.init(e,t)}raycast(e){return this.raycast1(e,!1)}raycast1(e,t){let i=[],r=a=>{for(let o of a.children){let a=o.cloner;if(SH.is(o)&&!o.raycastLock&&(o.visible||a?.object.data.visible)){if(!0===t&&o.isInstanceRoot){let t=[];if(e.intersectObject(o,!0,t),t.length){let e=t[0];e.object=o,e.point.applyMatrix4(e.object.matrixWorld);let r=o.matrixWorld.clone().invert();e.point.applyMatrix4(r),i.push(e)}}else(Cu(o)||Cf(o)&&this.enableHelpers&&o.objectHelper.visible)&&(e.intersectObject(o,!1,i),Of(o,e,i)),r(o)}}};return r(this.activePage),i}raycastWithClones(e){let t=[],i=r=>{for(let a of r.children){let r=a.cloner;SH.is(a)&&(a.visible||r?.object.data.visible)&&((Cu(a)||Cf(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,t),Of(a,e,t,!0)),i(a))}};return i(this),t}forEachEntity(e){for(let t of this.children)SH.is(t)&&e(t)}traverseConcreteEntity(e){for(let t of this.children)SH.is(t)&&t.isConcreteEntity&&t.traverseEntity(e)}traverseEntity(e){for(let t of this.children)SH.is(t)&&t.traverseEntity(e)}updateFont(e,t){this.traverseEntity(i=>{if(i instanceof Eh&&"Mesh"===i.data.type&&("TextGeometry"===i.data.geometry.type||"InputGeometry"===i.data.geometry.type)&&i.data.geometry.font===e){let r=i.geometry,a=i.data.geometry;r.updateFont(e,t).then(()=>{r.update(a,t);let e=i.invalidateDownstreamBooleanData();Cp(e)&&e.recomputeBoolean()})}})}traverseObject(e){for(let t of this.children)bi.is(t)&&t.traverseObject(e)}traverseVisibleEntity(e){for(let t of this.children)SH.is(t)&&t.visible&&t.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,t,i){let r=0;for(let a of e)this.createObject(a.id,a.data,a.children,t,r,i),r+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){for(let t of(delete this.entityByUuid[e.uuid],e.children))this.unregisterObject(t)}createObject(e,t,i,r,a,o){let l={scene:this,shared:o},h=D2(e,t,l);return h instanceof D7&&this.shapeBlendIntances.push(h),h&&(this.entityByUuid[e]=h,r.add(h),r.children.splice(a,0,r.children.pop()),i.length>0&&(h.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,h,o)),h.updateState(t,l),h instanceof Eh&&h.updateGeometryGroupsIfNeeded(),h.updateVisible(this),h.cloner&&this.toExpandCloner.add(h),t.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),"Empty"===t.type&&t.animations&&h.traverseEntity(e=>{let t=e.dataPatched;
8116if(e instanceof Eh&&t.bones&&t.boneInverses){let i=new nV(t.bones.map(e=>this.find(e)),t.boneInverses.map(e=>new i6().fromArray(e)));e.bind(i,e.bindMatrix)}else e.matrixAutoUpdate=!0}),h}getCenter(e){let t=[];for(let i=0,r=e.length;i<r;++i){let{id:r,recursive:a}=e[i],o=this.find(r),l=a?o.recursiveBBox:o.singleBBox;t.push(...l.vertices)}let i=new iR;return i.setFromPoints(t),i.getCenter(OO),OO}copyMatrixWorld(e,t){if(null===e){t.identity();return}let i=this.find(e);i?t.copy(i.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){if(null===e){t.identity();return}let i=this.find(e)?.parent;i?t.copy(i.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof _A){if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)t.material[i]instanceof MT&&e(t.material[i]);else t.material instanceof MT&&e(t.material)}})}updateViewPlaneSize(e,t,i=!1){this.traverseConcreteEntity(r=>{r instanceof Cn&&r.setViewplaneSize(e,t,i)})}initializeSplatViewer(){this.splatViewer=new OP({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}},OR=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},OL=(e,t)=>{let i=t.x-e.x;return OF(Math.atan2(t.y-e.y,i))},OB=(e,t,i)=>{let r={x:0,y:0};return i=Oz(i),r.x=e.x-t*Math.cos(i),r.y=e.y-t*Math.sin(i),r},Oz=e=>Math.PI/180*e,OF=e=>180/Math.PI*e,ON=e=>isNaN(e.buttons)?0!==e.pressure:0!==e.buttons,OU=new Map,Ok=e=>{OU.has(e)&&clearTimeout(OU.get(e)),OU.set(e,setTimeout(function(){OU.delete(e),e()},100))},OV=(e,t,i)=>{let r=t.split(/[ ,]+/g),a;for(let t=0;t<r.length;t+=1)a=r[t],e.addEventListener?e.addEventListener(a,i,!1):e.attachEvent&&e.attachEvent(a,i)},Oj=(e,t,i)=>{let r=t.split(/[ ,]+/g),a;for(let t=0;t<r.length;t+=1)a=r[t],e.removeEventListener?e.removeEventListener(a,i):e.detachEvent&&e.detachEvent(a,i)},OG=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),OH=()=>{if(!(typeof window>"u"))return{x:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,y:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop}},OW=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},Oq=(e,t,i)=>{let r=OY(e);for(let e in r)if(r.hasOwnProperty(e)){if("string"==typeof t)r[e]=t+" "+i;else{let a="";for(let e=0,r=t.length;e<r;e+=1)a+=t[e]+" "+i+", ";r[e]=a.slice(0,-2)}}return r},OX=(e,t)=>{let i=OY(e);for(let e in i)i.hasOwnProperty(e)&&(i[e]=t);return i},OY=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},OQ=(e,t)=>{for(let i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},OZ=(e,t)=>{let i={};for(let r in e)e.hasOwnProperty(r)&&t.hasOwnProperty(r)?i[r]=t[r]:e.hasOwnProperty(r)&&(i[r]=e[r]);return i},OK=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)},OJ=(e,t,i)=>({x:Math.min(Math.max(e.x,t.x-i),t.x+i),y:Math.min(Math.max(e.y,t.y-i),t.y+i)});"u">typeof window&&(O1="ontouchstart"in window,O2=!!window.PointerEvent,O3=!!window.MSPointerEvent);var O$,O0,O1,O2,O3,O4,O5={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},O6={};function O8(){}function O9(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=O9.id,O9.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}function O7(e,t){this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.pressureIntervals={},this.manager=e,this.id=O7.id,O7.id+=1,this.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},this.config(t),("static"===this.options.mode||"semi"===this.options.mode)&&(this.options.multitouch=!1),this.options.multitouch||(this.options.maxNumberOfNipples=1);let i=getComputedStyle(this.options.zone.parentElement);return i&&"flex"===i.display&&(this.parentIsFlex=!0),this.updateBox(),this.prepareNipples(),this.bindings(),this.begin(),this.nipples}function Ie(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=OH(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var e;
8116t.collections.forEach(function(i){i.forEach(function(i){e=i.el.getBoundingClientRect(),i.position={x:t.scroll.x+e.left,y:t.scroll.y+e.top}})})};return t._onResize=function(){Ok(i)},t._onScroll=function(){t.scroll=OH()},t.collections}O2?O4=O5.pointer:O3?O4=O5.MSPointer:O1?(O4=O5.touch,O6=O5.mouse):O4=O5.mouse,O8.prototype.on=function(e,t){var i,r=e.split(/[ ,]+/g);this._handlers_=this._handlers_||{};for(var a=0;a<r.length;a+=1)i=r[a],this._handlers_[i]=this._handlers_[i]||[],this._handlers_[i].push(t);return this},O8.prototype.off=function(e,t){return this._handlers_=this._handlers_||{},void 0===e?this._handlers_={}:void 0===t?this._handlers_[e]=null:this._handlers_[e]&&this._handlers_[e].indexOf(t)>=0&&this._handlers_[e].splice(this._handlers_[e].indexOf(t),1),this},O8.prototype.trigger=function(e,t){var i,r=this,a=e.split(/[ ,]+/g);r._handlers_=r._handlers_||{};for(var o=0;o<a.length;o+=1)i=a[o],r._handlers_[i]&&r._handlers_[i].length&&r._handlers_[i].forEach(function(e){e.call(r,{type:i,target:r},t)})},O8.prototype.config=function(e){this.options=this.defaults||{},e&&(this.options=OZ(this.options,e))},O8.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{}
8116,i._domHandlers_[t]=function(){"function"==typeof i["on"+t]?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},OV(e,O4[t],i._domHandlers_[t]),O6[t]&&OV(e,O6[t],i._domHandlers_[t]),i},O8.prototype.unbindEvt=function(e,t){return this._domHandlers_=this._domHandlers_||{},Oj(e,O4[t],this._domHandlers_[t]),O6[t]&&Oj(e,O6[t],this._domHandlers_[t]),delete this._domHandlers_[t],this},O9.prototype=new O8,O9.constructor=O9,O9.id=0,O9.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly||(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front)),this},O9.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=OX("borderRadius","50%"),i=Oq("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},r.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},OQ(r.el,i),"circle"===this.options.shape&&OQ(r.back,t),OQ(r.front,t),this.applyStyles(r),this},O9.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this},O9.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},O9.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},O9.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null},O9.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),"function"==typeof e&&e.call(this)},t.options.fadeTime)),t},O9.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var i="dynamic"===t.options.mode?"none":"block";t.ui.el.style.display=i,"function"==typeof e&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=!0===i||!1!==i.x?0:t.instance.frontPosition.x,r.y=!0===i||!1!==i.y?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t},O9.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",a={};a.front=Oq("transition",["top","left"],r);var o={front:{}};o.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(a),i.applyStyles(o),i.restTimeout=setTimeout(function(){"function"==typeof e&&e.call(i),i.restCallback()},i.options.fadeTime)},O9.prototype.restCallback=function(){var e={};e.front=Oq("transition","none",""),this.applyStyles(e),this.trigger("rested",this.instance)},O9.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},O9.prototype.computeDirection=function(e){var t,i,r,a=e.angle.radian,o=Math.PI/4,l=Math.PI/2;if(a>o&&a<3*o&&!e.lockX?t="up":a>-o&&a<=o&&!e.lockY?t="left":a>-(3*o)&&a<=-o&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(i=a>
8116-l&&a<l?"left":"right"),e.lockX||(r=a>0?"up":"down"),e.force>this.options.threshold){var h,c={};for(h in this.direction)this.direction.hasOwnProperty(h)&&(c[h]=this.direction[h]);var d={};for(h in this.direction={x:i,y:r,angle:t},e.direction=this.direction,c)c[h]===this.direction[h]&&(d[h]=!0);if(d.x&&d.y&&d.angle)return e;d.x&&d.y||this.trigger("plain",e),d.x||this.trigger("plain:"+i,e),d.y||this.trigger("plain:"+r,e),d.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e},O7.prototype=new O8,O7.constructor=O7,O7.id=0,O7.prototype.prepareNipples=function(){var e=this.nipples;e.on=this.on.bind(this),e.off=this.off.bind(this),e.options=this.options,e.destroy=this.destroy.bind(this),e.ids=this.ids,e.id=this.id,e.processOnMove=this.processOnMove.bind(this),e.processOnEnd=this.processOnEnd.bind(this),e.get=function(t){if(void 0===t)return e[0];for(var i=0,r=e.length;i<r;i+=1)if(e[i].identifier===t)return e[i];return!1}},O7.prototype.bindings=function(){this.bindEvt(this.options.zone,"start"),this.options.zone.style.touchAction="none",this.options.zone.style.msTouchAction="none"},O7.prototype.begin=function(){var e=this.options;if("static"===e.mode){var t=this.createNipple(e.position,this.manager.getIdentifier());t.add(),this.idles.push(t)}},O7.prototype.createNipple=function(e,t){var i=this.manager.scroll,r={},a=this.options,o={x:this.parentIsFlex?i.x:i.x+this.box.left,y:this.parentIsFlex?i.y:i.y+this.box.top};if(e.x&&e.y)r={x:e.x-o.x,y:e.y-o.y};else if(e.top||e.right||e.bottom||e.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=e.top,l.style.right=e.right,l.style.bottom=e.bottom,l.style.left=e.left,l.style.position="absolute",a.zone.appendChild(l);var h=l.getBoundingClientRect();a.zone.removeChild(l),r=e,e={x:h.left+i.x,y:h.top+i.y}}var c=new O9(this,{color:a.color,size:a.size,threshold:a.threshold,fadeTime:a.fadeTime,dataOnly:a.dataOnly,restJoystick:a.restJoystick,restOpacity:a.restOpacity,mode:a.mode,identifier:t,position:e,zone:a.zone,frontPosition:{x:0,y:0},shape:a.shape});return a.dataOnly||(OW(c.ui.el,r),OW(c.ui.front,c.frontPosition)),this.nipples.push(c),this.trigger("added "+c.identifier+":added",c),this.manager.trigger("added "+c.identifier+":added",c),this.bindNipple(c),c},O7.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},O7.prototype.bindNipple=function(e){var t,i=this,r=function(e,r){t=e.type+" "+r.id+":"+e.type,i.trigger(t,r)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},O7.prototype.pressureFn=function(e,t,i){var r=this,a=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval((function(){var i=e.force||e.pressure||e.webkitForce||0;i!==a&&(t.trigger("pressure",i),r.trigger("pressure "+t.identifier+":pressure",i),a=i)}).bind(r),100)},O7.prototype.onstart=function(e){var t=this,i=t.options,r=e;return e=OG(e),t.updateBox(),OK(e,function(a){t.actives.length<i.maxNumberOfNipples?t.processOnStart(a):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(i){if(0>Object.values(r.touches).findIndex(function(e){return e.identifier===i})){var a=[e[0]];a.identifier=i,t.processOnEnd(a)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(a))}),t.manager.bindDocument(),!1},O7.prototype.processOnStart=function(e){var t,i=this,r=i.options,a=i.manager.getIdentifier(e),o=e.force||e.pressure||e.webkitForce||0,l={x:e.pageX,y:e.pageY},h=i.getOrCreate(a,l);h.identifier!==a&&i.manager.removeIdentifier(h.identifier),h.identifier=a;var c=function(t){t.trigger("start",t),i.trigger("start "+t.id+":start",t),t.show(),o>0&&i.pressureFn(e,t,t.identifier),i.processOnMove(e)};if((t=i.idles.indexOf(h))>=0&&i.idles.splice(t,1),i.actives.push(h),i.ids.push(h.identifier),"semi"!==r.mode)c(h);else if(OR(l,h.position)<=r.catchDistance)c(h);else{h.destroy(),i.processOnStart(e);return}return h},O7.prototype.getOrCreate=function(e,t){var i,r=this.options;return/(semi|static)/.test(r.mode)?(i=this.idles[0])?(this.idles.splice(0,1),i):"semi"===r.mode?this.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),
8116!1):i=this.createNipple(t,e)},O7.prototype.processOnMove=function(e){var t=this.options,i=this.manager.getIdentifier(e),r=this.nipples.get(i),a=this.manager.scroll;if(!ON(e)){this.processOnEnd(e);return}if(!r){console.error("Found zombie joystick with ID "+i),this.manager.removeIdentifier(i);return}if(t.dynamicPage){var o=r.el.getBoundingClientRect();r.position={x:a.x+o.left,y:a.y+o.top}}r.identifier=i;var l=r.options.size/2,h={x:e.pageX,y:e.pageY};t.lockX&&(h.y=r.position.y),t.lockY&&(h.x=r.position.x);var c,d,p=OR(h,r.position),f=OL(h,r.position),m=Oz(f),g=p/l,v={distance:p,position:h};if("circle"===r.options.shape?(c=Math.min(p,l),d=OB(r.position,c,f)):c=OR(d=OJ(h,r.position,l),r.position),t.follow){if(p>l){let e=h.x-d.x,t=h.y-d.y;r.position.x+=e,r.position.y+=t,r.el.style.top=r.position.y-(this.box.top+a.y)+"px",r.el.style.left=r.position.x-(this.box.left+a.x)+"px",p=OR(h,r.position)}}else h=d,p=c;var y=h.x-r.position.x,x=h.y-r.position.y;r.frontPosition={x:y,y:x},t.dataOnly||OW(r.ui.front,r.frontPosition);var b={identifier:r.identifier,position:h,force:g,pressure:e.force||e.pressure||e.webkitForce||0,distance:p,angle:{radian:m,degree:f},vector:{x:y/l,y:-x/l},raw:v,instance:r,lockX:t.lockX,lockY:t.lockY};(b=r.computeDirection(b)).angle={radian:Oz(180-f),degree:180-f},r.trigger("move",b),this.trigger("move "+r.id+":move",b)},O7.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),a=t.nipples.get(r),o=t.manager.removeIdentifier(a.identifier);!a||(i.dataOnly||a.hide(function(){"dynamic"===i.mode&&(a.trigger("removed",a),t.trigger("removed "+a.id+":removed",a),t.manager.trigger("removed "+a.id+":removed",a),a.destroy())}),clearInterval(t.pressureIntervals[a.identifier]),a.resetDirection(),a.trigger("end",a),t.trigger("end "+a.id+":end",a),t.ids.indexOf(a.identifier)>=0&&t.ids.splice(t.ids.indexOf(a.identifier),1),t.actives.indexOf(a)>=0&&t.actives.splice(t.actives.indexOf(a),1),/(semi|static)/.test(i.mode)?t.idles.push(a):t.nipples.indexOf(a)>=0&&t.nipples.splice(t.nipples.indexOf(a),1),t.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(t.manager.ids[o.id]=o.identifier))},O7.prototype.onDestroyed=function(e,t){this.nipples.indexOf(t)>=0&&this.nipples.splice(this.nipples.indexOf(t),1),this.actives.indexOf(t)>=0&&this.actives.splice(this.actives.indexOf(t),1),this.idles.indexOf(t)>=0&&this.idles.splice(this.idles.indexOf(t),1),this.ids.indexOf(t.identifier)>=0&&this.ids.splice(this.ids.indexOf(t.identifier),1),this.manager.removeIdentifier(t.identifier),this.manager.unbindDocument()},O7.prototype.destroy=function(){for(var e in this.unbindEvt(this.options.zone,"start"),this.nipples.forEach(function(e){e.destroy()}),this.pressureIntervals)this.pressureIntervals.hasOwnProperty(e)&&clearInterval(this.pressureIntervals[e]);this.trigger("destroyed",this.nipples),this.manager.unbindDocument(),this.off(),this.pressureIntervals={},this.nipples=[],this.idles=[],this.actives=[],this.ids=[],this.manager=null},Ie.prototype=new O8,Ie.constructor=Ie,Ie.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var i;return e.collections.every(function(e){return!(i=e.get(t))}),i}},Ie.prototype.create=function(e){return this.createCollection(e)},Ie.prototype.bindWindowEvents=function(){this._windowBound||typeof window>"u"||(this._windowBound=!0,OV(window,"resize",this._onResize),OV(window,"scroll",this._onScroll))},Ie.prototype.unbindWindowEvents=function(){!this._windowBound||typeof window>"u"||(this._windowBound=!1,Oj(window,"resize",this._onResize),Oj(window,"scroll",this._onScroll))},Ie.prototype.createCollection=function(e){var t=new O7(this,e);return this.bindCollection(t),this.collections.push(t),this.bindWindowEvents(),t},Ie.prototype.bindCollection=function(e){var t,i=this,r=function(e,r){t=e.type+" "+r.id+":"+e.type,i.trigger(t,r)};e.on("destroyed",i.onDestroyed.bind(i)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)},Ie.prototype.bindDocument=function(){this.binded||(this.bindEvt(document,"move").bindEvt(document,"end"),this.binded=!0)},Ie.prototype.unbindDocument=function(e){Object.keys(this.ids).length&&!0!==e||(this.unbindEvt(document,"move").unbindEvt(document,"end"),this.binded=!1)},Ie.prototype.getIdentifier=function(e){var t;return e?void 0===(t=void 0===e.identifier?e.pointerId:e.identifier)&&(t=this.latest||0):t=this.index,void 0===this.ids[t]&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]},Ie.prototype.removeIdentifier=function(e){var t={};for(var i in this.ids)if(this.ids[i]===e){t.id=i,t.identifier=this.ids[i],delete this.ids[i];break}return t},Ie.prototype.onmove=function(e){return this.onAny("move",e),!1},Ie.prototype.onend=function(e){return this.onAny("end",e),!1},Ie.prototype.oncancel=function(e){return this.onAny("end",e),!1},Ie.prototype.onAny=function(e,t){var i,r=this,a="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=OG(t);var o=function(e,t,i){i.ids.indexOf(t)>=0&&(i[a](e),e._found_=!0)};return OK(t,function(e){i=r.getIdentifier(e),OK(r.collections,o.bind(null,e,i)),e._found_||r.removeIdentifier(i)}),!1},Ie.prototype.destroy=function(){this.unbindDocument(!0),this.unbindWindowEvents(),this.ids={},this.index=0,this.collections.forEach(function(e){e.destroy()}),this.collections=[],this.off()},Ie.prototype.onDestroyed=function(e,t){if(0>this.collections.indexOf(t))return!1;this.collections.splice(this.collections.indexOf(t),1),0===this.collections.length&&this.unbindWindowEvents()};var It=null;function Ii(){return It||(It=new Ie),It}var Ir={create:function(e){return Ii().create(e)},destroy:function(){It&&(It.destroy(),It=null)},get factory(){return Ii()}},Is=new Map,Ia=new Map,In=class{constructor(e,t,i,r){this.data=t;let{audio:a,volume:o,delay:l,loop:h}=t;if(!a)throw Error("Missing property");try{let e="string"==typeof a?r.getAudio(a).src:a.data;this.audioPlayer=new Mk({src:e,volume:o,delay:l,loop:h})}catch{console.warn(`Could not create an audio player for this object: "${i.name}" and this audio: "${a}"`)}Ia.has(i.uuid)?Ia.get(i.uuid).push(this):Ia.set(i.uuid,[this]),Is.set(e,this)}
8116playByToggle(){"stop"===this.data.toggle?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):"pause"===this.data.toggle?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},Io=class{constructor(e){this.data=e}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(e){let t=Is.get(e);t&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):t.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(e){let t=Ia.get(e);t?.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>e.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(e=>e.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let e=[...Ia.values()];e.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(e=>{e.forEach(e=>{e.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(e=>{e.forEach(e=>{e.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Il=class{constructor(e,t,i,r,a){if(this.data=t,this.shared=r,this.condition=a,"play"===t.interaction)this.interaction=new In(e,t,i,r);else if("pause"===t.interaction||"stop"===t.interaction)this.interaction=new Io(t);else throw Error("Missing property")}dispatchBasic(){if(!1===R5(this.shared,this.condition))return!1;this.interaction instanceof In?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===R5(this.shared,this.condition))return!1;this.interaction instanceof In?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(e){if(!1===R5(this.shared,this.condition))return!1;this.interaction instanceof In&&("start"===e?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}},Ih=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.delay=0,this.emission=e.emission,void 0!==e.delay&&(this.delay=e.delay),this.particleSystem=this.page.scene.find(this.data.emitterObjectId)}toggleEmitting(){this.particleSystem.started&&!this.particleSystem.stopped?this.stop(this.delay):this.start(this.delay)}toggleFroze(){this.particleSystem.started&&!this.particleSystem.isFrozen?this.freeze(this.delay):this.unFreeze(this.delay)}start(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.start(0),this.clearDelay()},e);return}this.particleSystem.start()}stop(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.stop(0),this.clearDelay()},e);return}this.particleSystem.stop()}freeze(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.freeze(0),this.clearDelay()},e);return}this.particleSystem.froze()}unFreeze(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.unFreeze(0),this.clearDelay()},e);return}this.particleSystem.unFroze()}reset(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.reset(0),this.clearDelay()},e);return}this.particleSystem.reset()}reverseFromCurrent(){switch(this.emission){case"emitToggle":this.toggleEmitting();break;case"pauseToggle":this.toggleFroze()}}dispatchBasic(){if(!1===R5(this.shared,this.condition)||!this.particleSystem)return!1;switch(this.emission){case"start":this.start(this.delay);break;case"emitToggle":this.toggleEmitting();break;case"pause":this.freeze(this.delay);break;case"pauseToggle":this.toggleFroze();break;case"stop":this.stop(this.delay);break;case"reset":this.reset(this.delay)}}dispatchConditional(){if(!1===R5(this.shared,this.condition)||!this.particleSystem)return!1;switch(this.emission){case"start":this.start(this.delay);break;case"stop":this.stop(this.delay);break;case"reset":this.reset(this.delay)}}dispatchGameControl(e){if(!1===R5(this.shared,this.condition)||!this.particleSystem)return!1;"start"===e?this.start(this.delay):this.stop(this.delay)}dispose(){this.particleSystem&&(this.particleSystem.reset(),this.clearDelay())}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}},Ic=(e,t)=>t.some(t=>t instanceof RegExp?t.test(e):t===e),Id=(e,{stripHash:t})=>{let i=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!i)throw Error(`Invalid URL: ${e}`);let{type:r,data:a,hash:o}=i.groups,l=r.split(";");o=t?"":o;let h=!1;"base64"===l[l.length-1]&&(l.pop(),h=!0);let c=(l.shift()||"").toLowerCase(),d=[...l.map(e=>{let[t,i=""]=e.split("=").map(e=>e.trim());return"charset"===t&&"us-ascii"===(i=i.toLowerCase())?"":`${t}${i?`=${i}`:""}`}
8116).filter(Boolean)];return h&&d.push("base64"),(d.length>0||c&&"text/plain"!==c)&&d.unshift(c),`data:${d.join(";")},${h?a.trim():a}${o?`#${o}`:""}`},Iu=class{constructor({url:e,context:t},i,r,a){if(this.controlsManager=i,this.shared=r,this.condition=a,!e)throw Error("Missing property");this.url=e.startsWith("mailto:")?e:function(e,t){if(t={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...t},e=e.trim(),/^data:/i.test(e))return Id(e,t);if(/^view-source:/i.test(e))throw Error("`view-source:` is not supported as it is a non-standard protocol");let i=e.startsWith("//");!i&&/^\.*\//.test(e)||(e=e.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol));let r=new URL(e);if(t.forceHttp&&t.forceHttps)throw Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&"https:"===r.protocol&&(r.protocol="http:"),t.forceHttps&&"http:"===r.protocol&&(r.protocol="https:"),t.stripAuthentication&&(r.username="",r.password=""),t.stripHash?r.hash="":t.stripTextFragment&&(r.hash=r.hash.replace(/#?:~:text.*?$/i,"")),r.pathname){let e=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,t=0,i="";for(;;){let a=e.exec(r.pathname);if(!a)break;let o=a[0],l=a.index;i+=r.pathname.slice(t,l).replace(/\/{2,}/g,"/")+o,t=l+o.length}i+=r.pathname.slice(t,r.pathname.length).replace(/\/{2,}/g,"/"),r.pathname=i}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(!0===t.removeDirectoryIndex&&(t.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let e=r.pathname.split("/");Ic(e[e.length-1],t.removeDirectoryIndex)&&(e=e.slice(0,-1),r.pathname=e.slice(1).join("/")+"/")}if(r.hostname&&(r.hostname=r.hostname.replace(/\.$/,""),t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(r.hostname)&&(r.hostname=r.hostname.replace(/^www\./,""))),Array.isArray(t.removeQueryParameters))for(let e of[...r.searchParams.keys()])Ic(e,t.removeQueryParameters)&&r.searchParams.delete(e);if(!0===t.removeQueryParameters&&(r.search=""),t.sortQueryParameters){r.searchParams.sort();try{r.search=decodeURIComponent(r.search)}catch{}}t.removeTrailingSlash&&(r.pathname=r.pathname.replace(/\/$/,""));let a=e;return e=r.toString(),t.removeSingleSlash||"/"!==r.pathname||a.endsWith("/")||""!==r.hash||(e=e.replace(/\/$/,"")),(t.removeTrailingSlash||"/"===r.pathname)&&""===r.hash&&t.removeSingleSlash&&(e=e.replace(/\/$/,"")),i&&!t.normalizeProtocol&&(e=e.replace(/^http:\/\//,"//")),t.stripProtocol&&(e=e.replace(/^(?:https?:)?\/\//,"")),e}(e,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=t??"tab"}dispatch(){if(!1===R5(this.shared,this.condition))return!1;pp?window.location.assign(this.url):("tab"===this.context||pd&&"none"===this.context?window.open(this.url,"_blank"):"window"===this.context?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(px[0]),px.splice(0,px.length))}},Ip=class{constructor(e,t,i,r,a){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=a,this.timeoutIdQueue=[],this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)},this.destroyCallback=e=>{this.timeoutIdQueue.shift();let t=this.page.scene.find(e);if(void 0===t)return;let i=this.controlsManager.sharedGameControlGlobals.rapierWorld,r=!i||t.dataPatched.physics?.fusedBody;if(t.cloner){for(let e of t.cloner.children)r?(e.playModeVisible=!1,e.rigidBody&&t.dataPatched.physics?.rigidBody==="positioned"&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),i.removeRigidBody(e.rigidBody),e.rigidBody=void 0),e.bvhGeometry&&(e.bvhGeometry=void 0)):void 0===this.clone||this.clone===e?(e.playModeVisible=!1,e.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),i.removeRigidBody(e.rigidBody),e.rigidBody=void 0)):void 0===e.playModeVisible&&(e.playModeVisible=!0);(r||void 0===this.clone||!1===this.clone)&&(t.visible=!1,t.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(t.rigidBody.collider(0).handle),i.removeRigidBody(t.rigidBody),t.rigidBody=void 0),t.bvhGeometry&&(t.bvhGeometry=void 0))}else t.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(t.rigidBody.collider(0).handle),i.removeRigidBody(t.rigidBody),t.rigidBody=void 0),t.bvhGeometry&&(t.bvhGeometry=void 0),t.visible=!1;void 0===i?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(e=>void 0!==e.bvhGeometry):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(e=>void 0!==e.rigidBody),t.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...e.objects]}dispatch(e){if(!1===R5(this.shared,this.condition))return!1;this.clone=e,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}
8116dispatchFromStart(){if(!1===R5(this.shared,this.condition))return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(e=>window.clearTimeout(e))}},If=class{constructor(e,t,i,r,a){this.data=e,this.page=t,this.shared=i,this.eventManager=r,this.condition=a,this.shared=i}dispatch(){if(!1===R5(this.shared,this.condition))return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),RO(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},(this.data.delay??0)*1e3)}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Im={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,timelineChangeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Ig={duration:1e3,delay:0,endDelay:0,startOnceDelay:0,pingPongDelayCorrection:0,pingPongEndDelayCorrection:0,easing:"easeOutElastic(1, .5)",round:0},Iv=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Iy={CSS:{},springs:{}};function Ix(e,t,i){return Math.min(Math.max(e,t),i)}function Ib(e,t){return e.indexOf(t)>-1}function Iw(e,t){return e.apply(null,t)}var IS={arr:function(e){return Array.isArray(e)},obj:function(e){return Ib(Object.prototype.toString.call(e),"Object")},pth:function(e){return IS.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return!("isNode"in e)&&(e.nodeType||IS.svg(e))},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return typeof e>"u"},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return IS.hex(e)||IS.rgb(e)||IS.hsl(e)},key:function(e){return!Im.hasOwnProperty(e)&&!Ig.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function I_(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map(function(e){return parseFloat(e)}):[]}function IA(e,t){var i=I_(e),r=Ix(IS.und(i[0])?1:i[0],.1,100),a=Ix(IS.und(i[1])?100:i[1],.1,100),o=Ix(IS.und(i[2])?10:i[2],.1,100),l=Ix(IS.und(i[3])?0:i[3],.1,100),h=Math.sqrt(a/r),c=o/(2*Math.sqrt(a*r)),d=c<1?h*Math.sqrt(1-c*c):0,p=c<1?(c*h+-l)/d:-l+h;function f(e){var i=t?t*e/1e3:e;return i=c<1?Math.exp(-i*c*h)*(1*Math.cos(d*i)+p*Math.sin(d*i)):(1+p*i)*Math.exp(-i*h),0===e||1===e?e:1-i}return t?f:function(){var t=Iy.springs[e];if(t)return t;for(var i=1/6,r=0,a=0;;)if(1===f(r+=i)){if(++a>=16)break}else a=0;var o=r*i*1e3;return Iy.springs[e]=o,o}}function IM(e){return void 0===e&&(e=10),function(t){return Math.ceil(Ix(t,1e-6,1)*e)*(1/e)}}var IE=function(){function e(e,t,i){return(((1-3*i+3*t)*e+(3*i-6*t))*e+3*t)*e}function t(e,t,i){return 3*(1-3*i+3*t)*e*e+2*(3*i-6*t)*e+3*t}return function(i,r,a,o){if(0<=i&&i<=1&&0<=a&&a<=1){var l=new Float32Array(11);if(i!==r||a!==o)for(var h=0;h<11;++h)l[h]=e(.1*h,i,a);return function(h){return i===r&&a===o||0===h||1===h?h:e(function(r){for(var o=0,h=1;10!==h&&l[h]<=r;++h)o+=.1;var c=o+(r-l[--h])/(l[h+1]-l[h])*.1,d=t(c,i,a);return d>=.001?function(i,r,a,o){for(var l=0;l<4;++l){var h=t(r,a,o);if(0===h)break;var c=e(r,a,o)-i;r-=c/h}return r}(r,c,i,a):0===d?c:function(t,i,r,a,o){var l,h,c=0;do(l=e(h=i+(r-i)/2,a,o)-t)>0?r=h:i=h;while(Math.abs(l)>1e-7&&++c<10);return h}(r,o,o+.1,i,a)}(h),r,o)}}}}(),IC=(I3={linear:function(){return function(e){return e}}},I4={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,i=4;e<((t=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var i=Ix(e,1,10),r=Ix(t,.1,2);return function(e){return 0===e||1===e?e:-i*Math.pow(2,10*(e-1))*Math.sin(2*Math.PI*(e-1-r/(2*Math.PI)*Math.asin(1/i))/r)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach(function(e,t){I4[e]=function(){return function(e){return Math.pow(e,t+2)}}}),Object.keys(I4).forEach(function(e){var t=I4[e];I3["easeIn"+e]=t,I3["easeOut"+e]=function(e,i){return function(r){return 1-t(e,i)(1-r)}},I3["easeInOut"+e]=function(e,i){return function(r){return r<.5?t(e,i
8116)(2*r)/2:1-t(e,i)(-2*r+2)/2}}}),I3);function IT(e,t){if(IS.fnc(e))return e;var i=e.split("(")[0],r=IC[i],a=I_(e);switch(i){case"spring":return IA(e,t);case"cubicBezier":return Iw(IE,a);case"steps":return Iw(IM,a);default:return Iw(r,a)}}function IP(e){try{return document.querySelectorAll(e)}catch{return}}function ID(e,t){for(var i=e.length,r=arguments.length>=2?arguments[1]:void 0,a=[],o=0;o<i;o++)if(o in e){var l=e[o];t.call(r,l,o,e)&&a.push(l)}return a}function IO(e){return e.reduce(function(e,t){return e.concat(IS.arr(t)?IO(t):t)},[])}function II(e){return IS.arr(e)?e:(IS.str(e)&&(e=IP(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function IR(e,t){return e.some(function(e){return e===t})}function IL(e){var t={};for(var i in e)t[i]=e[i];return t}function IB(e,t){var i=IL(e);for(var r in e)i[r]=t.hasOwnProperty(r)?t[r]:e[r];return i}function Iz(e,t){var i=IL(e);for(var r in t)i[r]=IS.und(e[r])?t[r]:e[r];return i}function IF(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function IN(e,t){return IS.fnc(e)?e(t.target,t.id,t.total):e}function IU(e,t){return e.getAttribute(t)}function Ik(e,t,i){if(IR([i,"deg","rad","turn"],IF(t)))return t;var r=Iy.CSS[t+i];if(!IS.und(r))return r;var a=document.createElement(e.tagName),o=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;o.appendChild(a),a.style.position="absolute",a.style.width=100+i;var l=100/a.offsetWidth;o.removeChild(a);var h=l*parseFloat(t);return Iy.CSS[t+i]=h,h}function IV(e,t,i){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return i?Ik(e,a,i):a}}function Ij(e,t){return IS.dom(e)&&!IS.inp(e)&&(IU(e,t)||IS.svg(e)&&e[t])?"attribute":IS.dom(e)&&IR(Iv,t)?"transform":IS.dom(e)&&"transform"!==t&&IV(e,t)?"css":null!=e[t]?"object":void 0}function IG(e){if(IS.dom(e)){for(var t,i=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,a=new Map;t=r.exec(i);)a.set(t[1],t[2]);return a}}function IH(e,t,i,r){switch(Ij(e,t)){case"transform":var a,o;return a=Ib(t,"scale")?1:0+(Ib(t,"translate")||"perspective"===t?"px":Ib(t,"rotate")||Ib(t,"skew")?"deg":void 0),o=IG(e).get(t)||a,r&&(r.transforms.list.set(t,o),r.transforms.last=t),i?Ik(e,o,i):o;case"css":return IV(e,t,i);case"attribute":return IU(e,t);default:return e[t]||0}}function IW(e,t){var i=/^(\*=|\+=|-=)/.exec(e);if(!i)return e;var r=IF(e)||0,a=parseFloat(t),o=parseFloat(e.replace(i[0],""));switch(i[0][0]){case"+":return a+o+r;case"-":return a-o+r;case"*":return a*o+r}}function Iq(e,t){if(IS.col(e)){var i,r,a,o;return i=e,IS.rgb(i)?(r=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i))?"rgba("+r[1]+",1)":i:IS.hex(i)?(a=i.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,i,r){return t+t+i+i+r+r}),"rgba("+parseInt((o=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a))[1],16)+","+parseInt(o[2],16)+","+parseInt(o[3],16)+",1)"):IS.hsl(i)?function(e){var t,i,r,a=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e),o=parseInt(a[1],10)/360,l=parseInt(a[2],10)/100,h=parseInt(a[3],10)/100,c=a[4]||1;function d(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}if(0==l)t=i=r=h;else{var p=h<.5?h*(1+l):h+l-h*l,f=2*h-p;t=d(f,p,o+1/3),i=d(f,p,o),r=d(f,p,o-1/3)}return"rgba("+255*t+","+255*i+","+255*r+","+c+")"}(i):void 0}if(/\s/g.test(e))return e;var l=IF(e),h=l?e.substr(0,e.length-l.length):e;return t?h+t:h}function IX(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function IY(e){for(var t,i=e.points,r=0,a=0;a<i.numberOfItems;a++){var o=i.getItem(a);a>0&&(r+=IX(t,o)),t=o}return r}function IQ(e){var t;if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return 2*Math.PI*IU(e,"r");case"rect":return 2*IU(e,"width")+2*IU(e,"height");case"line":return IX({x:IU(e,"x1"),y:IU(e,"y1")},{x:IU(e,"x2"),y:IU(e,"y2")});case"polyline":return IY(e);case"polygon":return t=e.points,IY(e)+IX(t.getItem(t.numberOfItems-1),t.getItem(0))}}function IZ(e,t){var i=t||{},r=i.el||function(e){for(var t=e.parentNode;IS.svg(t)&&IS.svg(t.parentNode);)t=t.parentNode;return t}(e),a=r.getBoundingClientRect(),o=IU(r,"viewBox"),l=a.width,h=a.height,c=i.viewBox||(o?o.split(" "):[0,0,l,h]);return{el:r,viewBox:c,x:c[0]/1,y:c[1]/1,w:l/c[2],h:h/c[3]}}function IK(e,t){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Iq(IS.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(i)?r.match(i).map(Number):[0],strings:IS.str(e)||t?r.split(i):[]}}function IJ(e){return ID(e?IO(IS.arr(e)?e.map(II):II(e)):[],function(e,t,i){return i.indexOf(e)===t})}function I$(e){var t=IJ(e);return t.map(function(e,i){return{target:e,id:i,total:t.length,transforms:{list:IG(e)}}})}var I0={css:function(e,t,i){return e.style[t]=i},attribute:function(e,t,i){return e.setAttribute(t,i)},object:function(e,t,i){return e[t]=i},transform:function(e,t,i,r,a){if(r.list.set(t,i),t===r.last||a){var o="";r.list.forEach(function(e,t){o+=t+"("+e+") "}),e.style.transform=o}}};function I1(e,t){I$(e).forEach(function(e){for(var i in t){var r=IN(t[i],e),a=e.target,o=IF(r),l=IH(a,i,o,e),h=IW(Iq(r,o||IF(l)),l);I0[Ij(a,i)](a,i,h,e.transforms,!0)}})}function I2(e,t){var i=e.length,r=function(e){return e.timelineOffset?e.timelineOffset:0},a={};return a.duration=i?Math.max.apply(Math,e.map(function(e){let t=e.startOnceDelay??0,i=e.pingPongDelayCorrection??0,a=e.pingPongEndDelayCorrection??0;return r(e)+t+i+a+e.duration*(e.loop??1)})):t.duration,a.delay=i?Math.min.apply(Math,e.map(function(e){let t=e.startOnceDelay??0,i=e.pingPongDelayCorrection??0;return r(e)+t+i+e.delay})):t.delay,a.endDelay=i?a.duration-Math.max.apply(Math,e.map(function(e){let t=e.startOnceDelay??0,i=e.pingPongDelayCorrection??0,a=e.pingPongEndDelayCorrection??0;return r(e)+t+i+e.duration*(e.loop??1)-e.endDelay-a})):t.endDelay,a}var I3,I4,I5,I6=0,I8=[],I9=[],I7=function(){let e=0,t=!0;function i(e){let r=I8.length;if(r){let a=0;for(;a<r;){let t=I8[a];t.paused?(I8.splice(a,1),r--):(t.tick(e),a++)}t&&(I5=requestAnimationFrame(i))}else I5&&(cancelAnimationFrame(I5),I5=null)}return{get isUsingInternalRaf(){return t},set isUsingInternalRaf(s){t=s},play:function(){e=performance.now(),I5=requestAnimationFrame(i)},update:function(t){i(e+=t)}}}();function Re(e){I7.isUsingInternalRaf&&(document.hidden?(I8.forEach(function(t){return t.pause(e.timeStamp)}),I9=I8.slice(0),Rt.running=I8=[]):(I9.forEach(function(t){return t.play(e.timeStamp)}),I9=[]))}function Rt(e){void 0===e&&(e={});var t,i,r,a,o,l,h,c,d,p,f=0,m=0,g=0,v=0,y=null;function x(e){var t=window.Promise&&new Promise(function(e){return y=e});return e.finished=t,t}var b=(i=IB(Im,t=e),a=function(e,t){var i=[],r=t.keyframes;for(var a in r&&(t=Iz(function(e){for(var t=ID(IO(e.map(function(e){return Object.keys(e)})),function(e){return IS.key(e)}).reduce(function(e,t){return 0>e.indexOf(t)&&e.push(t),e},[]),i={},r=0;r<t.length;r++)!function(r){var a=t[r];i[a]=e.map(function(e){var t={};for(var i in e)IS.key(i)?i==a&&(t.value=e[i]):t[i]=e[i];return t})}(r);return i}(r),t)),t)IS.key(a)&&i.push({name:a,tweens:function(e,t){var i=IL(t);if(/^spring/.test(i.easing)&&(i.duration=IA(i.easing)),IS.arr(e)){var r=e.length;2!==r||IS.obj(e[0])?IS.fnc(t.duration)||(i.duration=t.duration/r):e={value:e}}var a=IS.arr(e)?e:[e];return a.map(function(e,i){var r=IS.obj(e)&&!IS.pth(e)?e:{value:e};return IS.und(r.delay)&&(r.delay=i?0:t.delay),IS.und(r.endDelay)&&(r.endDelay=i===a.length-1?t.endDelay:0),r}).map(function(e){return Iz(e,i)})}(t[a],e)});return i}(r=IB(Ig,t),t),h=I2(l=ID(IO((o=I$(t.targets)).map(function(e){return a.map(function(t){return function(e,t){var i=Ij(e.target,t.name);if(i){var r,a=t.tweens.map(function(i){var a=function(e,t){var i={};for(var r in e){var a=IN(e[r],t);IS.arr(a)&&1===(a=a.map(function(e){return IN(e,t)})).length&&(a=a[0]),i[r]=a}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(i,e),o=a.value,l=IS.arr(o)?o[1]:o,h=IF(l),c=IH(e.target,t.name,h,e),d=r?r.to.original:c,p=IS.arr(o)?o[0]:d,f=IF(p)||IF(c),m=h||f;return IS.und(l)&&(l=d),a.from=IK(p,m),a.to=IK(IW(l,p),m),a.start=r?r.end:0,a.end=a.start+a.delay+a.duration+a.endDelay,a.easing=IT(a.easing,a.duration),a.isPath=IS.pth(o),a.isColor=IS.col(a.from.original),a.isColor&&(a.round=1),r=a,a}),o=a[a.length-1];return{type:i,property:t.name,animatable:e,tweens:a,duration:o.end,delay:a[0].delay,endDelay:o.endDelay}}}(e,t)})})),function(e){return!IS.und(e)}),r),c=I6,I6++,Iz(i,{id:c,children:[],animatables:o,animations:l,duration:h.duration,delay:h.delay,endDelay:h.endDelay,startOnceDelay:r.startOnceDelay,pingPongDelayCorrection:r.pingPongDelayCorrection,pingPongEndDelayCorrection:r.pingPongEndDelayCorrection}));function w(){var e=b.direction;"alternate"!==e&&(b.direction="normal"!==e?"normal":"reverse"),b.reversed=!b.reversed,p.forEach(function(e){(1===e.loop||e.loop%2==0)&&(e.reversed=b.reversed)})}function S(e,t,i=!1){t&&(b.reversed?t.seek(t.duration*t.loop-(e-t.timelineOffset-t.pingPongDelayCorrection),i):t.seek(e-t.timelineOffset-t.startOnceDelay-t.pingPongDelayCorrection,i))}function _(e){var t=0,i=b.animations,r=i.length;for("alternate"!==b.direction&&b.parent?.direction==="alternate"?b.parent?.rewind===!1&&!0===b.reversePlayback&&!1===b.rewind&&(e=b.parent?.reversed&&"alternate"===b.direction?b.duration-b.delay+b.endDelay-e:b.duration+b.delay-b.endDelay-e):E(!1,b.parent?.rewind,b.rewind,b.parent?.reversePlayback,b.reversePlayback)&&(e=b.parent?.reversed&&"alternate"===b.direction?b.duration-b.delay+b.endDelay-e:b.duration+b.delay-b.endDelay-e);t<r;){let r;var a=i[t],o=a.animatable,l=a.tweens,h=l.length-1,c=l[h];h&&(c=ID(l,function(t){return e<t.end})[0]||c),r=b.parent?.reversed&&"alternate"===b.direction?Ix(e-c.start-c.endDelay,0,c.duration)/c.duration:Ix(e-c.start-c.delay,0,c.duration)/c.duration;for(var d=isNaN(r)?1:c.easing(r),p=c.to.strings,f=c.round,m=[],g=c.to.numbers.length,v=void 0,y=0;y<g;y++){let e,t;var x=void 0;"alternate"!==b.direction?b.parent?.rewind===!1&&!0===b.reversePlayback&&!1===b.rewind?(e=c.to.numbers[y],t=c.from.numbers[y]||0):(t=c.to.numbers[y],e=c.from.numbers[y]||0):E(!0,b.parent?.rewind,b.rewind,b.parent?.reversePlayback,b.reversePlayback)?(e=c.to.numbers[y],t=c.from.numbers[y]||0):(t=c.to.numbers[y],e=c.from.numbers[y]||0),x=c.isPath?function(e,t){function i(i){void 0===i&&(i=0);var r=t+i>=1?t+i:0;return e.el.getPointAtLength(r)}var r=IZ(e.el,e.svg),a=i(),o=i(-1),l=i(1);switch(e.property){case"x":return(a.x-r.x)*r.w;case"y":return(a.y-r.y)*r.h;case"angle":return 180*Math.atan2(l.y-o.y,l.x-o.x)/Math.PI}}(c.value,d*t):e+d*(t-e),f&&(c.isColor&&y>2||(x=Math.round(x*f)/f)),m.push(x)}var w=p.length;if(w){v=p[0];for(var S=0;S<w;S++){p[S];var _=p[S+1],A=m[S];isNaN(A)||(_?v+=A+_:v+=A+" ")}}else v=m[0];I0[a.type](o.target,a.property,v,o.transforms),a.currentValue=v,t++}}function A(e){b[e]&&!b.passThrough&&b[e](b)}x(b);let M={0:!1,1:!0,2:!1,3:!0,4:!1,5:!1,6:!1,7:!1,8:!1,9:!0,10:!0,11:!1,12:!1,13:!1,14:!0,15:!0,16:!1,17:!0,18:!0,19:!1,20:!1,21:!1,22:!0,23:!0,24:!1,25:!0,26:!1,27:!0,28:!1,29:!1,30:!1,31:!1};function E(e,t,i,r,a){return M[e<<4|t<<3|i<<2|r<<1|a]}function C(e,t=!1){var i=b.duration;let r=b.delay,a=i-b.endDelay;b.parent?.reversed&&"alternate"===b.direction&&(r=b.endDelay,a=i-b.delay);var o=b.reversed?b.duration-e:e;if(b.progress=Ix(o/i*100,0,100),t||(b.reversePlayback=o<b.currentTime),v&&function(e,t=!1){if(b.reversed)for(var i=v;i--;)S(e,p[i],t);else for(var r=0;r<v;r++)S(e,p[r],t)}(o,t),!b.began&&o>=r&&(b.began=!0),!b.loopBegan&&b.currentTime>0&&(b.loopBegan=!0,A("loopBegin")),(b.reversed||o>=0)&&o<=r&&0!==b.currentTime&&(_(0),A("change")),(o>=a&&b.currentTime!==i+b.pingPongDelayCorrection||!i)&&(_(i),A("change")),o>r&&o<a?(b.changeBegan||(b.changeBegan=!0,b.changeCompleted=!1,A("changeBegin")),_(o),A("change")):b.changeBegan?(b.changeCompleted=!0,b.changeBegan=!1,A("change"),v&&A("timelineChangeComplete")):b.began&&o>a&&A("changeComplete"),b.currentTime=Ix(o,0,i+b.pingPongDelayCorrection),b.began&&A("update"),e>=i){if(b.remaining&&!0!==b.remaining&&b.remaining--,b.remaining){for(let e of(v?f+=b.duration/Rt.speed:f+=b.duration,p))e.setStartTime(0),e.remaining=e.loop;A("loopComplete"),b.loopBegan=!1,"alternate"===b.direction?w():v&&(b.direction="normal",b.reversed=!1,p.forEach(function(e){return e.reversed=!1}))}else b.paused=!0,b.completed||(b.completed=!0,A("loopComplete"),A("complete"),!b.passThrough&&"Promise"in window&&(y(),x(b)))}}return b.reset=function(){var e=b.direction;b.passThrough=!1,b.currentTime=0,b.progress=0,b.paused=!0,b.began=!1,b.loopBegan=!1,b.changeBegan=!1,b.completed=!1,b.changeCompleted=!1,b.reversed="reverse"===e,b.remaining=b.loop,v=(p=b.children).length;for(var t=v;t--;)b.children[t].reset();_(b.reversed?b.duration:0)},b.setStartTime=function(e){f=e},b.set=function(e,t){return I1(e,t),b},b.tick=function(e){g=e,f||(f=g),C((g+(m-f))*Rt.speed)},b.seek=function(e,t=!1){C(e-f,t)},b.pause=function(e){b.paused=!0,v&&(d=e??performance.now())},b.play=function(e){b.paused&&(b.completed&&b.reset(),b.paused=!1,I8.push(b),v&&void 0!==d&&(f+=(e??performance.now())-d),!I5&&I7.isUsingInternalRaf&&I7.play())},b.reverse=function(e=0){w(),b.completed=!b.reversed,f=void 0,m=e},b.restart=function(){b.reset(),f=void 0,m=0,b.play()},b.destroy=function(){b.paused=!0;var e=I8.indexOf(b);e>-1&&I8.splice(e,1),(e=I9.indexOf(b))>
8116-1&&I9.splice(e,1),b.children&&b.children.forEach(function(e){e.destroy&&e.destroy()}),b.animations=[],b.animatables=[],b.children=[],b.update=null,b.begin=null,b.complete=null,b.loopBegin=null,b.loopComplete=null,b.change=null,b.changeBegin=null,b.changeComplete=null,b.timelineChangeComplete=null,b.parent=null,y=null,p=[],v=0},b.reset(),b.autoplay&&b.play(),b}function Ri(e,t){for(var i=t.length;i--;)IR(e,t[i].animatable.target)&&t.splice(i,1)}Rt.version="3.2.0",Rt.speed=1,Rt.running=I8,Rt.remove=function(e){for(var t=IJ(e),i=I8.length;i--;){var r=I8[i],a=r.animations,o=r.children;Ri(t,a);for(var l=o.length;l--;){var h=o[l],c=h.animations;Ri(t,c),c.length||h.children.length||o.splice(l,1)}a.length||o.length||r.pause()}},Rt.get=IH,Rt.set=I1,Rt.convertPx=Ik,Rt.path=function(e,t){var i=IS.str(e)?IP(e)[0]:e,r=t||100;return function(e){return{property:e,el:i,svg:IZ(i),totalLength:IQ(i)*(r/100)}}},Rt.setDashoffset=function(e){var t=IQ(e);return e.setAttribute("stroke-dasharray",t),t},Rt.stagger=function(e,t){void 0===t&&(t={});var i=t.direction||"normal",r=t.easing?IT(t.easing):null,a=t.grid,o=t.axis,l=t.from||0,h="first"===l,c="center"===l,d="last"===l,p=IS.arr(e),f=parseFloat(p?e[0]:e),m=p?parseFloat(e[1]):0,g=IF(p?e[1]:e)||0,v=t.start||0+(p?f:0),y=[],x=0;return function(e,t,b){if(h&&(l=0),c&&(l=(b-1)/2),d&&(l=b-1),!y.length){for(var w=0;w<b;w++){if(a){var S=c?(a[0]-1)/2:l%a[0],_=c?(a[1]-1)/2:Math.floor(l/a[0]),A=w%a[0],M=Math.floor(w/a[0]),E=S-A,C=_-M,T=Math.sqrt(E*E+C*C);"x"===o&&(T=-E),"y"===o&&(T=-C),y.push(T)}else y.push(Math.abs(l-w));x=Math.max.apply(Math,y)}r&&(y=y.map(function(e){return r(e/x)*x})),"reverse"===i&&(y=y.map(function(e){return o?e<0?-1*e:-e:Math.abs(x-e)}))}var P=p?(m-f)/x:f;return v+Math.round(100*y[t])/100*P+g}},Rt.timeline=function(e){void 0===e&&(e={});var t=Rt(e);return t.duration=0,t.add=function(i,r){var a=I8.indexOf(t),o=t.children;function l(e){e.passThrough=!0}a>-1&&I8.splice(a,1);for(var h=0;h<o.length;h++)l(o[h]);var c=Iz(i,IB(Ig,e));c.targets=c.targets||e.targets;var d=t.duration;c.autoplay=!1,c.timelineOffset=IS.und(r)?d:IW(r,d),l(t);var p=Rt(c);l(p),o.push(p),p.parent=t;var f=I2(o,e);return t.delay=f.delay,t.endDelay=f.endDelay,t.duration=f.duration,!0===p.loop&&(t.duration=1/0),t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},Rt.easing=IT,Rt.penner=IC,Rt.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e},Rt.removeAll=function(){I8.forEach(function(e){e.destroy&&e.destroy()}),I8=[],I9=[],Rt.running=I8,I5&&(cancelAnimationFrame(I5),I5=null)},Rt.clearCache=function(){Iy.CSS={},Iy.springs={}},Rt.init=function(){"u">typeof document&&(document.removeEventListener("visibilitychange",Re),document.addEventListener("visibilitychange",Re))},Rt.dispose=function(e){Rt.removeAll(),Rt.clearCache(),document.removeEventListener("visibilitychange",Re)};var Rr=Rt,{degToRad:Rs,radToDeg:Ra}=t8,Rn=new iD,Ro=new iD,Rl=new iP;function Rh(e,t,i,r,a,o){let l=void 0!==i[e]?i[e]:void 0,h=r[e];if(null==h)return;let c=null!=l?"string"==typeof l?Number(a.getVariable(l)??0):l:t[e],d="string"==typeof h?Number(a.getVariable(h)??0):h;if(c!==d)return{update:i=>{let r=t8.lerp(c,d,i);o?t[e]=Math.trunc(r):t[e]=r},start:()=>{t[e]=c},end:()=>{t[e]=d}}}function Rc(e,t,i,r,a,o){let l=i[e]?i[e]:void 0,h=r[e];if(!h)return;let c=t[e],d=[...l??c].map(e=>"string"==typeof e?Number(a.getVariable(e)??0):e),p=[...h].map(e=>"string"==typeof e?Number(a.getVariable(e)??0):e);if(!(d.length!==p.length||pe(d,p)))return{update:i=>{d.forEach((r,a)=>{let l=t8.lerp(r,p[a],i);t[e][a]=o?Math.trunc(l):l})},start:()=>{Object.assign(t[e],d)},end:()=>{Object.assign(t[e],p)}}}function Rd(e,t,i){return t.forEach((t,r)=>{e.setComponent(r,"string"==typeof t?Number(i.getVariable(t)??0):t)}),e}function Ru(e,t,i,r,a){let o=i[e]?i[e]:void 0,l=r[e];if(!l)return;let h=t[e],c=o?Rd(new iD,o,a):h.clone(),d=Rd(new iD,l,a);if(!c.equals(d))return{update:e=>{h.lerpVectors(c,d,e)},start:()=>{h.copy(c)},end:()=>{h.copy(d)}}}function Rp(e,t,i){return t.forEach((t,r)=>{e.setComponent(r,"string"==typeof t?Number(i.getVariable(t)??0):t)}),e}function Rf(e,t,i,r,a){let o=i[e]?i[e]:void 0,l=r[e];if(!l)return;let h=t[e],c=!(h instanceof t9),d=h instanceof t9?h:new t9().fromArray(h),p=o?Rp(new t9,o,a):d.clone(),f=Rp(new t9,l,a);if(!p.equals(f))return{update:i=>{d.lerpVectors(p,f,i),c&&(t[e]=d.toArray())},start:()=>{d.copy(p),c&&(t[e]=d.toArray())},end:()=>{d.copy(f),c&&(t[e]=d.toArray())}}}function Rm(e,t,i,r,a){let o=i[e]?i[e]:void 0,l=r[e];if(!l)return;let h=t[e],c=new _R(h.r,h.g,h.b,h.a),d=o?"string"==typeof o?a.getColor(o).clone():new _R(o.r,o.g,o.b,o.a):c.clone(),p="string"==typeof l?a.getColor(l).clone():new _R(l.r,l.g,l.b,l.a);if(!d.equals(p))return{update:i=>{c.lerpColors(d,p,i);let r=t8.lerp(d.a,p.a,i);c.a=r,t[e]={r:c.r,g:c.g,b:c.b,a:c.a}},start:()=>{c.copy(d)},end:()=>{c.copy(p)}}}function Rg(e,t,i,r,a){return"number"==typeof t[e]?Rh(e,t,i??{},r,a):Array.isArray(t[e])?Rc(e,t,i??{},r,a):void 0}function Rv(e,t,i,r,a){let o=i[e],l=r[e];if("number"==typeof t[e])Math.abs(o-l)>1e-4&&(t[e]=t8.lerp(o,l,a));else if(Array.isArray(t[e]))for(let i=0,r=o.length;i<r;i++)t[e][i]=t8.lerp(o[i],l[i],a)}new rn;var Ry=["voronoiStyle"];function Rx(e,t,i,r){let a=[],o=MC(i,r)||!!t.layers&&MC(t,r);for(let l of(a.push({update:()=>
8116{e.setTransparent(o)}}),e.layers)){let e=t.layers?.data(l.uuid),o=i.layers.data(l.uuid);if(o&&("light"===l.type||(l.visible??!0)&&(o.visible??!0)))for(let t of l.getNames().filter(e=>!vi.some(t=>e.includes(t))))try{let i=l.getValue(t),h;if("colors"===t)h=function(e,t,i,r="colors"){if(!e.hasValue(r)||!(r in i))return;let a=[],o=e.getValue(r),l=t?t[r]:o.map(e=>e.toArray()),h=i[r];for(let e=0;e<o.length;++e){let t=[...l[e]],i=[...h[e]];gv.isEqual(t,i)||a.push({update:r=>{o[e].fromArray(gv.lerp(t,i,r))},start:()=>{o[e].fromArray(t)},end:()=>{o[e].fromArray(i)}})}return a.length?a:void 0}(l,e,o,t);else if(Array.isArray(i))"steps"===t&&(h=RA(l,e,o,t));else if("number"==typeof i)h=Rb(l,e,o,t,r,Ry.includes(t));else{if("boolean"==typeof i)continue;i instanceof t9?h=Rw(l,e,o,t):i instanceof iD?h=RS(l,e,o,t,r):i instanceof _R?h=function(e,t,i,r,a){if(!e.hasValue(r)||!(r in i))return;let o=t?t[r]:void 0,l=i[r],h=e.getValue(r),c=o?"string"==typeof o?a.color(o).clone():new iv().setRGB(o.r,o.g,o.b):h.clone(),d="string"==typeof l?a.getColor(l).clone():new _R(l.r,l.g,l.b,l.a);if(c.equals(d))return;let p=h.clone();return{update:t=>{e.getValue(r)!==p&&e.setValue(r,p),p.lerpColors(c,d,t)},start:()=>{p.copy(c)},end:()=>{p.copy(d)}}}(l,e,o,t,r):i instanceof iv?h=R_(l,e,o,t,r):"isTexture"in i&&(h=RM(l,e,o,t))}h&&(Array.isArray(h)?a.push(...h):a.push(h))}catch(e){console.error(`lerpMaterial: unexpected material layer for ${t}`,e)}}return a}function Rb(e,t,i,r,a,o=!1){if(!e.hasValue(r)||!(r in i))return;let l=t?t[r]:e.getValue(r),h=i[r],c="string"==typeof l?Number(a.getVariable(l)??0):l,d="string"==typeof h?Number(a.getVariable(h)??0):h;return{update:t=>{e.setValue(r,o?t<.5?c:d:t8.lerp(c,d,t))},start:()=>{e.setValue(r,c)},end:()=>{e.setValue(r,d)}}}function Rw(e,t,i,r){if(!e.hasValue(r)||!(r in i))return;let a=e.getValue(r),o=t?new t9().fromArray(t[r]):a.clone(),l=new t9().fromArray(i[r]);if(!o.equals(l))return{update:e=>{a.lerpVectors(o,l,e)},start:()=>{a.copy(o)},end:()=>{a.copy(l)}}}function RS(e,t,i,r,a){if(!e.hasValue(r)||!(r in i))return;let o=e.getValue(r),l=t?t[r]:void 0,h=i[r],c=l?Rd(new iD,l,a):o.clone(),d=Rd(new iD,h,a);if(!c.equals(d))return{update:e=>{o.lerpVectors(c,d,e)},start:()=>{o.copy(c)},end:()=>{o.copy(d)}}}function R_(e,t,i,r,a){if(!e.hasValue(r)||!(r in i))return;let o=t?t[r]:void 0,l=i[r],h=e.getValue(r),c=o?"string"==typeof o?a.getColor(o).clone():new iv().setRGB(o.r,o.g,o.b):h.clone(),d="string"==typeof l?a.getColor(l).clone():new iv().setRGB(l.r,l.g,l.b);if(c.equals(d))return;let p=h.clone();return{update:t=>{e.getValue(r)!==p&&e.setValue(r,p),p.lerpColors(c,d,t)},start:()=>{p.copy(c)},end:()=>{p.copy(d)}}}function RA(e,t,i,r="steps"){if(!e.hasValue(r)||!(r in i))return;let a=[],o=e.getValue(r),l=t?t[r]:o,h=i[r];return pe(l,h)||a.push({update:t=>{let i=[...o];for(let e=0;e<o.length;++e){let r=l[e],a=h[e];i[e]=t8.lerp(r,a,t)}e.setValue(r,i)},start:()=>{e.setValue(r,l)},end:()=>{e.setValue(r,h)}}),a.length?a:void 0}function RM(e,t,i,r="texture"){if(!e.hasValue(r)||!(r in i))return;let a=e.getNode("rotation"),o=t?.[r]?.rotation??0,l=i[r]?.rotation??0;if(a&&o!==l)return{update:e=>{a.value=t8.lerp(o,l,e)*t8.DEG2RAD},start:()=>{a.value=o*t8.DEG2RAD},end:()=>{a.value=l*t8.DEG2RAD}};let h=e.getNode("mat");if(!h)return;let c=t?t[r]:h,d=i[r],p=[...c.repeat],f=[...c.offset],m=[...d.repeat],g=[...d.offset],v=c.rotation??0,y=d.rotation??0;if(!go.isEqual(p,m)||!go.isEqual(f,g)||v!==y)return{update:e=>{h.repeat=go.lerp(p,m,e),h.offset=go.lerp(f,g,e),h.rotation=t8.lerp(v,y,e),h.updateMatrix()},start:()=>{h.repeat=[...p],h.offset=[...f],h.rotation=v,h.updateMatrix()},end:()=>{h.repeat=[...m],h.offset=[...g],h.rotation=y,h.updateMatrix()}}}function RE(e,t,i,r,a,o,l){if("color"===e)R_(t,i,r,e,l)?.update(a);else if(Array.isArray(o))"steps"===e&&RA(t,i,r,e)?.forEach(e=>e.update(a));else if("number"==typeof o)Rb(t,i,r,e,l)?.update(a);else{if("boolean"==typeof o)return;o instanceof t9?Rw(t,i,r,e)?.update(a):o instanceof iD?RS(t,i,r,e,l)?.update(a):"isTexture"in o&&RM(t,i,r,e)?.update(a)}}var RC=new iD,RT=new rn;function RP(e,t,i,r,a){let o=[];return e.data.visible&&o.push(...function(e,t,i,r,a){let o=[],l,h,c,d,p,f,m,g;if(e instanceof PU?((l=Rf("position",e,t,i,a))&&o.push(l),(c=Rh("rotation",e,t,i,a))&&o.push(c),(d=Rf("shear",e,t,i,a))&&o.push(d)):((f=Rh("slide",g={slide:t.pathSnapping?.slide??e.updatedPathSnapping?.slide??e.dataPatched.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??e.updatedPathSnapping?.offset??e.dataPatched.pathSnapping?.offset??0},t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,a))&&o.push(f),(m=Rh("offset",g,t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,a))&&o.push(m),!f&&!m&&((l=Ru("position",e,t,i,a))&&o.push(l),(h=Ru("scale",e,t,i,a))&&o.push(h),(c=function(e,t,i,r,a){let o=t?.rotation?t.rotation.map(e=>("string"==typeof e?Number(a.getVariable(e)??0):e)*t8.DEG2RAD):void 0,l=i.rotation?.map(e=>("string"==typeof e?Number(a.getVariable(e)??0):e)*t8.DEG2RAD);if(!l)return;let h=o?new iD().fromArray(o):new iD().setFromEuler(e.rotation),c=new iD().fromArray(l);if(h.equals(c))return;let d=RC.subVectors(c,h);if(!(r&&d.toArray().every(e=>Math.abs(e)<2*Math.PI)))return{update:t=>{RC.lerpVectors(h,c,t),e.rotation.setFromVector3(RC)},start:()=>{e.rotation.setFromVector3(h)},end:()=>{e.rotation.setFromVector3(c)}};{let t=new iP().setFromEuler(RT.setFromVector3(h)),i=new iP().setFromEuler(RT.setFromVector3(c));return{update:r=>{!function(e,t,i,r){if(0===r)return i.copy(e);if(1===r)return i.copy(t);let a=e.w*t.w+e.x*t.x+e.y*t.y+e.z*t.z;if(a>=1)return i.copy(e);let o=1-a*a;if(o<=Number.EPSILON){let a=1-r;
8116return i.w=a*e.w+r*t.w,i.x=a*e.x+r*t.x,i.y=a*e.y+r*t.y,i.z=a*e.z+r*t.z,i.normalize()}let l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-r)*h)/l,d=Math.sin(r*h)/l;i.w=e.w*c+t.w*d,i.x=e.x*c+t.x*d,i.y=e.y*c+t.y*d,i.z=e.z*c+t.z*d}(t,i,e.quaternion,r)},start:()=>{e.rotation.setFromVector3(h)},end:()=>{e.rotation.setFromVector3(c)}}}}(e,t,i,r,a))&&o.push(c),(p=function(e,t,i,r){let a=i[e]?i[e]:void 0,o=r[e];if(!o)return;let l=t[e],h=a?new i6().fromArray(a):l.clone(),c=new iD,d=new iP,p=new iD;h.decompose(c,d,p);let f=new i6().fromArray(o),m=new iD,g=new iP,v=new iD;if(f.decompose(m,g,v),!h.equals(f))return{update:e=>{Rl.slerpQuaternions(d,g,e),Rn.lerpVectors(c,m,e),Ro.lerpVectors(p,v,e),l.compose(Rn,Rl,Ro)},start:()=>{l.compose(c,d,p)},end:()=>{l.compose(m,g,v)}}}("hiddenMatrix",e,t,i))&&o.push(p))),l||h||c||p||f||m){let i=e instanceof PU?()=>{e.updateWorldMatrix(!0,!1,!0),e.resetBBoxNeedsUpdate()}:()=>{e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),e.parent?.matrixWorldFusedFalse&&(e.matrixWorld.multiplyMatrices(e.parent.matrixWorldFusedFalse,e.matrix),e.matrixWorldNeedsUpdate=!1),Cu(e)&&Cp(e.parent)&&e.invali
8116dateDownstreamBooleanData(!0),e.updatePathSnapping(Object.assign({},t.pathSnapping,g))};o.push({update:i,start:i,end:i})}return o}(e,t,i,a,r.shared)),e instanceof PU?o.push(...function(e,t,i,r,a){let o=[],l,h,c,d,p,f,m,g,v,y,x,b,w,S,_;if("width"in e&&(l=Rh("width",e,t,i,a))&&o.push(l),"height"in e&&(h=Rh("height",e,t,i,a))&&o.push(h),e instanceof P8||e instanceof Di){let r={...t.fill},l={...i.fill};void 0!==r.enabled&&r.enabled!==l.enabled&&(o.push({update:()=>{e instanceof P8&&(e.fill.enabled=!0)}}),r.enabled||Object.assign(r,{enabled:!0,color:{...r.color,a:0}}),l.enabled||Object.assign(l,{enabled:!0,color:{...l.color,a:0}})),(c=Rm("color",e.fill,r,l,a))&&o.push(c)}if(e instanceof P8){let r={...t.stroke},l={...i.stroke};(r.enabled||l.enabled)&&(o.push({update:()=>{e instanceof P8&&(e.stroke.enabled=!0)}}),r.enabled||Object.assign(r,{enabled:!0,color:{...r.color,a:0}}),l.enabled||Object.assign(l,{enabled:!0,color:{...l.color,a:0}})),(d=Rm("color",e.stroke,r,l,a))&&o.push(d),(p=Rh("thickness",e.stroke,r,l,a))&&o.push(p)}if(e instanceof P8){let r={...t.dropShadow},l={...i.dropShadow};(r.enabled||l.enabled)&&(o.push({update:()=>{e instanceof P8&&(e.dropShadow.enabled=!0)}}),r.enabled||Object.assign(r,{enabled:!0,color:{...r.color,a:0}}),l.enabled||Object.assign(l,{enabled:!0,color:{...l.color,a:0}})),(f=Rm("color",e.dropShadow,r,l,a))&&o.push(f),(m=Rh("blurRadius",e.dropShadow,r,l,a))&&o.push(m),(v=Rh("spread",e.dropShadow,r,l,a))&&o.push(v),(g=Rf("offset",e.dropShadow,r,l,a))&&o.push(g)}if(e instanceof P8){let r={...t.innerShadow},l={...i.innerShadow};(r.enabled||l.enabled)&&(o.push({update:()=>{e instanceof P8&&(e.innerShadow.enabled=!0)}}),r.enabled||Object.assign(r,{enabled:!0,color:{...r.color,a:0}}),l.enabled||Object.assign(l,{enabled:!0,color:{...l.color,a:0}})),(y=Rm("color",e.innerShadow,r,l,a))&&o.push(y),(x=Rh("blurRadius",e.innerShadow,r,l,a))&&o.push(x),(w=Rh("spread",e.innerShadow,r,l,a))&&o.push(w),(b=Rf("offset",e.innerShadow,r,l,a))&&o.push(b)}if(e instanceof P8||e instanceof Di){let r={...t.backgroundBlur},l={...i.backgroundBlur};(r.enabled||l.enabled)&&(o.push({update:()=>{e instanceof P8&&(e.backgroundBlur.enabled=!0)}}),r.enabled||Object.assign(r,{enabled:!0,radius:0}),l.enabled||Object.assign(l,{enabled:!0,radius:0})),(S=Rh("radius",e.backgroundBlur,r,l,a))&&o.push(S)}if(e instanceof P8){let r={...t.layerBlur},l={...i.layerBlur};(r.enabled||l.enabled)&&(o.push({update:()=>{e instanceof P8&&(e.layerBlur.enabled=!0)}}),r.enabled||Object.assign(r,{enabled:!0,radius:0}),l.enabled||Object.assign(l,{enabled:!0,radius:0})),(_=Rh("radius",e.layerBlur,r,l,a))&&o.push(_)}if(e instanceof Di||e instanceof P7){let r=Rc("cornerRadius",e,t,i,a);r&&o.push(r)}return o}(e,t,i,0,r.shared)):(e.data.visible&&o.push(...function(e,t,i,r){let a=[];if(!("cloner"in i)||!e.cloner)return a;let o=e.cloner,l="cloner"in t?t.cloner:{},h=i.cloner;gE.forEach(e=>{let t;(t="count"===e?Rh("count",o.parameters,l,h,r.shared,!0):Rg(e,o.parameters,l??{},h,r.shared))&&a.push(t)});let c=function(e,t,i,r){if("radial"!==e.parameters.type)return;let a=t.radial,o=i.radial;if(!o)return;let l=e.parameters.radial,h=[];return gC.forEach(e=>{let t=Rg(e,l,a??{},o,r);t&&h.push(t)}),h}(o,l,h,r.shared);c?.length&&a.push(...c);let d=function(e,t,i,r){if("linear"!==e.parameters.type)return;let a=t.linear,o=i.linear;if(!o)return;let l=[],h=e.parameters.linear;return gT.forEach(e=>{let t=Rg(e,h,a??{},o,r);t&&l.push(t)}),l}(o,l,h,r.shared);d?.length&&a.push(...d);let p=function(e,t,i,r){if("grid"!==e.parameters.type)return;let a=t.grid,o=i.grid;if(!o)return;let l=[],h=e.parameters.grid;return gP.forEach(e=>{let t;(t="count"===e?Rc(e,h,a??{},o,r,!0):Rg(e,h,a??{},o,r))&&l.push(t)}),l}(o,l,h,r.shared);p?.length&&a.push(...p);let f=function(e,t,i,r){if("toObject"!==e.parameters.type)return;let a=t.toObject,o=i.toObject;if(!o)return;let l=[],h=e.parameters.toObject;return gD.forEach(e=>{let t;(t="count"===e?Rh(e,h,a??{},o,r,!0):Rg(e,h,a??{},o,r))&&l.push(t)}),l}(o,l,h,r.shared);f?.length&&a.push(...f);let m=function(e,t,i,r){if(!e.parameters.randomness)return;let a=t.randomnessObject,o=i.randomnessObject;if(!o)return;let l=[],h=e.parameters.randomnessObject;
vendor: 4,099 bytes, line 8116
8116return gO.forEach(e=>{let t=Rg(e,h,a??{},o,r);t&&l.push(t)}),l}(o,l,h,r.shared);return m?.length&&a.push(...m),a.length&&a.push({update:()=>{o.update(r)}}),a}(e,t,i,r)),e instanceof _A?(e instanceof Eh&&e.data.visible&&o.push(...function(e,t,i,r){let a=[];if(!("geometry"in i))return a;let o=e.geometry.userData.parameters,l="geometry"in t?t.geometry:{},h=i.geometry;if(e instanceof Ef){let t=function(e,t,i,r){if(void 0===i.scaleBaked)return;let a=(t.scaleBaked??e.data.geometry.scaleBaked).map(e=>"string"==typeof e?Number(r.shared.getVariable(e)??0):e),o=i.scaleBaked.map(e=>"string"==typeof e?Number(r.shared.getVariable(e)??0):e);if(gg.isEqual(a,o))return;let l=[];return l.push({update:t=>{e.updateGeometryInteractions({scaleBaked:[t8.lerp(a[0],o[0],t),t8.lerp(a[1],o[1],t),t8.lerp(a[2],o[2],t)]},r.shared),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions(r)},start:()=>{e.updateGeometryInteractions({scaleBaked:a},r.shared),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions(r)},end:()=>{e.updateGeometryInteractions({scaleBaked:o},r.shared),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions(r)}}),l}(e,l,h,r);t&&a.push(...t)}else{let t={};if(Object.assign(t,po(o,vo),po(l,vo)),vo.forEach(e=>{let i=Rg(e,t,l,h,r.shared);i&&a.push(i)}),e instanceof DM){Object.assign(t,{extrusion:{...o.extrusion}});let e=function(e,t,i,r){if(!i.extrusion)return;let a=e.extrusion,o=t.extrusion??{},l=i.extrusion,h=[];return vn.forEach(e=>{let t=Rg(e,a,o,l,r);t&&h.push(t)}),h}(t,l,h,r.shared);e&&a.push(...e)}a.length&&a.push({update:i=>{e.updateGeometryInteractions(t,r.shared),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions(r)},start:i=>{e.updateGeometryInteractions(t,r.shared),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions(r)},end:i=>{e.updateGeometryInteractions(t,r.shared),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions(r)}})}return a}(e,t,i,r)),e.data.visible&&o.push(...function(e,t,i,r){let a=[];if(Array.isArray(e.material)){if(!("materials"in i&&i.materials))return a;let o="materials"in t&&t.materials?t.materials:[],l=i.materials;e.material.forEach((e,t)=>{if(!l[t])return;let i=o[t]??{},h=l[t];"string"==typeof i||"string"==typeof h||a.push(...Rx(e,i,h,r))})}else{if(!("material"in i&&i.material))return a;let o="material"in t&&t.material?t.material:{},l=i.material;if("string"==typeof o||"string"==typeof l)return a;a.push(...Rx(e.material,o,l,r))}return a}(e,t,i,r.shared))):PB.is(e)?e.data.visible&&o.push(...function(e,t,i,r){let a=[];if(void 0!==i.intensity){let o=Rh("intensity",e,t,i,r);o&&a.push(o)}if(void 0!==i.color){let o=function(e,t,i,r,a){let o=i[e]?i[e]:void 0,l=r[e];if(!l)return;let h=t[e],c=o?"string"==typeof o?a.getColor(o).clone():new iv().setRGB(o.r,o.g,o.b):h.clone(),d="string"==typeof l?a.getColor(l).clone():new iv().setRGB(l.r,l.g,l.b);if(c.equals(d))return;let p=h.clone();return{update:i=>{p.lerpColors(c,d,i),t[e]?.copy?.(p)},start:()=>{p.copy(c)},end:()=>{p.copy(d)}}}("color",e,t,i,r);o&&a.push(o)}return a}(e,t,i,r.shared)):e instanceof Cn&&o.push(...function(e,t,i,r){let a=[],o="OrthographicCamera"===e.cameraType?t.orthographic?.zoom:t.perspective?.zoom,l="OrthographicCamera"===e.cameraType?i.orthographic?.zoom:i.perspective?.zoom;if(void 0!==l){let t=o??e.zoom;t!==l&&a.push({update:i=>{e.zoom=t8.lerp(t,l,i),e.updateProjectionMatrix()},start:()=>{e.zoom=t,e.updateProjectionMatrix()},end:()=>{e.zoom=l,e.updateProjectionMatrix()}})}if(void 0!==i.targetOffset){let o=Rh("targetOffset",e,t,i,r);o&&a.push(o)}return a}(e,t,i,r.shared))),o.length?{update:e=>{o.forEach(t=>t.update(e))},start:e=>{o.forEach(t=>t.start?.(e))},end:e=>{o.forEach(t=>t.end?.(e))}}:void 0}var RD=new iD;function RO(e,t,i=!1){let r=[],a=i=>{let r=i.data;for(let e of(delete i.states,i.currentState=null,i.reversibleToState=null,i.currentTransitionEvent=null,r.states)){let t={...e.data};i.states||(i.states={}),i.states[e.id]=xw.patch(r,t)}RR(e.scene,i,null,t,void 0!==r.events.find(e=>"Follow"===e.data.type||"LookAt"===e.data.type)),RI(e)};
8116e.scene.traverse2D(a),e.traverseChildren(o=>{if(i&&(o.rigidBody?.setTranslation(o.position0,!0),o.rigidBody?.setRotation(o.rotation0,!0),o.rigidBody?.setLinvel(RD,!0),o.rigidBody?.setAngvel(RD,!0)),!SH.is(o))return;let l=o.uuid,h=o.data;if(delete o.states,o.uuid===gl)return;let c=!1;for(let t of(r.some(t=>e.scene.find(l)?.isDescendantOf(t))?c=!0:h.physics?.fusedBody===!0&&"dynamic"===h.physics.rigidBody&&r.push(l),o.data=h,o.currentState=null,o.reversibleToState=null,o.currentTransitionEvent=null,h.states)){let i={...t.data};!0===e.data.globalPhysics.usePhysics&&h.physics&&("dynamic"===h.physics.rigidBody||c)&&(void 0!==t.data.position&&delete i.position,void 0!==t.data.rotation&&delete i.rotation,void 0!==t.data.hiddenMatrix&&delete i.hiddenMatrix),o.states||(o.states={}),o.states[t.id]=y5.patch(h,i)}RR(e.scene,o,null,t,void 0!==h.events.find(e=>"Follow"===e.data.type||"LookAt"===e.data.type)),o instanceof DO&&o.frame&&(o.frame.traverse(e=>a(e)),o.uiCanvas?.applySize())}),RI(e),e.frame&&(e.frame.traverse(e=>a(e)),e.uiCanvas?.applySize())}function RI(e){e.traverseEntity(t=>{for(let i of t.data.events){let t=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":t.push(...i.data.actions);break;case"GameControl":for(let e of Object.values(i.data.gameActions))t.push(...e);break;case"DragDrop":t.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":t.push(...i.data.inActions,...i.data.outActions)}for(let i of t)if("Create"===i.data.type&&"Yes"===i.data.hideBase){let t=e.scene.find(i.data.object);t&&(t.visible=!1)}}})}function RR(e,t,i,r,a=!1){if(t instanceof Eh&&!(t instanceof D7)&&t.removeInteractionGeometry(r),t instanceof PU?t.changeSelectedState(i,{shared:r},a):t.changeSelectedState(i,{scene:e,shared:r},a),t instanceof Eh&&t.updateGeometryGroupsIfNeeded(),t instanceof Cn&&t.updateCameraState(t.dataPatched,{scene:e,shared:r}),!(t instanceof PU)){if(t.cloner)for(let e of t.cloner.children)e.playModeVisible=void 0;t.updateVisible()}}function RL(e,t,i,r){if(t){let a={},o=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time);if("data"in e){let t=o[0];t&&i?.(t.data.value,e),a={index:[],t:[]};for(let e=0;e<o.length-1;e++){let t=o[e],i=o[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*o[0].data.time:0};a.t.push({...r,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),a.index.push({...r,value:e,easing:"linear"})}if(o.length>1){let t={t:0,index:0};return{targets:t,...a,update:()=>{let a=Math.ceil(t.index),l=a%2==0?t.t:1-t.t,h=o?.[Math.min(a,o.length-1)].data.value,c=o?.[Math.min(a,o.length-1)+1]?.data.value,d={},p={};if(Object.keys(h).length>0&&Object.keys(c).length>0){for(let t in e.data)if(t in h&&t in c){let e=RB(h[t],c[t],l,r);void 0!==e&&(d[t]=e,p[t]={start:h,end:c,t:l})}}i?.({...d},e,p)}}}}}}function RB(e,t,i,r){if("string"==typeof e&&r&&(e=r.color(e)),"string"==typeof t&&r&&(e=r.color(t)),"number"==typeof e)return t8.lerp(e,t,i);if(gw.is(e))return gw.lerp(e,t,i);if(gb.is(e))return gb.lerp(e,t,i);if(Array.isArray(e))return(e.length>t.length?t:e).map((r,a)=>{if(Array.isArray(r)){let r=e[a].length>t[a].length?t[a].length:e[a].length;return(4===r?gv:3===r?gg:go).lerp(e[a],t[a],i)}return t8.lerp(e[a],t[a],i)});if("object"==typeof e&&null!==e){let a={};for(let o in e){let l=RB(e[o],t[o],i,r);void 0!==l&&(a[o]=l)}return a}}function Rz(e){let t;if(5===e.easing){let{control1:i,control2:r}=e;t=`cubicBezier( 8117 ${i[0]}, ${i[1]}, ${r[0]}, ${r[1]} 8118 )`}else if(6===e.easing){let{mass:i,stiffness:r,damping:a,velocity:o}=e;t=`spring( ${i}, ${r}, ${a}, ${o} )`}else{let i;switch(e.easing){case 0:default:i=gN.linear;break;case 1:i=gN.ease;break;case 2:i=gN.easeIn;break;case 3:i=gN.easeOut;break;case 4:i=gN.easeInOut}let[r,a,o,l]=i;t=`cubicBezier( ${r}, ${a}, ${o}, ${l} )`}return{duration:Math.max(e.duration,1e-4),easing:t}}function RF(e){let t={delay:0,loop:-1===e.repeat||e.repeat+1};if(0===e.repeat)t.direction="normal",t.rewind=!1;else switch(e.direction){case"pingpong":t.direction="alternate",t.rewind=!1;break;case"pingpong-rewind":t.direction="alternate",t.rewind=!0;break;default:t.direction="normal",t.rewind=!1}switch(t.delay=0,t.endDelay=0,t.startOnceDelay=0,t.pingPongDelayCorrection=0,t.pingPongEndDelayCorrection=0,e.delayDirection){case"start-once":t.startOnceDelay=e.delay;break;case"start":t.delay=e.delay;break;case"end":t.endDelay=e.delay;break;case"start-end":case void 0:t.delay=e.delay,t.endDelay=e.delay}return"alternate"===t.direction&&(t.delay/=2,t.endDelay/=2,"start"===e.delayDirection?(t.pingPongDelayCorrection=t.delay,"number"==typeof t.loop&&t.loop%2==0&&(t.pingPongEndDelayCorrection=t.delay)):"end"===e.delayDirection?"number"==typeof t.loop&&t.loop%2!=0&&(t.pingPongEndDelayCorrection=t.endDelay):"start-end"===e.delayDirection&&(t.pingPongDelayCorrection=t.delay,t.pingPongEndDelayCorrection=t.endDelay)),t}var RN={type:"beginState"},RU={type:"completeState",isfromEntity:!1},Rk=class{constructor(e,t,i,r,a,o,l){if(this.object=e,this.data=r,this.sharedAssets=a,this.allowSlerp=o,this.page=l,this.targets={t:0},this.firstLoop=!0,this._changeBegan=!1,this._changeCompleted=!0,this.onChange=()=>{if(0===this.data.duration){let e=this.targets.t>=.5?this.to.id:this.from.id;this.object instanceof PU?this.object.changeSelectedState(e,{shared:this.sharedAssets}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.sharedAssets}),this.object.requestRender(),this._changeBegan||(this._changeBegan=!0,this._changeCompleted=!1,this.onChangeBegin()),this._changeCompleted||(this._changeCompleted=!0,this._changeBegan=!1,this.onChangeComplete());return}this.callback&&(this.callback.update(this.targets.t),this.object.requestRender()),0===this.targets.t||1===this.targets.t?this._changeCompleted||(this._changeCompleted=!0,this._changeBegan=!1,this.onChangeComplete()):(this._changeCompleted&&(this._changeCompleted=!1),this._changeBegan||(this._changeBegan=!0,this.onChangeBegin()))},this.onChangeBegin=()=>{this.object.reversibleToState=this.to.id;let e=this.targets.t>.5?this.from.id:this.to.id;this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=e,this.object.dispatchEvent({type:"beginState",state:e}),this.object instanceof PU||this.object.traverseEntity(e=>{e!==this.object&&e instanceof Cn&&e.dispatchEvent(RN)})},this.onChangeComplete=()=>{this.firstLoop&&(this.onFirstLoop(),this.firstLoop=!1),this.object.reversibleToState=this.to.id;let e=this.targets.t<.5?this.from.id:this.to.id;this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=e,this.object.dispatchEvent({type:"completeState",state:e}),this.object instanceof PU||this.object.traverseEntity(e=>{e!==this.object&&e instanceof Cn&&e.dispatchEvent(RU)})},this.onFirstLoop=()=>{this.useCurrentState&&(this.callback=RP(this.object,this.from.data,this.to.data,{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp))},void 0===t){let e=Rj(this.object,this.object.currentState===i?this.object.prevState:this.object.currentState);if(!e)throw Error("Missing property");this.from=e}else{let e=Rj(this.object,t);if(!e)throw Error("Missing property");this.from=e}if(void 0===i)throw Error("Missing property");{let e=Rj(this.object,i);if(!e)throw Error("Missing property");this.to=e}this.useCurrentState=void 0===t||void 0===i,this.params={targets:this.targets,t:1,autoplay:!1,...RF(r),...Rz(r),change:this.onChange},this.callback=RP(this.object,void 0===t?{}:this.from.data,void 0===i?{}:this.to.data,{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)}get changeBegan(){return this._changeBegan}get changeCompleted(){return this._changeCompleted}},RV=class extends tX{constructor(e,t,i,r,a){if(super(),this.eventType=e,this.data=t,this.page=i,this.shared=r,this.condition=a,this.toggleIsForward=!1,this.timelineNeedsRebuild=!1,this.hasPlayedOnce=!1,this.pauseOnNextLoopEnd=!1,this.onTimelineChangeComplete=()=>{if(this.pauseOnNextLoopEnd){this.pauseOnNextLoopEnd=!1,this.timeline?.pause();return}"normal"!==this.data.tweens[0].data.direction&&(this.toggleIsForward=!this.toggleIsForward),!1!==this.timelineNeedsRebuild&&(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!1,isRebuild:!0}),this.timeline.play())},!t.object)throw Error("Missing property");let o=this.page.scene.find(t.object)??this.page.uiCanvas?.find(t.object)??this.page.scene.find2DInUIObjects(t.object);if(!o||!o.states||(this.object=o,t.tweens.length<2))throw Error("Missing property");this.tweens=Array(this.data.tweens.length-1),this.startOnceDelay="start-once"===t.tweens[0].data.delayDirection?t.tweens[0].data.delay:0,this.init()}get playing(){return this.timeline?.paused===!1}
8118get changeBegan(){return this.tweens.some(e=>e.changeBegan)??!1}init(){this.initialCurrentState=Rj(this.object,this.object.currentState).id,this.toggleIsForward=!1}get currentState(){return"Toggle"===this.data.runMode&&mI(this.eventType)?this.initialCurrentState:this.object.currentState}buildTimeline({isForward:e=!0,needsRebuild:t=!1,isRebuild:i=!1}={}){try{let r=RF(this.data.tweens[0].data);i&&"number"==typeof r.loop&&r.loop--,this.timeline?.pause(),this.timeline=Rr.timeline({autoplay:!1,...r,...!0===r.loop||r.loop>1?{timelineChangeComplete:this.onTimelineChangeComplete}:{}});let a=this.tweens.findIndex(e=>e?.changeBegan);if(!0===t&&(this.timelineNeedsRebuild=!0),e){let e=-1===a?0:a;for(let t=e;t<this.data.tweens.length-1;t++){let i=this.data.tweens[t],o=this.data.tweens[t+1],l;t===e&&(!0===this.object.wasMovedByUser||this.object.previousAction?.changeBegan===!0)?(l=void 0,this.object instanceof Cn&&(this.object.wasMovedByUser=!1)):l=void 0===i.data.state?this.currentState:i.data.state;let h=new Rk(this.object,l,void 0===o.data.state?this.currentState:o.data.state,o.data,this.shared,this.data.allowSlerp??!1,this.page);-1!==a&&t===e&&Object.assign(h.params,{startOnceDelay:0}),this.tweens[t]=h,this.timeline.add(h.params,this.timeline.duration+(t===e?r.delay:0))}this.timeline.duration+=r.endDelay}else{let e=-1===a?this.data.tweens.length-1:a+1;for(let t=e;t>0;t--){let i=this.data.tweens[t],o=this.data.tweens[t-1],l;t===e&&(!0===this.object.wasMovedByUser||this.object.previousAction?.changeBegan===!0)?(l=void 0,this.object instanceof Cn&&(this.object.wasMovedByUser=!1)):l=void 0===i.data.state?this.currentState:i.data.state;let h=new Rk(this.object,l,void 0===o.data.state?this.currentState:o.data.state,i.data,this.shared,this.data.allowSlerp??!1,this.page);-1!==a&&t===e&&Object.assign(h.params,{startOnceDelay:0}),this.tweens[t-1]=h,this.timeline.add(h.params,this.timeline.duration+(t===e?r.endDelay:0))}this.timeline.duration+=r.delay}}catch(e){e instanceof Error&&console.error(e.message)}this.object.previousAction?.playing===!0&&this.object.previousAction.pause(),this.object.previousAction=this}play(){if(!1===R5(this.shared,this.condition)||mI(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce||(this.hasPlayedOnce=!0,this.playing))return!1;this.startTimeout?.pause();let e=RF(this.data.tweens[0].data).pingPongDelayCorrection;this.startTimeout=Rr({targets:{},duration:this.startOnceDelay+e,easing:"linear",complete:()=>{this.startTimeout=void 0;try{this.buildTimeline(),this.timeline.play()}catch(e){e instanceof Error&&console.error(e.message)}}})}pause(){this.timeline?.pause(),this.startTimeout?.pause(),this.tweens=Array(this.data.tweens.length-1),delete this.startTimeout}stop(){this.pause();let e=void 0===this.data.tweens[0].data.state?this.initialCurrentState:this.data.tweens[0].data.state;this.object instanceof PU?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(!1===R5(this.shared,this.condition))return!1;void 0===this.timeline&&this.buildTimeline(),this.timeline?.seek(e*this.timeline.duration,!0)}toggle(e){if(!1===R5(this.shared,this.condition))return!1;this.startTimeout?.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.playing?(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!0}),this.pauseOnNextLoopEnd=!0,this.timeline.play()):this.startTimeout=Rr({targets:{},duration:this.startOnceDelay,easing:"linear",complete:()=>{this.startTimeout=void 0,this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward}),this.timeline.play()}})}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function Rj(e,t){let i,r;if("string"==typeof t?(i=t,r=e.states?.[i]):null===t&&(i=null,r=e.data),!(void 0===i||void 0===r))return{id:i,data:r}}var RG={type:"beginState"},RH={type:"completeState",isfromEntity:!1},RW={type:"requestRender"},Rq=class extends tX{constructor(e,t,i,r){super(),this.data=e,this.page=t,this.shared=i,this.condition=r,this.toggleIsForward=!1,this.posStart=new iD,this.posEnd=new iD,this.qStart=new iP,this.qEnd=new iP,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.animation&&this.animation.began&&!this.animation.completed}buildAnimation(e=!1){if(!this.data.animate)return;let t=this.page.scene.find(this.data.targetCamera);if(!t||!t.visible)throw ReferenceError("Target camera not founded or not visible");let i={t:0};this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom,this.animation=Rr({targets:i,t:1,...Rz(this.data),update:()=>{0===i.t&&("Toggle"!==this.data.runMode||this.toggleIsForward?(this.posEnd.copy(t.position),this.qEnd.copy(t.quaternion),this.zoomEnd=t.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(t.uuid)):this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)),this.page.activeCamera.dispatchEvent(RG));let e=this.page.activeCamera;e.position.lerpVectors(this.posStart,this.posEnd,i.t),e.quaternion.slerp
8118Quaternions(this.qStart,this.qEnd,i.t),e.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*i.t,e.wasMovedBySwitchCameraAction=!0,e.updateMatrix(),e.updateMatrixWorld(),e.updateProjectionMatrix(),e.dispatchEvent(RW),1===i.t&&e.dispatchEvent(RH)}})}switchCamera(e){let t=this.page.activeCamera,i=this.page.scene.find(e);if(!i||!i.visible)throw ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),t.dispatchEvent({type:"cameraChange",camera:i})}play(){if(!1===R5(this.shared,this.condition))return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.animation?.play()):this.switchCamera(this.data.targetCamera)},1e3*this.data.delay)}catch{}}pause(){this.animation?.pause(),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(!1===R5(this.shared,this.condition))return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.animation?.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(!0),this.animation?.play()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.animation?.pause(),this.buildAnimation(),this.animation?.play()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(RH),this.page.activeCamera.dispatchEvent(RW))},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}},RX=new Map,RY=new Map,RQ=class extends tX{constructor(e,t,i,r,a,o,l){super(),this.id=e,this.data=t,this.scene=i,this.sharedAssets=r,this.object=a,this.eventType=o,this.actionCondition=l,this.toggleIsForward=!1,this._finished=!1,this.hasPlayedOnce=!1,this._shouldForwardLoop=!1,this._shouldPauseOnNextLoopComplete=!1,this.hiddenMatrixOverrides=[],this._onLoopComplete=()=>{this._shouldPauseOnNextLoopComplete&&(this.timeline.pause(),this._shouldPauseOnNextLoopComplete=!1)};try{let e=RF(this.data);"number"==typeof e.loop&&e.loop--,this.timeline=Rr.timeline({...e,autoplay:!1}),this._shouldForwardLoop=!0===e.loop||"number"==typeof e.loop&&e.loop>1;let t=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.entries(t).forEach(([e,t])=>{var a,o,l,h;let c,d=this.scene.find(e);if(!d)return;let p=d.data.timelineAnimations[t];if(!p)return;let f=d.data.states.data(t);f?.hiddenMatrix&&16===f.hiddenMatrix.length&&!gx.isEqual(f.hiddenMatrix,d.data.hiddenMatrix)&&this.hiddenMatrixOverrides.push({objId:e,original:d.hiddenMatrix.clone(),state:f.hiddenMatrix});let m=(o={...p},a={scene:i,shared:r},l={position(e){Object.assign(d.position,e),(void 0!==e.x||void 0!==e.y||void 0!==e.z)&&(d.updateMatrix(),d.resetBBoxNeedsUpdate(),d instanceof Eh&&d.invalidateDownstreamBooleanData(),d.dispatchEvent({type:"requestRender"}))},rotation(e){let t=Object.keys(e)[0];d.rotation[t]=e[t]*t8.DEG2RAD,(void 0!==e.x||void 0!==e.y||void 0!==e.z)&&(d.updateMatrix(),d.resetBBoxNeedsUpdate(),d instanceof Eh&&d.invalidateDownstreamBooleanData(),d.dispatchEvent({type:"requestRender"}))},scale(e){Object.assign(d.scale,e),(void 0!==e.x||void 0!==e.y||void 0!==e.z)&&(d.updateMatrix(),d.resetBBoxNeedsUpdate(),d instanceof Eh&&d.invalidateDownstreamBooleanData(),d.dispatchEvent({type:"requestRender"}))},shapeSize(e){d instanceof Eh&&(d.userData.value={...d.userData.value,...e},(void 0!==e.x||void 0!==e.y||void 0!==e.z)&&(d.updateGeometryInteractions({width:d.userData.value.x,height:d.userData.value.y,depth:d.userData.value.z},a.shared),d.resetBBoxNeedsUpdate(),d.invalidateDownstreamBooleanData(),d.dispatchEvent({type:"requestRender"})))},material(e,t,i){i&&(Object.entries(i).forEach(([e,{start:i,end:r,t:o}])=>{let l=t.getValue(e);d instanceof _A&&!Array.isArray(d.material)&&"alpha"===e&&"number"==typeof l&&l>
81180&&d.material.setTransparent(!0),void 0!==l&&RE(e,t,i,r,o,l,a.shared)}),d.dispatchEvent({type:"requestRender"}))},opacity(e){if(d instanceof _A&&!Array.isArray(d.material)){let t=d.material.getLayersOfType("light")[0];d.material.setTransparent(!0),RE("alphaOverride",t,{alphaOverride:e},{alphaOverride:e+1},0,e,a.shared),d.dispatchEvent({type:"requestRender"})}},light(e,t){(d instanceof PC||d instanceof D_||d instanceof PO)&&(d[e]=t,d.dispatchEvent({type:"requestRender"}))},cloner(e){e.cloner?.update(a),e instanceof Eh&&e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"})},pathExtrusion(e,t){e.geometry.userData.parameters.extrusion={...e.geometry.userData.parameters.extrusion,...t},e.updateGeometryInteractions({extrusion:{...e.geometry.userData.parameters.extrusion}},a.shared),e.resetBBoxNeedsUpdate(),e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"})},pathSnapping(e){d.userData.pathSnapping={...d.userData.pathSnapping,...e},d.updatePathSnapping(d.userData.pathSnapping),d.dispatchEvent({type:"requestRender"})}},h=this.sharedAssets,c=[],o.properties.forEach(e=>{let t=e.data.path?.[0];if(t&&["position","rotation","scale"].includes(t)){let i=function(e,t=()=>{}){let i=[];for(let r of v9){let a=[...e.keyframes??[]].filter(e=>void 0!==e.data.value[r]).sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&t?.(o.data.value);let l={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};l.t.push({...r,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),l.index.push({...r,value:e,easing:"linear"})}if(a.length>1){let e={t:0,index:0};i.push({targets:e,...l,update:()=>{let i=Math.ceil(e.index),o=i%2==0?e.t:1-e.t,l=a?.[i].data.value,h=a?.[i+1]?.data.value;void 0!==l&&void 0!==h&&t?.({[r]:l[r]+(h[r]-l[r])*o})}})}}return i}(e.data,l?.[t]);i&&c.push(...i)}if(t&&"shape size"===t&&"geometry"in d){let t=function(e,t,i){let r=[];for(let e of v9){let a={},o=[...t.keyframes??[]].filter(t=>void 0!==t.data.value[e]).sort((e,t)=>e.data.time-t.data.time),l=o[0];l&&i?.(l.data.value),a={index:[],t:[]};for(let e=0;e<o.length-1;e++){let t=o[e],i=o[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*o[0].data.time:0};a.t.push({...r,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),a.index.push({...r,value:e,easing:"linear"})}if(o.length>1){let t={t:0,index:0};r.push({targets:t,...a,update:()=>{let r=Math.ceil(t.index),a=r%2==0?t.t:1-t.t,l=o?.[r].data.value,h=o?.[r+1]?.data.value;void 0!==l&&void 0!==h&&i?.({[e]:l[e]+(h[e]-l[e])*a})}})}}return r}(0,e.data,l?.shapeSize);t&&c.push(...t)}if(t&&"path extrusion"===t&&d instanceof DM){let t=function(e,t,i){let r={},a=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&i?.(e,o.data.value),r={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,o={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};r.t.push({...o,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),r.index.push({...o,value:e,easing:"linear"})}if(a.length>1){let t={t:0,index:0};return{targets:t,...r,update:()=>{let r=Math.ceil(t.index),o=r%2==0?t.t:1-t.t,l=a?.[Math.min(r,a.length-1)].data.value,h=a?.[Math.min(r,a.length-1)+1]?.data.value;i?.(e,function(e,t,i,r){let a=e.geometry.userData.parameters.extrusion;if(a)return vn.forEach(e=>{Rv(e,a,t,i,r)}),a}(e,l,h,o))}}}}(d,e.data,l?.pathExtrusion);t&&c.push(t)}if(t&&"path snapping"===t&&d.data.pathSnapping){let t=function(e,t,i){let r={},a=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&i?.(o.data.value),r={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,o={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};r.t.push({...o,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),r.index.push({...o,value:e,easing:"linear"})}if(a.length>1){let t={t:0,index:0};return{targets:t,...r,update:()=>{let r=Math.ceil(t.index),o=r%2==0?t.t:1-t.t,l=a?.[Math.min(r,a.length-1)].data.value,h=a?.[Math.min(r,a.length-1)+1]?.data.value;i?.(function(e,t,i,r){let a=e.updatedPathSnapping;
8118if(a)return vz.forEach(e=>{Rv(e,a,t,i,r)}),a}(e,l,h,o))}}}}(d,e.data,l?.pathSnapping);t&&c.push(t)}if(t&&"material"===t&&"Mesh"===d.type&&"material"in d&&d.material instanceof MT){let t=e.data.id;if(t){let i=d.material.getLayerByUuid(t);if(i){let t=RL(i,e.data,l?.material,h);t&&c.push(t)}else{let t=d.material.getLayersOfType(e.data.type);if(t)for(let i of t){let t=RL(i,e.data,l?.material,h);t&&c.push(t)}}}}if(t&&"opacity"===t&&"Mesh"===d.type&&"material"in d){let t=function(e,t){if(e){let i={},r=[...e.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),a=r[0];a&&t?.(a.data.value),i={index:[],t:[]};for(let e=0;e<r.length-1;e++){let t=r[e],a=r[e+1]??t,o={duration:(a?.data?.time-t.data.time)*1e3,delay:0===e?1e3*r[0].data.time:0};i.t.push({...o,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(a.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),i.index.push({...o,value:e,easing:"linear"})}if(r.length>1){let e={t:0,index:0};return{targets:e,...i,update:()=>{let i=Math.ceil(e.index),a=i%2==0?e.t:1-e.t,o=r?.[Math.min(i,r.length-1)].data.value,l=r?.[Math.min(i,r.length-1)+1]?.data.value;t?.(t8.lerp(o,l,a))}}}}}(e.data,l?.opacity);t&&c.push(t)}if(t&&"cloner"===t){let t=function(e,t,i){let r={},a=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),o=a[0];o&&i?.(e,o.data.value,o.data.value),r={index:[],t:[]};for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1]??t,o={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*a[0].data.time:0};r.t.push({...o,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),r.index.push({...o,value:e,easing:"linear"})}if(a.length>1){let t={t:0,index:0};return{targets:t,...r,update:()=>{let r=Math.ceil(t.index),o=r%2==0?t.t:1-t.t,l=a?.[Math.min(r,a.length-1)].data.value,h=a?.[Math.min(r,a.length-1)+1]?.data.value;i?.(e,l.randomnessObject?void 0:function(e,t,i,r){let a=r.cloner?.parameters;if(a){for(let r of(Rv("count",a,e,t,i),a.count=Math.trunc(a.count),gC))Rv(r,a.radial,e.radial,t.radial,i);for(let r of gT)Rv(r,a.linear,e.linear,t.linear,i);for(let r of gP)Rv(r,a.grid,e.grid,t.grid,i);for(let r of gD)Rv(r,a.toObject,e.toObject,t.toObject,i);return a}}(l,h,o,e),l.randomnessObject?function(e,t,i,r){let a=r.cloner?.parameters;if(a){for(let r of gO)Rv(r,a.randomnessObject,e.randomnessObject,t.randomnessObject,i);return a}}(l,h,o,e):void 0)}}}}(d,e.data,l?.cloner);t&&c.push(t)}if(t&&"camera"===t&&d instanceof Cn){let t=function(e,t,i,r){if(t){let a={[r]:[]},o=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),l=o[0];l&&(e[r]=l.data.value,i?.(r,l.data.value));for(let e=0;e<o.length-1;e++){let t=o[e];if(!Number.isFinite(t.data.value))continue;let i=o[e+1]??t;a[r].push({value:i.data.value,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters),duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*o[0].data.time:0})}if(o.length>1)return{targets:e,...a,update:()=>{i?.(r,e[r])}}}}(d,e.data,l?.camera,"zoom");t&&c.push(t)}if(t&&"light"===t&&(d instanceof PC||d instanceof D_||d instanceof PO)){let t=function(e,t,i,r,a){if(t){let o={},l=[...t.keyframes??[]].sort((e,t)=>e.data.time-t.data.time),h=l[0];if(h){let t=h.data.value;e[r]=t,i?.(r,t)}o={index:[],t:[]};for(let e=0;e<l.length-1;e++){let t=l[e],i=l[e+1]??t,r={duration:(i?.data?.time-t.data.time)*1e3,delay:0===e?1e3*l[0].data.time:0};o.t.push({...r,value:e%2==0?1:0,easing:v6(t.data.easing.type,{control1:v5(t.data.easing.cubicControls?.control1,[0,0]),control2:v5(i.data.easing.cubicControls?.control2,[1,1])},t.data.easing.springParameters)}),o.index.push({...r,value:e,easing:"linear"})}if(l.length>1){let e={t:0,index:0};return{targets:e,...o,update:()=>{let t=Math.ceil(e.index),o=t%2==0?e.t:1-e.t,h=l?.[Math.min(t,l.length-1)].data.value,c=l?.[Math.min(t,l.length-1)+1]?.data.value;i?.(r,RB(h,c,o,a))}}}}}(d,e.data,l?.light,e.data.path[1],h);t&&c.push(t)}}),c),g=("start"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?this.data.delay:0)+("start-once"===this.data.delayDirection?this.data.delay:0);
8118m.forEach(e=>{this.timeline.add(e,g)}),this.timeline.duration=1e3*p.to+g}),this.timeline.delay=0,this.timeline.duration+=("start"===this.data.delayDirection?this.data.delay:0)+("end"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?2*this.data.delay:0)+("start-once"===this.data.delayDirection?2*this.data.delay:0),this.timeline.finished.then(()=>{Object.keys(t).forEach(e=>{let t=this.scene.find(e);t instanceof Cn&&t.dispatchEvent(RU)}),this._finished=!0}),this.timeline.loopComplete=this._onLoopComplete}catch(e){throw Error("Missing property")}a&&(RY.has(a.uuid)?RY.get(a.uuid).push(this):RY.set(a.uuid,[this])),RX.set(e,this)}get playing(){return!1===this.timeline.paused}get finished(){return this._finished}get paused(){return this.timeline.paused}applyStateHiddenMatrices(){for(let{objId:e,state:t}of this.hiddenMatrixOverrides){let i=this.scene.find(e);i&&i.hiddenMatrix.fromArray(t)}}restoreOriginalHiddenMatrices(){for(let{objId:e,original:t}of this.hiddenMatrixOverrides){let i=this.scene.find(e);i&&i.hiddenMatrix.copy(t)}}supportsRunMode(){return void 0!==this.eventType&&(mI(this.eventType)||"VariableChange"===this.eventType)}play(){let e=this.supportsRunMode()&&"Once"===this.data.runMode&&this.hasPlayedOnce&&this.paused&&this.timeline.currentTime>0&&!this._finished;if(this.supportsRunMode()&&"Once"===this.data.runMode&&this.hasPlayedOnce&&!e||void 0===this.eventType&&this._finished)return!1;this.hasPlayedOnce=!0,this.applyStateHiddenMatrices(),Object.keys(this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping).forEach(e=>{let t=this.scene.find(e);t instanceof Cn&&t.dispatchEvent(RN)}),this.paused&&this.timeline.progress>0&&this.timeline.progress<100?this.timeline.play():this.timeline.restart()}pauseTimeline(){this.paused||this.timeline.pause()}pause(){this.pauseTimeline()}stop(){this.pauseTimeline(),this.seek(0),this.timeline.reset(),this.restoreOriginalHiddenMatrices(),this._finished=!1}seek(e){this.timeline.seek(e*this.timeline.duration,!0)}toggle(e){let t=this.paused&&this.timeline.currentTime>0&&this.timeline.currentTime<this.timeline.duration;if(void 0!==e?this.toggleIsForward=e:t||(this.toggleIsForward=!this.toggleIsForward),this.playing){if(!this.toggleIsForward&&this.timeline.reversed&&this._shouldForwardLoop&&this.timeline.remaining%2==1){this._shouldPauseOnNextLoopComplete=!0;return}this.timeline.reverse(this.timeline.duration-this.timeline.currentTime),this._shouldForwardLoop&&this.timeline.loop&&this.timeline.reversed&&(this._shouldPauseOnNextLoopComplete=!0)}else this.applyStateHiddenMatrices(),(!this.toggleIsForward!==this.timeline.reversed||!this.toggleIsForward&&this.timeline.reversed&&"alternate"===this.timeline.direction)&&this.timeline.reverse(),"number"==typeof this.timeline.loop&&"number"==typeof this.timeline.remaining&&this.timeline.remaining<this.timeline.loop&&this.toggleIsForward&&(this.timeline.remaining=this.timeline.loop),this.timeline.play()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pauseTimeline(),this.restoreOriginalHiddenMatrices()}},RZ=class{constructor(e){this.data=e}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(e){let t=this.getTimelineActions(e);t.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>{e[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):t.forEach(e=>{e[this.data.interaction]()}))}getTimelineActions(e){let t=RX.get(e);return t?[t]:[...RX.values()].filter(t=>t.data.timeline===e)}pauseAllTimelinesFromObject(e){let t=RY.get(e);t?.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>e[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(e=>e[this.data.interaction]()))}pauseAllTimelines(){let e=[...RY.values()];e.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(e=>
8118{e.forEach(e=>{e[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(e=>{e.forEach(e=>{e[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},RK=class{constructor(e,t,i,r,a,o,l){this.data=t;let h="interaction"in t?t.interaction:"play";if("play"===h||void 0===h)this.interaction=new RQ(e,t,i,r,a,o,l);else if("pause"===h||"stop"===h)this.interaction=new RZ(t);else throw Error("Missing property")}get playing(){return this.interaction instanceof RQ&&this.interaction.playing}get finished(){return!(this.interaction instanceof RQ)||this.interaction.finished}get paused(){return!(this.interaction instanceof RQ)||this.interaction.paused}play(){if(this.interaction instanceof RQ)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof RQ&&this.interaction.stop()}seek(e){this.interaction instanceof RQ&&this.interaction.seek(e)}toggle(e){this.interaction instanceof RQ?this.interaction.toggle(e):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof RQ?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof RQ?!1!==R5(this.interaction.sharedAssets,this.interaction.actionCondition)&&("runMode"in this.data&&"Toggle"===this.data.runMode?this.interaction.toggle():this.interaction.play()):this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof RQ&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};function RJ(e){let t=e?.tracks.filter(e=>"vector"===e.ValueTypeName||"quaternion"===e.ValueTypeName).map(e=>e.times.length);if(t?.length){let e=t&&t.length?pt(t,cs,u7):void 0;return e&&e>2?e:2}return 2}var R$=class extends tX{constructor(e,t,i,r,a){super(),this.data=e,this.page=t,this.animationControls=i,this.shared=r,this.condition=a,this.startOnceDelay=0,this.toggleIsForward=!1;let o=e.object,l=t.scene.find(e.object);l&&Array.isArray(l.identity)&&(o=l.identity[0]),this.data={...e,object:o};let h=this.animationControls.clipIdToAction[e.clipId+"/"+o];if(this.duration=h?.getClip()?.duration??1,this.data.crop2){let e=RJ(h?.getClip());this.leftFrameTime=this.data.crop2[0]/(e-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(e-1)*this.duration}else{let e=h?.getClip()?.tracks[0]?.times.length;e&&e>1?(this.leftFrameTime=this.data.crop[0]/e*this.duration,this.rightFrameTime=this.data.crop[1]/e*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay}get playing(){return this.threeAnimAction?.isRunning()??!1}play(e=!1){if(!1===R5(this.shared,this.condition))return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let t=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([i,r])=>{let a=i.split("/")[1];this.threeAnimAction!==r&&a===t&&(e?r.fadeOut(.2):r.stop())}),e&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),window.clearTimeout(this.timeoutId),delete this.timeoutId}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=t8.clamp(this.threeAnimAction.time+1/60*e,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(e,t=!1){if(!1===R5(this.shared,this.condition))return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let e=this.data.clipId.split("/")[1];
vendor: 4,213 bytes, line 8118
8118Object.entries(this.animationControls.clipIdToAction).forEach(([i,r])=>{let a=i.split("/")[1];this.threeAnimAction!==r&&a===e&&r.isRunning()&&(t?r.fadeOut(.2):r.stop())}),t&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause()}},R0=class{constructor(e,t,i,r,a){this.data=e,this.page=t,this.eventManager=i,this.shared=r,this.condition=a,this.timeOutId=-1,this.scene=t.scene}dispatch(){if(!1===R5(this.shared,this.condition))return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},1e3*this.data.delay))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(e=>e.uuid!==this.data.target||e.data.uiScene))return;"fade"===this.data.transition&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,1e3*this.data.duration),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let e=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.sleep(),e.wakeUp(),e.data.autoPlay?e.start():e.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(e),RO(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}},R1=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.evaluatedCondition=!1}checkConditions(){this.evaluatedCondition=R5(this.shared,this.condition)}dispatch(){if(!1===this.evaluatedCondition)return!1;let e=this.shared.getVariable(this.data.variableId),t=Sz(this.data.expression,this.shared,xn.typeOfVariable(e));void 0!==t&&this.shared.updateVariable(this.data.variableId,"string"==typeof t?{textValue:t}:t)}dispose(){}},R2=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.timeoutId=null}dispatchInner(){if(!1===R5(this.shared,this.condition))return!1;let e=this.shared.getDynamicVariablePlayState(this.data.variableId);if("PlayPause"===this.data.mode)void 0===this.shared.getDynamicVariableToggleIsForward(this.data.variableId)&&this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!0),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing"===e?"Paused":"Playing");else if("Play"===this.data.mode&&"Playing"!==e)void 0===this.shared.getDynamicVariableToggleIsForward(this.data.variableId)&&this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!0),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing");else if("Stop"===this.data.mode&&"Stopped"!==e)this.shared.setDynamicVariablePlayState(this.data.variableId,"Stopped");else if("Pause"===this.data.mode&&"Paused"!==e)this.shared.setDynamicVariablePlayState(this.data.variableId,"Paused");else if("Restart"===this.data.mode)this.shared.setDynamicVariablePlayState(this.data.variableId,"Restarted");else if("Toggle"===this.data.mode){let t=this.shared.getDynamicVariableToggleIsForward(this.data.variableId);"Playing"===e?this.shared.setDynamicVariableToggleIsForward(this.data.variableId,void 0!==t&&!t):(this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!t),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing"))}}dispatch(){let e=this.data.delay,t=this.shared.getDynamicVariablePlayState(this.data.variableId);"PlayPause"===this.data.mode&&"Playing"===t&&(e=this.data.pauseDelay),0!==e?(this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.dispatchInner()},e)):this.dispatchInner()}dispose(){this.timeoutId&&window.clearTimeout(this.timeoutId)}},R3=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(!1===R5(this.shared,this.condition))return!1;("single"===this.data.target?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEac
8118h(e=>{this.shared.getVariable(e);let t=this.shared.data.variables.data(e)?.value;void 0!==t&&this.shared.updateVariable(e,t),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(Ee(e))})}dispose(){}},R4=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(!1===R5(this.shared,this.condition))return!1;if(this.data.userAPIId){let e=this.shared.getUserAPI(this.data.userAPIId);e&&"callUserAPI"in e&&e.callUserAPI(this.shared)}}dispose(){}};function R5(e,t){if(void 0===t)return!0;if(0===t.expression.length)return!1;let i=Sz(t.expression,e,"boolean");return t.negate?!i:!!i}function R6(e,t,i,r,a,o){let l={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],TimelineAnimation:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},h=t=>({id:c,data:d})=>{try{"Audio"===d.type?mF[e.type].includes("Audio")&&l.Audio.push(new Il(c,d,o,r,t)):"Video"!==d.type||o instanceof PU?"Particles"===d.type?mF[e.type].includes("Particles")&&l.Particles.push(new Ih(d,i,r,t)):"Link"===d.type?mF[e.type].includes("Link")&&l.Link.push(new Iu(d,a.controlsManager,r,t)):"Create"===d.type?mF[e.type].includes("Create")&&l.Create.push(new Ll(d,i,a.controlsManager,r,t)):"Destroy"===d.type?mF[e.type].includes("Destroy")&&l.Destroy.push(new Ip(d,i,a.controlsManager,r,t)):"Reset"===d.type?mF[e.type].includes("Reset")&&l.Reset.push(new If(d,i,r,a,t)):"Transition"===d.type?mF[e.type].includes("Transition")&&l.Transition.push(new RV(e.type,d,i,r,t)):"SwitchCamera"===d.type?mF[e.type].includes("SwitchCamera")&&l.SwitchCamera.push(new Rq(d,i,r,t)):"SceneTransition"===d.type?mF[e.type].includes("SceneTransition")&&l.SceneTransition.push(new R0(d,i,a,r,t)):"Animation"===d.type?mF[e.type].includes("Animation")&&l.Animation.push(new R$(d,i,a.animationControls,r,t)):"SetVariable"===d.type?mF[e.type].includes("SetVariable")&&l.SetVariable.push(new R1(d,i,r,t)):"DynamicVariablePlay"===d.type?mF[e.type].includes("DynamicVariablePlay")&&l.DynamicVariablePlay.push(new R2(d,i,r,t)):"Conditional"===d.type?mF[e.type].includes("Conditional")&&(d.ifActions.forEach(h({expression:d.condition,negate:!1})),d.elseActions.forEach(h({expression:d.condition,negate:!0}))):"ClearLocalStorage"===d.type?mF[e.type].includes("ClearLocalStorage")&&l.ClearLocalStorage.push(new R3(d,i,r,t)):"UserAPI"===d.type?mF[e.type].includes("UserAPI")&&l.UserAPI.push(new R4(d,i,r,t)):"TimelineAnimation"===d.type&&mF[e.type].includes("TimelineAnimation")&&l.TimelineAnimation.push(new RK(c,d,i.scene,r,o,e.type,t)):mF[e.type].includes("Video")&&l.Video.push(new Li(c,d,o,r,t))}catch(e){}};return t.forEach(h()),l}function R8(e){Object.values(e).forEach(e=>{e.forEach(e=>{(e instanceof Il||e instanceof Li||e instanceof RV||e instanceof RK||e instanceof Ih||e instanceof R$||e instanceof RV||e instanceof Ll||e instanceof Ip||e instanceof Rq||e instanceof R0||e instanceof If||e instanceof R1||e instanceof R2)&&e.dispose()})})}var R9=new Map,R7=new Map,Le=class{constructor(e,t,i){this.data=t,this.delay=0,this.status="stopped";let{layerId:r,loop:a,volume:o,delay:l}=t;if(this.object=i,void 0===r)throw Error("Missing property");let h=function(e,t){let i;if("material"in e&&(i=Array.isArray(e.material)?e.material[0].layers.find(e=>e.uuid===t):e.material.layers.find(e=>e.uuid===t)),i)return i.color.texture.image.img instanceof HTMLVideoElement?i.color.texture.image.img:void 0}(i,r);h&&(this.videoElement=h,this.videoElement.loop=a===1/0,pp&&(this.videoElement.autoplay=!0),void 0!==o&&(this.videoElement.volume=o)),void 0!==l&&(this.delay=l),R7.has(i.uuid)?R7.get(i.uuid).push(this):R7.set(i.uuid,[this]),R9.set(e,this),this.pause()}mute(){this.videoElement&&(this.videoElement.muted=!0)}unMute(){this.videoElement&&(this.videoElement.muted=!1)}play(e){if(!this.videoElement)return;let t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);e?(this.mute(),this.delay+=150):t?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let e=this.videoElement.play();void 0!==e&&e.then(e=>{}).catch(e=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){this.videoElement&&(this.videoElement.pause(),this.status="paused")}stop(){this.videoElement&&(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(e){return new Promise(t=>{if(!this.videoElement)return t();let i=this.videoElement.duration;i>0&&(this.videoElement.currentTime=e%i),this.videoElement.addEventListener("seeked",()=>t(),{once:!0})})}
vendor: 6,040 bytes, line 8118
8118playByToggle(){"stop"===this.data.toggle?"playing"===this.status?this.stop():(this.stop(),this.play()):"pause"===this.data.toggle?"playing"===this.status?this.pause():this.play():(this.stop(),this.play())}dispose(){this.videoElement&&(this.stop(),this.videoElement.muted=!0)}},Lt=class{constructor(e){this.data=e}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(e){let t=R9.get(e);t&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t[this.data.interaction](),this.disposeDelay()},this.data.delay)):t[this.data.interaction]())}pauseAllVideosFromObject(e){let t=R7.get(e);t?.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(e=>e[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(e=>e[this.data.interaction]()))}pauseAllVideos(){let e=[...R7.values()];e.length&&(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(e=>{e.forEach(e=>{e[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(e=>{e.forEach(e=>{e[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},Li=class{constructor(e,t,i,r,a){if(this.data=t,this.shared=r,this.condition=a,"play"===t.interaction)this.interaction=new Le(e,t,i);else if("pause"===t.interaction||"stop"===t.interaction)this.interaction=new Lt(t);else throw Error("Missing property")}dispatchBasic(){if(!1===R5(this.shared,this.condition))return!1;this.interaction instanceof Le?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===R5(this.shared,this.condition))return!1;this.interaction instanceof Le?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}},Lr=(()=>{let e,t,i,r,a=!1;function o(i){!e&&!Ls()&&(t?.sharedGameControlGlobals.createdObjects.length??0)>0&&(e=requestAnimationFrame(l)),i&&(t=i,r=i.requestRender,!a&&"u">typeof document&&(document.addEventListener("visibilitychange",h),a=!0))}function l(a){if(!t||!r){e=void 0,i=void 0;return}let o=i?a-i:0,h=t.sharedGameControlGlobals.createdObjects,c=t.sharedGameControlGlobals.nCreatedPerAction,d=h.length,p=0;for(;p<d;){let e=h[p];void 0===e.userData.createdTime&&(e.userData.createdTime=a),void 0===e.userData.lifetime&&void 0===e.userData.quantity||e.userData.lifetime&&a-e.userData.createdTime<e.userData.lifetime||e.userData.quantity&&c[e.userData.actionId]<=e.userData.quantity?(e.userData.velocity&&(e.position.addScaledVector(e.userData.velocity,o/1e3),e.updateMatrix(),r()),p++):(c[e.userData.actionId]>e.userData.quantity&&c[e.userData.actionId]--,h.splice(p,1),e.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&e.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(e.rigidBody)):(e.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(e=>void 0!==e.bvhGeometry)),d--,r())}e=p>0?requestAnimationFrame(l):void 0,i=p>0?a:void 0}function h(){Ls()?e&&(cancelAnimationFrame(e),e=void 0,i=void 0):o()}return{play:o,dispose:function(){e&&(cancelAnimationFrame(e),e=void 0),a&&"u">typeof document&&(document.removeEventListener("visibilitychange",h),a=!1),t=void 0,r=void 0,i=void 0}}})();function Ls(){return!!document&&document.hidden}var La=new iP,Ln=new iD,Lo=new iD,Ll=class{constructor(e,t,i,r,a){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=a,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=t8.generateUUID(),this.dispatch=()=>{if(!1===R5(this.shared,this.condition))return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()},this.dispatchFromStart=()=>{if(!1===R5(this.shared,this.condition))return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=pl(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{null===this.intervalId&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{null!==this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let e=new bu(this.object);if(e.playModeVisible=!0,e.expand(),"world"!==this.data.coordinateSystem){let t=this.data.coordinateSystem,i=this.page.scene.find(t);i&&(i.updateMatrixWorldSVD(),e.hiddenMatrix.copy(i.matrixWorldRigid))}e.scale.copy(this.object.scale),e.position.fromArray(this.data.position.map(e=>"number"==typeof e?e:0)),e.rotation.fromArray(this.data.rotation.map(e=>"number"==typeof e?e:0)),e.updateMatrix(),this.page.add(e);let t=this.controlsManager.sharedGameControlGlobals;t.createdObjects.push(e),void 0===t.nCreatedPerAction[this.uniqueId]?t.nCreatedPerAction[this.uniqueId]=1:t.nCreatedPerAction[this.uniqueId]++,e.updateWorldMatrix(!0,!0),e.traverseObject(this.traverseObjectCB),Lr.play(),this.controlsManager.requestRender()},this.traverseObjectCB=e=>{let t;if(e.hasNonUniformScale&&e.updateMatrixWorldSVD(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(e instanceof EJ){if(!e.objectForSample)return!0===e.object.dataPatched.physics.fusedBody&&"dynamic"===e.object.dataPatched.physics.rigidBody||void 0;if(e.objectForSample.dataPatched.physics.fusedBody)return;t=e.object}else if(e instanceof bu)t=e.object;else if(t=e,t.dataPatched.cloner?.hideBase)return!0}else{if(e instanceof EJ)return;t=e instanceof bu?e.object:e}"Time"===this.data.destroy?e.userData.lifetime=1e3*this.data.lifetime:"Quantity"===this.data.destroy&&(e.userData.quantity=this.data.destroyAfterQuantity,e.userData.actionId=this.uniqueId);let i=new iD().fromArray(this.data.velocity.map(e=>"number"==typeof e?e:0)),r=t.dataPatched;
8118if(!("visibility"===r.physics.enabled?!r.visible:!r.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(e,t,{fromCreate:!0,dynamic:this.data.dynamic}),"Collision"===this.data.destroy&&(e.rigidBody?.collider(0).setActiveEvents(1),e.userData.hasCollisionDestroy=!0),e.matrixWorld.decompose(Ln,La,Lo),i.applyQuaternion(La),this.data.velocity.some(e=>0!==e)&&this.data.dynamic&&e.rigidBody?.setLinvel(i.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in e.object&&this.controlsManager.addBoundsTree(e),this.data.velocity.some(e=>0!==e)&&this.data.dynamic&&(e.userData.velocity=i)),t.dataPatched.physics?.fusedBody===!0))return!0};let o=this.page.scene.find(this.data.object);if(!o||(this.object=o,"world"!==this.data.coordinateSystem&&!this.page.scene.find(this.data.coordinateSystem)))throw Error("Missing Property");Lr.play(i)}dispose(){null!==this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(e=>window.clearTimeout(e)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],Lr.dispose()}},Lh=new iD,Lc=new iD,Ld=new iD,Lu=new iD,Lp=new iD,Lf=new iD,Lm=new i6,Lg=new i6,Lv=new i6,Ly=new iP,Lx=new iP,Lb=new rn(0,0,0,"YXZ"),Lw=new iD(1,0,0),LS=new iD(0,1,0),L_=new iD(0,0,1),LA=new iD(1,1,1),LM=new lJ,LE=new iR,LC={type:"requestRender"},LT={type:"updateMatrix"},LP=Math.PI/6,LD=class extends tX{constructor(e,t,i,r,a,o,l,h,c){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=a,this.cameraFollow=o,this.camera=l,this.page=h,this.sharedAssets=c,this.enableDamping=!0,this.hiddenMatrix0=new i6,this.target0=new iD,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new rn(0,0,0,"YXZ"),this.position0Cam=new iD,this.quat0Cam=new iP,this.scale0Cam=new iD,this.hiddenMatrix0Cam=new i6,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new lJ(new iD(0,-40,0),new iD(0,40,0)),matrix:new i6,position:new iD,rotation:new iP},this.euler=new rn(0,0,0,"YXZ"),this.eulerDelta=new iD,this.lastPosition=new iD,this.lastCameraQuaternion=new iP,this.lastCameraPosition=new iD,this.PI_2=Math.PI/2,this.prevMouse=new t9,this.velocityTarget=new iD,this.velocity=new iD,this.directionXZ=new iD,this.rotVelocityStick=new iD,this.rotVelocityTarget=new iD,this.rotVelocity=new iD,this.rotDirection=new iD,this.nonColliderRotOffset=new i6,this.nonColliderPosOffset=new i6,this.firstPointerId=-1,this.rot=new iD,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.vrEulerYOffset=0,this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new i6,this.objectToTarget=new iD,this.objectToTarget0=new iD,this.objectToCamXZ=new iD,this.objectToCamXZ0=new iD,this.targetToCamera=new iD,this.targetToCamera0=new iD,this.cameraPolarAxis0=new iD,this.targetPos=new iD,this.targetQuat=new iP,this.lerpFactorPos=new iD().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new iP,this.objXZQuatInv=new iP,this.objXZRotMat=new i6,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new iD,this.pushedVelocity=new iD,this.groundYRotation=0,this.objectRealQuat=new iP,this.colliderWorldQuat=new iP,this.groundNormal=new iD,this.groundTilt=new iP,this.groundTiltInv=new iP,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new iD,this.quaternion=new iP,this.scale=new iD,this.initialAction=!0,this.onPointerDown=e=>{(e.target===this.domElement||e.target instanceof HTMLElement&&"SPLINE-VIEWER"===e.target.tagName&&e.target.shadowRoot?.contains(this.domElement))&&-1===this.firstPointerId&&(this.firstPointerId=e.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),"keys"===this.rotBy||pm||pg||this.domElement.requestPointerLock(),this.prevMouse.set(e.clientX,e.clientY))},this.onPointerUp=e=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),"mouse"===e.pointerType&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=e=>{if(e.pointerId!==this.firstPointerId)return;let t=e.clientX-this.prevMouse.x,i=e.clientY-this.prevMouse.y;this.prevMouse.set(e.clientX,e.clientY),"mouse"===e.pointerType&&"keys"!==this.rotBy&&(pg&&pv<15.5&&!pm?(this.eulerDelta.y=-t*this.mouseOrbitSensitivity,this.eulerDelta.x=-i*this.mouseOrbitSensitivity):(this.eulerDelta.y=-e.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-e.movementY*this.mouseOrbitSensitivity)),"mouse"!==e.pointerType&&"drag"===this.rotByTouch&&(this.eulerDelta.y=-t*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-i*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=e=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?LD.isLocked=!0:LD.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let e in this.movementState)this.movementState[e]=0},this.onKeyDown=e=>{for(let t of(e.target instanceof HTMLInputElement||"ArrowLeft"!==e.code&&"ArrowUp"!==e.code&&"ArrowRight"!==e.code&&"ArrowDown"!==e.code&&"Space"!==e.code||e.preventDefault(),this.keyAssignments))if(e.key.toUpperCase()===t[1]||e.key===t[1]){this.movementState[t[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=e=>{for(let t of this.keyAssignments)if(e.key.toUpperCase()===t[1]||e.key===t[1]||e.code.slice(3,e.code.length).toUpperCase()===t[1]){this.movementState[t[0]]=0;break}},this.copyVRGamePadValues=(e,t)=>{for(let i=2;i<4;i++){let r=e.axes[i];0===t?2===i?this.movementState.movePosX=r:this.movementState.movePosZ=r:(e.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,2===i?(.3>Math.abs(this.movementState.rotPosY)&&Math.abs(r)>=.3&&(this.vrEulerYOffset+=r<0?1:-1),this.movementState.rotPosY=r):"fly"===this.moveMode&&(this.movementState.moveNegY=r))}},this.sharedGameControlGlobals=a.sharedGameControlGlobals,e===l&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let d=this.euler0.clone(),p=d.y;if(this.objectRealQuat.copy(this.quaternion),d.y=0,this.quaternion.setFromEuler(d),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZ
8118RotMat.makeRotationFromQuaternion(this.quaternion),d.set(0,p,0),this.quaternion.setFromEuler(d),this.rot.setFromEuler(d),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||!0===this.cameraFollow)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),!0===this.cameraFollow){let e,t;this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let i=new iD(0,0,-1).applyQuaternion(this.camera.quaternion),r=new iD().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(r),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),1e-6>Math.abs(i.y)?(r.y=0,i.y=0,t=r.projectOnVector(i)):t=r.y/i.y>0?i.multiplyScalar(r.y/i.y):i.multiplyScalar(r.length()),this.targetToCamera0.copy(t).negate(),e=this.camera.position.clone().add(t),this.objectToTarget0.subVectors(e,this.position);let a=new rn().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-a.x,a.x=0,a.z=0,a.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(a)}if(this.object instanceof Cn&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=(i.speedTranslate??250)*1,this.speedOrbit=(i.speedRotate??100)*.025,this.mouseOrbitSensitivity=(i.speedRotate??100)*16e-6,this.keyAssignments=i.keyAssignments.map(e=>{let t=[e[0],e[1]];return"▲"===t[1]?t[1]="ArrowUp":"◀"===t[1]?t[1]="ArrowLeft":"▼"===t[1]?t[1]="ArrowDown":"▶"===t[1]?t[1]="ArrowRight":"⇧"===t[1]?t[1]="Shift":"↵"===t[1]?t[1]="Enter":"Space"===t[1]?t[1]=" ":"⌘"===t[1]?t[1]="Meta":"Ctrl"===t[1]?t[1]="Control":"Esc"===t[1]&&(t[1]="Escape"),t}),"mouse"===i.rotBy){let e;-1!==(e=this.keyAssignments.findIndex(e=>"rotNegX"===e[0]))&&(this.keyAssignments[e][1]=""),-1!==(e=this.keyAssignments.findIndex(e=>"rotPosX"===e[0]))&&(this.keyAssignments[e][1]=""),-1!==(e=this.keyAssignments.findIndex(e=>"rotPosY"===e[0]))&&(this.keyAssignments[e][1]=""),-1!==(e=this.keyAssignments.findIndex(e=>"rotNegY"===e[0]))&&(this.keyAssignments[e][1]="")}this.lerpFactorPosStart=1-.02**(1/((i.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((i.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((i.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((i.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((i.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((i.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??vP.defaultData.gravity)*12,this.usePhysics=this.gloabalPhysics.usePhysics??vP.defaultData.usePhysics,this.jumpPower=20*i.jumpPower,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??xp.defaultDataThirdPerson.orientWith,this.slopeThresh=65*Math.PI/180,"capsule"===i.collider.type?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=.02*i.collider.height/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height):"sphere"===i.collider.type?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*.02/this.pixelsPerMeter,this.stepThresh=2*i.collider.radiu
vendor: 4,677 bytes, line 8118
8118s*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=.02*i.collider.height/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let f=new iD().fromArray(i.collider.position.map(e=>"number"==typeof e?e:0)),m=new iP().setFromEuler(new rn().fromArray([...i.collider.rotation.map(e=>"number"==typeof e?e:0),"XYZ"]));this.collider.position.copy(f).multiply(this.scale),this.collider.rotation.copy(m),this.collider.matrix.compose(f,m,LA),void 0!==i.cameraXAxis&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let g=2*i.navmesh.destinationHelperRadius;if(g>0){let e=new pX;e.push({fi:0,data:{...g3.defaultData("light","phong"),alpha:0},id:"layer1"}),e.push({fi:0,data:{...g3.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let t=new MD({layers:e},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new r7(bB.create({parameters:{width:g,height:g/10,hollow:.7}}),t),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let e=new rn().setFromQuaternion(this.quaternion,"YXZ"),t=e.y;this.objectRealQuat.copy(this.quaternion),e.y=0,this.quaternion.setFromEuler(e),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),e.set(0,t,0),this.quaternion.setFromEuler(e),this.rot.setFromEuler(e),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof Cn?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();!0===this.cameraFollow&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,t=this.sharedAssets;void 0!==e.gameActions&&(this.actions={},xu.list.forEach(i=>{this.actions[i]=R6({...e,disabled:!1,type:"GameControl"},e.gameActions[i],this.page,t,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),R8(this.actions.idle),R8(this.actions.move),R8(this.actions.run),R8(this.actions.jump)}dispatchStartEvent(e){void 0!==this.actions[e]&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(e
8118=>{e.play()}),this.actions[e].Animation.forEach(e=>{e.play(!1===this.initialAction)}),this.actions[e].TimelineAnimation.forEach(e=>{e.play()}),this.actions[e].Create.forEach(e=>{e.dispatchStart()}),this.actions[e].Audio.forEach(e=>{e.dispatchGameControl("start")}),this.actions[e].Particles.forEach(e=>{e.dispatchGameControl("start")})))}dispatchStopEvent(e){void 0===this.actions[e]||this.actionState[e]&&(this.actionState[e]=!1,this.actions[e].Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(e=>{e.stop()}),this.actions[e].Create.forEach(e=>{e.dispatchStop()}),this.actions[e].Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(e=>{e.dispatchGameControl("stop")}))}get colliderWorldPosition(){return Lu.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e,t,i){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let r=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let a=60*r,o=!1;if(this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let e=Lp.set(0,(0===this.velocity.y?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*r,0).divideScalar(this.pixelsPerMeter),t=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,e,this.object.rigidBody?.collider(0).shape,1,!1,16,void 0,void 0,this.object.rigidBody);if(t){this.onObject=!0,this.groundNormal.set(t.normal2.x,t.normal2.y,t.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(o=!0),t.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let e=t.collider.parent();for(let t of(this.groundYRotation=0,this.groundVelocity.set(0,0,0),this.sharedGameControlGlobals.entitiesWithTransformAnim))if(t.rigidBody===e&&t.userData.isFollowingObj!==this.object.uuid){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Lu,Lx,Lp),this.groundVelocity.subVectors(Lu,t.prevT),this.object.getWorldPosition(Lp).add(this.collider.position).sub(Lu),this.groundYRotation=Lb.setFromQuaternion(Lx).y-t.prevR.y,Lf.copy(Lp).applyAxisAngle(LS,this.groundYRotation),this.groundVelocity.add(Lf.sub(Lp)).divideScalar(r);break}}else this.onObject=!1}if("walk"===this.moveMode&&this.collisionEnabled&&(1===this.movementState.jump&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*a),"fly"===this.moveMode&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,"+z"===this.forwardDir&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let e=this.navMeshPathDest.material;if("walk"===this.moveMode&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let t=Lu.subVectors(this.path[1],this.position),i=Lp.subVectors(this.path[1],this.path[0]);0>t.dot(i)?this.path.shift():(this.directionXZ.x=i.x,this.directionXZ.z=i.z),e.opacity=e.userData.opacity0}else e.opacity-=.05*e.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,("walk"===this.moveMode?this.velocityTarget.x+this.velocityTarget.z===0:0===this.velocityTarget.manhattanLength())?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),"walk"===this.moveMode&&(this.lerpFactorPos.y=1),!1===this.didHit&&0===this.pushedVelocity.manhattanLength()||!1===this.usePhysics?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**a),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**a),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**a)):this.velocity.copy(this.velocityTarget),("walk"===this.moveMode?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||"fly"===this.moveMode)&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let l=Ld.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let e=Lp.copy(l);e.y=0,l.set(0,l.y,e.length()*("+z"===this.forwardDir?1:-1))}if(this.directionXZ.manhattanLength()>0&&"none"!==this.orientMode&&!1===this.isFirstPerson){if("camera"===this.orientWith&&this.path.length<=1){this.camera.getWorldDirection(Lu);let e=Lf.copy(LS).multiplyScalar(Lu.dot(LS));Lu.sub(e);let t=Lp.copy(this.directionXZ);t.x*=-1,this.rot.y=Lu.angleTo(t)*(Lu.cross(t).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*("+z"===this.forwardDir?1:-1)}if(Lb.setFromVector3(this.rot),"walk"===this.moveMode&&(Lb.x=0),l.applyEuler(Lb),o&&(Lx.setFromUnitVectors(LS,this.groundNormal),l.applyQuaternion(Lx)),i){let e=Lb.set(0,this.vrEulerYOffset*LP,0);i.applyEuler(e),l.x+=i.x,l.z+=i.z,this.nonColliderPosOffset.elements[13]+=i.y*r}if(!0===this.usePhysics&&this.object.rigidBody){for(let e of(this.pushedVelocity.set(0,0,0),this.sharedGameControlGlobals.entitiesWithTransformAnim)){let t=Lf.setFromMatrixPosition(e.matrixWorld).sub(e.prevT).divideScalar(r).divideScalar(this.pixelsPerMeter),i=e.rigidBody.collider(0).castCollider(t,this.object.rigidBody.collider(0),Lu.copy(l).divideScalar(this.pixelsPerMeter),r,!1);t.multiplyScalar(this.pixelsPerMeter);let a=SH.is(e)?e:e.object;if(null!==i&&this.lastHitObj!==a){let t;e instanceof bu&&(t=e);let i=this.sharedGameControlGlobals.entityToCollisionEvents[a.uuid];
vendor: 8,973 bytes, line 8118
8118if(i)for(let e of i)"character"===e.data.target&&(e.dispatch(t),a.dispatchEvent(zI));this.lastHitObj=a}if(null!==i){this.pushedVelocity.copy(t),Lp.copy(i.normal1).applyQuaternion(e.quaternion);break}}if(0!==this.pushedVelocity.manhattanLength()){let e=Lp.dot(l);e<0&&l.addScaledVector(Lp,-e),l.add(this.pushedVelocity)}else l.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),"normal"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)||"steer"===this.rotationMode&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||"walk"===this.moveMode)?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,"normal"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)||"steer"===this.rotationMode&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(r),this.rotVelocityStick),0===this.rotVelocityTarget.manhattanLength()?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**a):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**a),this.euler.x+=this.rotVelocity.x*r,this.euler.y+=this.rotVelocity.y*r+this.groundYRotation,0===this.rotVelocityTarget.y&&0===this.directionXZ.manhattanLength()?this.rotationAccumWhenOrientWithCamera=0:(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*r),!1===this.isFirstPerson&&"none"!==this.orientMode&&this.directionXZ.manhattanLength()>0){if("radial"===this.orientMode){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(LS,this.euler.y-this.euler0.y);let e=Lp.copy(this.objectToCamXZ).normalize(),t=Lf.copy(l).multiplyScalar(r);t.y=0;let i=t.sub(Lu.copy(e).multiplyScalar(t.dot(e))).cross(e).y;this.euler.y-=Math.atan2(i,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*r+this.groundYRotation,0!==this.rotVelocityTarget.y&&(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.euler.y=this.rot.y);if(!0===this.cameraFollow&&("walk"===this.moveMode?"Limit"===this.cameraXAxis?this.euler.x=t8.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=t8.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=t8.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(t?Lb.copy(t):Lb.copy(this.euler),Lb.y=0,this.nonColliderRotOffset.makeRotationFromEuler(Lb)),t&&("walk"===this.moveMode?(this.rot.y=t.y,this.rot.x=0,this.rot.z=0):this.rot.setFromEuler(t),this.rot.y+=this.vrEulerYOffset*LP),Ly.setFromAxisAngle(Lw,this.rot.x),Lx.setFromAxisAngle(LS,this.rot.y),Lx.multiply(Ly),Ly.setFromAxisAngle(L_,this.rot.z),Lx.multiply(Ly),this.quaternion.copy(Lx),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled){if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let e=Lp.copy(l).multiplyScalar(r/this.pixelsPerMeter),t=null;this.didHit=!1;let i=new iD;for(let r=0;r<5;r++){let a=e.length(),o=Lf.copy(e).normalize();if(null!==(t=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(i),this.colliderWorldQuat,o,this.object.rigidBody.collider(0).shape,a,!1,24,void 0,void 0,this.object.rigidBody))){this.didHit=!0;let l=this.sharedGameControlGlobals.colliderToEntity.get(t.collider.handle);if(l!==this.lastHitObj&&0===r){this.lastHitObj=l;let e=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(e){for(let i of e)if("character"===i.data.target){let e=(this.sharedGameControlGlobals.rapierWorld?.getCollider(t.collider.handle))._parent,r;if(l.cloner){for(let t of l.cloner.children)if(t.rigidBody===e){r=t;break}}i.dispatch(r),l.dispatchEvent(zI)}}}let h=Lh.set(t.normal2.x,t.normal2.y,t.normal2.z).applyQuaternion(this.colliderWorldQuat),c=Lc.copy(o).multiplyScalar(t.toi).dot(h),d=t.toi;if(0===d&&(this.position.y+=this.offset*this.pixelsPerMeter),c>this.offset&&(d=t.toi*(c-this.offset)/c,i.addScaledVector(o,d)),e.copy(o).multiplyScalar(a-d),Math.acos(-h.y)>this.slopeThresh){let r=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(i),a=Lf.copy(t.witness2).applyQuaternion(this.colliderWorldQuat);a.y=0;let o=r.add(a);o.y+=this.stepThresh;let l=this.sharedGameControlGlobals.rapierWorld.castShape(o,this.colliderWorldQuat,e,this.object.rigidBody?.collider(0).shape,1,!1,24,void 0,void 0,this.object.rigidBody);null!==l&&0===l.toi&&(h.y=0,h.normalize())}e.addScaledVector(h,-e.dot(h))}else{0===r&&0!==this.directionXZ.manhattanLength()&&(this.lastHitObj=null),i.add(e);break}}this.position.addScaledVector(i,this.pixelsPerMeter),this.object.rigidBody?.setTranslation(Lu.copy(this.position).divideScalar(this.pixelsPerMeter),!0),this.object.rigidBody?.setRotation(Ly.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat),!0)}else{let e=this.onObject?1:5,t=l.multiplyScalar(r/e);for(let i=0;i<e;i++)this.position.add(t),this.collisionAdjustment(r/e)}}else this.position.addScaledVector(l,r);if("walk"===this.moveMode&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),!0===this.cameraFollow){this.updateFollowArms();let e=this.objectToTarget.add(this.position),t=this.targetToCamera.add(e);Lm.lookAt(t,e,LS).setPosition(t),Lm.decompose(this.targetPos,this.targetQuat,Lu),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**a),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**a),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=t8.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=t8.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(LT),!(this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(void 0===this.camera||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&("fly"===this.moveMode||!0===this.onObject||!1===this.collisionEnabled)&&(null===this.navMeshPathDest||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0))&&(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(LC),!0)}updateFollowArms(){let e;this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t=Ly.setFromAxisAngle(LS,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?t8.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&this.objectToTarget.applyQuaternion(t),e="Limit"===this.cameraXAxis?t8.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):t8.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Lu.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(t);let r=Lx.setFromAxisAngle(i,e);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(t),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){180*LS.angleTo(e)/Math.PI<15||180*LS.angleTo(e)/Math.PI>85?Ly.identity():Ly.setFromUnitVectors(LS,e),this.groundTilt.slerp(Ly,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=Lc.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);
8118let i=Lm.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Lu,Ly,Lp).compose(Lu,Ly,LA);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(e=>{if(e===this.object||e.isDescendantOf(this.object)||!e.bvhGeometry||!e.bvhGeometry.boundsTree)return;LE.makeEmpty(),e.updateMatrixWorldSVD();let r=e.matrixWorldRigid,a=Lg.copy(r).invert(),o=Lv.copy(Lg).multiply(i);LM.copy(this.collider.segment),LM.start.applyMatrix4(o),LM.end.applyMatrix4(o);let l=Lh.copy(this.position).applyMatrix4(a);LE.expandByPoint(LM.start),LE.expandByPoint(LM.end),LE.min.addScalar(-this.collider.radius),LE.max.addScalar(this.collider.radius),e.bvhGeometry.boundsTree.shapecast({traverseBoundsOrder:e=>e.distanceToPoint(LM.end),intersectsBounds:e=>e.intersectsBox(LE),intersectsTriangle:e=>{let i=e.closestPointToSegment(LM,Lu,Lp);if(i<this.collider.radius){let e=this.collider.radius-i,a=Lp.sub(Lu).normalize(),o=Lf.copy(l);o.addScaledVector(a,e);let h=o.applyMatrix4(r).sub(this.position);t.add(h),LM.start.addScaledVector(a,e),LM.end.addScaledVector(a,e)}}})}),LE.makeEmpty(),LM.copy(this.collider.segment),LM.start.applyMatrix4(i),LM.end.applyMatrix4(i),LE.expandByPoint(LM.start),LE.expandByPoint(LM.end),LE.min.addScalar(-this.collider.radius),LE.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({traverseBoundsOrder:e=>e.distanceToPoint(LM.end),intersectsBounds:e=>e.intersectsBox(LE),intersectsTriangle:e=>{let i=e.closestPointToSegment(LM,Lu,Lp);if(i<this.collider.radius){let e=this.collider.radius-i,r=Lp.sub(Lu).normalize();this.alignToGround&&this.groundTiltAdjustment(r),t.addScaledVector(r,e),LM.start.addScaledVector(r,e),LM.end.addScaledVector(r,e)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}};LD.isLocked=!1;var LO=tL(tF());function LI(e){let t=e.elements,i=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,a=t[8]**2+t[9]**2+t[10]**2,o=t[0]**2+t[4]**2+t[8]**2,l=t[1]**2+t[5]**2+t[9]**2,h=t[2]**2+t[6]**2+t[10]**2;return i<1e-8||r<1e-8||a<1e-8||o<1e-8||l<1e-8||h<1e-8}function LR(e,t){let i=new rQ;if(t&&LI(t)||!e.getAttribute("position"))return i.setAttribute("position",new rV([],3)),i.setIndex([]),i;let{positions:r,triIndices:a}=_t(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new rV(r,3)),i.setIndex(a),t&&i.applyMatrix4(t),i}var LL=new i6,LB=new i6,Lz=[[0,0,0],[0,0,0],[0,0,0]];function LF(e){let t=e.elements;Lz[0][0]=t[0],Lz[0][1]=t[4],Lz[0][2]=t[8],Lz[1][0]=t[1],Lz[1][1]=t[5],Lz[1][2]=t[9],Lz[2][0]=t[2],Lz[2][1]=t[6],Lz[2][2]=t[10];let{u:i,v:r}=(0,LO.SVD)(Lz),a=LL.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),o=LB.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1);return a.multiply(o.transpose())}var LN=class extends lH{constructor(){super(),this.layers.enable(3),this.layers.enable(8),this.layers.enable(9)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,i=[]){return e.forEach(e=>{e.visible&&this.intersectObject(e,t,i)}),i}createRaycastLineHelper(){let e=new nQ({color:65280,linewidth:10}),t=new iD(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new iD(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),r=this.camera.far-this.camera.near,a=new iD().addVectors(t,i.multiplyScalar(r)),o=new rQ;return o.setFromPoints([t,a]),new n1(o,e)}},LU=e=>e instanceof Cb||e instanceof DC;function Lk(e,t){return e.distance-t.distance}function LV(e,t,i,r=!1){if(!r&&!i.some(t=>void 0!==LH(e,t)))return[];let a=[];
8118return t.children.forEach(t=>(function e(t,i,r){if(!(!bE(i)||!i.visible))for(let a of(Cu(i)&&i.raycast(t,r),i.children))e(t,a,r)})(e,t,a)),a.sort(Lk),a}function Lj(e){let t=[];if(e.length){let i=e[0].object;bE(i)&&t.push(i);let r=i.parent;for(;r;)LU(r)&&t.push(r),r=r.parent}return t}function LG(e,t,i,r){let a=e.frame;if(a){let e=t[0]*a.width,o=(1-t[1])*a.height;for(let t of i){let i=t===a.uuid?a:a.find(t);if(i?.intersects(e,o))return r(i),!0}}return!1}function LH(e,t){if(Cu(t)){if(t.visible){let i=[];return t.raycast(e,i),i.length?i[0]:void 0}}else if(LU(t))return function e(t,i){if(!(!bE(i)||!i.visible)){if(Cu(i)){let e=[];if(i.raycast(t,e),e.length)return e[0]}for(let r of i.children){let i=e(t,r);if(i)return i}}}(e,t)}var LW=class{constructor(e,t,i,r,a,o,l,h){this.renderer=e,this.publish=t,this.scene=i,this.getCamera=r,this.sharedAssets=a,this.requestRender=o,this.isExport=l,this.frame=h,this.raycaster=new LN,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents="window"===t.mouseEventTarget,this.domElement=e.domElement,this.eventElement=this._useWindowEvents?window:e.domElement,this._domRect=this.domElement.getBoundingClientRect()}get stopRaycast(){return this.publish.stopRaycast}get page(){return this.scene.activePage}set useWindowEvents(e){this._useWindowEvents=e,this.eventElement=e?window:this.renderer.domElement}get useWindowEvents(){return this._useWindowEvents}set domRect(e){this._domRect=e}get domRect(){return this._domRect}updateRaycaster(e){var t,i;let{pageX:r,pageY:a}=e.touches?.length>0?e.touches[0]:e;this.pointerWorld={x:(r-((t=this._domRect).left+window.scrollX))/t.width*2-1,y:-((a-(t.top+window.scrollY))/t.height*2)+1},this.pointerScreen={x:(r-((i=this._domRect).left+window.scrollX))/i.width,y:1-(a-(i.top+window.scrollY))/i.height},this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}dispose(){this.scene=void 0,this.sharedAssets=void 0,this.publish=void 0,this.getCamera=void 0,this.requestRender=void 0,this.frame=void 0,this.isExport=void 0}},Lq=class{constructor(e){this.eventContext=e,this.domEventsNeeded=new Set,this.hasVideoAction=!1}connect(){}disconnect(){}dispose(){this.disconnect(),this.eventContext=void 0}},LX=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],LY=e=>LX.find(([t,i])=>i===e)?.[0],LQ=e=>LX.find(([t])=>t===e)?.[1],LZ=(e,t)=>{let i=LY(e);if(i){let e=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(e,"target",{writable:!1,value:t}),e}},LK=class extends Lq{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=e=>{if(!e.eventName||!e.target||"Scroll"===e.eventName)return;let t=this.splineEvents[LY(e.eventName)]?.[e.target.uuid];if(!t)return;"Scroll"===e.eventName&&void 0!==e.deltaY&&Object.assign(t,{deltaY:e.deltaY});let{domElement:i}=this.eventContext;i.dispatchEvent(t)}}connect(){let{page:e}=this.eventContext;e.traverseEntity(e=>{if(e.data?.events.length){for(let[t,i]of LX)if(e.data.events.some(e=>e.data.type===i&&!e.data.disabled)){this.objectsPerEvents.has(t)?this.objectsPerEvents.get(t)?.push(e):this.objectsPerEvents.set(t,[e]);let r=LZ(i,{id:e.uuid,name:e.name}),a=this.splineEvents[t];a?a[e.uuid]=r:this.splineEvents[t]={[e.uuid]:r}}}}),this.objectsPerEvents.forEach(e=>{e.forEach(e=>{e.addEventListener("beginEvent",this.onBeginEvent)})})}disconnect(){this.objectsPerEvents.forEach(e=>{e.forEach(e=>{e.removeEventListener("beginEvent",this.onBeginEvent)})})}},LJ=class{constructor(e,t,i,r,a,o){if(this.id=e,this.data=t,this.object=i,this.entered=!1,("KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type)&&!t.key)throw Error("Missing property");this.actions=R6(t,t.actions,r,a,o,i)}disconnect(){R8(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init(
vendor: 728 bytes, line 8118
8118))}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStart())):(this.actions.Transition.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.SwitchCamera.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{
vendor: 2,466 bytes, line 8118
8118"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()})),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),!1===e&&this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},
vendor: 10,091 bytes, line 8118
8118L$=class extends Lq{constructor(e,t,i){super(e),this.eventManager=t,this.useForRaycastProperty=i,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=e=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(e);let{raycaster:t,page:i}=this.eventContext,r=LV(t,i,[],!0);this.sceneInterects=r,r.length&&(this.eventContext.sharedAssets.raycastProperty={x:r[0].point.x,y:r[0].point.y,z:r[0].point.z,objX:r[0].object.matrixWorld.elements[12],objY:r[0].object.matrixWorld.elements[13],objZ:r[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{("MouseDown"===t.data.type||"MousePress"===t.data.type)&&(this.onCanvasRaycast(e),t.dispatch())})},this.onCanvasMouseUp=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{"MouseUp"===t.data.type?(this.onCanvasRaycast(e),t.dispatch()):"MousePress"===t.data.type&&t.dispatchRelease()})},this.onMouseDown=e=>{px.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseDown"))},this.onMouseUp=e=>{px.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=e=>{px.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent())},this.onMousePressRelease=e=>{px.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent(!0))},this.onKeyDown=e=>{this.heldKeys[e.key]||(this.handleKeyEvent(e,"KeyDown"),this.handleKeyEventHeld(e,"KeyDown",!0)),this.heldKeys[e.key]=!0},this.onKeyUp=e=>{this.handleKeyEvent(e,"KeyUp"),this.handleKeyEventHeld(e,"KeyUp",!0)},this.onKeyPressDown=e=>{this.heldKeysPress[e.key]?this.handleKeyEventHeld(e,"KeyPress"):(this.handleKeyEvent(e,"KeyPress"),this.handleKeyEventHeld(e,"KeyPress",!0)),this.heldKeysPress[e.key]=!0},this.onKeyPressUp=e=>{this.handleKeyEvent(e,"KeyPress",!0)},this.releaseHeldKey=e=>{delete this.heldKeys[e.key]},this.releaseHeldKeyPress=e=>{delete this.heldKeysPress[e.key]},this._onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=LQ(e);r&&("MouseDown"===r||"MouseUp"===r||"MousePress"===r?(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent(i)}),this.canvasMouseEvents.forEach(e=>{e.dispatchUserEvent(i)})):("KeyDown"===r||"KeyUp"===r||"KeyPress"===r)&&(t.dispatchEvent({type:"beginEvent",eventName:r}),this.eventsPerObjects[r]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext,r=(i,r)=>{if(i.data?.events.length)for(let a of["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"]){let o=this.eventsPerObjects[a];if(i.data.events.filter(({data:e})=>e.type===a&&!0!==e.disabled).forEach(({id:r,data:a})=>{try{let l=new LJ(r,a,i,e,t,this.eventManager);l.actions.Video.length&&(this.hasVideoAction=!0),("MouseDown"===a.type||"MouseUp"===a.type||"MousePress"===a.type)&&("Canvas"===a.mode||"Window"===a.mode)?this.canvasMouseEvents.push(l):(o[i.uuid]?o[i.uuid].some(e=>e.id===l.id)||o[i.uuid].push(l):o[i.uuid]=[l],i instanceof D7&&i.traverseChildren(e=>{if(!e.visible)return!0;e instanceof Eh&&"shapeBlendNode"in e.data.geometry&&e.data.geometry.shapeBlendNode?.operation!==2&&(o[e.uuid]?o[e.uuid].push(l):o[e.uuid]=[l])}))}catch(e){}}),o[i.uuid]?.length&&(this.objectsPerTypes[a].push(i instanceof PU&&("MouseDown"===a||"MouseUp"===a||"MousePress"===a)?r:i),i instanceof D7)){let e=this.objectsPerTypes[a];i.traverseChildren(t=>{if(!t.visible)return!0;t instanceof Eh&&-1===e.indexOf(t)&&e.push(t)})}}};e.traverseEntity(e=>{(e instanceof DO||e instanceof DS)&&e.frame?.traverse(t=>{r(t,e)}),r(e)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),i.addEventListener("pointerdown",this.onCanvasMouseDown),i.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(e=>{Object.values(e).forEach(e=>{e.forEach(e=>{e.disconnect()})})}),this.canvasMouseEvents.forEach(e=>{e.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:i,page:r,pointerScreen:a}=this.eventContext,o=this.objectsPerTypes[e],l=o.filter(e=>!(e instanceof PU));if(!(!o.length&&!this.useForRaycastProperty)&&!(r.uiCanvas&&LG(r,[a.x,a.y],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))){if(t||this.useForRaycastProperty){let a;if(null===this.sceneInterects?a=LV(i,r,l,this.useForRaycastProperty):(a=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&a.length&&(this.eventContext.sharedAssets.raycastProperty={x:a[0].point.x,y:a[0].point.y,z:a[0].point.z,objX:a[0].object.matrixWorld.elements[12],objY:a[0].object.matrixWorld.elements[13],objZ:a[0].object.matrixWorld.elements[14]}),t){let t=[a[0]?.uv?.x??0,a[0]?.uv?.y??0];Lj(a).forEach(i=>{i instanceof DO&&LG(i,t,Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}),this.eventsPerObjects[e][i.uuid]&&this.handleObjectMouseEventDispatch(i,e)})}}t||l.forEach(t=>{let r=LH(i,t);r&&(this.handleObjectMouseEventDispatch(t,e),t instanceof DO&&LG(t,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",i=this.objectsPerTypes[t],r=i.filter(e=>!(e instanceof PU)),a=[];if(i.length){if(!e){let{stopRaycast:e,raycaster:i,page:o,pointerScreen:l}=this.eventContext,h=!1;if(o.uiCanvas&&(h=LG(o,[l.x,l.y],Object.keys(this.eventsPerObjects[t]),e=>{a.push(e)})),e&&!h){let e=LV(i,o,r);a=Lj(e),e.forEach(e=>{e.object instanceof DO&&LG(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{a.push(e)})})}else r.forEach(e=>{let r=LH(i,e);r&&(a.push(e),e instanceof DO&&LG(e,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{a.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{a.includes(e)||this.handleObjectMouseEventDispatchRelease(e,t)}),a.length&&a.forEach(e=>{this.handleObjectMouseEventDispatch(e,t)}),this._prevObjects=a}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatchRelease()})}handleKeyEvent(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{let a=this.eventsPerObjects[t][r.uuid];a.some(({data:t})=>"key"in t&&t.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}),a.forEach(t=>{"key"in t.data&&t.data.key===e.key&&(i?t.dispatchRelease():t.dispatch(!0))})})}handleKeyEventHeld(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(t=>{"key"in t.data&&t.data.key===e.key&&t.dispatchHeld(i)})})}},L0=new iD,L1=new iD,L2=class{constructor(e,t,i,r,a){this.actionsIn=R6(e,e.inActions,i,r,a,t),this.actionsOut=R6(e,e.outActions,i,r,a,t)}disconnect(){R8(this.actionsIn),R8(this.actionsOut)}},L3=class extends L2{constructor(e,t,i,r,a,o){super(t,i,r,a,o),this.id=e,this.data=t,this.object=i,this.stage="out",this.objects=[],this.onUpdateMatrixWorld=()=>{for(let e of this.objects)if(!e.visible)return;let e=L0.setFromMatrixPosition(this.objects[0].matrixWorld),t=L1.setFromMatrixPosition(this.objects[1].matrixWorld),i=e.distanceTo(t)<=this.distance?"in":"out";if(this.stage!==i){this.stage=i;let e="in"===i?this.actionsIn:this.actionsOut;
8118e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Link.forEach(e=>e.dispatch()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.TimelineAnimation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}};let{distance:l,fromObject:h,toObject:c}=t.condition;for(let e of(this.distance=l,[h,c])){if(!e)throw Error("Missing property");let t=r.find(e);if(!t)throw Error("Missing property");this.objects.push(t)}}connect(){window.setTimeout(()=>{this.objects.forEach(e=>{e.addEventListener("updateMatrixWorld",this.onUpdateMatrixWorld)}),this.onUpdateMatrixWorld()},0)}disconnect(){super.disconnect(),this.stage="out",this.objects.forEach(e=>{e.removeEventListener("updateMatrixWorld",this.onUpdateMatrixWorld)})}},L4=class extends L2{constructor(e,t,i,r,a,o){super(t,i,r,a,o),this.id=e,this.data=t,this.object=i,this.onBegin=({target:e,state:t})=>
8118{this.toState!==t&&(this.actionsOut.Audio.forEach(e=>e.dispatchConditional()),this.actionsOut.Particles.forEach(e=>e.dispatchConditional()),this.actionsOut.Video.forEach(e=>e.dispatchConditional()),this.actionsOut.Link.forEach(e=>e.dispatch()),this.actionsOut.Create.forEach(e=>e.dispatch()),this.actionsOut.Destroy.forEach(e=>e.dispatch()),this.actionsOut.Reset.forEach(e=>e.dispatch()),this.actionsIn.Transition.forEach(e=>e.pause()),this.object.currentTransitionEvent=this,this.actionsOut.Transition.forEach(e=>e.play()),this.actionsOut.Animation.forEach(e=>e.play()),this.actionsOut.TimelineAnimation.forEach(e=>e.play()),this.actionsIn.SwitchCamera.forEach(e=>e.pause()),this.actionsOut.SwitchCamera.forEach(e=>e.play()),this.actionsOut.SceneTransition.forEach(e=>e.dispatch()),this.actionsOut.SetVariable.forEach(e=>e.checkConditions()),this.actionsOut.SetVariable.forEach(e=>e.dispatch()),this.actionsOut.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actionsOut.ClearLocalStorage.forEach(e=>e.dispatch()),this.actionsOut.UserAPI.forEach(e=>e.dispatch()))},this.onComplete=({target:e,state:t})=>
8118{this.toState===t&&(this.actionsIn.Audio.forEach(e=>e.dispatchConditional()),this.actionsIn.Particles.forEach(e=>e.dispatchConditional()),this.actionsIn.Video.forEach(e=>e.dispatchConditional()),this.actionsIn.Link.forEach(e=>e.dispatch()),this.actionsIn.Create.forEach(e=>e.dispatch()),this.actionsIn.Destroy.forEach(e=>e.dispatch()),this.actionsIn.Reset.forEach(e=>e.dispatch()),this.actionsOut.Transition.forEach(e=>e.pause()),this.actionsOut.Transition.forEach(e=>e.pause()),this.object.currentTransitionEvent=this,this.actionsIn.Transition.forEach(e=>e.play()),this.actionsIn.Animation.forEach(e=>e.play()),this.actionsIn.TimelineAnimation.forEach(e=>e.play()),this.actionsOut.SwitchCamera.forEach(e=>e.pause()),this.actionsIn.SwitchCamera.forEach(e=>e.play()),this.actionsIn.SceneTransition.forEach(e=>e.dispatch()),this.actionsIn.SetVariable.forEach(e=>e.checkConditions()),this.actionsIn.SetVariable.forEach(e=>e.dispatch()),this.actionsIn.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actionsOut.ClearLocalStorage.forEach(e=>e.dispatch()),this.actionsOut.UserAPI.forEach(e=>e.dispatch()))};let{condition:l}=t;if(!l.object)throw Error("Missing property");let h=r.find(l.object)??r.scene.find2D(l.object);if(!h||(this.toObject=h,l.state&&!this.toObject.states?.[l.state]))throw Error("Missing property");this.toState=l.state}connect(){ds(this.actionsOut).forEach(e=>{this.actionsOut[e]?.length&&this.toObject.addEventListener("beginState",this.onBegin)}),ds(this.actionsIn).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.addEventListener("completeState",this.onComplete)})}disconnect(){super.disconnect(),ds(this.actionsOut).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.removeEventListener("beginState",this.onBegin)}),ds(this.actionsIn).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.removeEventListener("completeState",this.onComplete)})}},L5=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.eventsPerConditions={Comparison:[],Distance:[],State:[]},this.hasVideoAction=!1}connect(){super.connect();let{page:e,sharedAssets:t}=this.eventContext;e.traverseEntity(i=>{if(i.data?.events.length){for(let{id:r,data:a}of i.data.events)if(!a.disabled&&"Conditional"===a.type)try{let o;"Comparison"===a.condition.type||("Distance"===a.condition.type?o=new L3(r,a,i,e,t,this.eventManager):"State"===a.condition.type&&(o=new L4(r,a,i,e,t,this.eventManager))),o&&(this.eventsPerConditions[a.condition.type].push(o),(o.actionsIn.Video.length||o.actionsOut.Video.length)&&(this.hasVideoAction=!0))}catch(e){}}}),Object.values(this.eventsPerConditions).forEach(e=>e.forEach(e=>e.connect()))}disconnect(){super.disconnect(),Object.values(this.eventsPerConditions).forEach(e=>e.forEach(e=>e.disconnect()))}},L6=new iD,L8=new iD,L9=new iD,L7=new sv,Be=new iD,Bt=new iD,Bi=new iD,Br=new iP,Bs=new rn,Ba=new i6,Bn=new t7,Bo=new iD,Bl=new iD;function Bh(e,t){!t||(t[0]<t[1]&&(e.x=Math.min(Math.max(e.x,t[0]),t[1])),t[2]<t[3]&&(e.y=Math.min(Math.max(e.y,t[2]),t[3])),t[4]<t[5]&&(e.z=Math.min(Math.max(e.z,t[4]),t[5])))}var Bc=(tg=new i6,(e,t,i)=>{let r=e.obj;tg.copy(r.hiddenMatrix),null!==r.parent&&tg.premultiply(r.parent.matrixWorld),tg.invert(),r.position.copy(t),"global"===e.reference&&Bh(r.position,e.limits),r.position.applyMatrix4(tg),"parent"===e.reference?Bh(r.position,e.limits):"local"===e.reference&&(Br.copy(e.quat0).invert(),r.position.sub(e.position0),r.position.applyQuaternion(Br),Bh(r.position,e.limits),Br.invert(),r.position.applyQuaternion(Br),r.position.add(e.position0)),tg.multiply(i??r.matrixWorld).decompose(Be,r.quaternion,Bt),r.updateMatrix(),r.hasNonUniformScale&&(r.updateMatrixWorld(),r.updateMatrixWorldSVD()),r instanceof _A&&Cp(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),Bd=class{constructor(e,t,i,r,a,o,l){this.object=e,this.id=t,this.data=i,this.dropDestIds=[],this.activeIdx=null,this.wasDragEventTriggered=!1,this.resetDampingFactor=0===this.data.resetSpeed?1:8/this.data.resetSpeed+1,this.snapDampingFactor=0===this.data.snapSpeed?1:8/this.data.snapSpeed+1,this.actionsDrag=R6(i,i.dragDropActions.drag,r,a,o,this.object),this.actionsDrop=R6(i,i.dragDropActions.drop,r,a,o,this.object);let h=[];
8118this.data.objects.forEach(e=>{let t=r.find(e);!t||!1!==t.data.visible&&(h.push(t),l[t.uuid]&&l[t.uuid].forEach(e=>{let t=r.find(e);t&&!1!==t.data.visible&&h.push(t)}))}),this.data.dropDestinations.forEach(e=>{let t=r.find(e);!t||!1!==t.data.visible&&(this.dropDestIds.push(t.uuid),l[t.uuid]&&l[t.uuid].forEach(e=>{let t=r.find(e);t&&!1!==t.data.visible&&this.dropDestIds.push(t.uuid)}))}),this.dragItems=h.map(e=>("locked"===this.data.planeMode&&(e.userData.lockedPlane=!0),e.userData.worldPosition0=new iD().setFromMatrixPosition(e.matrixWorld),{obj:e,fromPosition:new iD().setFromMatrixPosition(e.matrixWorld),pointStart:new iD,pointEnd:new iD,paused:!0,currentDampingFactor:this.data.dampingFactor,reset:!1,position0:new iD().copy(e.position),quat0:new iP().copy(e.quaternion),snapped:!1,orientationMatrix:new i6,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return null!==this.activeIdx?this.dragItems[this.activeIdx]:null}dispose(){R8(this.actionsDrag),R8(this.actionsDrop),this.dragItems.forEach(e=>{e.fromPosition.copy(e.obj.userData.worldPosition0),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart),e.obj.recursiveBBoxNeedsUpdate=!0,e.obj.userData.lockedPlane=void 0,e.obj.position.copy(e.position0),e.obj.quaternion.copy(e.quat0),e.obj.updateMatrix()})}},Bu=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.onPointerDown=e=>{if(px.length>1)return;this.eventContext.updateRaycaster(e);let{raycaster:t,page:i}=this.eventContext,r=i.raycastWithClones(t);if(this.lastDropDestination=null,0===r.length){this.activeEvent=null;return}for(let e of this.events){let t=0;for(let{obj:i,pointEnd:a,pointStart:o}of e.dragItems){if(i===r[0].object||i===r[0].object.object||SH.is(i)&&i.isAncestorOf(r[0].object.uuid)){if(e.activeIdx=t,e.activeDragItem.reset=!1,e.activeDragItem.currentDampingFactor=e.data.dampingFactor,e.activeDragItem.snapped=!1,"hand"===e.data.cursor&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){e.activeDragItem.obj.rigidBody&&e.activeDragItem.obj.rigidBody.setBodyType(2,!0);let t=e.activeDragItem.obj;i.hasNonUniformScale&&i.updateMatrixWorldSVD(),(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Be,Br,Bt),Bs.setFromQuaternion(Br),void 0===t.prevR?(t.prevR=Bs.clone(),t.prevT=Be.clone()):(t.prevR.copy(Bs),t.prevT.copy(Be)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(e.activeDragItem.obj)}this.calcPlaneIntersectPos(i,o,e.data.plane,e.data.referenceFrame),a.copy(o),(this.eventManager.controlsManager.usePhysics&&i.data.physics?.rigidBody==="dynamic"||!1===e.data.drop||!1===e.data.resetOnSnapFail)&&e.activeDragItem.fromPosition.setFromMatrixPosition(e.activeDragItem.obj.matrixWorld),this.activeEvent=e,this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1);return}t++}}this.activeEvent=null},this.onPointerMove=e=>{if(px.length>1)return;this.eventContext.updateRaycaster(e);let{raycaster:t,page:i}=this.eventContext,r=i.raycastWithClones(t);if(0===px.length){let e=!1;for(let t of this.events){for(let{obj:i}of t.dragItems)if(i===r[0]?.object||i===r[0]?.object?.object||SH.is(i)&&i.isAncestorOf(r[0]?.object.uuid)){switch(e=!0,t.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move")}break}if(e)break}e||this.setCursor("default");return}if(this.activeEvent&&this.activeEvent.activeDragItem){let e,t=this.activeEvent.activeDragItem;if(t.snapped=!1,this.activeEvent.data.drop&&(e=r.filter(e=>t.obj!==e.object&&!t.obj.isAncestorOf(e.object.uuid)&&!(e.object instanceof Cb)&&("all"===this.activeEvent.data.dropOn||this.activeEvent.dropDestIds.some(t=>t===e.object.uuid||i.scene.find(t).isAncestorOf(e.object.uuid))))[0]),e){let i=Bi.copy(e.face.normal).applyMatrix3(Bn.getNormalMatrix(e.object.matrixWorld));if("center"===this.activeEvent.data.snapTo)t.fromPosition.setFromMatrixPosition(e.object.matrixWorld);else if("surface"===this.activeEvent.data.snapTo){if(t.fromPosition.copy(e.point),"bbox"===this.activeEvent.data.snapSurfaceMode){Be.copy(i).applyMatrix3(Bn.setFromMatrix4(t.obj.matrixWorld).transpose());let e=t.obj;Be.x>.2?Bt.x=-e.recursiveBBox.min.x:Be.x<-.2&&(Bt.x=-e.recursiveBBox.max.x),Be.y>.2?Bt.y=-e.recursiveBBox.min.y:Be.y<-.2&&(Bt.y=-e.recursiveBBox.max.y),Be.z>.2?Bt.z=-e.recursiveBBox.min.z:Be.z<-.2&&(Bt.z=-e.recursiveBBox.max.z),Bt.applyMatrix3(Bn.invert())}else Bt.copy(i).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);t.fromPosition.add(Bt)}
8118this.activeEvent.data.autoOrient&&(Be.set(0,1,0).cross(i),1e-4>Be.length()&&Be.set(-1,0,0).cross(i),Bt.crossVectors(Bi,Be),t.orientationMatrix.makeBasis(Be,Bt,i)),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart),t.currentDampingFactor=this.activeEvent.snapDampingFactor,t.snapped=!0,this.lastDropDestination!==e.object&&(this.lastDropDestination=e.object,this.activeEvent.actionsDrop.Transition.forEach(e=>{e.play()}),this.activeEvent.actionsDrop.Animation.forEach(e=>{e.play()}),this.activeEvent.actionsDrop.Audio.forEach(e=>{e.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(e=>{e.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(e=>{e.dispatchThrottled()}))}else t.orientationMatrix.makeRotationFromQuaternion(t.quat0),this.lastDropDestination=null,t.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(t.obj,t.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),this.activeEvent.actionsDrop.Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(e=>{e.stop()}
vendor: 7,078 bytes, line 8118
8118),this.activeEvent.actionsDrop.Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(e=>{e.dispatchGameControl("stop")});this.activeEvent.actionsDrag.Create.forEach(e=>{e.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(e=>e.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(e=>e.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(e=>e.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(e=>e.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(e=>e.dispatch()),!1===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(e=>{e.play()}),this.activeEvent.actionsDrag.Animation.forEach(e=>{e.play()}),this.activeEvent.actionsDrag.Audio.forEach(e=>{e.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(e=>{e.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{this.activeEvent&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(e=>{e.stop()}))},500),this.updateDragItem(t),t.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=e=>{if(this.activeEvent&&this.activeEvent.activeDragItem){"hand"===this.activeEvent.data.cursor&&this.setCursor("grab");let e=this.activeEvent.activeDragItem.obj.data.physics?.rigidBody==="dynamic";!1===this.activeEvent.activeDragItem.snapped&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(!1===this.eventManager.controlsManager.usePhysics||!e)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&e&&(this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.pop(),this.activeEvent.activeDragItem.obj.rigidBody.setBodyType(0,!0),this.activeEvent.activeDragItem.paused=!0),!0===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Transition.forEach(e=>{e.stop(),null!==e.object.currentState&&e.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(e=>{e.stop()}),this.activeEvent.actionsDrag.Audio.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(e=>{e.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(e=>e.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(e=>e.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(e=>e.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(e=>e.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(e=>e.dispatch())),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0)}}}connect(){let e={};if(this.eventContext.page.traverseEntity(t=>{t.component&&(e[t.component.uuid]?e[t.component.uuid].push(t.uuid):e[t.component.uuid]=[t.uuid])}),this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(e=>"DragDrop"===e.data.type&&!e.data.disabled).forEach(i=>{this.events.push(new Bd(t,i.id,i.data,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager,e))})}),!this.events.length)return;this.domEventsNeeded.clear(),this.domEventsNeeded.add("pointerdown");let t=this.eventContext.domElement;t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.domEventsNeeded.add("pointermove")}disconnect(){if(!this.events.length)return;this.domEventsNeeded.clear();let e=this.eventContext.domElement;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),this.events.forEach(e=>e.dispose())}setCursor(e){this.eventContext.domElement.style.cursor=e}onAnimationFrameDamping(){for(let e of this.events)for(let t of e.dragItems)t.paused||this.updateDragItem(t,!0)}calcPlaneIntersectPos(e,t,i,r){let{getCamera:a,raycaster:o}=this.eventContext;a().getWorldDirection(L8),L8.negate();let l=Br.identity();switch("parent"===r?Ba.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix).decompose(Be,l,Bt):"local"===r&&e.matrixWorld.decompose(Be,l,Bt),i){case"x":Be.set(1,0,0).applyQuaternion(l),Bo.copy(L8).cross(Be),Bl.copy(Be).cross(Bo);break;case"y":Be.set(0,1,0).applyQuaternion(l),Bo.copy(L8).cross(Be),Bl.copy(Be).cross(Bo);break;case"z":Be.set(0,0,1).applyQuaternion(l),Bo.copy(L8).cross(Be),Bl.copy(Be).cross(Bo);break;case"xy":Bl.set(0,0,1).applyQuaternion(l);break;case"yz":Bl.set(1,0,0).applyQuaternion(l);break;case"xz":Bl.set(0,1,0).applyQuaternion(l);break;case"adaptive":L8.angleTo(Bt.set(0,1,0))>Math.PI/6?(Be.crossVectors(Bt.set(0,1,0),L8),Bl.crossVectors(Be,Bt)):Bl.set(0,1,0);break;default:Bl.copy(L8)}L9.setFromMatrixPosition(e.matrixWorld);let h=e.userData.lockedPlane?e.userData.worldPosition0:L9;if(L7.setFromNormalAndCoplanarPoint(Bl,h),o.ray.intersectPlane(L7,t)&&("x"===i||"y"===i||"z"===i)){let e=Bt.subVectors(t,h).dot(Be);t.copy(h).addScaledVector(Be,e)}}updateDragItem(e,t=!1){L9.setFromMatrixPosition(e.obj.matrixWorld),"current"===e.reset?L6.subVectors(e.fromPosition,L9).divideScalar(e.currentDampingFactor):"original"===e.reset?(L6.subVectors(e.obj.userData.worldPosition0,L9).divideScalar(e.currentDampingFactor),e.fromPosition.copy(e.obj.userData.worldPosition0),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart)):L6.subVectors(e.pointEnd,e.pointStart).add(e.fromPosition).sub(L9).divideScalar(e.currentDampingFactor),e.paused=!(e.currentDampingFactor>1)||.01>L6.length(),(this.activeEvent&&1===this.activeEvent.data.dampingFactor||t)&&Bc(e,L6.add(L9),this.activeEvent?.data.drop&&this.activeEvent?.data.autoOrient?e.orientationMatrix:null),e.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}},Bp=new iD,Bf=new iD,Bm=new iD,Bg=new iD,Bv=new sv,By={type:"requestRender"},Bx=(tv=new iD,ty=new iD,(e,t,i)=>i>0?(tv.subVectors(e,t),tv.length()<=i?e:ty.copy(t).add(tv.normalize().multiplyScalar(i))):t),Bb=(tx=new i6,(e,t)=>{e.position.copy(t),null!==e.parent&&(tx.copy(e.parent.matrixWorld).invert(),e.position.applyMatrix4(tx)),tx.copy(e.hiddenMatrix).invert(),e.position.applyMatrix4(tx),e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),e instanceof _A&&Cp(e.parent)&&e.invali
8118dateDownstreamBooleanData(!0)}),Bw=class{constructor(e,t,i,r,a,o){this.data=e,this.id=t,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.snapComplete=!1,this.isReset=!1,this.worldPosition0=new iD,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...m4.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(this.target=r.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.resetDampingFactor=80/this.data.resetSpeed+1,this.object.getWorldPosition(this.worldPosition0),this.actions=R6(e,e.actions,r,a,o,i)}},BS=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=e=>{if(!(px.length>1))for(let t of(this.eventContext.updateRaycaster(e),this.events))void 0===t.target&&this.updateSingleEvent(t)},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let i=t.data?.events.find(e=>"Follow"===e.data.type&&!e.data.disabled);i&&(!e.data.globalPhysics.usePhysics||t.dataPatched.physics?.rigidBody!=="dynamic")&&this.events.push(new Bw(i.data,i.id,t,e,this.eventContext.sharedAssets,this.eventManager))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;for(let e of(this.domEventsNeeded.clear(),pm&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents||(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave)),this.events))if(void 0!==e.target){let t=e.target,i=this.onTargetChange(e);this.pairOfEventListeners.push([t,i]),t.addEventListener("requestRender",i)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;for(let[i,r]of(this.domEventsNeeded.clear(),pm&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave),this.pairOfEventListeners))i.removeEventListener("requestRender",r);for(let e of this.events)e.paused=!0,e.isReset=!1,R8(e.actions)}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e,!0)}updateSingleEvent(e,t=!1){this.events.forEach(e=>{e.actions.Create.forEach(e=>{e.dispatchThrottled()})});let{plane:i,limitDistance:r,limitDistanceEnabled:a}=e.data;if(e.object.getWorldPosition(Bm),e.isReset)Bg.copy(e.worldPosition0);else if(e.target)e.target.getWorldPosition(Bg);else{let{getCamera:e,raycaster:t}=this.eventContext;if("custom"===i?(e().getWorldDirection(Bf),Bf.negate(),Bp.copy(Bf)):"xy"===i?Bp.set(0,0,1):"xz"===i?Bp.set(0,1,0):"yz"===i&&Bp.set(1,0,0),Bv.setFromNormalAndCoplanarPoint(Bp,Bm),!t.ray.intersectPlane(Bv,Bg))return}if(!e.isReset){if(Bg.distanceTo(e.worldPosition0)>r&&a&&e.target){if(e.snapComplete=!1,e.data.snapDelay&&(e.delayFinished=!1,"u">typeof window&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;Bg.copy(e.worldPosition0),e.currentDampingFactor=e.resetDampingFactor}else if(e.wasOutside&&(e.data.snapDelay&&"u">typeof window&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return}!1===e.data.enabledTranslation[0]&&(Bg.x=Bm.x),!1===e.data.enabledTranslation[1]&&(Bg.y=Bm.y),!1===e.data.enabledTranslation[2]&&(Bg.z=Bm.z);
8118let o=Bx(Bm,Bg,e.wasOutside?0:e.data.maxDelta);if(e.currentDampingFactor>1){let i=Bp.subVectors(o,Bm).divideScalar(e.currentDampingFactor);Bm.add(i),t&&Bb(e.object,Bm),e.paused=.01>i.length()}else Bb(e.object,o),e.paused=!0;e.object?.dispatchEvent({type:"beginEvent",eventName:"Follow"}),e.object.dispatchEvent(By)}},B_=new iD,BA=new iD,BM=new i6,BE=new iP,BC=new iP,BT=new iD,BP=new iD,BD=new iD,BO=new iD,BI=new sv,BR={type:"requestRender"},BL={type:"changeRotation"},BB=(tb=new i6,function(e,t){null!==e.parent?tb.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix):tb.copy(e.hiddenMatrix),t.premultiply(LF(tb).invert()),e.rotation.setFromRotationMatrix(t),e.updateMatrix(),e instanceof _A&&Cp(e.parent)&&e.invalidateDownstreamBooleanData(!0)}),Bz=class{constructor(e,t,i,r){this.id=t,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new iP,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...m5.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(this.target=r.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.object.getWorldQuaternion(this.worldQuaternion0),isNaN(this.worldQuaternion0.x)&&(this.worldQuaternion0.x=0),isNaN(this.worldQuaternion0.y)&&(this.worldQuaternion0.y=0),isNaN(this.worldQuaternion0.z)&&(this.worldQuaternion0.z=0),isNaN(this.worldQuaternion0.w)&&(this.worldQuaternion0.w=1),this.resetDampingFactor=80/this.data.resetSpeed+1}},BF=class extends Lq{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=e=>{if(!(px.length>1))for(let t of(this._lastMouseEvent=e,this.eventContext.updateRaycaster(e),this.events))void 0===t.target&&this.updateSingleEvent(t)},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onScroll=e=>{if(this._lastMouseEvent){let e=new PointerEvent("pointermove",{clientX:this._lastMouseEvent.clientX,clientY:this._lastMouseEvent.clientY,bubbles:!0,cancelable:!0,view:window});this.eventContext.eventElement.dispatchEvent(e)}},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)},this.createUserEventListener=e=>({eventName:t,target:i})=>{if(!t||!i)return;let r=LQ(t);r&&"LookAt"===r&&this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let i=t.data?.events.find(e=>"LookAt"===e.data.type&&!e.data.disabled);i&&(!e.data.globalPhysics.usePhysics||t.dataPatched.physics?.rigidBody!=="dynamic")&&this.events.push(new Bz(i.data,i.id,t,e))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;for(let e of(this.domEventsNeeded.clear(),pm&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents?i.addEventListener("scroll",this.onScroll):(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave)),this.events)){if(void 0!==e.target){let t=this.onTargetChange(e),i=e.target;this.pairOfEventListeners.push([i,t]),i.addEventListener("requestRender",t)}let t=this.createUserEventListener(e),i=e.object;this.pairOfUserEventListeners.push([i,t]),i.addEventListener("userEvent",t)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;for(let[i,r]of(this.domEventsNeeded.clear(),pm&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave),t.removeEventListener("scroll",this.onScroll),this.pairOfEventListeners))i.removeEventListener("requestRender",r);for(let[e,t]of this.pairOfUserEventListeners)e.removeEventListener("userEvent",t);for(let e of this.events)e.paused=!0,e.isReset=!1}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e)}updateSingleEvent(e){let{tilt:t,axis:i,distance:r,plane:a,limitDistance:o,enabledRotation:l,limitDistanceEnabled:h}=e.data,{getCamera:c,raycaster:d}=this.eventContext,{object:p,target:f}=e;if(p.getWorldPosition(BT),!e.isReset){if(e.target)e.target.getWorldPosition(BP);else{if("custom"===a?(c().getWorldDirection(BA),BA.negate(),BI.setFromNormalAndCoplanarPoint(BA,BT)):("xy"===a?B_.set(0,0,1):"xz"===a?B_.set(0,1,0):"yz"===a&&B_.set(1,0,0),BI.setFromNormalAndCoplanarPoint(B_,BT)),!d.ray.intersectPlane(BI,BP))return;r>0&&("custom"===a||void 0===a)&&BP.addScaledVector(BA,r)}}if(e.isReset||(f?"target"===t?BD.copy(f.up).applyMatrix4(BM.extractRotation(f.matrixWorld)).normalize():l.some(e=>!1===e)?("x"===i?(BO.set(0,0,1),!1===l[2]&&BO.set(0,1,0)):"y"===i?(BO.set(1,0,0),!1===l[0]&&BO.set(0,0,1)):(BO.set(0,1,0),!1===l[1]&&BO.set(1,0,0)),BD.copy(BO).applyQuaternion(e.worldQuaternion0).normalize()):BD.set(0,1,0):"custom"===a?BD.set(0,1,0):BD.copy(B_)),e.isReset)BC.copy(e.worldQuaternion0);else if(BT.distanceTo(BP)>o&&h&&f){if(e.data.snapDelay&&(e.delayFinished=!1,"u">typeof window&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;BC.copy(e.worldQuaternion0),e.currentDampingFactor=e.resetDampingFactor}else{let r;if(e.wasOutside&&(e.data.snapDelay&&"u">typeof window&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return;r=BM.elements,Bk.subVectors(BP,BT),0===Bk.lengthSq()&&(Bk.z=1),Bk.normalize(),BU.crossVectors(BD,Bk),0===BU.lengthSq()&&(1===Math.abs(BD.z)?Bk.x+=1e-4:Bk.z+=1e-4,Bk.normalize(),BU.crossVectors(BD,Bk)),BU.normalize(),BN.crossVectors(Bk,BU),"x"===i?1===BO.z?[BU,BN,Bk]=[Bk,BU,BN]:(BU.negate(),[BU,Bk]=[Bk,BU]):"y"===i?1===BO.x?[BU,BN,Bk]=[BN,Bk,BU]:(BU.negate(),[BN,Bk]=[Bk,BN]):1===BO.x&&(BU.negate(),[BU,BN]=[BN,BU]),r[0]=BU.x,r[4]=BN.x,r[8]=Bk.x,r[1]=BU.y,r[5]=BN.y,r[9]=Bk.y,r[2]=BU.z,r[6]=BN.z,r[10]=Bk.z,BC.setFromRotationMatrix(BM),BE.setFromUnitVectors(BO.applyQuaternion(BC),BD),l.some(e=>!1===e)&&"target"!==t&&BC.premultiply(BE).normalize()}e.currentDampingFactor>1?(p.updateWorldMatrix(!0,!1),BE.setFromRotationMatrix(LF(p.matrixWorld)),BE.slerp(BC,1/e.currentDampingFactor),BB(p,BM.makeRotationFromQuaternion(BE)),e.paused=8*(1-BE.dot(BC))<1e-6):(BB(p,BM.makeRotationFromQuaternion(BC)),e.paused=!0),e.object?.dispatchEvent({type:"beginEvent",eventName:"Lo
8118okAt"}),p.dispatchEvent(BR),p.dispatchEvent(BL)}},BN=new iD,BU=new iD,Bk=new iD,BV=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.entered=!1,this.actions=R6(t,t.actions,r,a,o,i)}disconnect(){R8(this.actions)}dispatchEnter(){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.entered||(this.entered=!0,this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.play()),this.actions.Create.forEach(e=>e.dispatchStart()),this.actions.Particles.forEach(e=>e.dispatchBasic()),this.actions.Destroy.forEach(e=>e.dispatch()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}dispatchLeave(){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.entered&&(this.entered=!1,this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()),this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()))}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatch()),this.actions.Particles.forEach(e=>e.dispatchBasic()),this.actions.Destroy.forEach(e=>e.dispatch()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},Bj=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObjects={},this.objects=[],this.objects2D=[],this._prevObjects=[],this.onMouseDown=e=>{px.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseHoverEvent())},this.onMouseUp=e=>{px.length>1||this.handleMouseHoverEvent(!0)},this.onMouseMove=e=>{px.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseHoverEvent())},this.onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=LQ(e);r&&"MouseHover"===r&&(t.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[t.uuid]?.forEach(e=>e.dispatchUserEvent(i)))}}connect(){let{page:e,sharedAssets:t}=this.eventContext,i=(i,r)=>{if(!(!i.visible||!i.data?.events.length)){for(let{id:r,data:a}of i.data.events)if(!a.disabled&&"MouseHover"===a.type)try{let o=new BV(r,a,i,e,t,this.eventManager);this.eventsPerObjects[i.uuid]?this.eventsPerObjects[i.uuid].push(o):this.eventsPerObjects[i.uuid]=[o]}catch(e){}this.eventsPerObjects[i.uuid]?.length&&this.objects.push(i instanceof PU?r:i)}};if(e.traverseEntity(e=>{(e instanceof DO||e instanceof DS)&&e.frame?.traverse(t=>{i(t,e)}),i(e)}),!this.objects.length)return;let{domElement:r}=this.eventContext;this.domEventsNeeded.clear(),pm&&(this.domEventsNeeded.add("pointerdown"),r.addEventListener("pointerdown",this.onMouseDown),this.domEventsNeeded.add("pointerup"),r.addEventListener("pointerup",this.onMouseUp)),this.domEventsNeeded.add("pointermove"),r.addEventListener("pointermove",this.onMouseMove),this.objects.forEac
vendor: 4,136 bytes, line 8118
8118h(e=>{e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if(!this.objects.length)return;let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),pm&&(e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerup",this.onMouseUp)),e.removeEventListener("pointermove",this.onMouseMove),Object.values(this.eventsPerObjects).forEach(e=>{e.forEach(e=>{e.disconnect()})}),this.objects.forEach(e=>{e.removeEventListener("userEvent",this.onUserEvent)})}handleMouseHoverEvent(e=!1){let t=[];if(!e){let{stopRaycast:e,raycaster:i,page:r,pointerScreen:a}=this.eventContext,o=!1;if(r.uiCanvas&&(o=LG(r,[a.x,a.y],Object.keys(this.eventsPerObjects),e=>{t.push(e)})),e&&!o){let e=LV(i,r,this.objects);t=Lj(e),e.forEach(e=>{e.object instanceof DO&&LG(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects),e=>{t.push(e)})})}else this.objects.forEach(e=>{let r=LH(i,e);r&&(t.push(e),e instanceof DO&&LG(e,[r?.uv?.x??0,r?.uv?.y??0],Object.keys(this.eventsPerObjects),e=>{t.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{t.includes(e)||(e.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[e.uuid]?.forEach(e=>e.dispatchLeave()))}),t.length&&t.forEach(e=>{e.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[e.uuid]?.forEach(e=>e.dispatchEnter())}),this._prevObjects=t}},BG=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.scrollCounter=0,this.actions=R6(t,t.actions,r,a,o,i)}connect(){this.scrollCounter=0}disconnect(){R8(this.actions)}dispatch(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())});let t=e>0?1:-1;this.scrollCounter+=t,this.scrollCounter=Math.min(Math.max(this.scrollCounter,0),this.data.steps);let i=this.scrollCounter/this.data.steps;this.actions.Transition.forEach(e=>e.seek(i)),this.actions.Animation.forEach(e=>e.seek(t)),this.actions.TimelineAnimation.forEach(e=>e.seek(i)),this.actions.Create.forEach(e=>e.dispatchThrottled()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>{e.playFromCurrent()}),this.actions.Animation.forEach(e=>{e.playFromCurrent()}),this.actions.TimelineAnimation.forEach(e=>{e.playFromCurrent()})),this.actions.Create.forEach(e=>e.dispatchThrottled()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},BH=class{constructor(e,t,i,r,a,o,l){this.id=e,this.data=t,this.object=i,this.domElement=o,this.eventManager=l,this.scrollStart=0,this.scrollEnd=0,this.actions=R6(t,t.actions,r,a,l,i)}getStickyParentElement(){let e=this.domElement;for(;e;){if("sticky"===window.getComputedStyle(e).position)return e;e=e.parentElement}return null}computeScrollBounds(){let e=this.getStickyParentElement(),t=e?.parentElement,i=this.domElement.getBoundingClientRect(),r={top:i.top,bottom:i.bottom,left:i.left,right:i.right,width:i.width,height:i.height};if(t){let a=t.getBoundingClientRect(),o=window.getComputedStyle(e),l=parseFloat(o.marginTop)+parseFloat(o.marginBottom),h=parseFloat(o.top),c=parseFloat(o.bottom),d=a.height-l;if(isNaN(h)){if(!isNaN(c)){let e=document.body.clientHeight??window.innerHeight,t=window.innerWidth-(document.documentElement.clientWidth??window.innerWidth);i.bottom===e-c?(r.top+=a.top-i.height+c+t,r.bottom+=a.top-i.height+c+t):i.bottom<e-c&&(r.to
8118p-=d-i.height,r.bottom-=d-i.height)}}else i.top===h?(r.top+=a.top-h,r.bottom+=a.top-h):i.top<0&&(r.top-=d-i.height,r.bottom-=d-i.height)}let a=document.body,o=document.documentElement,l=window.pageYOffset||o.scrollTop||a.scrollTop,h=o.clientTop||a.clientTop||0,c=Math.round(r.top+l-h);if("enter"===this.data.startFrom){let e=window.innerHeight,t=r.height,i=this.data.enterAnchor;this.scrollStart=c-("top"===i?e:"bottom"===i?e-t:e-.5*t)}else this.scrollStart=0;this.scrollStart+=this.data.startOffset??0,this.scrollEnd=this.scrollStart+(this.data.endAfter??400),this.box=r,this.computeScroll({x:window.scrollX,y:window.scrollY})}connect(){this.computeScrollBounds()}disconnect(){R8(this.actions)}handleResize(){this.computeScrollBounds()}get isInvalidBox(){return void 0===this.box||0===this.box.width&&0===this.box.height&&0===this.box.top&&0===this.box.bottom}computeScroll({x:e,y:t}){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())});let i=this.scrollEnd-this.scrollStart,r=Math.min(1,Math.max(0,(t-this.scrollStart)/i));this.actions.Transition.forEach(e=>e.seek(r)),this.actions.Animation.forEach(e=>e.seek(r)),this.actions.TimelineAnimation.forEach(e=>e.seek(r)),this.actions.Create.forEach(e=>e.dispatchThrottled()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatch(e){this.isInvalidBox&&this.computeScrollBounds(),this.computeScroll(e)}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>{e.playFromCurrent()}),this.actions.Animation.forEach(e=>{e.playFromCurrent()}),this.actions.TimelineAnimation.forEach(e=>{e.playFromCurrent()})),this.actions.Create.forEach(e=>e.dispatchThrottled()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},BW=class extends Lq{constructor(e,t){super(e),this.managers=t,this.wheelEventsPerObject=new Map,this.scrollEventsPerObject=new Map,this.isInview=!0,this.handleResize=()=>{[...this.scrollEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>e.handleResize())})},this.onScroll=e=>{if(!this.isInview)return;let t={y:window.scrollY,x:window.scrollX};[...this.scrollEventsPerObject.entries()].forEach(([e,i])=>{e.dispatchEvent({type:"beginEvent",eventName:"Scroll",scroll:t}),i.forEach(e=>e.dispatch(t))})},this.onWheel=e=>{!this.isInview||e.ctrlKey||[...this.wheelEventsPerObject.entries()].forEach(([t,i])=>{t.dispatchEvent({type:"beginEvent",eventName:"Scroll",deltaY:e.deltaY}),i.forEach(t=>t.dispatch(e.deltaY))})},this.onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=LQ(e);r&&"Scroll"===r&&(t.dispatchEvent({type:"beginEvent",eventName:"Scroll"}),this.wheelEventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(i)}))}}connect(){let{page:e,sharedAssets:t,domElement:i,isExport:r}=this.eventContext,a=a=>{if(a.data?.events.length){for(let{id:o,data:l}of a.data.events)if(!l.disabled&&"Scroll"===l.type){if("load"!==l.trigger&&r){let r=new BH(o,l,a,e,t,i,this.managers);this.scrollEventsPerObject.has(a)?this.scrollEventsPerObject.get(a)?.push(r):this.scrollEventsPerObject.set(a,[r])}else{let i=new BG(o,l,a,e,t,this.managers);this.wheelEventsPerObject.has(a)?this.wheelEventsPerObject.get(a)?.push(i):this.wheelEventsPerObject.set(a,[i])}}}};e.traverseEntity(e=>{(e instanceof DO||e instanceof DS)&&e.frame?.traverse(e=>{a(e)}),a(e)}),this.intersectionObserver=new IntersectionObserver(e=>{let t=e[0];t&&(this.isInview=t.isIntersecting)},{root:null}),this.intersectionObserver.observe(this.eventContext.domElement),[...this.wheelEventsPerObject.entries()].forEac
vendor: 1,938 bytes, line 8118
8118h(([e,t])=>{t.forEach(e=>e.connect()),e.addEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>e.connect()),e.addEventListener("userEvent",this.onUserEvent)}),[...this.wheelEventsPerObject.values()].some(e=>e.length)&&(this.domEventsNeeded.add("wheel"),window.addEventListener("wheel",this.onWheel)),[...this.scrollEventsPerObject.values()].some(e=>e.length)&&(this.domEventsNeeded.add("scroll"),window.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.handleResize))}disconnect(){window.removeEventListener("wheel",this.onWheel),window.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.handleResize),this.intersectionObserver.unobserve(this.eventContext.domElement),this.domEventsNeeded.clear(),[...this.wheelEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>e.disconnect()),e.removeEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>e.disconnect()),e.removeEventListener("userEvent",this.onUserEvent)})}},Bq=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.actions=R6(t,t.actions,r,a,o,i)}disconnect(){R8(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}
8118dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(t.interaction instanceof In?t.interaction.audioPlayer?.play():t.interaction instanceof Io&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let i=t.interaction.data.triggerAfter??"autoplay";i===e&&(t.interaction instanceof Le?t.interaction.play("autoplay"===i):t.interaction instanceof Lt&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(i=>{(i.interaction.data.triggerAfter??"autoplay")==="autoplay"&&i.interaction instanceof Le&&t.push(i.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{e.interaction instanceof Le&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}
8118),this.actions.Audio.forEach(e=>{e.interaction instanceof In?e.interaction.audioPlayer?.play():e.interaction instanceof Io&&e.interaction.dispatch()}),this.actions.Video.forEach(e=>{e.interaction instanceof Le?e.interaction.play():e.interaction instanceof Lt&&e.interaction.dispatch()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()})}},BX=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>
vendor: 4,155 bytes, line 8118
8118{e.actions.Audio.forEach(e=>{e.interaction instanceof In&&e.interaction.audioPlayer?.play()}),e.actions.Video.forEach(e=>{let t=e.interaction.data.triggerAfter??"autoplay";e.interaction instanceof Le&&e.interaction.play("autoplay"===t)}),e.actions.Particles.forEach(e=>{e.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("autoplay")})})},this.seekVideos=async e=>{let t=[];[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.data.visible&&r.forEach(i=>{t.push(i.seekVideos(e))})}),await Promise.all(t)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>{e.pauseVideos()})})},this.onUserEvent=({eventName:e,target:t,reverse:i})=>{if(!e||!t)return;let r=LQ(e);r&&"Start"===r&&(t instanceof PU||t.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(i)}),this.eventsAfterPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(i)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,i=i=>{if(i.data?.events.length)for(let{id:r,data:a}of i.data.events){if(a.disabled||"Start"!==a.type)continue;let o=new Bq(r,a,i,t,e,this.eventManager);(o.actions.Transition.length||o.actions.TimelineAnimation.length||o.actions.Animation.length||o.actions.SwitchCamera.length||o.actions.Create.length||o.actions.Destroy.length||o.actions.SceneTransition.length||o.actions.Reset.length||o.actions.SetVariable.length||o.actions.DynamicVariablePlay.length||o.actions.ClearLocalStorage.length||o.actions.UserAPI.length)&&(this.eventsPerObject.has(i)?this.eventsPerObject.get(i)?.push(o):this.eventsPerObject.set(i,[o])),o.actions.Audio.length&&(this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(o):this.eventsAfterPerObject.set(i,[o])),o.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(o):this.eventsAfterPerObject.set(i,[o])),o.actions.Particles.length&&(this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(o):this.eventsAfterPerObject.set(i,[o]))}};if(t.traverseEntity(e=>{(e instanceof DO||e instanceof DS)&&e.frame?.traverse(e=>{i(e)}),i(e)}),[...this.eventsAfterPerObject.values()].some(e=>e.length)){if(0===this.eventManager.activateCount){let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.addEventListener("pointerdown",this.onMouseDown,{once:!0}),i.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),i.addEventListener("pointerdown",this.onAny),i.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>e.dispatch()),e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.removeEventListener("pointerdown",this.onMouseDown),i.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},BY=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=R6(t,t.actions,r,a,o,i),this.target=t.target}disconnect(){R8(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(e
8118=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(e??!1)}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},BQ=class extends Lq{constructor(e,t,i,r,a){super(e),this.sharedVariables=t,this.eventManager=i,this.needsMouse=r,this.needsRaycast=a,this.dynamicVars=[],this.variablesToWatch=[],this.prevMouseProperty=null,this.prevRaycastProperty=null,this.pauseTime=0,this.isOutOfFocus=!1,this.events=[],this.onFrame=e=>{let t=this.eventContext.sharedAssets;if(this.rafId=window.requestAnimationFrame(this.onFrame),this.isOutOfFocus)return;let i=new Date,r=[],a=[];for(let e=0;e<this.propertiesToWatch.length;e++){let{objectId:t,property:i,prevValue:r}=this.propertiesToWatch[e],o=this.eventContext.scene.find(t),l=gi.propertyPaths[i];if("width"===l[0]||"height"===l[0]||"depth"===l[0])o=o.geometry.userData.parameters[l[0]];else for(let e=0;e<l.length;e++)o=o[l[e]];null===r?this.propertiesToWatch[e].prevValue=o instanceof iD?o.clone():o:(o instanceof iD?o.equals(r):r===o)||(a.push({objId:t,property:i}),o instanceof iD?this.propertiesToWatch[e].prevValue.copy(o):this.propertiesToWatch[e].prevValue=o)}for(let e=0;e<this.variablesToWatch.length;e++){let{id:i,prevValue:a}=this.variablesToWatch[e],o=t.getVariable(i);o!==a&&(r.push(i),this.variablesToWatch[e].prevValue=o)}for(let a=0;a<this.dynamicVars.length;a++){let{id:o,expectedTime:l,last:h,data:c,timerSeconds:d,startValue:p}=this.dynamicVars[a],f=1e3;if(("timer"===c.dynamicVariableType||"stopwatch"===c.dynamicVariableType)&&"number3decimal"===c.format?f=1:"counter"===c.dynamicVariableType?f=c.updateInterval:"random"===c.dynamicVariableType&&(f=c.isStatic?1/0:c.updateInterval),-1===l){this.dynamicVars[a].last=e,this.dynamicVars[a].expectedTime=e+f;continue}if(!(("Stopped"===t.getDynamicVariablePlayState(o)||"Restarted"===t.getDynamicVariablePlayState(o))&&(this.dynamicVars[a].last=e,this.dynamicVars[a].expectedTime=e+f,"counter"===c.dynamicVariableType&&t.getVariable(o)!==p&&(t.updateVariable(o,p),this.eventManager.requestRender()),("timer"===c.dynamicVariableType||"stopwatch"===c.dynamicVariableType)&&this.dynamicVars[a].timerSeconds!==p&&(this.dynamicVars[a].timerSeconds=p,t.updateVariable(o,xd.getFormattedTimerTime(p,c)),this.eventManager.requestRender()),"Restarted"===t.getDynamicVariablePlayState(o)&&t.setDynamicVariablePlayState(o,"Playing"),"Stopped"===t.getDynamicVariablePlayState(o)))){if("Paused"===t.getDynamicVariablePlayState(o)){void 0===this.dynamicVars[a].deltaToExpectedTime&&(this.dynamicVars[a].deltaToExpectedTime=Math.max(this.dynamicVars[a].expectedTime-e,0)),this.dynamicVars[a].last=e-(f-this.dynamicVars[a].deltaToExpectedTime),this.dynamicVars[a].expectedTime=e+this.dynamicVars[a].deltaToExpectedTime;continue}if(this.dynamicVars[a].deltaToExpectedTime=void 0,e>=l){if(this.dynamicVars[a].last=e,this.dynamicVars[a].expectedTime+=f,"random"===c.dynamicVariableType){let e=c.min+Math.random()*(c.max-c.min),i=c.decimals;e=Math.round(e*Math.pow(10,i))/Math.pow(10,i),t.updateVariable(o,e),r.push(o),this.eventManager.requestRender()}else if("counter"===c.dynamicVariableType){let e=t.getVariable(o),i=t.getDynamicVariableToggleIsForward(o)??!0,a=t.getVariable(o)+c.increment*(i?1:-1);c.hasEnd&&((a=c.increment>0?t8.clamp(a,p,c.endValue):t8.clamp(a,c.endValue,p))===p&&t.setDynamicVariableToggleIsForward(o,void 0),c.repeat?a===c.endValue&&(a=p):(a===p||a===c.endValue)&&t.setDynamicVariablePlayState(o,"Paused")),a!==e&&(r.push(o),t.updateVariable(o,a),this.eventManager.requestRender())}else if("time"===c.dynamicVariableType){let e=t.getVariable(o),a=Ml(i,c);if("object"==typeof e&&"textValue"in e&&"object"==typeof a&&"textValue"in a){if(Array.isArray(e.textValue)&&Array.isArray(a.textValue)){if(e.textValue.every((e,t)=>e===a.textValue[t]))continue}else if(e.textValue===a.textValue)continue}else if(e===a)continue;t.updateVariable(o,a),r.push(o),this.eventManager.requestRender()}else{let i=xn.isTextValue(c.endValue)?BK(c.endValue.textValue):c.endValue,l=t.getDynamicVariableToggleIsForward(o)??!0,f=d+(e-h)/1e3*("timer"===c.dynamicVariableType?-1:1)*(l?1:-1);f=Math.max(f,0),c.hasEnd&&((f="stopwatch"===c.dynamicVariableType?t8.clamp(f,p,i):t8.clamp(f,i,p))===p&&t.setDynamicVariableToggleIsForward(o,void 0),c.repeat?Math.abs(f-i)<("number3decimal"===c.format?1e-4:.1)&&(f=p):(Math.abs(f-p)<("number3decimal"===c.format?1e-4:.1)||Math.abs(f-i)<("number3decimal"===c.format?1e-4:.1))&&t.setDynamicVariablePlayState(o,"Paused")),f!==d&&(r.push(o),this.dynamicVars[a].timerSeconds=f,t.updateVariable(o,xd.getFormattedTimerTime(f,c)),this.eventManager.requestRender())}}}}let o=!1;t.mouseProperty!==this.prevMouseProperty&&(this.prevMouseProperty=t.mouseProperty,o=!0);let l=!1;t.raycastProperty!==this.prevRaycastProperty&&(this.prevRaycastProperty=t.raycastProperty,l=!0),this.events.forEac
vendor: 1,054 bytes, line 8118
8118h(e=>{(r.includes(e.data.variableId)||a.find(t=>t.objId===e.data.objectId&&t.property===e.data.property)||"mouseProperty"===e.data.variableId&&o||"raycastProperty"===e.data.variableId&&l)&&(e.dispatch(),this.eventManager.requestRender())})},this.onBlur=()=>{this.pause()},this.onFocus=()=>{this.resume()}}pause(){this.isOutOfFocus||(this.isOutOfFocus=!0,this.pauseTime=Date.now())}resume(){if(!this.isOutOfFocus)return;this.isOutOfFocus=!1;let e=Date.now()-this.pauseTime;for(let t=0;t<this.dynamicVars.length;t++)this.dynamicVars[t].last+=e,this.dynamicVars[t].expectedTime+=e}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"VariableChange"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new BZ(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.propertiesToWatch=this.events.filter(e=>"objectProperty"===e.data.variableId&&null!==e.data.objectId).map(e=>({objectId:e.data.objectId,property:e.data.property,prevValue:null}));let e=this.eventContext.sharedAssets;
8118this.sharedVariables.forEach(({id:t,data:i})=>{let r;if(!("dynamicVariableType"in i)){this.events.find(e=>e.data.variableId===t)&&this.variablesToWatch.push({id:t,prevValue:e.getVariable(t)});return}if("timer"===i.dynamicVariableType||"stopwatch"===i.dynamicVariableType){let e;if(xn.isTextValue(i.value)&&Array.isArray(i.value.textValue)){let t=i.value.textValue;e=3===t.length?t[2]+60*t[1]+3600*t[0]:t[1]+60*t[0]}else e=i.value;r=e,this.dynamicVars.push({id:t,last:-1,expectedTime:-1,data:i,timerSeconds:e,startValue:r})}else"time"===i.dynamicVariableType&&e.updateVariable(t,Ml(new Date,i)),"counter"===i.dynamicVariableType&&(r=xn.isTextValue(i.value)?BK(i.value.textValue):i.value),this.dynamicVars.push({id:t,last:-1,expectedTime:-1,data:i,startValue:r})}),this.rafId=window.requestAnimationFrame(this.onFrame),window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus)}disconnect(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),this.rafId&&(window.cancelAnimationFrame(this.rafId),this.rafId=void 0),this.events.forEach(e=>e.dispose())}},BZ=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.actions=R6(t,t.actions,r,a,o,i)}dispatch(){let e=this.actions;
vendor: 14,179 bytes, lines 8118-8179
8118e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.TimelineAnimation.forEach(e=>e.dispatchConditional()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}dispose(){R8(this.actions)}};function BK(e){return 3===e.length?e[2]+60*e[1]+3600*e[0]:e[1]+60*e[0]}var BJ,B$,B0,B1=` 8119(async function() { 8120 const [wasmImport, wasmBinary] = await Promise.all([ 8121 import('https://unpkg.com/@splinetool/[email protected]/build/' + 'navmesh.js'), 8122 fetch('https://unpkg.com/@splinetool/[email protected]/build/' + 'navmesh.wasm').then((res) => res.arrayBuffer()), 8123 ]); 8124 const wasmModule = wasmImport.default; 8125 self.module = await wasmModule({ wasmBinary }); 8126 postMessage('ready'); 8127})(); 8128`,B2=` 8129(async function() { 8130 const [wasmImport, wasmBinary] = await Promise.all([ 8131 import(self.location.origin + '/_libraries/navmesh.js'), 8132 fetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()), 8133 ]); 8134 const wasmModule = wasmImport.default; 8135 self.module = await wasmModule({ wasmBinary }); 8136 postMessage('ready'); 8137})(); 8138`,B3=` 8139 8140onmessage = function(messageEvent) { 8141 const meshData = messageEvent.data; 8142 const positions = meshData[0]; 8143 const offset = meshData[1]; 8144 const indices = meshData[2]; 8145 const indicesLength = meshData[3]; 8146 const parameters = meshData[4]; 8147 8148 const module = self.module; 8149 const rc = new module.rcConfig(); 8150 rc.cs = parameters.cs; 8151 rc.ch = parameters.ch; 8152 rc.borderSize = parameters.borderSize ? parameters.borderSize : 0; 8153 rc.tileSize = parameters.tileSize ? parameters.tileSize : 0; 8154 rc.walkableSlopeAngle = parameters.walkableSlopeAngle; 8155 rc.walkableHeight = parameters.walkableHeight; 8156 rc.walkableClimb = parameters.walkableClimb; 8157 rc.walkableRadius = parameters.walkableRadius; 8158 rc.maxEdgeLen = parameters.maxEdgeLen; 8159 rc.maxSimplificationError = parameters.maxSimplificationError; 8160 rc.minRegionArea = parameters.minRegionArea; 8161 rc.mergeRegionArea = parameters.mergeRegionArea; 8162 rc.maxVertsPerPoly = parameters.maxVertsPerPoly; 8163 rc.detailSampleDist = parameters.detailSampleDist; 8164 rc.detailSampleMaxError = parameters.detailSampleMaxError; 8165 8166 if (!self.navMesh) { 8167 self.navMesh = new module.NavMesh(); 8168 } 8169 self.navMesh.build(positions, offset, indices, indicesLength, rc); 8170 8171 const navmeshData = navMesh.getNavmeshData(); 8172 const arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size); 8173 const ret = new Uint8Array(navmeshData.size); 8174 ret.set(arrView); 8175 navMesh.freeNavmeshData(navmeshData); 8176 8177 postMessage(ret); 8178} 8179`,B4={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};pN.then(e=>{BJ=e,B$=new e.Vec3,B0=new e.Vec3});var B5=new iD,B6=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=e=>{if(1!==px.length)return;let{raycaster:t,page:i}=this.eventContext;this.eventContext.updateRaycaster(e);let r=i.raycastWithClones(t);if(0!==r.length){if(this.gameControl){let e=B5.copy(this.gameControl.colliderWorldPosition);e.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(e,r[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(e,t)=>i=>{let r;if(i instanceof EJ){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;r=i.object}else if(i instanceof bu)r=i.object;else if(r=i,r.dataPatched.cloner?.disabled===!1&&r.dataPatched.cloner?.hideBase&&r.dataPatched.physics?.fusedBody!==!0)return!0;if(t&&!r.userData.navmesh)return;let a=r.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;i.updateMatrixWorldSVD();let o=zL(a),l=r.userData.hasDestroy,h=r.userData.hasDrag,c=!1,d=!1;for(let e of a.events)!0!==e.data.disabled&&("GameControl"===e.data.type?c=!0:"Follow"===e.data.type&&(d=!0));if(c||o||d||l||h)return!0;if(this.usePhysics&&a.physics?.rigidBody==="dynamic"){if(this.usePhysics&&a.physics?.fusedBody)return!0}else if("geometry"in i&&i.geometry&&e.push(LR(i.geometry,i.matrixWorld)),this.usePhysics&&a.physics?.fusedBody)return i.traverseObject((t,i)=>{let r;if(0===i)return;if(t instanceof EJ){if(!t.objectForSample)return!0===t.object.dataPatched.physics.fusedBody&&"dynamic"===t.object.dataPatched.physics.rigidBody||void 0;if(t.objectForSample.dataPatched.physics.fusedBody)return;r=t.object}else if(t instanceof bu)r=t.object;else if(r=t,t.dataPatched.cloner?.hideBase)return!0;let a=r.dataPatched;if(!a.visible&&a.physics?.enabled!==!0)return!0;"geometry"in t&&t.geometry&&e.push(LR(t.geometry,t.matrixWorld))}),!0},this.traverseNoPhysics=(e,t)=>i=>{let r;if(i instanceof EJ)return;let a=(r=i instanceof bu?i.object:i).dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;if(t&&!r.userData.navmesh)return;let o=i.geometry,l=!0===r.userData.hasDestroy,h=!0===r.userData.hasDrag;if(zL(a)||l||h||r.dataPatched.events.some(e=>!0!==e.data.disabled&&"GameControl"===e.data.type))return!0;o&&e.push(LR(o,i.matrixWorld))},this.navmeshWasm=BJ,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?B1:B2)+B3])),this._worker=new Worker(this._workerURL)}init(e,t,i){this.gameControl=t,this.eventContext=i,this.setDefaultQueryExtent(new iD().setScalar(e.ch*e.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,e,e=>{this.buildFromNavmeshData(e.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(e,t,i){t.objects.forEach(t=>{let i=e.scene.find(t);i.traverseEntity(e=>{e.userData.navmesh=!0}),i.cloner?.traverseObject(e=>{e.userData.navmesh=!0})});let r=[],a=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(r,"custom"===t.zones);if(e.traverseChildren(a),t.objects.forEach(t=>{let i=e.scene.find(t);i.traverseEntity(e=>{e.userData.navmesh=void 0}),i.cloner?.traverseObject(e=>{e.userData.navmesh=void 0})}),0===r.length)return!1;let o=v3(r),{positions:l,triIndices:h}=_t(o.getAttribute("position"),o.getIndex());return this._worker.postMessage([l,l.length/3,h,h.length,{...B4,...t}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let e,t,i=this.navMesh.getDebugNavMesh(),r=i.getTriangleCount(),a=new Uint32Array(3*r),o=new Float32Array(9*r);for(e=0;e<3*r;e++)a[e]=e;for(e=0;e<r;e++)for(t=0;t<3;t++){let r=i.getTriangle(e).getPoint(t);o[9*e+3*t+0]=r.x,o[9*e+3*t+1]=r.y,o[9*e+3*t+2]=r.z}let l=new rQ;return l.setIndex(new rN(a,1)),l.setAttribute("position",new rN(o,3)),l}getClosestPoint(e){return B$.x=e.x,B$.y=e.y,B$.z=e.z,this.navMesh.getClosestPoint(B$)}getClosestPointToRef(e,t){B$.x=e.x,B$.y=e.y,B$.z=e.z;let i=this.navMesh.getClosestPoint(B$);t.set(i.x,i.y,i.z)}getRandomPointAround(e,t){return B$.x=e.x,B$.y=e.y,B$.z=e.z,this.navMesh.getRandomPointAround(B$,t)}getRandomPointAroundToRef(e,t,i){B$.x=e.x,B$.y=e.y,B$.z=e.z;let r=this.navMesh.getRandomPointAround(B$,t);i.set(r.x,r.y,r.z)}moveAlong(e,t){return B$.x=e.x,B$.y=e.y,B$.z=e.z,B0.x=t.x,B0.y=t.y,B0.z=t.z,this.navMesh.moveAlong(B$,B0)}moveAlongToRef(e,t,i){return B$.x=e.x,B$.y=e.y,B$.z=e.z,B0.x=t.x,B0.y=t.y,B0.z=t.z,this.navMesh.moveAlong(B$,B0)}computePath(e,t){let i=this.getClosestPoint(t);if(B0.x=i.x,B0.y=i.y,B0.z=i.z,Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)+Math.pow(t.z-i.z,2))>this.getDefaultQueryExtent().y)return[];this.getClosestPoint(e);let r=this.navMesh.computePath(B$,B0),a=r.getPointCount(),o=[];for(let e=0;e<a;e++){let t=r.getPoint(e);o.push(new iD(t.x,t.y,t.z))}return o}createCrowd(e,t){return new B8(this,e,t)}setDefaultQueryExtent(e){B$.x=e.x,B$.y=e.y,B$.z=e.z,this.navMesh.setDefaultQueryExtent(B$)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(e){let t=e.length*e.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(t),r=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,t);r.set(e);let a=new this.navmeshWasm.NavmeshData;a.dataPointer=r.byteOffset,a.size=e.length,this.navMesh.buildFromNavmeshData(a),this.navmeshWasm._free(r.byteOffset)}getNavmeshData(){let e=this.navMesh.getNavmeshData(),t=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,e.dataPointer,e.size),i=new Uint8Array(e.size);return i.set(t),this.navMesh.freeNavmeshData(e),i}getDefaultQueryExtentToRef(e){let t=this.navMesh.getDefaultQueryExtent();e.set(t.x,t.y,t.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(e,t,i){return B$.x=e.x,B$.y=e.y,B$.z=e.z,this.navMesh.addCylinderObstacle(B$,t,i)}addBoxObstacle(e,t,i){return B$.x=e.x,B$.y=e.y,B$.z=e.z,B0.x=t.x,B0.y=t.y,B0.z=t.z,this.navMesh.addBoxObstacle(B$,B0,i)}removeObstacle(e){this.navMesh.removeObstacle(e)}isSupported(){return void 0!==this.navmeshWasm}},B8=class{constructor(e,t,i){this.navmeshWasmWrapper=e,this.transforms=[],this.agents=[],this.reachRadii=[],this._agentDestinationArmed=[],this._agentDestination=[],this.crowd=new this.navmeshWasmWrapper.navmeshWasm.Crowd(t,i,this.navmeshWasmWrapper.navMesh.getNavMesh())}onReachTarget(e,t){}addAgent(e,t,i){let r=new this.navmeshWasmWrapper.navmeshWasm.dtCrowdAgentParams;r.radius=t.radius,r.height=t.height,r.maxAcceleration=t.maxAcceleration,r.maxSpeed=t.maxSpeed,r.collisionQueryRange=t.collisionQueryRange,r.pathOptimizationRange=t.pathOptimizationRange,r.separationWeight=t.separationWeight,r.updateFlags=7,r.obstacleAvoidanceType=0,r.queryFilterType=0,r.userData=0;let a=this.crowd.addAgent(new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z),r);return this.transforms.push(i),this.agents.push(a),this.reachRadii.push(t.reachRadius?t.reachRadius:t.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new iD(0,0,0)),a}getAgentPosition(e){return this.crowd.getAgentPosition(e)}getAgentPositionToRef(e,t){let i=this.crowd.getAgentPosition(e);t.set(i.x,i.y,i.z)}getAgentVelocity(e){return this.crowd.getAgentVelocity(e)}getAgentVelocityToRef(e,t){let i=this.crowd.getAgentVelocity(e);t.set(i.x,i.y,i.z)}getAgentNextTargetPath(e){return this.crowd.getAgentNextTargetPath(e)}getAgentNextTargetPathToRef(e,t){let i=this.crowd.getAgentNextTargetPath(e);t.set(i.x,i.y,i.z)}getAgentState(e){return this.crowd.getAgentState(e)}overOffmeshConnection(e){return this.crowd.overOffmeshConnection(e)}agentGoto(e,t){this.crowd.agentGoto(e,new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z));let i=this.agents.indexOf(e);i>-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(t.x,t.y,t.z))}agentTeleport(e,t){this.crowd.agentTeleport(e,new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z))}updateAgentParameters(e,t){let i=this.crowd.getAgentParameters(e);void 0!==t.radius&&(i.radius=t.radius),void 0!==t.height&&(i.height=t.height),void 0!==t.maxAcceleration&&(i.maxAcceleration=t.maxAcceleration),void 0!==t.maxSpeed&&(i.maxSpeed=t.maxSpeed),void 0!==t.collisionQueryRange&&(i.collisionQueryRange=t.collisionQueryRange),void 0!==t.pathOptimizationRange&&(i.pathOptimizationRange=t.pathOptimizationRange),void 0!==t.separationWeight&&(i.separationWeight=t.separationWeight),this.crowd.setAgentParameters(e,i)}removeAgent(e){this.crowd.removeAgent(e);let t=this.agents.indexOf(e);t>-1&&(this.agents.splice(t,1),this.transforms.splice(t,1),this.reachRadii.splice(t,1),this._agentDestinationArmed.splice(t,1),this._agentDestination.splice(t,1))}getAgents(){return this.agents}update(e){if(this.navmeshWasmWrapper.navMesh.update(),!(e<=.001)){if(1/60<=.001)this.crowd.update(e);else{let t=Math.floor(e/(1/60));t>10&&(t=10),t<1&&(t=1);let i=e/t;for(let e=0;e<t;e++)this.crowd.update(i)}for(let e=0;e<this.agents.length;e++){let t=this.agents[e],i=this.getAgentPosition(t);if(this.transforms[e].copy(i),this._agentDestinationArmed[e]){let r=i.x-this._agentDestination[e].x,a=i.z-this._agentDestination[e].z,o=this.reachRadii[e],l=this._agentDestination[e].y-this.reachRadii[e],h=this._agentDestination[e].y+this.reachRadii[e],c=r*r+a*a;i.y>l&&i.y<h&&c<o*o&&(this.onReachTarget(t,this._agentDestination[e]),this._agentDestinationArmed[e]=!1)}}}}setDefaultQueryExtent(e){let t=new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z);this.crowd.setDefaultQueryExtent(t)}getDefaultQueryExtent(){return this.crowd.getDefaultQueryExtent()}getDefaultQueryExtentToRef(e){let t=this.crowd.getDefaultQueryExtent();e.set(t.x,t.y,t.z)}getCorners(e){let t,i=this.crowd.getCorners(e),r=i.getPointCount(),a=[];for(t=0;t<r;t++){let e=i.getPoint(t);a.push(new iD(e.x,e.y,e.z))}return a}dispose(){this.crowd.destroy()}},B9={type:"change"},B7={type:"start"},ze={type:"end",nonOrbit:!0},zt={type:"end",nonOrbit:!1},zi={type:"end",isZoom:!0,nonOrbit:!0},zr={type:"end",changed:!1},zs={type:"cameraAnimatingInTimeline"},za=new iP,zn=new t9,zo=2*Math.PI,zl=new iD,zh=new t9,zc=new iD,zd=new iP,zu=new i6,zp={type:"requestRender"},zf=class extends tX{constructor(e,t,i={isPlayMode:!1,isExport:!1},r){super(),this.object=e,this.domElement=t,this.options=i,this.timelineState=r,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,tG.DOLLY_ROTATE,tG.PAN],this.offset=new iD,this.eye=new iD,this.lastPosition=new iD,this.lastQuaternion=new iP,this.current=ne
vendor: 4,339 bytes, line 8179
8179w t9,this.overShoot=new t9,this.overRatio=new t9,this.spherical=new lX,this.sphericalDelta=new lX,this.panOffset=new iD,this.panLeftV=new iD,this.panUpV=new iD,this.panV=new iD,this.rotateStart=new t9,this.rotateEnd=new t9,this.rotateDelta=new t9,this.panStart=new t9,this.panEnd=new t9,this.panDelta=new t9,this.dollyStart=new t9,this.dollyEnd=new t9,this.dollyDelta=new t9,this.rotationRangeFactor=new t9,this.panRangeFactor=new t9,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=e=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=e.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(zc,zd,zl),this.offset.copy(zc).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&-1===this.state&&this.rotateLeft((!0===this.autoRotateClockwise?1:-1)*this.getAutoRotationAngle()),0!==this.rotationLimitsMode&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),2!==this.rotationLimitsMode&&(this.spherical.phi+=this.sphericalDelta.phi),(1!==this.rotationLimitsMode||!0===this.autoRotate)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),0!==this.panLimitsMode&&(this.target.applyQuaternion(za.copy(zd).invert()),this.panOffset.applyQuaternion(za),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(zd),this.panOffset.applyQuaternion(zd)),2===this.panLimitsMode&&(this.panOffset.y=0),1===this.panLimitsMode&&(this.panOffset.x=0),-1!==this.state||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),zc.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(zu.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(zu));let e=this.spherical.phi%zo;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(rw.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),e>0&&e>Math.PI||e<0&&e>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let e=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-e,this.sphericalDelta.phi*=1-e}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8){this.dispatchEvent(B9),this.object.dispatchEvent(zp),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.isCurrentlyDamping=!0;return}
vendor: 5,234 bytes, line 8179
8179this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=e=>{!1!==this.enabled&&("touch"===e.pointerType||"pen"===e.pointerType&&pm?this.onPointerDownTouch(e):this.onPointerDownMouse(e),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(B7),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),e.stopPropagation(),"touch"===e.pointerType||"pen"===e.pointerType&&pm||this.domElement.setPointerCapture(e.pointerId)))},this.onPointerLeave=e=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,zl.subVectors(this.position0,this.target0),this.spherical.setFromVector3(zl),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):2===this.hoverRotatePanMode&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=e},this.onPointerEnter=e=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?zh.set(e.clientX-this.domElement.clientWidth/2,e.clientY-this.domElement.clientHeight/2):zh.set(e.clientX-this.pointerLeaveEvent.clientX,e.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(zh).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(zn,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(e.clientX,e.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(zh).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(e.clientX,e.clientY)),this.update()},this.onPointerMove=e=>{if(this.timelineState?.isPlayingCameraAnimation){this.dispatchEvent(zs);return}!1!==this.enabled&&(this.checkRaycastLock()||("touch"===e.pointerType||"pen"===e.pointerType&&pm?this.onPointerMoveTouch(e):this.onPointerMoveMouse(e),e.stopPropagation()))},this.onPointerUp=e=>{this.isPointerDown=!1,0===px.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),px.length>1&&e.preventDefault(),this.hasChange?this.dispatchEvent(0===this.state?zt:ze):this.dispatchEvent(zr),this.state=-1,e&&(e.stopPropagation(),"touch"===e.pointerType||"pen"===e.pointerType&&pm||this.domElement.releasePointerCapture(e.pointerId))},this.onPointerDownMouse=e=>{switch(this.useKeyEvents?this.mouseButtons[e.button]:this.mouseButtonsPlay[e.button]){case 0:if(!0!==e.altKey||e.shiftKey||py(e)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(e),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2;break;case 3:if(py(e)||e.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(e),this.state=0}break;case 5:if(py(e)||e.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(e),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(e),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=e=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(e);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(e);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(e)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=e=>{switch(px.length>1&&e.preventDefault(),this.touches[px.length-1]){case tG.ROTATE:if(!1===this.enableRotate){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case tG.PAN:if(!1===this.enablePan){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case tG.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case tG.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=e=>{switch(px.length>1&&e.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(e),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(e),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(e),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=u8(()=>{this.zoomChanged?this.dispatchEvent(zi):this.dispatchEvent(ze),this.zoomChanged=!1},33),this.onMouseWheel=e=>{if(!(!1===this.enabled||!1===this.enableZoom&&!1===this.enablePan)&&!this.checkRaycastLock()){if
8179(this.options.isExport||this.domElement.clientHeight!==document.body.clientHeight||this.domElement.clientWidth!==document.body.clientWidth||e.preventDefault(),this.dispatchEvent(B7),this.timelineState?.isPlayingCameraAnimation){this.dispatchEvent(zs);return}this.handleMouseWheel(e),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=e=>{if(e.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!pp){if(this.timelineState?.isPlayingCameraAnimation){this.dispatchEvent(zs);return}if("gesturechange"===e.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(B7),e.scale>this.prevScale?this.dollyIn(this.getZoomScale()):e.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=e.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(ze)}},this.onContextMenu=e=>{e.preventDefault()},this.onTouchEnd=e=>{e.preventDefault()},this.onKeyDown=e=>{!1!==this.enabled&&(this.key=e.key," "===e.key&&this.dispatchEvent(B7))},this.onKeyUp=e=>{!1!==this.enabled&&(this.key=void 0,-1!==this.state&&"Alt"===e.key&&this.onPointerUp(px[0])," "===e.key&&this.dispatchEvent(ze))},this.onPointerHover=e=>{"mouse"!==e.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverSho
vendor: 8,296 bytes, line 8179
8179ot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(e,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(e,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=e=>{e.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.offset.copy(this.object.position).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(e){"start"===e.type?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(e)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(e){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=e,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let e=this.useWindowEvents?window:this.domElement;e.addEventListener("pointerleave",this.onPointerLeave),e.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(e,t){this.rotateFactor=e.rotationSpeed??1,this.setEnableDampingSpeed(e.enableDamping),this.enablePan=e.enablePan,this.enableZoom=e.enableZoom,this.enableRotate=e.enableRotate,this.rotationLimitsMode=e.rotationLimitsMode,this.thetaIsFree=e.rotationHorizontalOffset.min===e.rotationHorizontalOffset.max&&e.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=e.rotationVerticalOffset.min===e.rotationVerticalOffset.max&&e.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=e.panLimitsMode,this.panSoftLimit=e.panSoftLimit,this.rotationSoftLimit=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,this.hoverRotateDamping=e.hoverRotateDamping??this.dampingFactor,this.useWindowEvents="window"===t,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=e.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,this.minZoom=e.zoomLimits.min,this.maxZoom=Math.max(e.zoomLimits.min,e.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed,this.autoRotateClockwise=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(za.copy(this.object.quaternion).invert());this.minV=-e.panVerticalOffset.min+r.y,this.maxV=e.panVerticalOffset.max+r.y,this.minH=-e.panHorizontalOffset.min+r.x,this.maxH=e.panHorizontalOffset.max+r.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=zm(this.spherical.phi-e.rotationVerticalOffset.min),this.maxPhi=zm(this.spherical.phi+e.rotationVerticalOffset.max),this.minTheta=zm(zm(this.spherical.theta)-e.rotationHorizontalOffset.min),this.maxTheta=zm(zm(this.spherical.theta)+e.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===e.orbitTouches&&(this.touches[0]=tG.ROTATE),1===e.panTouches&&(this.touches[0]=tG.PAN),2===e.orbitTouches&&(this.touches[1]=tG.DOLLY_ROTATE),2===e.panTouches&&(this.touches[1]=tG.DOLLY_PAN),3===e.orbitTouches&&(this.touches[2]=tG.ROTATE),3===e.panTouches&&(this.touches[2]=tG.PAN),this.isTouchZoom=e.isTouchZoom,this.resetHoverEffectOnPointerLeave=e.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let e=this.useWindowEvents?window:this.domElement;e.addEventListener("pointerleave",this.onPointerLeave),e.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(e,t,i,r,a,o,l,h){let c,d,p;this.overShoot.set(0,0),e instanceof iD?(c=e.x,d=e.y,this.current.set(this.target.x,this.target.y),p=!0):(c=e.theta,d=e.phi,this.current.set(zm(this.spherical.theta),zm(this.spherical.phi)),p=!1),0===i&&(this.current.x+=c,this.current.y+=d),(3===t||2===t)&&(!p&&this.isThetaFlipped?this.current.x>r&&this.current.x<0?this.overShoot.x=r-this.current.x:this.current.x<a&&this.current.x>0&&(this.overShoot.x=a-this.current.x):this.current.x>r?this.overShoot.x=r-this.current.x:this.current.x<a&&(this.overShoot.x=a-this.current.x)),(3===t||1===t)&&(this.current.y>o?this.overShoot.y=o-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y)),p||(this.overShoot.x=zm(this.overShoot.x),this.overShoot.y=zm(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(h),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),1===i&&(this.overRatio.x=zg(Math.abs(this.overRatio.x)),this.overRatio.y=zg(Math.abs(this.overRatio.y))),this.isPointerDown||1===i?2===i&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(c*this.overShoot.x<0&&!this.thetaIsFree&&(c*=1-this.overRatio.x),d*this.overShoot.y<0&&!this.phiIsFree&&(d*=1-this.overRatio.y)):2===i&&(!p&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||p&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(c=.05*this.overShoot.x),this.phiIsFree||(d=.05*this.overShoot.y),p?this.isPanOverShoot=!0:this.isRotateOverSho
8179ot=!0):p?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(c+=this.overShoot.x,d+=this.overShoot.y),e instanceof iD?(e.x=c,e.y=d):(this.thetaIsFree||(e.theta=c),this.phiIsFree||(e.phi=d))}setEnableDampingSpeed(e){this.enableDamping=e,this.rotateSpeed=(!0===e?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(e){this.sphericalDelta.theta-=e}rotateUp(e){this.sphericalDelta.phi-=e}panLeft(e,t){this.panLeftV.setFromMatrixColumn(t,0),this.panLeftV.multiplyScalar(-e),this.panOffset.add(this.panLeftV)}panUp(e,t){this.panUpV.setFromMatrixColumn(t,1),this.panUpV.multiplyScalar(e),this.panOffset.add(this.panUpV)}pan(e,t){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let r=this.object.position;this.panV.copy(r).sub(this.target);let a=this.panV.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*a/i.clientHeight,this.object.matrixWorld),this.panUp(2*t*a/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(B9)}dollyOut(e){this.object.isPerspectiveCamera?this.scale/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(B9)}dollyIn(e){this.object.isPerspectiveCamera?this.scale*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(B9)}setZoom(e){if(this.dispatchEvent(B7),this.object.isPerspectiveCamera){let t=this.initialSphericalRadius/e/this.spherical.radius;this.scale=t}else this.object.isOrthographicCamera&&(this.object.zoom=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(ze)}handleMouseDownRotate(e){this.rotateStart.set(e.clientX,e.clientY)}handleMouseDownDolly(e){this.dollyStart.set(e.clientX,e.clientY)}handleMouseDownPan(e){this.panStart.set(e.clientX,e.clientY)}handleMouseMoveRotate(e,t=1){void 0!==e.movementX?this.rotateDelta.set(e.movementX,e.movementY):(this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*t).rotateAround(zn,-this.object.angleOffsetFromUp);let i=this.domElement,r=this.useWindowEvents?window.innerHeight:i.clientHeight,a=2*Math.PI*this.rotateDelta.x/r,o=2*Math.PI*this.rotateDelta.y/r;this.rotateLeft(a),this.rotateUp(o),this.update()}handleMouseMoveDolly(e){this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(e,t=1){void 0!==e.movementX?this.panDelta.set(e.movementX,e.movementY):(this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*t),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(e){if(!1===pf&&!1===py(e)&&!0==(0===e.wheelDeltaY||0===e.deltaY?!(pu&&e.shiftKey&&Math.abs(e.wheelDeltaX)>=120)&&(e.wheelDeltaX?e.wheelDeltaX===-3*e.deltaX||e.wheelDeltaX===-3*window.devicePixelRatio*e.deltaX:0===e.deltaMode):e.wheelDeltaY?e.wheelDeltaY===-3*e.deltaY||e.wheelDeltaY===-3*window.devicePixelRatio*e.deltaY:0===e.deltaMode))!1!==this.enablePan&&(this.gesture?(this.panDelta.set(-e.deltaX,-e.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),e.altKey?this.pan(0,this.panDelta.y):e.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(ze)},30));else{if(!1===this.enableZoom||this.gesture)return;0===e.deltaY?e.deltaX<0?this.dollyIn(this.getZoomScale()):e.deltaX>0&&this.dollyOut(this.getZoomScale()):e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(2===px.length){let e=.5*(px[0].pageX+px[
vendor: 3,511 bytes, line 8179
81791].pageX),t=.5*(px[0].pageY+px[1].pageY);this.rotateStart.set(e,t)}else this.rotateStart.set(px[0].pageX,px[0].pageY)}handleTouchStartPan(){if(2===px.length){let e=.5*(px[0].pageX+px[1].pageX),t=.5*(px[0].pageY+px[1].pageY);this.panStart.set(e,t)}else this.panStart.set(px[0].pageX,px[0].pageY)}handleTouchStartDolly(){let e=px[0].pageX-px[1].pageX,t=px[0].pageY-px[1].pageY,i=Math.sqrt(e*e+t*t);this.dollyStart.set(0,i)}handleTouchStartDollyPan(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(2===px.length){let t=pE(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.rotateEnd.set(i,r)}else{if(e.pointerId!==px[0].pointerId)return;this.rotateEnd.set(e.pageX,e.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;t&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(e){if(2===px.length){let t=pE(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.panEnd.set(i,r)}else{if(e.pointerId!==px[0].pointerId)return;this.panEnd.set(e.pageX,e.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(e){let t=pE(e),i=e.pageX-t.x,r=e.pageY-t.y,a=Math.sqrt(i*i+r*r);this.dollyEnd.set(0,a),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(e){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}checkRaycastLock(){if(!this.object.data.raycastLock||this.options.isPlayMode)return!1;{let e=this.options?.showCameraLock;return e&&e(),!0}}};function zm(e){let t=2*Math.PI;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}function zg(e){return 1-Math.pow(1-e,4)}var zv=class{constructor(e,t,i,r,a,o){for(let l of(this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=R6(t,t.actions,r,a,o,i),this.target=t.target,this.triggeringObjects=[],t.triggeringObjects)){let e=r.scene.find(l);e&&this.triggeringObjects.push(e)}}isValidTriggeringObject(e){return"all"===this.target||this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){R8(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(!1)}
8179),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}};pU.then(e=>tw=e);var zy=new iD,zx=new iP,zb=new iD,zw=new rn(0,0,0,"YXZ"),zS=new rn(0,0,0,"XYZ"),z_=new iD,zA=new iD,zM=new iD(1,1,1),zE=new iP,zC=new i6,zT=new i6,zP={type:"updateMatrix"},zD=new iP,zO=new iK,zI={type:"beginEvent",eventName:"Collision"},zR={type:"beginEvent",eventName:"Trigger"},zL=e=>e.states.some(e=>void 0!==e.data.position||void 0!==e.data.rotation||void 0!==e.data.hiddenMatrix||void 0!==e.data.cloner||void 0!==e.data.pathSnapping),zB=class{constructor(e){this.eventContext=e,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this.processRigidBody=e=>{if(e.bodyType()!==tw.RigidBodyType.Dynamic)return;e.isSleeping()||this.nActiveRigidBodies++;let[t,i,r]=this.rigidBodyToMesh.get(e.handle);if(zy.copy(e.translation()).multiplyScalar(this.pixelsPerMeter),zx.copy(e.rotation()),t.matrixWorld.compose(zy,zx,i),t.hasNonUniformScale&&t.matrixWorld.multiply(t.shearScale),t.dispatchEvent(zP),r){let e=t.cloner;if(e&&void 0===e.objectForSample)for(let i of(e.matrixWorld.copy(t.matrixWorld),e.children))i.updateMatrixWorld(!0);for(let e of t.children)e.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(e,t,i)=>{let r,a;if(!1!==i){if(this.sensorToTriggerEvent[e]?(r=this.sensorToTriggerEvent[e],a=this.sharedGameControlGlobals.colliderToEntity.get(t)):this.sensorToTriggerEvent[t]&&(r=this.sensorToTriggerEvent[t],a=this.sharedGameControlGlobals.colliderToEntity.get(e)),r&&a&&r.isValidTriggeringObject(a)){r.dispatch();return}for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let r=this.sharedGameControlGlobals.createdObjects[i];if(r.userData.hasCollisionDestroy&&(r.rigidBody?.collider(0).handle===e||r.rigidBody?.collider(0).handle===t)){this.sharedGameControlGlobals.createdObjects.splice(i,1),r.removeFromParent(),requestAnimationFrame(()=>this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(r.rigidBody));break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let r of i)"character"===r.data.target&&this.dispatchCollisionEvent(r,e,t)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let r of i)"character"===r.data.target&&this.dispatchCollisionEvent(r,t,e)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(e),r=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==r)for(let t of r)"scene"===t.data.target&&this.dispatchCollisionEvent(t,i,e);let a=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[a?.uuid];if(void 0!==o)for(let e of o)"scene"===e.data.target&&this.dispatchCollisionEvent(e,a,t)}}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}
8179attachVRControllers(e){e.forEach(e=>{e.addEventListener("connected",e=>{"gamepad"in e.data&&"axes"in e.data.gamepad&&this.sharedGameControlGlobals.gamePads.push(e.data.gamepad)})})}markIsDestroyTarget(){this.page.traverseVisibleEntity(e=>{for(let t of e.dataPatched.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(e=>"Destroy"===e.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{for(let t of e.dataPatched.events)if(!(!0===t.data.disabled||"DragDrop"!==t.data.type))for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}initBVH(){let e=[];if(this.page.traverseChildren(t=>{let i,r=t instanceof Cw,a=t instanceof D0;if(t instanceof EJ||r||a)return;let o=(i=t instanceof bu?t.object:t).dataPatched;if(o.physics?.enabled==="visibility"?!o.visible:!o.physics?.enabled)return!0;let l=t.geometry,h=!0===i.userData.hasDestroy,c=!0===i.userData.hasDrag;if(zL(o)||h||c||i.dataPatched.events.some(e=>!0!==e.data.disabled&&("GameControl"===e.data.type||"Follow"===e.data.type)))return t.updateMatrixWorldSVD(),this.addBoundsTree(t),!0;l&&l.getAttribute("position").count>0&&e.push(LR(l,t.matrixWorld))}),e.length>0){let t=v3(e,!1);this.sharedGameControlGlobals.staticMeshBVH=new x2(t)}}addRigidBody(e,t,i){if(LI(e.matrixWorld))return;let r=[],a="geometry"in e?e.geometry:void 0,o=t.dataPatched;if(a?.getAttribute("position")!==void 0&&r.push(LR(a,e.shearScale)),o.physics.fusedBody){let t=this.gatherChildrenGeom(e,r);e.traverseObject(t),e.children.forEach(e=>e.updateMatrixWorld(!0));let i=e.cloner;i&&void 0===i.objectForSample&&"dynamic"===o.physics.rigidBody&&(i.traverseObject(t),i.children.forEach(e=>e.updateMatrixWorld(!0)))}if(r.length>0){let l,h=!i.fromCreate&&"dynamic"===o.physics.rigidBody||i.fromCreate&&i.dynamic;h?(l=tw.RigidBodyDesc.dynamic()).setLinearDamping(o.physics.damping).setAngularDamping(o.physics.damping).setAdditionalMass(1e-9).setGravityScale(o.physics.gravityScale).enabledRotations(...o.physics.enabledRotation).enabledTranslations(...o.physics.enabledTranslation):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(l=tw.RigidBodyDesc.kinematicPositionBased(),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):l=tw.RigidBodyDesc.fixed();let c=v3(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(zy,zx,zb),e.position0=zy.clone().divideScalar(this.pixelsPerMeter),e.rotation0=zx.clone(),zy.divideScalar(this.pixelsPerMeter),l.setTranslation(zy.x,zy.y,zy.z).setRotation(zx),a?c?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):c?.scale(zb.x/this.pixelsPerMeter,zb.y/this.pixelsPerMeter,zb.z/this.pixelsPerMeter);let d=this.sharedGameControlGlobals.rapierWorld.createRigidBody(l);h&&this.rigidBodyToMesh.set(d.handle,[e,zb.clone(),o.physics.fusedBody]);let p=!(void 0===o.geometry||"SubdivGeometry"===o.geometry.type||"NonParametricGeometry"===o.geometry.type||"BooleanGeometry"===o.geometry.type||"VectorGeometry"===o.geometry.type||"StarGeometry"===o.geometry.type||"RectangleGeometry"===o.geometry.type||"EllipseGeometry"===o.geometry.type||"TriangleGeometry"===o.geometry.type||"TorusGeometry"===o.geometry.type||"HelixGeometry"===o.geometry.type);try{this.addCollider(d,o.physics,c,t,p)}catch{try{this.addCollider(d,o.physics,c,t,!1)}catch(e){console.error(e)}}e.rigidBody=d}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(LR(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(e=>e.updateMatrixWorld(!0)),t.length>0){let i=v3(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new x2(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,a=!0){let o;if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;i&&(o="trimesh"===t.colliderType?tw.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):tw.ColliderDesc.convexMesh(i.getAttribute("position").array,a?i.getIndex().array:void 0)),o.setFrictionCombineRule(tw.CoefficientCombineRule.Average).setRestitutionCombineRule(tw.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let l=this.sharedGameControlGlobals.rapierWorld.createCollider(o,e);this.sharedGameControlGlobals.colliderToEntity.set(l.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(e=>"scene"===e.target)&&l.setActiveEvents(tw.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){return(i,r)=>{let a;if(0===r)return;if(i instanceof EJ){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;a=i.object}else if(i instanceof bu)a=i.object;else if(a=i,a.dataPatched.cloner?.hideBase)return!0;let o=a.dataPatched;
8179if("visibility"===o.physics.enabled?!o.visible:!o.physics.enabled)return!0;1===r?e.hasNonUniformScale?i.matrixWorld.multiplyMatrices(e.shearScale,i.hiddenMatrix):i.matrixWorld.copy(i.hiddenMatrix):i.matrixWorld.multiplyMatrices(i.parent.matrixWorld,i.hiddenMatrix),i.matrixWorld.multiply(i.matrix);let l=i.geometry;l?.getAttribute("position")!==void 0&&t.push(LR(l,i.matrixWorld))}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=this.page.playCamera,i=!1,r=5,a=8,o=9,l="drag",h=this.page.data.publish.gameControlObject,c=null!==h?this.page.find(h):null,d=null;if(c)for(let e of c.data.events){if(e.data.disabled||"GameControl"!==e.data.type)continue;let t=c;for(;this.usePhysics&&(t=t.parent)?.parent!==null;)t.data.physics?.fusedBody;e.data.collisionEnabled&&(this.needsCollisionDetection=!0),null===d&&(d=e.data)}if(this.page.traverseEntity(e=>{for(let t of e.dataPatched.events)if(!1===t.data.disabled&&"Trigger"===t.data.type)return this.needsCollisionDetection=!0,!0}),c&&d&&(!0===c.data.visible||!0===c.data.physics.enabled)){i=i||d.camera===t.uuid||c.uuid===t.uuid;let e=new LD(c,this.renderer.domElement,d,this.eventContext.page.data.globalPhysics,this,c.uuid!==t.uuid&&d.camera===t.uuid,t,this.page,this.sharedAssets);this.gameControl=e,r=d.joystickPosLoc,a=d.joystickRotLoc,o=d.jumpTouchButtonLoc,l=d.rotByTouch,pm&&d.touchControl&&(this.joystickToGameControls[r]="pos","walk"===d.moveMode&&(this.joystickToGameControls[o]="jmp"),"joystick"===l&&(this.joystickToGameControls[a]="rot"))}if(this.gameControl&&this.gameControl.data.navmesh.enabled){let e=this.gameControl.data;if(!this.navigationMeshWrapper){let t;this.navigationMeshWrapper=new B6(this.usePhysics,this.isExport),t=Math.floor((t="sphere"===e.collider.type?2*e.collider.radius:e.collider.height)/e.navmesh.ch-1),this.navigationMeshWrapper.init({...e.navmesh,walkableHeight:t},this.gameControl,this.eventContext)}}if(!1===i){let{enableRotate:e,enablePan:i,enableZoom:r,autoRotate:a,hoverRotatePanMode:o}=this.eventManager.publish.orbitControls;(e||i||r||a||0!==o)&&(this.orbitControls=new zf(t,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let p=this.renderer.domElement.width/this.renderer.getPixelRatio(),f=this.renderer.domElement.height/this.renderer.getPixelRatio();this.joystickToGameControls.forEach((e,t)=>{let i=document.body.appendChild(document.createElement("div")),[r,a,o]=this.eventManager.eventContext.publish.joystickSizeAndXYOffset[t],l=(p-5*r)/4+r,h={},c="jmp"===e,d=c?0:r;for(let e in t<10?(t<5?h.top=d/2:h.bottom=d/2,h.left=d/2+t%5*l):(10===t?h.left=d/2:h.right=d/2,h.top=f/2),h.top?h.top-=a[1]:h.bottom+=a[1],h.left?h.left+=a[0]:h.right-=a[0],h)h[e]+="px";if(c){let e=i.appendChild(document.createElement("div"));Object.assign(e.style,h,{position:"absolute",width:r+"px",height:r+"px",backgroundColor:`rgba(255,255,255,${"show"===o?.4:0})`,zIndex:"9999",borderRadius:r+"px",border:"show"===o?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let a=r/16*6.4;"show"===o&&(e.innerHTML=` 8180 <svg width="${a}" height="${.4*r}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 8181 <path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 8182 </svg> 8183 `),e.addEventListener("pointerdown",()=>{this.gameControl.movementState.jump=1,this.requestRender()}),e.addEventListener("touchend",e=>e.preventDefault()),this.joysticks[t]=[void 0,i];return}let m={zone:i,mode:"static",position:h,size:r};"hide"===o&&(m.restOpacity=0);let g=Ir.create(m);g.on("move",(t,i)=>{let r=this.gameControl;"pos"===e?i.force<.2?r.moveForce=0:(r.movementState.movePosZ=Math.sin(-i.angle.radian),r.movementState.movePosX=Math.cos(-i.angle.radian),i.force>1.2?r.movementState.run=1:r.movementState.run=0,i.force<.3?r.moveForce=(i.force-.2)/.1:r.moveForce=1):"rot"===e&&(i.force<.2?r.rotForce=0:(r.movementState.rotPosX=i.vector.y,r.movementState.rotPosY=-i.vector.x,i.force<.3?r.rotForce=(i.force-.2)/.1:r.rotForce=1)),this.requestRender()}),g.on("end",(t,i)=>{let r=this.gameControl;"pos"===e?(r.movementState.movePosZ=0,r.movementState.movePosX=0,r.moveForce=1):"rot"===e&&(r.movementState.rotPosX=0,r.movementState.rotPosY=0,r.rotForce=1)}),this.joysticks[t]=[g,i]}),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>
8183{this.collisionEvents.forEach(e=>e.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new tw.World(new tw.Vector3(0,this.gravity,0)),this.events=new tw.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(i=>{let r;if(i instanceof EJ){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;r=i.object}else if(i instanceof bu)r=i.object;else{if(i instanceof D0||i instanceof Cw)return;if(r=i,r.dataPatched.cloner?.disabled===!1&&r.dataPatched.cloner?.hideBase&&r.dataPatched.physics?.fusedBody!==!0)return!0}let a=r.dataPatched,o;for(let e of a.events)!0!==e.data.disabled&&"GameControl"===e.data.type&&(o=e.data);if(!a.physics||("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled))return!0;i.updateMatrixWorldSVD();let l=zL(a),h=!1,c=r.userData.hasDestroy,d=r.userData.hasDrag,p=!1;for(let e of a.events)if(!0!==e.data.disabled){if("Collision"===e.data.type){h=!0;let t=new BY(e.id,e.data,r,this.page,this.sharedAssets,this.eventManager);t.initialDisabled=!0,this.collisionEvents.push(t),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid].every(t=>t.id!==e.id)?this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid].push(t):this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]=[t]}else if("Follow"===e.data.type){p=!0;let t=e.data.target;i.traverseVisible(e=>{e.userData.isFollowingObj=t})}}"dynamic"===a.physics.rigidBody&&!1===a.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let f=i.geometry;if(void 0!==o){let e,t=tw.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(zy,zx,zb),i.position0=zy.clone().divideScalar(this.pixelsPerMeter),i.rotation0=zx.clone(),zy.divideScalar(this.pixelsPerMeter),t.setTranslation(zy.x,zy.y,zy.z).setRotation(zx);let l=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=l,(e="sphere"===o.collider.type?tw.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?tw.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):tw.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2)).setFrictionCombineRule(tw.CoefficientCombineRule.Average).setRestitutionCombineRule(tw.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(a.physics.restitution);let h=this.sharedGameControlGlobals.rapierWorld.createCollider(e,l);this.sharedGameControlGlobals.colliderToEntity.set(h.handle,r),zy.fromArray(o.collider.position.map(e=>"number"==typeof e?e:0)).multiply(zb.setFromMatrixScale(r.matrixWorld)).divideScalar(this.pixelsPerMeter),h.setTranslationWrtParent(zy);let c=new iP().setFromEuler(new rn().setFromVector3(new iD().fromArray(o.collider.rotation.map(e=>"number"==typeof e?e:0))));h.setRotationWrtParent(c),h.setActiveEvents(tw.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(r,!0)}else"dynamic"===a.physics.rigidBody||l||p||c||d||h?(this.addRigidBody(i,r,{hasFollow:p,hasTransformAnim:l,hasDrag:d}),this.generateSensorColliderDescs(r,a.physics.fusedBody)):(f&&e.push(LR(f,i.matrixWorld)),a.physics.fusedBody&&i.traverseObject((t,i)=>{let r;if(0===i)return;if(t instanceof EJ){if(!t.objectForSample)return!0===t.object.dataPatched.physics.fusedBody&&"dynamic"===t.object.dataPatched.physics.rigidBody||void 0;if(t.objectForSample.dataPatched.physics.fusedBody)return;r=t.object}else{if(t instanceof D0||t instanceof Cw)return;if(t instanceof bu)r=t.object;else if(r=t,r.dataPatched.cloner?.hideBase)return!0}let a=r.dataPatched;if("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled)return!0;let o=t.geometry;o?.getAttribute("position")!==void 0&&e.push(LR(o,t.matrixWorld))}),this.generateSensorColliderDescs(r,a.physics.fusedBody,t));if(a.physics?.fusedBody===!0||o)return!0}),0===e.length)return;let i=v3(e);i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=tw.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r),o=tw.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(tw.CoefficientCombineRule.Multiply).setRestitutionCombineRule(tw.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);for(let[e,i]of(this.sharedGameControlGlobals.rapierWorld.createCollider(o,a),t)){let t=this.sharedGameControlGlobals.rapierWorld.createCollider(e,a);this.sensorToTriggerEvent[t.handle]=i}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(e=>{for(let t of e.dataPatched.events)if("Trigger"===t.data.type&&!0!==t.data.disabled){let i=new zv(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new i6().compose(z_.fromArray(t.data.position.map(e=>"number"==typeof e?e:0)),zE.setFromEuler(zS.fromArray(t.data.rotation.map(e=>"number"==typeof e?e:0))),zM);if("box"===t.data.triggerZone){let a=new iR;a.min.fromArray(t.data.size.map(e=>"number"==typeof e?e:0)).multiplyScalar(-.5),a.max.fromArray(t.data.size.map(e=>"number"==typeof e?e:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([a,r,e,i])}else this.sharedGameControlGlobals.triggers.push([t.data.radius,r,e,i])}}),this.needsCollisionDetection&&this.initBVH())}
8183disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){for(let e of(this.isEnabled=!1,this.page.traverse(e=>{e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0,Object.values(this.sharedGameControlGlobals.entityToCollisionEvents)))e.forEach(e=>e.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e,t,i){if(!this.isEnabled)return!0;let r=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),r=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,r=!1):2===this.initializationCounter&&this.gameControl&&(r=!this.gameControl.update(e,t,i)&&r),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics){if(0===e)r=this.stepPhysics()&&r;else{let t=e/1e3;t<.016666666666666666&&t>.009166666666666667&&(t=.016666666666666666),this.accumulator+=t;let i=performance.now(),a=0;for(;this.accumulator>=.016666666666666666&&a<6&&(r=this.stepPhysics()&&r,this.accumulator-=.016666666666666666,a++,!(performance.now()-i>16.666666666666668)););this.accumulator=this.accumulator%.016666666666666666}}this.skipRender=r}stepPhysics(){for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(zy,zx,zb),zw.setFromQuaternion(zx),void 0===e.prevR?(e.prevR=zw.clone(),e.prevT=zy.clone()):(e.prevR.copy(zw),e.prevT.copy(zy)),e.rigidBody&&(e.rigidBody.setNextKinematicTranslation(zy.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(zx));return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(e,t,i){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent,a;if(t.cloner){for(let e of t.cloner.children)if(e.rigidBody===r){a=e;break}}e.dispatch(a),t.dispatchEvent(zI)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=zT.copy(e.matrixWorld).invert();e.traverseEntity((a,o)=>{if(!1===t&&1===o)return!0;for(let t of a.dataPatched.events)if("Trigger"===t.data.type&&!0!==t.data.disabled){let o=new zv(t.id,t.data,a,this.page,this.sharedAssets,this.eventManager),l;if((l="box"===t.data.triggerZone?tw.ColliderDesc.cuboid(...t.data.size.map(e=>("number"==typeof e?e:1)/(2*this.pixelsPerMeter))):tw.ColliderDesc.ball(t.data.radius/this.pixelsPerMeter)).setDensity(0).setSensor(!0).setActiveEvents(tw.ActiveEvents.COLLISION_EVENTS),z_.fromArray(t.data.position.map(e=>"number"==typeof e?e:0)),zE.setFromEuler(zS.fromArray(t.data.rotation.map(e=>"number"==typeof e?e:0))),zC.compose(z_,zE,zM).premultiply(a.matrixWorld),i?(zC.decompose(z_,zE,zA),l.setActiveCollisionTypes(tw.ActiveCollisionTypes.KINEMATIC_FIXED|tw.ActiveCollisionTypes.DYNAMIC_FIXED)):(zC.premultiply(r).decompose(z_,zE,zA),e.rigidBody.bodyType()===tw.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===tw.RigidBodyType.Fixed?l.setActiveCollisionTypes(tw.ActiveCollisionTypes.KINEMATIC_FIXED|tw.ActiveCollisionTypes.DYNAMIC_FIXED):l.setActiveCollisionTypes(tw.ActiveCollisionTypes.KINEMATIC_KINEMATIC|tw.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),z_.divideScalar(this.pixelsPerMeter),l.setTranslation(z_.x,z_.y,z_.z),l.setRotation(zE),i)i.push([l,o]);else{let t=this.sharedGameControlGlobals.rapierWorld.createCollider(l,e.rigidBody);this.sensorToTriggerEvent[t.handle]=o}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,a,o]=this.sharedGameControlGlobals.triggers[t];for(let t=0;t<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;t++){let l=this.sharedGameControlGlobals.entitiesWithTransformAnim[t];if(a===l||!1===o.isValidTriggeringObject(SH.is(l)?l:l.object))continue;let h=zT.copy(a.matrixWorld).decompose(z_,zD,zA).compose(z_,zD,zM).multiply(r),c=zC.copy(l.matrixWorld).invert().multiply(h);i instanceof iR?e=l.bvhGeometry.boundsTree.intersectsBox(i,c):(zO.radius=i,zO.center.setFromMatrixPosition(c),e=l.bvhGeometry.boundsTree.intersectsSphere(zO)),e?-1===o.currentIntersectedObjects.indexOf(l)&&(o.currentIntersectedObjects.push(l),o.dispatch(),a.dispatchEvent(zR)):o.currentIntersectedObjects=o.currentIntersectedObjects.filter(e=>e!==l)}}}};function zz(e){let t=this._clip.duration,i=this._clip.start??0,r=this.loop,a=this.time+e,o=this._loopCount,l=2202===r;if(0===e)return -1===o?a:l&&(1&o)==1?t-(a-i):a;if(2200===r){-1===o&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(a>=t)a=t;else if(a<0)a=0;else{this.time=a;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=a,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===o&&(e>=0?(o=0,this._setEndings(!0,0===this.repetitions,l)):this._setEndings(0===this.repetitions,!0,l)),a>=t||a<i){let r=Math.floor((a-i)/(t-i));a-=(t-i)*r,o+=Math.abs(r);let h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,l||(a=e>0?t:i,1===this.repetitions&&(a=t)),this.time=a,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===h){let t=e<0;this._setEndings(t,!t,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=a,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:r})}}else this.time=a;if(l&&(1&o)==1)return t-(a-i)}return a}var zF=!1,zN=class{constructor(e,t,i,r){this.scene=e,this.requestRender=t,this.updateDisplayProgress=i,this.animationInspectorState=r,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=e=>{"Empty"===e.data.type&&Array.isArray(e.data.animations)&&e.data.animations.forEach((t,i)=>{let r=t[0]+"/";if(Array.isArray(e.identity)?r+=e.identity[0]:r+=e.uuid,this.clipIdToAction[r])return;let a=li.parse(JSON.parse(t[2]));e.animations[i]=a;let o=this.mixer.clipAction(a,e);
8183!1===zF&&(Object.getPrototypeOf(o)._updateTime=zz,zF=!0),o.clampWhenFinished=!0,this.clipIdToAction[r]=o})},this.mixer=new lj(e),this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let i=this.scene.find(t);if(!i)return;let r=i.animations.find(t=>t.uuid===e);if(!r)return;let a=this.clipIdToAction[e];a&&(a.stop(),this.mixer.uncacheClip(r),delete this.clipIdToAction[e],i.animations=i.animations.filter(t=>t.uuid!==e))}get isPlaying(){return Object.values(this.clipIdToAction).some(e=>e.isRunning())}playFromInspector(e){this.mixer.stopAllAction();let t=this.clipIdToAction[e];t&&(t.play(),this.activeClip=t.getClip(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=2201}),this.mixer.stopAllAction(),this.requestRender()}play(e){let t=e.clipId+"/"+e.object,i=this.clipIdToAction[t];if(i)return e&&(e.repeat>=0&&(i.repetitions=e.repeat+1),"pingpong"===e.direction&&0!==e.repeat&&(i.loop=2202)),i.play(),i.paused=!1,this.requestRender(),i}resumeFromInspector(e){let t=this.clipIdToAction[e];t&&(t.play(),t.paused=!1,this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];t&&(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(!1===this.isPlaying||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return RJ(this.activeClip??void 0)}setProgressFromInspector(e,t){if(!this.clipIdToAction[t])return;this.activeClip!==this.clipIdToAction[t].getClip()&&this.playFromInspector(t);let i=this.clipIdToAction[t].paused;this.clipIdToAction[t].paused=!1,this.mixer.setTime(Math.min(e/(this.maxFrames-1),.9999)*this.activeClip.duration),this.requestRender(),i&&(this.clipIdToAction[t].paused=!0)}},zU=new WeakMap,zk=class extends ln{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let a=new lh(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,e=>{this.decodeDracoFile(e,t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){let a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};return this.decodeGeometry(e,a).then(t)}decodeGeometry(e,t){let i=JSON.stringify(t);if(zU.has(e)){let t=zU.get(e);if(t.key===i)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,a=this.workerNextTaskID++,o=e.byteLength,l=this._getWorker(a,o).then(i=>(r=i,new Promise((i,o)=>{r._callbacks[a]={resolve:i,reject:o},r.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return l.catch(()=>!0).then(()=>{r&&a&&this._releaseTask(r,a)}),zU.set(e,{key:i,promise:l}),l}_createGeometry(e){let t=new rQ;e.index&&t.setIndex(new rN(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let r=e.attributes[i],a=r.name,o=r.array,l=r.itemSize;t.setAttribute(a,new rN(o,l))}return t}_loadLibrary(e,t){let i=new lh(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,r)=>{i.load(e,t,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let r=zV.toString(),a=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(` 8184`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>
8184{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};function zV(){let e,t;onmessage=function(i){let r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let a=r.buffer,o=r.taskConfig;t.then(e=>{let t=e.draco,i=new t.Decoder,l=new t.DecoderBuffer;l.Init(new Int8Array(a),a.byteLength);try{let e=function(e,t,i,r){let a=r.attributeIDs,o=r.attributeTypes,l,h,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)l=new e.Mesh,h=t.DecodeBufferToMesh(i,l);else if(c===e.POINT_CLOUD)l=new e.PointCloud,h=t.DecodeBufferToPointCloud(i,l);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!h.ok()||0===l.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());let d={index:null,attributes:[]};for(let i in a){let h=self[o[i]],c,p;if(r.useUniqueIDs)p=a[i],c=t.GetAttributeByUniqueId(l,p);else{if(-1===(p=t.GetAttributeId(l,e[a[i]])))continue;c=t.GetAttribute(l,p)}d.attributes.push(function(e,t,i,r,a,o){let l=o.num_components(),h=i.num_points()*l,c=h*a.BYTES_PER_ELEMENT,d=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,a),p=e._malloc(c);t.GetAttributeDataArrayForAllPoints(i,o,d,c,p);let f=new a(e.HEAPF32.buffer,p,h).slice();return e._free(p),{name:r,array:f,itemSize:l}}(e,t,l,i,h,c))}return c===e.TRIANGULAR_MESH&&(d.index=function(e,t,i){let r=3*i.num_faces(),a=4*r,o=e._malloc(a);t.GetTrianglesUInt32Array(i,a,o);let l=new Uint32Array(e.HEAPF32.buffer,o,r).slice();return e._free(o),{array:l,itemSize:1}}(e,t,l)),e.destroy(l),d}(t,i,l,o),a=e.attributes.map(e=>e.array.buffer);e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(l),t.destroy(i)}})}}}function zj(e){return tS||(tS=new zk).setDecoderPath(void 0!==e?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),tS.decoderPending}async function zG(e){if(tS){let t={attributeIDs:tS.defaultAttributeIDs,attributeTypes:tS.defaultAttributeTypes,useUniqueIDs:!1},i;try{i=await tS.decodeGeometry(new Int8Array(e).buffer,t)}catch(e){console.error(e)}if(i)return{index:i.index?{array:i.index.array}:void 0,attributes:Object.entries(i.attributes).map(([e,t])=>({name:e,itemSize:t.itemSize,array:t.array}))}}return null}async function zH(e,t){let[i,r]=fl(mL.deserialize(new Uint8Array(e)));return v2(i),t&&t(i),r.result().data}async function zW(e){for(let t of e){let e=await zG(t.geometry.data.draco);if(e){let i=t.geometry.data;e.index&&(i.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let r={};e.attributes.forEach(({name:e,array:t,itemSize:i})=>{r[e]={array:t,itemSize:i,type:"Float32Array",normalized:!1}}),i.attributes=r,i.draco=void 0}}}var zq=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=e=>{let t=[e.clientX,e.clientY],i=new Date().getTime();if(this._clickCount>0){let e=t[0]-this._lastPosition[0],i=t[1]-this._lastPosition[1];Math.sqrt(e*e+i*i)>this._distance&&(this._clickCount=0)}this._lastPosition=t,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=e=>{}}start(e,t=500,i=2){this._target&&this.stop(),this.reset(),this._delay=t,this._distance=i,this._target=e,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}},zX=class{constructor(e,t,i,r,a,o,l,h){this.eventId=e,this.id=t,this.data=i,this.dataEvent=r,this.object=a,this.stage=!1,this.actions=R6(r,i.actions,o,l,h,a)}disconnect(){R8(this.actions)}
8184dispatchIn(){this.actions.Audio.forEach(e=>e.dispatchBasic()),this.actions.Particles.forEach(e=>e.dispatchBasic()),this.actions.Video.forEach(e=>e.dispatchBasic()),this.actions.Create.forEach(e=>e.dispatch()),this.actions.Destroy.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.Link.forEach(e=>e.dispatch()),this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.actions.Transition.forEach(e=>e.toggle()),this.actions.Animation.forEach(e=>e.play()),this.actions.SwitchCamera.forEach(e=>e.play()),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchOut(){this.actions.Transition.forEach(e=>{e.toggle()})}},zY=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.breakpoints=[],this.resize=(e,t)=>{this.breakpoints.forEach(i=>{let r=gt.deviceToSize(i.data.size),a="horizontal"===i.dataEvent.orientation?e:t,o;switch(i.data.operator){case"<":o=a<r[0];break;case">":o=a>r[0];break;case"<>":o=a>r[0]&&a<r[1]}i.stage!==o&&(i.stage=o,i.stage?i.dispatchIn():i.dispatchOut())})},this.onResizeObserver=new ResizeObserver(e=>{for(let t of e){let{width:e,height:i}=t.contentRect;this.resize(e,i)}})}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext;this.onResizeObserver.observe(i);let r=i=>{if(!(!i.visible||!i.data?.events.length))for(let{data:r,id:a}of i.data.events)r.disabled||"Resize"===r.type&&r.breakpoints.forEach(({data:o,id:l})=>{try{let h=new zX(a,l,o,r,i,e,t,this.eventManager);this.breakpoints.push(h)}catch(e){}})};e.traverseEntity(e=>{(e instanceof DO||e instanceof DS)&&e.frame?.traverse(e=>{r(e)}),r(e)})}disconnect(){this.onResizeObserver.disconnect(),this.breakpoints.forEach(e=>{e.disconnect()}),this.breakpoints=[]}},zQ=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.userAPIs={},this.events=[],this.onSuccess=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchSuccess()})},this.onError=({userAPIId:e})=>{this.events.forEach(t=>{t.data.userAPIId===e&&t.dispatchError()})},this.userAPIs=e.sharedAssets.getUserAPIs()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"API"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new zZ(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userAPIs).forEach(([e,t])=>{t.on("success",this.onSuccess),t.on("error",this.onError),t.autostart&&t.callUserAPI(this.eventContext.sharedAssets)})}disconnect(){Object.entries(this.userAPIs).forEach(([e,t])=>{t.off("success",this.onSuccess),t.off("error",this.onError)})}},zZ=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.successActions=R6(t,t.successActions,r,a,o,i),this.errorActions=R6(t,t.errorActions,r,a,o,i)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}
vendor: 1,586 bytes, line 8184
8184dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},zK=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.userWebhooks={},this.events=[],this.onMessage=({userWebhookId:e})=>{this.events.forEach(t=>{t.data.userWebhookId===e&&t.dispatch()})},this.userWebhooks=e.sharedAssets.getUserWebhooks()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"WEBHOOK"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new zJ(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userWebhooks).forEach(([e,t])=>{t.connect(),t.on("message",this.onMessage)})}disconnect(){Object.entries(this.userWebhooks).forEach(([e,t])=>{t.off("message",this.onMessage),t.disconnect()})}},zJ=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.actions=R6(t,t.actions,r,a,o,i)}dispatch(){let e=this.actions;
8184e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},z$=new iD(0,0,1),z0=new iD,z1=new iD,z2=new t7,z3=class{constructor(e,t,i,r,a){this.containerScene=e,this.raycaster=t,this.sharedAssets=i,this.requestRender=r,this.onExit=a,this.htmlInput=null,this.virtualInput=null,this.helper=new PA,this.doubleClickHandler=new zq,this.isDragging=!1,this.plane=new sv,this.caretInterval=0,this.planeIntersection=new iD,this.projected=new t9,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let e=this.virtualInput?.data;if(void 0!==this.virtualInput&&e){let t=e.material,i=function(e,t){let i=gb.fromHex(3223857),r=.8;for(let o of e.layers){if("light"===o.data.type||"displace"===o.data.type||"fresnel"===o.data.type||"matcap"===o.data.type||"texture"===o.data.type||"toon"===o.data.type||"outline"===o.data.type||"transmission"===o.data.type||"noise"===o.data.type)continue;let e="string"==typeof o.data.alpha?Number(t.getVariable(o.data.alpha)):o.data.alpha;if("color"===o.data.type&&e>.3){var a;i="string"==typeof(a=o.data.color)?t.data.colors[a]:a,r=e;break}if(("depth"===o.data.type||"gradient"===o.data.type)&&e>.3){let e=o.data.colors[0];i={r:e[0],g:e[1],b:e[2]},r="string"==typeof o.data.alpha?1:o.data.alpha;break}}return{...i,a:r}}("string"==typeof t?this.sharedAssets.data.materials[t]:t,this.sharedAssets);this.helper.setCaretColor(i)}},this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)},this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))},this.handleCaretUpdate=e=>{if(!this.htmlInput||!this.virtualInput)return;let t=this.helper,i=e?.key==="ArrowLeft"||e?.key==="ArrowRight",r=e?.key==="ArrowUp"||e?.key==="ArrowDown";this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(t.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:i,verticalKeyMove:r}),this.startAnimateTextCursor()):t.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){let e;return this.htmlInput=((e=document.createElement("textarea")).style.position="fixed",e.style.top="200px",e.style.left="400px",e.style.zIndex="-1",e.style.border="1px solid rgba(255,0,0,0.5)",e.style.width="10px",e.style.height="500px",e.style.color="white",e.style.opacity="0.5",e.style.background="transparent",e.style.display="none",e.style.margin="0px",e.style.padding="0px",e.style.boxSizing="content-box",e.style.pointerEvents="none",e),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let e=this.doubleClickHandler.clickCount,{index:t,lineIndex:i,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,e>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0};this.virtualInput?.wrappedText?.length&&this.virtualInput.wrappedText[i][Math.max(0,r-1)]===` 8185`&&(t--,r--),this._lastIndex=t,this._isFirstDragMove=!0;let a=this.checkClickedObject();if(1===e){if(null===a)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=t,this.isDragging=!0,this.setInputSelection(t)}else a===this.virtualInput&&(2===e?this.selectClosestWord(i,r):e>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){this.virtualInput&&(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(e){if(this.virtualInput=e,this.updateTextInputStyles(),this.htmlInput){if(e){let e=this.data?.geometry.text;this.htmlInput.value="string"==typeof e?"":e?.textValue.toString()??""}else this.htmlInput.value=""}}blur(){}get data(){let{virtualInput:e}=this;if(e)return e.dataPatched}
8185applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let e=this.selectionOnDragStart,{index:t,lineIndex:i,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0};void 0!==i&&void 0!==r&&this.virtualInput?.wrappedText[i][r-1]===` 8186`&&t--,this.htmlInput.setSelectionRange(Math.min(e,t),Math.max(e,t))}checkClickedObject(){if(this.virtualInput){let e=this.raycaster.intersectObject(this.virtualInput,!1);if(e.length>0){let t=e[0];if(t.object instanceof DE)return t.object}}return null}selectClosestWord(e,t){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,r=i[e],a=t+1,o=t;" "!==r[t]&&(a=this.findNextCharOccurence(r,t,"forward"," "),(o=this.findNextCharOccurence(r,t,"backward"," "))>0&&o++,a>=r.length-1&&e===i.length-1&&a++);let l=this.helper,h=l.getGlobalIndexFromLineAndCharIndexes(i,e,o),c=l.getGlobalIndexFromLineAndCharIndexes(i,e,a);this.setInputSelection(h,c)}findNextCharOccurence(e,t,i,r=" "){let a=Math.max(0,e.length-1),o="forward"===i?a:0,l="forward"===i?1:-1,h=Math.max(Math.min(t,a),0);for(;h!==o;)if(h+=l,e.charAt(h)===r)return h;return o}getPointOnPlane(){let e=this.virtualInput?.data;if(!(!this.virtualInput||!e)&&this.raycaster.ray.intersectsPlane(this.plane)){null===this.planeIntersection&&(this.planeIntersection=new iD);let t=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(t){this.planeIntersection.copy(this.virtualInput.worldToLocal(t));let i="number"==typeof e.geometry.width?e.geometry.width:1,r="number"==typeof e.geometry.height?e.geometry.height:1;this.projected.set(t.x+.5*i,t.y-.5*r)}}}updatePlane(){let e=this.virtualInput?.data;this.virtualInput&&e&&(z2.getNormalMatrix(this.virtualInput.matrixWorld),z0.copy(z$).applyMatrix3(z2).normalize(),this.virtualInput.localToWorld(z1.set(0,0,e.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(z0,z1))}setInputSelection(e,t=e){this.htmlInput?.setSelectionRange(e,t),pp&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){var e;let t=this.virtualInput?.data;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=4===(e=t.geometry.horizontalAlign)?"justify":2===e?"right":3===e?"center":"left")}},z4=(e,t)=>{if("string"==typeof e){let i=t.data(e);if(i)return z4(i.value,t)}return xn.getDisplayedValue(e)};function z5(e,t){let i=e.text,r="";if("string"==typeof i){let e=t.variables.data(r);e&&(r=z4(e.value,t.variables))}else r=i.textValue.toString();return r}var z6=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this._textInputs=[],this.sceneHelpers=new nR,this.helper=new PA,this._onMouseDownFocusIn=e=>{if(px.length>1)return;this.eventContext.updateRaycaster(e);let t=null;if(this.eventContext.raycaster){for(let e of this._textInputs)if(this.eventContext.raycaster.intersectObject(e,!0).length>0){t=e;break}}this.focusOnTextInput(t),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(e),this._onMouseDown(e)},this.onExit=()=>{let{virtualInput:e}=this.textInputManager;if(null===e)return;let t=this.textInputManager.htmlInput;this.helper.hide(),t?.setSelectionRange(t.value.length,t.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:i}=this.eventContext;i.removeEventListener("pointerdown",this._onMouseDown,!1),i.removeEventListener("pointerup",this._onMouseUp,!1),i.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),i.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=e=>{this.eventContext.updateRaycaster(e),this.textInputManager.handleMouseMove()},this._onTextEdit=e=>{let{htmlInput:t,virtualInput:i,helper:r}=this.textInputManager;if(!t||!i)return;let a=t.value;i.textGeometry.setText(a,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let o=i.data;
vendor: 3,834 bytes, line 8186
8186r.update();let l=o.geometry.text;"string"==typeof l&&this.eventContext.sharedAssets.updateVariable(l,{textValue:a}),this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=e=>{this.textInputManager.handleCaretUpdate(e)},this._onKeyPress=e=>{"Escape"===e.key&&this.onExit()},this.textInputManager=new z3(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(t=>{t instanceof DE&&e.push(t)}),this._textInputs=e,0===e.length)return;let{domElement:t}=this.eventContext;t.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:t,sharedAssets:i}=this.eventContext;t.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(e=>{let t=z5(e.data.geometry,this.eventContext.sharedAssets.data);e.textGeometry.setText(t,i)}),t.removeEventListener("pointerdown",this._onMouseDown,!1),t.removeEventListener("pointerup",this._onMouseUp,!1),t.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(e){this.textInputManager.focus(e),this.textInputManager.onTextMaterialChanged();let t=this.textInputManager.htmlInput;if(!t||null===e)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=z5(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);t.value=i,t.setSelectionRange(0,0),this.textInputManager.helper.show(e),t.style.display="block",t.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDownFocusIn),r.addEventListener("pointerdown",this._onMouseDown,!1),r.addEventListener("pointerup",this._onMouseUp,!1),r.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}},z8=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onVoice=({value:e,frequencies:t})=>{this.events.forEach(e=>{e.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantListener"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new z9(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},z9=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.actions=R6(t,t.actions,r,a,o,i)}dispatch(){this.dispatchActions(this.actions)}
vendor: 1,591 bytes, line 8186
8186dispatchActions(e){e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}},z7=class extends Lq{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onTriggerEvent=({description:e,direction:t})=>{let i=this.events.find(t=>t.data.description===e);i&&("backward"===t?i.dispatchReverse():i.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(e=>"AIAssistantTrigger"===e.data.type&&!e.data.disabled).forEach(t=>{this.events.push(new Fe(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},Fe=class{constructor(e,t,i,r,a,o){this.id=e,this.data=t,this.object=i,this.actions=R6(t,t.actions,r,a,o,i)}dispatch(){let e=this.actions;
8186e.Audio.forEach(e=>e.dispatchConditional()),e.Particles.forEach(e=>e.dispatchConditional()),e.Video.forEach(e=>e.dispatchConditional()),e.Create.forEach(e=>e.dispatch()),e.Destroy.forEach(e=>e.dispatch()),e.Reset.forEach(e=>e.dispatch()),e.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this),e.init()}),e.Transition.forEach(e=>e.play()),e.Animation.forEach(e=>e.play()),e.SwitchCamera.forEach(e=>e.play()),e.SceneTransition.forEach(e=>e.dispatch()),e.SetVariable.forEach(e=>e.checkConditions()),e.SetVariable.forEach(e=>e.dispatch()),e.DynamicVariablePlay.forEach(e=>e.dispatch()),e.ClearLocalStorage.forEach(e=>e.dispatch()),e.UserAPI.forEach(e=>e.dispatch())}dispatchReverse(){let e=this.actions;e.Transition.forEach(e=>e.reverseFromCurrent()),e.Particles.forEach(e=>e.reverseFromCurrent()),e.Animation.forEach(e=>e.reverseFromCurrent()),e.SwitchCamera.forEach(e=>e.reverseFromCurrent()),e.Create.forEach(e=>e.dispatchStop())}},Ft=class{constructor(e,t,i,r,a){this.publish=e,this.controlsManager=t,this.animationControls=i,this.eventContext=r,this.sharedVariables=a,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=e=>{let t=window.parent!==window,i=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(e.touches.length>1||this.preventTouchScroll||!1===t&&!1===i)&&e.preventDefault()},this.onMouseWheelPreventScroll=e=>{this.preventScroll&&e.preventDefault()},this.onMouseMove=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:e.buttons>0}},this.onMouseDown=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!0}},this.onMouseUp=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!1}},this.getMousePosition=e=>{let{domRect:t}=this.eventContext,{pageX:i,pageY:r}=e.touches?.length>0?e.touches[0]:e;return{x:i-(t.left+window.scrollX),y:r-(t.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown)),this.handlers={Spline:new LK(this.eventContext),VariableChange:new BQ(this.eventContext,this.sharedVariables,this,this.needsMouse,this.needsRaycast),API:new zQ(this.eventContext,this),WEBHOOK:new zK(this.eventContext,this),AIAssistantListener:new z8(this.eventContext,this),AIAssistantTrigger:new z7(this.eventContext,this),Conditional:new L5(this.eventContext,this),Start:new BX(this.eventContext,this),Basic:new L$(this.eventContext,this,this.needsRaycast),MouseHover:new Bj(this.eventContext,this),Scroll:ne
8186w BW(this.eventContext,this),Follow:new BS(this.eventContext,this),DragDrop:new Bu(this.eventContext,this),LookAt:new BF(this.eventContext),Resize:new zY(this.eventContext,this),Textfields:new z6(this.eventContext,this)};let{page:t,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),t.traverseEntity(e=>{e.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(e=>e.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:i}=this.eventContext;i.style.cursor="",Object.values(this.handlers).forEach(e=>e.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(e=>{e.removeEventListener("requestRender",this.requestRender),e.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=i=>{if("Conditional"===i.data.type&&(i.data.ifActions.forEach(t),i.data.elseActions.forEach(t)),"Conditional"===i.data.type||"SetVariable"===i.data.type)for(let e of"Conditional"===i.data.type?i.data.condition:i.data.expression)"id"in e&&Array.isArray(e.id)&&("mouse"===e.id[0]&&(this.needsMouse=!0),"raycast"===e.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===i.data.type&&""!==i.data.variableId&&("Play"===i.data.mode||"PlayPause"===i.data.mode||"Toggle"===i.data.mode)&&e.setDynamicVariablePlayState(i.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(e=>{if(e.data?.events.length)for(let i of e.data.events)if("VariableChange"===i.data.type&&("mouseProperty"===i.data.variableId&&(this.needsMouse=!0),"raycastProperty"===i.data.variableId&&(this.needsRaycast=!0)),"Conditional"===i.data.type)for(let e of["inActions","outActions"])i.data[e].forEach(t);else if("DragDrop"===i.data.type)for(let e of["drag","drop"])i.data.dragDropActions[e].forEach(t);else if("GameControl"===i.data.type)for(let e of["idle","move","jump","run"])i.data.gameActions[e].forEach(t);else if("Resize"===i.data.type)for(let e of i.data.breakpoints)e.data.actions.forEach(t);else"LookAt"===i.data.type||"API"===i.data.type||i.data.actions.forEach(t)})}},Fi=class{constructor(e,t,i,r,a){this._aspect=1,this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=new t9().copy(i),this._editorSize=new t9().copy(r),this._aspect=t.aspect,this._fov=a??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){this._renderer&&this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||"PerspectiveCamera"!==this._camera.cameraType)return;let e=this._frameSize.x,t=this._frameSize.y,i=this._editorSize.y;this._aspect=e/t,t<=i&&(this._camera.zoom*=i/t),this._renderer.setViewport(0,0,e,t)}updateCamera(e=!0){if(this._camera){if("PerspectiveCamera"===this._camera.cameraType){let t=this._frameSize.y,i=this._editorSize.y,r=this._fov;if(e&&t>i)r*=t/i*(1-((t-1080)/1080*14+1)/100);this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive)}}setCamera(e){this._camera=e,this._aspect=e.aspect,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}},Fr=class{get sharedAssets(){return this.shared}constructor(e,t={},i=!0){this.shared=new Ei(e.shared,t,!0,i),this.scene=new OI(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof DS&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof Eh&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}},Fs=class{constructor({x:e=10,y:t=10}){this._startTime=0;let i=document.getElementById("spe-perfs");i?this.element=i:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){this.element.parentElement?.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let e=performance.now()-this._startTime;this.element.innerHTML=e.toFixed(3)+" ms"}};function Fa(e){return e instanceof Ef?"SubdivObject":"NonParametricGeometry"===e.geometry.type?"NonParametric":"Mesh"}var Fn=tL(tj(),1);function Fo(e){return"texture"===e.type||"video"===e.type||"matcap"===e.type?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}var Fl=new _R(0,0,0,1),Fh={color:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],matcap:[],pattern:["colorA","colorB"],light:[],displace:[],rainbow:[],particle:[]},Fc=new t9;function Fd(e){let t=new _R(0,0,0,1);try{t.setStyle(e)}catch(e){console.error(e)}finally{return t}}var Fu=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r}={}){this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHe
8186ight=window.innerHeight,this._proxyObjectCache=new Map,this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=e=>{if(this.time=e,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer||!this._isPaused&&("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start.hasVideoAction||this._eventManager.handlers?.Basic.hasVideoAction||this._eventManager.handlers?.Conditional.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<32?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.update(this.dt),this._skipRender=!1)}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&((this._eventManager.handlers?.Follow).onAnimationFrameDamping(),(this._eventManager.handlers?.LookAt).onAnimationFrameDamping(),(this._eventManager.handlers?.DragDrop).onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration;this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()},this._resize=e=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=Fc.set(this._viewportWidth,this._viewportHeight)),e){let e=this._viewportWidth,t=this._viewportHeight;this._renderer.setSize(e-1,t-1,!1),this._renderer.setSize(e,t,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let e=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera("fullscreen"!==e),"PerspectiveCamera"===this._camera.cameraType&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=u8(this._resize,10),this._onScroll=e=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this.renderMode=t?"auto":i,void 0!==r&&(this._wasmPath=pc(r,"/")),this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&(this._perfs=new Fs({x:10,y:10})),e.addEventListener("pointerdown",p_,!0),e.addEventListener("pointerdown",pM,!0),e.addEventListener("pointermove",pM,!0),e.addEventListener("pointerup",pA,!0),e.addEventListener("pointercancel",pA,!0),e.addEventListener("pointerleave",pA,!0),window.addEventListener("keydown",pC,!0),window.addEventListener("keyup",pT,!0)}async load(e,t,i){let r;r="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.",e.endsWith(".spline")?console.warn(r+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(r),this.disposed=!1;let a=await (await fetch(e,i)).arrayBuffer();await this.start(a,{variables:t})}async start(e,{interactive:t=!0,variables:r}={}){var a,o;let l,h,c,d,p;if(this.disposed)return;Rr.init();let f=await zH(e);this._data=f;let m=(l=[],f.scene.objects.traverse((e,t)=>
8186{"Mesh"===t.type&&"NonParametricGeometry"===t.geometry.type&&void 0!==t.geometry.data.draco&&l.push(t)}),l);f.version&&(0,Fn.default)(f.version,"1.12.98")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),void 0!==this._wasmPath&&this.setUIWasmUrl(`${this._wasmPath}/ui.wasm`),await Promise.all([m.length&&zj(this._wasmPath),Ch(f)&&(a=this._wasmPath,Az||(Az=async function(){let e=i.e(5774).then(i.bind(i,45774)),[t,r]=await Promise.all([e,fetch(`${a??"https://unpkg.com/@splinetool/[email protected]/build"}/boolean.wasm`).then(e=>e.arrayBuffer())]),o=t.default,l=await o({wasmBinary:r});AB(l)}())),(h=!1,f.scene.objects.traverse((e,t)=>{"Mesh"===t.type&&"SubdivGeometry"===t.geometry.type&&(h=!0)}),h&&function(e){if(!SK)return S2||(S2=t());async function t(){let t=i.e(515).then(i.bind(i,90515)),[r,a]=await Promise.all([t,fetch(`${e??"https://unpkg.com/@splinetool/[email protected]/build"}/process.wasm`).then(e=>e.arrayBuffer())]),o=r.default,l=await o({wasmBinary:a});SX(l),SK=!0}}(this._wasmPath)),xt.physicsEnabled(f.scene.objects)&&(pQ||(pQ=async function(){let e=await i.e(5268).then(i.bind(i,77719));await e.init(),pF(e)}())),ER(f)&&function(){if(Mj=!0,!MH)return EL||(EL=e());async function e(){let e=await i.e(4882).then(i.bind(i,57741));MU(e),MH=!0}}(),Ob(f)&&function(){if(!OT)return O$||(O$=e());async function e(){let e=await i.e(5232).then(i.bind(i,25232));OM(e),OT=!0}}(),(c=!1,d=[],f.scene.objects.traverse((e,t)=>{if("Page"===t.type&&void 0!==t.uiScene&&t.uiScene.objects.traverse((e,t)=>{if(void 0===t.events||!1===Array.isArray(t.events))return!0;Mz(t.events,d),c=c||d.some(e=>"Audio"===e.data.type)}),void 0===t.events||!1===Array.isArray(t.events))return!0;Mz(t.events,d),c=c||d.some(e=>"Audio"===e.data.type)}),c&&function(){if(!MB)return MF||(MF=e());async function e(){await i.e(9836).then(i.bind(i,39836)),MO(void 0!==window?window:global),MB=!0}}()),PX(f)&&function(){if(!Pq)return P$||(P$=e());async function e(){let e=await i.e(8170).then(i.bind(i,58170));PF(e.default??e),Pq=!0}}(),(p=!1,f.scene.objects.forEach(e=>{"Page"===e.data.type&&!p&&e.data.publish.gameControlObject&&xt.traverseModuleInstances(f,e.id,(e,t,i)=>{for(let e of i)"GameControl"===e.data.type&&e.data.navmesh.enabled&&(p=!0)})}),p&&(o=this._wasmPath,pz||(pz=async function(){let e=i.e(2386).then(i.bind(i,82386)),[t,r]=await Promise.all([e,fetch(`${o??"https://unpkg.com/@splinetool/[email protected]/build"}/navmesh.wasm`).then(e=>e.arrayBuffer())]),a=t.default,l=await a({wasmBinary:r});pB(l)}())))].filter(Boolean)),m.length&&await zW(m),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let g=new Fr(f);if(g.resetPersonalCameraFromDocumentData(),this._scene=g.scene,this._sharedAssetsManager=g.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let e=performance.now();!function(e,t){let i,r;let a=(i={},t.traverseEntity(t=>{if(!t.visible||!(t instanceof _A)||"Mesh"!==t.type||Array.isArray(t.material)||t.states&&Object.keys(t.states).length)return;let r=t.parent;for(;r;){if(r instanceof _A&&t.states&&Object.keys(t.states).length)return;r=r.parent}let a=t.material.uuid,o=e.shared.materials[a];if(o){if(!vv.isMergable(o))return}else{let i=e.scene.objects.get(t.uuid)?.data;if(i&&"material"in i&&"string"!=typeof i.material){if(!vv.isMergable(i.material))return;a=vv.getHash(i.material)}}i[a]||(i[a]={});let l=i[a][Fa(t)];if(l){if(l.push(t),t.cloner)for(let e of t.cloner.children)l.push(e)}else if(i[a][Fa(t)]=[t],t.cloner)for(let e of t.cloner.children)i[a][Fa(t)].push(e)}),i),o=(r=0,Object.values(a).forEach(e=>{Object.values(e).forEach(e=>{let t=e.length;t>r&&(r=t)})}),r),l=Array(o),h=0,c=Array(o),d=0,p=Array(o),f=0,m=Array(o),g=0;for(let[e,i]of Object.entries(a))for(let r of Object.values(i)){if(d=0,f=0,r.forEach(e=>{e instanceof _A&&(c[d++]=e.geometry.clone(),p[f++]=e)}),f<2)continue;for(let e=0;e<f;e++)p[e].updateWorldMatrix(!0,!1),c[e].applyMatrix4(p[e].matrixWorld),0>p[e].matrixWorld.determinant()&&function(e){let t;if(e.index)for(let i=0;i<e.index.array.length;i+=3)t=e.index.array[i],e.index.array[i]=e.index.array[i+2],e.index.array[i+2]=t}(c[e]);let i=v3(c.slice(0,d),!1);if(i){let r;"SubdivObject"===e&&console.warn("Turning subdiv object into mesh"),(r=new r7(i,p[0].material)).castShadow=p[0].castShadow,r.receiveShadow=p[0].receiveShadow,t.add(r);let o=e=>{for(let t of(g=0,e))t.children&&o(t.children),t instanceof _A&&(Array.isArray(t.material)||a[t.material.uuid]&&a[t.material.uuid][Fa(t)]&&a[t.material.uuid][Fa(t)].length>1||(m[g++]=t));for(let e=0;e<g;e++)t.attach(m[e])};for(let e=0;e<f;e++){let t=p[e];o(t.children),l[h++]=t}}}for(let e=0;e<h;e++)l[e].removeFromParent()}(f,g.scene),console.log("Merged geometries in ",performance.now()-e," ms")}Ch(f)&&this._scene.traverse(e=>{Cp(e)&&e.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(e=>
8186{e instanceof EJ&&e.pendingMediaLoad&&e.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(e=>{"ParticleSystem"===e.type&&(e.wakeUp(),e.data.autoPlay?e.start():e.stop())});let v=Object.keys(f.shared.fonts).map(e=>this._sharedAssetsManager.getFont(e).loadingPromise);if(Promise.all(v).then(()=>{this.disposed||(g.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),ER(f)&&function(e){if(xt.physicsEnabled(e.scene.objects))return!0;let t=!1;return e.scene.objects.traverse((e,i)=>{if(i.events){if(Array.isArray(i.events)){for(let e of i.events)if(!0!==e.data.disabled&&"GameControl"===e.data.type&&e.data.collisionEnabled){t=!0;break}}else for(let e of Object.values(i.events))if(!0!==e.disabled&&"GameControl"===e.type&&e.collisionEnabled){t=!0;break}}}),t}(f)&&await Promise.all(v),PX(f)){let e=[];this._scene.traverseEntity(t=>{(t instanceof DO||t instanceof DS)&&t.uiCanvas&&e.push(t.uiCanvas)}),await Promise.all(e.map(e=>e.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),RO(this._scene.activePage,this._sharedAssetsManager),!this._renderer){this._renderer=new Px({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._renderer.hdTransmission=!0===f.scene.publish.hdTransmission;let e=this._getPixelRatio(/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?f.scene.publish.settings.web.pixelRatioMobile:f.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(e),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),f.shared.images.SplineWatermark){let e=this._sharedAssetsManager.getImage("SplineWatermark");await e.loadPromise;let t=e.getTexture(1001);this._renderer.pipeline.setWatermark(t)}}Ob(f)&&this._scene.initializeSplatViewer(),void 0!==f.scene.blueNoiseTextureData&&this._renderer.pipeline.updateBlueNoiseTexture(f.scene.blueNoiseTextureData);let y=Object.values(f.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===y.preset?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=y.size[0],this._viewportHeight=y.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new Fi(this._renderer,this._camera,new t9(this._viewportWidth,this._viewportHeight),new t9(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(y.allowResponsive??!1)&&"fullscreen"===y.preset),t){let e=new LW(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,y);this._scene.updateMatrixWorld(!0),this._controls=new zB(e),this._animationControls=new zN(this._scene,this._requestRenderAutoMode),this._eventManager=new Ft(f.scene.publish,this._controls,this._animationControls,e,f.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),void 0!==r&&this.setVariables(r),0===this.dt&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll)}setVariables(e){if(void 0!==this._data)for(let[t,i]of Object.entries(e))this.setVariable(t,i)}setVariable(e,t){let i=this._getVariableByName(e);
vendor: 4,893 bytes, line 8186
8186if(!i||"dynamicVariableType"in i.data)void 0===i?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`);else{let e=t;"number"==typeof i.data.value?e="number"==typeof t?t:"boolean"==typeof t?!0===t?1:0:parseFloat(t):"boolean"==typeof i.data.value?e="number"==typeof t?!!t:"boolean"==typeof t?t:"false"!==t.toLocaleLowerCase()&&!!t:"string"!=typeof i.data.value&&void 0!==i.data.value.textValue&&(e=t.toString());let r="string"==typeof e?{textValue:e}:e;this._sharedAssetsManager?.updateVariable(i.id,r),this.requestRender(),this._requestRenderAutoMode()}}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{void 0===e[t.data.name]&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let e=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(e)}}_getVariableValue(e){return"string"!=typeof e&&xn.isTextValue(e)?xn.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(t=>t.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(t.uuid!==gl&&!this._scene.isInvisibleObjects(t)&&!(t instanceof DS)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof zf&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=Fd(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){var e;this.disposed=!0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,AU&&AU.disposeAll(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{hF.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,(e=this.canvas).removeEventListener("pointerdown",p_,!0),e.removeEventListener("pointerdown",pM,!0),e.removeEventListener("pointermove",pM,!0),e.removeEventListener("pointerup",pA,!0),e.removeEventListener("pointercancel",pA,!0),e.removeEventListener("pointerleave",pA,!0),window.removeEventListener("keydown",pC,!0),window.removeEventListener("keyup",pT,!0),document.removeEventListener("scroll",this._onScroll),Rr.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){this._isPaused&&(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){let t,i,r,a;if(!this._scene)return;let o=this._scene;if(null==e)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(e=>
8186{e instanceof DS&&(t=e.name)});let l=this._sharedAssetsManager,h={shared:l,scene:this._scene},c=t=>{if(null===t||"Base State"===t)return null;if(t&&e.data.states){let i=e.data.states.find(e=>e.data.name===t);return i?i.id:void 0}},d="material"in e?e.material:void 0,p=hF({name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:t,material:d?(r=(i=Array.isArray(d)?d[0]:d).layers.map(Fo),a=i.layers.find(e=>"light"===e.type),{layers:r,alpha:a.node.alphaOverride?.value??1}):void 0,parentUuid:e.parent instanceof DS||e instanceof OI?void 0:e.parent?.uuid,emitEvent(t){e.dispatchEvent({type:"userEvent",eventName:t})},emitEventReverse(t){e.dispatchEvent({type:"userEvent",eventName:t,reverse:!0})},hide(){e.visible&&(e.visible=!1,h.shared.requestRender())},show(){e.visible||(e.visible=!0,h.shared.requestRender())},get state(){let t=e.stateSelection;if(null!==t)return e.data.states.find(({id:e})=>e===t)?.data.name},set state(u){let t;if(void 0!==u){let i="string"==typeof u?e.data.states.find(({id:e})=>e===u):e.data.states[u];if(i)t=i.id;else{let e="string"==typeof u?c(u):void 0;e&&(t=e)}}e.changeSelectedState(t??null,h),e.currentState=t??null,e.dispatchEvent({type:"completeState",state:t??null}),h.shared.requestRender()},transition(t){let i=this,r,a=Rr.timeline({autoplay:t.autoPlay??!0}),h={transition({from:t,to:h,duration:d,delay:p,...f}){let m=c(t);void 0===m&&(m=r);let g=c(h);r=g;let v=new Rk(e,m,g,{state:g,repeat:0,delay:p??0,delayDirection:"start-once",direction:"normal",duration:d??1e3,...f,...6===f.easing?g_.defaultData:5===f.easing?gF.defaultData:{}},l,!1,o.activePage);return a.add({...v.params,begin:()=>{(t&&m||"Base State"===t&&!m)&&(i.state=m??void 0)},complete:()=>{i.state=g??void 0}},a.duration),this},play(){return a.play(),this},pause(){return a.pause(),this},reset(){return a.reset(),this},seek(e){return a.seek(e),this}};return h.transition(t),h},set color(u){let t=Fd(u);if(PB.is(e)){e.color=t;return}if("Mesh"!==e.type||!("material"in e)||!(e instanceof Er))return;let i={r:t.r,g:t.g,b:t.b,a:t.a},r=Array.isArray(e.material)?e.material[0]:e.material,a=r.data.layers.find(e=>"color"===e.data.type)?.id;if(a)r.updateByOp({type:0,path:["layers",a],props:{color:{...i}}},r.data,h);else{let e=r.data,t=e.layers.find(e=>"light"===e.data.type);if(!t)return;let a=0===e.layers.indexOf(t)?t:null,o=e.layers.at(a?e.layers.indexOf(a)+1:0),l={type:4,fi:a?a.fi+(o?(o.fi-a.fi)/2:1):o?o.fi/2:1,id:t8.generateUUID(),data:{...g3.defaultData("color"),color:i},localIndex:0},c=e.layers.insertAfterHelper(a?.id??null,1),d=e.layers.runOp({...l,fi:c[0]}).data;Object.assign(r.data,{layers:d}),r.updateByOp({...l,path:["layers"]},r.data,h)}}},(t,i)=>{let r=e[t],a=t.split(".");"material"===a[0]&&d&&function(e,t,i){let r=Array.isArray(i)?i[0]:i;if("layers"===e[0]){let i=parseInt(e[1]),a=r.layers[i],o=e[2];a&&o&&function(e,t,i){let r=e[0];try{var a,o;if(a=i.type,e.slice(1),Fh[a]?.includes(r)){if("colors"===r){if(e.length<2)throw Error("You cannot mutate the colors array, only its items");let a=parseInt(e[1]),o=i.getValue(r)?.[a];if(o)Fl.setStyle(t),o.set(Fl.r,Fl.g,Fl.b,Fl.a);else throw Error("Color index out of range")}else i.getValue(r)?.setStyle(t)}else if("texture"===r||"video"===r){let r=i.color;(function(e,t,i,r){let a=e[0];if("repeat"===a||"offset"===a){let r=e[1];if(void 0===r)t instanceof Array&&2===t.length&&Object.assign(i.mat,{[a]:t});else{let e=i.mat[a],o=0===parseInt(r)?[parseFloat(t),e[1]]:[e[0],parseFloat(t)];Object.assign(i.mat,{[a]:o})}i.mat.updateMatrix()}else"rotation"===a?(i.mat.rotation=parseFloat(t),i.mat.updateMatrix()):"wrapping"===a||"minFilter"===a||"magFilter"===a?"wrapping"===a?i.texture.wrap=t:i.texture[a]=t:"image"===a&&"data"===e[1]&&i.texture.image.updateSrc(t)})(e.slice(1),t,r,0)}else{let a=e[1],o=i.getValue(r);o?.isVector3&&void 0!==a||o?.isVector2&&void 0!==a?o.setComponent(parseInt(a),t):i.setValue(r,t)}}catch(e){console.error("Error setting material value",e)}}(e.slice(2),t,a)}else"alpha"===e[0]&&r.layers.forEach(e=>{"light"===e.type&&void 0!==e.node.alphaOverride&&(e.node.alphaOverride.value=t,t<1&&(r.transparent=!0))})}(a.slice(1),i,d),"object"!=typeof r&&Object.getOwnPropertyDescriptor(e,t)?.writable&&(e[t]=i),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,p),p}setUIWasmUrl(e){Ak.skiaWasmUrl=e}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if("string"==typeof t){if(t.endsWith(".splinegeometry"))i=new Uint8Array(await (await fetch(t)).arrayBuffer());else throw Error("Only .splinegeometry format is supported")}else i=t;let r=mL.deserialize(i),a="data"in r&&void 0!==r.data.draco;a&&await zj(this._wasmPath);let o=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);
8186if(!o){console.warn(`Object ${e} not found`);return}if("Mesh"!==o.data.type||!(o instanceof Er)){console.warn(`Object ${e} is not a mesh`);return}let l={...o.data,geometry:r};for(let e of(a&&await zW([l]),o.updateByOp({type:0,path:[],props:{geometry:l.geometry}},l,{shared:this._sharedAssetsManager,scene:this._scene},!1),o.data.states)){let t={...e.data};o.states||(o.states={}),o.states[e.id]=y5.patch(l,t)}return i}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.