1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/howler-wePr8Kjv.js","assets/spline-react-B0mPUlou.js"])))=>i.map(i=>d[i]); 2const t={},e=function(e,i,n){let r=Promise.resolve();if(i&&i.length>0){let e=function(t){return Promise.all(t.map(t=>Promise.resolve(t).then(t=>({status:"fulfilled",value:t}),t=>({status:"rejected",reason:t}))))};document.getElementsByTagName("link");const n=document.querySelector("meta[property=csp-nonce]"),s=n?.nonce||n?.getAttribute("nonce");r=e(i.map(e=>{if((e=function(t){return"/"+t}(e))in t)return;t[e]=!0;const i=e.endsWith(".css"),n=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${n}`))return;const r=document.createElement("link");return r.rel=i?"stylesheet":"modulepreload",i||(r.as="script"),r.crossOrigin="",r.href=e,s&&r.setAttribute("nonce",s),document.head.appendChild(r),i?new Promise((t,i)=>{r.addEventListener("load",t),r.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${e}`)))}):void 0}))}function s(t){const e=new Event("vite:preloadError",{cancelable:!0});if(e.payload=t,window.dispatchEvent(e),!e.defaultPrevented)throw t}return r.then(t=>{for(const e of t||[])"rejected"===e.status&&s(e.reason);return e().catch(s)})};var i=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,l=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),h=(t,e,l)=>(l=null!=t?i(a(t)):{},((t,e,i,a)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let l of s(e))!o.call(t,l)&&l!==i&&n(t,l,{get:()=>e[l],enumerable:!(a=r(e,l))||a.enumerable});return t})(!e&&t&&t.__esModule?l:n(l,"default",{value:t,enumerable:!0}),t)),c=(t,e,i)=>(((t,e,i)=>{e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,"symbol"!=typeof e?e+"":e,i),i),d=l((t,e)=>{var i,n;i=t,n=function(){return t.importState=function(e){var i=new t;return i.importState(e),i},t;function t(){return function(t){var e=0,i=0,n=0,r=1;0==t.length&&(t=[+new Date]);var s=function(){var t=4022871197,e=function(e){e=e.toString();for(var i=0;i<e.length;i++){var n=.02519603282416938*(t+=e.charCodeAt(i));n-=t=n>>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)};return e.version="Mash 0.9",e}();e=s(" "),i=s(" "),n=s(" ");for(var a=0;a<t.length;a++)(e-=s(t[a]))<0&&(e+=1),(i-=s(t[a]))<0&&(i+=1),(n-=s(t[a]))<0&&(n+=1);s=null;var o=function(){var t=2091639*e+2.3283064365386963e-10*r;return e=i,i=n,n=t-(r=0|t)};return o.next=o,o.uint32=function(){return 4294967296*o()},o.fract53=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.version="Alea 0.9",o.args=t,o.exportState=function(){return[e,i,n,r]},o.importState=function(t){e=+t[0]||0,i=+t[1]||0,n=+t[2]||0,r=+t[3]||0},o}(Array.prototype.slice.call(arguments))}},"object"==typeof t?e.exports=n():"function"==typeof define&&define.amd?define(n):i.Alea=n()}),u=l((t,e)=>{var i,n;i=t,n=function(t){t.SVD=function(t,e,i,n,r){if(e=void 0===e||e,i=void 0===i||i,r=1e-64/(n=n||Math.pow(2,-52)),!t)throw new TypeError("Matrix a is not defined");var s,a,o,l,h,c,d,u,p,f,m,g,v=t[0].length,y=t.length;if(y<v)throw new TypeError("Invalid matrix: m < n");for(var x=[],b=[],w=[],S="f"===e?y:v,_=f=d=0;_<y;_++)b[_]=new Array(S).fill(0);for(_=0;_<v;_++)w[_]=new Array(v).fill(0);var A,M=new Array(v).fill(0);for(_=0;_<y;_++)for(s=0;s<v;s++)b[_][s]=t[_][s];for(_=0;_<v;_++){for(x[_]=d,p=0,o=_+1,s=_;s<y;s++)p+=Math.pow(b[s][_],2);if(p<r)d=0;else for(u=(c=b[_][_])*(d=c<0?Math.sqrt(p):-Math.sqrt(p))-p,b[_][_]=c-d,s=o;s<v;s++){for(p=0,a=_;a<y;a++)p+=b[a][_]*b[a][s];for(c=p/u,a=_;a<y;a++)b[a][s]=b[a][s]+c*b[a][_]}for(M[_]=d,p=0,s=o;s<v;s++)p+=Math.pow(b[_][s],2);if(p<r)d=0;else{for(u=(c=b[_][_+1])*(d=c<0?Math.sqrt(p):-Math.sqrt(p))-p,b[_][_+1]=c-d,s=o;s<v;s++)x[s]=b[_][s]/u;for(s=o;s<y;s++){for(p=0,a=o;a<v;a++)p+=b[s][a]*b[_][a];for(a=o;a<v;a++)b[s][a]=b[s][a]+p*x[a]}}f<(m=Math.abs(M[_])+Math.abs(x[_]))&&(f=m)}if(i)for(_=v-1;0<=_;_--){if(0!==d){for(u=b[_][_+1]*d,s=o;s<v;s++)w[s][_]=b[_][s]/u;for(s=o;s<v;s++){for(p=0,a=o;a<v;a++)p+=b[_][a]*w[a][s];for(a=o;a<v;a++)w[a][s]=w[a][s]+p*w[a][_]}}for(s=o;s<v;s++)w[_][s]=0,w[s][_]=0;w[_][_]=1,d=x[_],o=_}if(e){if("f"===e)for(_=v;_<y;_++){for(s=v;s<y;s++)b[_][s]=0;b[_][_]=1}for(_=v-1;0<=_;_--){for(o=_+1,d=M[_],s=o;s<S;s++)b[_][s]=0;if(0!==d){for(u=b[_][_]*d,s=o;s<S;s++){for(p=0,a=o;a<y;a++)p+=b[a][_]*b[a][s];for(c=p/u,a=_;a<y;a++)b[a][s]=b[a][s]+c*b[a][_]}for(s=_;s<y;s++)b[s][_]=b[s][_]/d}else for(s=_;s<y;s++)b[s][_]=0;b[_][_]=b[_][_]+1}}for(n*=f,a=v-1;0<=a;a--)for(var C=0;C<50;C++){for(A=!1,o=a;0<=o;o--){if(Math.abs(x[o])<=n){A=!0;break}if(Math.abs(M[o-1])<=n)break}if(!A)for(h=0,l=o-(p=1),_=o;_<a+1&&(c=p*x[_],x[_]=h*x[_],!(Math.abs(c)<=n));_++)if(d=M[_],M[_]=Math.sqrt(c*c+d*d),h=d/(u=M[_]),p=-c/u,e)for(s=0;s<y;s++)m=b[s][l],g=b[s][_],b[s][l]=m*h+g*p,b[s][_]=-m*p+g*h;if(g=M[a],o===a){if(g<0&&(M[a]=-g,i))for(s=0;s<v;s++)w[s][a]=-w[s][a];break}
2for(f=M[o],c=(((m=M[a-1])-g)*(m+g)+((d=x[a-1])-(u=x[a]))*(d+u))/(2*u*m),d=Math.sqrt(c*c+1),c=((f-g)*(f+g)+u*(m/(c<0?c-d:c+d)-u))/f,_=o+(p=h=1);_<a+1;_++){if(d=x[_],m=M[_],u=p*d,d*=h,g=Math.sqrt(c*c+u*u),c=f*(h=c/(x[_-1]=g))+d*(p=u/g),d=-f*p+d*h,u=m*p,m*=h,i)for(s=0;s<v;s++)f=w[s][_-1],g=w[s][_],w[s][_-1]=f*h+g*p,w[s][_]=-f*p+g*h;if(g=Math.sqrt(c*c+u*u),c=(h=c/(M[_-1]=g))*d+(p=u/g)*m,f=-p*d+h*m,e)for(s=0;s<y;s++)m=b[s][_-1],g=b[s][_],b[s][_-1]=m*h+g*p,b[s][_]=-m*p+g*h}x[o]=0,x[a]=c,M[a]=f}for(_=0;_<v;_++)M[_]<n&&(M[_]=0);return{u:b,q:M,v:w}},t.VERSION="1.1.1",Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof t&&typeof e<"u"?n(t):"function"==typeof define&&define.amd?define(["exports"],n):n((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})}),p=l((t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){if(null===t||!0===t||!1===t)return NaN;var e=Number(t);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)},e.exports=t.default}),f=l((t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),t.getTime()-e.getTime()},e.exports=t.default}),m=l((t,e)=>{function i(t,e,n,r){this.message=t,this.expected=e,this.found=n,this.location=r,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,i)}!function(t,e){function i(){this.constructor=t}i.prototype=e.prototype,t.prototype=new i}(i,Error),i.buildMessage=function(t,e){var i,n={literal:function(t){return'"'+s(t.text)+'"'},class:function(t){var e,i="";for(e=0;e<t.parts.length;e++)i+=t.parts[e]instanceof Array?a(t.parts[e][0])+"-"+a(t.parts[e][1]):a(t.parts[e]);return"["+(t.inverted?"^":"")+i+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function r(t){return t.charCodeAt(0).toString(16).toUpperCase()}function s(t){return t.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(t){return"\\x0"+r(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+r(t)})}function a(t){return t.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(t){return"\\x0"+r(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+r(t)})}function o(t){return n[t.type](t)}return"Expected "+function(t){var e,i,n=new Array(t.length);for(e=0;e<t.length;e++)n[e]=o(t[e]);if(n.sort(),n.length>0){for(e=1,i=1;e<n.length;e++)n[e-1]!==n[e]&&(n[i]=n[e],i++);n.length=i}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(t)+" but "+(((i=e)?'"'+s(i)+'"':"end of input")+" found.")},e.exports={SyntaxError:i,parse:function(t,e){e=void 0!==e?e:{};var n,r={},s={svg_path:ft},a=ft,o=function(t){if(!t)return[];for(var e=[],i=0;i<t.length;i++)e=e.concat.apply(e,t[i]);var n=e[0];return n&&"m"==n.code&&(delete n.relative,n.code="M"),e},l=function(t,e){return function(t,e){if(!e)return[t];for(var i=[t],n=0,r=e.length;n<r;n++)i[n+1]=e[n][1];return i}(t,e)},h=/^[Mm]/,c=ct(["M","m"],!1,!1),d=function(t,e,i){var n=Ut(t,[e]);return i&&(n=n.concat(Ut("M"==t?"L":"l",i[1]))),n},u=/^[Zz]/,p=ct(["Z","z"],!1,!1),f=function(){return Ut("Z")},m=/^[Ll]/,g=ct(["L","l"],!1,!1),v=function(t,e){return Ut(t,e)},y=/^[Hh]/,x=ct(["H","h"],!1,!1),b=function(t,e){return Ut(t,e.map(function(t){return{x:t}}))},w=/^[Vv]/,S=ct(["V","v"],!1,!1),_=function(t,e){return Ut(t,e.map(function(t){return{y:t}}))},A=/^[Cc]/,M=ct(["C","c"],!1,!1),C=function(t,e,i){return{x1:t.x,y1:t.y,x2:e.x,y2:e.y,x:i.x,y:i.y}},E=/^[Ss]/,P=ct(["S","s"],!1,!1),T=function(t,e){return{x2:t.x,y2:t.y,x:e.x,y:e.y}},D=/^[Qq]/,I=ct(["Q","q"],!1,!1),O=function(t,e){return{x1:t.x,y1:t.y,x:e.x,y:e.y}},R=/^[Tt]/,L=ct(["T","t"],!1,!1),B=/^[Aa]/,z=ct(["A","a"],!1,!1),F=function(t,e,
2i,n,r,s){return{rx:t,ry:e,xAxisRotation:i,largeArc:n,sweep:r,x:s.x,y:s.y}},N=function(t,e){return{x:t,y:e}},U=function(t){return 1*t},k=function(t){return 1*t.join("")},V=/^[01]/,j=ct(["0","1"],!1,!1),G=function(t){return"1"==t},W=function(){return""},H=",",q=ht(",",!1),X=function(t){return t.join("")},Y=".",Q=ht(".",!1),Z=/^[eE]/,K=ct(["e","E"],!1,!1),J=/^[+\-]/,$=ct(["+","-"],!1,!1),tt=/^[0-9]/,et=ct([["0","9"]],!1,!1),it=function(t){return t.join("")},nt=/^[ \t\n\r]/,rt=ct([" ","\t","\n","\r"],!1,!1),st=0,at=[{line:1,column:1}],ot=0,lt=[];if("startRule"in e){if(!(e.startRule in s))throw new Error("Can't start parsing from rule \""+e.startRule+'".');a=s[e.startRule]}function ht(t,e){return{type:"literal",text:t,ignoreCase:e}}function ct(t,e,i){return{type:"class",parts:t,inverted:e,ignoreCase:i}}function dt(e){var i,n=at[e];if(n)return n;for(i=e-1;!at[i];)i--;for(n={line:(n=at[i]).line,column:n.column};i<e;)10===t.charCodeAt(i)?(n.line++,n.column=1):n.column++,i++;return at[e]=n,n}function ut(t,e){var i=dt(t),n=dt(e);return{start:{offset:t,line:i.line,column:i.column},end:{offset:e,line:n.line,column:n.column}}}function pt(t){st<ot||(st>ot&&(ot=st,lt=[]),lt.push(t))}function ft(){var t,e,i,n,s;for(t=st,e=[],i=Rt();i!==r;)e.push(i),i=Rt();if(e!==r)if(i=function(){var t,e,i,n,s,a;if(t=st,e=mt(),e!==r){for(i=[],n=st,s=[],a=Rt();a!==r;)s.push(a),a=Rt();for(s!==r?(a=mt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;){for(i.push(n),n=st,s=[],a=Rt();a!==r;)s.push(a),a=Rt();s!==r?(a=mt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r)}i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}(),i===r&&(i=null),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?t=e=o(i):(st=t,t=r)}else st=t,t=r;else st=t,t=r;return t}function mt(){var e,i,n,s,a,o;if(e=st,i=function(){var e,i,n,s,a,o,l;if(e=st,h.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(c)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=_t())!==r?(a=st,(o=Et())===r&&(o=null),o!==r?(l=vt())!==r?a=o=[o,l]:(st=a,a=r):(st=a,a=r),a===r&&(a=null),a!==r?e=i=d(i,s,a):(st=e,e=r)):(st=e,e=r):(st=e,e=r)}else st=e,e=r;return e}(),i!==r){for(n=[],s=st,a=[],o=Rt();o!==r;)a.push(o),o=Rt();for(a!==r?(o=gt())!==r?s=a=[a,o]:(st=s,s=r):(st=s,s=r);s!==r;){for(n.push(s),s=st,a=[],o=Rt();o!==r;)a.push(o),o=Rt();a!==r?(o=gt())!==r?s=a=[a,o]:(st=s,s=r):(st=s,s=r)}n!==r?e=i=l(i,n):(st=e,e=r)}else st=e,e=r;return e}function gt(){var e;return(e=function(){var e,i;return e=st,u.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(p)),i!==r&&(i=f()),e=i,e}())===r&&((e=function(){var e,i,n,s;if(e=st,m.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(g)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=vt())!==r?e=i=v(i,s):(st=e,e=r):(st=e,e=r)}else st=e,e=r;return e}())===r&&((e=function(){var e,i,n,s;if(e=st,y.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(x)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=yt())!==r?e=i=b(i,s):(st=e,e=r):(st=e,e=r)}else st=e,e=r;return e}())===r&&((e=function(){var e,i,n,s;if(e=st,w.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(S)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=yt())!==r?e=i=_(i,s):(st=e,e=r):(st=e,e=r)}else st=e,e=r;return e}())===r&&((e=function(){var e,i,n,s;if(e=st,A.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(M)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=function(){var t,e,i,n,s,a;if(t=st,e=xt(),e!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=xt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=xt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}(),s!==r?e=i=v(i,s):(st=e,e=r)):(st=e,e=r)}else st=e,e=r;return e}())===r&&((e=function(){var e,i,n,s;if(e=st,E.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(P)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=function(){var t,e,i,n,s,a;if(t=st,e=bt(),e!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=bt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=bt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}(),s!==r?e=i=v(i,s):(st=e,e=r)):(st=e,e=r)}else st=e,e=r;return e}())===r&&((e=function(){var e,i,n,s;if(e=st,D.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(I)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=function(){var t,e,i,n,s,a;if(t=st,e=wt(),e!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=wt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=wt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}(),s!==r?e=i=v(i,s):(st=e,e=r)):(st=e,e=r)}else st=e,e=r;return e}())===r&&((e=function(){var e,i,n,s;if(e=st,R.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(L)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=function(){var t,e,i,n,s,a;if(t=st,e=_t(),e!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=_t())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=_t())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}(),s!==r?e=i=v(i,s):(st=e,e=r)):(st=e,e=r)}else st=e,e=r;return e}())===r&&(e=function(){var e,i,n,s;if(e=st,B.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(z)),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?(s=function(){var t,e,i,n,s,a;if(t=st,e=St(),e!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=St())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=St())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}(),s!==r?e=i=v(i,s):(st=e,e=r)):(st=e,e=r)}else st=e,e=r;return e}())))))))),e}function vt(){var t,e,i,n,s,a;if(t=st,(e=_t())!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=_t())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=_t())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}function yt(){var t,e,i,n,s,a;if(t=st,(e=Mt())!==r){for(i=[],n=st,(s=Et())===r&&(s=null),s!==r?(a=Mt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);n!==r;)i.push(n),n=st,(s=Et())===r&&(s=null),s!==r?(a=Mt())!==r?n=s=[s,a]:(st=n,n=r):(st=n,n=r);i!==r?t=e=l(e,i):(st=t,t=r)}else st=t,t=r;return t}
2function xt(){var t,e,i,n,s,a;return t=st,(e=_t())!==r?((i=Et())===r&&(i=null),i!==r?(n=_t())!==r?((s=Et())===r&&(s=null),s!==r?(a=_t())!==r?t=e=C(e,n,a):(st=t,t=r):(st=t,t=r)):(st=t,t=r):(st=t,t=r)):(st=t,t=r),t}function bt(){var t,e,i,n;return t=st,(e=_t())!==r?((i=Et())===r&&(i=null),i!==r?(n=_t())!==r?t=e=T(e,n):(st=t,t=r):(st=t,t=r)):(st=t,t=r),t}function wt(){var t,e,i,n;return t=st,(e=_t())!==r?((i=Et())===r&&(i=null),i!==r?(n=_t())!==r?t=e=O(e,n):(st=t,t=r):(st=t,t=r)):(st=t,t=r),t}function St(){var t,e,i,n,s,a,o,l,h,c,d;return t=st,(e=At())!==r?((i=Et())===r&&(i=null),i!==r?(n=At())!==r?((s=Et())===r&&(s=null),s!==r?(a=Mt())!==r?Et()!==r?(o=Ct())!==r?((l=Et())===r&&(l=null),l!==r?(h=Ct())!==r?((c=Et())===r&&(c=null),c!==r?(d=_t())!==r?t=e=F(e,n,a,o,h,d):(st=t,t=r):(st=t,t=r)):(st=t,t=r):(st=t,t=r)):(st=t,t=r):(st=t,t=r):(st=t,t=r):(st=t,t=r)):(st=t,t=r):(st=t,t=r)):(st=t,t=r),t}function _t(){var t,e,i,n;return t=st,(e=Mt())!==r?((i=Et())===r&&(i=null),i!==r?(n=Mt())!==r?t=e=N(e,n):(st=t,t=r):(st=t,t=r)):(st=t,t=r),t}function At(){var t;return(t=Tt())===r&&(t=Ot()),t!==r&&(t=U(t)),t}function Mt(){var t,e,i;return t=st,(e=It())===r&&(e=null),e!==r?(i=Tt())!==r?t=e=[e,i]:(st=t,t=r):(st=t,t=r),t===r&&(t=st,(e=It())===r&&(e=null),e!==r?(i=Ot())!==r?t=e=[e,i]:(st=t,t=r):(st=t,t=r)),t!==r&&(t=k(t)),t}function Ct(){var e;return V.test(t.charAt(st))?(e=t.charAt(st),st++):(e=r,pt(j)),e!==r&&(e=G(e)),e}function Et(){var t,e,i,n,s;if(t=st,e=[],(i=Rt())!==r)for(;i!==r;)e.push(i),i=Rt();else e=r;if(e!==r)if((i=Pt())===r&&(i=null),i!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?t=e=[e,i,n]:(st=t,t=r)}else st=t,t=r;else st=t,t=r;if(t===r){if(t=st,e=st,(i=Pt())!==r){for(n=[],s=Rt();s!==r;)n.push(s),s=Rt();n!==r?e=i=[i,n]:(st=e,e=r)}else st=e,e=r;e!==r&&(e=W()),t=e}return t}function Pt(){var e;return 44===t.charCodeAt(st)?(e=H,st++):(e=r,pt(q)),e}function Tt(){var e,i,n;return e=st,i=function(){var e,i,n,s,a;return e=st,i=st,n=Ot(),n===r&&(n=null),n!==r?(46===t.charCodeAt(st)?(s=Y,st++):(s=r,pt(Q)),s!==r&&(a=Ot())!==r?(n=[n,s,a],i=n):(st=i,i=r)):(st=i,i=r),i===r&&(i=st,n=Ot(),n!==r?(46===t.charCodeAt(st)?(s=Y,st++):(s=r,pt(Q)),s!==r?(n=[n,s],i=n):(st=i,i=r)):(st=i,i=r)),i!==r&&(i=X(i)),e=i,e}(),i!==r?((n=Dt())===r&&(n=null),n!==r?e=i=[i,n]:(st=e,e=r)):(st=e,e=r),e===r&&(e=st,(i=Ot())!==r?(n=Dt())!==r?e=i=[i,n]:(st=e,e=r):(st=e,e=r)),e!==r&&(e=X(e)),e}function Dt(){var e,i,n,s;return e=st,Z.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(K)),i!==r?((n=It())===r&&(n=null),n!==r?(s=Ot())!==r?e=i=[i,n,s]:(st=e,e=r):(st=e,e=r)):(st=e,e=r),e!==r&&(e=X(e)),e}function It(){var e;return J.test(t.charAt(st))?(e=t.charAt(st),st++):(e=r,pt($)),e}function Ot(){var e,i;if(e=[],tt.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(et)),i!==r)for(;i!==r;)e.push(i),tt.test(t.charAt(st))?(i=t.charAt(st),st++):(i=r,pt(et));else e=r;return e!==r&&(e=it(e)),e}function Rt(){var e;return nt.test(t.charAt(st))?(e=t.charAt(st),st++):(e=r,pt(rt)),e!==r&&(e=W()),e}var Lt,Bt,zt,Ft={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 Nt in Ft)Ft[Nt.toUpperCase()]=Ft[Nt];function Ut(t,e){e||(e=[{}]);for(var i=e.length;i--;){var n={code:t,command:Ft[t]};for(var r in t==t.toLowerCase()&&(n.relative=!0),e[i])n[r]=e[i][r];e[i]=n}return e}if((n=a())!==r&&st===t.length)return n;throw n!==r&&st<t.length&&pt({type:"end"}),Lt=lt,Bt=ot<t.length?t.charAt(ot):null,zt=ot<t.length?ut(ot,ot+1):ut(ot,ot),new i(i.buildMessage(Lt,Bt),Lt,Bt,zt)}}}),g=l((t,e)=>{var i=m().parse;i.parseSVG=i,i.makeAbsolute=function(t){var e,i={x:0,y:0},n={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return t.forEach(function(t){for(var r in"moveto"===t.command&&(e=t),t.x0=i.x,t.y0=i.y,n)r in t&&(t[r]+=t.relative?t[n[r]]:0);"x"in t||(t.x=i.x),"y"in t||(t.y=i.y),t.relative=!1,t.code=t.code.toUpperCase(),"closepath"==t.command&&(t.x=e.x,t.y=e.y),i=t}),t},e.exports=i}),v=l((t,e)=>{e.exports=function(t,e){for(var i=t.split("."),n=e.split("."),r=0;r<3;r++){var s=Number(i[r]),a=Number(n[r]);if(s>a)return 1;if(a>s)return-1;if(!isNaN(s)&&isNaN(a))return 1;if(isNaN(s)&&!isNaN(a))return-1}return 0}}),y="149",x=0,b=1,w=2,S=3,_=0,A=1,M=2,C=100,E=101,P=102,T=200,D=201,I=202,O=203,R=204,L=205,B=206,z=207,F=208,N=209,U=210,k=301,V=302,j=306,G=1e3,W=1001,H=1002,q=1003,X=1004,Y=1005,Q=1006,Z=1007,K=1008,J=1009,$=1014,tt=1015,et=1016,it=1020,nt=1023,rt=1026,st=1027,at=1028,ot=1030,lt=33776,ht=33777,ct=33778,dt=33779,ut=36492,pt=2202,ft=2300,mt=2301,gt=2302,vt=2400,yt=2401,xt=2402,bt=2500,wt=3e3,St=3001,_t=3200,At="srgb",Mt="srgb-linear",Ct=7680,Et=35044,Pt="300 es",Tt=1035,Dt=class{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;let i=this._listeners[t];if(void 0!==i){let t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;let e=this._listeners[t.type];if(void 0!==e){t.target=this;let i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}},It=["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"],Ot=1234567,Rt=Math.PI/180,Lt=180/Math.PI;function Bt(){let t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(It[255&t]+It[t>>8&255]+It[t>>16&255]+It[t>>24&255]+"-"+It[255&e]+It[e>>8&255]+"-"+It[e>>16&15|64]+It[e>>24&255]+"-"+It[63&i|128]+It[i>>8&255]+"-"+It[i>>16&255]+It[i>>24&255]+It[255&n]+It[n>>8&255]+It[n>>16&255]+It[n>>24&255]).toLowerCase()}function zt(t,e,i){return Math.max(e,Math.min(i,t))}function Ft(t,e){return(t%e+e)%e}function Nt(t,e,i){return(1-i)*t+i*e}function Ut(t){return!(t&t-1)&&0!==t}function kt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Vt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function jt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Gt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}var Wt=Object.freeze({__proto__:null,DEG2RAD:Rt,RAD2DEG:Lt,ceilPowerOfTwo:kt,clamp:zt,damp:function(t,e,i,n){return Nt(t,e,1-Math.exp(-i*n))},degToRad:function(t){return t*Rt},denormalize:jt,euclideanModulo:Ft,floorPowerOfTwo:Vt,generateUUID:Bt,inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},isPowerOfTwo:Ut,lerp:Nt,mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},normalize:Gt,pingpong:function(t,e=1){return e-Math.abs(Ft(t,2*e)-e)},radToDeg:function(t){return t*Lt},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},seededRandom:function(t){void 0!==t&&(Ot=t);let e=Ot+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},setQuaternionFromProperEuler:function(t,e,i,n,r){let s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),h=s((e+n)/2),c=a((e+n)/2),d=s((e-n)/2),u=a((e-n)/2),p=s((n-e)/2),f=a((n-e)/2);switch(r){case"XYX":t.set(o*c,l*d,l*u,o*h);break;case"YZY":t.set(l*u,o*c,l*d,o*h);break;case"ZXZ":t.set(l*d,l*u,o*c,o*h);break;case"XZX":t.set(o*c,l*f,l*p,o*h);break;case"YXY":t.set(l*p,o*c,l*f,o*h);break;case"ZYZ":t.set(l*f,l*p,o*c,o*h)}},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}}),Ht=class{constructor(t=0,e=0){Ht.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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}
vendor: 4,818 bytes, line 2
2round(){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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},qt=class{constructor(){qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,i,n,r,s,a,o,l){let h=this.elements;return h[0]=t,h[1]=n,h[2]=a,h[3]=e,h[4]=r,h[5]=o,h[6]=i,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],h=i[4],c=i[7],d=i[2],u=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],y=n[4],x=n[7],b=n[2],w=n[5],S=n[8];return r[0]=s*f+a*v+o*b,r[3]=s*m+a*y+o*w,r[6]=s*g+a*x+o*S,r[1]=l*f+h*v+c*b,r[4]=l*m+h*y+c*w,r[7]=l*g+h*x+c*S,r[2]=d*f+u*v+p*b,r[5]=d*m+u*y+p*w,r[8]=d*g+u*x+p*S,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8];return e*s*h-e*a*l-i*r*h+i*a*o+n*r*l-n*s*o}invert(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=h*s-a*l,d=a*o-h*r,u=l*r-s*o,p=e*c+i*d+n*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return t[0]=c*f,t[1]=(n*l-h*i)*f,t[2]=(a*i-n*s)*f,t[3]=d*f,t[4]=(h*e-n*o)*f,t[5]=(n*r-a*e)*f,t[6]=u*f,t[7]=(i*o-l*e)*f,t[8]=(s*e-i*r)*f,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,a){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+t,-n*l,n*o,-n*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Xt.makeScale(t,e)),this}rotate(t){return this.premultiply(Xt.makeRotation(-t)),this}translate(t,e){return this.premultiply(Xt.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,i=t.elements;for(let n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}},Xt=new qt;function Yt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}var Qt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Zt(t,e){return new Qt[t](e)}function Kt(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}
2function Jt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $t(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var te={[At]:{[Mt]:Jt},[Mt]:{[At]:$t}},ee={legacyMode:!0,get workingColorSpace(){return Mt},set workingColorSpace(t){},convert:function(t,e,i){if(this.legacyMode||e===i||!e||!i)return t;if(te[e]&&void 0!==te[e][i]){let n=te[e][i];return t.r=n(t.r),t.g=n(t.g),t.b=n(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},ie={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},ne={r:0,g:0,b:0},re={h:0,s:0,l:0},se={h:0,s:0,l:0};function ae(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function oe(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}var le=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=At){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ee.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=ee.workingColorSpace){return this.r=t,this.g=e,this.b=i,ee.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=ee.workingColorSpace){if(t=Ft(t,1),e=zt(e,0,1),i=zt(i,0,1),0===e)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=ae(r,n,t+1/3),this.g=ae(r,n,t),this.b=ae(r,n,t-1/3)}return ee.toWorkingColorSpace(this,n),this}setStyle(t,e=At){function i(t){void 0!==t&&parseFloat(t)}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t,r=n[1],s=n[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,ee.toWorkingColorSpace(this,e),i(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,ee.toWorkingColorSpace(this,e),i(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){let n=parseFloat(t[1])/360,r=parseFloat(t[2])/100,s=parseFloat(t[3])/100;return i(t[4]),this.setHSL(n,r,s,e)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){let t=n[1],i=t.length;if(3===i)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,ee.toWorkingColorSpace(this,e),this;if(6===i)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,ee.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e=At){let i=ie[t.toLowerCase()];return void 0!==i&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Jt(t.r),this.g=Jt(t.g),this.b=Jt(t.b),this}copyLinearToSRGB(t){return this.r=$t(t.r),this.g=$t(t.g),this.b=$t(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=At){return ee.fromWorkingColorSpace(oe(this,ne),t),zt(255*ne.r,0,255)<<16^zt(255*ne.g,0,255)<<8^zt(255*ne.b,0,255)}getHexString(t=At){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ee.workingColorSpace){ee.fromWorkingColorSpace(oe(this,ne),e);let i,n,r=ne.r,s=ne.g,a=ne.b,o=Math.max(r,s,a),l=Math.min(r,s,a),h=(l+o)/2;if(l===o)i=0,n=0;else{let t=o-l;switch(n=h<=.5?t/(o+l):t/(2-o-l),o){case r:i=(s-a)/t+(s<a?6:0);break;case s:i=(a-r)/t+2;break;case a:i=(r-s)/t+4}i/=6}return t.h=i,t.s=n,t.l=h,t}getRGB(t,e=ee.workingColorSpace){return ee.fromWorkingColorSpace(oe(this,ne),e),t.r=ne.r,t.g=ne.g,t.b=ne.b,t}getStyle(t=At){return ee.fromWorkingColorSpace(oe(this,ne),t),t!==At?`color(${t} ${ne.r} ${ne.g} ${ne.b})`:`rgb(${255*ne.r|0},${255*ne.g|0},${255*ne.b|0})`}offsetHSL(t,e,i){return this.getHSL(re),re.h+=t,re.s+=e,re.l+=i,this.setHSL(re.h,re.s,re.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(re),t.getHSL(se);let i=Nt(re.h,se.h,e),n=Nt(re.s,se.s,e),r=Nt(re.l,se.l,e);return this.setHSL(i,n,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};le.NAMES=ie;var he,ce=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===he&&(he=Kt("canvas")),he.width=t.width,he.height=t.height;let i=he.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=he}return e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Kt("canvas");e.width=t.width,e.height=t.height;let i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);let n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t<r.length;t++)r[t]=255*Jt(r[t]/255);return i.putImageData(n,0,0),e}if(t.data){let e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Jt(e[t]/255)):e[t]=Jt(e[t]);return{data:e,width:t.width,height:t.height}}return t}},de=class{constructor(t=null){this.isSource=!0,this.uuid=Bt(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(ue(n[e].image)):t.push(ue(n[e]))}else t=ue(n);i.url=t}return e||(t.images[this.uuid]=i),i}};function ue(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?ce.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}var pe=0,fe=class extends Dt{constructor(t=fe.DEFAULT_IMAGE,e=fe.DEFAULT_MAPPING,i=W,n=W,r=Q,s=K,a=nt,o=J,l=fe.DEFAULT_ANISOTROPY,h=wt){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:pe++}),this.uuid=Bt(),this.name="",this.source=new de(t),this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Ht(0,0),this.repeat=new Ht(1,1),this.center=new Ht(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new qt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t){this.source.data=t}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(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];let i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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.t
vendor: 4,808 bytes, line 2
2ype,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),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case G:t.x=t.x-Math.floor(t.x);break;case W:t.x=t.x<0?0:1;break;case H:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case G:t.y=t.y-Math.floor(t.y);break;case W:t.y=t.y<0?0:1;break;case H:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}};fe.DEFAULT_IMAGE=null,fe.DEFAULT_MAPPING=300,fe.DEFAULT_ANISOTROPY=1;var me=class{constructor(t=0,e=0,i=0,n=1){me.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r,s=t.elements,a=s[0],o=s[4],l=s[8],h=s[1],c=s[5],d=s[9],u=s[2],p=s[6],f=s[10];if(Math.abs(o-h)<.01&&Math.abs(l-u)<.01&&Math.abs(d-p)<.01){if(Math.abs(o+h)<.1&&Math.abs(l+u)<.1&&Math.abs(d+p)<.1&&Math.abs(a+c+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let t=(a+1)/2,s=(c+1)/2,m=(f+1)/2,g=(o+h)/4,v=(l+u)/4,y=(d+p)/4;return t>s&&t>m?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=g/i,r=v/i):s>m?s<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(s),i=g/n,r=y/n):m<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(m),i=v/r,n=y/r),this.set(i,n,r,e),this}let m=Math.sqrt((p-d)*(p-d)+(l-u)*(l-u)+(h-o)*(h-o));return Math.abs(m)<.001&&(m=1),this.x=(p-d)/m,this.y=(l-u)/m,this.z=(h-o)/m,this.w=Math.acos((a+c+f-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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}
vendor: 4,789 bytes, line 2
2round(){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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},ge=class extends Dt{constructor(t=1,e=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new me(0,0,t,e),this.scissorTest=!1,this.viewport=new me(0,0,t,e);let n={width:t,height:e,depth:1};this.texture=new fe(n,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:Q,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(t,e,i=1){(this.width!==t||this.height!==e||this.depth!==i)&&(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new de(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},ve=class extends fe{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=q,this.minFilter=q,this.wrapR=W,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},ye=class extends ge{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGLMultipleRenderTargets=!0;let r=this.texture;this.texture=[];for(let s=0;s<i;s++)this.texture[s]=r.clone(),this.texture[s].isRenderTargetTexture=!0}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.texture.length;n<r;n++)this.texture[n].image.width=t,this.texture[n].image.height=e,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.texture.length=0;for(let e=0,i=t.texture.length;e<i;e++)this.texture[e]=t.texture[e].clone(),this.texture[e].isRenderTargetTexture=!0;return this}},xe=class{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,s,a){let o=i[n+0],l=i[n+1],h=i[n+2],c=i[n+3],d=r[s+0],u=r[s+1],p=r[s+2],f=r[s+3];if(0===a)return t[e+0]=o,t[e+1]=l,t[e+2]=h,void(t[e+3]=c);if(1===a)return t[e+0]=d,t[e+1]=u,t[e+2]=p,void(t[e+3]=f);
vendor: 4,698 bytes, line 2
2if(c!==f||o!==d||l!==u||h!==p){let t=1-a,e=o*d+l*u+h*p+c*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){let r=Math.sqrt(n),s=Math.atan2(r,e*i);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}let r=a*i;if(o=o*t+d*r,l=l*t+u*r,h=h*t+p*r,c=c*t+f*r,t===1-a){let t=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=t,l*=t,h*=t,c*=t}}t[e]=o,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,r,s){let a=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return t[e]=a*p+h*c+o*u-l*d,t[e+1]=o*p+h*d+l*c-a*u,t[e+2]=l*p+h*u+a*d-o*c,t[e+3]=h*p-a*c-o*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){let i=t._x,n=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(i/2),h=a(n/2),c=a(r/2),d=o(i/2),u=o(n/2),p=o(r/2);switch(s){case"XYZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"YXZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"ZXY":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"ZYX":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"YZX":this._x=d*h*c+l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c-d*u*p;break;case"XZY":this._x=d*h*c-l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c+d*u*p}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],h=e[6],c=e[10],d=i+a+c;if(d>0){let t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(h-o)*t,this._y=(r-l)*t,this._z=(s-n)*t}else if(i>a&&i>c){let t=2*Math.sqrt(1+i-a-c);this._w=(h-o)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+l)/t}else if(a>c){let t=2*Math.sqrt(1+a-i-c);this._w=(r-l)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(o+h)/t}else{let t=2*Math.sqrt(1+c-i-a);this._w=(s-n)/t,this._x=(r+l)/t,this._y=(o+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(zt(this.dot(t),-1,1)))}rotateTowards(t,e){let i=this.angleTo(t);if(0===i)return this;let n=Math.min(1,e/i);return this.slerp(t,n),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let i=t._x,n=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,h=e._w;return this._x=i*h+s*a+n*l-r*o,this._y=n*h+s*o+r*a-i*l,this._z=r*h+s*l+i*o-n*a,this._w=s*h-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);let i=this._x,n=this._y,r=this._z,s=this._w,a=s*t._w+i*t._x+n*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=i,this._y=n,this._z=r,this;let o=1-a*a;if(o<=Number.EPSILON){let t=1-e;return this._w=t*s+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=s*c+this._w*d,this._x=i*c+this._x*d,this._y=n*c+this._y*d,this._z=r*c+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){let t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r
vendor: 4,143 bytes, line 2
2=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},be=class{constructor(t=0,e=0,i=0){be.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Se.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Se.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){let e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*n-a*i,h=o*i+a*e-r*n,c=o*n+r*i-s*e,d=-r*e-s*i-a*n;return this.x=l*o+d*-r+h*-a-c*-s,this.y=h*o+d*-s+c*-r-l*-a,this.z=c*o+d*-a+l*-s-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,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}
vendor: 13,609 bytes, line 2
2roundToZero(){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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let i=t.x,n=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(t){let e=t.lengthSq();if(0===e)return this.set(0,0,0);let i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return we.copy(this).projectOnVector(t),this.sub(we)}reflect(t){return this.sub(we.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;let i=this.dot(t)/e;return Math.acos(zt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){let n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},we=new be,Se=new xe,_e=class{constructor(t=new be(1/0,1/0,1/0),e=new be(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.length;o<l;o+=3){let l=t[o],h=t[o+1],c=t[o+2];l<e&&(e=l),h<i&&(i=h),c<n&&(n=c),l>r&&(r=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(e,i,n),this.max.set(r,s,a),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.count;o<l;o++){let l=t.getX(o),h=t.getY(o),c=t.getZ(o);l<e&&(e=l),h<i&&(i=h),c<n&&(n=c),l>r&&(r=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(e,i,n),this.max.set(r,s,a),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=Me.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let i=t.geometry;if(void 0!==i)if(e&&null!=i.attributes&&void 0!==i.attributes.position){let e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)Me.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(Me)}else null===i.boundingBox&&i.computeBoundingBox(),Ce.copy(i.boundingBox),Ce.applyMatrix4(t.matrixWorld),this.union(Ce);let n=t.children;for(let r=0,s=n.length;r<s;r++)this.expandByObject(n[r],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Me),Me.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Re),Le.subVectors(this.max,Re),Ee.subVectors(t.a,Re),Pe.subVectors(t.b,Re),Te.subVectors(t.c,Re),De.subVectors(Pe,Ee),Ie.subVectors(Te,Pe),Oe.subVectors(Ee,Te);let e=[0,-De.z,De.y,0,-Ie.z,Ie.y,0,-Oe.z,Oe.y,De.z,0,-De.x,Ie.z,0,-Ie.x,Oe.z,0,-Oe.x,-De.y,De.x,0,-Ie.y,Ie.x,0,-Oe.y,Oe.x,0];return!(!Fe(e,Ee,Pe,Te,Le)||(e=[1,0,0,0,1,0,0,0,1],!Fe(e,Ee,Pe,Te,Le)))&&(Be.crossVectors(De,Ie),e=[Be.x,Be.y,Be.z],Fe(e,Ee,Pe,Te,Le))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Me.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Me).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ae[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ae[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ae[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ae[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ae[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ae[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ae[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ae[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ae)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Ae=[new be,new be,new be,new be,new be,new be,new be,new be],Me=new be,Ce=new _e,Ee=new be,Pe=new be,Te=new be,De=new be,Ie=new be,Oe=new be,Re=new be,Le=new be,Be=new be,ze=new be;function Fe(t,e,i,n,r){for(let s=0,a=t.length-3;s<=a;s+=3){ze.fromArray(t,s);let a=r.x*Math.abs(ze.x)+r.y*Math.abs(ze.y)+r.z*Math.abs(ze.z),o=e.dot(ze),l=i.dot(ze),h=n.dot(ze);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>a)return!1}return!0}var Ne=new _e,Ue=new be,ke=new be,Ve=class{constructor(t=new be,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let i=this.center;void 0!==e?i.copy(e):Ne.setFromPoints(t).getCenter(i);let n=0;for(let r=0,s=t.length;r<s;r++)n=Math.max(n,i.distanceToSquared(t[r]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Ue.subVectors(t,this.center);let e=Ue.lengthSq();if(e>this.radius*this.radius){let t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Ue,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(ke.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ue.copy(t.center).add(ke)),this.expandByPoint(Ue.copy(t.center).sub(ke))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}},je=new be,Ge=new be,We=new be,He=new be,qe=new be,Xe=new be,Ye=new be,Qe=class{constructor(t=new be,e=new be(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,je)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=je.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(je.copy(this.direction).multiplyScalar(e).add(this.origin),je.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Ge.copy(t).add(e).multiplyScalar(.5),We.copy(e).sub(t).normalize(),He.copy(this.origin).sub(Ge);let r,s,a,o,l=.5*t.distanceTo(e),h=-this.direction.dot(We),c=He.dot(this.direction),d=-He.dot(We),u=He.lengthSq(),p=Math.abs(1-h*h);if(p>0)if(r=h*d-c,s=h*c-d,o=l*p,r>=0)if(s>=-o)if(s<=o){let t=1/p;r*=t,s*=t,a=r*(r+h*s+2*c)+s*(h*r+s+2*d)+u}else s=l,r=Math.max(0,-(h*s+c)),a=-r*r+s*(s+2*d)+u;else s=-l,r=Math.max(0,-(h*s+c)),a=-r*r+s*(s+2*d)+u;else s<=-o?(r=Math.max(0,-(-h*l+c)),s=r>0?-l:Math.min(Math.max(-l,-d),l),a=-r*r+s*(s+2*d)+u):s<=o?(r=0,s=Math.min(Math.max(-l,-d),l),a=s*(s+2*d)+u):(r=Math.max(0,-(h*l+c)),s=r>0?l:Math.min(Math.max(-l,-d),l),a=-r*r+s*(s+2*d)+u);else s=h>0?-l:l,r=Math.max(0,-(h*s+c)),a=-r*r+s*(s+2*d)+u;return i&&i.copy(this.direction).multiplyScalar(r).add(this.origin),n&&n.copy(We).multiplyScalar(s).add(Ge),a}intersectSphere(t,e){je.subVectors(t.center,this.origin);let i=je.dot(this.direction),n=je.dot(je)-i*i,r=t.radius*t.radius;if(n>r)return null;let s=Math.sqrt(r-n),a=i-s,o=i+s;return a<0&&o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){let i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,a,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),h>=0?(r=(t.min.y-d.y)*h,s=(t.max.y-d.y)*h):(r=(t.max.y-d.y)*h,s=(t.min.y-d.y)*h),i>s||r>n||((r>i||isNaN(i))&&(i=r),(s<n||isNaN(n))&&(n=s),c>=0?(a=(t.min.z-d.z)*c,o=(t.max.z-d.z)*c):(a=(t.max.z-d.z)*c,o=(t.min.z-d.z)*c),i>o||a>n)||((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0)?null:this.at(i>=0?i:n,e)}intersectsBox(t){return null!==this.intersectBox(t,je)}intersectTriangle(t,e,i,n,r){qe.subVectors(e,t),Xe.subVectors(i,t),Ye.crossVectors(qe,Xe);let s,a=this.direction.dot(Ye);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}He.subVectors(this.origin,t);let o=s*this.direction.dot(Xe.crossVectors(He,Xe));if(o<0)return null;let l=s*this.direction.dot(qe.cross(He));if(l<0||o+l>a)return null;
vendor: 4,600 bytes, line 2
2let h=-s*He.dot(Ye);return h<0?null:this.at(h/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}},Ze=class{constructor(){Ze.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,i,n,r,s,a,o,l,h,c,d,u,p,f,m){let g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=d,g[3]=u,g[7]=p,g[11]=f,g[15]=m,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 Ze).fromArray(this.elements)}copy(t){let e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){let e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,i=t.elements,n=1/Ke.setFromMatrixColumn(t,0).length(),r=1/Ke.setFromMatrixColumn(t,1).length(),s=1/Ke.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){let t=s*h,i=s*c,n=a*h,r=a*c;e[0]=o*h,e[4]=-o*c,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=n+i*l,e[10]=s*o}else if("YXZ"===t.order){let t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t+r*a,e[4]=n*a-i,e[8]=s*l,e[1]=s*c,e[5]=s*h,e[9]=-a,e[2]=i*a-n,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){let t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t-r*a,e[4]=-s*c,e[8]=n+i*a,e[1]=i+n*a,e[5]=s*h,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){let t=s*h,i=s*c,n=a*h,r=a*c;e[0]=o*h,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*c,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){let t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*h,e[4]=r-t*c,e[8]=n*c+i,e[1]=c,e[5]=s*h,e[9]=-a*h,e[2]=-l*h,e[6]=i*c+n,e[10]=t-r*c}else if("XZY"===t.order){let t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*h,e[4]=-c,e[8]=l*h,e[1]=t*c+r,e[5]=s*h,e[9]=i*c-n,e[2]=n*c-i,e[6]=a*h,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose($e,t,ti)}lookAt(t,e,i){let n=this.elements;return ni.subVectors(t,e),0===ni.lengthSq()&&(ni.z=1),ni.normalize(),ei.crossVectors(i,ni),0===ei.lengthSq()&&(1===Math.abs(i.z)?ni.x+=1e-4:ni.z+=1e-4,ni.normalize(),ei.crossVectors(i,ni)),ei.normalize(),ii.crossVectors(ni,ei),n[0]=ei.x,n[4]=ii.x,n[8]=ni.x,n[1]=ei.y,n[5]=ii.y,n[9]=ni.y,n[2]=ei.z,n[6]=ii.z,n[10]=ni.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],h=i[1],c=i[5],d=i[9],u=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15],w=n[0],S=n[4],_=n[8],A=n[12],M=n[1],C=n[5],E=n[9],P=n[13],T=n[2],D=n[6],I=n[10],O=n[14],R=n[3],L=n[7],B=n[11],z=n[15];return r[0]=s*w+a*M+o*T+l*R,r[4]=s*S+a*C+o*D+l*L,r[8]=s*_+a*E+o*I+l*B,r[12]=s*A+a*P+o*O+l*z,r[1]=h*w+c*M+d*T+u*R,r[5]=h*S+c*C+d*D+u*L,r[9]=h*_+c*E+d*I+u*B,r[13]=h*A+c*P+d*O+u*z,r[2]=p*w+f*M+m*T+g*R,r[6]=p*S+f*C+m*D+g*L,r[10]=p*_+f*E+m*I+g*B,r[14]=p*A+f*P+m*O+g*z,r[3]=v*w+y*M+x*T+b*R,r[7]=v*S+y*C+x*D+b*L,r[11]=v*_+y*E+x*I+b*B,r[15]=v*A+y*P+x*O+b*z,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],h=t[2],c=t[6],d=t[10],u=t[14];return t[3]*(+r*o*c-n*l*c-r*a*d+i*l*d+n*a*u-i*o*u)+t[7]*(+e*o*u-e*l*d+r*s*d-n*s*u+n*l*h-r*o*h)+t[11]*(+e*l*c-e*a*u-r*s*c+i*s*u+r*a*h-i*l*h)+t[15]*(-n*a*h-e*o*c+e*a*d+n*s*c-i*s*d+i*o*h)}transpose(){let t,e=this.elements;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}
vendor: 7,176 bytes, line 2
2setPosition(t,e,i){let n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){let t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],h=t[8],c=t[9],d=t[10],u=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=c*m*l-f*d*l+f*o*u-a*m*u-c*o*g+a*d*g,y=p*d*l-h*m*l-p*o*u+s*m*u+h*o*g-s*d*g,x=h*f*l-p*c*l+p*a*u-s*f*u-h*a*g+s*c*g,b=p*c*o-h*f*o-p*a*d+s*f*d+h*a*m-s*c*m,w=e*v+i*y+n*x+r*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/w;return t[0]=v*S,t[1]=(f*d*r-c*m*r-f*n*u+i*m*u+c*n*g-i*d*g)*S,t[2]=(a*m*r-f*o*r+f*n*l-i*m*l-a*n*g+i*o*g)*S,t[3]=(c*o*r-a*d*r-c*n*l+i*d*l+a*n*u-i*o*u)*S,t[4]=y*S,t[5]=(h*m*r-p*d*r+p*n*u-e*m*u-h*n*g+e*d*g)*S,t[6]=(p*o*r-s*m*r-p*n*l+e*m*l+s*n*g-e*o*g)*S,t[7]=(s*d*r-h*o*r+h*n*l-e*d*l-s*n*u+e*o*u)*S,t[8]=x*S,t[9]=(p*c*r-h*f*r-p*i*u+e*f*u+h*i*g-e*c*g)*S,t[10]=(s*f*r-p*a*r+p*i*l-e*f*l-s*i*g+e*a*g)*S,t[11]=(h*a*r-s*c*r-h*i*l+e*c*l+s*i*u-e*a*u)*S,t[12]=b*S,t[13]=(h*f*n-p*c*n+p*i*d-e*f*d-h*i*m+e*c*m)*S,t[14]=(p*a*n-s*f*n-p*i*o+e*f*o+s*i*m-e*a*m)*S,t[15]=(s*c*n-h*a*n+h*i*o-e*c*o-s*i*d+e*a*d)*S,this}scale(t){let e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,a=t.y,o=t.z,l=r*s,h=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,h*a+i,h*o-n*s,0,l*o-n*a,h*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){let n=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,h=s+s,c=a+a,d=r*l,u=r*h,p=r*c,f=s*h,m=s*c,g=a*c,v=o*l,y=o*h,x=o*c,b=i.x,w=i.y,S=i.z;return n[0]=(1-(f+g))*b,n[1]=(u+x)*b,n[2]=(p-y)*b,n[3]=0,n[4]=(u-x)*w,n[5]=(1-(d+g))*w,n[6]=(m+v)*w,n[7]=0,n[8]=(p+y)*S,n[9]=(m-v)*S,n[10]=(1-(d+f))*S,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){let n=this.elements,r=Ke.set(n[0],n[1],n[2]).length(),s=Ke.set(n[4],n[5],n[6]).length(),a=Ke.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],Je.copy(this);let o=1/r,l=1/s,h=1/a;return Je.elements[0]*=o,Je.elements[1]*=o,Je.elements[2]*=o,Je.elements[4]*=l,Je.elements[5]*=l,Je.elements[6]*=l,Je.elements[8]*=h,Je.elements[9]*=h,Je.elements[10]*=h,e.setFromRotationMatrix(Je),i.x=r,i.y=s,i.z=a,this}makePerspective(t,e,i,n,r,s){let a=this.elements,o=2*r/(e-t),l=2*r/(i-n),h=(e+t)/(e-t),c=(i+n)/(i-n),d=-(s+r)/(s-r),u=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=l,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=u,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,n,r,s){let a=this.elements,o=1/(e-t),l=1/(i-n),h=1/(s-r),c=(e+t)*o,d=(i+n)*l,u=(s+r)*h;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-c,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-u,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){let e=this.elements,i=t.elements;for(let n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){let i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}},Ke=new be,Je=new Ze,$e=new be(0,0,0),ti=new be(1,1,1),ei=new be,ii=new be,ni=new be,ri=new Ze,si=new xe,ai=class{constructor(t=0,e=0,i=0,n=ai.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){let n=t.elements,r=n[0],s=n[4],a=n[8],o=n[1],l=n[5],h=n[9],c=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(zt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-zt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(zt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-zt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(zt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-zt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,u),this._y=0)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ri.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ri,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return si.setFromEuler(this),this.setFromQuaternion(si,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ai.DEFAULT_ORDER="XYZ";var oi=class{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}},li=0,hi=new be,ci=new xe,di=new Ze,ui=new be,pi=new be,fi=new be,mi=new xe,gi=new be(1,0,0),vi=new be(0,1,0),yi=new be(0,0,1),xi={type:"added"},bi={type:"removed"},wi=class extends Dt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:li++}),this.uuid=Bt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wi.DEFAULT_UP.clone();
2let t=new be,e=new ai,i=new xe,n=new be(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Ze},normalMatrix:{value:new qt}}),this.matrix=new Ze,this.matrixWorld=new Ze,this.matrixAutoUpdate=wi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=wi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new oi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ci.setFromAxisAngle(t,e),this.quaternion.multiply(ci),this}rotateOnWorldAxis(t,e){return ci.setFromAxisAngle(t,e),this.quaternion.premultiply(ci),this}rotateX(t){return this.rotateOnAxis(gi,t)}rotateY(t){return this.rotateOnAxis(vi,t)}rotateZ(t){return this.rotateOnAxis(yi,t)}translateOnAxis(t,e){return hi.copy(t).applyQuaternion(this.quaternion),this.position.add(hi.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(gi,t)}translateY(t){return this.translateOnAxis(vi,t)}translateZ(t){return this.translateOnAxis(yi,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(di.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?ui.copy(t):ui.set(t,e,i);let n=this.parent;this.updateWorldMatrix(!0,!1),pi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?di.lookAt(pi,ui,this.up):di.lookAt(ui,pi,this.up),this.quaternion.setFromRotationMatrix(di),n&&(di.extractRotation(n.matrixWorld),ci.setFromRotationMatrix(di),this.quaternion.premultiply(ci.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this||t&&t.isObject3D&&(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(xi)),this}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}let e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(bi)),this}removeFromParent(){let t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){let e=this.children[t];e.parent=null,e.dispatchEvent(bi)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),di.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),di.multiply(t.parent.matrixWorld)),t.applyMatrix4(di),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){let n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e){let i=[];this[t]===e&&i.push(this);for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectsByProperty(t,e);r.length>0&&(i=i.concat(r))}return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pi,t,fi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pi,mi,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);let e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){let e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix
2):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let i=0,n=e.length;i<n;i++){let n=e[i];(!0===n.matrixWorldAutoUpdate||!0===t)&&n.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let i=this.parent;if(!0===t&&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===e){let t=this.children;for(let e=0,i=t.length;e<i;e++){let i=t[e];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);let e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){let i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){let n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){let i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){let e=s(t.geometries),n=s(t.materials),r=s(t.textures),a=s(t.images),o=s(t.shapes),l=s(t.skeletons),h=s(t.animations),c=s(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=n,i;function s(t){let e=[];for(let i in t){let n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let i=0;i<t.children.length;i++){let e=t.children[i];this.add(e.clone())}return this}};wi.DEFAULT_UP=new be(0,1,0),wi.DEFAULT_MATRIX_AUTO_UPDATE=!0,wi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Si=new be,_i=new be,Ai=new be,Mi=new be,Ci=new be,Ei=new be,Pi=new be,Ti=new be,Di=new be,Ii=new be,Oi=class{constructor(t=new be,e=ne
vendor: 18,563 bytes, line 2
2w be,i=new be){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Si.subVectors(t,e),n.cross(Si);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){Si.subVectors(n,e),_i.subVectors(i,e),Ai.subVectors(t,e);let s=Si.dot(Si),a=Si.dot(_i),o=Si.dot(Ai),l=_i.dot(_i),h=_i.dot(Ai),c=s*l-a*a;if(0===c)return r.set(-2,-1,-1);let d=1/c,u=(l*o-a*h)*d,p=(s*h-a*o)*d;return r.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Mi),Mi.x>=0&&Mi.y>=0&&Mi.x+Mi.y<=1}static getUV(t,e,i,n,r,s,a,o){return this.getBarycoord(t,e,i,n,Mi),o.set(0,0),o.addScaledVector(r,Mi.x),o.addScaledVector(s,Mi.y),o.addScaledVector(a,Mi.z),o}static isFrontFacing(t,e,i,n){return Si.subVectors(i,e),_i.subVectors(t,e),Si.cross(_i).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Si.subVectors(this.c,this.b),_i.subVectors(this.a,this.b),.5*Si.cross(_i).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Oi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Oi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Oi.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Oi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Oi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let i,n,r=this.a,s=this.b,a=this.c;Ci.subVectors(s,r),Ei.subVectors(a,r),Ti.subVectors(t,r);let o=Ci.dot(Ti),l=Ei.dot(Ti);if(o<=0&&l<=0)return e.copy(r);Di.subVectors(t,s);let h=Ci.dot(Di),c=Ei.dot(Di);if(h>=0&&c<=h)return e.copy(s);let d=o*c-h*l;if(d<=0&&o>=0&&h<=0)return i=o/(o-h),e.copy(r).addScaledVector(Ci,i);Ii.subVectors(t,a);let u=Ci.dot(Ii),p=Ei.dot(Ii);if(p>=0&&u<=p)return e.copy(a);let f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),e.copy(r).addScaledVector(Ei,n);let m=h*p-u*c;if(m<=0&&c-h>=0&&u-p>=0)return Pi.subVectors(a,s),n=(c-h)/(c-h+(u-p)),e.copy(s).addScaledVector(Pi,n);let g=1/(m+f+d);return i=f*g,n=d*g,e.copy(r).addScaledVector(Ci,i).addScaledVector(Ei,n)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Ri=0,Li=class extends Dt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ri++}),this.uuid=Bt(),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=C,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=Ct,this.stencilZFail=Ct,this.stencilZPass=Ct,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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(let e in t){let i=t[e];if(void 0===i)continue;let n=this[e];void 0!==n&&(n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i)}}toJSON(t){let e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){let e=[];for(let i in t){let n=t[i];delete n.metadata,e.push(n)}return e}if(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(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).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(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).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(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).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),e){let e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,i=null;if(null!==e){let t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}},Bi=class extends Li{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new le(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}},zi=new be,Fi=new Ht,Ni=class{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=Et,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Fi.fromBufferAttribute(this,e),Fi.applyMatrix3(t),this.setXY(e,Fi.x,Fi.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)zi.fromBufferAttribute(this,e),zi.applyMatrix3(t),this.setXYZ(e,zi.x,zi.y,zi.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)zi.fromBufferAttribute(this,e),zi.applyMatrix4(t),this.setXYZ(e,zi.x,zi.y,zi.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)zi.fromBufferAttribute(this,e),zi.applyNormalMatrix(t),this.setXYZ(e,zi.x,zi.y,zi.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)zi.fromBufferAttribute(this,e),zi.transformDirection(t),this.setXYZ(e,zi.x,zi.y,zi.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=jt(e,this.array)),e}setX(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=jt(e,this.array)),e}setY(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=jt(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=jt(e,this.array)),e}setW(t,e){return this.normalized&&(e=Gt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Gt(e,this.array),i=Gt(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Gt(e,this.array),i=Gt(i,this.array),n=Gt(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=Gt(e,this.array),i=Gt(i,this.array),n=Gt(n,this.array),r=Gt(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Et&&(t.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(t.updateRange=this.updateRange),t}copyColorsArray(){}copyVector2sArray(){}copyVector3sArray(){}copyVector4sArray(){}},Ui=class extends Ni{constructor(t,e,i){super(new Uint16Array(t),e,i)}},ki=class extends Ni{constructor(t,e,i){super(new Uint32Array(t),e,i)}},Vi=class extends Ni{constructor(t,e,i){super(new Float32Array(t),e,i)}},ji=0,Gi=new Ze,Wi=new wi,Hi=new be,qi=new _e,Xi=new _e,Yi=new be,Qi=class extends Dt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ji++}),this.uuid=Bt(),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(t){return Array.isArray(t)?this.index=new(Yt(t)?ki:Ui)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let e=(new qt).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}let n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Gi.makeRotationFromQuaternion(t),this.applyMatrix4(Gi),this}rotateX(t){return Gi.makeRotationX(t),this.applyMatrix4(Gi),this}rotateY(t){return Gi.makeRotationY(t),this.applyMatrix4(Gi),this}rotateZ(t){return Gi.makeRotationZ(t),this.applyMatrix4(Gi),this}
2translate(t,e,i){return Gi.makeTranslation(t,e,i),this.applyMatrix4(Gi),this}scale(t,e,i){return Gi.makeScale(t,e,i),this.applyMatrix4(Gi),this}lookAt(t){return Wi.lookAt(t),Wi.updateMatrix(),this.applyMatrix4(Wi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Hi).negate(),this.translate(Hi.x,Hi.y,Hi.z),this}setFromPoints(t){let e=[];for(let i=0,n=t.length;i<n;i++){let n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new Vi(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new _e);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingBox.set(new be(-1/0,-1/0,-1/0),new be(1/0,1/0,1/0));else{if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){let i=e[t];qi.setFromBufferAttribute(i),this.morphTargetsRelative?(Yi.addVectors(this.boundingBox.min,qi.min),this.boundingBox.expandByPoint(Yi),Yi.addVectors(this.boundingBox.max,qi.max),this.boundingBox.expandByPoint(Yi)):(this.boundingBox.expandByPoint(qi.min),this.boundingBox.expandByPoint(qi.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ve);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)this.boundingSphere.set(new be,1/0);else if(t){let i=this.boundingSphere.center;if(qi.setFromBufferAttribute(t),e)for(let t=0,r=e.length;t<r;t++){let i=e[t];Xi.setFromBufferAttribute(i),this.morphTargetsRelative?(Yi.addVectors(qi.min,Xi.min),qi.expandByPoint(Yi),Yi.addVectors(qi.max,Xi.max),qi.expandByPoint(Yi)):(qi.expandByPoint(Xi.min),qi.expandByPoint(Xi.max))}qi.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)Yi.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Yi));if(e)for(let r=0,s=e.length;r<s;r++){let s=e[r],a=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Yi.fromBufferAttribute(s,e),a&&(Hi.fromBufferAttribute(t,e),Yi.add(Hi)),n=Math.max(n,i.distanceToSquared(Yi))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)}}computeTangents(){let t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return;let i=t.array,n=e.position.array,r=e.normal.array,s=e.uv.array,a=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ni(new Float32Array(4*a),4));let o=this.getAttribute("tangent").array,l=[],h=[];for(let M=0;M<a;M++)l[M]=new be,h[M]=new be;let c=new be,d=new be,u=new be,p=new Ht,f=new Ht,m=new Ht,g=new be,v=new be;function y(t,e,i){c.fromArray(n,3*t),d.fromArray(n,3*e),u.fromArray(n,3*i),p.fromArray(s,2*t),f.fromArray(s,2*e),m.fromArray(s,2*i),d.sub(c),u.sub(c),f.sub(p),m.sub(p);let r=1/(f.x*m.y-m.x*f.y);!isFinite(r)||(g.copy(d).multiplyScalar(m.y).addScaledVector(u,-f.y).multiplyScalar(r),v.copy(u).multiplyScalar(f.x).addScaledVector(d,-m.x).multiplyScalar(r),l[t].add(g),l[e].add(g),l[i].add(g),h[t].add(v),h[e].add(v),h[i].add(v))}let x=this.groups;0===x.length&&(x=[{start:0,count:i.length}]);for(let M=0,C=x.length;M<C;++M){let t=x[M],e=t.start;for(let n=e,r=e+t.count;n<r;n+=3)y(i[n+0],i[n+1],i[n+2])}let b=new be,w=new be,S=new be,_=new be;function A(t){S.fromArray(r,3*t),_.copy(S);let e=l[t];b.copy(e),b.sub(S.multiplyScalar(S.dot(e))).normalize(),w.crossVectors(_,e);let i=w.dot(h[t])<0?-1:1;o[4*t]=b.x,o[4*t+1]=b.y,o[4*t+2]=b.z,o[4*t+3]=i}for(let M=0,C=x.length;M<C;++M){let t=x[M],e=t.start;for(let n=e,r=e+t.count;n<r;n+=3)A(i[n+0]),A(i[n+1]),A(i[n+2])}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Ni(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);let n=new be,r=new be,s=new be,a=new be,o=new be,l=new be,h=new be,c=new be;if(t)for(let d=0,u=t.count;d<u;d+=3){let u=t.getX(d+0),p=t.getX(d+1),f=t.getX(d+2);n.fromBufferAttribute(e,u),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,f),h.subVectors(s,r),c.subVectors(n,r),h.cross(c),a.fromBufferAttribute(i,u),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),a.add(h),o.add(h),l.add(h),i.setXYZ(u,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,d=e.count;t<d;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),h.subVectors(s,r),c.subVectors(n,r),h.cross(c),i.setXYZ(t+0,h.x,h.y,h.z),i.setXYZ(t+1,h.x,h.y,h.z),i.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return this}normalizeNormals(){let t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Yi.fromBufferAttribute(t,e),Yi.normalize(),t.setXYZ(e,Yi.x,Yi.y,Yi.z)}toNonIndexed(){function t(t,e){let i=t.array,n=t.itemSize,r=t.normalized,s=new i.constructor(e.length*n),a=0,o=0;for(let l=0,h=e.length;l<h;l++){a=t.isInterleavedBufferAttribute?e[l]*t.data.stride+t.offset:e[l]*n;for(let t=0;t<n;t++)s[o++]=i[a++]}return new Ni(s,n,r)}if(null===this.index)return this;let e=new Qi,i=this.index.array,n=this.attributes;for(let a in n){let r=t(n[a],i);e.setAttribute(a,r)}let r=this.morphAttributes;for(let a in r){let n=[],s=r[a];for(let e=0,r=s.length;e<r;e++){let r=t(s[e],i);n.push(r)}e.morphAttributes[a]=n}e.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let a=0,o=s.length;a<o;a++){let t=s[a];e.addGroup(t.start,t.count,t.materialIndex)}return e}toJSON(){let t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
2if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};let e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let i=this.attributes;for(let o in i){let e=i[o];t.data.attributes[o]=e.toJSON(t.data)}let n={},r=!1;for(let o in this.morphAttributes){let e=this.morphAttributes[o],i=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];i.push(r.toJSON(t.data))}i.length>0&&(n[o]=i,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));let a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let i=t.index;null!==i&&this.setIndex(i.clone(e));let n=t.attributes;for(let l in n){let t=n[l];this.setAttribute(l,t.clone(e))}let r=t.morphAttributes;for(let l in r){let t=[],i=r[l];for(let n=0,r=i.length;n<r;n++)t.push(i[n].clone(e));this.morphAttributes[l]=t}this.morphTargetsRelative=t.morphTargetsRelative;let s=t.groups;for(let l=0,h=s.length;l<h;l++){let t=s[l];this.addGroup(t.start,t.count,t.materialIndex)}let a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());let o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}},Zi=new Ze,Ki=new Qe,Ji=new Ve,$i=new be,tn=new be,en=new be,nn=new be,rn=new be,sn=new Ht,an=new Ht,on=new Ht,ln=new be,hn=new be,cn=class extends wi{constructor(t=new Qi,e=new Bi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){let e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,s=i.morphTargetsRelative;e.fromBufferAttribute(n,t);let a=this.morphTargetInfluences;if(r&&a){rn.set(0,0,0);for(let i=0,n=r.length;i<n;i++){let n=a[i],o=r[i];0!==n&&(nn.fromBufferAttribute(o,t),s?rn.addScaledVector(nn,n):rn.addScaledVector(nn.sub(e),n))}e.add(rn)}return this.isSkinnedMesh&&this.boneTransform(t,e),e}raycast(t,e){let i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n||(null===i.boundingSphere&&i.computeBoundingSphere(),Ji.copy(i.boundingSphere),Ji.applyMatrix4(r),!1===t.ray.intersectsSphere(Ji))||(Zi.copy(r).invert(),Ki.copy(t.ray).applyMatrix4(Zi),null!==i.boundingBox&&!1===Ki.intersectsBox(i.boundingBox)))return;let s,a=i.index,o=i.attributes.position,l=i.attributes.uv,h=i.attributes.uv2,c=i.groups,d=i.drawRange;if(null!==a)if(Array.isArray(n))for(let u=0,p=c.length;u<p;u++){let i=c[u],r=n[i.materialIndex];for(let n=Math.max(i.start,d.start),o=Math.min(a.count,Math.min(i.start+i.count,d.start+d.count));n<o;n+=3){let o=a.getX(n),c=a.getX(n+1),d=a.getX(n+2);s=dn(this,r,t,Ki,l,h,o,c,d),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=i.materialIndex,e.push(s))}}else{for(let i=Math.max(0,d.start),r=Math.min(a.count,d.start+d.count);i<r;i+=3){let r=a.getX(i),o=a.getX(i+1),c=a.getX(i+2);s=dn(this,n,t,Ki,l,h,r,o,c),s&&(s.faceIndex=Math.floor(i/3),e.push(s))}}else if(void 0!==o)if(Array.isArray(n))for(let u=0,p=c.length;u<p;u++){let i=c[u],r=n[i.materialIndex];for(let n=Math.max(i.start,d.start),a=Math.min(o.count,Math.min(i.start+i.count,d.start+d.count));n<a;n+=3){s=dn(this,r,t,Ki,l,h,n,n+1,n+2),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=i.materialIndex,e.push(s))}}else{for(let i=Math.max(0,d.start),r=Math.min(o.count,d.start+d.count);i<r;i+=3){s=dn(this,n,t,Ki,l,h,i,i+1,i+2),s&&(s.faceIndex=Math.floor(i/3),e.push(s))}}}};function dn(t,e,i,n,r,s,a,o,l){t.getVertexPosition(a,$i),t.getVertexPosition(o,tn),t.getVertexPosition(l,en);
2let h=function(t,e,i,n,r,s,a,o){let l;if(l=1===e.side?n.intersectTriangle(a,s,r,!0,o):n.intersectTriangle(r,s,a,0===e.side,o),null===l)return null;hn.copy(o),hn.applyMatrix4(t.matrixWorld);let h=i.ray.origin.distanceTo(hn);return h<i.near||h>i.far?null:{distance:h,point:hn.clone(),object:t}}(t,e,i,n,$i,tn,en,ln);if(h){r&&(sn.fromBufferAttribute(r,a),an.fromBufferAttribute(r,o),on.fromBufferAttribute(r,l),h.uv=Oi.getUV(ln,$i,tn,en,sn,an,on,new Ht)),s&&(sn.fromBufferAttribute(s,a),an.fromBufferAttribute(s,o),on.fromBufferAttribute(s,l),h.uv2=Oi.getUV(ln,$i,tn,en,sn,an,on,new Ht));let t={a:a,b:o,c:l,normal:new be,materialIndex:0};Oi.getNormal($i,tn,en,t.normal),h.face=t}return h}var un=class extends Qi{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};let a=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);let o=[],l=[],h=[],c=[],d=0,u=0;function p(t,e,i,n,r,s,p,f,m,g,v){let y=s/m,x=p/g,b=s/2,w=p/2,S=f/2,_=m+1,A=g+1,M=0,C=0,E=new be;for(let a=0;a<A;a++){let s=a*x-w;for(let o=0;o<_;o++){let d=o*y-b;E[t]=d*n,E[e]=s*r,E[i]=S,l.push(E.x,E.y,E.z),E[t]=0,E[e]=0,E[i]=f>0?1:-1,h.push(E.x,E.y,E.z),c.push(o/m),c.push(1-a/g),M+=1}}for(let a=0;a<g;a++)for(let t=0;t<m;t++){let e=d+t+_*a,i=d+t+_*(a+1),n=d+(t+1)+_*(a+1),r=d+(t+1)+_*a;o.push(e,i,r),o.push(i,n,r),C+=6}a.addGroup(u,C,v),u+=C,d+=M}p("z","y","x",-1,-1,i,e,t,s,r,0),p("z","y","x",1,-1,i,e,-t,s,r,1),p("x","z","y",1,1,t,i,e,n,s,2),p("x","z","y",1,-1,t,i,-e,n,s,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new Vi(l,3)),this.setAttribute("normal",new Vi(h,3)),this.setAttribute("uv",new Vi(c,2))}static fromJSON(t){return new un(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function pn(t){let e={};for(let i in t){e[i]={};for(let n in t[i]){let r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function fn(t){let e={};for(let i=0;i<t.length;i++){let n=pn(t[i]);for(let t in n)e[t]=n[t]}return e}function mn(t){return null===t.getRenderTarget()&&t.outputEncoding===St?At:Mt}var gn={clone:pn,merge:fn},vn=class extends Li{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",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!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=pn(t.uniforms),this.uniformsGroups=function(t){let e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let n in this.uniforms){let i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;let i={};for(let n in this.extensions)!0===this.extensions[n]&&(i[n]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}},yn=class extends wi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ze,this.projectionMatrix=new Ze,this.projectionMatrixInverse=new Ze}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}},xn=class extends yn{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=2*Lt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(.5*Rt*this.fov);return.5*this.getFilmHeight()/t}
2getEffectiveFOV(){return 2*Lt*Math.atan(Math.tan(.5*Rt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,s){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(.5*Rt*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n,s=this.view;if(null!==this.view&&this.view.enabled){let t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*n/t,e-=s.offsetY*i/a,n*=s.width/t,i*=s.height/a}let a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},bn=-90,wn=class extends wi{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i;let n=new xn(bn,1,t,e);n.layers=this.layers,n.up.set(0,1,0),n.lookAt(1,0,0),this.add(n);let r=new xn(bn,1,t,e);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(-1,0,0),this.add(r);let s=new xn(bn,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(0,1,0),this.add(s);let a=new xn(bn,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);let o=new xn(bn,1,t,e);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new xn(bn,1,t,e);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();let i=this.renderTarget,[n,r,s,a,o,l]=this.children,h=t.getRenderTarget(),c=t.toneMapping,d=t.xr.enabled;t.toneMapping=0,t.xr.enabled=!1;let u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,s),t.setRenderTarget(i,3),t.render(e,a),t.setRenderTarget(i,4),t.render(e,o),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(h),t.toneMapping=c,t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}},Sn=class extends fe{constructor(t,e,i,n,r,s,a,o,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:k,i,n,r,s,a,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},_n=class extends ge{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];this.texture=new Sn(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:Q}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new un(5,5,5),r=new vn({name:"CubemapFromEquirect",uniforms:pn(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;let s=new cn(n,r),a=e.minFilter;return e.minFilter===K&&(e.minFilter=Q),new wn(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,i,n){let r=t.getRenderTarget();for(let s=0;s<6;
2s++)t.setRenderTarget(this,s),t.clear(e,i,n);t.setRenderTarget(r)}},An=new be,Mn=new be,Cn=new qt,En=class{constructor(t=new be(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){let n=An.subVectors(i,e).cross(Mn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){let i=t.delta(An),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){let e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let i=e||Cn.getNormalMatrix(t),n=this.coplanarPoint(An).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}},Pn=new Ve,Tn=new be,Dn=class{constructor(t=new En,e=new En,i=new En,n=new En,r=new En,s=new En){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){let a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(t){let e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){let e=this.planes,i=t.elements,n=i[0],r=i[1],s=i[2],a=i[3],o=i[4],l=i[5],h=i[6],c=i[7],d=i[8],u=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return e[0].setComponents(a-n,c-o,f-d,y-m).normalize(),e[1].setComponents(a+n,c+o,f+d,y+m).normalize(),e[2].setComponents(a+r,c+l,f+u,y+g).normalize(),e[3].setComponents(a-r,c-l,f-u,y-g).normalize(),e[4].setComponents(a-s,c-h,f-p,y-v).normalize(),e[5].setComponents(a+s,c+h,f+p,y+v).normalize(),this}intersectsObject(t){let e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Pn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Pn)}intersectsSprite(t){return Pn.center.set(0,0,0),Pn.radius=.7071067811865476,Pn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Pn)}intersectsSphere(t){let e=this.planes,i=t.center,n=-t.radius;for(let r=0;r<6;r++)if(e[r].distanceToPoint(i)<n)return!1;return!0}intersectsBox(t){let e=this.planes;for(let i=0;i<6;i++){let n=e[i];if(Tn.x=n.normal.x>0?t.max.x:t.min.x,Tn.y=n.normal.y>0?t.max.y:t.min.y,Tn.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Tn)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}};function In(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function On(t,e){let i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);let i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){let t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);let s=n.get(e);void 0===s?n.set(e,function(e,n){let r,s=e.array,a=e.usage,o=t.createBuffer();if(t.bindBuffer(n,o),t.bufferData(n,s,a),e.onUploadCallback(),s instanceof Float32Array)r=5126;else if(s instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");r=5131}else r=5123;else if(s instanceof Int16Array)r=5122;else if(s instanceof Uint32Array)r=5125;else if(s instanceof Int32Array)r=5124;else if(s instanceof Int8Array)r=5120;else if(s instanceof Uint8Array)r=5121;else{if(!(s instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+s);r=5121}return{buffer:o,type:r,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version}}(e,r)):s.version<e.version&&(function(e,n,r){let s=n.array,a=n.updateRange;t.bindBuffer(r,e),-1===a.count?t.bufferSubData(r,0,s):(i?t.bufferSubData(r,a.offset*s.BYTES_PER_ELEMENT,s,a.offset,a.count):t.bufferSubData(r,a.offset*s.BYTES_PER_ELEMENT,s.subarray(a.offset,a.offset+a.count)),a.count=-1),n.onUploadCallback()}(s.buffer,e,r),s.version=e.version)}}}var Rn=class extends Qi{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};let r=t/2,s=e/2,a=Math.floor(i),o=Math.floor(n),l=a+1,h=o+1,c=t/a,d=e/o,u=[],p=[],f=[],m=[];for(let g=0;g<h;g++){let t=g*d-s;for(let e=0;e<l;e++){let i=e*c-r;p.push(i,-t,0),f.push(0,0,1),m.push(e/a),m.push(1-g/o)}}for(let g=0;g<o;g++)for(let t=0;t<a;t++){let e=t+l*g,i=t+l*(g+1),n=t+1+l*(g+1),r=t+1+l*g;u.push(e,i,r),u.push(i,n,r)}this.setIndex(u),this.setAttribute("position",new Vi(p,3)),this.setAttribute("normal",new Vi(f,3)),this.setAttribute("uv",new Vi(m,2))}static fromJSON(t){return new Rn(t.width,t.height,t.widthSegments,t.heightSegments)}},Ln={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot
2( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 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 ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#ifdef USE_IRIDESCENCE\n\tvec3 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 ) {\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x >
2 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
2\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + dis
2placementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t}
2 else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}
2\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong
vendor: 12,517 bytes, line 2
2",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *=
2( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = 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 );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );
2\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;
2\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n
vendor: 9,071 bytes, line 2
2uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n
2 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
2\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
2IGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = 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 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = tex
vendor: 31,014 bytes, line 2
2Color;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},
vendor: 604 bytes, line 2
2Bn={common:{diffuse:{value:new le(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new qt},uv2Transform:{value:new qt},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 Ht(1,1)}}
vendor: 5,840 bytes, line 2
2,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 le(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 le(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new qt}},sprite:{diffuse:{value:new le(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new qt}}},zn={basic:{uniforms:fn([Bn.common,Bn.specularmap,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.fog]),vertexShader:Ln.meshbasic_vert,fragmentShader:Ln.meshbasic_frag},lambert:{uniforms:fn([Bn.common,Bn.specularmap,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.fog,Bn.lights,{emissive:{value:new le(0)}}]),vertexShader:Ln.meshlambert_vert,fragmentShader:Ln.meshlambert_frag},phong:{uniforms:fn([Bn.common,Bn.specularmap,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.fog,Bn.lights,{emissive:{value:new le(0)},specular:{value:new le(1118481)},shininess:{value:30}}]),vertexShader:Ln.meshphong_vert,fragmentShader:Ln.meshphong_frag},standard:{uniforms:fn([Bn.common,Bn.envmap,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.roughnessmap,Bn.metalnessmap,Bn.fog,Bn.lights,{emissive:{value:new le(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ln.meshphysical_vert,fragmentShader:Ln.meshphysical_frag},toon:{uniforms:fn([Bn.common,Bn.aomap,Bn.lightmap,Bn.emissivemap,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.gradientmap,Bn.fog,Bn.lights,{emissive:{value:new le(0)}}]),vertexShader:Ln.meshtoon_vert,fragmentShader:Ln.meshtoon_frag},matcap:{uniforms:fn([Bn.common,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,Bn.fog,{matcap:{value:null}}]),vertexShader:Ln.meshmatcap_vert,fragmentShader:Ln.meshmatcap_frag},points:{uniforms:fn([Bn.points,Bn.fog]),vertexShader:Ln.points_vert,fragmentShader:Ln.points_frag},dashed:{uniforms:fn([Bn.common,Bn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ln.linedashed_vert,fragmentShader:Ln.linedashed_frag},depth:{uniforms:fn([Bn.common,Bn.displacementmap]),vertexShader:Ln.depth_vert,fragmentShader:Ln.depth_frag},normal:{uniforms:fn([Bn.common,Bn.bumpmap,Bn.normalmap,Bn.displacementmap,{opacity:{value:1}}]),vertexShader:Ln.meshnormal_vert,fragmentShader:Ln.meshnormal_frag},sprite:{uniforms:fn([Bn.sprite,Bn.fog]),vertexShader:Ln.sprite_vert,fragmentShader:Ln.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ln.background_vert,fragmentShader:Ln.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ln.backgroundCube_vert,fragmentShader:Ln.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ln.cube_vert,fragmentShader:Ln.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ln.equirect_vert,fragmentShader:Ln.equirect_frag},distanceRGBA:{uniforms:fn([Bn.common,Bn.displacementmap,{referencePosition:{value:new be},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ln.distanceRGBA_vert,fragmentShader:Ln.distanceRGBA_frag},shadow:{uniforms:fn([Bn.lights,Bn.fog,{color:{value:new le(0)},opacity:{value:1}}]),vertexShader:Ln.shadow_vert,fragmentShader:Ln.shadow_frag}};zn.physical={uniforms:fn([zn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ht(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 le(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new le(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new le(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Ln.meshphysical_vert,fragmentShader:Ln.meshphysical_frag};var Fn={r:0,b:0,g:0};
2function Nn(t,e,i,n,r,s,a){let o,l,h=new le(0),c=!0===s?0:1,d=null,u=0,p=null;function f(e,i){e.getRGB(Fn,mn(t)),n.buffers.color.setClear(Fn.r,Fn.g,Fn.b,i,a)}return{getClearColor:function(){return h},setClearColor:function(t,e=1){h.set(t),c=e,f(h,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,f(h,c)},render:function(n,s){let a=!1,m=!0===s.isScene?s.background:null;m&&m.isTexture&&(m=(s.backgroundBlurriness>0?i:e).get(m));let g=t.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?f(h,c):m&&m.isColor&&(f(m,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||m.mapping===j)?(void 0===l&&(l=new cn(new un(1,1,1),new vn({name:"BackgroundCubeMaterial",uniforms:pn(zn.backgroundCube.uniforms),vertexShader:zn.backgroundCube.vertexShader,fragmentShader:zn.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=s.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=s.backgroundIntensity,l.material.toneMapped=m.encoding!==St,(d!==m||u!==m.version||p!==t.toneMapping)&&(l.material.needsUpdate=!0,d=m,u=m.version,p=t.toneMapping),l.layers.enableAll(),n.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(void 0===o&&(o=new cn(new Rn(2,2),new vn({name:"BackgroundMaterial",uniforms:pn(zn.background.uniforms),vertexShader:zn.background.vertexShader,fragmentShader:zn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=m,o.material.uniforms.backgroundIntensity.value=s.backgroundIntensity,o.material.toneMapped=m.encoding!==St,!0===m.matrixAutoUpdate&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(d!==m||u!==m.version||p!==t.toneMapping)&&(o.material.needsUpdate=!0,d=m,u=m.version,p=t.toneMapping),o.layers.enableAll(),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Un(t,e,i,n){let r=t.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||null!==s,o={},l=p(null),h=l,c=!1;function d(e){return n.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){let e=[],i=[],n=[];for(let s=0;s<r;s++)e[s]=0,i[s]=0,n[s]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function f(){let t=h.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function m(t){g(t,0)}function g(i,r){let s=h.newAttributes,a=h.enabledAttributes,o=h.attributeDivisors;s[i]=1,0===a[i]&&(t.enableVertexAttribArray(i),a[i]=1),o[i]!==r&&((n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),o[i]=r)}function v(){let e=h.newAttributes,i=h.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function y(e,i,r,s,a,o){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,s,a,o):t.vertexAttribIPointer(e,i,r,a,o)}function x(){b(),c=!0,h!==l&&(h=l,d(h.object))}function b(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,x,b){let w=!1;if(a){let e=function(e,i,r){let a=!0===r.wireframe,l=o[e.id];void 0===l&&(l={},o[e.id]=l);let h=l[i.id];void 0===h&&(h={},l[i.id]=h);let c=h[a];return void 0===c&&(c=p(n.isWebGL2?t.createVertexArray():s.createVertexArrayOES()),h[a]=c),c}(x,u,l);h!==e&&(h=e,d(h.object)),w=function(t,e,i,n){let r=h.attributes,s=e.attributes,a=0,o=i.getAttributes();for(let l in o)if(o[l].location>=0){let e=r[l],i=s[l];if(void 0===i&&("instanceMatrix"===l&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(i=t.instanceColor)),void 0===e||e.attribute!==i||i&&e.data!==i.data)return!0;a++}return h.attributesNum!==a||h.index!==n}
2(r,x,u,b),w&&function(t,e,i,n){let r={},s=e.attributes,a=0,o=i.getAttributes();for(let l in o)if(o[l].location>=0){let e=s[l];void 0===e&&("instanceMatrix"===l&&t.instanceMatrix&&(e=t.instanceMatrix),"instanceColor"===l&&t.instanceColor&&(e=t.instanceColor));let i={};i.attribute=e,e&&e.data&&(i.data=e.data),r[l]=i,a++}h.attributes=r,h.attributesNum=a,h.index=n}(r,x,u,b)}else{let t=!0===l.wireframe;(h.geometry!==x.id||h.program!==u.id||h.wireframe!==t)&&(h.geometry=x.id,h.program=u.id,h.wireframe=t,w=!0)}null!==b&&i.update(b,34963),(w||c)&&(c=!1,function(r,s,a,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;f();let l=o.attributes,h=a.getAttributes(),c=s.defaultAttributeValues;for(let e in h){let n=h[e];if(n.location>=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){let e=s.normalized,a=s.itemSize,l=i.get(s);if(void 0===l)continue;let h=l.buffer,c=l.type,d=l.bytesPerElement;if(s.isInterleavedBufferAttribute){let i=s.data,l=i.stride,u=s.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<n.locationSize;t++)g(n.location+t,i.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<n.locationSize;t++)m(n.location+t);t.bindBuffer(34962,h);for(let t=0;t<n.locationSize;t++)y(n.location+t,a/n.locationSize,c,e,l*d,(u+a/n.locationSize*t)*d)}else{if(s.isInstancedBufferAttribute){for(let t=0;t<n.locationSize;t++)g(n.location+t,s.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let t=0;t<n.locationSize;t++)m(n.location+t);t.bindBuffer(34962,h);for(let t=0;t<n.locationSize;t++)y(n.location+t,a/n.locationSize,c,e,a*d,a/n.locationSize*t*d)}}else if(void 0!==c){let i=c[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n.location,i);break;case 3:t.vertexAttrib3fv(n.location,i);break;case 4:t.vertexAttrib4fv(n.location,i);break;default:t.vertexAttrib1fv(n.location,i)}}}}v()}(r,l,u,x),null!==b&&t.bindBuffer(34963,i.get(b).buffer))},reset:x,resetDefaultState:b,dispose:function(){x();for(let t in o){let e=o[t];for(let t in e){let i=e[t];for(let t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;let e=o[t.id];for(let i in e){let t=e[i];for(let e in t)u(t[e].object),delete t[e];delete e[i]}delete o[t.id]},releaseStatesOfProgram:function(t){for(let e in o){let i=o[e];if(void 0===i[t.id])continue;let n=i[t.id];for(let t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:f,enableAttribute:m,disableUnusedAttributes:v}}function kn(t,e,i,n){let r,s=n.isWebGL2;this.setMode=function(t){r=t},this.render=function(e,n){t.drawArrays(r,e,n),i.update(n,r,1)},this.renderInstances=function(n,a,o){if(0===o)return;let l,h;if(s)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return;l[h](r,n,a,o),i.update(a,r,o)}}function Vn(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let s=typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext,a=void 0!==i.precision?i.precision:"highp",o=r(a);o!==a&&(a=o);let l=s||e.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,c=t.getParameter(34930),d=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),y=d>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){let i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(36183):0}}function jn(t){let e=this,i=null,n=0,r=!1,s=!1,a=new En,o=new qt,l={value:null,needsUpdate:!1};function h(t,i,n,r){let s=null!==t?t.length:0,h=null;if(0!==s){if(h=l.value,!0!==r||null===h){let e=n+4*s,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let i=0,l=n;i!==s;
2++i,l+=4)a.copy(t[i]).applyMatrix4(r,o),a.normal.toArray(h,l),h[l+3]=a.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){let i=0!==t.length||e||0!==n||r;return r=e,n=t.length,i},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){i=h(t,e,0)},this.setState=function(a,o,c){let d=a.clippingPlanes,u=a.clipIntersection,p=a.clipShadows,f=t.get(a);if(!r||null===d||0===d.length||s&&!p)s?h(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0);else{let t=s?0:n,e=4*t,r=f.clippingState||null;l.value=r,r=h(d,o,e,c);for(let n=0;n!==e;++n)r[n]=i[n];f.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function Gn(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=k:304===e&&(t.mapping=V),t}function n(t){let i=t.target;i.removeEventListener("dispose",n);let r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){let s=r.mapping;if(303===s||304===s){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{let s=r.image;if(s&&s.height>0){let a=new _n(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",n),i(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}var Wn=class extends yn{constructor(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,s){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=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-t,s=i+t,a=n+e,o=n-e;if(null!==this.view&&this.view.enabled){let t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}},Hn=[.125,.215,.35,.446,.526,.582],qn=20,Xn=new Wn,Yn=new le,Qn=null,Zn=(1+Math.sqrt(5))/2,Kn=1/Zn,Jn=[new be(1,1,1),new be(-1,1,1),new be(1,1,-1),new be(-1,1,-1),new be(0,Zn,Kn),new be(0,Zn,-Kn),new be(Kn,0,Zn),new be(-Kn,0,Zn),new be(Zn,Kn,0),new be(-Zn,Kn,0)],$n=class{constructor(t){this._renderer=t,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(t,e=0,i=.1,n=100){Qn=this._renderer.getRenderTarget(),this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=nr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=ir(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Qn),t.scissorTest=!1,er(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===k||t.mapping===V?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Qn=this._renderer.getRenderTarget();let i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:Q,minFilter:Q,generateMipmaps:!1,type:et,format:nt,encoding:wt,depthBuffer:!1},n=tr(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=tr(t,e,i);let{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){let e=[],i=[],n=[],r=t,s=t-4+1+Hn.length;for(let a=0;a<s;a++){let s=Math.pow(2,r);i.push(s);let o=1/s;a>t-4?o=Hn[a-t+4-1]:0===a&&(o=0),n.push(o);let l=1/(s-2),h=-l,c=1+l,d=[h,h,c,h,c,c,h,h,c,c,h,c],u=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*u),y=new Float32Array(m*p*u),x=new Float32Array(g*p*u);for(let t=0;t<u;t++){let e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];v.set(n,f*p*t),y.set(d,m*p*t);let r=[t,t,t,t,t,t];x.set(r,g*p*t)}let b=new Qi;b.setAttribute("position",new Ni(v,f)),b.setAttribute("uv",new Ni(y,m)),b.setAttribute("faceIndex",new Ni(x,g)),e.push(b),r>4&&r--}return{lodPlanes:e,sizeLods:i,sigmas:n}}
vendor: 2,282 bytes, line 2
2(n)),this._blurMaterial=function(t,e,i){let n=new Float32Array(qn),r=new be(0,1,0);return new vn({name:"SphericalGaussianBlur",defines:{n:qn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:rr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(n,t,e)}return n}_compileMaterial(t){let e=new cn(this._lodPlanes[0],t);this._renderer.compile(e,Xn)}_sceneToCubeUV(t,e,i,n){let r=new xn(90,1,e,i),s=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.toneMapping;o.getClearColor(Yn),o.toneMapping=0,o.autoClear=!1;
2let c=new Bi({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new cn(new un,c),u=!1,p=t.background;p?p.isColor&&(c.color.copy(p),t.background=null,u=!0):(c.color.copy(Yn),u=!0);for(let f=0;f<6;f++){let e=f%3;0===e?(r.up.set(0,s[f],0),r.lookAt(a[f],0,0)):1===e?(r.up.set(0,0,s[f]),r.lookAt(0,a[f],0)):(r.up.set(0,s[f],0),r.lookAt(0,0,a[f]));let i=this._cubeSize;er(n,e*i,f>2?i:0,i,i),o.setRenderTarget(n),u&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){let i=this._renderer,n=t.mapping===k||t.mapping===V;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=nr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=ir());let r=n?this._cubemapMaterial:this._equirectMaterial,s=new cn(this._lodPlanes[0],r);r.uniforms.envMap.value=t;let a=this._cubeSize;er(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(s,Xn)}_applyPMREM(t){let e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let e=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),i=Jn[(n-1)%Jn.length];this._blur(t,n-1,n,e,i)}e.autoClear=i}_blur(t,e,i,n,r){let s=this._pingPongRenderTarget;this._halfBlur(t,s,e,i,n,"latitudinal",r),this._halfBlur(s,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,s,a){let o=this._renderer,l=this._blurMaterial,h=new cn(this._lodPlanes[n],l),c=l.uniforms,d=this._sizeLods[i]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,f=isFinite(r)?1+Math.floor(3*p):qn,m=[],g=0;for(let x=0;x<qn;++x){let t=x/p,e=Math.exp(-t*t/2);m.push(e),0===x?g+=e:x<f&&(g+=2*e)}for(let x=0;x<m.length;x++)m[x]=m[x]/g;c.envMap.value=t.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===s,a&&(c.poleAxis.value=a);let{_lodMax:v}=this;c.dTheta.value=u,c.mipInt.value=v-i;let y=this._sizeLods[n];er(e,3*y*(n>v-4?n-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(e),o.render(h,Xn)}};function tr(t,e,i){let n=new ge(t,e,i);return n.texture.mapping=j,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function er(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function ir(){return new vn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:rr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function nr(){return new vn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:rr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function rr(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function sr(t){let e=new WeakMap,i=null;function n(t){let i=t.target;i.removeEventListener("dispose",n);let r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let s=r.mapping,a=303===s||304===s,o=s===k||s===V;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let n=e.get(r);return null===i&&(i=new $n(t)),n=a?i.fromEquirectangular(r,n):i.fromCubemap(r,n),e.set(r,n),n.texture}if(e.has(r))return e.get(r).texture;{let s=r.image;if(a&&s&&s.height>0||o&&s&&function(t){let e=0,i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(s)){null===i&&(i=new $n(t));let s=a?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,s),r.addEventListener("dispose",n),s.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function ar(t){let e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.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(t){let e=i(t);return e}}}function or(t,e,i,n){let r={},s=new WeakMap;function a(t){let o=t.target;null!==o.index&&e.remove(o.index);for(let i in o.attributes)e.remove(o.attributes[i]);o.removeEventListener("dispose",a),delete r[o.id];let l=s.get(o);l&&(e.remove(l),s.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){let i=[],n=t.index,r=t.attributes.position,a=0;if(null!==n){let t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){let n=t[e+0],r=t[e+1],s=t[e+2];i.push(n,r,r,s,s,n)}}else{let t=r.array;a=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){let t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}let o=new(Yt(i)?ki:Ui)(i,1);o.version=a;let l=s.get(t);l&&e.remove(l),s.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",a),r[e.id]=!0,i.memory.geometries++),e},update:function(t){let i=t.attributes;for(let r in i)e.update(i[r],34962);let n=t.morphAttributes;for(let r in n){let t=n[r];for(let i=0,n=t.length;i<n;i++)e.update(t[i],34962)}},getWireframeAttribute:function(t){let e=s.get(t);if(e){let i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return s.get(t)}}}
2function lr(t,e,i,n){let r,s,a,o=n.isWebGL2;this.setMode=function(t){r=t},this.setIndex=function(t){s=t.type,a=t.bytesPerElement},this.render=function(e,n){t.drawElements(r,n,s,e*a),i.update(n,r,1)},this.renderInstances=function(n,l,h){if(0===h)return;let c,d;if(o)c=t,d="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===c)return;c[d](r,l,s,n*a,h),i.update(l,r,h)}}function hr(t){let e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t}}}}function cr(t,e){return t[0]-e[0]}function dr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function ur(t,e,i){let n={},r=new Float32Array(8),s=new WeakMap,a=new me,o=[];for(let l=0;l<8;l++)o[l]=[l,0];return{update:function(l,h,c,d){let u=l.morphTargetInfluences;if(!0===e.isWebGL2){let n=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,r=void 0!==n?n.length:0,o=s.get(h);if(void 0===o||o.count!==r){let t=function(){v.dispose(),s.delete(h),h.removeEventListener("dispose",t)};void 0!==o&&o.texture.dispose();let i=void 0!==h.morphAttributes.position,n=void 0!==h.morphAttributes.normal,l=void 0!==h.morphAttributes.color,c=h.morphAttributes.position||[],d=h.morphAttributes.normal||[],u=h.morphAttributes.color||[],p=0;!0===i&&(p=1),!0===n&&(p=2),!0===l&&(p=3);let f=h.attributes.position.count*p,m=1;f>e.maxTextureSize&&(m=Math.ceil(f/e.maxTextureSize),f=e.maxTextureSize);let g=new Float32Array(f*m*4*r),v=new ve(g,f,m,r);v.type=tt,v.needsUpdate=!0;let y=4*p;for(let e=0;e<r;e++){let t=c[e],r=d[e],s=u[e],o=f*m*4*e;for(let e=0;e<t.count;e++){let h=e*y;!0===i&&(a.fromBufferAttribute(t,e),g[o+h+0]=a.x,g[o+h+1]=a.y,g[o+h+2]=a.z,g[o+h+3]=0),!0===n&&(a.fromBufferAttribute(r,e),g[o+h+4]=a.x,g[o+h+5]=a.y,g[o+h+6]=a.z,g[o+h+7]=0),!0===l&&(a.fromBufferAttribute(s,e),g[o+h+8]=a.x,g[o+h+9]=a.y,g[o+h+10]=a.z,g[o+h+11]=4===s.itemSize?a.w:1)}}o={count:r,texture:v,size:new Ht(f,m)},s.set(h,o),h.addEventListener("dispose",t)}let l=0;for(let t=0;t<u.length;t++)l+=u[t];let c=h.morphTargetsRelative?1:1-l;d.getUniforms().setValue(t,"morphTargetBaseInfluence",c),d.getUniforms().setValue(t,"morphTargetInfluences",u),d.getUniforms().setValue(t,"morphTargetsTexture",o.texture,i),d.getUniforms().setValue(t,"morphTargetsTextureSize",o.size)}else{let e=void 0===u?0:u.length,i=n[h.id];if(void 0===i||i.length!==e){i=[];for(let t=0;t<e;t++)i[t]=[t,0];n[h.id]=i}for(let t=0;t<e;t++){let e=i[t];e[0]=t,e[1]=u[t]}i.sort(dr);for(let t=0;t<8;t++)t<e&&i[t][1]?(o[t][0]=i[t][0],o[t][1]=i[t][1]):(o[t][0]=Number.MAX_SAFE_INTEGER,o[t][1]=0);o.sort(cr);let s=h.morphAttributes.position,a=h.morphAttributes.normal,l=0;for(let t=0;t<8;t++){let e=o[t],i=e[0],n=e[1];i!==Number.MAX_SAFE_INTEGER&&n?(s&&h.getAttribute("morphTarget"+t)!==s[i]&&h.setAttribute("morphTarget"+t,s[i]),a&&h.getAttribute("morphNormal"+t)!==a[i]&&h.setAttribute("morphNormal"+t,a[i]),r[t]=n,l+=n):(s&&!0===h.hasAttribute("morphTarget"+t)&&h.deleteAttribute("morphTarget"+t),a&&!0===h.hasAttribute("morphNormal"+t)&&h.deleteAttribute("morphNormal"+t),r[t]=0)}let c=h.morphTargetsRelative?1:1-l;d.getUniforms().setValue(t,"morphTargetBaseInfluence",c),d.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function pr(t,e,i,n){let r=new WeakMap;function s(t){let e=t.target;e.removeEventListener("dispose",s),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){let a=n.render.frame,o=t.geometry,l=e.get(t,o);return r.get(l)!==a&&(e.update(l),r.set(l,a)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",s)&&t.addEventListener("dispose",s),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}var fr=new fe,mr=new ve,gr=new class extends fe{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=q,this.minFilter=q,this.wrapR=W,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},vr=new Sn,yr=[],xr=[],br=new Float32Array(16),wr=new Float32Array(9),Sr=new Float32Array(4);function _r(t,e,i){let n=t[0];if(null==n||n<=0||n>0)return t;let r=e*i,s=yr[r];if(void 0===s&&(s=new Float32Array(r),yr[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function Ar(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Mr(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Cr(t,e){let i=xr[e];void 0===i&&(i=new Int32Array(e),xr[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Er(t,e){let i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Pr(t,e){let i=this.cache;
vendor: 6,685 bytes, line 2
2if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Ar(i,e))return;t.uniform2fv(this.addr,e),Mr(i,e)}}function Tr(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)(i[0]!==e.r||i[1]!==e.g||i[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Ar(i,e))return;t.uniform3fv(this.addr,e),Mr(i,e)}}function Dr(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z||i[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Ar(i,e))return;t.uniform4fv(this.addr,e),Mr(i,e)}}function Ir(t,e){let i=this.cache,n=e.elements;if(void 0===n){if(Ar(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Mr(i,e)}else{if(Ar(i,n))return;Sr.set(n),t.uniformMatrix2fv(this.addr,!1,Sr),Mr(i,n)}}function Or(t,e){let i=this.cache,n=e.elements;if(void 0===n){if(Ar(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Mr(i,e)}else{if(Ar(i,n))return;wr.set(n),t.uniformMatrix3fv(this.addr,!1,wr),Mr(i,n)}}function Rr(t,e){let i=this.cache,n=e.elements;if(void 0===n){if(Ar(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Mr(i,e)}else{if(Ar(i,n))return;br.set(n),t.uniformMatrix4fv(this.addr,!1,br),Mr(i,n)}}function Lr(t,e){let i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Br(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Ar(i,e))return;t.uniform2iv(this.addr,e),Mr(i,e)}}function zr(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Ar(i,e))return;t.uniform3iv(this.addr,e),Mr(i,e)}}function Fr(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z||i[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Ar(i,e))return;t.uniform4iv(this.addr,e),Mr(i,e)}}function Nr(t,e){let i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Ur(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Ar(i,e))return;t.uniform2uiv(this.addr,e),Mr(i,e)}}function kr(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Ar(i,e))return;t.uniform3uiv(this.addr,e),Mr(i,e)}}function Vr(t,e){let i=this.cache;if(void 0!==e.x)(i[0]!==e.x||i[1]!==e.y||i[2]!==e.z||i[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Ar(i,e))return;t.uniform4uiv(this.addr,e),Mr(i,e)}}function jr(t,e,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2D(e||fr,r)}function Gr(t,e,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||gr,r)}function Wr(t,e,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||vr,r)}function Hr(t,e,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||mr,r)}function qr(t,e){t.uniform1fv(this.addr,e)}function Xr(t,e){let i=_r(e,this.size,2);t.uniform2fv(this.addr,i)}function Yr(t,e){let i=_r(e,this.size,3);t.uniform3fv(this.addr,i)}function Qr(t,e){let i=_r(e,this.size,4);t.uniform4fv(this.addr,i)}function Zr(t,e){let i=_r(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Kr(t,e){let i=_r(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Jr(t,e){let i=_r(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function $r(t,e){t.uniform1iv(this.addr,e)}function ts(t,e){t.uniform2iv(this.addr,e)}function es(t,e){t.uniform3iv(this.addr,e)}function is(t,e){t.uniform4iv(this.addr,e)}function ns(t,e){t.uniform1uiv(this.addr,e)}function rs(t,e){t.uniform2uiv(this.addr,e)}function ss(t,e){t.uniform3uiv(this.addr,e)}function as(t,e){t.uniform4uiv(this.addr,e)}function os(t,e,i){let n=this.cache,r=e.length,s=Cr(i,r);Ar(n,s)||(t.uniform1iv(this.addr,s),Mr(n,s));for(let a=0;a!==r;++a)i.setTexture2D(e[a]||fr,s[a])}function ls(t,e,i){let n=this.cache,r=e.length,s=Cr(i,r);Ar(n,s)||(t.uniform1iv(this.addr,s),Mr(n,s));for(let a=0;a!==r;++a)i.setTexture3D(e[a]||gr,s[a])}function hs(t,e,i){let n=this.cache,r=e.length,s=Cr(i,r);Ar(n,s)||(t.uniform1iv(this.addr,s),Mr(n,s));for(let a=0;a!==r;++a)i.setTextureCube(e[a]||vr,s[a])}function cs(t,e,i){let n=this.cache,r=e.length,s=Cr(i,r);Ar(n,s)||(t.uniform1iv(this.addr,s),Mr(n,s));for(let a=0;a!==r;++a)i.setTexture2DArray(e[a]||mr,s[a])}var ds=class{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Er;case 35664:return Pr;case 35665:return Tr;case 35666:return Dr;case 35674:return Ir;case 35675:return Or;case 35676:return Rr;case 5124:case 35670:return Lr;case 35667:case 35671:return Br;case 35668:case 35672:return zr;case 35669:case 35673:return Fr;case 5125:return Nr;case 36294:return Ur;case 36295:return kr;case 36296:return Vr;case 35678:case 36198:case 36298:case 36306:case 35682:return jr;case 35679:case 36299:case 36307:return Gr;case 35680:case 36300:case 36308:case 36293:return Wr;case 36289:case 36303:case 36311:case 36292:return Hr}}(e.type)}},us=class{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return qr;case 35664:return Xr;case 35665:return Yr;case 35666:return Qr;case 35674:return Zr;case 35675:return Kr;case 35676:return Jr;case 5124:case 35670:return $r;case 35667:case 35671:return ts;case 35668:case 35672:return es;case 35669:case 35673:return is;case 5125:return ns;case 36294:return rs;case 36295:return ss;case 36296:return as;case 35678:case 36198:case 36298:case 36306:case 35682:return os;case 35679:case 36299:case 36307:return ls;case 35680:case 36300:case 36308:case 36293:return hs;case 36289:case 36303:case 36311:case 36292:return cs}}(e.type)}},ps=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){if(void 0===e)return;let n=this.seq;for(let r=0,s=n.length;r!==s;++r){let s=n[r];s.setValue(t,e[s.id],i)}}},fs=/(\w+)(\])?(\[|\.)?/g;function ms(t,e){t.seq.push(e),t.map[e.id]=e}function gs(t,e,i){let n=t.name,r=n.length;for(fs.lastIndex=0;;){let s=fs.exec(n),a=fs.lastIndex,o=s[1],l="]"===s[2],h=s[3];if(l&&(o|=0),void 0===h||"["===h&&a+2===r){ms(i,void 0===h?new ds(o,t,e):new us(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new ps(o),ms(i,t)),i=t}}}var vs=class{constructor(t,e){this.seq=[],this.map={};
2let i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){let i=t.getActiveUniform(e,n);gs(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){let r=this.map[e];void 0!==r&&r.setValue(t,i,n)}setOptional(t,e,i){let n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let r=0,s=e.length;r!==s;++r){let s=e[r],a=i[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,n)}}static seqWithValue(t,e){let i=[];for(let n=0,r=t.length;n!==r;++n){let r=t[n];r.id in e&&i.push(r)}return i}};function ys(t,e,i){let n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}var xs=0;function bs(t,e,i){let n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(n&&""===r)return"";let s=/ERROR: 0:(\d+)/.exec(r);if(s){let n=parseInt(s[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){let i=t.split("\n"),n=[],r=Math.max(e-6,0),s=Math.min(e+6,i.length);for(let a=r;a<s;a++){let t=a+1;n.push(`${t===e?">":" "} ${t}: ${i[a]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return r}function ws(t,e){let i=function(t){switch(t){case wt:return["Linear","( value )"];case St:return["sRGB","( value )"];default:return["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function Ss(t,e){let i;switch(e){case 1:default:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function _s(t){return""!==t}function As(t,e){let i=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ms(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Cs=/^[ \t]*#include +<([\w\d./]+)>/gm;function Es(t){return t.replace(Cs,Ps)}function Ps(t,e){let i=Ln[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Es(i)}var Ts=/#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 Ds(t){return t.replace(Ts,Is)}function Is(t,e,i,n){let r="";for(let s=parseInt(e);s<parseInt(i);s++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function Os(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Rs(t,e,i,n){let r,s,a=t.getContext(),o=i.defines,l=i.vertexShader,h=i.fragmentShader,c=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),d=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case k:case V:e="ENVMAP_TYPE_CUBE";break;case j:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),u=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===V&&(e="ENVMAP_MODE_REFRACTION");return e}(i),p=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),f=function(t){let e=t.envMapCubeUVHeight;if(null===e)return null;let i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),m=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(_s).join("\n")}(i),g=function(t){let e=[];for(let i in t){let n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(o),v=a.createProgram(),y=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(r=[g].filter(_s).join("\n"),r.length>0&&(r+="\n"),s=[m,g].filter(_s).join("\n"),s.length>0&&(s+="\n")):(r=[Os(i),"#define SHADER_NAME "+i.shaderName,g,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 "+u:"",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_IR
2IDESCENCEMAP":"",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.alphaMap?"#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 "+c:"",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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(_s).join("\n"),s=[m,Os(i),"#define SHADER_NAME "+i.shaderName,g,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 "+d:"",i.envMap?"#define "+u:"",i.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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_IR
2IDESCENCE_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 "+c:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#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?Ln.tonemapping_pars_fragment:"",0!==i.toneMapping?Ss("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Ln.encodings_pars_fragment,ws("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(_s).join("\n")),l=Es(l),l=As(l,i),l=Ms(l,i),h=Es(h),h=As(h,i),h=Ms(h,i),l=Ds(l),h=Ds(h),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(y="#version 300 es\n",r=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,s=["#define varying in",i.glslVersion===Pt?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===Pt?"":"#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("\n")+"\n"+s);let x,b,w=y+s+h,S=ys(a,35633,y+r+l),_=ys(a,35632,w);if(a.attachShader(v,S),a.attachShader(v,_),void 0!==i.index0AttributeName?a.bindAttribLocation(v,0,i.index0AttributeName):!0===i.morphTargets&&a.bindAttribLocation(v,0,"position"),a.linkProgram(v),t.debug.checkShaderErrors){let t=a.getProgramInfoLog(v).trim(),e=a.getShaderInfoLog(S).trim(),i=a.getShaderInfoLog(_).trim(),n=!0,o=!0;if(!1===a.getProgramParameter(v,35714)){n=!1;bs(a,S,"vertex"),bs(a,_,"fragment")}else""!==t||(""===e||""===i)&&(o=!1);o&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:r},fragmentShader:{log:i,prefix:s}})}return a.deleteShader(S),a.deleteShader(_),this.getUniforms=function(){return void 0===x&&(x=new vs(a,v)),x},this.getAttributes=function(){return void 0===b&&(b=function(t,e){let i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){let n=t.getActiveAttrib(e,r),s=n.name,a=1;35674===n.type&&(a=2),35675===n.type&&(a=3),35676===n.type&&(a=4),i[s]={type:n.type,location:t.getAttribLocation(e,s),locationSize:a}}return i}(a,v)),b},this.destroy=function(){n.releaseStatesOfProgram(this),a.deleteProgram(v),this.program=void 0},this.name=i.shaderName,this.id=xs++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=S,this.fragmentShader=_,this}var Ls=0,Bs=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),r=this._getShaderStage(i),s=this._getShaderCacheForMaterial(t);return!1===s.has(n)&&(s.add(n),n.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let i of e)i.usedTimes--,0===i.usedTimes&&this.shaderCache.delete(i.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){let e=this.shaderCache,i=e.get(t);return void 0===i&&(i=new zs(t),e.set(t,i)),i}},zs=class{constructor(t){this.id=Ls++,this.code=t,this.usedTimes=0}};function Fs(t,e,i,n,r,s,a){let o=new oi,l=new Bs,h=[],c=r.isWebGL2,d=r.logarithmicDepthBuffer,u=r.vertexTextures,p=r.precision,f={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(s,o,h,m,g){let v=m.fog,y=g.geometry,x=s.isMeshStandardMaterial?m.environment:null,b=(s.isMeshStandardMaterial?i:e).get(s.envMap||x),w=b&&b.mapping===j?b.image.height:null,S=f[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),s.precision);let _,A,M,C,E=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,P=void 0!==E?E.length:0,T=0;if(void 0!==y.morphAttributes.position&&(T=1),void 0!==y.morphAttributes.normal&&(T=2),void 0!==y.morphAttributes.color&&(T=3),S){let t=zn[S];_=t.vertexShader,A=t.fragmentShader}else _=s.vertexShader,A=s.fragmentShader,l.update(s),M=l.getVertexShaderID(s),C=l.getFragmentShaderID(s);let D=t.getRenderTarget(),I=s.alphaTest>0,O=s.clearcoat>0,R=s.iridescence>0;return{isWebGL2:c,shaderID:S,shaderName:s.type,vertexShader:_,fragmentShader:A,defines:s.defines,customVertexShaderID:M,customFragmentShaderID:C,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:u,outputEncoding:null===D?t.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:wt,map:!!s.map,matcap:!!s.matcap,envMap:!!b,envMapMode:b&&b.mapping,envMapCubeUVHeight:w,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===St,clearcoat:O,clearcoatMap:O&&!!s.clearcoatMap,clearcoatRoughnessMap:O&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:O&&!!s.clearcoatNormalMap,iridescence:R,iridescenceMap:R&&!!s.iridescenceMap,iridescenceThicknessMap:R&&!!s.iridescenceThicknessMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&1===s.blending,alphaMap:!!s.alphaMap,alphaTest:I,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!y.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.iridescenceMap||s.iridescenceThicknessMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.iridescenceMap||s.iridescenceThicknessMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!v,useFog:!0===s.fog,fogExp2:v&&v.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:P,morphTextureStride:T,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,useDepthPacking:!!s.depthPacking,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||n.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){let i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(let t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.pu
vendor: 6,605 bytes, line 2
2sh(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0),e.supportsVertexTextures&&o.enable(1),e.instancing&&o.enable(2),e.instancingColor&&o.enable(3),e.map&&o.enable(4),e.matcap&&o.enable(5),e.envMap&&o.enable(6),e.lightMap&&o.enable(7),e.aoMap&&o.enable(8),e.emissiveMap&&o.enable(9),e.bumpMap&&o.enable(10),e.normalMap&&o.enable(11),e.objectSpaceNormalMap&&o.enable(12),e.tangentSpaceNormalMap&&o.enable(13),e.clearcoat&&o.enable(14),e.clearcoatMap&&o.enable(15),e.clearcoatRoughnessMap&&o.enable(16),e.clearcoatNormalMap&&o.enable(17),e.iridescence&&o.enable(18),e.iridescenceMap&&o.enable(19),e.iridescenceThicknessMap&&o.enable(20),e.displacementMap&&o.enable(21),e.specularMap&&o.enable(22),e.roughnessMap&&o.enable(23),e.metalnessMap&&o.enable(24),e.gradientMap&&o.enable(25),e.alphaMap&&o.enable(26),e.alphaTest&&o.enable(27),e.vertexColors&&o.enable(28),e.vertexAlphas&&o.enable(29),e.vertexUvs&&o.enable(30),e.vertexTangents&&o.enable(31),e.uvsVertexOnly&&o.enable(32),t.push(o.mask),o.disableAll(),e.fog&&o.enable(0),e.useFog&&o.enable(1),e.flatShading&&o.enable(2),e.logarithmicDepthBuffer&&o.enable(3),e.skinning&&o.enable(4),e.morphTargets&&o.enable(5),e.morphNormals&&o.enable(6),e.morphColors&&o.enable(7),e.premultipliedAlpha&&o.enable(8),e.shadowMapEnabled&&o.enable(9),e.physicallyCorrectLights&&o.enable(10),e.doubleSided&&o.enable(11),e.flipSided&&o.enable(12),e.useDepthPacking&&o.enable(13),e.dithering&&o.enable(14),e.specularIntensityMap&&o.enable(15),e.specularColorMap&&o.enable(16),e.transmission&&o.enable(17),e.transmissionMap&&o.enable(18),e.thicknessMap&&o.enable(19),e.sheen&&o.enable(20),e.sheenColorMap&&o.enable(21),e.sheenRoughnessMap&&o.enable(22),e.decodeVideoTexture&&o.enable(23),e.opaque&&o.enable(24),t.push(o.mask)}(i,e),i.push(t.outputEncoding)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){let e,i=f[t.type];if(i){let t=zn[i];e=gn.clone(t.uniforms)}else e=t.uniforms;return e},acquireProgram:function(e,i){let n;for(let t=0,r=h.length;t<r;t++){let e=h[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Rs(t,i,e,s),h.push(n)),n},releaseProgram:function(t){if(0===--t.usedTimes){let e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function Ns(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function Us(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function ks(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Vs(){let t=[],e=0,i=[],n=[],r=[];function s(i,n,r,s,a,o){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:s,renderOrder:i.renderOrder,z:a,group:o},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=s,l.renderOrder=i.renderOrder,l.z=a,l.group=o),e++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){e=0,i.length=0,n.length=0,r.length=0},push:function(t,e,a,o,l,h){let c=s(t,e,a,o,l,h);a.transmission>0?n.push(c):!0===a.transparent?r.push(c):i.push(c)},unshift:function(t,e,a,o,l,h){let c=s(t,e,a,o,l,h);a.transmission>0?n.unshift(c):!0===a.transparent?r.unshift(c):i.unshift(c)},finish:function(){for(let i=e,n=t.length;i<n;i++){let e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Us),n.length>1&&n.sort(e||ks),r.length>1&&r.sort(e||ks)}}}function js(){let t=new WeakMap;return{get:function(e,i){let n,r=t.get(e);return void 0===r?(n=new Vs,t.set(e,[n])):i>=r.length?(n=new Vs,r.push(n)):n=r[i],n},dispose:function(){t=new WeakMap}}}function Gs(){let t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new be,color:new le};break;case"SpotLight":i={position:new be,direction:new be,color:new le,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new be,color:new le,distance:0,decay:0};break;case"HemisphereLight":i={direction:new be,skyColor:new le,groundColor:new le};break;case"RectAreaLight":i={color:new le,position:new be,halfWidth:new be,halfHeight:new be}}return t[e.id]=i,i}}}var Ws=0;function Hs(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function qs(t,e){let i=new Gs,n=function(){let t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={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 l=0;l<9;l++)r.probe.push(new be);let s=new be,a=new Ze,o=new Ze;return{setup:function(s,a){let o=0,l=0,h=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,d=0,u=0,p=0,f=0,m=0,g=0,v=0,y=0,x=0;s.sort(Hs);let b=!0!==a?Math.PI:1;for(let t=0,e=s.length;t<e;t++){let e=s[t],a=e.color,w=e.intensity,S=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=a.r*w*b,l+=a.g*w*b,h+=a.b*w*b;else if(e.isLightProbe)for(let t=0;t<9;
2t++)r.probe[t].addScaledVector(e.sh.coefficients[t],w);else if(e.isDirectionalLight){let t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*b),e.castShadow){let t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[c]=i,r.directionalShadowMap[c]=_,r.directionalShadowMatrix[c]=e.shadow.matrix,m++}r.directional[c]=t,c++}else if(e.isSpotLight){let t=i.get(e);t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(a).multiplyScalar(w*b),t.distance=S,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,r.spot[u]=t;let s=e.shadow;if(e.map&&(r.spotLightMap[y]=e.map,y++,s.updateMatrices(e),e.castShadow&&x++),r.spotLightMatrix[u]=s.matrix,e.castShadow){let t=n.get(e);t.shadowBias=s.bias,t.shadowNormalBias=s.normalBias,t.shadowRadius=s.radius,t.shadowMapSize=s.mapSize,r.spotShadow[u]=t,r.spotShadowMap[u]=_,v++}u++}else if(e.isRectAreaLight){let t=i.get(e);t.color.copy(a).multiplyScalar(w),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){let t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*b),t.distance=e.distance,t.decay=e.decay,e.castShadow){let t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[d]=i,r.pointShadowMap[d]=_,r.pointShadowMatrix[d]=e.shadow.matrix,g++}r.point[d]=t,d++}else if(e.isHemisphereLight){let t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(w*b),t.groundColor.copy(e.groundColor).multiplyScalar(w*b),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Bn.LTC_FLOAT_1,r.rectAreaLTC2=Bn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")&&(r.rectAreaLTC1=Bn.LTC_HALF_1,r.rectAreaLTC2=Bn.LTC_HALF_2)),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;let w=r.hash;(w.directionalLength!==c||w.pointLength!==d||w.spotLength!==u||w.rectAreaLength!==p||w.hemiLength!==f||w.numDirectionalShadows!==m||w.numPointShadows!==g||w.numSpotShadows!==v||w.numSpotMaps!==y)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=p,r.point.length=d,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=v+y-x,r.spotLightMap.length=y,r.numSpotLightShadowsWithMaps=x,w.directionalLength=c,w.pointLength=d,w.spotLength=u,w.rectAreaLength=p,w.hemiLength=f,w.numDirectionalShadows=m,w.numPointShadows=g,w.numSpotShadows=v,w.numSpotMaps=y,r.version=Ws++)},setupView:function(t,e){let i=0,n=0,l=0,h=0,c=0,d=e.matrixWorldInverse;for(let u=0,p=t.length;u<p;u++){let e=t[u];if(e.isDirectionalLight){let t=r.directional[i];t.direction.setFromMatrixPosition(e.matrixWorld),s.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),i++}else if(e.isSpotLight){let t=r.spot[l];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(e.matrixWorld),s.setFromMatrixPosition(e.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),l++}else if(e.isRectAreaLight){let t=r.rectArea[h];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(d),o.identity(),a.copy(e.matrixWorld),a.premultiply(d),o.extractRotation(a),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),h++}else if(e.isPointLight){let t=r.point[n];t.position.setFromMatrixPosition(e.matrixWorld),t.position.applyMatrix4(d),n++}else if(e.isHemisphereLight){let t=r.hemi[c];t.direction.setFromMatrixPosition(e.matrixWorld),t.direction.transformDirection(d),c++}}},state:r}}function Xs(t,e){let i=new qs(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function Ys(t,e){let i=new WeakMap;return{get:function(n,r=0){let s,a=i.get(n);return void 0===a?(s=new Xs(t,e),i.set(n,[s])):r>=a.length?(s=new Xs(t,e),a.push(s)):s=a[r],s},dispose:function(){i=new WeakMap}}}var Qs=class extends Li{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=_t,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Zs=class extends Li{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new be,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}};
2function Ks(t,e,i){let n=new Dn,r=new Ht,s=new Ht,a=new me,o=new Qs({depthPacking:3201}),l=new Zs,h={},c=i.maxTextureSize,d={[_]:1,[A]:0,[M]:2},u=new vn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let f=new Qi;f.setAttribute("position",new Ni(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new cn(f,u),g=this;function v(i,n){let s=e.update(m);u.defines.VSM_SAMPLES!==i.blurSamples&&(u.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new ge(r.x,r.y)),u.uniforms.shadow_pass.value=i.map.texture,u.uniforms.resolution.value=i.mapSize,u.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,s,u,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,s,p,m,null)}function y(e,i,n,r,s,a){let c=null,u=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==u)c=u;else if(c=!0===n.isPointLight?l:o,t.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 t=c.uuid,e=i.uuid,n=h[t];void 0===n&&(n={},h[t]=n);let r=n[e];void 0===r&&(r=c.clone(),n[e]=r),c=r}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=3===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:d[i.side],c.alphaMap=i.alphaMap,c.alphaTest=i.alphaTest,c.map=i.map,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.displacementMap=i.displacementMap,c.displacementScale=i.displacementScale,c.displacementBias=i.displacementBias,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===n.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(n.matrixWorld),c.nearDistance=r,c.farDistance=s),c}function x(i,r,s,a,o){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);let n=e.update(i),r=i.material;if(Array.isArray(r)){let e=n.groups;for(let l=0,h=e.length;l<h;l++){let h=e[l],c=r[h.materialIndex];if(c&&c.visible){let e=y(i,c,a,s.near,s.far,o);t.renderBufferDirect(s,null,n,e,i,h)}}}else if(r.visible){let e=y(i,r,a,s.near,s.far,o);t.renderBufferDirect(s,null,n,e,i,null)}}let l=i.children;for(let t=0,e=l.length;t<e;t++)x(l[t],r,s,a,o)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,i,o){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===e.length)return;let l=t.getRenderTarget(),h=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),u=t.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);for(let p=0,f=e.length;p<f;p++){let l=e[p],h=l.shadow;if(void 0===h)continue;if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;r.copy(h.mapSize);let d=h.getFrameExtents();if(r.multiply(d),s.copy(h.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/d.x),r.x=s.x*d.x,h.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/d.y),r.y=s.y*d.y,h.mapSize.y=s.y)),null===h.map){let t=3!==this.type?{minFilter:q,magFilter:q}:{};h.map=new ge(r.x,r.y,t),h.map.texture.name=l.name+".shadowMap",h.camera.updateProjectionMatrix()}
2t.setRenderTarget(h.map),t.clear();let f=h.getViewportCount();for(let t=0;t<f;t++){let e=h.getViewport(t);a.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),u.viewport(a),h.updateMatrices(l,t),n=h.getFrustum(),x(i,o,h.camera,l,this.type)}!0!==h.isPointLightShadow&&3===this.type&&v(h,o),h.needsUpdate=!1}g.needsUpdate=!1,t.setRenderTarget(l,h,d)}}function Js(t,e,i){let n=i.isWebGL2;let r=new function(){let e=!1,i=new me,n=null,r=new me(0,0,0,0);return{setMask:function(i){n!==i&&!e&&(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,s,a,o){!0===o&&(e*=a,n*=a,s*=a),i.set(e,n,s,a),!1===r.equals(i)&&(t.clearColor(e,n,s,a),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},s=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?tt(2929):et(2929)},setMask:function(n){i!==n&&!e&&(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},a=new function(){let e=!1,i=null,n=null,r=null,s=null,a=null,o=null,l=null,h=null;return{setTest:function(t){e||(t?tt(2960):et(2960))},setMask:function(n){i!==n&&!e&&(t.stencilMask(n),i=n)},setFunc:function(e,i,a){(n!==e||r!==i||s!==a)&&(t.stencilFunc(e,i,a),n=e,r=i,s=a)},setOp:function(e,i,n){(a!==e||o!==i||l!==n)&&(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,s=null,a=null,o=null,l=null,h=null}}},o=new WeakMap,l=new WeakMap,h={},c={},d=new WeakMap,u=[],p=null,f=!1,m=null,g=null,v=null,y=null,x=null,b=null,w=null,S=!1,_=null,A=null,M=null,k=null,V=null,j=t.getParameter(35661),G=!1,W=0,H=t.getParameter(7938);-1!==H.indexOf("WebGL")?(W=parseFloat(/^WebGL (\d)/.exec(H)[1]),G=W>=1):-1!==H.indexOf("OpenGL ES")&&(W=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),G=W>=2);let q=null,X={},Y=t.getParameter(3088),Q=t.getParameter(2978),Z=(new me).fromArray(Y),K=(new me).fromArray(Q);function J(e,i,n){let r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let a=0;a<n;a++)t.texImage2D(i+a,0,6408,1,1,0,6408,5121,r);return s}let $={};function tt(e){!0!==h[e]&&(t.enable(e),h[e]=!0)}function et(e){!1!==h[e]&&(t.disable(e),h[e]=!1)}$[3553]=J(3553,3553,1),$[34067]=J(34067,34069,6),r.setClear(0,0,0,1),s.setClear(1),a.setClear(0),tt(2929),s.setFunc(3),st(!1),at(1),tt(2884),rt(0);let it={[C]:32774,[E]:32778,[P]:32779};if(n)it[103]=32775,it[104]=32776;else{let t=e.get("EXT_blend_minmax");null!==t&&(it[103]=t.MIN_EXT,it[104]=t.MAX_EXT)}let nt={[T]:0,[D]:1,[I]:768,[R]:770,[U]:776,[F]:774,[B]:772,[O]:769,[L]:771,[N]:775,[z]:773};function rt(e,i,n,r,s,a,o,l){if(0!==e){if(!1===f&&(tt(3042),f=!0),5===e)s=s||i,a=a||n,o=o||r,(i!==g||s!==x)&&(t.blendEquationSeparate(it[i],it[s]),g=i,x=s),(n!==v||r!==y||a!==b||o!==w)&&(t.blendFuncSeparate(nt[n],nt[r],nt[a],nt[o]),v=n,y=r,b=a,w=o),m=e,S=!1;else if(e!==m||l!==S){if((g!==C||x!==C)&&(t.blendEquation(32774),g=C,x=C),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768)}v=null,y=null,b=null,w=null,m=e,S=l}}else!0===f&&(et(3042),f=!1)}function st(e){_!==e&&(e?t.frontFace(2304):t.frontFace(2305),_=e)}function at(e){0!==e?(tt(2884),e!==A&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):et(2884),A=e}function ot(e,i,n){e?(tt(32823),(k!==i||V!==n)&&(t.polygonOffset(i,n),k=i,V=n)):et(32823)}return{buffers:{color:r,depth:s,stencil:a},enable:tt,disable:et,bindFramebuffer:function(e,i){return c[e]!==i&&(t.bindFramebuffer(e,i),c[e]=i,n&&(36009===e&&(c[36160]=i),36160===e&&(c[36009]=i)),!0)},drawBuffers:function(n,r){let s=u,a=!1;if(n)if(s=d.get(r),void 0===s&&(s=[],d.set(r,s)),n.isWebGLMultipleRenderTargets){let t=n.texture;if(s.length!==t.length||36064!==s[0]){for(let e=0,i=t.length;e<i;e++)s[e]=36064+e;s.length=t.length,a=!0}}else 36064!==s[0]&&(s[0]=36064,a=!0);else 1029!==s[0]&&(s[0]=1029,a=!0);
2a&&(i.isWebGL2?t.drawBuffers(s):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(s))},useProgram:function(e){return p!==e&&(t.useProgram(e),p=e,!0)},setBlending:rt,setMaterial:function(t,e){2===t.side?et(2884):tt(2884);let i=1===t.side;e&&(i=!i),st(i),1===t.blending&&!1===t.transparent?rt(0):rt(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),r.setMask(t.colorWrite);let n=t.stencilWrite;a.setTest(n),n&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),ot(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?tt(32926):et(32926)},setFlipSided:st,setCullFace:at,setLineWidth:function(e){e!==M&&(G&&t.lineWidth(e),M=e)},setPolygonOffset:ot,setScissorTest:function(t){t?tt(3089):et(3089)},activeTexture:function(e){void 0===e&&(e=33984+j-1),q!==e&&(t.activeTexture(e),q=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===q?33984+j-1:q);let r=X[n];void 0===r&&(r={type:void 0,texture:void 0},X[n]=r),(r.type!==e||r.texture!==i)&&(q!==n&&(t.activeTexture(n),q=n),t.bindTexture(e,i||$[e]),r.type=e,r.texture=i)},unbindTexture:function(){let e=X[q];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(e){}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(e){}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(e){}},updateUBOMapping:function(e,i){let n=l.get(i);void 0===n&&(n=new WeakMap,l.set(i,n));let r=n.get(e);void 0===r&&(r=t.getUniformBlockIndex(i,e.name),n.set(e,r))},uniformBlockBinding:function(e,i){let n=l.get(i).get(e);o.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),o.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(e){}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(e){}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(e){}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(e){}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(e){}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(e){}},scissor:function(e){!1===Z.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),Z.copy(e))},viewport:function(e){!1===K.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),K.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),h={},q=null,X={},c={},d=new WeakMap,u=[],p=null,f=!1,m=null,g=null,v=null,y=null,x=null,b=null,w=null,S=!1,_=null,A=null,M=null,k=null,V=null,Z.set(0,0,t.canvas.width,t.canvas.height),K.set(0,0,t.canvas.width,t.canvas.height),r.reset(),s.reset(),a.reset()}}}function $s(t,e,i,n,r,s,a){let o,l=r.isWebGL2,h=(r.maxTextures,r.maxCubemapSize),c=r.maxTextureSize,d=r.maxSamples,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p=!(typeof navigator>"u")&&/OculusBrowser/g.test(navigator.userAgent),f=new WeakMap,m=new WeakMap,g=!1;try{g=typeof OffscreenCanvas<"u"&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch{}function v(t,e){return g?new OffscreenCanvas(t,e):Kt("canvas")}function y(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let n=e?Vt:Math.floor,s=n(r*t.width),a=n(r*t.height);void 0===o&&(o=v(s,a));let l=i?v(s,a):o;return l.width=s,l.height=a,l.getContext("2d").drawImage(t,0,0,s,a),l}return t}return t}function x(t){return Ut(t.width)&&Ut(t.height)}function b(t,e){return t.generateMipmaps&&e&&t.minFilter!==q&&t.minFilter!==Q}function w(e){t.generateMipmap(e)}function S(i,n,r,s,a=!1){if(!1===l)return n;if(null!==i&&void 0!==t[i])return t[i];let o=n;return 6403===n&&(5126===r&&(o=33326),5131===r&&(o=33325),5121===r&&(o=33321)),33319===n&&(5126===r&&(o=33328),5131===r&&(o=33327),5121===r&&(o=33323)),6408===n&&(5126===r&&(o=34836),5131===r&&(o=34842),5121===r&&(o=s===St&&!1===a?35907:32856),32819===r&&(o=32854),32820===r&&(o=32855)),(33325===o||33326===o||33327===o||33328===o||34842===o||34836===o)&&e.get("EXT_color_buffer_float"),o}function _(t,e,i){return!0===b(t,i)||t.isFramebufferTexture&&t.minFilter!==q&&t.minFilter!==Q?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function A(t){return t===q||1004===t||t===Y?9728:9729}function M(t){let e=t.target;e.removeEventListener("dispose",M),function(t){let e=n.get(t);if(void 0===e.__webglInit)return;let i=t.source,r=m.get(i);if(r){let n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&E(t),0===Object.keys(r).length&&m.delete(i)}n.remove(t)}(e),e.isVideoTexture&&f.delete(e)}function C(e){let i=e.target;i.removeEventListener("dispose",C),function(e){let i=e.texture,r=n.get(e),s=n.get(i);if(void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRen
2derTarget)for(let n=0;n<6;n++)t.deleteFramebuffer(r.__webglFramebuffer[n]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[n]);else{if(t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let e=0;e<r.__webglColorRenderbuffer.length;e++)r.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(r.__webglColorRenderbuffer[e]);r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let o=0,l=i.length;o<l;o++){let e=n.get(i[o]);e.__webglTexture&&(t.deleteTexture(e.__webglTexture),a.memory.textures--),n.remove(i[o])}n.remove(i),n.remove(e)}(i)}function E(e){let i=n.get(e);t.deleteTexture(i.__webglTexture);let r=e.source;delete m.get(r)[i.__cacheKey],a.memory.textures--}let P=0;function T(t,e){let r=n.get(t);if(t.isVideoTexture&&function(t){let e=a.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&r.__version!==t.version){let i=t.image;if(null===i);else if(!1!==i.complete)return void L(r,t,e)}i.bindTexture(3553,r.__webglTexture,33984+e)}let D={[G]:10497,[W]:33071,[H]:33648},I={[q]:9728,[X]:9984,[Y]:9986,[Q]:9729,[Z]:9985,[K]:9987};function O(i,s,a){if(a?(t.texParameteri(i,10242,D[s.wrapS]),t.texParameteri(i,10243,D[s.wrapT]),(32879===i||35866===i)&&t.texParameteri(i,32882,D[s.wrapR]),t.texParameteri(i,10240,I[s.magFilter]),t.texParameteri(i,10241,I[s.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),(32879===i||35866===i)&&t.texParameteri(i,32882,33071),s.wrapS!==W||s.wrapT,t.texParameteri(i,10240,A(s.magFilter)),t.texParameteri(i,10241,A(s.minFilter)),s.minFilter!==q&&s.minFilter),!0===e.has("EXT_texture_filter_anisotropic")){let a=e.get("EXT_texture_filter_anisotropic");if(s.magFilter===q||s.minFilter!==Y&&s.minFilter!==K||s.type===tt&&!1===e.has("OES_texture_float_linear")||!1===l&&s.type===et&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||n.get(s).__currentAnisotropy)&&(t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy)}}function R(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",M));let r=i.source,s=m.get(r);void 0===s&&(s={},m.set(r,s));let o=function(t){let e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(i);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),s[o].usedTimes++;let r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&E(i)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return n}function L(e,r,a){let o=3553;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(o=35866),r.isData3DTexture&&(o=32879);let h=R(e,r),d=r.source;i.bindTexture(o,e.__webglTexture,33984+a);let u=n.get(d);if(d.version!==u.__version||!0===h){i.activeTexture(33984+a),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);let e=function(t){return!l&&(t.wrapS!==W||t.wrapT!==W||t.minFilter!==q&&t.minFilter!==Q)}(r)&&!1===x(r.image),n=y(r.image,e,!1,c);n=k(r,n);let p=x(n)||l,f=s.convert(r.format,r.encoding),m=s.convert(r.type),g=S(r.internalFormat,f,m,r.encoding,r.isVideoTexture);O(o,r,p);let v,A=r.mipmaps,M=l&&!0!==r.isVideoTexture,C=void 0===u.__version||!0===h,E=_(r,n,p);if(r.isDepthTexture)g=6402,l?g=r.type===tt?36012:r.type===$?33190:r.type===it?35056:33189:r.type,r.format===rt&&6402===g&&1012!==r.type&&r.type!==$&&(r.type=$,m=s.convert(r.type)),r.format===st&&6402===g&&(g=34041,r.type!==it&&(r.type=it,m=s.convert(r.type))),C&&(M?i.texStorage2D(3553,1,g,n.width,n.height):i.texImage2D(3553,0,g,n.width,n.height,0,f,m,null));else if(r.isDataTexture)if(A.length>0&&p){M&&C&&i.texStorage2D(3553,E,g,A[0].width,A[0].height);for(let t=0,e=A.length;t<e;t++)v=A[t],M?i.texSubImage2D(3553,t,0,0,v.width,v.height,f,m,v.data):i.texImage2D(3553,t,g,v.width,v.height,0,f,m,v.data);r.generateMipmaps=!1}else M?(C&&i.texStorage2D(3553,E,g,n.width,n.height),i.texSubImage2D(3553,0,0,0,n.width,n.height,f,m,n.data)):i.texImage2D(3553,0,g,n.width,n.height,0,f,m,n.data);else if(r.isCompressedTexture)if(r.isCompressedArrayTexture){M&&C&&i.texStorage3D(35866,E,g,A[0].width,A[0].height,n.depth);for(let t=0,e=A.length;t<e;t++)v=A[t],r.format!==nt?null!==f&&(M?i.compressedTexSubImage3D(35866,t,0,0,0,v.width,v.height,n.depth,f,v.data,0,0):i.compressedTexImage3D(35866,t,g,v.width,v.height,n.depth,0,v.data,0,0)):M?i.texSubImage3D(35866,t,0,0,0,v.width,v.height,n.depth,f,m,v.data):i.texImage3D(35866,t,g,v.width,v.height,n.depth,0,f,m,v.data)}else{M&&C&&i.texStorage2D(3553,E,g,A[0].width,A[0].height);for(let t=0,e=A.length;t<e;t++)v=A[t],r.format!==nt?null!==f&&(M?i.compressedTexSubImage2D(3553,t,0,0,v.width,v.height,f,v.data):i.compressedTexImage2D(3553,t,g,v.width,v.height,0,v.data)):M?i.texSubImage2D(3553,t,0,0,v.width,v.height,f,m,v.data):i.texImage2D(3553,t,g,v.width,v.height,0,f,m,v.data)}else if(r.isDataArrayTexture)M?(C&&i.texStorage3D(35866,E,g,n.width,n.height,n.depth),i.texSubImage3D(35866,0,0,0,0,n.width,n.height,n.depth,f,m,n.data)):i.texImage3D(35866,0,g,n.width,n.height,n.depth,0,f,m,n.data);else if(r.isData3DTexture)M?(C&&i.texStorage3D(32879,E,g,n.width,n.height,n.depth),i.texSubImage3D(32879,0,0,0,0,n.width,n.height,n.depth,f,m,n.data)):i.texImage3D(32879,0,g,n.width,n.height,n.depth,0,f,m,n.data);else if(r.isFramebufferTexture){if(C)if(M)i.texStorage2D(3553,E,g,n.width,n.height);else{let t=n.width,e=n.height;for(let n=0;n<E;n++)i.texImage2D(3553,n,g,t,e,0,f,m,null),t>>=1,e>>=1}}else if(A.length>0&&p){M&&C&&i.texStorage2D(3553,E,g,A[0].width,A[0].height);for(let t=0,e=A.length;t<e;t++)v=A[t],M?i.texSubImage2D(3553,t,0,0,f,m,v):i.texImage2D(3553,t,g,f,m,v);r.generateMipmaps=!1}else M?(C&&i.texStorage2D(3553,E,g,n.width,n.height),i.texSubImage2D(3553,0,0,0,f,m,n)):i.texImage2D(3553,0,g,f,m,n);b(r,p)&&w(o),u.__version=d.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}
2function B(e,r,a,o,l){let h=s.convert(a.format,a.encoding),c=s.convert(a.type),d=S(a.internalFormat,h,c,a.encoding);n.get(r).__hasExternalTextures||(32879===l||35866===l?i.texImage3D(l,0,d,r.width,r.height,r.depth,0,h,c,null):i.texImage2D(l,0,d,r.width,r.height,0,h,c,null)),i.bindFramebuffer(36160,e),U(r)?u.framebufferTexture2DMultisampleEXT(36160,o,l,n.get(a).__webglTexture,0,N(r)):(3553===l||l>=34069&&l<=34074)&&t.framebufferTexture2D(36160,o,l,n.get(a).__webglTexture,0),i.bindFramebuffer(36160,null)}function z(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n||U(i)){let e=i.depthTexture;e&&e.isDepthTexture&&(e.type===tt?r=36012:e.type===$&&(r=33190));let n=N(i);U(i)?u.renderbufferStorageMultisampleEXT(36161,n,r,i.width,i.height):t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){let r=N(i);n&&!1===U(i)?t.renderbufferStorageMultisample(36161,r,35056,i.width,i.height):U(i)?u.renderbufferStorageMultisampleEXT(36161,r,35056,i.width,i.height):t.renderbufferStorage(36161,34041,i.width,i.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{let e=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let r=0;r<e.length;r++){let a=e[r],o=s.convert(a.format,a.encoding),l=s.convert(a.type),h=S(a.internalFormat,o,l,a.encoding),c=N(i);n&&!1===U(i)?t.renderbufferStorageMultisample(36161,c,h,i.width,i.height):U(i)?u.renderbufferStorageMultisampleEXT(36161,c,h,i.width,i.height):t.renderbufferStorage(36161,h,i.width,i.height)}}t.bindRenderbuffer(36161,null)}function F(e){let r=n.get(e),s=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!n.get(r.depthTexture).__webglTexture||r.depthTexture.image.width!==r.width||r.depthTexture.image.height!==r.height)&&(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),T(r.depthTexture,0);let s=n.get(r.depthTexture).__webglTexture,a=N(r);if(r.depthTexture.format===rt)U(r)?u.framebufferTexture2DMultisampleEXT(36160,36096,3553,s,0,a):t.framebufferTexture2D(36160,36096,3553,s,0);else{if(r.depthTexture.format!==st)throw new Error("Unknown depthTexture format");U(r)?u.framebufferTexture2DMultisampleEXT(36160,33306,3553,s,0,a):t.framebufferTexture2D(36160,33306,3553,s,0)}}(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),z(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),z(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function N(t){return Math.min(d,t.samples)}function U(t){let i=n.get(t);return l&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function k(t,i){let n=t.encoding,r=t.format;t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Tt||n!==wt&&(n===St&&(!1===l&&(!0===e.has("EXT_sRGB")&&r===nt?(t.format=Tt,t.minFilter=Q,t.generateMipmaps=!1):i=ce.sRGBToLinear(i)))),i}this.allocateTextureUnit=function(){let t=P;return P+=1,t},this.resetTextureUnits=function(){P=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){let r=n.get(t);t.version>0&&r.__version!==t.version?L(r,t,e):i.bindTexture(35866,r.__webglTexture,33984+e)},this.setTexture3D=function(t,e){let r=n.get(t);t.version>0&&r.__version!==t.version?L(r,t,e):i.bindTexture(32879,r.__webglTexture,33984+e)},this.setTextureCube=function(e,r){let a=n.get(e);e.version>0&&a.__version!==e.version?function(e,r,a){if(6!==r.image.length)return;let o=R(e,r),c=r.source;i.bindTexture(34067,e.__webglTexture,33984+a);let d=n.get(c);if(c.version!==d.__version||!0===o){i.activeTexture(33984+a),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);let e=r.isCompressedTexture||r.image[0].isCompressedTexture,n=r.image[0]&&r.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=e||n?n?r.image[t].image:r.image[t]:y(r.image[t],!1,!0,h),u[t]=k(r,u[t]);let p,f=u[0],m=x(f)||l,g=s.convert(r.format,r.encoding),v=s.convert(r.type),A=S(r.internalFormat,g,v,r.encoding),M=l&&!0!==r.isVideoTexture,C=void 0===d.__version||!0===o,E=_(r,f,m);if(O(34067,r,m),e){M&&C&&i.texStorage2D(34067,E,A,f.width,f.height);for(let t=0;t<6;t++){p=u[t].mipmaps;for(let e=0;e<p.length;e++){let n=p[e];r.format!==nt?null!==g&&(M?i.compressedTexSubImage2D(34069+t,e,0,0,n.width,n.height,g,n.data):i.compressedTexImage2D(34069+t,e,A,n.width,n.height,0,n.data)):M?i.texSubImage2D(34069+t,e,0,0,n.width,n.height,g,v,n.data):i.texImage2D(34069+t,e,A,n.width,n.height,0,g,v,n.data)}}}else{p=r.mipmaps,M&&C&&(p.length>0&&E++,i.texStorage2D(34067,E,A,u[0].width,u[0].height));for(let t=0;t<6;t++)if(n){M?i.texSubImage2D(34069+t,0,0,0,u[t].width,u[t].height,g,v,u[t].data):i.texImage2D(34069+t,0,A,u[t].width,u[t].height,0,g,v,u[t].data);for(let e=0;e<p.length;e++){let n=p[e].image[t].image;M?i.texSubImage2D(34069+t,e+1,0,0,n.width,n.height,g,v,n.data):i.texImage2D(34069+t,e+1,A,n.width,n.height,0,g,v,n.data)}}else{M?i.texSubImage2D(34069+t,0,0,0,g,v,u[t]):i.texImage2D(34069+t,0,A,g,v,u[t]);for(let e=0;e<p.length;e++){let n=p[e];M?i.texSubImage2D(34069+t,e+1,0,0,g,v,n.image[t]):i.texImage2D(34069+t,e+1,A,g,v,n.image[t])}}}b(r,m)&&w(34067),d.__version=c.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(a,e,r):i.bindTexture(34067,a.__webglTexture,33984+r)}
2,this.rebindTextures=function(t,e,i){let r=n.get(t);void 0!==e&&B(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==i&&F(t)},this.setupRenderTarget=function(e){let o=e.texture,h=n.get(e),c=n.get(o);e.addEventListener("dispose",C),!0!==e.isWebGLMultipleRenderTargets&&(void 0===c.__webglTexture&&(c.__webglTexture=t.createTexture()),c.__version=o.version,a.memory.textures++);let d=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultipleRenderTargets,p=x(e)||l;if(d){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else{if(h.__webglFramebuffer=t.createFramebuffer(),u&&r.drawBuffers){let i=e.texture;for(let e=0,r=i.length;e<r;e++){let r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),a.memory.textures++)}}if(l&&e.samples>0&&!1===U(e)){let n=u?o:[o];h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer);for(let i=0;i<n.length;i++){let r=n[i];h.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer[i]);let a=s.convert(r.format,r.encoding),o=s.convert(r.type),l=S(r.internalFormat,a,o,r.encoding,!0===e.isXRRenderTarget),c=N(e);t.renderbufferStorageMultisample(36161,c,l,e.width,e.height),t.framebufferRenderbuffer(36160,36064+i,36161,h.__webglColorRenderbuffer[i])}t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),z(h.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}}if(d){i.bindTexture(34067,c.__webglTexture),O(34067,o,p);for(let t=0;t<6;t++)B(h.__webglFramebuffer[t],e,o,36064,34069+t);b(o,p)&&w(34067),i.unbindTexture()}else if(u){let t=e.texture;for(let r=0,s=t.length;r<s;r++){let s=t[r],a=n.get(s);i.bindTexture(3553,a.__webglTexture),O(3553,s,p),B(h.__webglFramebuffer,e,s,36064+r,3553),b(s,p)&&w(3553)}i.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(l&&(t=e.isWebGL3DRenderTarget?32879:35866)),i.bindTexture(t,c.__webglTexture),O(t,o,p),B(h.__webglFramebuffer,e,o,36064,t),b(o,p)&&w(t),i.unbindTexture()}e.depthBuffer&&F(e)},this.updateRenderTargetMipmap=function(t){let e=x(t)||l,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let s=0,a=r.length;s<a;s++){let a=r[s];if(b(a,e)){let e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(a).__webglTexture;i.bindTexture(e,r),w(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(l&&e.samples>0&&!1===U(e)){let r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=e.width,a=e.height,o=16384,l=[],h=e.stencilBuffer?33306:36096,c=n.get(e),d=!0===e.isWebGLMultipleRenderTargets;if(d)for(let e=0;e<r.length;e++)i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,null),i.bindFramebuffer(36160,c.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,null,0);i.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,c.__webglFramebuffer);for(let i=0;i<r.length;i++){l.push(36064+i),e.depthBuffer&&l.push(h);let u=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;if(!1===u&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),d&&t.framebufferRenderbuffer(36008,36064,36161,c.__webglColorRenderbuffer[i]),!0===u&&(t.invalidateFramebuffer(36008,[h]),t.invalidateFramebuffer(36009,[h])),d){let e=n.get(r[i]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,e,0)}t.blitFramebuffer(0,0,s,a,0,0,s,a,o,9728),p&&t.invalidateFramebuffer(36008,l)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),d)for(let e=0;e<r.length;e++){i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,c.__webglColorRenderbuffer[e]);let s=n.get(r[e]).__webglTexture;i.bindFramebuffer(36160,c.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,s,0)}i.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=F,this.setupFrameBufferTexture=B,this.useMultisampledRTT=U}function ta(t,e,i){let n=i.isWebGL2;return{convert:function(i,r=null){let s;if(i===J)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(i===$)return 5125;if(i===tt)return 5126;if(i===et)return n?5131:(s=e.get("OES_texture_half_float"),null!==s?s.HALF_FLOAT_OES:null);if(1021===i)return 6406;if(i===nt)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(i===rt)return 6402;if(i===st)return 34041;if(i===Tt)return s=e.get("EXT_sRGB"),null!==s?s.SRGB_ALPHA_EXT:null;if(i===at)return 6403;if(1029===i)return 36244;if(i===ot)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(i===lt||i===ht||i===ct||i===dt)if(r===St){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===lt)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===ht)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ct)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===dt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===lt)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===ht)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ct)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===dt)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(35840===i)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return s=e.get("WEBGL_compressed_texture_etc1"),null!==s?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(37492===i)return r===St?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(37496===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.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(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(37808===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return r===St?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===ut){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(i===ut)return r===St?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===i||36284===i||36285===i||36286===i){if(s=e.get("EXT_texture_compression_rgtc"),null===s)return null;
2if(i===ut)return s.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===it?n?34042:(s=e.get("WEBGL_depth_texture"),null!==s?s.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}var ea=class extends xn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},ia=class extends wi{constructor(){super(),this.isGroup=!0,this.type="Group"}},na={type:"move"},ra=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ia,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 ia,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new be,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new be),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ia,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new be,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new be),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,s=null,a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(let s of t.hand.values()){let t=e.getJointPose(s,i),n=this._getHandJoint(l,s);null!==t&&(n.matrix.fromArray(t.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.jointRadius=t.radius),n.visible=null!==t}let n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=n.position.distanceTo(r.position),o=.02,h=.005;l.inputState.pinching&&a>o+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==r&&(n=r),null!==n&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(na)))}return null!==a&&(a.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){let i=new ia;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},sa=class extends fe{constructor(t,e,i,n,r,s,a,o,l,h){if((h=void 0!==h?h:rt)!==rt&&h!==st)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&h===rt&&(i=$),void 0===i&&h===st&&(i=it),super(null,n,r,s,a,o,h,i,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:q,this.minFilter=void 0!==o?o:q,this.flipY=!1,this.generateMipmaps=!1}},aa=class extends Dt{constructor(t,e){super();let i=this,n=null,r=1,s=null,a="local-floor",o=1,l=null,h=null,c=null,d=null,u=null,p=null,f=e.getContextAttributes(),m=null,g=null,v=[],y=[],x=new Set,b=new Map,w=new xn;w.layers.enable(1),w.viewport=new me;let S=new xn;S.layers.enable(2),S.viewport=new me;let _=[w,S],A=new ea;A.layers.enable(1),A.layers.enable(2);let M=null,C=null;function E(t){let e=y.indexOf(t.inputSource);if(-1===e)return;let i=v[e];void 0!==i&&i.dispatchEvent({type:t.type,data:t.inputSource})}function P(){n.removeEventListener("select",E),n.removeEventListener("selectstart",E),n.removeEventListener("selectend",E),n.removeEventListener("squeeze",E),n.removeEventListener("squeezestart",E),n.removeEventListener("squeezeend",E),n.removeEventListener("end",P),n.removeEventListener("inputsourceschange",T);for(let t=0;t<v.length;t++){let e=y[t];null!==e&&(y[t]=null,v[t].disconnect(e))}M=null,C=null,t.setRenderTarget(m),u=null,d=null,c=null,n=null,g=null,L.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function T(t){for(let e=0;e<t.removed.length;e++){let i=t.removed[e],n=y.indexOf(i);n>=0&&(y[n]=null,v[n].disconnect(i))}for(let e=0;e<t.added.length;e++){let i=t.added[e],n=y.indexOf(i);if(-1===n){for(let t=0;t<v.length;t++){if(t>=y.length){y.push(i),n=t;break}if(null===y[t]){y[t]=i,n=t;break}}if(-1===n)break}let r=v[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=v[t];return void 0===e&&(e=new ra,v[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=v[t];return void 0===e&&(e=new ra,v[t]=e),e.getGripSpace()},this.getHand=function(t){let e=v[t];return void 0===e&&(e=new ra,v[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,i.isPresenting},this.setReferenceSpaceType=function(t){a=t,i.isPresenting},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return c},this.getFrame=function(){return p}
2,this.getSession=function(){return n},this.setSession=async function(h){if(n=h,null!==n){if(m=t.getRenderTarget(),n.addEventListener("select",E),n.addEventListener("selectstart",E),n.addEventListener("selectend",E),n.addEventListener("squeeze",E),n.addEventListener("squeezestart",E),n.addEventListener("squeezeend",E),n.addEventListener("end",P),n.addEventListener("inputsourceschange",T),!0!==f.xrCompatible&&await e.makeXRCompatible(),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){let i={antialias:void 0!==n.renderState.layers||f.antialias,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),g=new ge(u.framebufferWidth,u.framebufferHeight,{format:nt,type:J,encoding:t.outputEncoding,stencilBuffer:f.stencil})}else{let i=null,s=null,a=null;f.depth&&(a=f.stencil?35056:33190,i=f.stencil?st:rt,s=f.stencil?it:$);let o={colorFormat:32856,depthFormat:a,scaleFactor:r};c=new XRWebGLBinding(n,e),d=c.createProjectionLayer(o),n.updateRenderState({layers:[d]}),g=new ge(d.textureWidth,d.textureHeight,{format:nt,type:J,depthTexture:new sa(d.textureWidth,d.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,encoding:t.outputEncoding,samples:f.antialias?4:0}),t.properties.get(g).__ignoreDepthValues=d.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await n.requestReferenceSpace(a),L.setContext(n),L.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};let D=new be,I=new be;function O(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;A.near=S.near=w.near=t.near,A.far=S.far=w.far=t.far,(M!==A.near||C!==A.far)&&(n.updateRenderState({depthNear:A.near,depthFar:A.far}),M=A.near,C=A.far);let e=t.parent,i=A.cameras;O(A,e);for(let n=0;n<i.length;n++)O(i[n],e);A.matrixWorld.decompose(A.position,A.quaternion,A.scale),t.matrix.copy(A.matrix),t.matrix.decompose(t.position,t.quaternion,t.scale);let r=t.children;for(let n=0,s=r.length;n<s;n++)r[n].updateMatrixWorld(!0);2===i.length?function(t,e,i){D.setFromMatrixPosition(e.matrixWorld),I.setFromMatrixPosition(i.matrixWorld);let n=D.distanceTo(I),r=e.projectionMatrix.elements,s=i.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],d=(s[8]+1)/s[0],u=a*c,p=a*d,f=n/(-c+d),m=f*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();let g=a+f,v=o+f,y=u-m,x=p+(n-m),b=l*o/v*g,w=h*o/v*g;t.projectionMatrix.makePerspective(y,x,b,w,g,v)}(A,w,S):A.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return A},this.getFoveation=function(){if(null!==d||null!==u)return o},this.setFoveation=function(t){o=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)},this.getPlanes=function(){return x};let R=null;let L=new In;L.setAnimationLoop(function(e,n){if(h=n.getViewerPose(l||s),p=n,null!==h){let e=h.views;null!==u&&(t.setRenderTargetFramebuffer(g,u.framebuffer),t.setRenderTarget(g));let i=!1;e.length!==A.cameras.length&&(A.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){let r=e[n],s=null;if(null!==u)s=u.getViewport(r);else{let e=c.getViewSubImage(d,r);s=e.viewport,0===n&&(t.setRenderTargetTextures(g,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(g))}let a=_[n];void 0===a&&(a=new xn,a.layers.enable(n),a.viewport=new me,_[n]=a),a.matrix.fromArray(r.transform.matrix),a.projectionMatrix.fromArray(r.projectionMatrix),a.viewport.set(s.x,s.y,s.width,s.height),0===n&&A.matrix.copy(a.matrix),!0===i&&A.cameras.push(a)}}for(let t=0;t<v.length;t++){let e=y[t],i=v[t];null!==e&&void 0!==i&&i.update(e,n,l||s)}if(R&&R(e,n),n.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:n.detectedPlanes});let t=null;for(let e of x)n.detectedPlanes.has(e)||(null===t&&(t=[]),t.push(e));if(null!==t)for(let e of t)x.delete(e),b.delete(e),i.dispatchEvent({type:"planeremoved",data:e});for(let e of n.detectedPlanes)if(x.has(e)){let t=b.get(e);e.lastChangedTime>t&&(b.set(e,e.lastChangedTime),i.dispatchEvent({type:"planechanged",data:e}))}else x.add(e),b.set(e,n.lastChangedTime),i.dispatchEvent({type:"planeadded",data:e})}p=null}),this.setAnimationLoop=function(t){R=t},this.dispose=function(){}}};function oa(t,e){function i(i,n){i.opacity.value=n.opacity,n.color&&i.diffuse.value.copy(n.
2color),n.emissive&&i.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(i.map.value=n.map),n.alphaMap&&(i.alphaMap.value=n.alphaMap),n.bumpMap&&(i.bumpMap.value=n.bumpMap,i.bumpScale.value=n.bumpScale,1===n.side&&(i.bumpScale.value*=-1)),n.displacementMap&&(i.displacementMap.value=n.displacementMap,i.displacementScale.value=n.displacementScale,i.displacementBias.value=n.displacementBias),n.emissiveMap&&(i.emissiveMap.value=n.emissiveMap),n.normalMap&&(i.normalMap.value=n.normalMap,i.normalScale.value.copy(n.normalScale),1===n.side&&i.normalScale.value.negate()),n.specularMap&&(i.specularMap.value=n.specularMap),n.alphaTest>0&&(i.alphaTest.value=n.alphaTest);let r,s,a=e.get(n).envMap;if(a&&(i.envMap.value=a,i.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,i.reflectivity.value=n.reflectivity,i.ior.value=n.ior,i.refractionRatio.value=n.refractionRatio),n.lightMap){i.lightMap.value=n.lightMap;let e=!0!==t.physicallyCorrectLights?Math.PI:1;i.lightMapIntensity.value=n.lightMapIntensity*e}n.aoMap&&(i.aoMap.value=n.aoMap,i.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.iridescenceMap?r=n.iridescenceMap:n.iridescenceThicknessMap?r=n.iridescenceThicknessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularColorMap?r=n.specularColorMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap?r=n.thicknessMap:n.sheenColorMap?r=n.sheenColorMap:n.sheenRoughnessMap&&(r=n.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),i.uvTransform.value.copy(r.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),i.uv2Transform.value.copy(s.matrix))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,mn(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,n,r,s,a){n.isMeshBasicMaterial||n.isMeshLambertMaterial?i(t,n):n.isMeshToonMaterial?(i(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,n)):n.isMeshPhongMaterial?(i(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,n)):n.isMeshStandardMaterial?(i(t,n),function(t,i){t.roughness.value=i.roughness,t.metalness.value=i.metalness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap),e.get(i).envMap&&(t.envMapIntensity.value=i.envMapIntensity)}(t,n),n.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap)),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate())),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap)),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}
2(t,n,a)):n.isMeshMatcapMaterial?(i(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,n)):n.isMeshDepthMaterial?i(t,n):n.isMeshDistanceMaterial?(i(t,n),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?i(t,n):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){let r;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?r=e.map:e.alphaMap&&(r=e.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,s):n.isSpriteMaterial?function(t,e){let i;t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map),e.alphaMap&&(t.alphaMap.value=e.alphaMap),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest),e.map?i=e.map:e.alphaMap&&(i=e.alphaMap),void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function la(t,e,i,n){let r={},s={},a=[],o=i.isWebGL2?t.getParameter(35375):0;function l(t,e,i){let n=t.value;if(void 0===i[e]){if("number"==typeof n)i[e]=n;else{let t=Array.isArray(n)?n:[n],r=[];for(let e=0;e<t.length;e++)r.push(t[e].clone());i[e]=r}return!0}if("number"==typeof n){if(i[e]!==n)return i[e]=n,!0}else{let t=Array.isArray(i[e])?i[e]:[i[e]],r=Array.isArray(n)?n:[n];for(let e=0;e<t.length;e++){let i=t[e];if(!1===i.equals(r[e]))return i.copy(r[e]),!0}}return!1}function h(t){let e={boundary:0,storage:0};return"number"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture,e}function c(e){let i=e.target;i.removeEventListener("dispose",c);let n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(r[i.id]),delete r[i.id],delete s[i.id]}return{bind:function(t,e){let i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=r[i.id];void 0===u&&(function(t){let e=t.uniforms,i=0,n=16,r=0;for(let s=0,a=e.length;s<a;s++){let t=e[s],a={boundary:0,storage:0},o=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=o.length;e<i;e++){let t=h(o[e]);a.boundary+=t.boundary,a.storage+=t.storage}if(t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,s>0){r=i%n,0!==r&&n-r-a.boundary<0&&(i+=n-r,t.__offset=i)}i+=a.storage}r=i%n,r>0&&(i+=n-r),t.__size=i,t.__cache={}}(i),u=function(e){let i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return 0}();e.__bindingPointIndex=i;let n=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(35345,n),t.bufferData(35345,r,s),t.bindBuffer(35345,null),t.bindBufferBase(35345,i,n),n}(i),r[i.id]=u,i.addEventListener("dispose",c));let p=d.program;n.updateUBOMapping(i,p);let f=e.render.frame;s[i.id]!==f&&(function(e){let i=r[e.id],n=e.uniforms,s=e.__cache;t.bindBuffer(35345,i);for(let r=0,a=n.length;r<a;r++){let e=n[r];if(!0===l(e,r,s)){let i=e.__offset,n=Array.isArray(e.value)?e.value:[e.value],r=0;for(let s=0;s<n.length;s++){let a=n[s],o=h(a);"number"==typeof a?(e.__data[0]=a,t.bufferSubData(35345,i+r,e.__data)):a.isMatrix3?(e.__data[0]=a.elements[0],e.__data[1]=a.elements[1],e.__data[2]=a.elements[2],e.__data[3]=a.elements[0],e.__data[4]=a.elements[3],e.__data[5]=a.elements[4],e.__data[6]=a.elements[5],e.__data[7]=a.elements[0],e.__data[8]=a.elements[6],e.__data[9]=a.elements[7],e.__data[10]=a.elements[8],e.__data[11]=a.elements[0]):(a.toArray(e.__data,r),r+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(35345,i,e.__data)}}t.bindBuffer(35345,null)}(i),s[i.id]=f)},dispose:function(){for(let e in r)t.deleteBuffer(r[e]);a=[],r={},s={}}}}function ha(t={}
2){this.isWebGLRenderer=!0;let e,i=void 0!==t.canvas?t.canvas:function(){let t=Kt("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,r=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;e=null!==n?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let d=null,u=null,p=[],f=[];this.domElement=i,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=wt,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;let m=this,g=!1,v=0,x=0,b=null,w=-1,S=null,_=new me,A=new me,M=null,C=i.width,E=i.height,P=1,T=null,D=null,I=new me(0,0,C,E),O=new me(0,0,C,E),R=!1,L=new Dn,B=!1,z=!1,F=null,N=new Ze,U=new Ht,k=new be,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===b?P:1}let G,W,H,q,X,Y,Q,Z,$,it,rt,st,at,ot,lt,ht,ct,dt,ut,pt,ft,mt,gt,vt,yt=n;function xt(t,e){for(let n=0;n<t.length;n++){let r=t[n],s=i.getContext(r,e);if(null!==s)return s}return null}try{let t={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:c};if("setAttribute"in i&&i.setAttribute("data-engine",`three.js r${y}`),i.addEventListener("webglcontextlost",_t,!1),i.addEventListener("webglcontextrestored",At,!1),i.addEventListener("webglcontextcreationerror",Mt,!1),null===yt){let e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),yt=xt(e,t),null===yt)throw xt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===yt.getShaderPrecisionFormat&&(yt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Ft){throw Ft}function bt(){G=new ar(yt),W=new Vn(yt,G,t),G.init(W),mt=new ta(yt,G,W),H=new Js(yt,G,W),q=new hr,X=new Ns,Y=new $s(yt,G,H,X,W,mt,q),Q=new Gn(m),Z=new sr(m),$=new On(yt,W),gt=new Un(yt,G,$,W),it=new or(yt,$,q,gt),rt=new pr(yt,it,$,q),ut=new ur(yt,W,Y),ht=new jn(X),st=new Fs(m,Q,Z,G,W,gt,ht),at=new oa(m,X),ot=new js,lt=new Ys(G,W),dt=new Nn(m,Q,Z,H,rt,e,o),ct=new Ks(m,rt,W),vt=new la(yt,q,W,H),pt=new kn(yt,G,q,W),ft=new lr(yt,G,q,W),q.programs=st.programs,m.capabilities=W,m.extensions=G,m.properties=X,m.renderLists=ot,m.shadowMap=ct,m.state=H,m.info=q}bt();let St=new aa(m,yt);function _t(t){t.preventDefault(),g=!0}function At(){g=!1;let t=q.autoReset,e=ct.enabled,i=ct.autoUpdate,n=ct.needsUpdate,r=ct.type;bt(),q.autoReset=t,ct.enabled=e,ct.autoUpdate=i,ct.needsUpdate=n,ct.type=r}function Mt(t){}function Ct(t){let e=t.target;e.removeEventListener("dispose",Ct),function(t){(function(t){let e=X.get(t).programs;void 0!==e&&(e.forEach(function(t){st.releaseProgram(t)}),t.isShaderMaterial&&st.releaseShaderCache(t))})(t),X.remove(t)}(e)}this.xr=St,this.getContext=function(){return yt},this.getContextAttributes=function(){return yt.getContextAttributes()},this.forceContextLoss=function(){let t=G.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){let t=G.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(C,E,!1))},this.getSize=function(t){return t.set(C,E)},this.setSize=function(t,e,n){St.isPresenting||(C=t,E=e,i.width=Math.floor(t*P),i.height=Math.floor(e*P),!1!==n&&(i.style.width=t+"px",i.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(C*P,E*P).floor()},this.setDrawingBufferSize=function(t,e,n){C=t,E=e,P=n,i.width=Math.floor(t*n),i.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(_)},this.getViewport=function(t){return t.copy(I)}
2,this.setViewport=function(t,e,i,n){t.isVector4?I.set(t.x,t.y,t.z,t.w):I.set(t,e,i,n),H.viewport(_.copy(I).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(O)},this.setScissor=function(t,e,i,n){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,i,n),H.scissor(A.copy(O).multiplyScalar(P).floor())},this.getScissorTest=function(){return R},this.setScissorTest=function(t){H.setScissorTest(R=t)},this.setOpaqueSort=function(t){T=t},this.setTransparentSort=function(t){D=t},this.getClearColor=function(t){return t.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor.apply(dt,arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha.apply(dt,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;t&&(n|=16384),e&&(n|=256),i&&(n|=1024),yt.clear(n)},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(){i.removeEventListener("webglcontextlost",_t,!1),i.removeEventListener("webglcontextrestored",At,!1),i.removeEventListener("webglcontextcreationerror",Mt,!1),ot.dispose(),lt.dispose(),X.dispose(),Q.dispose(),Z.dispose(),rt.dispose(),gt.dispose(),vt.dispose(),st.dispose(),St.dispose(),St.removeEventListener("sessionstart",Pt),St.removeEventListener("sessionend",Tt),F&&(F.dispose(),F=null),Dt.stop()},this.renderBufferDirect=function(t,e,i,n,r,s){null===e&&(e=V);let a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,i,n,r){!0!==e.isScene&&(e=V),Y.resetTextureUnits();let s=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===b?m.outputEncoding:!0===b.isXRRenderTarget?b.texture.encoding:wt,l=(n.isMeshStandardMaterial?Z:Q).get(n.envMap||a),h=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,c=!!n.normalMap&&!!i.attributes.tangent,d=!!i.morphAttributes.position,p=!!i.morphAttributes.normal,f=!!i.morphAttributes.color,g=n.toneMapped?m.toneMapping:0,v=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,y=void 0!==v?v.length:0,x=X.get(n),_=u.state.lights;if(!0===B&&(!0===z||t!==S)){let e=t===S&&n.id===w;ht.setState(n,t,e)}let A=!1;n.version===x.__version?(x.needsLights&&x.lightsStateVersion!==_.state.version||x.outputEncoding!==o||r.isInstancedMesh&&!1===x.instancing||!r.isInstancedMesh&&!0===x.instancing||r.isSkinnedMesh&&
2!1===x.skinning||!r.isSkinnedMesh&&!0===x.skinning||x.envMap!==l||!0===n.fog&&x.fog!==s||void 0!==x.numClippingPlanes&&(x.numClippingPlanes!==ht.numPlanes||x.numIntersection!==ht.numIntersection)||x.vertexAlphas!==h||x.vertexTangents!==c||x.morphTargets!==d||x.morphNormals!==p||x.morphColors!==f||x.toneMapping!==g||!0===W.isWebGL2&&x.morphTargetsCount!==y)&&(A=!0):(A=!0,x.__version=n.version);let M=x.currentProgram;!0===A&&(M=Bt(n,e,r));let C=!1,T=!1,D=!1,I=M.getUniforms(),O=x.uniforms;if(H.useProgram(M.program)&&(C=!0,T=!0,D=!0),n.id!==w&&(w=n.id,T=!0),C||S!==t){if(I.setValue(yt,"projectionMatrix",t.projectionMatrix),W.logarithmicDepthBuffer&&I.setValue(yt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,T=!0,D=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){let e=I.map.cameraPosition;void 0!==e&&e.setValue(yt,k.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&I.setValue(yt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||r.isSkinnedMesh)&&I.setValue(yt,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){I.setOptional(yt,r,"bindMatrix"),I.setOptional(yt,r,"bindMatrixInverse");let t=r.skeleton;t&&W.floatVertexTextures&&(null===t.boneTexture&&t.computeBoneTexture(),I.setValue(yt,"boneTexture",t.boneTexture,Y),I.setValue(yt,"boneTextureSize",t.boneTextureSize))}let R=i.morphAttributes;if((void 0!==R.position||void 0!==R.normal||void 0!==R.color&&!0===W.isWebGL2)&&ut.update(r,i,n,M),(T||x.receiveShadow!==r.receiveShadow)&&(x.receiveShadow=r.receiveShadow,I.setValue(yt,"receiveShadow",r.receiveShadow)),n.isMeshGouraudMaterial&&null!==n.envMap&&(O.envMap.value=l,O.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),T&&(I.setValue(yt,"toneMappingExposure",m.toneMappingExposure),x.needsLights&&function(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}(O,D),s&&!0===n.fog&&at.refreshFogUniforms(O,s),at.refreshMaterialUniforms(O,n,P,E,F),vs.upload(yt,x.uniformsList,O,Y)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(vs.upload(yt,x.uniformsList,O,Y),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&I.setValue(yt,"center",r.center),I.setValue(yt,"modelViewMatrix",r.modelViewMatrix),I.setValue(yt,"normalMatrix",r.normalMatrix),I.setValue(yt,"modelMatrix",r.matrixWorld),r.previousModelViewMatrix&&I.setValue(yt,"previousModelViewMatrix",r.previousModelViewMatrix),t.previousProjectionMatrix&&I.setValue(yt,"previousProjectionMatrix",t.previousProjectionMatrix),n.isShaderMaterial||n.isRawShaderMaterial){let t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(W.isWebGL2){let i=t[e];vt.update(i,M),vt.bind(i,M)}}return M}(t,e,i,n,r);H.setMaterial(n,a);let l=i.index,h=1;!0===n.wireframe&&(l=it.getWireframeAttribute(i),h=2);let c=i.drawRange,d=i.attributes.position,p=c.start*h,f=(c.start+c.count)*h;null!==s&&(p=Math.max(p,s.start*h),f=Math.min(f,(s.start+s.count)*h)),null!==l?(p=Math.max(p,0),f=Math.min(f,l.count)):null!=d&&(p=Math.max(p,0),f=Math.min(f,d.count));let g=f-p;if(g<0||g===1/0)return;gt.setup(r,n,o,i,l);let v,y=pt;if(null!==l&&(v=$.get(l),y=ft,y.setIndex(v)),r.isMesh)!0===n.wireframe?(H.setLineWidth(n.wireframeLinewidth*j()),y.setMode(1)):y.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),H.setLineWidth(t*j()),r.isLineSegments?y.setMode(1):r.isLineLoop?y.setMode(2):y.setMode(3)}else r.isPoints?y.setMode(0):r.isSprite&&y.setMode(4);if(r.isInstancedMesh)y.renderInstances(p,g,r.count);else if(i.isInstancedBufferGeometry){let t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);y.renderInstances(p,g,e)}else y.render(p,g)},this.compile=function(t,e){function i(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Bt(t,e,i),t.side=0,t.needsUpdate=!0,Bt(t,e,i),t.side=2):Bt(t,e,i)}
2u=lt.get(t),u.init(),f.push(u),t.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(u.pushLight(t),t.castShadow&&u.pushShadow(t))}),u.setupLights(m.physicallyCorrectLights),t.traverse(function(e){let n=e.material;if(n)if(Array.isArray(n))for(let r=0;r<n.length;r++){i(n[r],t,e)}else i(n,t,e)}),f.pop(),u=null};let Et=null;function Pt(){Dt.stop()}function Tt(){Dt.start()}let Dt=new In;function It(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)u.pushLight(t),t.castShadow&&u.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||L.intersectsSprite(t)){n&&k.setFromMatrixPosition(t.matrixWorld).applyMatrix4(N);let e=rt.update(t),r=t.material;r.visible&&d.push(t,e,r,i,k.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==q.render.frame&&(t.skeleton.update(),t.skeleton.frame=q.render.frame),!t.frustumCulled||L.intersectsObject(t))){n&&k.setFromMatrixPosition(t.matrixWorld).applyMatrix4(N);let e=rt.update(t),r=t.material;if(Array.isArray(r)){let n=e.groups;for(let s=0,a=n.length;s<a;s++){let a=n[s],o=r[a.materialIndex];o&&o.visible&&d.push(t,e,o,i,k.z,a)}}else r.visible&&d.push(t,e,r,i,k.z,null)}let r=t.children;for(let s=0,a=r.length;s<a;s++)It(r[s],e,i,n)}function Ot(t,e,i,n){let r=t.opaque,s=t.transmissive,o=t.transparent;u.setupLightsView(i),!0===B&&ht.setGlobalState(m.clippingPlanes,i),s.length>0&&function(t,e,i){let n=W.isWebGL2;null===F&&(F=new ge(1,1,{generateMipmaps:!0,type:G.has("EXT_color_buffer_half_float")?et:J,minFilter:K,samples:n&&!0===a?4:0})),m.getDrawingBufferSize(U),n?F.setSize(U.x,U.y):F.setSize(Vt(U.x),Vt(U.y));let r=m.getRenderTarget();m.setRenderTarget(F),m.clear();let s=m.toneMapping;m.toneMapping=0,Rt(t,e,i),m.toneMapping=s,Y.updateMultisampleRenderTarget(F),Y.updateRenderTargetMipmap(F),m.setRenderTarget(r)}(r,e,i),n&&H.viewport(_.copy(n)),r.length>0&&Rt(r,e,i),s.length>0&&Rt(s,e,i),o.length>0&&Rt(o,e,i),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function Rt(t,e,i){let n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){let s=t[r],a=s.object,o=s.geometry,l=null===n?s.material:n,h=s.group;a.layers.test(i.layers)&&Lt(a,e,i,o,l,h)}}function Lt(t,e,i,n,r,s){t.onBeforeRender(m,e,i,n,r,s),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(m,e,i,n,t,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,m.renderBufferDirect(i,e,n,r,t,s),r.side=0,r.needsUpdate=!0,m.renderBufferDirect(i,e,n,r,t,s),r.side=2):m.renderBufferDirect(i,e,n,r,t,s),t.onAfterRender(m,e,i,n,r,s)}function Bt(t,e,i){!0!==e.isScene&&(e=V);let n=X.get(t),r=u.state.lights,s=u.state.shadowsArray,a=r.state.version,o=st.getParameters(t,r.state,s,e,i),l=st.getProgramCacheKey(o),h=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?Z:Q).get(t.envMap||n.environment),void 0===h&&(t.addEventListener("dispose",Ct),h=new Map,n.programs=h);let c=h.get(l);if(void 0!==c){if(n.currentProgram===c&&n.lightsStateVersion===a)return zt(t,o),c}else o.uniforms=st.getUniforms(t),t.onBuild(i,o,m),t.onBeforeCompile(o,m),c=st.acquireProgram(o,l),h.set(l,c),n.uniforms=o.uniforms;let d=n.uniforms;(!t.isShaderMaterial&&!t.isRawShaderMaterial||!0===t.clipping)&&(d.clippingPlanes=ht.uniform),zt(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix);let p=c.getUniforms(),f=vs.seqWithValue(p.seq,d);return n.currentProgram=c,n.uniformsList=f,c}function zt(t,e){let i=X.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Dt.setAnimationLoop(function(t){Et&&Et(t)}),typeof self<"u"&&Dt.setContext(self),this.setAnimationLoop=function(t){Et=t,St.setAnimationLoop(t),null===t?Dt.stop():Dt.start()},St.addEventListener("sessionstart",Pt),St.addEventListener("sessionend",Tt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return;if(!0===g)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===St.enabled&&!0===St.isPresenting&&(!0===St.cameraAutoUpdate&&St.updateCamera(e),e=St.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,b),u=lt.get(t,f.length),u.init(
2),f.push(u),N.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),L.setFromProjectionMatrix(N),z=this.localClippingEnabled,B=ht.init(this.clippingPlanes,z),d=ot.get(t,p.length),d.init(),p.push(d),It(t,e,0,m.sortObjects),d.finish(),!0===m.sortObjects&&d.sort(T,D),!0===B&&ht.beginShadows();let i=u.state.shadowsArray;if(ct.render(i,t,e),!0===B&&ht.endShadows(),!0===this.info.autoReset&&this.info.reset(),dt.render(d,t),u.setupLights(m.physicallyCorrectLights),e.isArrayCamera){let i=e.cameras;for(let e=0,n=i.length;e<n;e++){let n=i[e];Ot(d,t,n,n.viewport)}}else Ot(d,t,e);null!==b&&(Y.updateMultisampleRenderTarget(b),Y.updateRenderTargetMipmap(b)),!0===t.isScene&&t.onAfterRender(m,t,e),gt.resetDefaultState(),w=-1,S=null,f.pop(),u=f.length>0?f[f.length-1]:null,p.pop(),d=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return x},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(t,e,i){X.get(t.texture).__webglTexture=e,X.get(t.depthTexture).__webglTexture=i;let n=X.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===G.has("WEBGL_multisampled_render_to_texture")&&(n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){let i=X.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){b=t,v=e,x=i;let n=!0,r=null,s=!1,a=!1;if(t){let i=X.get(t);void 0!==i.__useDefaultFramebuffer?(H.bindFramebuffer(36160,null),n=!1):void 0===i.__webglFramebuffer?Y.setupRenderTarget(t):i.__hasExternalTextures&&Y.rebindTextures(t,X.get(t.texture).__webglTexture,X.get(t.depthTexture).__webglTexture);let o=t.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(a=!0);let l=X.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=l[e],s=!0):r=W.isWebGL2&&t.samples>0&&!1===Y.useMultisampledRTT(t)?X.get(t).__webglMultisampledFramebuffer:l,_.copy(t.viewport),A.copy(t.scissor),M=t.scissorTest}else _.copy(I).multiplyScalar(P).floor(),A.copy(O).multiplyScalar(P).floor(),M=R;if(H.bindFramebuffer(36160,r)&&W.drawBuffers&&n&&H.drawBuffers(t,r),H.viewport(_),H.scissor(A),H.setScissorTest(M),s){let n=X.get(t.texture);yt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(a){let n=X.get(t.texture),r=e||0;yt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}w=-1},this.readRenderTargetPixels=function(t,e,i,n,r,s,a){if(!t||!t.isWebGLRenderTarget)return;let o=X.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){H.bindFramebuffer(36160,o);try{let a=t.texture,o=a.format,l=a.type;if(o!==nt&&mt.convert(o)!==yt.getParameter(35739))return;let h=l===et&&(G.has("EXT_color_buffer_half_float")||W.isWebGL2&&G.has("EXT_color_buffer_float"));if(!(l===J||mt.convert(l)===yt.getParameter(35738)||l===tt&&(W.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float"))||h))return;e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&yt.readPixels(e,i,n,r,mt.convert(o),mt.convert(l),s)}finally{let t=null!==b?X.get(b).__webglFramebuffer:null;H.bindFramebuffer(36160,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,i,n,r,s,a){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=X.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){let a=t.texture,l=a.format,h=a.type;if(e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r){H.bindFramebuffer(yt.FRAMEBUFFER,o);let t=yt.createBuffer();yt.bindBuffer(yt.PIXEL_PACK_BUFFER,t),yt.bufferData(yt.PIXEL_PACK_BUFFER,s.byteLength,yt.STREAM_READ),yt.readPixels(e,i,n,r,mt.convert(l),mt.convert(h),0);let a=null!==b?X.get(b).__webglFramebuffer:null;H.bindFramebuffer(yt.FRAMEBUFFER,a);let c=yt.fenceSync(yt.SYNC_GPU_COMMANDS_COMPLETE,0);return yt.flush(),await function(t,e,i){return new Promise(function(n,r){setTimeout(function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,i);break;default:n()}},i)})}(yt,c,4),yt.bindBuffer(yt.PIXEL_PACK_BUFFER,t),yt.getBufferSubData(yt.PIXEL_PACK_BUFFER,0,s),yt.deleteBuffer(t),yt.deleteSync(c),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}}
2,this.copyFramebufferToTexture=function(t,e,i=0){let n=Math.pow(2,-i),r=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n);Y.setTexture2D(e,0),yt.copyTexSubImage2D(3553,i,0,0,t.x,t.y,r,s),H.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){let r=e.image.width,s=e.image.height,a=mt.convert(i.format),o=mt.convert(i.type);Y.setTexture2D(i,0),yt.pixelStorei(37440,i.flipY),yt.pixelStorei(37441,i.premultiplyAlpha),yt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?yt.texSubImage2D(3553,n,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?yt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):yt.texSubImage2D(3553,n,t.x,t.y,a,o,e.image),0===n&&i.generateMipmaps&&yt.generateMipmap(3553),H.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(m.isWebGL1Renderer)return;let s,a=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,l=t.max.z-t.min.z+1,h=mt.convert(n.format),c=mt.convert(n.type);if(n.isData3DTexture)Y.setTexture3D(n,0),s=32879;else{if(!n.isDataArrayTexture)return;Y.setTexture2DArray(n,0),s=35866}yt.pixelStorei(37440,n.flipY),yt.pixelStorei(37441,n.premultiplyAlpha),yt.pixelStorei(3317,n.unpackAlignment);let d=yt.getParameter(3314),u=yt.getParameter(32878),p=yt.getParameter(3316),f=yt.getParameter(3315),g=yt.getParameter(32877),v=i.isCompressedTexture?i.mipmaps[0]:i.image;yt.pixelStorei(3314,v.width),yt.pixelStorei(32878,v.height),yt.pixelStorei(3316,t.min.x),yt.pixelStorei(3315,t.min.y),yt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isData3DTexture?yt.texSubImage3D(s,r,e.x,e.y,e.z,a,o,l,h,c,v.data):i.isCompressedArrayTexture?yt.compressedTexSubImage3D(s,r,e.x,e.y,e.z,a,o,l,h,v.data):yt.texSubImage3D(s,r,e.x,e.y,e.z,a,o,l,h,c,v),yt.pixelStorei(3314,d),yt.pixelStorei(32878,u),yt.pixelStorei(3316,p),yt.pixelStorei(3315,f),yt.pixelStorei(32877,g),0===r&&n.generateMipmaps&&yt.generateMipmap(s),H.unbindTexture()},this.initRenderTarget=function(t){void 0===X.get(t).__webglFramebuffer&&Y.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?Y.setTextureCube(t,0):t.isData3DTexture?Y.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?Y.setTexture2DArray(t,0):Y.setTexture2D(t,0),H.unbindTexture()},this.resetState=function(){v=0,x=0,b=null,H.reset(),gt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends ha{}).prototype.isWebGL1Renderer=!0;var ca=class{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new le(t),this.near=e,this.far=i}clone(){return new ca(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},da=class extends wi{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,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e}get autoUpdate(){return this.matrixWorldAutoUpdate}set autoUpdate(t){this.matrixWorldAutoUpdate=t}},ua=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Et,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bt()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Bt()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Bt()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.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}}},pa=new be,fa=class{constructor(t,e,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)pa.fromBufferAttribute(this,e),pa.applyMatrix4(t),this.setXYZ(e,pa.x,pa.y,pa.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)pa.fromBufferAttribute(this,e),pa.applyNormalMatrix(t),this.setXYZ(e,pa.x,pa.y,pa.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)pa.fromBufferAttribute(this,e),pa.transformDirection(t),this.setXYZ(e,pa.x,pa.y,pa.z);return this}setX(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Gt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=jt(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=jt(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=jt(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=jt(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Gt(e,this.array),i=Gt(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}
vendor: 10,846 bytes, line 2
2setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Gt(e,this.array),i=Gt(i,this.array),n=Gt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Gt(e,this.array),i=Gt(i,this.array),n=Gt(n,this.array),r=Gt(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){let t=[];for(let e=0;e<this.count;e++){let i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new Ni(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new fa(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){let t=[];for(let e=0;e<this.count;e++){let i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},ma=class extends wi{constructor(){super(),this.isBone=!0,this.type="Bone"}},ga=class extends fe{constructor(t=null,e=1,i=1,n,r,s,a,o,l=q,h=q,c,d){super(null,s,a,o,l,h,n,r,c,d),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},va=new Ze,ya=new Ze,xa=class{constructor(t=[],e=[]){this.uuid=Bt(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Ze)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){let e=new Ze;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){let e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){let e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){let t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let r=0,s=t.length;r<s;r++){let n=t[r]?t[r].matrixWorld:ya;va.multiplyMatrices(n,e[r]),va.toArray(i,16*r)}null!==n&&(n.needsUpdate=!0)}clone(){return new xa(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=kt(t),t=Math.max(t,4);let e=new Float32Array(t*t*4);e.set(this.boneMatrices);let i=new ga(e,t,t,nt,tt);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){let i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){let n=e[t.bones[i]];void 0===n&&(n=new ma),this.bones.push(n),this.boneInverses.push((new Ze).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){let t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;let e=this.bones,i=this.boneInverses;for(let n=0,r=e.length;n<r;n++){let r=e[n];t.bones.push(r.uuid);let s=i[n];t.boneInverses.push(s.toArray())}return t}},ba=class extends Ni{constructor(t,e,i,n=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){let t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}},wa=new Ze,Sa=new Ze,_a=[],Aa=new Ze,Ma=new cn,Ca=class extends cn{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new ba(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1;for(let n=0;n<i;n++)this.setMatrixAt(n,Aa)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){let i=this.matrixWorld,n=this.count;if(Ma.geometry=this.geometry,Ma.material=this.material,void 0!==Ma.material)for(let r=0;r<n;r++){this.getMatrixAt(r,wa),Sa.multiplyMatrices(i,wa),Ma.matrixWorld=Sa,Ma.raycast(t,_a);for(let t=0,i=_a.length;t<i;t++){let i=_a[t];i.instanceId=r,i.object=this,e.push(i)}_a.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new ba(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}},Ea=class extends Li{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new le(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}},Pa=new be,Ta=new be,Da=new Ze,Ia=new Qe,Oa=new Ve,Ra=class extends wi{constructor(t=new Qi,e=new Ea){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Pa.fromBufferAttribute(e,t-1),Ta.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Pa.distanceTo(Ta);t.setAttribute("lineDistance",new Vi(i,1))}return this}raycast(t,e){let i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,s=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Oa.copy(i.boundingSphere),Oa.applyMatrix4(n),Oa.radius+=r,!1===t.ray.intersectsSphere(Oa))return;Da.copy(n).invert(),Ia.copy(t.ray).applyMatrix4(Da);let a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=new be,h=new be,c=new be,d=new be,u=this.isLineSegments?2:1,p=i.index,f=i.attributes.position;if(null!==p){for(let i=Math.max(0,s.start),n=Math.min(p.count,s.start+s.count)-1;i<n;i+=u){let n=p.getX(i),r=p.getX(i+1);if(l.fromBufferAttribute(f,n),h.fromBufferAttribute(f,r),Ia.distanceSqToSegment(l,h,d,c)>o)continue;d.applyMatrix4(this.matrixWorld);let s=t.ray.origin.distanceTo(d);s<t.near||s>t.far||e.push({distance:s,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,s.start),n=Math.min(f.count,s.start+s.count)-1;i<n;i+=u){if(l.fromBufferAttribute(f,i),h.fromBufferAttribute(f,i+1),Ia.distanceSqToSegment(l,h,d,c)>o)continue;d.applyMatrix4(this.matrixWorld);let n=t.ray.origin.distanceTo(d);n<t.near||n>t.far||e.push({distance:n,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){let i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){let e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}},La=new be,Ba=new be,za=class extends Ra{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let t=this.geometry;if(null===t.index){let e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)La.fromBufferAttribute(e,t),Ba.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+La.distanceTo(Ba);t.setAttribute("lineDistance",new Vi(i,1))}return this}},Fa=class extends fe{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:Q,this.magFilter=void 0!==r?r:Q,this.generateMipmaps=!1;let h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){let t=this.image;"requestVideoFrameCallback"in t==!1&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},Na=class extends fe{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},Ua=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return null}getPointAt(t,e){let i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){let e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){let t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let e,i=[],n=this.getPoint(0),r=0;i.push(0);for(let s=1;s<=t;s++)e=this.getPoint(s/t),r+=e.distanceTo(n),i.push(r),n=e;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){let i,n=this.getLengths(),r=0,s=n.length;i=e||t*n[s-1];let a,o=0,l=s-1;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),a=n[r]-i,a<0)o=r+1;else{if(!(a>0)){l=r;break}l=r-1}if(r=l,n[r]===i)return r/(s-1);let h=n[r];return(r+(i-h)/(n[r+1]-h))/(s-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),s=this.getPoint(n),a=e||(r.isVector2?new Ht:new be);return a.copy(s).sub(r).normalize(),a}getTangentAt(t,e){let i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){let i=new be,n=[],r=[],s=[],a=new be,o=new Ze;for(let u=0;u<=t;u++){let e=u/t;n[u]=this.getTangentAt(e,new be)}r[0]=new be,s[0]=new be;let l=Number.MAX_VALUE,h=Math.abs(n[0].x),c=Math.abs(n[0].y),d=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],a),s[0].crossVectors(n[0],r[0]);for(let u=1;u<=t;u++){if(r[u]=r[u-1].clone(),s[u]=s[u-1].clone(),a.crossVectors(n[u-1],n[u]),a.length()>Number.EPSILON){a.normalize();
vendor: 14,401 bytes, line 2
2let t=Math.acos(zt(n[u-1].dot(n[u]),-1,1));r[u].applyMatrix4(o.makeRotationAxis(a,t))}s[u].crossVectors(n[u],r[u])}if(!0===e){let e=Math.acos(zt(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),s[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){let t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},ka=class extends Ua{constructor(t=0,e=0,i=1,n=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){let i=e||new Ht,n=2*Math.PI,r=this.aEndAngle-this.aStartAngle,s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=s?0:n),!0===this.aClockwise&&!s&&(r===n?r=-n:r-=n);let a=this.aStartAngle+t*r,o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=l-this.aY;o=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){let t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}};function Va(){let t=0,e=0,i=0,n=0;function r(r,s,a,o){t=r,e=a,i=-3*r+3*s-2*a-o,n=2*r-2*s+a+o}return{initCatmullRom:function(t,e,i,n,s){r(e,i,s*(i-t),s*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,s,a,o){let l=(e-t)/s-(i-t)/(s+a)+(i-e)/a,h=(i-e)/a-(n-e)/(a+o)+(n-i)/o;l*=a,h*=a,r(e,i,l,h)},calc:function(r){let s=r*r;return t+e*r+i*s+n*(s*r)}}}var ja=new be,Ga=new Va,Wa=new Va,Ha=new Va;function qa(t,e,i,n,r){let s=.5*(n-e),a=.5*(r-i),o=t*t;return(2*i-2*n+s+a)*(t*o)+(-3*i+3*n-2*s-a)*o+s*t+i}function Xa(t,e,i,n){return function(t,e){let i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Ya(t,e,i,n,r){return function(t,e){let i=1-t;return i*i*i*e}(t,e)+function(t,e){let i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}var Qa=class extends Ua{constructor(t=new Ht,e=new Ht,i=new Ht,n=new Ht){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Ht){let i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(Ya(t,n.x,r.x,s.x,a.x),Ya(t,n.y,r.y,s.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Za=class extends Ua{constructor(t=new be,e=new be,i=new be,n=new be){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new be){let i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(Ya(t,n.x,r.x,s.x,a.x),Ya(t,n.y,r.y,s.y,a.y),Ya(t,n.z,r.z,s.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},Ka=class extends Ua{constructor(t=new Ht,e=new Ht){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Ht){let i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){let i=e||new Ht;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},Ja=class extends Ua{constructor(t=new be,e=new be){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new be){let i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},$a=class extends Ua{constructor(t=new Ht,e=new Ht,i=new Ht){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ht){let i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(Xa(t,n.x,r.x,s.x),Xa(t,n.y,r.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},to=class extends Ua{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Ht){let i=e,n=this.points,r=(n.length-1)*t,s=Math.floor(r),a=r-s,o=n[0===s?s:s-1],l=n[s],h=n[s>n.length-2?n.length-1:s+1],c=n[s>n.length-3?n.length-1:s+2];return i.set(qa(a,o.x,l.x,h.x,c.x),qa(a,o.y,l.y,h.y,c.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push(i.clone())}return this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push((new Ht).fromArray(i))}return this}},eo=Object.freeze({__proto__:null,ArcCurve:class extends ka{constructor(t,e,i,n,r,s){super(t,e,i,i,n,r,s),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends Ua{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new be){let i,n,r=e,s=this.points,a=s.length,o=(a-(this.closed?0:1))*t,l=Math.floor(o),h=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/a)+1)*a:0===h&&l===a-1&&(l=a-2,h=1),this.closed||l>0?i=s[(l-1)%a]:(ja.subVectors(s[0],s[1]).add(s[0]),i=ja);let c=s[l%a],d=s[(l+1)%a];if(this.closed||l+2<a?n=s[(l+2)%a]:(ja.subVectors(s[a-1],s[a-2]).add(s[a-1]),n=ja),"centripetal"===this.curveType||"chordal"===this.curveType){let t="chordal"===this.curveType?.5:.25,e=Math.pow(i.distanceToSquared(c),t),r=Math.pow(c.distanceToSquared(d),t),s=Math.pow(d.distanceToSquared(n),t);r<1e-4&&(r=1),e<1e-4&&(e=r),s<1e-4&&(s=r),Ga.initNonuniformCatmullRom(i.x,c.x,d.x,n.x,e,r,s),Wa.initNonuniformCatmullRom(i.y,c.y,d.y,n.y,e,r,s),Ha.initNonuniformCatmullRom(i.z,c.z,d.z,n.z,e,r,s)}else"catmullrom"===this.curveType&&(Ga.initCatmullRom(i.x,c.x,d.x,n.x,this.tension),Wa.initCatmullRom(i.y,c.y,d.y,n.y,this.tension),Ha.initCatmullRom(i.z,c.z,d.z,n.z,this.tension));return r.set(Ga.calc(h),Wa.calc(h),Ha.calc(h)),r}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){let t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){let i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){let i=t.points[e];this.points.push((new be).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:Qa,CubicBezierCurve3:Za,EllipseCurve:ka,LineCurve:Ka,LineCurve3:Ja,QuadraticBezierCurve:$a,QuadraticBezierCurve3:class extends Ua{constructor(t=new be,e=new be,i=new be){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new be){let i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(Xa(t,n.x,r.x,s.x),Xa(t,n.y,r.y,s.y),Xa(t,n.z,r.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){let t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:to}),io=class extends Ua{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){let t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ka(e,t))}getPoint(t,e){let i=t*this.getLength(),n=this.getCurveLengths(),r=0;for(;r<n.length;){if(n[r]>=i){let t=n[r]-i,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){let t=this.getCurveLengths();return t[t.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 t=[],e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){let e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){let e,i=[];for(let n=0,r=this.curves;n<r.length;n++){let s=r[n],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let t=0;t<o.length;t++){let n=o[t];e&&e.equals(n)||(i.push(n),e=n)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){let t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){let i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){let i=t.curves[e];this.curves.push((new eo[i.type]).fromJSON(i))}return this}},no=class extends io{constructor(t){super(),this.type="Path",this.currentPoint=new Ht,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){let i=new Ka(this.currentPoint.clone(),new Ht(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){let r=new $a(this.currentPoint.clone(),new Ht(t,e),new Ht(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,s){let a=new Qa(this.currentPoint.clone(),new Ht(t,e),new Ht(i,n),new Ht(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){let e=[this.currentPoint.clone()].concat(t),i=new to(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,s){let a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,r,s),this}absarc(t,e,i,n,r,s){return this.absellipse(t,e,i,i,n,r,s),this}ellipse(t,e,i,n,r,s,a,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+l,e+h,i,n,r,s,a,o),this}absellipse(t,e,i,n,r,s,a,o){let l=new ka(t,e,i,n,r,s,a,o);if(this.curves.length>0){let t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){let t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}},ro=class extends Qi{constructor(t=[new Ht(0,-.5),new Ht(.5,0),new Ht(0,.5)],e=12,i=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e),n=zt(n,0,2*Math.PI);let r=[],s=[],a=[],o=[],l=[],h=1/e,c=new be,d=new Ht,u=new be,p=new be,f=new be,m=0,g=0;for(let v=0;v<=t.length-1;v++)switch(v){case 0:m=t[v+1].x-t[v].x,g=t[v+1].y-t[v].y,u.x=1*g,u.y=-m,u.z=0*g,f.copy(u),u.normalize(),o.push(u.x,u.y,u.z);break;case t.length-1:o.push(f.x,f.y,f.z);break;default:m=t[v+1].x-t[v].x,g=t[v+1].y-t[v].y,u.x=1*g,u.y=-m,u.z=0*g,p.copy(u),u.x+=f.x,u.y+=f.y,u.z+=f.z,u.normalize(),o.push(u.x,u.y,u.z),f.copy(p)}for(let v=0;v<=e;v++){let r=i+v*h*n,u=Math.sin(r),p=Math.cos(r);for(let i=0;i<=t.length-1;i++){c.x=t[i].x*u,c.y=t[i].y,c.z=t[i].x*p,s.push(c.x,c.y,c.z),d.x=v/e,d.y=i/(t.length-1),a.push(d.x,d.y);let n=o[3*i+0]*u,r=o[3*i+1],h=o[3*i+0]*p;l.push(n,r,h)}}for(let v=0;v<e;v++)for(let e=0;e<t.length-1;e++){let i=e+v*t.length,n=i,s=i+t.length,a=i+t.length+1,o=i+1;r.push(n,s,o),r.push(a,o,s)}this.setIndex(r),this.setAttribute("position",new Vi(s,3)),this.setAttribute("uv",new Vi(a,2)),this.setAttribute("normal",new Vi(l,3))}static fromJSON(t){return new ro(t.points,t.segments,t.phiStart,t.phiLength)}},so=class extends Qi{constructor(t=1,e=1,i=1,n=32,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiu
vendor: 1,484 bytes, line 2
2sTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};let l=this;n=Math.floor(n),r=Math.floor(r);let h=[],c=[],d=[],u=[],p=0,f=[],m=i/2,g=0;function v(i){let r=p,s=new Ht,f=new be,v=0,y=!0===i?t:e,x=!0===i?1:-1;for(let t=1;t<=n;t++)c.push(0,m*x,0),d.push(0,x,0),u.push(.5,.5),p++;let b=p;for(let t=0;t<=n;t++){let e=t/n*o+a,i=Math.cos(e),r=Math.sin(e);f.x=y*r,f.y=m*x,f.z=y*i,c.push(f.x,f.y,f.z),d.push(0,x,0),s.x=.5*i+.5,s.y=.5*r*x+.5,u.push(s.x,s.y),p++}for(let t=0;t<n;t++){let e=r+t,n=b+t;!0===i?h.push(n,n+1,e):h.push(n+1,n,e),v+=3}l.addGroup(g,v,!0===i?1:2),g+=v}(function(){let s=new be,v=new be,y=0,x=(e-t)/i;for(let l=0;l<=r;l++){let h=[],g=l/r,y=g*(e-t)+t;for(let t=0;t<=n;t++){let e=t/n,r=e*o+a,l=Math.sin(r),f=Math.cos(r);v.x=y*l,v.y=-g*i+m,v.z=y*f,c.push(v.x,v.y,v.z),s.set(l,x,f).normalize(),d.push(s.x,s.y,s.z),u.push(e,1-g),h.push(p++)}f.push(h)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){let i=f[e][t],n=f[e+1][t],r=f[e+1][t+1],s=f[e][t+1];h.push(i,n,s),h.push(n,r,s),y+=6}l.addGroup(g,y,0),g+=y})(),!1===s&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(h),this.setAttribute("position",new Vi(c,3)),this.setAttribute("normal",new Vi(d,3)),this.setAttribute("uv",new Vi(u,2))}static fromJSON(t){return new so(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},ao=class extends so{constructor(t=1,e=1,i=32,n=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,i,n,r,s,a),this.type="C
2oneGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new ao(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},oo=class extends Qi{constructor(t=[],e=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n};let r=[],s=[];function a(t,e,i,n){let r=n+1,s=[];for(let a=0;a<=r;a++){s[a]=[];let n=t.clone().lerp(i,a/r),o=e.clone().lerp(i,a/r),l=r-a;for(let t=0;t<=l;t++)s[a][t]=0===t&&a===r?n:n.clone().lerp(o,t/l)}for(let a=0;a<r;a++)for(let t=0;t<2*(r-a)-1;t++){let e=Math.floor(t/2);t%2==0?(o(s[a][e+1]),o(s[a+1][e]),o(s[a][e])):(o(s[a][e+1]),o(s[a+1][e+1]),o(s[a+1][e]))}}function o(t){r.push(t.x,t.y,t.z)}function l(e,i){let n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function h(t,e,i,n){n<0&&1===t.x&&(s[e]=t.x-1),0===i.x&&0===i.z&&(s[e]=n/2/Math.PI+.5)}function c(t){return Math.atan2(t.z,-t.x)}function d(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}(function(t){let i=new be,n=new be,r=new be;for(let s=0;s<e.length;s+=3)l(e[s+0],i),l(e[s+1],n),l(e[s+2],r),a(i,n,r,t)})(n),function(t){let e=new be;for(let i=0;i<r.length;i+=3)e.x=r[i+0],e.y=r[i+1],e.z=r[i+2],e.normalize().multiplyScalar(t),r[i+0]=e.x,r[i+1]=e.y,r[i+2]=e.z}(i),function(){let t=new be;for(let e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];let i=c(t)/2/Math.PI+.5,n=d(t)/Math.PI+.5;s.push(i,1-n)}(function(){let t=new be,e=new be,i=new be,n=new be,a=new Ht,o=new Ht,l=new Ht;for(let d=0,u=0;d<r.length;d+=9,u+=6){t.set(r[d+0],r[d+1],r[d+2]),e.set(r[d+3],r[d+4],r[d+5]),i.set(r[d+6],r[d+7],r[d+8]),a.set(s[u+0],s[u+1]),o.set(s[u+2],s[u+3]),l.set(s[u+4],s[u+5]),n.copy(t).add(e).add(i).divideScalar(3);let p=c(n);h(a,u+0,t,p),h(o,u+2,e,p),h(l,u+4,i,p)}})(),function(){for(let t=0;t<s.length;t+=6){let e=s[t+0],i=s[t+2],n=s[t+4],r=Math.max(e,i,n),a=Math.min(e,i,n);r>.9&&a<.1&&(e<.2&&(s[t+0]+=1),i<.2&&(s[t+2]+=1),n<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Vi(r,3)),this.setAttribute("normal",new Vi(r.slice(),3)),this.setAttribute("uv",new Vi(s,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new oo(t.vertices,t.indices,t.radius,t.details)}},lo=class extends oo{constructor(t=1,e=0){let i=(1+Math.sqrt(5))/2,n=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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[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,
219,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new lo(t.radius,t.detail)}},ho=class extends no{constructor(t){super(t),this.uuid=Bt(),this.type="Shape",this.holes=[]}getPointsHoles(t){let e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){let t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){let i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){let i=t.holes[e];this.holes.push((new no).fromJSON(i))}return this}},co=function(t,e,i=2){let n,r,s,a,o,l,h,c=e&&e.length,d=c?e[0]*i:t.length,u=uo(t,0,d,i,!0),p=[];if(!u||u.next===u.prev)return p;if(c&&(u=function(t,e,i,n){let r,s,a,o,l,h=[];for(r=0,s=e.length;r<s;r++)a=e[r]*n,o=r<s-1?e[r+1]*n:t.length,l=uo(t,a,o,n,!1),l===l.next&&(l.steiner=!0),h.push(_o(l));for(h.sort(xo),r=0;r<h.length;r++)i=bo(h[r],i);return i}(t,e,u,i)),t.length>80*i){n=s=t[0],r=a=t[1];for(let e=i;e<d;e+=i)o=t[e],l=t[e+1],o<n&&(n=o),l<r&&(r=l),o>s&&(s=o),l>a&&(a=l);h=Math.max(s-n,a-r),h=0!==h?32767/h:0}return fo(u,p,i,n,r,h,0),p};function uo(t,e,i,n,r){let s,a;if(r===function(t,e,i,n){let r=0;for(let s=e,a=i-n;s<i;s+=n)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)a=Ro(s,t[s],t[s+1],a);else for(s=i-n;s>=e;s-=n)a=Ro(s,t[s],t[s+1],a);return a&&Eo(a,a.next)&&(Lo(a),a=a.next),a}function po(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Eo(n,n.next)&&0!==Co(n.prev,n,n.next))n=n.next;else{if(Lo(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function fo(t,e,i,n,r,s,a){if(!t)return;!a&&s&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=So(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,s,a,o,l,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e<h&&(o++,n=n.nextZ,n);e++);for(l=h;o>0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(a>1)}(r)}(t,n,r,s);let o,l,h=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?go(t,n,r,s):mo(t))e.push(o.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),Lo(t),t=l.next,h=l.next;else if((t=l)===h){a?1===a?fo(t=vo(po(t),e,i),e,i,n,r,s,2):2===a&&yo(t,e,i,n,r,s):fo(po(t),e,i,n,r,s,1);break}}function mo(t){let e=t.prev,i=t,n=t.next;if(Co(e,i,n)>=0)return!1;let r=e.x,s=i.x,a=n.x,o=e.y,l=i.y,h=n.y,c=r<s?r<a?r:a:s<a?s:a,d=o<l?o<h?o:h:l<h?l:h,u=r>s?r>a?r:a:s>a?s:a,p=o>l?o>h?o:h:l>h?l:h,f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=u&&f.y>=d&&f.y<=p&&Ao(r,o,s,l,a,h,f.x,f.y)&&Co(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function go(t,e,i,n){let r=t.prev,s=t,a=t.next;if(Co(r,s,a)>=0)return!1;let o=r.x,l=s.x,h=a.x,c=r.y,d=s.y,u=a.y,p=o<l?o<h?o:h:l<h?l:h,f=c<d?c<u?c:u:d<u?d:u,m=o>l?o>h?o:h:l>h?l:h,g=c>d?c>u?c:u:d>u?d:u,v=So(p,f,e,i,n),y=So(m,g,e,i,n),x=t.prevZ,b=t.nextZ;for(;x&&x.z>=v&&b&&b.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&Ao(o,c,l,d,h,u,x.x,x.y)&&Co(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==r&&b!==a&&Ao(o,c,l,d,h,u,b.x,b.y)&&Co(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==r&&x!==a&&Ao(o,c,l,d,h,u,x.x,x.y)&&Co(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==r&&b!==a&&Ao(o,c,l,d,h,u,b.x,b.y)&&Co(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function vo(t,e,i){let n=t;do{let r=n.prev,s=n.next.next;!Eo(r,s)&&Po(r,n,n.next,s)&&Io(r,s)&&Io(s,r)&&(e.push(r.i/i|0),e.push(n.i/i|0),e.push(s.i/i|0),Lo(n),Lo(n.next),n=t=s),n=n.next}while(n!==t);return po(n)}function yo(t,e,i,n,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Mo(a,t)){let o=Oo(a,t);return a=po(a,a.next),o=po(o,o.next),fo(a,e,i,n,r,s,0),void fo(o,e,i,n,r,s,0)}t=t.next}a=a.next}while(a!==t)}function xo(t,e){return t.x-e.x}function bo(t,e){let i=function(t,e){let i,n=e,r=-1/0,s=t.x,a=t.y;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){let t=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=s&&t>
2r&&(r=t,i=n.x<n.next.x?n:n.next,t===s))return i}n=n.next}while(n!==e);if(!i)return null;let o,l=i,h=i.x,c=i.y,d=1/0;n=i;do{s>=n.x&&n.x>=h&&s!==n.x&&Ao(a<c?s:r,a,h,c,a<c?r:s,a,n.x,n.y)&&(o=Math.abs(a-n.y)/(s-n.x),Io(n,t)&&(o<d||o===d&&(n.x>i.x||n.x===i.x&&wo(i,n)))&&(i=n,d=o)),n=n.next}while(n!==l);return i}(t,e);if(!i)return e;let n=Oo(i,t);return po(n,n.next),po(i,i.next)}function wo(t,e){return Co(t.prev,t,e.prev)<0&&Co(e.next,t,t.next)<0}function So(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function _o(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Ao(t,e,i,n,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(s-o)>=(r-a)*(n-o)}function Mo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Po(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Io(t,e)&&Io(e,t)&&function(t,e){let i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Co(t.prev,t,e.prev)||Co(t,e.prev,e))||Eo(t,e)&&Co(t.prev,t,t.next)>0&&Co(e.prev,e,e.next)>0)}function Co(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Eo(t,e){return t.x===e.x&&t.y===e.y}function Po(t,e,i,n){let r=Do(Co(t,e,i)),s=Do(Co(t,e,n)),a=Do(Co(i,n,t)),o=Do(Co(i,n,e));return!!(r!==s&&a!==o||0===r&&To(t,i,e)||0===s&&To(t,n,e)||0===a&&To(i,t,n)||0===o&&To(i,e,n))}function To(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Do(t){return t>0?1:t<0?-1:0}function Io(t,e){return Co(t.prev,t,t.next)<0?Co(t,e,t.next)>=0&&Co(t,t.prev,e)>=0:Co(t,e,t.prev)<0||Co(t,t.next,e)<0}function Oo(t,e){let i=new Bo(t.i,t.x,t.y),n=new Bo(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Ro(t,e,i,n){let r=new Bo(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Lo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bo(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var zo=class{static area(t){let e=t.length,i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return zo.area(t)<0}static triangulateShape(t,e){let i=[],n=[],r=[];Fo(t),No(i,t);let s=t.length;e.forEach(Fo);for(let o=0;o<e.length;o++)n.push(s),s+=e[o].length,No(i,e[o]);let a=co(i,n);for(let o=0;o<a.length;o+=3)r.push(a.slice(o,o+3));return r}};function Fo(t){let e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function No(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}var Uo=class extends oo{constructor(t=1,e=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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Uo(t.radius,t.detail)}},ko=class extends Qi{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));let o=Math.min(s+a,Math.PI),l=0,h=[],c=new be,d=new be,u=[],p=[],f=[],m=[];for(let g=0;g<=i;g++){let u=[],v=g/i,y=0;0==g&&0==s?y=.5/e:g==i&&o==Math.PI&&(y=-.5/e);for(let i=0;i<=e;i++){let o=i/e;c.x=-t*Math.cos(n+o*r)*Math.sin(s+v*a),c.y=t*Math.cos(s+v*a),c.z=t*Math.sin(n+o*r)*Math.sin(s+v*a),p.push(c.x,c.y,c.z),d.copy(c).normalize(),f.push(d.x,d.y,d.z),m.push(o+y,1-v),u.push(l++)}h.push(u)}for(let g=0;g<i;g++)for(let t=0;t<e;t++){let e=h[g][t+1],n=h[g][t],r=h[g+1][t],a=h[g+1][t+1];(0!==g||s>0)&&u.push(e,n,a),(g!==i-1||o<Math.PI)&&u.push(n,r,a)}this.setIndex(u),this.setAttribute("position",new Vi(p,3)),this.setAttribute("normal",new Vi(f,3)),this.setAttribute("uv",new Vi(m,2))}static fromJSON(t){return new ko(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Vo=class extends Qi{constructor(t=1,e=.4,i=12,n=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radiu
vendor: 7,716 bytes, line 2
2s:t,tube:e,radialSegments:i,tubularSegments:n,arc:r},i=Math.floor(i),n=Math.floor(n);let s=[],a=[],o=[],l=[],h=new be,c=new be,d=new be;for(let u=0;u<=i;u++)for(let s=0;s<=n;s++){let p=s/n*r,f=u/i*Math.PI*2;c.x=(t+e*Math.cos(f))*Math.cos(p),c.y=(t+e*Math.cos(f))*Math.sin(p),c.z=e*Math.sin(f),a.push(c.x,c.y,c.z),h.x=t*Math.cos(p),h.y=t*Math.sin(p),d.subVectors(c,h).normalize(),o.push(d.x,d.y,d.z),l.push(s/n),l.push(u/i)}for(let u=1;u<=i;u++)for(let t=1;t<=n;t++){let e=(n+1)*u+t-1,i=(n+1)*(u-1)+t-1,r=(n+1)*(u-1)+t,a=(n+1)*u+t;s.push(e,i,a),s.push(i,r,a)}this.setIndex(s),this.setAttribute("position",new Vi(a,3)),this.setAttribute("normal",new Vi(o,3)),this.setAttribute("uv",new Vi(l,2))}static fromJSON(t){return new Vo(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},jo=class extends Qi{constructor(t=1,e=.4,i=64,n=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:r,q:s},i=Math.floor(i),n=Math.floor(n);let a=[],o=[],l=[],h=[],c=new be,d=new be,u=new be,p=new be,f=new be,m=new be,g=new be;for(let y=0;y<=i;++y){let a=y/i*r*Math.PI*2;v(a,r,s,t,u),v(a+.01,r,s,t,p),m.subVectors(p,u),g.addVectors(p,u),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let t=0;t<=n;++t){let r=t/n*Math.PI*2,s=-e*Math.cos(r),a=e*Math.sin(r);c.x=u.x+(s*g.x+a*f.x),c.y=u.y+(s*g.y+a*f.y),c.z=u.z+(s*g.z+a*f.z),o.push(c.x,c.y,c.z),d.subVectors(c,u).normalize(),l.push(d.x,d.y,d.z),h.push(y/i),h.push(t/n)}}for(let y=1;y<=i;y++)for(let t=1;t<=n;t++){let e=(n+1)*(y-1)+(t-1),i=(n+1)*y+(t-1),r=(n+1)*y+t,s=(n+1)*(y-1)+t;a.push(e,i,s),a.push(i,r,s)}function v(t,e,i,n,r){let s=Math.cos(t),a=Math.sin(t),o=i/e*t,l=Math.cos(o);r.x=n*(2+l)*.5*s,r.y=n*(2+l)*a*.5,r.z=n*Math.sin(o)*.5}this.setIndex(a),this.setAttribute("position",new Vi(o,3)),this.setAttribute("normal",new Vi(l,3)),this.setAttribute("uv",new Vi(h,2))}static fromJSON(t){return new jo(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Go=class extends vn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};function Wo(t,e,i){return qo(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)}function Ho(t,e,i){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function qo(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Xo(t){let e=t.length,i=new Array(e);for(let n=0;n!==e;++n)i[n]=n;return i.sort(function(e,i){return t[e]-t[i]}),i}function Yo(t,e,i){let n=t.length,r=new t.constructor(n);for(let s=0,a=0;a!==n;++s){let n=i[s]*e;for(let i=0;i!==e;++i)r[a++]=t[n+i]}return r}function Qo(t,e,i,n){let r=1,s=t[0];for(;void 0!==s&&void 0===s[n];)s=t[r++];if(void 0===s)return;let a=s[n];if(void 0!==a)if(Array.isArray(a))do{a=s[n],void 0!==a&&(e.push(s.time),i.push.apply(i,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[n],void 0!==a&&(e.push(s.time),a.toArray(i,i.length)),s=t[r++]}while(void 0!==s);else do{a=s[n],void 0!==a&&(e.push(s.time),i.push(a)),s=t[r++]}while(void 0!==s)}var Zo=class{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let s;i:{n:if(!(t<n)){for(let s=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===s)break;if(r=n,n=e[++i],t<n)break e}s=e.length;break i}if(!(t>=r)){let a=e[1];t<a&&(i=2,r=a);for(let s=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===s)break;if(n=r,r=e[--i-1],t>=r)break e}s=i,i=0;break i}break t}for(;i<s;){let n=i+s>>>1;t<e[n]?s=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let s=0;s!==n;++s)e[s]=i[r+s];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ko=class extends Zo{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:vt,endingEnd:vt}}intervalChanged_(t,e,i){let n=this.parameterPositions,r=t-2,s=t+1,a=n[r],o=n[s];if(void 0===a)switch(this.getSettings_().endingStart){case yt:r=t,a=2*e-i;break;case xt:r=n.length-2,a=e+n[r]-n[r+1];break;default:r=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case yt:s=t,o=2*i-e;break;case xt:s=1,o=i+n[1]-n[0];break;default:s=t-1,o=e}let l=.5*(i-e),h=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-i),this._offsetPrev=r*h,this._offsetNext=s*h}interpolate_(t,e,i,n){let r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,h=this._offsetPrev,c=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(i-e)/(n-e),f=p*p,m=f*p,g=-d*m+2*d*f-d*p,v=(1+d)*m+(-1.5-2*d)*f+(-.5+d)*p+1,y=(-1-u)*m+(1.5+u)*f+.5*p,x=u*m-u*f;for(let b=0;b!==a;++b)r[b]=g*s[h+b]+v*s[l+b]+y*s[o+b]+x*s[c+b];return r}},Jo=class extends Zo{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){let r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,h=(i-e)/(n-e),c=1-h;for(let d=0;d!==a;++d)r[d]=s[l+d]*c+s[o+d]*h;return r}},$o=class extends Zo{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}},tl=class{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ho(e,this.TimeBufferType),this.values=Ho(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){let e,i=t.constructor;if(i.toJSON!==this.toJSON)e=i.toJSON(t);else{e={name:t.name,times:Ho(t.times,Array),values:Ho(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e}InterpolantFactoryMethodDiscrete(t){return new $o(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Jo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ko(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ft:e=this.InterpolantFactoryMethodDiscrete;break;case mt:e=this.InterpolantFactoryMethodLinear;break;case gt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){let e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ft;case this.InterpolantFactoryMethodLinear:return mt;case this.InterpolantFactoryMethodSmooth:return gt}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){let e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){let e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){let i=this.times,n=i.length,r=0,s=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==s&&i[s]>e;)--s;if(++s,0!==r||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);let t=this.getValueSize();this.times=Wo(i,r,s),this.values=Wo(this.values,r*t,s*t)}
2return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(t=!1);let i=this.times,n=this.values,r=i.length;0===r&&(t=!1);let s=null;for(let a=0;a!==r;a++){let e=i[a];if("number"==typeof e&&isNaN(e)){t=!1;break}if(null!==s&&s>e){t=!1;break}s=e}if(void 0!==n&&qo(n))for(let a=0,o=n.length;a!==o;++a){let e=n[a];if(isNaN(e)){t=!1;break}}return t}optimize(){let t=Wo(this.times),e=Wo(this.values),i=this.getValueSize(),n=this.getInterpolation()===gt,r=t.length-1,s=1;for(let a=1;a<r;++a){let r=!1,o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)r=!0;else{let t=a*i,n=t-i,s=t+i;for(let a=0;a!==i;++a){let i=e[t+a];if(i!==e[n+a]||i!==e[s+a]){r=!0;break}}}if(r){if(a!==s){t[s]=t[a];let n=a*i,r=s*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*i,n=s*i,a=0;a!==i;++a)e[n+a]=e[t+a];++s}return s!==t.length?(this.times=Wo(t,0,s),this.values=Wo(e,0,s*i)):(this.times=t,this.values=e),this}clone(){let t=Wo(this.times,0),e=Wo(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};tl.prototype.TimeBufferType=Float32Array,tl.prototype.ValueBufferType=Float32Array,tl.prototype.DefaultInterpolation=mt;var el=class extends tl{};el.prototype.ValueTypeName="bool",el.prototype.ValueBufferType=Array,el.prototype.DefaultInterpolation=ft,el.prototype.InterpolantFactoryMethodLinear=void 0,el.prototype.InterpolantFactoryMethodSmooth=void 0;var il=class extends tl{};il.prototype.ValueTypeName="color";var nl=class extends tl{};nl.prototype.ValueTypeName="number";var rl=class extends Zo{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){let r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(i-e)/(n-e),l=t*a;for(let h=l+a;l!==h;l+=4)xe.slerpFlat(r,0,s,l-a,s,l,o);return r}},sl=class extends tl{InterpolantFactoryMethodLinear(t){return new rl(this.times,this.values,this.getValueSize(),t)}};sl.prototype.ValueTypeName="quaternion",sl.prototype.DefaultInterpolation=mt,sl.prototype.InterpolantFactoryMethodSmooth=void 0;var al=class extends tl{};al.prototype.ValueTypeName="string",al.prototype.ValueBufferType=Array,al.prototype.DefaultInterpolation=ft,al.prototype.InterpolantFactoryMethodLinear=void 0,al.prototype.InterpolantFactoryMethodSmooth=void 0;var ol=class extends tl{};ol.prototype.ValueTypeName="vector";var ll=class{constructor(t,e=-1,i,n=bt){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=Bt(),this.duration<0&&this.resetDuration()}static parse(t){let e=[],i=t.tracks,n=1/(t.fps||1);for(let s=0,a=i.length;s!==a;++s)e.push(hl(i[s]).scale(n));let r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){let e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,s=i.length;r!==s;++r)e.push(tl.toJSON(i[r]));return n}static CreateFromMorphTargetSequence(t,e,i,n){let r=e.length,s=[];for(let a=0;a<r;a++){let t=[],o=[];t.push((a+r-1)%r,a,(a+1)%r),o.push(0,1,0);let l=Xo(t);t=Yo(t,1,l),o=Yo(o,1,l),!n&&0===t[0]&&(t.push(r),o.push(o[0])),s.push(new nl(".morphTargetInfluences["+e[a].name+"]",t,o).scale(1/i))}return new this(t,-1,s)}static findByName(t,e){let i=t;if(!Array.isArray(t)){let e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let n=0;n<i.length;n++)if(i[n].name===e)return i[n];return null}static CreateClipsFromMorphTargetSequences(t,e,i){let n={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,o=t.length;a<o;a++){let e=t[a],i=e.name.match(r);if(i&&i.length>1){let t=i[1],r=n[t];r||(n[t]=r=[]),r.push(e)}}let s=[];for(let a in n)s.push(this.CreateFromMorphTargetSequence(a,n[a],e,i));return s}static parseAnimation(t,e){if(!t)return null;let i=function(t,e,i,n,r){if(0!==i.length){let s=[],a=[];Qo(i,s,a,n),0!==s.length&&r.push(new t(e,s,a))}},n=[],r=t.name||"default",s=t.fps||30,a=t.blendMode,o=t.length||-1,l=t.hierarchy||[];for(let h=0;h<l.length;h++){let t=l[h].keys;if(t&&0!==t.length)if(t[0].morphTargets){let e,i={};for(e=0;e<t.length;e++)if(t[e].morphTargets)for(let n=0;n<t[e].morphTargets.length;n++)i[t[e].morphTargets[n]]=-1;for(let r in i){let i=[],s=[];for(let n=0;n!==t[e].morphTargets.length;++n){let n=t[e];i.push(n.time),s.push(n.morphTarget===r?1:0)}n.push(new nl(".morphTargetInfluence["+r+"]",i,s))}o=i.length*s}else{let r=".bones["+e[h].name+"]";i(ol,r+".position",t,"pos",n),i(sl,r+".quaternion",t,"rot",n),i(ol,r+".scale",t,"scl",n)}}return 0===n.length?null:new this(r,o,n,a)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){let i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){let t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function hl(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return nl;
vendor: 9,663 bytes, line 2
2case"vector":case"vector2":case"vector3":case"vector4":return ol;case"color":return il;case"quaternion":return sl;case"bool":case"boolean":return el;case"string":return al}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){let e=[],i=[];Qo(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}var cl={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},dl=class{constructor(t,e,i){let n,r=this,s=!1,a=0,o=0,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===s&&void 0!==r.onStart&&r.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(s=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return n?n(t):t},this.setURLModifier=function(t){return n=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){let e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){let i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}},ul=new dl,pl=class{constructor(t){this.manager=void 0!==t?t:ul,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let i=this;return new Promise(function(n,r){i.load(t,n,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}},fl={},ml=class extends Error{constructor(t,e){super(t),this.response=e}},gl=class extends pl{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);let r=cl.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==fl[t])return void fl[t].push({onLoad:e,onProgress:i,onError:n});fl[t]=[],fl[t].push({onLoad:e,onProgress:i,onError:n});let s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then(e=>{if(200===e.status||0===e.status){if(e.status,typeof ReadableStream>"u"||void 0===e.body||void 0===e.body.getReader)return e;let i=fl[t],n=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),s=r?parseInt(r):0,a=0!==s,o=0,l=new ReadableStream({start(t){!function e(){n.read().then(({done:n,value:r})=>{if(n)t.close();else{o+=r.byteLength;let n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=i.length;t<e;t++){let e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(r),e()}})}()}});return new Response(l)}throw new ml(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(void 0===a)return t.text();{let e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then(t=>n.decode(t))}}}).then(e=>{cl.add(t,e);let i=fl[t];delete fl[t];for(let t=0,n=i.length;t<n;t++){let n=i[t];n.onLoad&&n.onLoad(e)}}).catch(e=>{let i=fl[t];if(void 0===i)throw this.manager.itemError(t),e;delete fl[t];for(let t=0,n=i.length;t<n;t++){let n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}},vl=class extends pl{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);let r=this,s=cl.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0),s;let a=Kt("img");function o(){h(),cl.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){h(),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}function h(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}},yl=class extends pl{constructor(t){super(t)}load(t,e,i,n){let r=new fe,s=new vl(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r}},xl=class extends wi{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new le(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){let e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}},bl=class extends xl{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new le(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}},wl=new Ze,Sl=new be,_l=new be,Al=class{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ht(512,512),this.map=null,this.mapPass=null,this.matrix=new Ze,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Dn,this._frameExtents=new Ht(1,1),this._viewportCount=1,this._viewports=[new me(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){let e=this.camera,i=this.matrix;Sl.setFromMatrixPosition(t.matrixWorld),e.position.copy(Sl),_l.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(_l),e.updateMatrixWorld(),wl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(wl),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(wl)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){let t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}},Ml=class extends Al{constructor(){super(new xn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){let e=this.camera,i=2*Lt*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;(i!==e.fov||n!==e.aspect||r!==e.far)&&(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}},Cl=class extends xl{constructor(t,e,i=0,n=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.target=new wi,this.distance=i,this.angle=n,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Ml}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}},El=new Ze,Pl=new be,Tl=new be,Dl=class extends Al{constructor(){super(new xn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ht(4,2),this._viewportCount=6,this._viewports=[new me(2,1,1,1),new me(0,1,1,1),new me(3,1,1,1),new me(1,1,1,1),new me(3,0,1,1),new me(1,0,1,1)],this._cubeDirections=[new be(1,0,0),new be(-1,0,0),new be(0,0,1),new be(0,0,-1),new be(0,1,0),new be(0,-1,0)],this._cubeUps=[new be(0,1,0),new be(0,1,0),new be(0,1,0),new be(0,1,0),new be(0,0,1),new be(0,0,-1)]}updateMatrices(t,e=0){let i=this.camera,n=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),Pl.setFromMatrixPosition(t.matrixWorld),i.position.copy(Pl),Tl.copy(i.position),Tl.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(Tl),i.updateMatrixWorld(),n.makeTranslation(-Pl.x,-Pl.y,-Pl.z),El.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(El)}},Il=class extends xl{constructor(t,e,i=0,n=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Dl}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}},Ol=class extends Al{constructor(){super(new Wn(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}
2},Rl=class extends xl{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.target=new wi,this.shadow=new Ol}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}},Ll=class extends Qi{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){let t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}},Bl=class extends pl{constructor(t){super(t)}load(t,e,i,n){let r=this,s=new gl(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,function(i){try{e(r.parse(JSON.parse(i)))}catch(s){n&&n(s),r.manager.itemError(t)}},i,n)}parse(t){let e={},i={};function n(t,n){if(void 0!==e[n])return e[n];let r=t.interleavedBuffers[n],s=function(t,e){if(void 0!==i[e])return i[e];let n=t.arrayBuffers[e],r=new Uint32Array(n).buffer;return i[e]=r,r}(t,r.buffer),a=Zt(r.type,s),o=new ua(a,r.stride);return o.uuid=r.uuid,e[n]=o,o}let r=t.isInstancedBufferGeometry?new Ll:new Qi,s=t.data.index;if(void 0!==s){let t=Zt(s.type,s.array);r.setIndex(new Ni(t,1))}let a=t.data.attributes;for(let c in a){let e,i=a[c];if(i.isInterleavedBufferAttribute){let r=n(t.data,i.data);e=new fa(r,i.itemSize,i.offset,i.normalized)}else{let t=Zt(i.type,i.array);e=new(i.isInstancedBufferAttribute?ba:Ni)(t,i.itemSize,i.normalized)}void 0!==i.name&&(e.name=i.name),void 0!==i.usage&&e.setUsage(i.usage),void 0!==i.updateRange&&(e.updateRange.offset=i.updateRange.offset,e.updateRange.count=i.updateRange.count),r.setAttribute(c,e)}let o=t.data.morphAttributes;if(o)for(let c in o){let e=o[c],i=[];for(let r=0,s=e.length;r<s;r++){let s,a=e[r];if(a.isInterleavedBufferAttribute){let e=n(t.data,a.data);s=new fa(e,a.itemSize,a.offset,a.normalized)}else{let t=Zt(a.type,a.array);s=new Ni(t,a.itemSize,a.normalized)}void 0!==a.name&&(s.name=a.name),i.push(s)}r.morphAttributes[c]=i}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);let l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let c=0,d=l.length;c!==d;++c){let t=l[c];r.addGroup(t.start,t.count,t.materialIndex)}let h=t.data.boundingSphere;if(void 0!==h){let t=new be;void 0!==h.center&&t.fromArray(h.center),r.boundingSphere=new Ve(t,h.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}},zl=class{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Fl(),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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let e=Fl();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}};function Fl(){return(typeof performance>"u"?Date:performance).now()}var Nl=class{constructor(t,e,i){let n,r,s;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){let i=this.buffer,n=this.valueSize,r=t*n+n,s=this.cumulativeWeight;if(0===s){for(let t=0;t!==n;++t)i[r+t]=i[t];s=e}else{s+=e;let t=e/s;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=s}accumulateAdditive(t){let e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){let e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let o=e,l=e+e;o!==l;++o)if(i[o]!==i[o+e]){a.setValue(i,n);break}}saveOriginalState(){let t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let r=i,s=n;r!==s;++r)e[r]=e[n+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){let t=this._addIndex*this.valueSize,e=t+this.valueSize;
vendor: 4,800 bytes, line 2
2for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let s=0;s!==r;++s)t[e+s]=t[i+s]}_slerp(t,e,i,n){xe.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){let s=this._workIndex*r;xe.multiplyQuaternionsFlat(t,s,t,e,t,i),xe.slerpFlat(t,e,t,e,t,s,n)}_lerp(t,e,i,n,r){let s=1-n;for(let a=0;a!==r;++a){let r=e+a;t[r]=t[r]*s+t[i+a]*n}}_lerpAdditive(t,e,i,n,r){for(let s=0;s!==r;++s){let r=e+s;t[r]=t[r]+t[i+s]*n}}},Ul="\\[\\]\\.:\\/",kl=new RegExp("["+Ul+"]","g"),Vl="[^"+Ul+"]",jl="[^"+Ul.replace("\\.","")+"]",Gl=/((?:WC+[\/:])*)/.source.replace("WC",Vl),Wl=/(WCOD+)?/.source.replace("WCOD",jl),Hl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vl),ql=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vl),Xl=new RegExp("^"+Gl+Wl+Hl+ql+"$"),Yl=["material","materials","bones","map"],Ql=class{constructor(t,e,i){this.path=e,this.parsedPath=i||Ql.parseTrackName(e),this.node=Ql.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Ql.Composite(t,e,i):new Ql(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(kl,"")}static parseTrackName(t){let e=Xl.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let t=i.nodeName.substring(n+1);-1!==Yl.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){let i=function(t){for(let n=0;n<t.length;n++){let r=t[n];if(r.name===e||r.uuid===e)return r;let s=i(r.children);if(s)return s}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,i=e.objectName,n=e.propertyName,r=e.propertyIndex;if(t||(t=Ql.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return;if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return;if(!t.material.materials)return;t=t.material.materials;break;case"bones":if(!t.skeleton)return;t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return;if(!t.material.map)return;t=t.material.map;break;default:if(void 0===t[i])return;t=t[i]}
2if(void 0!==n){if(void 0===t[n])return;t=t[n]}}let s=t[n];if(void 0===s){e.nodeName;return}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return;if(!t.geometry.morphAttributes)return;void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Ql.Composite=class{constructor(t,e,i){let n=i||Ql.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Ql.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ql.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ql.prototype.GetterByBindingType=[Ql.prototype._getValue_direct,Ql.prototype._getValue_array,Ql.prototype._getValue_arrayElement,Ql.prototype._getValue_toArray],Ql.prototype.SetterByBindingTypeAndVersioning=[[Ql.prototype._setValue_direct,Ql.prototype._setValue_direct_setNeedsUpdate,Ql.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ql.prototype._setValue_array,Ql.prototype._setValue_array_setNeedsUpdate,Ql.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ql.prototype._setValue_arrayElement,Ql.prototype._setValue_arrayElement_setNeedsUpdate,Ql.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ql.prototype._setValue_fromArray,Ql.prototype._setValue_fromArray_setNeedsUpdate,Ql.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Zl=class{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;let r=e.tracks,s=r.length,a=new Array(s),o={endingStart:vt,endingEnd:vt};for(let l=0;l!==s;++l){let t=r[l].createInterpolant(null);a[l]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),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(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){let i=this._clip.duration,n=t._clip.duration,r=n/i,s=i/n;t.warp(1,r,e),this.warp(s,1,e)}return this}
vendor: 5,379 bytes, line 2
2crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){let t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){let n=this._mixer,r=n.time,s=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+i,l[0]=t/s,l[1]=e/s,this}stopWarping(){let t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);let r=this._startTime;if(null!==r){let n=(t-r)*i;n<0||0===i?e=0:(this._startTime=null,e=i*n)}e*=this._updateTimeScale(t);let s=this._updateTime(e),a=this._updateWeight(t);if(a>0){let t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(s),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(s),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;let i=this._weightInterpolant;if(null!==i){let n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;let i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){let e=this._clip.duration,i=this.loop,n=this.time+t,r=this._loopCount,s=i===pt;if(0===t)return-1===r||!s||1&~r?n:e-n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),n>=e||n<0){let i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);let a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){let e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(s&&!(1&~r))return e-n}return n}_setEndings(t,e,i){let n=this._interpolantSettings;i?(n.endingStart=yt,n.endingEnd=yt):(n.endingStart=t?this.zeroSlopeAtStart?yt:vt:xt,n.endingEnd=e?this.zeroSlopeAtEnd?yt:vt:xt)}_scheduleFading(t,e,i){let n=this._mixer,r=n.time,s=this._weightInterpolant;null===s&&(s=n._lendControlInterpolant(),this._weightInterpolant=s);let a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}},Kl=new Float32Array(1),Jl=class extends Dt{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){let i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,s=t._propertyBindings,a=t._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(let c=0;c!==r;++c){let t=n[c],r=t.name,l=h[r];if(void 0!==l)++l.referenceCount,s[c]=l;else{if(l=s[c],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,o,r));continue}let n=e&&e._propertyBindings[c].binding.parsedPath;l=new Nl(Ql.create(i,r,n),t.ValueTypeName,t.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,o,r),s[c]=l}a[c].resultBuffer=l.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){let e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){let e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){let i=e[t];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){let e=t._cacheIndex;return null!==e&&e<this._nActiveActions}
vendor: 11,011 bytes, line 2
2_addInactiveAction(t,e,i){let n=this._actions,r=this._actionsByClip,s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{let e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),s.actionByRoot[i]=t}_removeInactiveAction(t){let e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;let r=t._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){let e=t._propertyBindings;for(let i=0,n=e.length;i!==n;++i){let t=e[i];0===--t.referenceCount&&this._removeInactiveBinding(t)}}_lendAction(t){let e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){let e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){let n=this._bindingsByRootAndName,r=this._bindings,s=n[e];void 0===s&&(s={},n[e]=s),s[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){let e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,s=this._bindingsByRootAndName,a=s[n],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete s[n]}_lendBinding(t){let e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){let e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){let t=this._controlInterpolants,e=this._nActiveControlInterpolants++,i=t[e];return void 0===i&&(i=new Jo(new Float32Array(2),new Float32Array(2),1,Kl),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){let e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){let n=e||this._root,r=n.uuid,s="string"==typeof t?ll.findByName(n,t):t,a=null!==s?s.uuid:t,o=this._actionsByClip[a],l=null;if(void 0===i&&(i=null!==s?s.blendMode:bt),void 0!==o){let t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;let h=new Zl(this,s,e,i);return this._bindAction(h,l),this._addInactiveAction(h,a,r),h}existingAction(t,e){let i=e||this._root,n=i.uuid,r="string"==typeof t?ll.findByName(i,t):t,s=r?r.uuid:t,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[n]||null}stopAllAction(){let t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;let e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let l=0;l!==i;++l)e[l]._update(n,t,r,s);let a=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)a[l].apply(s);return this}setTime(t){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){let e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){let t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){let n=t[i];this._deactivateAction(n);let r=n._cacheIndex,s=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){let e=t.uuid,i=this._actionsByClip;for(let r in i){let t=i[r].actionByRoot[e];void 0!==t&&(this._deactivateAction(t),this._removeInactiveAction(t))}let n=this._bindingsByRootAndName[e];if(void 0!==n)for(let r in n){let t=n[r];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(t,e){let i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}},$l=class{constructor(t){this.value=t}clone(){return new $l(void 0===this.value.clone?this.value:this.value.clone())}},th=class{constructor(t,e,i=0,n=1/0){this.ray=new Qe(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new oi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera&&(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e)}intersectObject(t,e=!0,i=[]){return ih(t,this,i,e),i.sort(eh),i}intersectObjects(t,e=!0,i=[]){for(let n=0,r=t.length;n<r;n++)ih(t[n],this,i,e);return i.sort(eh),i}};function eh(t,e){return t.distance-e.distance}function ih(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n){let n=t.children;for(let t=0,r=n.length;t<r;t++)ih(n[t],e,i,!0)}}var nh=class{constructor(t=1,e=0,i=0){return this.radius=t,this.phi=e,this.theta=i,this}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(zt(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}},rh=new Ht,sh=class{constructor(t=new Ht(1/0,1/0),e=new Ht(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let i=rh.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return rh.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},ah=new be,oh=new be,lh=class{constructor(t=new be,e=new be){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){ah.subVectors(t,this.start),oh.subVectors(this.end,this.start);let i=oh.dot(oh),n=oh.dot(ah)/i;return e&&(n=zt(n,0,1)),n}closestPointToPoint(t,e,i){let n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}},hh=new be,ch=class extends wi{constructor(t,e){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";let i=new Qi,n=[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 s=0,a=1,o=32;s<o;s++,a++){let t=s/o*Math.PI*2,e=a/o*Math.PI*2;n.push(Math.cos(t),Math.sin(t),1,Math.cos(e),Math.sin(e),1)}i.setAttribute("position",new Vi(n,3));let r=new Ea({fog:!1,toneMapped:!1});this.cone=new za(i,r),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 t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),hh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(hh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},dh=class extends cn{constructor(t,e,i){super(new ko(e,4,2),new Bi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,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)}},uh=new be,ph=new be,fh=new be,mh=class extends wi{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===e&&(e=1);let n=new Qi;n.setAttribute("position",new Vi([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));let r=new Ea({fog:!1,toneMapped:!1});this.lightPlane=new Ra(n,r),this.add(this.lightPlane),n=new Qi,n.setAttribute("position",new Vi([0,0,0,0,0,1],3)),this.targetLine=new Ra(n,r),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),uh.setFromMatrixPosition(this.light.matrixWorld),ph.setFromMatrixPosition(this.light.target.matrixWorld),fh.subVectors(ph,uh),this.lightPlane.lookAt(ph),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(ph),this.targetLine.scale.z
2=fh.length()}},gh=new be,vh=new yn,yh=class extends za{constructor(t){let e=new Qi,i=new Ea({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={};function a(t,e){o(t),o(e)}function o(t){n.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(n.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new Vi(n,3)),e.setAttribute("color",new Vi(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();let l=new le(16755200),h=new le(16711680),c=new le(43775),d=new le(16777215),u=new le(3355443);this.setColors(l,h,c,d,u)}setColors(t,e,i,n,r){let s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,i.r,i.g,i.b),s.setXYZ(33,i.r,i.g,i.b),s.setXYZ(34,i.r,i.g,i.b),s.setXYZ(35,i.r,i.g,i.b),s.setXYZ(36,i.r,i.g,i.b),s.setXYZ(37,i.r,i.g,i.b),s.setXYZ(38,n.r,n.g,n.b),s.setXYZ(39,n.r,n.g,n.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){let t=this.geometry,e=this.pointMap;vh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xh("c",e,t,vh,0,0,-1),xh("t",e,t,vh,0,0,1),xh("n1",e,t,vh,-1,-1,-1),xh("n2",e,t,vh,1,-1,-1),xh("n3",e,t,vh,-1,1,-1),xh("n4",e,t,vh,1,1,-1),xh("f1",e,t,vh,-1,-1,1),xh("f2",e,t,vh,1,-1,1),xh("f3",e,t,vh,-1,1,1),xh("f4",e,t,vh,1,1,1),xh("u1",e,t,vh,.7,1.1,-1),xh("u2",e,t,vh,-.7,1.1,-1),xh("u3",e,t,vh,0,2,-1),xh("cf1",e,t,vh,-1,0,1),xh("cf2",e,t,vh,1,0,1),xh("cf3",e,t,vh,0,-1,1),xh("cf4",e,t,vh,0,1,1),xh("cn1",e,t,vh,-1,0,-1),xh("cn2",e,t,vh,1,0,-1),xh("cn3",e,t,vh,0,-1,-1),xh("cn4",e,t,vh,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function xh(t,e,i,n,r,s,a){gh.set(r,s,a).unproject(n);let o=e[t];if(void 0!==o){let t=i.getAttribute("position");for(let e=0,i=o.length;e<i;e++)t.setXYZ(o[e],gh.x,gh.y,gh.z)}}var bh=class extends za{constructor(t,e=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]),n=new Qi;n.setIndex(new Ni(i,1)),n.setAttribute("position",new Vi([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(n,new Ea({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){let e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},wh=class extends za{constructor(t=1){let e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new Qi;i.setAttribute("position",new Vi(e,3)),i.setAttribute("color",new Vi([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(i,new Ea({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){let n=new le,r=this.geometry.attributes.color.array;return n.set(t),n.toArray(r,0),n.toArray(r,3),n.set(e),n.toArray(r,6),n.toArray(r,9),n.set(i),n.toArray(r,12),n.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Sh=function(){let t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let t=l-127;t<-27?(n[l]=0,n[256|l]=32768,r[l]=24,r[256|l]=24):t<-14?(n[l]=1024>>-t-14,n[256|l]=1024>>-t-14|32768,r[l]=-t-1,r[256|l]=-t-1):t<=15?(n[l]=t+15<<10,n[256|l]=t+15<<10|32768,r[l]=13,r[256|l]=13):t<128?(n[l]=31744,n[256|l]=64512,r[l]=24,r[256|l]=24):(n[l]=31744,n[256|l]=64512,r[l]=13,r[256|l]=13)}let s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let t=l<<13,e=0;for(;!(8388608&t);)t<<=1,e-=8388608;t&=-8388609,e+=947912704,s[l]=t|e}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)32!==l&&(o[l]=1024);return{floatView:e,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}();var _h=Object.freeze({__proto__:null,fromHalfFloat:function(t){let e=t>>10;return Sh.uint32View[0]=Sh.mantissaTable[Sh.offsetTable[e]+(1023&t)]+Sh.exponentTable[e],Sh.floatView[0]},toHalfFloat:function(t){Math.abs(t),t=zt(t,-65504,65504),Sh.floatView[0]=t;let e=Sh.uint32View[0],i=e>>23&511;return Sh.baseTable[i]+((8388607&e)>>Sh.shiftTable[i])}});typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:y}})),typeof window<"u"&&(window.__THREE__||(window.__THREE__=y));var Ah=".",Mh=Symbol("target"),Ch=Symbol("unsubscribe");function Eh(t){return t instanceof Date||t instanceof Set||t instanceof Map||t instanceof WeakSet||t instanceof WeakMap||ArrayBuffer.isView(t)}var Ph=Array.isArray;function Th(t){return"symbol"==typeof t}var Dh={after:(t,e)=>Ph(t)?t.slice(e.length):""===e?t:t.slice(e.length+1),concat:(t,e)=>Ph(t)?(t=[...t],e&&t.push(e),t):e&&void 0!==e.toString?(""!==t&&(t+=Ah),Th(e)?t+e.toString():t+e):t,initial:t=>
vendor: 6,152 bytes, line 2
2{if(Ph(t))return t.slice(0,-1);if(""===t)return t;let e=t.lastIndexOf(Ah);return-1===e?"":t.slice(0,e)},last:t=>{if(Ph(t))return t[t.length-1]||"";if(""===t)return t;let e=t.lastIndexOf(Ah);return-1===e?t:t.slice(e+1)},walk:(t,e)=>{if(Ph(t))for(let i of t)e(i);else if(""!==t){let i=0,n=t.indexOf(Ah);if(-1===n)e(t);else for(;i<t.length;)-1===n&&(n=t.length),e(t.slice(i,n)),i=n+1,n=t.indexOf(Ah,i)}},get(t,e){return this.walk(e,e=>{t&&(t=t[e])}),t}},Ih=Dh;function Oh(t,e,i){return t.isUnsubscribed||e.ignoreSymbols&&Th(i)||e.ignoreUnderscores&&"_"===i.charAt(0)||"ignoreKeys"in e&&e.ignoreKeys.includes(i)}var Rh=class{constructor(t){this._equals=t,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(t){let e=this._getDescriptorCache(),i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i}_getOwnPropertyDescriptor(t,e){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(t,e);let i=this._getProperties(t),n=i[e];return void 0===n&&(n=Reflect.getOwnPropertyDescriptor(t,e),i[e]=n),n}getProxy(t,e,i,n){if(this.isUnsubscribed)return t;let r=t[n],s=r||t;this._pathCache.set(s,e);let a=this._proxyCache.get(s);return void 0===a&&(a=void 0===r?new Proxy(t,i):t,this._proxyCache.set(s,a)),a}getPath(t){return this.isUnsubscribed?void 0:this._pathCache.get(t)}isDetached(t,e){return!Object.is(t,Ih.get(e,this.getPath(t)))}defineProperty(t,e,i){return!!Reflect.defineProperty(t,e,i)&&(this.isUnsubscribed||(this._getProperties(t)[e]=i),!0)}setProperty(t,e,i,n,r){if(!this._equals(r,i)||!(e in t)){let r=this._getOwnPropertyDescriptor(t,e);return void 0!==r&&"set"in r?Reflect.set(t,e,i,n):Reflect.set(t,e,i)}return!0}deleteProperty(t,e,i){if(Reflect.deleteProperty(t,e)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(t);n&&(delete n[e],this._pathCache.delete(i))}return!0}return!1}isSameDescriptor(t,e,i){let n=this._getOwnPropertyDescriptor(e,i);return void 0!==t&&void 0!==n&&Object.is(t.value,n.value)&&(t.writable||!1)===(n.writable||!1)&&(t.enumerable||!1)===(n.enumerable||!1)&&(t.configurable||!1)===(n.configurable||!1)&&t.get===n.get&&t.set===n.set}isGetInvariant(t,e){let i=this._getOwnPropertyDescriptor(t,e);return void 0!==i&&!0!==i.configurable&&!0!==i.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Lh(t){return"[object Object]"===toString.call(t)}function Bh(){return!0}function zh(t,e){return t.length!==e.length||t.some((t,i)=>e[i]!==t)}var Fh=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),Nh=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),Uh={push:Bh,pop:Bh,shift:Bh,unshift:Bh,copyWithin:zh,reverse:zh,sort:zh,splice:zh,flat:zh,fill:zh},kh=new Set([...Fh,...Nh,...Object.keys(Uh)]);function Vh(t,e){if(t.size!==e.size)return!0;for(let i of t)if(!e.has(i))return!0;return!1}var jh=["keys","values","entries"],Gh=new Set(["has","toString"]),Wh={add:Vh,clear:Vh,delete:Vh,forEach:Vh},Hh=new Set([...Gh,...Object.keys(Wh),...jh]);function qh(t,e){if(t.size!==e.size)return!0;let i;for(let[n,r]of t)if(i=e.get(n),i!==r||void 0===i&&!e.has(n))return!0;return!1}var Xh=new Set([...Gh,"get"]),Yh={set:qh,clear:qh,delete:qh,forEach:qh},Qh=new Set([...Xh,...Object.keys(Yh),...jh]),Zh=class{constructor(t,e,i,n){this._path=e,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=void 0===e?t:this._shallowClone(t)}static isHandledMethod(t){return Fh.has(t)}_shallowClone(t){let e=t;if(Lh(t))e={...t};else if(Ph(t))e=[...t];else if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set([...t].map(t=>this._shallowClone(t)));else if(t instanceof Map){e=new Map;for(let[i,n]of t.entries())e.set(i,this._shallowClone(n))}return this._clonedCache.add(e),e}preferredThisArg(t,e,i,n){return t?(Ph(n)?this._onIsChanged=Uh[e]:n instanceof Set?this._onIsChanged=Wh[e]:n instanceof Map&&(this._onIsChanged=Yh[e]),n):i}update(t,e,i){let n=Ih.after(t,this._path);if("length"!==e){let t=this.clone;Ih.walk(n,e=>{t&&t[e]&&(this._clonedCache.has(t[e])||(t[e]=this._shallowClone(t[e])),t=t[e])}),this._hasOnValidate&&this._changes.push({path:n,property:e,previous:i}),t&&t[e]&&(t[e]=i)}this._isChanged=!0}undo(t){let e;for(let i=this._changes.length-1;-1!==i;i--)e=this._changes[i],Ih.get(t,e.path)[e.property]=e.previous}isChanged(t){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,t)}},Kh=class extends Zh{static isHandledMethod(t){return kh.has(t)}},Jh=class extends Zh{undo(t){t.setTime(this.clone.getTime())}isChanged(t,e){return!e(this.clone.valueOf(),t.valueOf())}},$h=class extends Zh{static isHandledMethod(t){return Hh.has(t)}undo(t){for(let e of this.clone)t.add(e);for(let e of t)this.clone.has(e)||t.delete(e)}},tc=class extends Zh{static isHandledMethod(t){return Qh.has(t)}undo(t){for(let[e,i]of this.clone.entries())t.set(e,i);for(let e of t.keys())this.clone.has(e)||t.delete(e)}},ec=class extends Zh{constructor(t,e,i,n){super(void 0,e,i,n),this._arg1=i[0],this._weakValue=t.has(this._arg1)}isChanged(t){return this._weakValue!==t.has(this._arg1)}undo(t){this._weakValue&&!t.has(this._arg1)?t.add(this._arg1):t.delete(this._arg1)}},ic=class extends Zh{constructor(t,e,i,n){super(void 0,e,i,n),this._weakKey=i[0],this._weakHas=t.has(this._weakKey),this._weakValue=t.get(this._weakKey)}isChanged(t){return this._weakValue!==t.get(this._weakKey)}undo(t){let e=t.has(this._weakKey);this._weakHas&&!e?t.set(this._weakKey,this._weakValue):!this._weakHas&&e?t.delete(this._weakKey):this._weakValue!==t.get(this._weakKey)&&t.set(this._weakKey,this._weakValue)}},nc=class{constructor(t){this._stack=[],this._hasOnValidate=t}static isHandledType(t){return Lh(t)||Ph(t)||Eh(t)}static isHandledMethod(t,e){return Lh(t)?Zh.isHandledMethod(e):Ph(t)?Kh.isHandledMethod(e):t instanceof Set?$h.isHandledMethod(e):t instanceof Map?tc.isHandledMethod(e):Eh(t)}get isCloning(){return this._stack.length>0}start(t,e,i){let n=Zh;
2Ph(t)?n=Kh:t instanceof Date?n=Jh:t instanceof Set?n=$h:t instanceof Map?n=tc:t instanceof WeakSet?n=ec:t instanceof WeakMap&&(n=ic),this._stack.push(new n(t,e,i,this._hasOnValidate))}update(t,e,i){this._stack[this._stack.length-1].update(t,e,i)}preferredThisArg(t,e,i){let{name:n}=t,r=nc.isHandledMethod(i,n);return this._stack[this._stack.length-1].preferredThisArg(r,n,e,i)}isChanged(t,e,i){return this._stack[this._stack.length-1].isChanged(t,e,i)}undo(t){void 0!==this._previousClone&&this._previousClone.undo(t)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},rc={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},sc=(t,e,i={})=>{i={...rc,...i};let n=Symbol("ProxyTarget"),{equals:r,isShallow:s,ignoreDetached:a,details:o}=i,l=new Rh(r),h="function"==typeof i.onValidate,c=new nc(h),d=(t,e,n,r,s)=>!h||c.isCloning||!0===i.onValidate(Ih.concat(l.getPath(t),e),n,r,s),u=(e,n,r,s)=>{!Oh(l,i,n)&&(!a||!l.isDetached(e,t))&&p(l.getPath(e),n,r,s)},p=(t,i,n,r,s)=>{c.isCloning?c.update(t,i,r):e(Ih.concat(t,i),n,r,s)},f=t=>t&&(t[n]||t),m=(e,r,o,h)=>function(t){return("object"==typeof t?null===t:"function"!=typeof t)||t instanceof RegExp}(e)||"constructor"===o||s&&!nc.isHandledMethod(r,o)||Oh(l,i,o)||l.isGetInvariant(r,o)||a&&l.isDetached(r,t)?e:(void 0===h&&(h=l.getPath(r)),l.getProxy(e,Ih.concat(h,o),g,n)),g={get(t,e,i){if(Th(e)){if(e===n||e===Mh)return t;if(e===Ch&&!l.isUnsubscribed&&0===l.getPath(t).length)return l.unsubscribe(),t}let r=Eh(t)?Reflect.get(t,e):Reflect.get(t,e,i);return m(r,t,e)},set(t,e,i,s){i=f(i);let a=t[n]||t,o=a[e];if(r(o,i)&&e in t)return!0;let h=d(t,e,i,o);return h&&l.setProperty(a,e,i,s,o)?(u(t,e,t[e],o),!0):!h},defineProperty(t,e,i){if(!l.isSameDescriptor(i,t,e)){let n=t[e];d(t,e,i.value,n)&&l.defineProperty(t,e,i,n)&&u(t,e,i.value,n)}return!0},deleteProperty(t,e){if(!Reflect.has(t,e))return!0;let i=Reflect.get(t,e),n=d(t,e,void 0,i);return n&&l.deleteProperty(t,e,i)?(u(t,e,void 0,i),!0):!n},apply(e,i,s){let a=i[n]||i;if(l.isUnsubscribed)return Reflect.apply(e,a,s);if((!1===o||!0!==o&&!o.includes(e.name))&&nc.isHandledType(a)){let n=Ih.initial(l.getPath(e)),o=nc.isHandledMethod(a,e.name);c.start(a,n,s);let h=Reflect.apply(e,c.preferredThisArg(e,i,a),o?s.map(t=>f(t)):s),u=c.isChanged(a,r),v=c.stop();if(nc.isHandledType(h)&&o&&(i instanceof Map&&"get"===e.name&&(n=Ih.concat(n,s[0])),h=l.getProxy(h,n,g)),u){let i={name:e.name,args:s,result:h},r=c.isCloning?Ih.initial(n):n,o=c.isCloning?Ih.last(n):"";d(Ih.get(t,r),o,a,v,i)?p(r,o,a,v,i):c.undo(a)}return(i instanceof Map||i instanceof Set)&&function(t){return"object"==typeof t&&"function"==typeof t.next}(h)?function(t,e,i,n,r){let s=t.next;if("entries"===e.name)t.next=function(){let t=s.call(this);return!1===t.done&&(t.value[0]=r(t.value[0],e,t.value[0],n),t.value[1]=r(t.value[1],e,t.value[0],n)),t};else if("values"===e.name){let a=i[Mh].keys();t.next=function(){let t=s.call(this);return!1===t.done&&(t.value=r(t.value,e,a.next().value,n)),t}}else t.next=function(){let t=s.call(this);return!1===t.done&&(t.value=r(t.value,e,t.value,n)),t};return t}(h,e,i,n,m):h}return Reflect.apply(e,i,s)}},v=l.getProxy(t,i.pathAsArray?[]:"",g);return e=e.bind(v),h&&(i.onValidate=i.onValidate.bind(v)),v};sc.target=t=>t&&t[Mh]||t,sc.unsubscribe=t=>t[Ch]||t;var ac=sc,oc="object"==typeof globalThis&&globalThis&&globalThis.Object===Object&&globalThis,lc="object"==typeof self&&self&&self.Object===Object&&self,hc=oc||lc||Function("return this")(),cc=hc.Symbol,dc=Object.prototype,uc=dc.hasOwnProperty,pc=dc.toString,fc=cc?cc.toStringTag:void 0;var mc=function(t){var e=uc.call(t,fc),i=t[fc];try{t[fc]=void 0;var n=!0}catch{}var r=pc.call(t);return n&&(e?t[fc]=i:delete t[fc]),r},gc=Object.prototype.toString;var vc=function(t){return gc.call(t)},yc=cc?cc.toStringTag:void 0;var xc=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":yc&&yc in Object(t)?mc(t):vc(t)};var bc=function(t){return null!=t&&"object"==typeof t};var wc=function(t){return"symbol"==typeof t||bc(t)&&"[object Symbol]"==xc(t)};var Sc=function(t,e){for(var i=-1,n=null==t?0:t.length,r=Array(n);++i<n;)r[i]=e(t[i],i,t);return r},_c=Array.isArray,Ac=cc?cc.prototype:void 0,Mc=Ac?Ac.toString:void 0;var Cc=function t(e){if("string"==typeof e)return e;if(_c(e))return Sc(e,t)+"";if(wc(e))return Mc?Mc.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i},Ec=/\s/;var Pc=function(t){for(var e=t.length;e--&&Ec.test(t.charAt(e)););return e},Tc=/^\s+/;var Dc=function(t){return t&&t.slice(0,Pc(t)+1).replace(Tc,"")};var Ic=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Oc=/^[-+]0x[0-9a-f]+$/i,Rc=/^0b[01]+$/i,Lc=/^0o[0-7]+$/i,Bc=parseInt;var zc=function(t){if("number"==typeof t)return t;if(wc(t))return NaN;if(Ic(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Ic(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Dc(t);var i=Rc.test(t);return i||Lc.test(t)?Bc(t.slice(2),i?2:8):Oc.test(t)?NaN:+t};var Fc=function(t){return t};var Nc,Uc=function(t){if(!Ic(t))return!1;var e=xc(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},kc=hc["__core-js_shared__"],Vc=(Nc=/[^.]+$/.exec(kc&&kc.keys&&kc.keys.IE_PROTO||""))?"Symbol(sr
2c)_1."+Nc:"";var jc=function(t){return!!Vc&&Vc in t},Gc=Function.prototype.toString;var Wc=function(t){if(null!=t){try{return Gc.call(t)}catch{}try{return t+""}catch{}}return""},Hc=/^\[object .+?Constructor\]$/,qc=Function.prototype,Xc=Object.prototype,Yc=qc.toString,Qc=Xc.hasOwnProperty,Zc=RegExp("^"+Yc.call(Qc).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Kc=function(t){return!(!Ic(t)||jc(t))&&(Uc(t)?Zc:Hc).test(Wc(t))};var Jc=function(t,e){return t?.[e]};var $c=function(t,e){var i=Jc(t,e);return Kc(i)?i:void 0},td=$c(hc,"WeakMap"),ed=Object.create,id=function(){function t(){}return function(e){if(!Ic(e))return{};if(ed)return ed(e);t.prototype=e;var i=new t;return t.prototype=void 0,i}}(),nd=id;var rd=function(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)};var sd=function(t,e){var i=-1,n=t.length;for(e||(e=Array(n));++i<n;)e[i]=t[i];return e},ad=Date.now;var od=function(t){var e=0,i=0;return function(){var n=ad(),r=16-(n-i);if(i=n,r>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}};var ld=function(t){return function(){return t}},hd=function(){try{var t=$c(Object,"defineProperty");return t({},"",{}),t}catch{}}(),cd=hd,dd=cd?function(t,e){return cd(t,"toString",{configurable:!0,enumerable:!1,value:ld(e),writable:!0})}:Fc,ud=od(dd);var pd=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n&&!1!==e(t[i],i,t););return t};var fd=function(t,e,i,n){for(var r=t.length,s=i+(n?1:-1);n?s--:++s<r;)if(e(t[s],s,t))return s;return-1};var md=function(t){return t!=t};var gd=function(t,e,i){for(var n=i-1,r=t.length;++n<r;)if(t[n]===e)return n;return-1};var vd=function(t,e,i){return e==e?gd(t,e,i):fd(t,md,i)},yd=/^(?:0|[1-9]\d*)$/;var xd=function(t,e){var i=typeof t;return!!(e=e??9007199254740991)&&("number"==i||"symbol"!=i&&yd.test(t))&&t>-1&&t%1==0&&t<e};var bd=function(t,e,i){"__proto__"==e&&cd?cd(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i};var wd=function(t,e){return t===e||t!=t&&e!=e},Sd=Object.prototype.hasOwnProperty;var _d=function(t,e,i){var n=t[e];(!Sd.call(t,e)||!wd(n,i)||void 0===i&&!(e in t))&&bd(t,e,i)};var Ad=function(t,e,i,n){var r=!i;i||(i={});for(var s=-1,a=e.length;++s<a;){var o=e[s],l=n?n(i[o],t[o],o,i,t):void 0;void 0===l&&(l=t[o]),r?bd(i,o,l):_d(i,o,l)}return i},Md=Math.max;var Cd=function(t,e,i){return e=Md(void 0===e?t.length-1:e,0),function(){for(var n=arguments,r=-1,s=Md(n.length-e,0),a=Array(s);++r<s;)a[r]=n[e+r];r=-1;for(var o=Array(e+1);++r<e;)o[r]=n[r];return o[e]=i(a),rd(t,this,o)}};var Ed=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var Pd=function(t){return null!=t&&Ed(t.length)&&!Uc(t)},Td=Object.prototype;var Dd=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Td)};var Id=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n};var Od=function(t){return bc(t)&&"[object Arguments]"==xc(t)},Rd=Object.prototype,Ld=Rd.hasOwnProperty,Bd=Rd.propertyIsEnumerable,zd=Od(function(){return arguments}())?Od:function(t){return bc(t)&&Ld.call(t,"callee")&&!Bd.call(t,"callee")},Fd=zd;var Nd=function(){return!1},Ud="object"==typeof exports&&exports&&!exports.nodeType&&exports,kd=Ud&&"object"==typeof module&&module&&!module.nodeType&&module,Vd=kd&&kd.exports===Ud?hc.Buffer:void 0,jd=(Vd?Vd.isBuffer:void 0)||Nd,Gd={};Gd["[object Float32Array]"]=Gd["[object Float64Array]"]=Gd["[object Int8Array]"]=Gd["[object Int16Array]"]=Gd["[object Int32Array]"]=Gd["[object Uint8Array]"]=Gd["[object Uint8ClampedArray]"]=Gd["[object Uint16Array]"]=Gd["[object Uint32Array]"]=!0,Gd["[object Arguments]"]=Gd["[object Array]"]=Gd["[object ArrayBuffer]"]=Gd["[object Boolean]"]=Gd["[object DataView]"]=Gd["[object Date]"]=Gd["[object Error]"]=Gd["[object Function]"]=Gd["[object Map]"]=Gd["[object Number]"]=Gd["[object Object]"]=Gd["[object RegExp]"]=Gd["[object Set]"]=Gd["[object String]"]=Gd["[object WeakMap]"]=!1;var Wd=function(t){return bc(t)&&Ed(t.length)&&!!Gd[xc(t)]};var Hd=function(t){return function(e){return t(e)}},qd="object"==typeof exports&&exports&&!exports.nodeType&&exports,Xd=qd&&"object"==typeof module&&module&&!module.nodeType&&module,Yd=Xd&&Xd.exports===qd&&oc.process,Qd=function(){try{return Xd&&Xd.require&&Xd.require("util").t
2ypes||Yd&&Yd.binding&&Yd.binding("util")}catch{}}(),Zd=Qd&&Qd.isTypedArray,Kd=Zd?Hd(Zd):Wd,Jd=Object.prototype.hasOwnProperty;var $d=function(t,e){var i=_c(t),n=!i&&Fd(t),r=!i&&!n&&jd(t),s=!i&&!n&&!r&&Kd(t),a=i||n||r||s,o=a?Id(t.length,String):[],l=o.length;for(var h in t)(e||Jd.call(t,h))&&(!a||!("length"==h||r&&("offset"==h||"parent"==h)||s&&("buffer"==h||"byteLength"==h||"byteOffset"==h)||xd(h,l)))&&o.push(h);return o};var tu=function(t,e){return function(i){return t(e(i))}},eu=tu(Object.keys,Object),iu=Object.prototype.hasOwnProperty;var nu=function(t){if(!Dd(t))return eu(t);var e=[];for(var i in Object(t))iu.call(t,i)&&"constructor"!=i&&e.push(i);return e};var ru=function(t){return Pd(t)?$d(t):nu(t)};var su=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},au=Object.prototype.hasOwnProperty;var ou=function(t){if(!Ic(t))return su(t);var e=Dd(t),i=[];for(var n in t)"constructor"==n&&(e||!au.call(t,n))||i.push(n);return i};var lu=function(t){return Pd(t)?$d(t,!0):ou(t)},hu=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cu=/^\w*$/;var du=function(t,e){if(_c(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!wc(t))||(cu.test(t)||!hu.test(t)||null!=e&&t in Object(e))},uu=$c(Object,"create");var pu=function(){this.__data__=uu?uu(null):{},this.size=0};var fu=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},mu=Object.prototype.hasOwnProperty;var gu=function(t){var e=this.__data__;if(uu){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return mu.call(e,t)?e[t]:void 0},vu=Object.prototype.hasOwnProperty;var yu=function(t){var e=this.__data__;return uu?void 0!==e[t]:vu.call(e,t)};var xu=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=uu&&void 0===e?"__lodash_hash_undefined__":e,this};function bu(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}bu.prototype.clear=pu,bu.prototype.delete=fu,bu.prototype.get=gu,bu.prototype.has=yu,bu.prototype.set=xu;var wu=bu;var Su=function(){this.__data__=[],this.size=0};var _u=function(t,e){for(var i=t.length;i--;)if(wd(t[i][0],e))return i;return-1},Au=Array.prototype.splice;var Mu=function(t){var e=this.__data__,i=_u(e,t);return!(i<0)&&(i==e.length-1?e.pop():Au.call(e,i,1),--this.size,!0)};var Cu=function(t){var e=this.__data__,i=_u(e,t);return i<0?void 0:e[i][1]};var Eu=function(t){return _u(this.__data__,t)>-1};var Pu=function(t,e){var i=this.__data__,n=_u(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this};function Tu(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Tu.prototype.clear=Su,Tu.prototype.delete=Mu,Tu.prototype.get=Cu,Tu.prototype.has=Eu,Tu.prototype.set=Pu;var Du=Tu,Iu=$c(hc,"Map");var Ou=function(){this.size=0,this.__data__={hash:new wu,map:new(Iu||Du),string:new wu}};var Ru=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Lu=function(t,e){var i=t.__data__;return Ru(e)?i["string"==typeof e?"string":"hash"]:i.map};var Bu=function(t){var e=Lu(this,t).delete(t);return this.size-=e?1:0,e};var zu=function(t){return Lu(this,t).get(t)};var Fu=function(t){return Lu(this,t).has(t)};var Nu=function(t,e){var i=Lu(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function Uu(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Uu.prototype.clear=Ou,Uu.prototype.delete=Bu,Uu.prototype.get=zu,Uu.prototype.has=Fu,Uu.prototype.set=Nu;var ku=Uu;function Vu(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var i=function(){var n=arguments,r=e?e.apply(this,n):n[0],s=i.cache;if(s.has(r))return s.get(r);var a=t.apply(this,n);return i.cache=s.set(r,a)||s,a};return i.cache=new(Vu.Cache||ku),i}Vu.Cache=ku;var ju=Vu;var Gu=function(t){var e=ju(t,function(t){return 500===i.size&&i.clear(),t}),i=e.cache;return e},Wu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hu=/\\(\\)?/g,qu=Gu(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Wu,function(t,i,n,r){e.push(n?r.replace(Hu,"$1"):i||t)}),e}),Xu=qu;var Yu=function(t){return null==t?"":Cc(t)};var Qu=function(t,e){return _c(t)?t:du(t,e)?[t]:Xu(Yu(t))};var Zu=function(t){if("string"==typeof t||wc(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e};var Ku=function(t,e){for(var i=0,n=(e=Qu(e,t)).length;null!=t&&i<n;)t=t[Zu(e[i++])];return i&&i==n?t:void 0};var Ju=function(t,e){for(var i=-1,n=e.length,r=t.length;++i<n;)t[r+i]=e[i];return t},$u=cc?cc.isConcatSpreadable:void 0;var tp=function(t){return _c(t)||Fd(t)||!!($u&&t&&t[$u])};var ep=function t(e,i,n,r,s){var a=-1,o=e.length;for(n||(n=tp),s||(s=[]);++a<o;){var l=e[a];i>0&&n(l)?i>1?t(l,i-1,n,r,s):Ju(s,l):r||(s[s.length]=l)}return s};var ip=function(t){return(null==t?0:t.length)?ep(t,1):[]};var np=function(t){return ud(Cd(t,void 0,ip),t+"")},rp=tu(Object.getPrototypeOf,Object),sp=Function.prototype,ap=Object.prototype,op=sp.toString,lp=ap.hasOwnProperty,hp=op.call(Object);var cp=function(t){if(!bc(t)||"[object Object]"!=xc(t))return!1;var e=rp(t);if(null===e)return!0;var i=lp.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&op.call(i)==hp};
2var dp=function(t,e,i){var n=-1,r=t.length;e<0&&(e=-e>r?0:r+e),(i=i>r?r:i)<0&&(i+=r),r=e>i?0:i-e>>>0,e>>>=0;for(var s=Array(r);++n<r;)s[n]=t[n+e];return s};var up=function(t,e,i){var n=t.length;return i=void 0===i?n:i,!e&&i>=n?t:dp(t,e,i)},pp=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var fp=function(t){return pp.test(t)};var mp=function(t){return t.split("")},gp="\\ud800-\\udfff",vp="["+gp+"]",yp="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",xp="\\ud83c[\\udffb-\\udfff]",bp="[^"+gp+"]",wp="(?:\\ud83c[\\udde6-\\uddff]){2}",Sp="[\\ud800-\\udbff][\\udc00-\\udfff]",_p="(?:"+yp+"|"+xp+")"+"?",Ap="[\\ufe0e\\ufe0f]?",Mp=Ap+_p+("(?:\\u200d(?:"+[bp,wp,Sp].join("|")+")"+Ap+_p+")*"),Cp="(?:"+[bp+yp+"?",yp,wp,Sp,vp].join("|")+")",Ep=RegExp(xp+"(?="+xp+")|"+Cp+Mp,"g");var Pp=function(t){return t.match(Ep)||[]};var Tp=function(t){return fp(t)?Pp(t):mp(t)};var Dp=function(){this.__data__=new Du,this.size=0};var Ip=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i};var Op=function(t){return this.__data__.get(t)};var Rp=function(t){return this.__data__.has(t)};var Lp=function(t,e){var i=this.__data__;if(i instanceof Du){var n=i.__data__;if(!Iu||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new ku(n)}return i.set(t,e),this.size=i.size,this};function Bp(t){var e=this.__data__=new Du(t);this.size=e.size}Bp.prototype.clear=Dp,Bp.prototype.delete=Ip,Bp.prototype.get=Op,Bp.prototype.has=Rp,Bp.prototype.set=Lp;var zp=Bp;var Fp=function(t,e){return t&&Ad(e,ru(e),t)};var Np=function(t,e){return t&&Ad(e,lu(e),t)},Up="object"==typeof exports&&exports&&!exports.nodeType&&exports,kp=Up&&"object"==typeof module&&module&&!module.nodeType&&module,Vp=kp&&kp.exports===Up?hc.Buffer:void 0,jp=Vp?Vp.allocUnsafe:void 0;var Gp=function(t,e){if(e)return t.slice();var i=t.length,n=jp?jp(i):new t.constructor(i);return t.copy(n),n};var Wp=function(t,e){for(var i=-1,n=null==t?0:t.length,r=0,s=[];++i<n;){var a=t[i];e(a,i,t)&&(s[r++]=a)}return s};var Hp=function(){return[]},qp=Object.prototype.propertyIsEnumerable,Xp=Object.getOwnPropertySymbols,Yp=Xp?function(t){return null==t?[]:(t=Object(t),Wp(Xp(t),function(e){return qp.call(t,e)}))}:Hp,Qp=Yp;var Zp=function(t,e){return Ad(t,Qp(t),e)},Kp=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Ju(e,Qp(t)),t=rp(t);return e}:Hp,Jp=Kp;var $p=function(t,e){return Ad(t,Jp(t),e)};var tf=function(t,e,i){var n=e(t);return _c(t)?n:Ju(n,i(t))};var ef=function(t){return tf(t,ru,Qp)};var nf=function(t){return tf(t,lu,Jp)},rf=$c(hc,"DataView"),sf=$c(hc,"Promise"),af=$c(hc,"Set"),of="[object Map]",lf="[object Promise]",hf="[object Set]",cf="[object WeakMap]",df="[object DataView]",uf=Wc(rf),pf=Wc(Iu),ff=Wc(sf),mf=Wc(af),gf=Wc(td),vf=xc;(rf&&vf(new rf(new ArrayBuffer(1)))!=df||Iu&&vf(new Iu)!=of||sf&&vf(sf.resolve())!=lf||af&&vf(new af)!=hf||td&&vf(new td)!=cf)&&(vf=function(t){var e=xc(t),i="[object Object]"==e?t.constructor:void 0,n=i?Wc(i):"";if(n)switch(n){case uf:return df;case pf:return of;case ff:return lf;case mf:return hf;case gf:return cf}return e});var yf=vf,xf=Object.prototype.hasOwnProperty;var bf=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xf.call(t,"index")&&(i.index=t.index,i.input=t.input),i},wf=hc.Uint8Array;var Sf=function(t){var e=new t.constructor(t.byteLength);return new wf(e).set(new wf(t)),e};var _f=function(t,e){var i=e?Sf(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)},Af=/\w*$/;var Mf=function(t){var e=new t.constructor(t.source,Af.exec(t));return e.lastIndex=t.lastIndex,e},Cf=cc?cc.prototype:void 0,Ef=Cf?Cf.valueOf:void 0;var Pf=function(t){return Ef?Object(Ef.call(t)):{}};var Tf=function(t,e){var i=e?Sf(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)};var Df=function(t,e,i){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return Sf(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return _f(t,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 Tf(t,i);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return Mf(t);case"[object Symbol]":return Pf(t)}};var If=function(t){return"function"!=typeof t.constructor||Dd(t)?{}:nd(rp(t))};var Of=function(t){return bc(t)&&"[object Map]"==yf(t)},Rf=Qd&&Qd.isMap,Lf=Rf?Hd(Rf):Of;var Bf=function(t){return bc(t)&&"[object Set]"==yf(t)},zf=Qd&&Qd.isSet,Ff=zf?Hd(zf):Bf,Nf="[object Arguments]",Uf="[object Function]",kf="[object Object]",Vf={};Vf[Nf]=Vf["[object Array]"]=Vf["[object ArrayBuffer]"]=Vf["[object DataView]"]=Vf["[object Boolean]"]=Vf["[object Date]"]=Vf["[object Float32Array]"]=Vf["[object Float64Array
2]"]=Vf["[object Int8Array]"]=Vf["[object Int16Array]"]=Vf["[object Int32Array]"]=Vf["[object Map]"]=Vf["[object Number]"]=Vf[kf]=Vf["[object RegExp]"]=Vf["[object Set]"]=Vf["[object String]"]=Vf["[object Symbol]"]=Vf["[object Uint8Array]"]=Vf["[object Uint8ClampedArray]"]=Vf["[object Uint16Array]"]=Vf["[object Uint32Array]"]=!0,Vf["[object Error]"]=Vf[Uf]=Vf["[object WeakMap]"]=!1;var jf=function t(e,i,n,r,s,a){var o,l=1&i,h=2&i,c=4&i;if(n&&(o=s?n(e,r,s,a):n(e)),void 0!==o)return o;if(!Ic(e))return e;var d=_c(e);if(d){if(o=bf(e),!l)return sd(e,o)}else{var u=yf(e),p=u==Uf||"[object GeneratorFunction]"==u;if(jd(e))return Gp(e,l);if(u==kf||u==Nf||p&&!s){if(o=h||p?{}:If(e),!l)return h?$p(e,Np(o,e)):Zp(e,Fp(o,e))}else{if(!Vf[u])return s?e:{};o=Df(e,u,l)}}a||(a=new zp);var f=a.get(e);if(f)return f;a.set(e,o),Ff(e)?e.forEach(function(r){o.add(t(r,i,n,r,e,a))}):Lf(e)&&e.forEach(function(r,s){o.set(s,t(r,i,n,s,e,a))});var m=d?void 0:(c?h?nf:ef:h?lu:ru)(e);return pd(m||e,function(r,s){m&&(r=e[s=r]),_d(o,s,t(r,i,n,s,e,a))}),o};var Gf=function(t){return jf(t,5)};var Wf=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Hf=function(t){return this.__data__.has(t)};function qf(t){var e=-1,i=null==t?0:t.length;for(this.__data__=new ku;++e<i;)this.add(t[e])}qf.prototype.add=qf.prototype.push=Wf,qf.prototype.has=Hf;var Xf=qf;var Yf=function(t,e){for(var i=-1,n=null==t?0:t.length;++i<n;)if(e(t[i],i,t))return!0;return!1};var Qf=function(t,e){return t.has(e)};var Zf=function(t,e,i,n,r,s){var a=1&i,o=t.length,l=e.length;if(o!=l&&!(a&&l>o))return!1;var h=s.get(t),c=s.get(e);if(h&&c)return h==e&&c==t;var d=-1,u=!0,p=2&i?new Xf:void 0;for(s.set(t,e),s.set(e,t);++d<o;){var f=t[d],m=e[d];if(n)var g=a?n(m,f,d,e,t,s):n(f,m,d,t,e,s);if(void 0!==g){if(g)continue;u=!1;break}if(p){if(!Yf(e,function(t,e){if(!Qf(p,e)&&(f===t||r(f,t,i,n,s)))return p.push(e)})){u=!1;break}}else if(f!==m&&!r(f,m,i,n,s)){u=!1;break}}return s.delete(t),s.delete(e),u};var Kf=function(t){var e=-1,i=Array(t.size);return t.forEach(function(t,n){i[++e]=[n,t]}),i};var Jf=function(t){var e=-1,i=Array(t.size);return t.forEach(function(t){i[++e]=t}),i},$f=cc?cc.prototype:void 0,tm=$f?$f.valueOf:void 0;var em=function(t,e,i,n,r,s,a){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!s(new wf(t),new wf(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return wd(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var o=Kf;case"[object Set]":var l=1&n;if(o||(o=Jf),t.size!=e.size&&!l)return!1;var h=a.get(t);if(h)return h==e;n|=2,a.set(t,e);var c=Zf(o(t),o(e),n,r,s,a);return a.delete(t),c;case"[object Symbol]":if(tm)return tm.call(t)==tm.call(e)}return!1},im=Object.prototype.hasOwnProperty;var nm=function(t,e,i,n,r,s){var a=1&i,o=ef(t),l=o.length;if(l!=ef(e).length&&!a)return!1;for(var h=l;h--;){var c=o[h];if(!(a?c in e:im.call(e,c)))return!1}var d=s.get(t),u=s.get(e);if(d&&u)return d==e&&u==t;var p=!0;s.set(t,e),s.set(e,t);for(var f=a;++h<l;){var m=t[c=o[h]],g=e[c];if(n)var v=a?n(g,m,c,e,t,s):n(m,g,c,t,e,s);if(!(void 0===v?m===g||r(m,g,i,n,s):v)){p=!1;break}f||(f="constructor"==c)}if(p&&!f){var y=t.constructor,x=e.constructor;y!=x&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x)&&(p=!1)}return s.delete(t),s.delete(e),p},rm="[object Arguments]",sm="[object Array]",am="[object Object]",om=Object.prototype.hasOwnProperty;var lm=function(t,e,i,n,r,s){var a=_c(t),o=_c(e),l=a?sm:yf(t),h=o?sm:yf(e),c=(l=l==rm?am:l)==am,d=(h=h==rm?am:h)==am,u=l==h;if(u&&jd(t)){if(!jd(e))return!1;a=!0,c=!1}if(u&&!c)return s||(s=new zp),a||Kd(t)?Zf(t,e,i,n,r,s):em(t,e,l,i,n,r,s);if(!(1&i)){var p=c&&om.call(t,"__wrapped__"),f=d&&om.call(e,"__wrapped__");
2if(p||f){var m=p?t.value():t,g=f?e.value():e;return s||(s=new zp),r(m,g,i,n,s)}}return!!u&&(s||(s=new zp),nm(t,e,i,n,r,s))};var hm=function t(e,i,n,r,s){return e===i||(null==e||null==i||!bc(e)&&!bc(i)?e!=e&&i!=i:lm(e,i,n,r,t,s))};var cm=function(t,e){return null!=t&&e in Object(t)};var dm=function(t,e,i){for(var n=-1,r=(e=Qu(e,t)).length,s=!1;++n<r;){var a=Zu(e[n]);if(!(s=null!=t&&i(t,a)))break;t=t[a]}return s||++n!=r?s:!!(r=null==t?0:t.length)&&Ed(r)&&xd(a,r)&&(_c(t)||Fd(t))};var um=function(t,e){return null!=t&&dm(t,e,cm)},pm=function(){return hc.Date.now()},fm=Math.max,mm=Math.min;var gm=function(t,e,i){var n,r,s,a,o,l,h=0,c=!1,d=!1,u=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function p(e){var i=n,s=r;return n=r=void 0,h=e,a=t.apply(s,i)}function f(t){var i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=s}function m(){var t=pm();if(f(t))return g(t);o=setTimeout(m,function(t){var i=e-(t-l);return d?mm(i,s-(t-h)):i}(t))}function g(t){return o=void 0,u&&n?p(t):(n=r=void 0,a)}function v(){var t=pm(),i=f(t);if(n=arguments,r=this,l=t,i){if(void 0===o)return function(t){return h=t,o=setTimeout(m,e),c?p(t):a}(l);if(d)return clearTimeout(o),o=setTimeout(m,e),p(l)}return void 0===o&&(o=setTimeout(m,e)),a}return e=zc(e)||0,Ic(i)&&(c=!!i.leading,s=(d="maxWait"in i)?fm(zc(i.maxWait)||0,e):s,u="trailing"in i?!!i.trailing:u),v.cancel=function(){void 0!==o&&clearTimeout(o),h=0,n=l=r=o=void 0},v.flush=function(){return void 0===o?a:g(pm())},v};var vm=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0};var ym=function(t,e){return t>e};var xm=function(t,e){return e.length<2?t:Ku(t,dp(e,0,-1))};var bm=function(t,e){return hm(t,e)};var wm=function(t,e,i){for(var n=-1,r=t.length;++n<r;){var s=t[n],a=e(s);if(null!=a&&(void 0===o?a==a&&!wc(a):i(a,o)))var o=a,l=s}return l};var Sm=function(t){return t&&t.length?wm(t,Fc,ym):void 0};var _m=function(t,e){return e=Qu(e,t),null==(t=xm(t,e))||delete t[Zu(vm(e))]};var Am=function(t){return cp(t)?void 0:t},Mm=np(function(t,e){var i={};if(null==t)return i;var n=!1;e=Sc(e,function(e){return e=Qu(e,t),n||(n=e.length>1),e}),Ad(t,nf(t),i),n&&(i=jf(i,7,Am));for(var r=e.length;r--;)_m(i,e[r]);return i}),Cm=Mm;var Em=function(t,e,i,n){if(!Ic(t))return t;for(var r=-1,s=(e=Qu(e,t)).length,a=s-1,o=t;null!=o&&++r<s;){var l=Zu(e[r]),h=i;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(r!=a){var c=o[l];void 0===(h=n?n(c,l,o):void 0)&&(h=Ic(c)?c:xd(e[r+1])?[]:{})}_d(o,l,h),o=o[l]}return t};var Pm=function(t,e,i){for(var n=-1,r=e.length,s={};++n<r;){var a=e[n],o=Ku(t,a);i(o,a)&&Em(s,Qu(a,t),o)}return s};var Tm=function(t,e){return Pm(t,e,function(e,i){return um(t,i)})},Dm=np(function(t,e){return null==t?{}:Tm(t,e)}),Im=Dm;var Om=function(t,e,i){var n=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return Ic(i)&&(n="leading"in i?!!i.leading:n,r="trailing"in i?!!i.trailing:r),gm(t,e,{leading:n,maxWait:e,trailing:r})};var Rm=function(t,e){for(var i=t.length;i--&&vd(e,t[i],0)>-1;);return i};var Lm=function(t,e,i){if((t=Yu(t))&&(i||void 0===e))return t.slice(0,Pc(t)+1);if(!t||!(e=Cc(e)))return t;var n=Tp(t),r=Rm(n,Tp(e))+1;return up(n,0,r).join("")};function Bm(t){for(let e of Object.keys(t))void 0===t[e]&&delete t[e];return t}function zm(t,e){return Object.setPrototypeOf(t,e),t}var Fm=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().includes(" electron/");Fm&&(()=>{if(typeof window>"u")return;let t=new URLSearchParams(window.location.search).get("desktop-app-version");t?window.localStorage.setItem("desktop-app-version",t):window.localStorage.getItem("desktop-app-version")})();var Nm=!(typeof window>"u")&&window.navigator.platform.toUpperCase().includes("MAC"),Um=!(typeof window>"u")&&(/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Nm&&"ontouchend"in document),km=!(typeof window>"u")&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Vm=!(typeof window>"u")&&("ontouchstart"in window||navigator.maxTouchPoints>0),jm=(()=>{if(typeof window>"u")return!1;let t=navigator.userAgent,e=navigator.vendor;return/Safari/i.test(t)&&/Apple Computer/.test(e)})(),Gm=Number((()=>
2{if(typeof window>"u")return null;let t=navigator.userAgent.match(/Version\/(\d+\.\d)/);return t&&t[1]})());function Wm(t){return Array.isArray(t)?t:[t]}function Hm(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}function qm(t){return Nm?t.metaKey:t.ctrlKey}var Xm=[],Ym={},Qm={},Zm={};function Km(t){Xm.includes(t)||Xm.push(t)}function Jm(t){delete Ym[t.pointerId];for(let e=0;e<Xm.length;e++)if(Xm[e].pointerId===t.pointerId){Xm.splice(e,1);break}}function $m(t){if("touch"!==t.pointerType)return;let e=Ym[t.pointerId];void 0===e&&(e={x:0,y:0},Ym[t.pointerId]=e),e.x=t.pageX,e.y=t.pageY}function tg(t){let e=t.pointerId===Xm[0].pointerId?Xm[1]:Xm[0];return Ym[e.pointerId]}function eg(t){Qm[t.key]=!0,Zm[t.key]=void 0===Zm[t.key]?1:Zm[t.key]+1}function ig(t){if(Nm&&Qm.Meta)for(let e in Qm)Qm[e]=!1;else Qm[t.key]=!1;Zm={}}var ng,rg,sg=new Promise(t=>{ng=t});function ag(t){if(rg)return rg;return rg=async function(){let i=t??"https://unpkg.com/@splinetool/[email protected]/build",n=e(()=>import("./navmesh-DbVjNp65.js"),[]),[r,s]=await Promise.all([n,fetch(`${i}/navmesh.wasm`).then(t=>t.arrayBuffer())]),a=r.default,o=await a({wasmBinary:s});ng(o)}()}var og,lg,hg=new Promise(t=>{og=t});function cg(){if(lg)return lg;return lg=async function(){let t=await e(()=>import("./physics-BUckeimk.js"),[]);await t.init(),og(t)}()}var dg=class{modifyById(t,e){let i=this;if(void 0===i[t])throw new Error("not expected");{let n={...i,[t]:e};return Object.setPrototypeOf(n,dg.prototype),n}}add(t,e){return this.runOp({type:1,id:t,data:e})?.data??this}runOp(t){let e=this;if(1===t.type){let i,n=e[t.id];i=void 0===n?{type:2,id:t.id}:{type:1,id:t.id,data:n};let{id:r,data:s}=t,a={...e,[r]:s};return Object.setPrototypeOf(a,dg.prototype),{data:a,actual:t,reverse:i}}if(2===t.type){let{id:i}=t,n=e[i];if(void 0===n)return null;{let r={...e};return Object.setPrototypeOf(r,dg.prototype),delete r[i],{data:r,actual:t,reverse:{type:1,id:i,data:n}}}}return null}};function ug(t){if(void 0!==t.deepFreeze)return void t.deepFreeze(t);let e=Object.getOwnPropertyNames(t);for(let i of e){let e=t[i];e&&"object"==typeof e&&ug(e)}return Object.freeze(t)}var pg=class extends Error{};function fg(t){let e={...t};return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}function mg(t,e,i){if(void 0===t?void 0===e?(t=0,e=10):t=e-10:void 0===e&&(e=t+10),t>e){let i=t;t=e,e=i}let n=[],r=1/(i+1);for(let s=0;s<i;s++){let i=t+(e-t)*(s+.75+.5*Math.random())*r;n.push(i)}return n}function gg(t){return t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof Float32Array||t instanceof Float64Array}function vg(t,e){for(let i of t)!0!==e(i.id,i.data)&&vg(i.children,e)}function yg(t,e){if(!0!==e(t.id,t.data))for(let i of t.children)yg(i,e)}var xg,bg=class extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,bg.prototype)}deepFreeze(){let t=0;for(;t<this.length;)ug(this[t]),t++}fillCaches0(t,e){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,e);for(let i of t.children)this.fillCaches0(i,t.id)}fillCaches(){if(void 0===this.objCaches){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(0!==t.length)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}nonExistOrDescendantOf(t,e){if(!this.has(t))return!0;for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}rootAcestor(t){for(;t;){let e=this.parent(t);if(!e)return t;t=e}return t}isDescendantOf(t,e){for(;t;){let i=this.parent(t);if(i===e)return!0;t=i}return!1}data(t){return this.get(t)?.data}has(t){return void 0!==this.childrenOf(t)}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){return null===t?this:this.get(t)?.children}traverseFrom(t,e){if(null===t)this.traverse(e);else{let i=this.get(t);i&&yg(i,e)}}traverse(t){vg(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return null===t?this:this.get(t).children}modifyById(t,e){if(void 0===this.get(t))throw new Error("not expected");{let i=this.parent(t),n=this.childrenArray(i),r=n.findIndex(e=>e.id===t);if(r<0)throw new Error("not expected");let s=n[r];return n=[...n],n[r]={...s,data:e},this.modifyArrayBy(i,n)}}modifyArrayBy(t,e){let i=t,n=e;for(;null!==i;){let t=n,e=i;if(i=this.parent(i),void 0===i)throw new Error;n=this.childrenArray(i);let r=n.findIndex(t=>t.id===e);if(r<0)throw new Error;n=[...n],n[r]={...n[r],children:t}}Object.setPrototypeOf(n,bg.prototype);let r=n;return r.fillCaches(),r}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}return null}checkDuplicatedIdRec({id:t,children:e}){if(void 0!==this.get(t))return!0;for(let i of e)if(this.checkDuplicatedIdRec(i))return!0;return!1}
vendor: 17,906 bytes, line 2
2addOp(t){let{parent:e,fi:i,id:n,data:r,children:s}=t;if(null!==e&&void 0===this.get(e))return null;if(this.checkDuplicatedIdRec(t))return null;{let a=e,o=this.childrenArray(a),l={fi:i,id:n,data:r,children:s};return o=[...o,l],o.sort((t,e)=>t.fi-e.fi),t.localIndex=o.indexOf(l),{data:this.modifyArrayBy(a,o),actual:t,reverse:{type:8,id:n}}}}deleteOp(t){let{id:e}=t;if(null===this.get(e))return null;{let i=this.parent(e);if(void 0===i)return null;let n=this.childrenArray(i),r=n.findIndex(t=>t.id===e);t.localIndex=r,n=[...n];let s=n.splice(r,1)[0];return{data:this.modifyArrayBy(i,n),actual:t,reverse:{type:7,...s,parent:i}}}}moveOp(t){let{parent:e,fi:i,id:n}=t;if(null!==e&&void 0===this.get(e))return this.deleteOp({type:8,id:n});if(null!==e){let t=e;for(;null!==t;){if(void 0===t)throw new Error;if(t===n)throw new pg("cyclic tree");t=this.parent(t)}}let r=this.parent(n);if(void 0===r)return null;let s=r,a=this.childrenArray(r),o=a.findIndex(t=>t.id===n);a=[...a];let l=a.splice(o,1)[0],h=this.modifyArrayBy(r,a);r=e,a=h.childrenArray(r);let c=l.fi;return l={...l,fi:i},a=[...a,l],a.sort((t,e)=>t.fi-e.fi),t.localIndex=a.indexOf(l),h=h.modifyArrayBy(r,a),{data:h,actual:t,reverse:{type:9,parent:s,fi:c,id:n}}}previous(t,e){if(null===e){let e=this.childrenArray(t);return 0===e.length?null:e[e.length-1].id}let i=null;for(let n of this.childrenArray(t)){if(n.id===e)return i;i=n.id}return null}traverseSortNext(t){let e=this.parent(t);if(void 0!==e){let i=this.childrenArray(e),n=i.findIndex(e=>e.id===t)+1;if(n<i.length)return i[n].id;if(e)return this.traverseSortNext(e)}}sortNext(t){let e=this.childrenArray(t);return e.length>0?e[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let e=this.childrenArray(t);return e.length>0?this.traverseSortPrevious(e[e.length-1].id):t}sortPrevious(t){let e=this.parent(t);if(void 0!==e){let i=this.childrenArray(e),n=i.findIndex(e=>e.id===t)-1;return n>=0?this.traverseSortPrevious(i[n].id):e}}getAllSorted(t){let e=[];for(let i of t){let t=this.getWithSortKey(i.id);void 0!==t&&e.push({...i,...t})}e.sort((t,e)=>function(t,e){let i=0;for(;i<t.length&&i<e.length;){if(t[i]<e[i])return-1;if(t[i]>e[i])return 1;i+=1}return i!==e.length?-1:i!==t.length?1:0}(t.sortKey,e.sortKey));for(let i of e)delete i.sortKey;return e}getWithSortKey(t){var e=t;let i=[],n=this.get(e),r=n;if(void 0!==n){for(;e;)i.splice(0,0,n.fi),null!==(e=this.parent(e))&&(n=this.get(e));return{...r,sortKey:i}}}insertBeforeHelper(t,e,i){return this.insertAfterHelper(t,this.previous(t,e),i)}insertAfterHelper(t,e,i){let n=this.childrenArray(t);if(null===e){if(0===n.length)return mg(0,i,i);{let t=n[0].fi;return mg(t-i,t,i)}}{let r=this.get(e);if(void 0===r||this.parent(e)!==t)throw new Error("illegal args");let s=n.find(t=>t.fi>r.fi);if(void 0===s){let t=n[n.length-1].fi;return mg(t,t+i,i)}return mg(r.fi,s.fi,i)}}};(xg||(xg={})).runOp=function(t,e){if(0!==e.type)return null;if(Array.isArray(t)){let i=e.props,n={},r=[...t],s=!1;if(i)for(let t of Object.keys(i)){let e=parseInt(t);if(isNaN(e))throw new Error("wrong index");n[t]=r[e],r[e]=i[t],s=!0}return s?{data:r,actual:e,reverse:{type:0,props:n}}:null}{let i=e.props,n={},r={...t},s=!1;if(i)for(let t of Object.keys(i)){n[t]=r[t];let e=i[t];void 0===e?delete r[t]:r[t]=e,s=!0}return s?{data:r,actual:e,reverse:{type:0,props:n}}:null}};var wg=class extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,wg.prototype)}deepFreeze(){let t=0;for(;t<this.length;)ug(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(void 0===this.objCaches){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(0!==t.length)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){return this.get(t)?.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,e){if(void 0===this.get(t))throw new Error("not expected");{let i=this,n=i.findIndex(e=>e.id===t);if(n<0)throw new Error("not expected");let r=i[n];return i=[...i],i[n]={...r,data:e},this.modifyArrayBy(i)}}modifyArrayBy(t){Object.setPrototypeOf(t,wg.prototype);let e=t;return typeof process<"u"||e.fillCaches(),e}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}return null}addOp(t){let{fi:e,id:i,data:n}=t,r=this,s={fi:e,id:i,data:n};return r=[...r,s],r.sort((t,e)=>t.fi-e.fi),t.localIndex=r.indexOf(s),{data:this.modifyArrayBy(r),actual:t,reverse:{type:5,id:i}}}deleteOp(t){let{id:e}=t,i=this,n=i.findIndex(t=>t.id===e);if(-1===n)return null;t.localIndex=n,i=[...i];let r=i.splice(n,1)[0];return{data:this.modifyArrayBy(i),actual:t,reverse:{type:4,...r}}}moveOp(t){let{fi:e,id:i}=t,n=this;n=[...n];let r=n.findIndex(t=>t.id===i);if(-1===r)return null;let s=n[r].fi,a={...n[r],fi:e};return n[r]=a,n.sort((t,e)=>t.fi-e.fi),t.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:t,reverse:{type:6,fi:s,id:i}}}previous(t){if(null===t)return 0===this.length?null:this[this.length-1].id;let e=null;for(let i of this){if(i.id===t)return e;e=i.id}return null}insertBeforeHelper(t,e){return this.insertAfterHelper(this.previous(t),e)}insertAfterHelper(t,e){let i=this;if(null===t){if(0===i.length)return mg(0,e,e);{let t=i[0].fi;return mg(t-e,t,e)}}{let n=this.get(t);if(void 0===n)throw new Error("illegal args");let r=i.find(t=>t.fi>n.fi);if(void 0===r){let t=i[i.length-1].fi;return mg(t,t+e,e)}return mg(n.fi,r.fi,e)}}};function Sg(t){return t&&"object"==typeof t&&t instanceof Pg}var _g,Ag,Mg,Cg,Eg,Pg=class{unusedFunOverridesTable(t){}runOp(t){let e=[],i=this,n=0,r={};for(;n<t.path.length;){if(e.push(i),i=void 0===i?void 0:i[t.path[n]],void 0!==i&&!Sg(i))return null;n+=1}i=i?fg(i):new Pg;for(let[s,a]of Object.entries(t.props)){let t=i[s];r[s]=t,void 0===a?delete i[s]:i[s]=a}for(;n>0;){if(0===Object.keys(i).length){let r=e[n-1];r&&(i=fg(r),delete i[t.path[n-1]])}else{let r=e[n-1];if(r){let e=fg(r);e[t.path[n-1]]=i,i=e}else{let e=new Pg;e[t.path[n-1]]=i,i=e}}n-=1}return{data:Object.setPrototypeOf(i,Pg.prototype),actual:t,reverse:{...t,props:r}}}};function Tg(t,e){if(void 0===e)return;let i=!1,n=t.map(t=>{let n=t.id,r=Dg(t.data,e[n]);if(i=i||void 0!==r,void 0===r&&(r=t.data),t.children){let s=Tg(t.children,e);return void 0!==s?i=!0:s=t.children,{...t,id:n,data:r,children:s}}return{...t,id:n,data:r}});return i?n:void 0}function Dg(t,e){if(!Sg(e))return e;if(t instanceof bg){let i=Tg(t,e);return void 0!==i&&Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i}if(t instanceof wg)return function(t,e){if(void 0===e)return;let i=!1,n=t.map(t=>{let n=t.id,r=Dg(t.data,e[n]);return i=i||void 0!==r,void 0===r&&(r=t.data),{...t,id:n,data:r}});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}(t,e);if(Array.isArray(t)){let i=!1,n=t.map((t,n)=>{let r=Dg(t,e[n]);return i=i||void 0!==r,void 0===r&&(r=t),r});return i?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if(t instanceof Pg)return Ig(t,e);if(t&&"object"==typeof t){let i={},n=!1;for(let[r,s]of Object.entries(t)){let t=Dg(s,e[r]);n=n||void 0!==t,void 0===t&&(t=s),i[r]=t}return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(t)),i):void 0}}function Ig(t,e){if(void 0===t)return e;if(void 0===e)return t;if(!Sg(e))return e;if(!Sg(t))return _g.apply(t,e);let i=new Set;for(let r of Object.keys(t))i.add(r);for(let r of Object.keys(e))i.add(r);let n=new Pg;for(let r of i){let i=Ig(void 0===t?void 0:t[r],void 0===e?void 0:e[r]);n[r]=i}return n}function Og(t,e){let i={cur:[],result:[],len:0};return[t=zg(t,e,i)??t,i.result]}function Rg(t,e){return null===t?null:(t.cur[t.len]=e,t.len+=1,t)}function Lg(t){t&&(t.len-=1)}function Bg(t,e,i){let n=!1,r=t.map(t=>{let r=t.id,s=e[r];if(void 0!==s&&"string"==typeof s&&(n=!0,r=s,null!==i))throw new Error("not supported");let a=zg(t.data,e,Rg(i,r));Lg(i),n=n||void 0!==a,void 0===a&&(a=t.data);let o=Bg(t.children,e,i);return void 0!==o?n=!0:o=t.children,{...t,id:r,data:a,children:o}});if(n)return r}function zg(t,e,i){if(t instanceof bg){let n=Bg(t,e,i);return void 0!==n&&Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}if(t instanceof wg)return function(t,e,i){let n=!1,r=t.map(t=>{let r=t.id,s=e[r];if(void 0!==s&&"string"==typeof s&&(n=!0,r=s,null!==i))throw new Error("not supported");let a=zg(t.data,e,Rg(i,r));return Lg(i),n=n||void 0!==a,void 0===a&&(a=t.data),{...t,id:r,data:a}});if(n)return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}(t,e,i);if(Array.isArray(t)){let n=!1,r=t.map((t,r)=>{let s=zg(t,e,Rg(i,r));return Lg(i),n=n||void 0!==s,void 0===s&&(s=t),s});return n?(Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r):void 0}if(t&&"object"==typeof t&&!gg(t)){let n={},r=!1;for(let[s,a]of Object.entries(t))if("name"!==s&&"variableId"!==s){let t=e[s];if("string"==typeof t){if(null!==i)throw new Error("not supported");r=!0,s=t}let o=zg(a,e,Rg(i,s));Lg(i),r=r||void 0!==o,void 0===o&&(o=a),n[s]=o}else n[s]=a;return r?(Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n):void 0}if("string"==typeof t){let n=e[t];return void 0!==n&&function(t){if(null===t)return null;t.result.push(t.cur.slice(0,t.len))}(i),n}}(Ag=_g||(_g={})).apply=function(t,e){return Dg(t,e)??t},Ag.merge=function(t,e){return Ig(t,e)},Ag.filterOp=function(t,e){let i=0,n=e.path,r=t;for(;i<n.length&&void 0!==r;){if(r=Qg.zoomOnce(r,n[i]),void 0===r)return e;if(!Sg(r))return;i+=1}if(void 0===r)return e;if(Sg(r)){if(0===e.type){let t={...e.props};for(let e of Object.keys(r))delete t[e];return{...e,props:t}}if(1===e.type||4===e.type||7===e.type){let t=Tg([e],r);return t||e}return e}},(Mg||(Mg={})).replaceProps=function(t,e){let i=Qg.zoom(e,t.path);if("object"==typeof i){let e={};for(let n of Object.keys(t.props))e[n]=i[n];return{...t,props:e}}return{...t,props:{}}},(t=>{function e(t,e){let i=e.path;for(var n=[];;){let r;if(t instanceof Pg&&0===e.type&&(r=t.runOp({...e,path:i.slice(n.length)}),null===r&&(r=void 0)),void 0===r&&n.length===i.length&&(r=t instanceof bg||t instanceof wg||t instanceof dg?t.runOp(e):xg.runOp(t,e)),void 0!==r){if(null!==r){let t=r.data;for(let e=n.length-1;e>=0;e--){let r=i[e],s=n[e];if(s instanceof bg){if("number"==typeof r)throw new Error("illegal arg");t=s.modifyById(r,t)}else if(s instanceof wg){if("number"==typeof r)throw new Error("illegal arg");t=s.modifyById(r,t)}else if(s instanceof dg){if("number"==typeof r)throw new Error("illegal arg");t=s.modifyById(r,t)}else if(s instanceof Pg){let e={...s,[r]:t};t=Object.setPrototypeOf(e,Pg.prototype)}else{if("object"!=typeof s)return null;if(Array.isArray(s)){if("string"==typeof r&&(r=parseInt(r),isNaN(r)))throw new Error("Invalid path");let e=t;t=[...s],t[r]=e}else t={...s,[r]:t}}}return{data:t,actual:{...r.actual,path:i},reverse:{...r.reverse,path:i}}}return null}let s,a=i[n.length];if(t instanceof bg){if("number"==typeof a)throw new Error("");s=t.get(a)?.data}else if(t instanceof wg){if("number"==typeof a)throw new Error("");s=t.get(a)?.data}else null!==t&&(s=t[a]);if(void 0===s)return null;n.push(t),t=s}}function i(t,e){for(let i=0;i<t.length&&i<e.length;i++)if(t[i]!==e[i])return!0;return!1}function n(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}t.drop=function(t,e){return{...t,path:t.path.slice(e)}},t.applySimple=function(t,i){return e(t,i)?.data??t},t.apply=e,t.pathDisjoint=i,t.pathEq=n,t.commutative=function(t,e){return i(t.path,e.path)},t.subsumed=function(t,e){return!(0!==t.type||0!==e.type||!n(t.path,e.path))&&Object.keys(t.props).every(t=>void 0!==e.props[t])}})(Cg||(Cg={})),(t=>{function e(t,e){var i=t;let n=[],r=[];for(let a of e)try{if(3===a.type||5===a.type&&"variables"===a.path[a.path.length-1]){let t,e,s;if(3===a.type?(t=Qg.zoom(i,[...a.path,a.id]),s=Cg.apply(i,{...a,type:2})):(t=Qg.zoom(i,[...a.path,a.id,"value"]),s=Cg.apply(i,a)),null!==s){i=s.data;let[o,l]=Og(i,{[a.id]:t});i=o;for(let s=0;s<l.length;s++){let o=l[s],h=o.pop();if("number"==typeof h){let n=[h];for(let t=s+1;t<l.length;t++){let e=l[t],i=e[e.length-1];if("number"!=typeof i||!Qg.equal(o,e.slice(0,e.length-1)))break;n.push(i),l.splice(t,1)}let r=Qg.zoom(i,o);e=r.map((t,e)=>n.includes(e)?a.id:t),t=r,h=o.pop()}else{if("alphaOverride"===h||"alpha"===h){t/=100;let e=t,n=Qg.zoom(i,o.slice(0,o.length-2)),r=n.layers.map(t=>t.id===o[o.length-1]?{...t,data:{...t.data,[h]:e}}:t);Object.setPrototypeOf(r,Object.getPrototypeOf(n.layers)),n.layers=r}e=a.id}n.push({type:0,path:o,props:{[h]:t}}),r.push({type:0,path:o,props:{[h]:e}})}r.push(s.reverse),n.push(s.actual)}}else{let t=Cg.apply(i,a);null!==t&&(n.push(t.actual),i=t.data,r.push(t.reverse))}}catch(s){if(s instanceof pg)return null;throw s}return{data:i,actual:n,reverse:r.reverse()}}t.empty=function(){return[]},t.removePrefix=function(t,e){let i=[];for(let n of t){let[t,...r]=n.path;t===e&&i.push({...n,path:r})}return i},t.addPrefix=function(t,e){return t.map(t=>({...t,path:[e,...t.path]}))},t.concat=function(t,e){return[...t,...e]},t.compress=function(t,e){return[...t.filter(t=>!e.some(e=>Cg.subsumed(t,e))),...e]},t.commutative=function(t,e){return t.every(t=>e.every(e=>Cg.commutative(t,e)))},t.applyAll=function(t,i){for(let n of i){let i=e(t,n);null!==i&&(t=i.data)}return t},t.apply=e})(Eg||(Eg={}));var Fg=Symbol(),Ng=Symbol(),Ug=Symbol(),kg=class{reportOp(t,e,i=[]){let n=this;if(null===e)return;n._current=e.data;let r=i;for(;!(n instanceof Zg);){let t=n._path,e=n._current;if(""!==t&&r.splice(0,0,t),n=n._parent,null===n)return;n.update(t,e)}n.push(r,t,e.actual,e.reverse)}deleteChildren(t){if(this._children){let e=this._children[t];if(e){let i=e[Ug];i&&i(),delete this._children[t]}}}},Vg=class extends kg{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){if(Array.isArray(this._current)){if("string"==typeof t&&(t=parseInt(t),isNaN(t)))throw new Error("Invalid path");this._current=[...this._current],this._current[t]=e}else this._current={...this._current,[t]:e}}runOp(t){this.reportOp(t,xg.runOp(this._current,t),t.path)}},jg=class extends kg{constructor(t,e,i){super(),this._parent=t,this._path=e,this._current=i}update(t,e){this._current={...this._current,[t]:e},Object.setPrototypeOf(this._current,dg.prototype)}runOp(t){this.reportOp(t,this._current.runOp(t))}},Gg={get(t,e){if(e===Ug)return()=>{t._parent=null};if(e===Fg)return t._current;if(e===Ng)return t;let{_current:i,_children:n}=t;if("push"===e&&Array.isArray(i))throw new Error("not supported to expand array");let r=void 0===n?void 0:n[e];if(void 0!==r)return r;let s=i[e],a=Kg(t,e,s);return a!==s?(void 0===n&&(n={},t._children=n),n[e]=a,a):s},has:(t,e)=>e in t._current,ownKeys:t=>Reflect.ownKeys(t._current),defineProperty(){throw Error("not supported")},getPrototypeOf:t=>Object.getPrototypeOf(t._current),setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(t,e){let i=t._current,n=Reflect.getOwnPropertyDescriptor(i,e);return n&&{writable:!0,configurable:!0,enumerable:n.enumerable,value:i[e]}}},Wg={...Gg,set(t,e,i){let n={type:0,props:{[e]:tv(i)??i}};return t.deleteChildren(e),t.runOp(n),!0},deleteProperty(t,e){let i={type:0,props:{[e]:void 0}};return t.deleteChildren(e),t.runOp(i),!0}},Hg={...Gg,set(t,e,i){return void 0===i?this.deleteProperty(t,e):(t.deleteChildren(e),t.runOp({type:1,id:e,data:i})),!0},deleteProperty:(t,e)=>(t.runOp({type:2,id:e}),!0)},qg=class extends kg{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Ug]=()=>{this._parent=null}}unproxy(){return this._current}update(t,e){this._current=this._current.modifyById(t,e)}runOp(t){this.reportOp(t,this._current.runOp(t))}randomId(){return this._current.randomId()}isDescendantOf(t,e){return this._current.isDescendantOf(t,e)}childrenOf(t){return this._current.childrenOf(t)}traverse(t){return this._current.traverse(t)}get(t){return this._current.get(t)}parent(t){return this._current.parent(t)}traverse(t){this._current.traverse((e,i)=>{t(e,this.data(e))})}data(t){let{_current:e,_children:i}=this,n=void 0===i?void 0:i[t];if(void 0!==n)return n;let r=e.get(t)?.data,s=Kg(this,t,r);return s!==r?(void 0===i&&(i={},this._children=i),i[t]=s,s):r}add(t,e,i,n,r){this.runOp({type:7,parent:t,fi:e,id:i,data:n,children:r})}move(t,e,i){this.runOp({type:9,parent:t,fi:e,id:i})}insertAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let e=i[r];this.add(t,n[r],e.id,e.data,e.children)}}insertBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let e=i[r];this.add(t,n[r],e.id,e.data,e.children)}}moveAfter(t,e,i){let n=this._current.insertAfterHelper(t,e,i.length);for(let r=0;r<i.length;r++){let e=i[r];this.move(t,n[r],e)}}moveBefore(t,e,i){let n=this._current.insertBeforeHelper(t,e,i.length);for(let r=0;r<i.length;r++){let e=i[r];this.move(t,n[r],e)}}delete(t){this.deleteChildren(t),this.runOp({type:8,id:t})}sortNext(t){return this._current.sortNext(t)}sortPrevious(t){return this._current.sortPrevious(t)}getAllSorted(t){return this._current.getAllSorted(t)}},Xg=class extends kg{constructor(t,e,i){super(),this._children={},this._parent=t,this._path=e,this._current=i,this[Ug]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(t){let e=this.length;for(let i=0;i<e;i++){let e=this._current[i].id,n=this._current[i].fi;t(this.data(this._current[i].id),e,n)}}find(t){let e=this.length;for(let i=0;i<e;i++){let e=this._current[i].id;if(t(this.data(e),e))return this.get(e)}}update(t,e){this._current=this._current.modifyById(t,e)}randomId(){return this._current.randomId()}get(t){return{...this._current.get(t),data:this.data(t)}}data(t){let{_current:e,_children:i}=this,n=void 0===i?void 0:i[t];if(void 0!==n)return n;let r=e.get(t)?.data,s=Kg(this,t,r);return s!==r?(void 0===i&&(i={},this._children=i),i[t]=s,s):r}runOp(t){this.reportOp(t,this._current.runOp(t))}
2add(t,e,i){this.runOp({type:4,fi:t,id:e,data:i})}move(t,e){this.runOp({type:6,fi:t,id:e})}insertAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let t=e[n];this.add(i[n],t.id,t.data)}}insertBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let t=e[n];this.add(i[n],t.id,t.data)}}moveAfter(t,e){let i=this._current.insertAfterHelper(t,e.length);for(let n=0;n<e.length;n++){let t=e[n];this.move(i[n],t)}}moveBefore(t,e){let i=this._current.insertBeforeHelper(t,e.length);for(let n=0;n<e.length;n++){let t=e[n];this.move(i[n],t)}}delete(t){this.deleteChildren(t),this.runOp({type:5,id:t})}};function Yg(t,e,i){if(t.length>0){let n=t[t.length-1];if(0===n.type&&0===e.type&&Qg.equal(n.path,i))return void Object.assign(n.props,e.props)}t.push({...e,path:i})}var Qg,Zg=class extends kg{constructor(t){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=t}update(t,e){if(""!==t)throw new Error("");this._current=e}push(t,e,i,n){Yg(this.ts,e,t),Yg(this.actual,i,t),Yg(this.reverse,n,t)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Kg(t,e,i){return i instanceof bg?new qg(t,e,i):i instanceof wg?new Xg(t,e,i):i instanceof dg?new Proxy(new jg(t,e,i),Hg):null!==i&&"object"==typeof i?gg(i)?i:new Proxy(new Vg(t,e,i),Wg):i}function Jg(t){let e=new Zg(t);return[Kg(e,"",t),e]}function $g(t,e){let[i,n]=Jg(t);return e(i),n.result()}function tv(t){return t instanceof qg||t instanceof Xg?t._current:null!==t&&"object"==typeof t?t[Fg]:t}function ev(t,e){let i=[];if(!(e.length<=t.length))return null;for(var n=0;n<e.length;){if("*"===e[n])i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}return i}(t=>{function e(t,e){return(t instanceof bg||t instanceof qg)&&"string"==typeof e||(t instanceof wg||t instanceof Xg)&&"string"==typeof e?t.data(e):"number"==typeof e&&Array.isArray(t)||"string"==typeof e&&"object"==typeof t&&null!==t?t[e]:void 0}function i(t,i,n=0){for(;n<i.length&&void 0!==t;)t=e(t,i[n]),n+=1;return t}t.equal=function(t,e){if(e.length!==t.length)return!1;for(var i=0;i<t.length;){if(t[i]!==e[i])return!1;i+=1}return!0},t.removeOverridden=function(t,e,n){let r=i(n,t);if(void 0!==r&&"object"==typeof r&&null!==r){let t={...e};return Object.keys(r).forEach(e=>{delete t[e]}),t}return e},t.zoomOnce=e,t.zoom=i})(Qg||(Qg={}));var iv,nv=class{},rv=class extends nv{constructor(t){super(),this.id=t}},sv=class extends nv{constructor(t){super(),this.data=t}};try{iv=new TextDecoder}catch{}var av,ov,lv,hv,cv,dv,uv,pv=0,fv={},mv=0,gv=0,vv=[],yv={useRecords:!1,mapsAsObjects:!0},xv=class{},bv=new xv;bv.name="MessagePack 0xC1";var wv=!1,Sv=class{constructor(t){t&&(!1===t.useRecords&&void 0===t.mapsAsObjects&&(t.mapsAsObjects=!0),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0)),Object.assign(this,t)}unpack(t,e){if(av)return Xv(()=>(Yv(),this?this.unpack(t,e):Sv.prototype.unpack.call(yv,t,e)));ov=e>-1?e:t.length,pv=0,gv=0,hv=null,cv=null,av=t;try{uv=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(Ag){throw av=null,t instanceof Uint8Array?Ag:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&"object"==typeof t?t.constructor.name:typeof t))}if(this instanceof Sv){if(fv=this,this.structures)return lv=this.structures,_v();(!lv||lv.length>0)&&(lv=[])}else fv=yv,(!lv||lv.length>0)&&(lv=[]);return _v()}unpackMultiple(t,e){let i,n=0;try{wv=!0;let r=t.length,s=this?this.unpack(t,r):Zv.unpack(t,r);if(!e){for(i=[s];pv<r;)n=pv,i.push(_v());return i}for(e(s);pv<r;)if(n=pv,!1===e(_v()))return}catch(dx){throw dx.lastPosition=n,dx.values=i,dx}finally{wv=!1,Yv()}}_mergeStructures(t,e){for(let i=0,n=(t=t||[]).length;i<n;i++){let e=t[i];e&&(e.isShared=!0,i>=32&&(e.highByte=i-32>>5))}t.sharedLength=t.length;for(let i in e||[])if(i>=0){let n=t[i],r=e[i];r&&(n&&((t.restoreStructures||(t.restoreStructures=[]))[i]=n),t[i]=r)}return this.structures=t}decode(t,e){return this.unpack(t,e)}};function _v(){try{if(!fv.trusted&&!wv){let t=lv.sharedLength||0;t<lv.length&&(lv.length=t)}let t=Mv();
2if(pv==ov)lv.restoreStructures&&Av(),lv=null,av=null,dv&&(dv=null);else{if(pv>ov){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}if(!wv)throw new Error("Data read, but end of buffer not reached")}return t}catch(Nc){throw lv.restoreStructures&&Av(),Yv(),(Nc instanceof RangeError||Nc.message.startsWith("Unexpected end of buffer"))&&(Nc.incomplete=!0),Nc}}function Av(){for(let t in lv.restoreStructures)lv[t]=lv.restoreStructures[t];lv.restoreStructures=null}function Mv(){let t=av[pv++];if(t<160){if(t<128){if(t<64)return t;{let e=lv[63&t]||fv.getStructures&&Tv()[63&t];return e?(e.read||(e.read=Ev(e,63&t)),e.read()):t}}if(t<144){if(t-=128,fv.mapsAsObjects){let e={};for(let i=0;i<t;i++)e[Gv()]=Mv();return e}{let e=new Map;for(let i=0;i<t;i++)e.set(Mv(),Mv());return e}}{t-=144;let e=new Array(t);for(let i=0;i<t;i++)e[i]=Mv();return e}}if(t<192){let e=t-160;if(gv>=pv)return hv.slice(pv-mv,(pv+=e)-mv);if(0==gv&&ov<140){let t=e<16?Uv(e):Nv(e);if(null!=t)return t}return Dv(e)}{let e;switch(t){case 192:return null;case 193:return cv?(e=Mv(),e>0?cv[1].slice(cv.position1,cv.position1+=e):cv[0].slice(cv.position0,cv.position0-=e)):bv;case 194:return!1;case 195:return!0;case 196:return kv(av[pv++]);case 197:return e=uv.getUint16(pv),pv+=2,kv(e);case 198:return e=uv.getUint32(pv),pv+=4,kv(e);case 199:return Vv(av[pv++]);case 200:return e=uv.getUint16(pv),pv+=2,Vv(e);case 201:return e=uv.getUint32(pv),pv+=4,Vv(e);case 202:if(e=uv.getFloat32(pv),fv.useFloat32>2){let t=Qv[(127&av[pv])<<1|av[pv+1]>>7];return pv+=4,(t*e+(e>0?.5:-.5)|0)/t}return pv+=4,e;case 203:return e=uv.getFloat64(pv),pv+=8,e;case 204:return av[pv++];case 205:return e=uv.getUint16(pv),pv+=2,e;case 206:return e=uv.getUint32(pv),pv+=4,e;case 207:return fv.int64AsNumber?(e=4294967296*uv.getUint32(pv),e+=uv.getUint32(pv+4)):e=uv.getBigUint64(pv),pv+=8,e;case 208:return uv.getInt8(pv++);case 209:return e=uv.getInt16(pv),pv+=2,e;case 210:return e=uv.getInt32(pv),pv+=4,e;case 211:return fv.int64AsNumber?(e=4294967296*uv.getInt32(pv),e+=uv.getUint32(pv+4)):e=uv.getBigInt64(pv),pv+=8,e;case 212:if(e=av[pv++],114==e)return Wv(63&av[pv++]);{let t=vv[e];if(t)return t.read?(pv++,t.read(Mv())):t.noBuffer?(pv++,t()):t(av.subarray(pv,++pv));throw new Error("Unknown extension "+e)}case 213:return e=av[pv],114==e?(pv++,Wv(63&av[pv++],av[pv++])):Vv(2);case 214:return Vv(4);case 215:return Vv(8);case 216:return Vv(16);case 217:return e=av[pv++],gv>=pv?hv.slice(pv-mv,(pv+=e)-mv):Iv(e);case 218:return e=uv.getUint16(pv),gv>=(pv+=2)?hv.slice(pv-mv,(pv+=e)-mv):Ov(e);case 219:return e=uv.getUint32(pv),gv>=(pv+=4)?hv.slice(pv-mv,(pv+=e)-mv):Rv(e);case 220:return e=uv.getUint16(pv),pv+=2,Bv(e);case 221:return e=uv.getUint32(pv),pv+=4,Bv(e);case 222:return e=uv.getUint16(pv),pv+=2,zv(e);case 223:return e=uv.getUint32(pv),pv+=4,zv(e);default:if(t>=224)return t-256;if(void 0===t){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+t)}}}var Cv=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Ev(t,e){function i(){if(i.count++>2){let i=t.read=new Function("r","return function(){return {"+t.map(t=>Cv.test(t)?t+":r()":"["+JSON.stringify(t)+"]:r()").join(",")+"}}")(Mv);return 0===t.highByte&&(t.read=Pv(e,t.read)),i()}let n={};for(let e=0,i=t.length;e<i;e++){n[t[e]]=Mv()}return n}return i.count=0,0===t.highByte?Pv(e,i):i}var Pv=(t,e)=>function(){let i=av[pv++];if(0===i)return e();let n=t<32?-(t+(i<<5)):t+(i<<5),r=lv[n]||Tv()[n];if(!r)throw new Error("Record id is not defined for "+n);return r.read||(r.read=Ev(r,t)),r.read()};function Tv(){let t=Xv(()=>(av=null,fv.getStructures()));return lv=fv._mergeStructures(t,lv)}var Dv=Lv,Iv=Lv,Ov=Lv,Rv=Lv;function Lv(t){let e;if(t<16&&(e=Uv(t)))return e;if(t>64&&iv)return iv.decode(av.subarray(pv,pv+=t));let i=pv+t,n=[];for(e="";pv<i;){let t=av[pv++];if(128&t)if(192==(224&t)){let e=63&av[pv++];n.push((31&t)<<6|e)}else if(224==(240&t)){let e=63&av[pv++],i=63&av[pv++];n.push((31&t)<<12|e<<6|i)}else if(240==(248&t)){let e=(7&t)<<18|(63&av[pv++])<<12|(63&av[pv++])<<6|63&av[pv++];e>65535&&(e-=65536,n.push(e>>>10&1023|55296),e=56320|1023&e),n.push(e)}else n.push(t);else n.push(t);n.length>=4096&&(e+=Fv.apply(String,n),n.length=0)}return n.length>0&&(e+=Fv.apply(String,n)),e}function Bv(t){let e=new Array(t);for(let i=0;i<t;i++)e[i]=Mv();return e}function zv(t){if(fv.mapsAsObjects){let e={};for(let i=0;i<t;i++)e[Gv()]=Mv();return e}{let e=new Map;for(let i=0;i<t;i++)e.set(Mv(),Mv());return e}}var Fv=String.fromCharCode;function Nv(t){let e=pv,i=new Array(t);for(let n=0;n<t;n++){let t=av[pv++];if((128&t)>0)return void(pv=e);i[n]=t}return Fv.apply(String,i)}function Uv(t){if(t<4){if(t<2){if(0===t)return"";{let t=av[pv++];return(128&t)>1?void(pv-=1):Fv(t)}}{let e=av[pv++],i=av[pv++];if((128&e)>0||(128&i)>0)return void(pv-=2);
2if(t<3)return Fv(e,i);let n=av[pv++];return(128&n)>0?void(pv-=3):Fv(e,i,n)}}{let e=av[pv++],i=av[pv++],n=av[pv++],r=av[pv++];if((128&e)>0||(128&i)>0||(128&n)>0||(128&r)>0)return void(pv-=4);if(t<6){if(4===t)return Fv(e,i,n,r);{let t=av[pv++];return(128&t)>0?void(pv-=5):Fv(e,i,n,r,t)}}if(t<8){let s=av[pv++],a=av[pv++];if((128&s)>0||(128&a)>0)return void(pv-=6);if(t<7)return Fv(e,i,n,r,s,a);let o=av[pv++];return(128&o)>0?void(pv-=7):Fv(e,i,n,r,s,a,o)}{let s=av[pv++],a=av[pv++],o=av[pv++],l=av[pv++];if((128&s)>0||(128&a)>0||(128&o)>0||(128&l)>0)return void(pv-=8);if(t<10){if(8===t)return Fv(e,i,n,r,s,a,o,l);{let t=av[pv++];return(128&t)>0?void(pv-=9):Fv(e,i,n,r,s,a,o,l,t)}}if(t<12){let h=av[pv++],c=av[pv++];if((128&h)>0||(128&c)>0)return void(pv-=10);if(t<11)return Fv(e,i,n,r,s,a,o,l,h,c);let d=av[pv++];return(128&d)>0?void(pv-=11):Fv(e,i,n,r,s,a,o,l,h,c,d)}{let h=av[pv++],c=av[pv++],d=av[pv++],u=av[pv++];if((128&h)>0||(128&c)>0||(128&d)>0||(128&u)>0)return void(pv-=12);if(t<14){if(12===t)return Fv(e,i,n,r,s,a,o,l,h,c,d,u);{let t=av[pv++];return(128&t)>0?void(pv-=13):Fv(e,i,n,r,s,a,o,l,h,c,d,u,t)}}{let p=av[pv++],f=av[pv++];if((128&p)>0||(128&f)>0)return void(pv-=14);if(t<15)return Fv(e,i,n,r,s,a,o,l,h,c,d,u,p,f);let m=av[pv++];return(128&m)>0?void(pv-=15):Fv(e,i,n,r,s,a,o,l,h,c,d,u,p,f,m)}}}}}function kv(t){return fv.copyBuffers?Uint8Array.prototype.slice.call(av,pv,pv+=t):av.subarray(pv,pv+=t)}function Vv(t){let e=av[pv++];if(vv[e])return vv[e](av.subarray(pv,pv+=t));throw new Error("Unknown extension type "+e)}var jv=new Array(4096);function Gv(){let t=av[pv++];if(!(t>=160&&t<192))return pv--,Mv();if(t-=160,gv>=pv)return hv.slice(pv-mv,(pv+=t)-mv);if(!(0==gv&&ov<180))return Dv(t);let e,i=4095&(t<<5^(t>1?uv.getUint16(pv):t>0?av[pv]:0)),n=jv[i],r=pv,s=pv+t-3,a=0;if(n&&n.bytes==t){for(;r<s;){if(e=uv.getUint32(r),e!=n[a++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(e=av[r++],e!=n[a++]){r=1879048192;break}if(r===s)return pv=r,n.string;s-=3,r=pv}for(n=[],jv[i]=n,n.bytes=t;r<s;)e=uv.getUint32(r),n.push(e),r+=4;for(s+=3;r<s;)e=av[r++],n.push(e);let o=t<16?Uv(t):Nv(t);return n.string=null!=o?o:Dv(t)}var Wv=(t,e)=>{var i=Mv();let n=t;void 0!==e&&(t=t<32?-((e<<5)+t):(e<<5)+t,i.highByte=e);let r=lv[t];return r&&r.isShared&&((lv.restoreStructures||(lv.restoreStructures=[]))[t]=r),lv[t]=i,i.read=Ev(i,n),i.read()},Hv="object"==typeof self?self:globalThis;vv[0]=()=>{},vv[0].noBuffer=!0,vv[101]=()=>{let t=Mv();return(Hv[t[0]]||Error)(t[1])},vv[105]=t=>{let e=uv.getUint32(pv-4);dv||(dv=new Map);let i,n=av[pv];i=n>=144&&n<160||220==n||221==n?[]:{};let r={target:i};dv.set(e,r);let s=Mv();return r.used?Object.assign(i,s):(r.target=s,s)},vv[112]=t=>{let e=uv.getUint32(pv-4),i=dv.get(e);return i.used=!0,i.target},vv[115]=()=>new Set(Mv());var qv=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(t=>t+"Array");function Xv(t){let e=ov,i=pv,n=mv,r=gv,s=hv,a=dv,o=cv,l=new Uint8Array(av.slice(0,ov)),h=lv,c=lv.slice(0,lv.length),d=fv,u=wv,p=t();return ov=e,pv=i,mv=n,gv=r,hv=s,dv=a,cv=o,av=l,wv=u,(lv=h).splice(0,lv.length,...c),fv=d,uv=new DataView(av.buffer,av.byteOffset,av.byteLength),p}function Yv(){av=null,dv=null,lv=null}vv[116]=t=>{let e=t[0],i=qv[e];if(!i)throw new Error("Could not find typed array for code "+e);return new Hv[i](Uint8Array.prototype.slice.call(t,1).buffer)},vv[120]=()=>{let t=Mv();return new RegExp(t[0],t[1])},vv[98]=t=>{let e=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3],i=pv;pv+=e-4,(cv=[Mv(),Mv()]).position0=0,cv.position1=0;let n=pv;pv=i;try{return Mv()}finally{pv=n}},vv[255]=t=>4==t.length?new Date(1e3*(16777216*t[0]+(t[1]<<16)+(t[2]<<8)+t[3])):8==t.length?new Date(((t[0]<<22)+(t[1]<<14)+(t[2]<<6)+(t[3]>>2))/1e6+1e3*(4294967296*(3&t[3])+16777216*t[4]+(t[5]<<16)+(t[6]<<8)+t[7])):12==t.length?new Date(((t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3])/1e6+1e3*((128&t[4]?-281474976710656:0)+1099511627776*t[6]+4294967296*t[7]+16777216*t[8]+(t[9]<<16)+(t[10]<<8)+t[11])):new Date("invalid");var Qv=new Array(147);for(let oG=0;oG<256;oG++)Qv[oG]=+("1e"+Math.floor(45.15-.30103*oG));var Zv=new Sv({useRecords:!1});Zv.unpack,Zv.unpackMultiple,Zv.unpack;var Kv,Jv=new Float32Array(1);new Uint8Array(Jv.buffer,0,4);try{Kv=new TextEncoder}catch{}var $v,ty,ey,iy,ny,ry=typeof Buffer<"u",sy=ry?Buffer.allocUnsafeSlow:Uint8Array,ay=ry?Buffer:Uint8Array,oy=ry?4294967296:2144337920,ly=0,hy=null,cy=/[\u0080-\uFFFF]/,dy=Symbol("record-id"),uy=class extends Sv{constructor(t){super(t),this.offset=0;
2let e,i,n,r,s,a=0,o=ay.prototype.utf8Write?function(t,e,i){return ey.utf8Write(t,e,i)}:!(!Kv||!Kv.encodeInto)&&function(t,e){return Kv.encodeInto(t,ey.subarray(e)).written},l=this;t||(t={});let h=t&&t.sequential,c=t.structures||t.saveStructures,d=t.maxSharedStructures;if(null==d&&(d=c?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let u=t.maxOwnStructures;null==u&&(u=c?32:64),h&&!t.saveStructures&&(this.structures=[]);let p=d>32||u+d>64,f=d+64,m=d+u+64;if(m>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let g=[],v=0,y=0;this.pack=this.encode=function(t,o){if(ey||(ey=new sy(8192),iy=new DataView(ey.buffer,0,8192),ly=0),(ny=ey.length-10)-ly<2048?(ey=new sy(ey.length),iy=new DataView(ey.buffer,0,ey.length),ny=ey.length-10,ly=0):ly=ly+7&2147483640,e=ly,s=l.structuredClone?new Map:null,l.bundleStrings?(hy=["",""],ey[ly++]=214,ey[ly++]=98,hy.position=ly-e,ly+=4):hy=null,i=l.structures,i){i.uninitialized&&(i=l._mergeStructures(l.getStructures()));let t=i.sharedLength||0;if(t>d)throw new 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 e=0;e<t;e++){let t=i[e];if(!t)continue;let n,r=i.transitions;for(let e=0,i=t.length;e<i;e++){let i=t[e];n=r[i],n||(n=r[i]=Object.create(null)),r=n}r[dy]=e+64}a=t}h||(i.nextId=t+64)}n&&(n=!1),r=i||[];try{if(x(t),hy){iy.setUint32(hy.position+e,ly-hy.position-e);let t=hy;hy=null,x(t[0]),x(t[1])}if(l.offset=ly,s&&s.idsToInsert){(ly+=6*s.idsToInsert.length)>ny&&w(ly),l.offset=ly;let t=function(t,e){let i,n=6*e.length,r=t.length-n;for(e.sort((t,e)=>t.offset>e.offset?1:-1);i=e.pop();){let e=i.offset,s=i.id;t.copyWithin(e+n,e,r),n-=6;let a=e+n;t[a++]=214,t[a++]=105,t[a++]=s>>24,t[a++]=s>>16&255,t[a++]=s>>8&255,t[a++]=255&s,r=e}return t}(ey.subarray(e,ly),s.idsToInsert);return s=null,t}return o&wy?(ey.start=e,ey.end=ly,ey):ey.subarray(e,ly)}finally{if(i){if(y<10&&y++,v>1e4)i.transitions=null,y=0,v=0,g.length>0&&(g=[]);else if(g.length>0&&!h){for(let t=0,e=g.length;t<e;t++)g[t][dy]=0;g=[]}if(n&&l.saveStructures){let n=i.sharedLength||d;i.length>n&&(i=i.slice(0,n));let r=ey.subarray(e,ly);return!1===l.saveStructures(i,a)?(l._mergeStructures(l.getStructures()),l.pack(t)):(a=n,r)}}o&Sy&&(ly=e)}};let x=t=>{ly>ny&&(ey=w(ly));var i,n=typeof t;if("string"===n){let e,n=t.length;if(hy&&n>=8&&n<4096){let e=cy.test(t);return hy[e?0:1]+=t,ey[ly++]=193,void x(e?-n:n)}e=n<32?1:n<256?2:n<65536?3:5;let r=3*n;if(ly+r>ny&&(ey=w(ly+r)),n<64||!o){let r,s,a,o=ly+e;for(r=0;r<n;r++)s=t.charCodeAt(r),s<128?ey[o++]=s:s<2048?(ey[o++]=s>>6|192,ey[o++]=63&s|128):55296==(64512&s)&&56320==(64512&(a=t.charCodeAt(r+1)))?(s=65536+((1023&s)<<10)+(1023&a),r++,ey[o++]=s>>18|240,ey[o++]=s>>12&63|128,ey[o++]=s>>6&63|128,ey[o++]=63&s|128):(ey[o++]=s>>12|224,ey[o++]=s>>6&63|128,ey[o++]=63&s|128);i=o-ly-e}else i=o(t,ly+e,r);i<32?ey[ly++]=160|i:i<256?(e<2&&ey.copyWithin(ly+2,ly+1,ly+1+i),ey[ly++]=217,ey[ly++]=i):i<65536?(e<3&&ey.copyWithin(ly+3,ly+2,ly+2+i),ey[ly++]=218,ey[ly++]=i>>8,ey[ly++]=255&i):(e<5&&ey.copyWithin(ly+5,ly+3,ly+3+i),ey[ly++]=219,iy.setUint32(ly,i),ly+=4),ly+=i}else if("number"===n)if(t>>>0===t)t<64?ey[ly++]=t:t<256?(ey[ly++]=204,ey[ly++]=t):t<65536?(ey[ly++]=205,ey[ly++]=t>>8,ey[ly++]=255&t):(ey[ly++]=206,iy.setUint32(ly,t),ly+=4);else if((t|0)===t)t>=-32?ey[ly++]=256+t:t>=-128?(ey[ly++]=208,ey[ly++]=t+256):t>=-32768?(ey[ly++]=209,iy.setInt16(ly,t),ly+=2):(ey[ly++]=210,iy.setInt32(ly,t),ly+=4);else{let e;if((e=this.useFloat32)>0&&t<4294967296&&t>=-2147483648){let i;if(ey[ly++]=202,iy.setFloat32(ly,t),e<4||((i=t*Qv[(127&ey[ly])<<1|ey[ly+1]>>7])|0)===i)return void(ly+=4);ly--}ey[ly++]=203,iy.setFloat64(ly,t),ly+=8}else if("object"===n)if(t){if(s){let i=s.get(t);if(i){if(!i.id){let t=s.idsToInsert||(s.idsToInsert=[]);i.id=t.push(i)}return ey[ly++]=214,ey[ly++]=112,iy.setUint32(ly,i.id),void(ly+=4)}s.set(t,{offset:ly-e})}let n=t.constructor;if(n===Object)b(t,!0);else if(n===Array){(i=t.length)<16?ey[ly++]=144|i:i<65536?(ey[ly++]=220,ey[ly++]=i>>8,ey[ly++]=255&i):(ey[ly++]=221,iy.setUint32(ly,i),ly+=4);for(let e=0;e<i;e++)x(t[e])}else if(n===Map){(i=t.size)<16?ey[ly++]=128|i:i<65536?(ey[ly++]=222,ey[ly++]=i>>8,ey[ly++]=255&i):(ey[ly++]=223,iy.setUint32(ly,i),ly+=4);for(let[e,i]of t)x(e),x(i)}else{for(let e=0,i=$v.length;e<i;e++){if(t instanceof ty[e]){let i=$v[e];if(i.write)return i.type&&(ey[ly++]=212,ey[ly++]=i.type,ey[ly++]=0),void x(i.write.call(this,t));let n,r=ey,s=iy,a=ly;ey=null;try{n=i.pack.call(this,t,t=>(ey=r,r=null,(ly+=t)>
2ny&&w(ly),{target:ey,targetView:iy,position:ly-t}),x)}finally{r&&(iy=s,ly=a,ny=(ey=r).length-10)}return void(n&&(n.length+ly>ny&&w(n.length+ly),ly=my(n,ey,ly,i.type)))}}b(t,!t.hasOwnProperty)}}else ey[ly++]=192;else if("boolean"===n)ey[ly++]=t?195:194;else if("bigint"===n){if(t<BigInt(1)<<BigInt(63)&&t>=-(BigInt(1)<<BigInt(63)))ey[ly++]=211,iy.setBigInt64(ly,t);else if(t<BigInt(1)<<BigInt(64)&&t>0)ey[ly++]=207,iy.setBigUint64(ly,t);else{if(!this.largeBigIntToFloat)throw new RangeError(t+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");ey[ly++]=203,iy.setFloat64(ly,Number(t))}ly+=8}else if("undefined"===n)this.encodeUndefinedAsNil?ey[ly++]=192:(ey[ly++]=212,ey[ly++]=0,ey[ly++]=0);else{if("function"!==n)throw new Error("Unknown type: "+n);x(this.writeFunction&&this.writeFunction())}},b=!1===this.useRecords?this.variableMapSize?t=>{let e,i=Object.keys(t),n=i.length;n<16?ey[ly++]=128|n:n<65536?(ey[ly++]=222,ey[ly++]=n>>8,ey[ly++]=255&n):(ey[ly++]=223,iy.setUint32(ly,n),ly+=4);for(let r=0;r<n;r++)x(e=i[r]),x(t[e])}:(t,i)=>{ey[ly++]=222;let n=ly-e;ly+=2;let r=0;for(let e in t)(i||t.hasOwnProperty(e))&&(x(e),x(t[e]),r++);ey[n+++e]=r>>8,ey[n+e]=255&r}:t=>{let e,i=Object.keys(t),s=r.transitions||(r.transitions=Object.create(null)),a=0;for(let n=0,r=i.length;n<r;n++){let t=i[n];e=s[t],e||(e=s[t]=Object.create(null),a++),s=e}let o=s[dy];if(o)o>=96&&p?(ey[ly++]=96+(31&(o-=96)),ey[ly++]=o>>5):ey[ly++]=o;else{o=r.nextId,o||(o=64),o<f&&this.shouldShareStructure&&!this.shouldShareStructure(i)?(o=r.nextOwnId,o<m||(o=f),r.nextOwnId=o+1):(o>=m&&(o=f),r.nextId=o+1);let t=i.highByte=o>=96&&p?o-96>>5:-1;s[dy]=o,r[o-64]=i,o<f?(i.isShared=!0,r.sharedLength=o-63,n=!0,t>=0?(ey[ly++]=96+(31&o),ey[ly++]=t):ey[ly++]=o):(t>=0?(ey[ly++]=213,ey[ly++]=114,ey[ly++]=96+(31&o),ey[ly++]=t):(ey[ly++]=212,ey[ly++]=114,ey[ly++]=o),a&&(v+=y*a),g.length>=u&&(g.shift()[dy]=0),g.push(s),x(i))}for(let n=0,r=i.length;n<r;n++)x(t[i[n]])},w=t=>{let i;if(t>16777216){if(t-e>oy)throw new Error("Packed buffer would be larger than maximum buffer size");i=Math.min(oy,4096*Math.round(Math.max((t-e)*(t>67108864?1.25:2),4194304)/4096))}else i=1+(Math.max(t-e<<2,ey.length-1)>>12)<<12;let n=new sy(i);return iy=new DataView(n.buffer,0,i),ey.copy?ey.copy(n,0,e,t):n.set(ey.slice(e,t)),ly-=e,e=0,ny=n.length-10,ey=n}}useBuffer(t){ey=t,iy=new DataView(ey.buffer,ey.byteOffset,ey.byteLength),ly=0}};function py(t,e,i,n){let r=t.byteLength;if(r+1<256){var{target:s,position:a}=i(4+r);s[a++]=199,s[a++]=r+1}else if(r+1<65536){var{target:s,position:a}=i(5+r);s[a++]=200,s[a++]=r+1>>8,s[a++]=r+1&255}else{var{target:s,position:a,targetView:o}=i(7+r);s[a++]=201,o.setUint32(a,r+1),a+=4}s[a++]=116,s[a++]=e,s.set(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),a)}function fy(t,e){let i=t.byteLength;var n,r;if(i<256){var{target:n,position:r}=e(i+2);n[r++]=196,n[r++]=i}else if(i<65536){var{target:n,position:r}=e(i+3);n[r++]=197,n[r++]=i>>8,n[r++]=255&i}else{var{target:n,position:r,targetView:s}=e(i+5);n[r++]=198,s.setUint32(r,i),r+=4}n.set(t,r)}function my(t,e,i,n){let r=t.length;switch(r){case 1:e[i++]=212;break;case 2:e[i++]=213;break;case 4:e[i++]=214;break;case 8:e[i++]=215;break;case 16:e[i++]=216;break;default:r<256?(e[i++]=199,e[i++]=r):r<65536?(e[i++]=200,e[i++]=r>>8,e[i++]=255&r):(e[i++]=201,e[i++]=r>>24,e[i++]=r>>16&255,e[i++]=r>>8&255,e[i++]=255&r)}return e[i++]=n,e.set(t,i),i+=r}function gy(t){if(t.Class){if(!t.pack&&!t.write)throw new Error("Extension has no pack or write function");if(t.pack&&!t.type)throw new Error("Extension has no type (numeric code to identify the extension)");ty.unshift(t.Class),$v.unshift(t)}!function(t){t.unpack?vv[t.type]=t.unpack:vv[t.type]=t}(t)}ty=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,xv],$v=[{pack(t,e,i){let n=t.getTime()/1e3;if((this.useTimestamp32||0===t.getMilliseconds())&&n>=0&&n<4294967296){let{target:t,targetView:i,position:r}=e(6);t[r++]=214,t[r++]=255,i.setUint32(r,n)}else if(n>0&&n<17179869184){let{target:i,targetView:r,position:s}=e(10);i[s++]=215,i[s++]=255,r.setUint32(s,4e6*t.getMilliseconds()+(n/1e3/4294967296|0)),r.setUint32(s+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),i(this.onInvalidDate());let{target:t,targetView:n,position:r}=e(3);t[r++]=212,t[r++]=255,t[r++]=255}else{let{target:i,targetView:r,position:s}=e(15);i[s++]=199,i[s++]=12,i[s++]=255,r.setUint32(s,1e6*t.getMilliseconds()),r.setBigInt64(s+4,BigInt(Math.floor(n)))}}}
2,{pack(t,e,i){let n=Array.from(t),{target:r,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(r[s++]=212,r[s++]=115,r[s++]=0),i(n)}},{pack(t,e,i){let{target:n,position:r}=e(this.structuredClone?3:0);this.structuredClone&&(n[r++]=212,n[r++]=101,n[r++]=0),i([t.name,t.message])}},{pack(t,e,i){let{target:n,position:r}=e(this.structuredClone?3:0);this.structuredClone&&(n[r++]=212,n[r++]=120,n[r++]=0),i([t.source,t.flags])}},{pack(t,e){this.structuredClone?py(t,16,e):fy(ry?Buffer.from(t):new Uint8Array(t),e)}},{pack(t,e){let i=t.constructor;i!==ay&&this.structuredClone?py(t,qv.indexOf(i.name),e):fy(t,e)}},{pack(t,e){let{target:i,position:n}=e(1);i[n]=193}}];var vy=new uy({useRecords:!1});vy.pack,vy.pack;var yy,xy,by,wy=512,Sy=1024,_y=new uy({structuredClone:!0});function Ay(t){if(gg(t))return t;if(Array.isArray(t))return t.map(Ay);if("object"==typeof t&&null!==t){let e={};for(let i of Object.keys(t).sort())e[i]=Ay(t[i]);return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}return t}function My(t){return"MouseDown"===t||"MouseUp"===t||"KeyDown"===t||"KeyUp"===t||"Collision"===t||"Trigger"===t}gy({Class:dg.prototype.constructor,type:1,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,dg.prototype),t)}),gy({Class:wg.prototype.constructor,type:2,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,wg.prototype),t)}),gy({Class:bg.prototype.constructor,type:3,write:t=>[...t],read:t=>(Object.setPrototypeOf(t,bg.prototype),t)}),gy({Class:rv.prototype.constructor,type:4,write:t=>t.id,read:t=>new rv(t)}),gy({Class:sv.prototype.constructor,type:5,write:t=>t.data,read:t=>new sv(t)}),gy({Class:Pg.prototype.constructor,type:6,write:t=>({...t}),read:t=>(Object.setPrototypeOf(t,Pg.prototype),t)}),(t=>{function e(t){return _y.pack(t)}t.serialize=e,t.deserialize=function(t){return _y.unpack(t)},t.checksum=function(t){return function(t){var e=0;if(0===t.length)return e;for(let i=0;i<t.length;i++)e=(e<<5)-e+t[i],e&=e;return e}(e(Ay(t))).toString()}})(yy||(yy={})),(by=xy||(xy={})).toEventUIType=function(t){return"Conditional"===t.type?"Distance"===t.condition.type?"Distance":"StateChange":t.type},by.fromEventUIType=function(t){return"Distance"===t||"StateChange"===t?"Conditional":t};var Cy,Ey,Py,Ty,Dy,Iy,Oy,Ry,Ly,By,zy,Fy,Ny,Uy,ky,Vy,jy,Gy,Wy,Hy,qy={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","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","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","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","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"]};(t=>{t.is=function(t){return"MouseDown"===t.type||"MouseUp"===t.type||"MousePress"===t.type||"KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type},t.defaultData=function(t){return"MouseDown"===t||"MouseUp"===t||"MousePress"===t?{type:t,mode:"Object",disabled:!1,actions:new wg}:{type:t,disabled:!1,key:void 0,actions:new wg}}})(Cy||(Cy={})),(t=>{t.propertyDefaultData=function(t){return{type:"Property",value:[t??null,"position","x"]}},t.valueDefaultData={type:"Literal",value:0}})(Ey||(Ey={})),(t=>{t.comparisonDefaultData=function(t){return{type:"Comparison",operator:"==",lOperand:Ey.propertyDefaultData(t),rOperand:{...Ey.valueDefaultData}}},t.distanceDefaultData=function(t){return{type:"Distance",toObject:t??null,fromObject:t??null,distance:200}},t.stateDefaultData=function(t,e){return{type:"State",object:t??null,state:e??null}}})(Py||(Py={}
vendor: 8,803 bytes, line 2
2)),(Ty||(Ty={})).isConditionalSubActions=function(t){return void 0!==t.find(t=>"ifActions"===t||"elseActions"===t)},(t=>{t.is=function(t){return"Conditional"===t.type},t.defaultData=function(t){return{type:"Conditional",disabled:!1,inActions:new wg,outActions:new wg,condition:Py.distanceDefaultData(t)}}})(Dy||(Dy={})),(Iy||(Iy={})).defaultData={type:"DragDrop",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 wg,drop:new wg}},(Oy||(Oy={})).defaultData={type:"Follow",disabled:!1,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 wg},(Ry||(Ry={})).defaultData={type:"LookAt",disabled:!1,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},(t=>{t.is=function(t){return"MouseHover"===t.type},t.defaultData=function(){return{type:"MouseHover",disabled:!1,actions:new wg}}})(Ly||(Ly={})),(t=>{t.is=function(t){return"Scroll"===t.type},t.defaultData=function(){return{type:"Scroll",disabled:!1,steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new wg}}})(By||(By={})),(t=>{t.is=function(t){return"Start"===t.type},t.defaultData=function(){return{type:"Start",disabled:!1,actions:new wg}}})(zy||(zy={})),(t=>{t.is=function(t){return"Collision"===t.type},t.defaultData=function(){return{type:"Collision",disabled:!1,target:"character",actions:new wg}}})(Fy||(Fy={})),(t=>{t.is=function(t){return"Trigger"===t.type},t.defaultData=function(t,e){return{type:"Trigger",disabled:!1,target:"all",triggeringObjects:[],actions:new wg,triggerZone:"box",position:e.toArray(),rotation:[0,0,0],size:t.toArray(),radius:t.length()/2,helperVisible:!0}}})(Ny||(Ny={})),(ky=Uy||(Uy={})).defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]},ky.is=function(t){return"Resize"===t.type},ky.sizeToDevice=function(t){return"string"==typeof t?t:"custom"},ky.deviceToSize=function(t){return"string"==typeof t?[...ky.defaultSizes[t]]:[...t]},ky.defaultData=function(){let t={size:"mobile",operator:"<",actions:new wg},e={size:"tablet",operator:"<",actions:new wg},i={size:[...ky.defaultSizes.custom],operator:"<>",actions:new wg},n=new wg;return n.push({id:Wt.generateUUID(),fi:0,data:t},{id:Wt.generateUUID(),fi:1,data:e},{id:Wt.generateUUID(),fi:2,data:i}),{type:"Resize",disabled:!1,orientation:"horizontal",breakpoints:n}},ky.defaultBreakpointData=function(){return{size:[...ky.defaultSizes.custom],operator:"<>",actions:new wg}},(t=>{t.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 Object Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]},t.is=function(t){return"VariableChange"===t.type},t.defaultData=function(){return{disabled:!1,type:"VariableChange",actions:new wg,variableId:"",objectId:null,property:"Position X"}}})(Vy||(Vy={})),(t=>{t.is=function(t){return"API"===t.type},t.defaultData=function(){return{disabled:!1,type:"API",successActions:new wg,errorActions:new wg,userAPIId:""}}})(jy||(jy={})),(t=>{t.is=function(t){return"WEBHOOK"===t.type},t.defaultData=function(){return{disabled:!1,type:"WEBHOOK",actions:new wg,userWebhookId:""}}})(Gy||(Gy={})),(t=>{t.is=function(t){return"AIAssistantListener"===t.type},t.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",actions:new wg,analysis:"average",analysisRange:[0,71],analysisSingle:0}}})(Wy||(Wy={})),(t=>{t.is=function(t){return"AIAssistantTrigger"===t.type},t.defaultData=function(){return{disabled:!1,description:"",type:"AIAssistantTrigger",actions:new wg}}})(Hy||(Hy={}));var Xy,Yy,Qy,Zy,Ky,Jy,$y,tx,ex,ix,nx,rx,sx="personal camera",ax="a218fcc3-276b-49b9-b485-49037fd14f5f",ox=5526619;(t=>{function e(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function i(t,i){return Math.sqrt(e(t,i))}function n(e,i,n){let r=t.sub(i,e),s=t.sub(n,e),a=t.dot(r,s)/t.dot(r,r),o=t.scalarMultiply(r,a);return t.add(e,o)}t.isEqual=function(t,e){return t[0]===e[0]&&t[1]===e[1]},t.lerp=function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i]},t.add=function(t,e){return[t[0]+e[0],t[1]+e[1]]},t.sub=function(t,e){return[t[0]-e[0],t[1]-e[1]]},t.multiply=function(t,e){return[t[0]*e[0],t[1]*e[1]]},t.divide=function(t,e){return[t[0]/e[0],t[1]/e[1]]},t.distanceSquared=e,t.distance=i,t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},t.scalarMultiply=function(t,e){return[t[0]*e,t[1]*e]},t.projectionOnto=n,t.projectionOntoDistance=function(t,e,r){return i(t,n(t,e,r))},t.center=function(t,e){return[.5*(t[0]+e[0]),.5*(t[1]+e[1])]}})(Xy||(Xy={})),(Qy=Yy||(Yy={})).isEqual=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},Qy.add=function(t,e){return[t[0]+e[0],t[1]+e[1],t[2]+e[2]]},Qy.sub=function(t,e){return[t[0]-e[0],t[1]-e[1],t[2]-e[2]]},Qy.div=function(t,e){return[t[0]/e[0],t[1]/e[1],t[2]/e[2]]},Qy.mul=function(t,e){return[t[0]*e[0],t[1]*e[1],t[2]*e[2]]},Qy.dist=function(t,e){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},Qy.lerp=function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i]},(t=>{t.isEqual=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},t.lerp=function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}})(Zy||(Zy={})),(t=>{let e=180/Math.PI,i=Math.PI/180;function n(t){return"number"==typeof t?t*e:t}function r(t){return"number"==typeof t?t*i:t}t.radToDeg=function(t){return[n(t[0]),n(t[1]),n(t[2])]},t.degToRad=function(t){return[r(t[0]),r(t[1]),r(t[2])]}})(Ky||(Ky={})),($y=Jy||(Jy={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],$y.isEqual=function(t,e){for(let i=0;i<16;i++)if(t[i]!==e[i])return!1;return!0},$y.simplify=function(t){return t??$y.identity},$y.applyMatrix4=function(t,e){let i=e.slice(0);for(var n=0,r=e.length;n<r;n+=3){let r=t[3]*e[n]+t[7]*e[n+1]+t[11]*e[n+2]+t[15];i[n]=(t[0]*e[n]+t[4]*e[n+1]+t[8]*e[n+2]+t[12])/r,i[n+1]=(t[1]*e[n]+t[5]*e[n+1]+t[9]*e[n+2]+t[13])/r,i[n+2]=(t[2]*e[n]+t[6]*e[n+1]+t[10]*e[n+2]+t[14])/r}return i},(ex=tx||(tx={})).isRGB=function(t){return"object"==typeof t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},ex.white={r:1,g:1,b:1},ex.red={r:1,g:0,b:0},ex.black={r:0,g:0,b:0},ex.toRgb255a1=function(t){return{r:Math.round(255*t.r),g:Math.round(255*t.g),b:Math.round(255*t.b),a:1}},ex.clone=function(t){return{r:t.r,g:t.g,b:t.b}},ex.fromHex=function(t){return{r:((t=Math.floor(t))>>16&255)/255,g:(t>>8&255)/255,b:(255&t)/255}},ex.toHex=function(t){return 65536*Math.round(255*t.r)+256*Math.round(255*t.g)+Math.round(255*t.b)},ex.equals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b},ex.equalsFixed=function(t,e){return t.r.toFixed(2)===e.r.toFixed(2)&&t.g.toFixed(2)===e.g.toFixed(2)&&t.b.toFixed(2)===e.b.toFixed(2)},ex.lerp=function(t,e,i){return{r:t.r+(e.r-t.r)*i,g:t.g+(e.g-t.g)*i,b:t.b+(e.b-t.b)*i}},(nx=ix||(ix={})).white={...tx.white,a:1},nx.transparent={...tx.white,a:0},nx.from0to1=function(t){return{r:t[0],g:t[1],b:t[2],a:t[3]}},nx.fromHexAndA=function(t,e){return{...tx.fromHex(t),a:e}},nx.toRgb255a1=function(t){return{r:Math.round(255*t.r),g:Math.round(255*t.g),b:Math.round(255*t.b),a:t.a}},nx.equals=function(t,e){return tx.equals(t,e)&&t.a===e.a},nx.equalsFixed=function(t,e){return tx.equalsFixed(t,e)&&t.a.toFixed(2)===e.a.toFixed(2)},nx.lerp=function(t,e,i){return{r:t.r+(e.r-t.r)*i,g:t.g+(e.g-t.g)*i,b:t.b+(e.b-t.b)*i,a:t.a+(e.a-t.a)*i}},nx.toStyle=function({r:t,g:e,b:i,a:n}=nx.white){return`rgba(${255*t}, ${255*e}, ${255*i}, ${n})`},(rx||(rx={})).identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]};var lx,hx,cx,dx,ux,px,fx,mx,gx=(t=>(t[t.LINEAR=0]="LINEAR",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.EASE_IN_O
2UT=4]="EASE_IN_OUT",t[t.CUBIC=5]="CUBIC",t[t.SPRING=6]="SPRING",t))(gx||{});function vx(t){return"string"==typeof t&&36===t.length&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)}(lx||(lx={})).defaultData={mass:1,stiffness:80,damping:10,velocity:0},(hx||(hx={})).defaultData={control1:[.5,0],control2:[.5,1]},(dx=cx||(cx={})).linear=[0,0,1,1],dx.ease=[.25,.1,.25,1],dx.easeIn=[.42,0,1,1],dx.easeOut=[0,0,.58,1],dx.easeInOut=[.42,0,.58,1],(t=>{t.all=["PerspectiveCamera","OrthographicCamera"],t.is=function(e){return t.all.includes(e)}})(ux||(ux={})),(t=>{t.DefaultUp=[0,1,0],t.DefaultTargetOffset=1e3,t.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:t.DefaultUp,isUpVectorFlipped:!1,targetOffset:t.DefaultTargetOffset},t.getZoom=function(t){return"PerspectiveCamera"===t.type?t.perspective?.zoom??1:t.orthographic?.zoom??1}})(px||(px={})),(t=>{t.defaultData=function(t,e=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:2*Math.max(t[0],t[1]),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[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"},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*e,0,0]},grid:{count:[2,2,2],size:t.map(t=>t*(1+e)),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"}}},t.merge=function(t,e){let i={...t};if(Tx.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i.radial={...t.radial},e.radial){let n=t.radial,r=e.radial;
vendor: 12,832 bytes, line 2
2Dx.forEach(t=>{Object.assign(i.radial,{[t]:r[t]??n[t]})})}if(i.linear={...t.linear},e.linear){let n=t.linear,r=e.linear;Ix.forEach(t=>{Object.assign(i.linear,{[t]:r[t]??n[t]})})}if(i.grid={...t.grid},e.grid){let n=t.grid,r=e.grid;Ox.forEach(t=>{Object.assign(i.grid,{[t]:r[t]??n[t]})})}if(i.toObject={...t.toObject},e.toObject){let n=t.toObject,r=e.toObject;Rx.forEach(t=>{Object.assign(i.toObject,{[t]:r[t]??n[t]})})}if(i.randomnessObject={...t.randomnessObject},e.randomnessObject){let n=t.randomnessObject,r=e.randomnessObject;Lx.forEach(t=>{Object.assign(i.randomnessObject,{[t]:r[t]??n[t]})})}return i}})(fx||(fx={})),(t=>{t.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let e=["radial","linear","grid","toObject","randomnessObject"];t.toOps=function(t,i){let n=[];void 0!==t.count&&n.push({type:0,path:i,props:{count:t.count}});for(let r of e){let e=t[r];e&&Object.keys(e).length>0&&n.push({type:0,path:[...i,r],props:e})}return n}})(mx||(mx={}));var yx,xx,bx,wx,Sx,_x,Ax,Mx,Cx,Ex,Px,Tx=["count"],Dx=["radius","start","end","position","scale","rotation"],Ix=["position","scale","rotation"],Ox=["count","size"],Rx=["count","position","scale","rotation"],Lx=["strength","scale","rotation","position","movement","seed","freqScale"];(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],t.is=function(e){return t.all.includes(e)}})(yx||(yx={})),(xx||(xx={})).defaultData=function(t){return function(t){if("PointLight"===t)return{type:t,color:ix.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if("SpotLight"===t)return{type:t,color:ix.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"===t)return{type:t,color:ix.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(t)},(t=>{t.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},t.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},t.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:t.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...t.defaultCollisionData}})(bx||(bx={})),(wx||(wx={})).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]},(t=>{t.defaultData={castShadow:!0,receiveShadow:!0},t.equals=function(t,e){return t.castShadow===e.castShadow&&t.receiveShadow===e.receiveShadow}})(Sx||(Sx={})),(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0},t.equals=function(t,e){return t.flatShading===e.flatShading&&t.side===e.side&&t.wireframe===e.wireframe}})(_x||(_x={})),(Ax||(Ax={})).defaultData={..._x.defaultData,...Sx.defaultData},(Mx||(Mx={})).getMaterialData=function(t,e){let i=[];if("material"in t){let n="string"==typeof t.material?e.materials[t.material]??e.lib.materials[t.material]?.asset:t.material;n&&i.push(n)}else if("materials"in t)for(let n of t.materials){let t="string"==typeof n?e.materials[n]??e.lib.materials[n]?.asset:n;t&&i.push(t)}return i},(t=>{t.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},t.maxSize=3e7})(Cx||(Cx={})),(Ex||(Ex={})).is=function(t){return"texture"===t||"video"===t||"color"===t||"depth"===t||"normal"===t||"gradient"===t||"noise"===t||"fresnel"===t||"rainbow"===t||"toon"===t||"outline"===t||"particle"===t||"transmission"===t||"matcap"===t||"displace"===t||"pattern"===t||"light"===t},(Px||(Px={})).is=function(t){return"phong"===t||"toon"===t||"lambert"===t||"physical"===t};var Bx,zx,Fx,Nx,Ux=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],kx=["wrapping","image","video","name","minFilter","magFilter"];(t=>{t.patch=function(t,e){let{texture:i,...n}=e;if(Object.assign(t,n),i){let e=t.texture;e&&Object.assign(e,i)}},t.defaultData=function(t,e){return"light"===t&&e?function(t){let e={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(t){case"phong":return{...e,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...e,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...e,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...e,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}(e):function(t){let e={alpha:1,mode:0,isMask:!1,visible:!0};switch(t){case"texture":return{...e,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{...e,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Cx.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...e,type:"color",color:tx.fromHex(ox)};case"depth":return{...e,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{...e,type:"normal",cnormal:[1,1,1]};case"gradient":return{...e,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{...e,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...tx.fromHex(6710886),a:1},colorB:{...tx.fromHex(6710886),a:1},colorC:{...tx.fromHex(16777215),a:1},colorD:{...tx.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{...e,type:"fresnel",color:ix.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...e,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...e,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:ix.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...e,type:"outline",outlineColor:ix.fromHexAndA(0,1),contourColor:ix.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{...e,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...e,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{...e,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...tx.fromHex(0),a:1},colorB:{...tx.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}}}(t)}})(Bx||(Bx={})),(t=>{function e(t,e="layer1",i="layer2"){let n=new wg;return n.push({fi:0,data:Bx.defaultData("light",t),id:e}),n.push({fi:1,data:Bx.defaultData("color"),id:i}),{layers:n}}t.isMergable=function(t){return!t.layers.some(t=>"texture"===t.data.type&&0!==t.data.projection||"depth"===t.data.type&&!t.data.isWorldSpace||"noise"===t.data.type||"displace"===t.data.type)},t.getHash=function(t){let e="";return t.layers.forEach(t=>{Object.entries(t.data).forEach(([t,i])=>{e+=`${t}${i}`,Array.isArray(i)?i.forEach(t=>e+=`${t}`):"object"==typeof i?Object.values(i).forEach(t=>{e+="number"==typeof t?`${t.toFixed(4)}`:`${t}`}):e+=`${i}`})}),e},t.defaultEmptyData=function(){return{layers:new wg}},t.defaultData=function(t="layer1",i="layer2"){return e("phong",t,i)},t.withName=function(t,e){return{...t,name:e}},t.defaultTwoLayerData=e,t.defaultUIObjectMaterial=function(t){let e=Bx.defaultData("texture");t&&Object.assign(e.texture,{image:t});let i=new wg;return i.push({fi:0,data:e,id:"layer1"}),i.push({fi:1,data:{...Bx.defaultData("transmission"),alpha:1},id:"layer2"}),i.push({fi:2,data:{...Bx.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:i}},t.defaultTwoLayerTextureData=function(t,e="phong",i="layer1",n="layer2"){let r=Bx.defaultData("texture");Object.assign(r.texture,{image:t});let s=new wg;return s.push({fi:0,data:r,id:i}),s.push({fi:1,data:Bx.defaultData("light",e),id:n}),{layers:s}},t.defaultTwoLayerVideoTextureData=function(t,e="phong",i="layer1",n="layer2"){let r=Bx.defaultData("video");Object.assign(r.texture,{video:t});let s=new wg;return s.push({fi:0,data:r,id:i}),s.push({fi:1,data:Bx.defaultData("light",e),id:n}),{layers:s}}})(zx||(zx={})),(Fx||(Fx={})).defaultData=function(){return{points:new wg,roundness:0,shapeHoles:[],isClosed:!1}},(Nx||(Nx={})).defaultData=function(){return{points:new wg,lastInsertionPlane:null,subdivisions:12,isClosed:!1}};var Vx,jx={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};(Vx||(Vx={})).merge=function(t,e){let i={...t};return Yx.forEach(n=>{Object.assign(i,{[n]:e[n]??t[n]})}),i};var Gx,Wx,Hx,qx,Xx={shape:jx,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},Yx=["depth","offset","angle","twist","startScale","endScale"];(t=>{t.is2DParametricMesh=function(t){return"PolygonGeometry"===t||"RectangleGeometry"===t||"StarGeometry"===t||"TriangleGeometry"===t||"EllipseGeometry"===t||"UIGeometry"===t},t.isParametricMesh=function(t){return"PolygonGeometry"===t||"PolygonGeometry"===t||"RectangleGeometry"===t||"StarGeometry"===t||"TriangleGeometry"===t||"EllipseGeometry"===t||"PathGeometry"===t||"VectorGeometry"===t||"ConeGeometry"===t||"CubeGeometry"===t||"CylinderGeometry"===t||"DodecahedronGeometry"===t||"HelixGeometry"===t||"IcosahedronGeometry"===t||"LatheGeometry"===t||"PyramidGeometry"===t||"SphereGeometry"===t||"PlaneGeometry"===t||"BackdropGeometry"===t||"TorusGeometry"===t||"TorusKnotGeometry"===t||"BooleanGeometry"===t||"TextGeometry"===t||"InputGeometry"===t}})(Gx||(Gx={})),(Wx||(Wx={})).merge=function(t,e){let i={...t};return Object.assign(i,e),"PathGeometry"===i.type&&"extrusion"in e&&e.extrusion&&(i.extrusion={...t.extrusion},Object.assign(i.extrusion,Vx.merge(i.extrusion,e.extrusion))),i},(qx=Hx||(Hx={})).defaultData=function(t){if("RectangleGeometry"===t)return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("UIGeometry"===t)return{type:t,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if("PathGeometry"===t)return{type:t,width:1,height:1,depth:1,path:Nx.defaultData(),extrusion:Xx};if("VectorGeometry"===t)return{width:1,height:1,type:t,subdivisions:12,shape:Fx.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if("BooleanGeometry"===t)return{type:t,operation:2,width:0,height:0,depth:0,phongAngle:35};if("ShapeBlendGeometry"===t)return{type:t,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if("TextGeometry"===t)return{type:t,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"===t)return{...qx.defaultData("TextGeometry"),type:t,editable:!0};if("SphereGeometry"===t)return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")};var Qx,Zx,Kx,Jx,$x,tb,eb,ib,nb,rb,sb,ab,ob,lb,hb,cb,db,ub,pb,fb,mb,gb,vb,yb,xb,bb,wb,Sb,_b,Ab,Mb,Cb,Eb,Pb,Tb,Db,Ib,Ob,Rb,Lb,Bb,zb,Fb=["width","height","depth"];
vendor: 4,690 bytes, line 2
2function Nb(t){t.layers.forEach(t=>{if("depth"===t.type&&void 0!==t.colorA){let e=t.colorA,i=t.colorB,n=[[e.r,e.g,e.b,e.a],[i.r,i.g,i.b,i.a]],r=[0,1];for(let t=2;t<10;t++)n.push(n[1]),r.push(1);let s={...Im(tv(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:n,steps:r,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,s)}else if("depth"===t.type&&1===t.gradientType&&(t.near<0||t.far<0)){let e={...tv(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,e)}})}function Ub(t,e){Object.values(t.shared.materials).forEach(t=>e(t))}function kb(t,e){t.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach((t,n)=>{void 0===t&&(i.materials[n]=zx.defaultData(),t=i.materials[n]),"string"!=typeof t&&e(t)}):"material"in i?"string"!=typeof i.material&&(void 0===i.material&&(i.material=zx.defaultData()),e(i.material)):"Mesh"===i.type&&(void 0===i.material&&(i.material=zx.defaultData()),e(i.material)),"overrides"in i&&Object.values(i.overrides).forEach(t=>{t.material&&"string"!=typeof t.material&&Object.getPrototypeOf(t.material)!==Pg.prototype&&e(t.material)})})}function Vb(t){void 0===t.layers&&Object.assign(t,zx.defaultTwoLayerData("lambert"))}function jb(t){!t.layers||t.layers.forEach(t=>{if("depth"===t.type&&10===t.colors.length){let e=[...t.colors];e.push(t.colors[9]);let i=[...t.steps];i.push(t.steps[9]);let n={...tv(t),colors:e,steps:i};Object.assign(t,n)}})}function Gb(t){t.scene.objects.traverse((t,e)=>{"materials"in e?e.materials.forEach(t=>{"string"!=typeof t&&jb(t)}):"material"in e&&"string"!=typeof e.material&&jb(e.material)}),Object.values(t.shared.materials).forEach(t=>jb(t))}function Wb(t){t.layers&&t.layers.forEach(t=>{"depth"===t.type&&void 0!==t.num&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function Hb(t){t.layers&&t.layers.forEach(t=>{(function(t){return"displace"!==t.type})(t)&&void 0===t.isMask&&(t.isMask=!1),("texture"===t.type||"video"===t.type)&&void 0===t.blending&&(t.blending=0),("noise"===t.type||"displace"===t.type&&"noise"===t.displacementType)&&(void 0===t.voronoiStyle&&(t.voronoiStyle=0),void 0===t.highCut&&(t.highCut=1),void 0===t.lowCut&&(t.lowCut=0),void 0===t.smoothness&&(t.smoothness=.3),void 0===t.seed&&(t.seed=0),void 0===t.quality&&(t.quality=1))})}function qb(t){let e=t.layers.find(t=>"light"===t.type)?.data;if("basic"===e?.category){let t=Bx.defaultData("light","phong"),i=e;Object.assign(i,t),i.visible=!1}}function Xb(t){Ub(t,qb),kb(t,qb)}function Yb(t){t.layers.forEach(t=>{"light"===t.type&&"toon"!==t.category&&void 0===t.occlusion&&(t.occlusion=!0)})}function Qb(t){t.layers&&t.layers.forEach(t=>{"light"===t.type&&void 0===t.bumpMapIntensity&&(t.bumpMapIntensity=5)})}function Zb(t,e){if(e<1&&(kb(t,Nb),Ub(t,Nb),t.schema=1),e<2&&(function(t){Object.assign(t.scene.publish,{orbitControls:{...xb.defaultData,...tv(t.scene.publish.orbitControls)}})}(t),t.schema=2),e<3&&(function(t){function e(t){if(t.layers)for(let e of Object.values(t.layers))if(e)for(let[t,i]of Object.entries(e))if((Ux.includes(t)||"boolean"==typeof i)&&delete e[t],"texture"===t)for(let[e,n]of Object.entries(i))(kx.includes(e)||"boolean"==typeof n)&&delete i[e]}t.scene.objects.traverse((t,i)=>{i.states.forEach(t=>{let i=t;i.material?e(i.material):i.materials&&i.materials.forEach(t=>{e(t)})})})}(t),t.schema=3),e<4&&(function(t){t.scene.publish.withBackground=!0}(t),t.schema=4),e<5&&(function(t){t.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}(t),t.schema=5),e<6&&(function(t){t.scene.objects.traverse((t,e)=>{let i=e.cloner;i&&(i.radial.scale=i.radial.scale.map(t=>t+1),i.linear.scale=i.linear.scale.map(t=>t+1))})}(t),t.schema=6),e<7&&(function(t){t.scene.objects.traverse((t,e)=>{let i=e.geometry;i&&("DodecahedronGeometry"===i.type||"IcosahedronGeometry"===i.type)&&(i.detail=Math.round(i.detail))})}(t),t.schema=7),e<8&&(t.schema=8),e<9&&(Gb(t),t.schema=9),e<10&&(function(t){t.scene.objects.traverse((t,e)=>{"Mesh"===e.type&&("BooleanGeometry"===e.geometry.type||"SubdivGeometry"===e.geometry.type)&&(e.geometry.phongAngle=35)})}(t),t.schema=10),e<11&&(function(t){t.scene.environment.ambientLight.softShadows=!1,t.scene.environment.ambientLight.softShadowQuality="low",t.scene.objects.traverse((t,e)=>{("DirectionalLight"===e.type||"SpotLight"===e.type)&&(e.shadowResolution=1024,e.shadowRadius=1,e.depth=1e5)}),t.shared.penumbraSize=new Array(5).fill(.5)}(t),t.schema=11),e<12&&(Gb(t),t.schema=12),e<13&&(function(t){t.shared.audios=zm({},dg.prototype)}(t),t.schema=13),e<14&&(function(t){let e=t.shared.materials;Object.entries(e).forEach(([t,i])=>
vendor: 32,510 bytes, line 2
2{if(!i.layers){let i={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"}]};Object.assign(e,{[t]:i})}})}(t),t.schema=14),e<15&&(function(t){Object.entries(tv(t.shared.images)).filter(t=>!1===t[1].asset).map(t=>t[0]).forEach(e=>{delete t.shared.images[e]}),Object.entries(tv(t.shared.audios)).filter(t=>!1===t[1].asset).map(t=>t[0]).forEach(e=>{delete t.shared.audios[e]})}(t),t.schema=15),e<16&&(function(t){t.scene.publish.settings.web.preload=!1}(t),t.schema=16),e<17&&(kb(t,Wb),Ub(t,Wb),t.schema=17),e<18&&(kb(t,Vb),Ub(t,Vb),t.schema=18),e<19&&(function(t){Object.assign(t.scene.publish.settings,{video:{...bb.defaultData.settings.video,...tv(t.scene.publish.settings.video)}})}(t),t.schema=19),e<20&&(function(t){t.shared.fonts=zm({},dg.prototype)}(t),function(t){let e=[];t.scene.objects.traverse((i,n)=>{let r=n;if("TextFrame"===r.type){let n=zx.defaultTwoLayerData("phong"),s="string"==typeof r.color?t.shared.colors[r.color]:r.color;n.layers[1].data.color={r:s.r,g:s.g,b:s.b},n.layers[1].data.alpha=r.alpha;let a=function(t){return t.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(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}(r.font);void 0===t.shared.fonts[a]&&(t.shared.fonts[a]={name:a});let o={name:r.name,...ab.defaultData,...db.defaultData,flatShading:!1,wireframe:!1,geometry:{...Hx.defaultData("TextGeometry"),width:r.width,height:r.height,font:a,depth:0,horizontalAlign:r.horizontalAlign,verticalAlign:r.verticalAlign,fontSize:1.40625*r.fontSize,lineHeight:r.lineHeight/1.40625,letterSpacing:r.letterSpacing-1,text:r.text,textTransform:r.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:n,states:tv(r.states),events:tv(r.events),visible:r.visible,raycastLock:r.raycastLock,position:r.position,rotation:r.rotation,scale:r.scale,hiddenMatrix:r.hiddenMatrix},l=tv(t.scene.objects).parent(i);t.scene.objects.insertAfter(l??null,i,[{id:i+"new",data:o,children:[]}]),e.push(i)}}),e.forEach(e=>{t.scene.objects.delete(e)})}(t),t.schema=20),e<21&&(function(t){let e={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};t.scene.objects.traverse((t,i)=>{i.events.forEach(t=>{if(e[Number(t.type)])if(Object.assign(t,{type:e[Number(t.type)]}),"Audio"===t.type&&"audioEvent"in t&&(Object.assign(t,{playAudio:t.audioEvent}),delete t.audioEvent),"GameControl"===t.type)Object.assign(t,{gameActions:{idle:new wg,move:new wg,jump:new wg}});else{let e=new wg;Object.assign(t,{actions:e}),("MouseDown"===t.type||"MouseUp"===t.type||"KeyDown"===t.type||"KeyUp"===t.type)&&"url"in t&&e.push({fi:0,id:Wt.generateUUID(),data:{type:"Link",url:t.url,delay:0}}),"targets"in t&&(t.targets.forEach((t,i,n)=>{let r={easing:t.easing,duration:t.duration};6===t.easing?Object.assign(r,Im(t,"mass","stiffness","damping","velocity")):5===t.easing&&Object.assign(r,{control1:{...t.control1},control2:{...t.control2}});let s={repeat:t.repeat?-1:0,delay:t.delay,delayDirection:t.delayDirection,direction:t.cycle&&t.rewind?"pingpong-rewind":t.cycle?"pingpong":"normal"},a={state:t.state,...s,...r},o={allowSlerp:!0,type:"Transition",object:t.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new wg({fi:0,id:Wt.generateUUID(),data:{state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4}},{fi:1,id:Wt.generateUUID(),data:a})};e.push({fi:n,id:i,data:o})}),delete t.targets)}})})}(t),function(t){t.scene.objects.traverse((t,e)=>{function i(t,i){let n=new wg,r=[];if(e.events.forEach((t,e,s)=>{if("Audio"===t.type&&t.trigger===i){let i;r.push(e),"play"===t.interaction?i={...Im(t,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in t?t.after:void 0,toggle:"after"in t?t.toggle:void 0,type:"Audio"}:("pause"===t.interaction||"stop"===t.interaction)&&(i={...Im(t,"interaction","delay","object","playAudio"),type:"Audio"}),i&&n.push({fi:s,id:e,data:i})}}),r.forEach(t=>e.events.delete(t)),n.length){let i=e.events.find(e=>e.type===t)?.data;i?"actions"in i&&i.actions.insertBefore(null,n):e.events.insertBefore(null,[{id:Wt.generateUUID(),data:{type:t,actions:n}}])}}i("Start","start"),i("MouseDown","mouseDown"),i("MouseUp","mouseUp"),i("KeyDown","keyDown"),i("KeyUp","keyUp")})}(t),t.schema=21),e<22&&(Xb(t),t.schema=22),e<23&&(function(t){t.scene.objects.traverse((t,e)=>{"Mesh"===e.type&&"SubdivGeometry"===e.geometry.type&&(e.geometry.scaleBaked||(e.geometry.scaleBaked=[1,1,1]))})}(t),t.schema=23),e<24&&(function(t){t.scene.objects.traverse((t,e)=>{("Empty"===e.type||"Mesh"===e.type)&&e.cloner&&!e.cloner.randomnessObject&&!e.cloner.toObject&&!e.cloner.randomness&&(e.cloner={...e.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"}})})}(t),t.schema=24),(e<25||void 0===t.shared.videos)&&(function(t){t.shared.videos=zm({},dg.prototype)}(t),e<25&&(t.schema=25)),e<26&&(function(t){t.scene.objects.traverse((e,i)=>{let n=t.scene.objects.unproxy().parent(e);if(n){let e=tv(t.scene.objects.data(n));e&&"Mesh"===e.type&&"BooleanGeometry"===e.geometry.type&&"Mesh"===i.type&&(i.visible=!0!==tv(i).booleanExclude)}})}(t),t.schema=26),e<27&&(function(t){t.scene.objects.traverse((t,e)=>{if("Mesh"===e.type){let t=e;"NonParametricGeometry"===e.geometry.type?void 0!==t.material&&delete t.material:void 0!==t.materials&&delete t.materials}})}(t),t.schema=27),e<28&&(Xb(t),t.schema=28),e<29&&(function(t){function e(t){Object.setPrototypeOf(t,Pg.prototype),t.texture&&Object.setPrototypeOf(t.texture,Pg.prototype)}function i(t){Object.setPrototypeOf(t,Pg.prototype);for(let i in t)e(t[i])}t.scene.objects.traverse((t,e)=>{e.states.forEach(t=>{let e=t;if(e.material){let t=tv(e.material).layers;i(t),e.material.layers=t}if(e.materials)for(let n=0;n<e.materials.length;n++){let t=e.materials[n],r=tv(t).layers;i(r),t.layers=r}})})}(t),t.schema=29),e<30&&(function(t){t.scene.objects.traverse((t,e)=>{"Mesh"===e.type&&"NonParametricGeometry"===e.geometry.type&&!("material"in e)&&!("materials"in e)&&(e.material=zx.defaultTwoLayerData("phong"))})}(t),t.schema=30),e<31&&(function(t){void 0===t.scene.publish.orbitControls.autoZoom&&(t.scene.publish.orbitControls.autoZoom=!1),t.scene.objects.traverse((t,e)=>{("OrthographicCamera"===e.type||"PerspectiveCamera"===e.type)&&(void 0===e.orthographic.autoZoom&&(e.orthographic.autoZoom=!1),void 0===e.orthographic.autoZoomFrustumSize&&(e.orthographic.autoZoomFrustumSize=790))})}(t),t.schema=31),e<33&&(function(t){t.scene.objects.traverse((t,e)=>{void 0===e.pathSnapping&&(e.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),void 0===e.pathSnapping.offset&&(e.pathSnapping.offset=0)})}(t),t.schema=33),e<34&&(function(t){void 0===t.scene.publish.mouseEventTarget&&(t.scene.publish.mouseEventTarget="canvas"),void 0===t.scene.publish.settings.web.hint&&(t.scene.publish.settings.web.hint=!1)}(t),t.schema=34),e<35&&(function(t){let{video:e}=t.scene.publish.settings;"gif"===e.format&&e.fps>48&&(e.fps=15)}(t),t.schema=35),e<36&&(function(t){t.scene.objects.traverse((t,e)=>{e.events.forEach(t=>{"GameControl"===t.type&&(t.resetYPosition=Math.abs(t.resetYPosition-e.position[1]))})})}(t),t.schema=36),e<37&&(function(t){let e=t.scene.environment.usePhysics;t.scene.objects.traverse((t,i)=>{e&&null===i.physics?i.collision=!1:i.collision="visibility"})}(t),t.schema=37),e<38&&(kb(t,Hb),Ub(t,Hb),t.schema=38),e<39&&(function(t){t.scene.objects.traverse((t,e)=>{e.events.forEach(t=>{"GameControl"===t.type&&(t.navmesh=zb.defaultDataThirdPerson.navmesh)})})}(t),t.schema=39),e<40&&(function(t){t.scene.styles||(t.scene.styles=_b.defaultData())}(t),t.schema=40),e<41&&(function(t){void 0===t.scene.environment.ambientLight.occlusion&&(t.scene.environment.ambientLight.occlusion=!1),void 0===t.scene.environment.ambientLight.aoFullRes&&(t.scene.environment.ambientLight.aoFullRes=!1),void 0===t.scene.environment.ambientLight.radius&&(t.scene.environment.ambientLight.radius=256),void 0===t.scene.environment.ambientLight.bias&&(t.scene.environment.ambientLight.bias=.5),void 0===t.scene.environment.ambientLight.aoColor&&(t.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),kb(t,Yb),Ub(t,Yb)}(t),t.schema=41),e<42&&(function(t){t.scene.objects.traverse((t,e)=>{e.events.forEach(t=>{"GameControl"===t.type&&Object.assign(t.gameActions,{run:new wg})})})}(t),t.schema=42),e<43&&(function(t){t.scene.objects.traverse((t,e)=>{e.events.forEach(t=>{"GameControl"===t.type&&(t.keyAssignments=[...t.keyAssignments,["run","⇧"],["none","Ctrl"]])})})}(t),t.schema=43),e<99){kb(t,Qb),Ub(t,Qb),null===t.scene.publish.playCamera&&(t.scene.publish.playCamera=sx);let e=tv(t.scene.objects),i=t.scene.objects;t.scene.publish.playPage=ax,i.insertBefore(null,null,[{id:ax,data:{...gb.defaultData,backgroundColor:t.scene.backgroundColor,fog:t.scene.fog,postprocessing:t.scene.postprocessing,ao:Im(t.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:t.scene.publish.playCamera,gameControlObject:t.scene.publish.gameControlObject},shadow:Im(t.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...tb.defaultData,...Im(t.scene.environment,"usePhysics","gravity")},camera:tv(t.scene.ownerCamera)??gb.defaultData.camera,name:"Scene"},children:[]}]);for(let t of e)t.id!==Mb.TRASH_CAN_ID&&i.move(ax,t.fi,t.id);let n=0,r=0;t.shared.penumbraSize&&t.scene.objects.traverse((e,i)=>{"DirectionalLight"===i.type?(i.penumbraSize=t.shared.penumbraSize[Math.min(n,2)],n+=1):"SpotLight"===i.type&&(i.penumbraSize=t.shared.penumbraSize[3+Math.min(r,1)],r+=1),(void 0===i.physics||null===i.physics)&&"Instance"!==i.type&&(i.physics={},Object.assign(i.physics,wx.defaultData)),void 0!==i.physics&&null!==i.physics&&(i.physics.enabled=i.collision??"visibility",delete i.collision)}),t.schema=99}}function Kb(t){t.layers&&t.layers.forEach(t=>{"light"===t.type&&void 0===t.alphaOverride&&(t.alphaOverride=1)})}(Qx||(Qx={})).defaultData={enabled:!1,useBackgroundColor:!1,color:tx.white,near:.1,far:2e3},(()=>{let t={opacity:1,blendFunction:13,enabled:!1};(Zx||(Zx={})).defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})(),(Kx||(Kx={})).defaultData={softShadowQuality:"low"},(Jx||(Jx={})).defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75},($x||($x={})).defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}},(tb||(tb={})).defaultData={usePhysics:!1,gravity:-10},(eb||(eb={})).defaultData={playCamera:sx,gameControlObject:null},(ib||(ib={})).defaultData={backgroundColor:ix.fromHexAndA(2960946,1),postprocessing:Zx.defaultData,fog:Qx.defaultData,globalPhysics:tb.defaultData,ambient:Jx.defaultData,ao:$x.defaultData,shadow:Kx.defaultData,publish:eb.defaultData},(nb||(nb={})).defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95},(t=>{t.isComponentRelated=function(t){return"Component"===t||"Instance"===t},t.isEmptyOrComponent=function(t){return"Empty"===t||"Instance"===t}})(rb||(rb={})),(t=>{t.identity={...rx.identity,hiddenMatrix:Jy.identity},t.fromObject=function(t){return{position:t.position,rotation:t.rotation,scale:t.scale,hiddenMatrix:t.hiddenMatrix}},t.merge=function(t,e){return{position:e?.position||t.position,rotation:e?.rotation||t.rotation,scale:e?.scale||t.scale,hiddenMatrix:e?.hiddenMatrix||t.hiddenMatrix}},t.diff=function(t,e){return Bm({position:Yy.isEqual(t.position,e.position)?void 0:e.position,rotation:Yy.isEqual(t.rotation,e.rotation)?void 0:e.rotation,scale:Yy.isEqual(t.scale,e.scale)?null:e.scale,hiddenMatrix:Jy.isEqual(t.hiddenMatrix,e.hiddenMatrix)?void 0:e.hiddenMatrix})}})(sb||(sb={})),(ab||(ab={})).defaultData={states:new wg,events:new wg,visible:!0,raycastLock:!1,physics:wx.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...sb.identity,cloner:null},(ob||(ob={})).defaultData={type:"Empty",...ab.defaultData},(lb||(lb={})).defaultData={type:"ParticleCollider",...nb.defaultData,...ab.defaultData},(hb||(hb={})).defaultData={type:"Component",...ab.defaultData},(cb||(cb={})).defaultData={type:"Particle",...ab.defaultData,...bx.defaultData},(db||(db={})).defaultData={type:"Mesh",...ab.defaultData,...Ax.defaultData},(ub||(ub={})).defaultData={...ab.defaultData,...sb.identity,position:[0,0,px.DefaultTargetOffset],...px.defaultData},(t=>{t.defaultData=function(t){return{...ab.defaultData,...xx.defaultData(t)}},t.defaultDirectionalLightData={...t.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(pb||(pb={})),(t=>{function e(t,e,i=0){for(;i<e.length;){let n=t?t[e[i]]:void 0;if(e.length===i+1)return n;if(!n)return;t=n.descendants,i+=1}}t.resolveWithDes=e,t.resolve=function(t,i,n=0){let r=e(t,i,n);if(r){let t=Object.keys(r);if(1===t.length&&"descendants"===t[0])return}return r}})(fb||(fb={})),(t=>{function e(t,e){return{...ab.defaultData,...e,component:t,overrides:new Pg,physics:void 0,events:void 0,type:"Instance"}}t.rootOverrideProps=["physics","events"],t.compositeNonOptionalOverrideProps=["geometry"],t.compositeEntireOverrideOverrideProps=["material"],t.ofComponent=e,t.fromComponentData=function(t){let i=sb.fromObject(t.data);return e(t.id,i)}})(mb||(mb={})),(t=>{t.defaultData={type:"Page",...ab.defaultData,physics:{...wx.defaultData,fusedBody:!1},...ib.defaultData,camera:ub.defaultData},t.isUIPage=function(t){return void 0!==t.uiScene}})(gb||(gb={})),(t=>{t.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Jy.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:wx.defaultData,states:new wg,events:new wg,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...px.defaultData},t.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"]},t.defaultMeshObject={name:"Rectangle",...ab.defaultData,...db.defaultData,geometry:Hx.defaultData("RectangleGeometry"),material:zx.defaultTwoLayerData("phong","layer1","layer2")},t.defaultBooleanObject={name:"Boolean",...ab.defaultData,...db.defaultData,geometry:Hx.defaultData("BooleanGeometry"),material:zx.defaultTwoLayerData("phong","layer1","layer2")},t.defaultShapeBlendObject={name:"Shape Blend",...ab.defaultData,...db.defaultData,geometry:Hx.defaultData("ShapeBlendGeometry"),material:zx.defaultTwoLayerData("phong","layer1","layer2")},t.defaultTextObject={name:"Text",...ab.defaultData,...db.defaultData,geometry:Hx.defaultData("TextGeometry"),material:zx.defaultTwoLayerData("phong","layer1","layer2")},t.defaultInputObject={name:"Input",...ab.defaultData,...db.defaultData,geometry:Hx.defaultData("InputGeometry"),material:zx.defaultTwoLayerData("phong","layer1","layer2")}})(vb||(vb={})),(t=>{t.newEmpty=function(t,e){let i={name:e};return"Mesh"===t.type?(i.geometry={},"material"in t&&(i.material={layers:new Pg}),"materials"in t&&(i.materials=t.materials.map(t=>({layers:new Pg})))):ux.is(t.type)&&(i.perspective={},i.orthographic={}),i},t.toOps=function(t,e){let i,n=[],r={orthographic:0,perspective:0,geometry:0};function s(t,e){for(let[i,r]of Object.entries(e.layers)){let{texture:e,...s}=r;if(void 0!==e&&Object.keys(e).length>0){let r={path:[...t,"layers",i,"texture"],props:e,type:0};n.push(r)}if(Object.keys(s).length>0){let e={path:[...t,"layers",i],props:s,type:0};n.push(e)}}}for(let[a,o]of Object.entries(e))if("name"!==a)if("cloner"===a)n.push(...mx.toOps(o,["cloner"]));else if("pathSnapping"===a)n.push({path:[a],props:{slide:o.slide,offset:o.offset},type:0});else if("material"===a)s(["material"],o);else if("materials"===a)for(let[t,e]of Object.entries(o))s(["materials",t],e);else if(0===r[a]){if("geometry"===a&&void 0!==o.extrusion){let t={path:[a,"extrusion"],props:o.extrusion,type:0};n.push(t),o={...o},delete o.extrusion}if(Object.keys(o).length>0){let t={path:[a],props:o,type:0};n.push(t)}}else void 0===i&&(i={path:[],props:{},type:0},n.push(i)),i.props[a]=o;return n},t.patch=function(t,e){if(void 0===e)return t;let i={...t};if(Object.assign(i,sb.merge(i,e)),Object.assign(i,{pathSnapping:Object.assign({},i.pathSnapping,{slide:e.pathSnapping?.slide??i.pathSnapping?.slide??0,offset:e.pathSnapping?.offset??i.pathSnapping?.offset??0})}),ux.is(t.type)){i.orthographic={...i.orthographic},i.perspective={...i.perspective};let t=e;void 0!==t.orthographic?.zoom&&(i.orthographic.zoom=t.orthographic.zoom),void 0!==t.perspective?.zoom&&(i.perspective.zoom=t.perspective.zoom),void 0!==t.isUpVectorFlipped&&(i.isUpVectorFlipped=t.isUpVectorFlipped),void 0!==t.targetOffset&&(i.targetOffset=t.targetOffset)}else if("Mesh"===t.type)"geometry"in e&&Object.assign(i,{geometry:Wx.merge(i.geometry,e.geometry)}),(e.material||e.materials)&&(i=function(t,e){if(void 0===e)return t;let i={...t};return"material"in i&&"material"in e&&e.material&&(i.material=$g(i.material,t=>{if("string"!=typeof t)for(let[i,n]of Object.entries(e.material.layers)){let e=t.layers.data(i);e&&Bx.patch(e,n)}}).data),i.materials&&e.materials&&(i.materials=$g(i.materials,t=>{for(let n=0;n<i.materials.length;n++){let i=e.materials[n];if("string"!=typeof i)for(let[e,r]of Object.entries(i.layers)){let i=t[n]?.layers?.data(e);i&&Bx.patch(i,r)}}}).data),i}(i,e)),i.cloner&&"cloner"in e&&Object.assign(i,{cloner:fx.merge(i.cloner,e.cloner)});else if("Empty"===t.type)i.cloner&&"cloner"in e&&Object.assign(i,{cloner:fx.merge(i.cloner,e.cloner)});else if(yx.is(t.type)){let t=e;void 0!==t.intensity&&(i.intensity=t.intensity),void 0!==t.color&&("string"==typeof t.color?i.color=t.color:i.color=tx.clone(t.color))}return i}})(yb||(yb={})),(xb||(xb={})).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,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},(bb||(bb={})).defaultData={orbitControls:xb.defaultData,playPage:ax,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,e)=>{let i=0,n=0;return e<5?n=-30:e<10&&(n=30),0===e||10===e||5===e?i=30:(4===e||11===e||9===e)&&(i=-30),[120,[i,n],"show"]}),settings:{image:{format:"jpg",ratio:1},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3},video:{format:"mp4",imageFormat:"jpg",fps:30,mbps:80,ratio:Math.max(1,typeof window<"u"?Math.floor(window.devicePixelRatio):1),stopMode:"manual",duration:5e3},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70}},stopRaycast:!0,hdTransmission:!1},(wb||(wb={})).defaultData={id:"basic",label:"Basic",style:"None",prompt:""},(Sb||(Sb={})).defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0},(t=>{t.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...wb.defaultData},isRandomSeed:!0,seed:t.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:Sb.defaultData}),t.generateSeed=()=>Math.round(1e5*Math.random())})(_b||(_b={})),(t=>{t.physicsEnabled=function(t){return void 0!==t.find(t=>"Page"===t.data.type&&t.data.globalPhysics.usePhysics)},t.traverseModuleInstances=function(t,e,i){t.scene.objects.traverseFrom(e,(e,n)=>{if("Instance"===n.type){let r=ew.getComponentData(t,n.component)?.data;r&&i(e,n,r.events)}else i(e,n,n.events)})}})(Ab||(Ab={})),(t=>{function e(e=!0,i=[]){let n=[],r=vb.defaultMeshObject;e&&(n.push({...t.defaultLight}),n.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:r,children:[]})),n.push(...i);let s=new bg;return s.push({fi:1,id:ax,data:{...gb.defaultData,name:"Scene 1"},children:n}),s}function i(e){return{...t.defaultData,objects:zm(e,bg.prototype)}}t.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",t.defaultLight={fi:-1,data:pb.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},t.createDefaultObjectTreeWithPage=e,t.defaultData={objects:e(),publish:bb.defaultData,styles:_b.defaultData()},t.emptyDataWithoutPage=function(){return{objects:new bg,publish:bb.defaultData,styles:_b.defaultData()}},t.emptyDataWithPage=function(t=!0){return{objects:e(t),publish:bb.defaultData,styles:_b.defaultData()}},t.emptyData=function(){return{objects:new bg,publish:{...bb.defaultData},styles:_b.defaultData()}},t.withObjs=i,t.withObj=function(t,e){return i([{id:t,data:e,children:[],fi:0}])}})(Mb||(Mb={})),(Cb||(Cb={})).defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}},(t=>{t.defaultData=t=>({url:t,name:"New Webhook",parametersSchemas:new wg}),t.defaultParameterValueByType=t=>"number"===t?0:"boolean"!==t&&""})(Eb||(Eb={})),(Pb||(Pb={})).defaultData=(t,e="GET")=>({url:t,method:e,name:"New API",headers:new wg,queries:new wg,autoStart:!0}),(t=>{function e(t){return void 0!==t.textValue}function i(t){return"boolean"==typeof t}t.isTextValue=e,t.isNumber=function(t){return"number"==typeof t},t.isBoolean=i,t.typeOfVariable=function(t){return e(t)?"string":i(t)?"boolean":"number"},t.getDisplayedValue=function(e){return t.isTextValue(e)?Array.isArray(e.textValue)?e.textValue.map(t=>t.toString().padStart(e.padding??2,"0")).join(e.deliminator??":")+(void 0!==e.suffix?" "+e.suffix:""):e.textValue.toString():t.isBoolean(e)?e?"True":"False":t.isNumber(e)?parseFloat(e.toFixed(3)).toString():e.toString()}})(Tb||(Tb={})),(Db||(Db={})).all=["images","videos","colors","audios","particles","fonts","materials","variables"],(Ib||(Ib={})).all=[...Db.all,"components"],(Ob||(Ob={})).defaultData=function(){return{images:new dg,videos:new dg,colors:new dg,audios:new dg,particles:new dg,fonts:new dg,materials:new dg,components:new dg,variables:new dg,userAPIs:new dg,userWebhooks:new dg}},(Rb||(Rb={})).defaultData=function(){return{images:new dg,videos:new dg,colors:new dg,audios:new dg,particles:new dg,fonts:new dg,materials:new dg,components:new dg,variables:new dg,userAPIs:new dg,userWebhooks:new dg}},(t=>{t.defaultColors=function(){let t={"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}};return zm(t,dg.prototype)},t.defaultImages=function(){return zm({},dg.prototype)},t.emptyData=function(){return{catelogs:new dg,materials:new dg,images:new dg,videos:new dg,colors:new dg,audios:new dg,particles:new dg,fonts:new dg,variables:new wg,userAPIs:new dg,userWebhooks:new dg,lib:Rb.defaultData()}},t.defaultVariables=function(t){switch(t){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}}},t.getFormattedTimerTime=function(t,e){if("HH:mm:ss"===e.format){let e=Math.floor(t/3600),i=Math.floor((t-3600*e)/60);return{textValue:[e,i,Math.round(t-3600*e-60*i)]}}if("mm:ss"===e.format){let e=Math.floor(t/60);return{textValue:[e,Math.round(t-60*e)]}}return t="number"===e.format?Math.round(t):Math.round(1e3*t)/1e3}})(Lb||(Lb={})),(Bb||(Bb={})).list=["idle","move","jump","run"],(t=>{t.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},t.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:t.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!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 wg,move:new wg,jump:new wg,run:new wg},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:ix.fromHexAndA(3728051,1)}}})(zb||(zb={}));var Jb=180/Math.PI;function $b(t){t.rotation=t.rotation.slice(0,3).map(t=>t*Jb)}function tw(t){$b(t),"Page"===t.type&&$b(t.camera),t.states?.forEach(t=>{void 0===t.rotation||null===t.rotation||(t.rotation=t.rotation.slice(0,3).map(t=>t*Jb))});let e=t.geometry;e&&"SphereGeometry"===e.type&&(e.thetaLength=(e.thetaLength??180)*Jb),e&&"TorusGeometry"===e.type&&(e.arc=e.arc*Jb),e&&"PathGeometry"===e.type&&(e.extrusion.angle*=Jb,e.extrusion.twist*=Jb),"Mesh"===t.type&&"TextGeometry"===t.geometry.type&&(t.geometry.text={textValue:t.geometry.text}),Array.isArray(tv(t.events))&&t.events?.forEach(t=>{("MouseDown"===t.type||"MouseUp"===t.type||"MousePress"===t.type||"KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type||"Collision"===t.type||"Trigger"===t.type)&&(t.runMode=t.toggle?"Toggle":"Repeat")})}var ew,iw,nw,rw,sw,aw,ow,lw,hw,cw,dw,uw,pw,fw,mw,gw,vw,yw,xw,bw,ww=116;function Sw(t,e){e(t.data);for(let i of t.children)Sw(i,e)}function _w(t){let e=t.schema??104;e!==ww&&e<105&&(Sw(t.asset,tw),t.schema=105)}function Aw(t){let e=t.schema??0;if(e!==ww){Zb(t,e),e<100&&(void 0===t.scene.publish.joystickSizeAndXYOffset&&(t.scene.publish.joystickSizeAndXYOffset=bb.defaultData.joystickSizeAndXYOffset),t.schema=100),e<101&&(kb(t,Kb),Ub(t,Kb),t.schema=101),e<102&&(function(t){t.scene.objects.traverse((t,e)=>{let i=e.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"))})}(t),t.schema=102),e<104&&(t.shared.catelogs=new dg,t.shared.lib=Rb.defaultData(),t.schema=104),e<105&&(function(t){t.shared.variables=zm({},dg.prototype)}(t),t.scene.objects.traverse((t,e)=>{tw(e)}),t.schema=105);for(let e of Object.values(t.shared.lib.components))_w(e);e<106&&(function(t){let e=tv(t.shared.variables);t.shared.variables=zm(Object.entries(e??{}).map(([t,e],i)=>({fi:i,id:t,data:e})),wg.prototype)}(t),t.schema=106),e<107&&(t.shared.lib.variables=Rb.defaultData().variables,t.schema=107),e<109&&(function(t){t.shared.particles=zm({},dg.prototype),t.shared.lib&&(t.shared.lib.particles=Rb.defaultData().particles)}(t),t.schema=109),e<110&&(function(t){t.scene.objects.traverse((t,e)=>{"Particle"===e.type&&"number"==typeof e.renderMaterial.size&&Object.assign(e.renderMaterial,{size:[e.renderMaterial.size,e.renderMaterial.size]})})}(t),t.schema=110),e<111&&(t.scene.objects.traverse((t,e)=>{!function(t){Array.isArray(tv(t.events))&&t.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),("MouseDown"===t.type||"MouseUp"===t.type||"MousePress"===t.type)&&(t.mode=t.mode||"Object")})}(e)}),t.schema=111),e<112&&(function(t){t.scene.objects.traverse((t,e)=>{"Page"===e.type&&(e.postprocessing.depthOfField.focusDistance=100,e.postprocessing.depthOfField.focalLength=20,e.postprocessing.depthOfField.bokehScale=5)})}(t),t.schema=112),e<113&&(function(t){t.scene.objects.traverse((t,e)=>{!1!==Array.isArray(tv(e.events))&&e.events?.forEach(t=>{let e=t.runMode;"MouseDown"===t.type||"MouseUp"===t.type||"KeyDown"===t.type||"KeyUp"===t.type||"Collision"===t.type||"Trigger"===t.type?t.actions?.forEach(t=>{"Transition"===t.type&&(t.runMode=e??"Repeat"),("Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Toggle"===e?"Toggle":"Normal")}):"MouseHover"===t.type||"MousePress"===t.type||"KeyPress"===t.type?t.actions?.forEach(t=>{("Transition"===t.type||"Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Toggle")}):"GameControl"===t.type?(delete t.actions,Object.keys(t.gameActions).forEach(e=>{t.gameActions[e]?.forEach(t=>{"Transition"===t.type&&(t.runMode="Repeat"),"Animation"===t.type&&(t.runMode="Normal")})})):"DragDrop"===t.type?(delete t.actions,t.dragDropActions?.drag?.forEach(t=>{("Transition"===t.type||"Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Toggle")}),t.dragDropActions?.drop?.forEach(t=>{("Transition"===t.type||"Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Toggle")})):"Resize"===t.type?(delete t.actions,t.breakpoints?.forEach(t=>{t.actions?.forEach(t=>{("Transition"===t.type||"Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Toggle")})})):"Start"===t.type?t.actions?.forEach(t=>{"Transition"===t.type&&(t.runMode="Once"),("Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Normal")}):"VariableChange"===t.type||"Scroll"===t.type?t.actions?.forEach(t=>{"Transition"===t.type&&(t.runMode="Repeat"),("Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Normal")}):"Conditional"===t.type&&(delete t.actions,t.inActions?.forEach(t=>{"Transition"===t.type&&(t.runMode="Repeat"),("Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Normal")}),t.outActions?.forEach(t=>{"Transition"===t.type&&(t.runMode="Repeat"),("Animation"===t.type||"SwitchCamera"===t.type)&&(t.runMode="Normal")}))})})}(t),t.schema=113),e<114&&(void 0===t.scene.publish.settings.web.imageQuality&&(t.sce
2ne.publish.settings.web.imageQuality=70),t.schema=114),e<115&&(function(t){t.shared.userAPIs=zm({},dg.prototype),t.shared.userWebhooks=zm({},dg.prototype),t.shared.lib&&(t.shared.lib.userAPIs=Rb.defaultData().userAPIs,t.shared.lib.userWebhooks=Rb.defaultData().userWebhooks)}(t),t.schema=115),e<116&&(function(t){void 0===t.scene.publish.settings.videoStatic&&(t.scene.publish.settings.videoStatic=bb.defaultData.settings.videoStatic)}(t),t.schema=116)}}function Mw(t,e=!1){let i=null!==t[0].index,n=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},a={},o=t[0].morphTargetsRelative,l=new Qi,h=0;for(let c=0;c<t.length;++c){let d=t[c],u=0;if(i!==(null!==d.index))return null;for(let t in d.attributes){if(!n.has(t))return null;void 0===s[t]&&(s[t]=[]),s[t].push(d.attributes[t]),u++}if(u!==n.size)return null;if(o!==d.morphTargetsRelative)return null;for(let t in d.morphAttributes){if(!r.has(t))return null;void 0===a[t]&&(a[t]=[]),a[t].push(d.morphAttributes[t])}if(e){let t;if(i)t=d.index.count;else{if(void 0===d.attributes.position)return null;t=d.attributes.position.count}l.addGroup(h,t,c),h+=t}}if(i){let e=0,i=[];for(let n=0;n<t.length;++n){let r=t[n].index;for(let t=0;t<r.count;++t)i.push(r.getX(t)+e);e+=t[n].attributes.position.count}l.setIndex(i)}for(let c in s){let t=Cw(s[c]);if(!t)return null;l.setAttribute(c,t)}for(let c in a){let t=a[c][0].length;if(0===t)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[c]=[];for(let e=0;e<t;++e){let t=[];for(let n=0;n<a[c].length;++n)t.push(a[c][n][e]);let i=Cw(t);if(!i)return null;l.morphAttributes[c].push(i)}}return l}function Cw(t){let e,i,n,r=0;for(let o=0;o<t.length;++o){let s=t[o];if(s.isInterleavedBufferAttribute)return null;if(void 0===e&&(e=s.array.constructor),e!==s.array.constructor)return null;if(void 0===i&&(i=s.itemSize),i!==s.itemSize)return null;if(void 0===n&&(n=s.normalized),n!==s.normalized)return null;r+=s.array.length}let s=new e(r),a=0;for(let o=0;o<t.length;++o)s.set(t[o].array,a),a+=t[o].array.length;return new Ni(s,i,n)}(t=>{t.defaultData={schema:ww,scene:Mb.defaultData,frames:(new dg).add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Cb.defaultData),shared:{...Lb.emptyData(),colors:Lb.defaultColors()}},t.emptyDataForImports=function(){let t=Mb.emptyDataWithPage();return{schema:ww,scene:t,frames:(new dg).add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Cb.defaultData),shared:{...Lb.emptyData(),colors:Lb.defaultColors(),images:Lb.defaultImages()}}},t.emptyData=function(){return{schema:ww,scene:Mb.emptyDataWithPage(),frames:(new dg).add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Cb.defaultData),shared:Lb.emptyData()}},t.clipboard2dData=function(){return{schema:ww,scene:Mb.emptyData(),frames:new dg,shared:Lb.emptyData()}},t.collabHelper={...Eg,updateSchema:t=>(t.schema??0)<ww?$g(t,Aw):(t.schema??0)-ww},t.updateSchemaDirectly=function(e){let i=t.collabHelper.updateSchema(e);return"number"==typeof i?0===i?e:null:i.data},t.withoutLib=function(t){return{...t,shared:{...t.shared,lib:Rb.defaultData()}}},t.getComponentData=function(t,e){let i=t.scene.objects.get(e);if(i&&"Component"===i.data.type)return i;{let i=t.shared.lib.components[e];if(i)return i.asset}},t.hasSensitiveData=function(t){let e=Object.values(t.shared.userAPIs);for(let i of e){let t=i.headers;for(let e of t)if("authorization"===e.data.key.toLowerCase()&&""!==e.data.value)return!0}return!1}})(ew||(ew={})),(iw||(iw={})).emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"},(nw||(nw={})).is=function(t){return!0},(t=>{t.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]},t.merge=function(t,e){return{position:e?.position??t.position,rotation:e?.rotation??t.rotation,scale:e?.scale??t.scale,shear:e?.shear??t.shear}},t.diff=function(t,e){return Bm({position:Xy.isEqual(t.position,e.position)?void 0:e.position,rotation:t.rotation===e.rotation?void 0:e.rotation,scale:Xy.isEqual(t.scale,e.scale)?void 0:e.scale,shear:t.shear&&e.shear&&Xy.isEqual(t.shear,e.shear)?void 0:e.shear})}})(rw||(rw={})),(sw||(sw={})).defaultData={horizontalConstraint:0,verticalConstraint:0},(aw||(aw={})).defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8},(ow||(ow={})).defaultData={opacity:1,fill:{color:ix.fromHexAndA(ox,1),enabled:!0},stroke:{color:ix.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:ix.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:ix.from0to1([0,0,0,1]),enabled:!1,spread:0}},(t=>{t.newEmpty=function(t,e){return{name:e}},t.patch=function(t,e){if(void 0===e)return t;let i={...t};return Object.assign(i,rw.merge(i,e)),i=function(t,e){if(void 0===e)return t;let i={...t},n=["width","height","cornerRadius"];for(let r of n)r in i&&r in e&&void 0!==e[r]&&Object.assign(i,{[r]:e[r]});return i}(i,e),i=function(t,e){if(void 0===e)return t;let i={...t};return"fill"in i&&"fill"in e&&void 0!==e.fill&&Object.assign(i,{fill:{...i.fill,...e.fill}}),"stroke"in i&&"stroke"in e&&void 0!==e.stroke&&Object.assign(i,{stroke:{...i.stroke,...e.stroke}}),"layerBlur"in i&&"layerBlur"in e&&void 0!==e.layerBlur&&Object.assign(i,{layerBlur:{...i.layerBlur,...e.layerBlur}}),"backgroundBlur"in i&&"backgroundBlur"in e&&void 0!==e.backgroundBlur&&Object.assign(i,{backgroundBlur:{...i.backgroundBlur,...e.backgroundBlur}}),"dropShadow"in i&&"dropShadow"in e&&void 0!==e.dropShadow&&Object.assign(i,{dropShadow:{...i.dropShadow,...e.dropShadow}}),"innerShadow"in i&&"innerShadow"in e&&void 0!==e.innerShadow&&Object.assign(i,{innerShadow:{...i.innerShadow,...e.innerShadow}}),i}(i,e),i},t.toOps=function(t,e){let i,n=[];for(let[r,s]of Object.entries(e))"name"!==r&&(void 0===i&&(i={path:[],props:{}
2,type:0},n.push(i)),i.props[r]=s);return n}})(lw||(lw={})),(hw||(hw={})).defaultData={...rw.defaultData,...sw.defaultData,states:new wg,events:new wg,visible:!0,raycastLock:!1},(cw||(cw={})).defaultData={...hw.defaultData,...ow.defaultData},(dw||(dw={})).defaultData={cornerRadius:[0,0,0,0]},(uw||(uw={})).defaultData={...cw.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"},(pw||(pw={})).defaultData={...cw.defaultData,...dw.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"},(fw||(fw={})).defaultData={...cw.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"},(mw||(mw={})).defaultData={...cw.defaultData,type:"path2d",path:"",name:"Path"},(gw||(gw={})).is=function(t){return"ellipse2d"===t.type||"rectangle2d"===t.type||"text2d"===t.type||"vector2d"===t.type||"path2d"===t.type},(vw||(vw={})).defaultData={...hw.defaultData,name:"Group",type:"group2d"},(yw||(yw={})).defaultData=()=>({...hw.defaultData,...dw.defaultData,...ow.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:ix.fromHexAndA(4737101,1),enabled:!0},stroke:{color:ix.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}),(t=>{t.defaultData=function(t){switch(t){case"rectangle2d":case"vector2d":return{...pw.defaultData};case"ellipse2d":return{...uw.defaultData};case"text2d":return{...fw.defaultData};case"path2d":return{...mw.defaultData};case"frame2d":return{...yw.defaultData()};case"group2d":return{...vw.defaultData}}},t.getPivot=function(t){return"width"in t&&"height"in t?["number"==typeof t.width?.5*t.width:0,"number"==typeof t.height?.5*t.height:0]:[0,0]},t.isResizeable=function(t){return"rectangle2d"===t.type||"ellipse2d"===t.type||"text2d"===t.type||"frame2d"===t.type},t.isAutoLayoutable=function(t){return"frame2d"===t.type&&void 0!==t.autoLayout},t.hasCorners=function(t){return"rectangle2d"===t.type||"frame2d"===t.type}})(xw||(xw={})),(t=>{t.defaultData={name:"UI",type:"scene2d",objects:new bg},t.emptyData=function(){return{type:"scene2d",objects:new bg}}})(bw||(bw={}));var Ew=Math.pow(2,-24),Pw=class{constructor(){}};function Tw(t,e,i){return i.min.x=e[t],i.min.y=e[t+1],i.min.z=e[t+2],i.max.x=e[t+3],i.max.y=e[t+4],i.max.z=e[t+5],i}function Dw(t){let e=-1,i=-1/0;for(let n=0;n<3;n++){let r=t[n+3]-t[n];r>i&&(i=r,e=n)}return e}function Iw(t,e){e.set(t)}function Ow(t,e,i){let n,r;for(let s=0;s<3;s++){let a=s+3;n=t[s],r=e[s],i[s]=n<r?n:r,n=t[a],r=e[a],i[a]=n>r?n:r}}function Rw(t,e,i){for(let n=0;n<3;n++){let r=e[t+2*n],s=e[t+2*n+1],a=r-s,o=r+s;a<i[n]&&(i[n]=a),o>i[n+3]&&(i[n+3]=o)}}function Lw(t){let e=t[3]-t[0],i=t[4]-t[1],n=t[5]-t[2];return 2*(e*i+i*n+n*e)}function Bw(t,e,i,n,r=null){let s=1/0,a=1/0,o=1/0,l=-1/0,h=-1/0,c=-1/0,d=1/0,u=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0,v=null!==r;for(let y=6*e,x=6*(e+i);y<x;y+=6){let e=t[y+0],i=t[y+1],n=e-i,r=e+i;n<s&&(s=n),r>l&&(l=r),v&&e<d&&(d=e),v&&e>f&&(f=e);let x=t[y+2],b=t[y+3],w=x-b,S=x+b;w<a&&(a=w),S>h&&(h=S),v&&x<u&&(u=x),v&&x>m&&(m=x);let _=t[y+4],A=t[y+5],M=_-A,C=_+A;M<o&&(o=M),C>c&&(c=C),v&&_<p&&(p=_),v&&_>g&&(g=_)}n[0]=s,n[1]=a,n[2]=o,n[3]=l,n[4]=h,n[5]=c,v&&(r[0]=d,r[1]=u,r[2]=p,r[3]=f,r[4]=m,r[5]=g)}var zw=32,Fw=(t,e)=>t.candidate-e.candidate,Nw=new Array(zw).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Uw=new Float32Array(6);function kw(t,e){function i(t){d&&d(t/u)}function n(t,e,r,d=null,u=0){if(!p&&u>=l&&(p=!0),r<=h||u>=l)return i(e+r),t.offset=e,t.count=r,t;let f=function(t,e,i,n,r,s){let a=-1,o=0;if(0===s)a=Dw(e),-1!==a&&(o=(e[a]+e[a+3])/2);else if(1===s)a=Dw(t),-1!==a&&(o=function(t,e,i,n){let r=0;for(let s=e,a=e+i;s<a;s++)r+=t[6*s+2*n];return r/i}(i,n,r,a));else if(2===s){let s=Lw(t),l=1.25*r,h=6*n,c=6*(n+r);for(let t=0;t<3;t++){let n=e[t],d=(e[t+3]-n)/zw;if(r<8){let e=[...Nw];e.length=r;let n=0;for(let r=h;r<c;r+=6,n++){let s=e[n];s.candidate=i[r+2*t],s.count=0;let{bounds:a,leftCacheBounds:o,rightCacheBounds:l}=s;for(let t=0;t<3;t++)l[t]=1/0,l[t+3]=-1/0,o[t]=1/0,o[t+3]=-1/0,a[t]=1/0,a[t+3]=-1/0;Rw(r,i,a)}e.sort(Fw);let d=r;for(let t=0;t<d;t++){let i=e[t];for(;
2t+1<d&&e[t+1].candidate===i.candidate;)e.splice(t+1,1),d--}for(let r=h;r<c;r+=6){let n=i[r+2*t];for(let t=0;t<d;t++){let s=e[t];n>=s.candidate?Rw(r,i,s.rightCacheBounds):(Rw(r,i,s.leftCacheBounds),s.count++)}}for(let i=0;i<d;i++){let n=e[i],h=n.count,c=r-n.count,d=n.leftCacheBounds,u=n.rightCacheBounds,p=0;0!==h&&(p=Lw(d)/s);let f=0;0!==c&&(f=Lw(u)/s);let m=1+1.25*(p*h+f*c);m<l&&(a=t,l=m,o=n.candidate)}}else{for(let t=0;t<zw;t++){let e=Nw[t];e.count=0,e.candidate=n+d+t*d;let i=e.bounds;for(let t=0;t<3;t++)i[t]=1/0,i[t+3]=-1/0}for(let r=h;r<c;r+=6){let e=~~((i[r+2*t]-n)/d);e>=zw&&(e=31);let s=Nw[e];s.count++,Rw(r,i,s.bounds)}let e=Nw[31];Iw(e.bounds,e.rightCacheBounds);for(let t=30;t>=0;t--){let e=Nw[t],i=Nw[t+1];Ow(e.bounds,i.rightCacheBounds,e.rightCacheBounds)}let u=0;for(let i=0;i<31;i++){let e=Nw[i],n=e.count,h=e.bounds,c=Nw[i+1].rightCacheBounds;0!==n&&(0===u?Iw(h,Uw):Ow(h,Uw,Uw)),u+=n;let d=0,p=0;0!==u&&(d=Lw(Uw)/s);let f=r-u;0!==f&&(p=Lw(c)/s);let m=1+1.25*(d*u+p*f);m<l&&(a=t,l=m,o=e.candidate)}}}}return{axis:a,pos:o}}(t.boundingData,d,a,e,r,c);if(-1===f.axis)return i(e+r),t.offset=e,t.count=r,t;let m=function(t,e,i,n,r){let s=i,a=i+n-1,o=r.pos,l=2*r.axis;for(;;){for(;s<=a&&e[6*s+l]<o;)s++;for(;s<=a&&e[6*a+l]>=o;)a--;if(!(s<a))return s;for(let i=0;i<3;i++){let n=t[3*s+i];t[3*s+i]=t[3*a+i],t[3*a+i]=n;let r=e[6*s+2*i+0];e[6*s+2*i+0]=e[6*a+2*i+0],e[6*a+2*i+0]=r;let o=e[6*s+2*i+1];e[6*s+2*i+1]=e[6*a+2*i+1],e[6*a+2*i+1]=o}s++,a--}}(o,a,e,r,f);if(m===e||m===e+r)i(e+r),t.offset=e,t.count=r;else{t.splitAxis=f.axis;let i=new Pw,o=e,l=m-e;t.left=i,i.boundingData=new Float32Array(6),Bw(a,o,l,i.boundingData,s),n(i,o,l,s,u+1);let h=new Pw,c=m,d=r-l;t.right=h,h.boundingData=new Float32Array(6),Bw(a,c,d,h.boundingData,s),n(h,c,d,s,u+1)}return t}!function(t,e){if(!t.index){let i,n=t.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;i=n>65535?new Uint32Array(new r(4*n)):new Uint16Array(new r(2*n)),t.setIndex(new Ni(i,1));for(let t=0;t<n;t++)i[t]=t}}(t,e);let r=new Float32Array(6),s=new Float32Array(6),a=function(t,e){let i=t.attributes.position,n=t.index.array,r=n.length/3,s=new Float32Array(6*r),a=i.normalized,o=i.array,l=i.offset||0,h=3;i.isInterleavedBufferAttribute&&(h=i.data.stride);let c=["getX","getY","getZ"];for(let d=0;d<r;d++){let t,r,u,p=3*d,f=6*d;a?(t=n[p+0],r=n[p+1],u=n[p+2]):(t=n[p+0]*h+l,r=n[p+1]*h+l,u=n[p+2]*h+l);for(let n=0;n<3;n++){let l,h,d;a?(l=i[c[n]](t),h=i[c[n]](r),d=i[c[n]](u)):(l=o[t+n],h=o[r+n],d=o[u+n]);let p=l;h<p&&(p=h),d<p&&(p=d);let m=l;h>m&&(m=h),d>m&&(m=d);let g=(m-p)/2,v=2*n;s[f+v+0]=p+g,s[f+v+1]=g+(Math.abs(p)+g)*Ew,p<e[n]&&(e[n]=p),m>e[n+3]&&(e[n+3]=m)}}return s}(t,r),o=t.index.array,l=e.maxDepth,h=(e.verbose,e.maxLeafTris),c=e.strategy,d=e.onProgress,u=t.index.count/3,p=!1,f=[],m=function(t){if(!t.groups||!t.groups.length)return[{offset:0,count:t.index.count/3}];let e=[],i=new Set;for(let r of t.groups)i.add(r.start),i.add(r.start+r.count);let n=Array.from(i.values()).sort((t,e)=>t-e);for(let r=0;r<n.length-1;r++){let t=n[r],i=n[r+1];e.push({offset:t/3,count:(i-t)/3})}return e}(t);if(1===m.length){let t=m[0],e=new Pw;e.boundingData=r,function(t,e,i,n){let r=1/0,s=1/0,a=1/0,o=-1/0,l=-1/0,h=-1/0;for(let c=6*e,d=6*(e+i);c<d;c+=6){let e=t[c+0];e<r&&(r=e),e>o&&(o=e);let i=t[c+2];i<s&&(s=i),i>l&&(l=i);let n=t[c+4];n<a&&(a=n),n>h&&(h=n)}n[0]=r,n[1]=s,n[2]=a,n[3]=o,n[4]=l,n[5]=h}(a,t.offset,t.count,s),n(e,t.offset,t.count,s),f.push(e)}else for(let g of m){let t=new Pw;t.boundingData=new Float32Array(6),Bw(a,g.offset,g.count,t.boundingData,s),n(t,g.offset,g.count,s),f.push(t)}return f}var Vw=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let i=1/0,n=-1/0;for(let r=0,s=t.length;r<s;r++){let s=t[r][e];i=s<i?s:i,n=s>n?s:n}this.min=i,this.max=n}setFromPoints(t,e){let i=1/0,n=-1/0;for(let r=0,s=e.length;r<s;r++){let s=e[r],a=t.dot(s);i=a<i?a:i,n=a>n?a:n}this.min=i,this.max=n}isSeparated(t){return this.min>t.max||t.min>this.max}};Vw.prototype.setFromBox=function(){let t=new be;return function(e,i){let n=i.min,r=i.max,s=1/0,a=-1/0;for(let o=0;o<=1;o++)for(let i=0;i<=1;i++)for(let l=0;l<=1;l++){t.x=n.x*o+r.x*(1-o),t.y=n.y*i+r.y*(1-i),t.z=n.z*l+r.z*(1-l);let h=e.dot(t);s=Math.min(h,s),a=Math.max(h,a)}this.min=s,this.max=a}}();
2var jw=function(){let t=new be,e=new be,i=new be;return function(n,r,s){let a=n.start,o=t,l=r.start,h=e;i.subVectors(a,l),t.subVectors(n.end,n.start),e.subVectors(r.end,r.start);let c,d,u=i.dot(h),p=h.dot(o),f=h.dot(h),m=i.dot(o),g=o.dot(o)*f-p*p;c=0!==g?(u*p-m*f)/g:0,d=(u+c*p)/f,s.x=c,s.y=d}}(),Gw=function(){let t=new Ht,e=new be,i=new be;return function(n,r,s,a){jw(n,r,t);let o=t.x,l=t.y;if(o>=0&&o<=1&&l>=0&&l<=1)return n.at(o,s),void r.at(l,a);if(o>=0&&o<=1)return l<0?r.at(0,a):r.at(1,a),void n.closestPointToPoint(a,!0,s);if(l>=0&&l<=1)return o<0?n.at(0,s):n.at(1,s),void r.closestPointToPoint(s,!0,a);{let t,h;t=o<0?n.start:n.end,h=l<0?r.start:r.end;let c=e,d=i;return n.closestPointToPoint(h,!0,e),r.closestPointToPoint(t,!0,i),c.distanceToSquared(h)<=d.distanceToSquared(t)?(s.copy(c),void a.copy(h)):(s.copy(t),void a.copy(d))}}}(),Ww=function(){let t=new be,e=new be,i=new En,n=new lh;return function(r,s){let{radius:a,center:o}=r,{a:l,b:h,c:c}=s;if(n.start=l,n.end=h,n.closestPointToPoint(o,!0,t).distanceTo(o)<=a||(n.start=l,n.end=c,n.closestPointToPoint(o,!0,t).distanceTo(o)<=a)||(n.start=h,n.end=c,n.closestPointToPoint(o,!0,t).distanceTo(o)<=a))return!0;let d=s.getPlane(i);if(Math.abs(d.distanceToPoint(o))<=a){let t=d.projectPoint(o,e);if(s.containsPoint(t))return!0}return!1}}();function Hw(t){return Math.abs(t)<1e-15}var qw=class extends Oi{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new be),this.satBounds=new Array(4).fill().map(()=>new Vw),this.points=[this.a,this.b,this.c],this.sphere=new Ve,this.plane=new En,this.needsUpdate=!0}intersectsSphere(t){return Ww(t,this)}update(){let t=this.a,e=this.b,i=this.c,n=this.points,r=this.satAxes,s=this.satBounds,a=r[0],o=s[0];this.getNormal(a),o.setFromPoints(a,n);let l=r[1],h=s[1];l.subVectors(t,e),h.setFromPoints(l,n);let c=r[2],d=s[2];c.subVectors(e,i),d.setFromPoints(c,n);let u=r[3],p=s[3];u.subVectors(i,t),p.setFromPoints(u,n),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,t),this.needsUpdate=!1}};qw.prototype.closestPointToSegment=function(){let t=new be,e=new be,i=new lh;return function(n,r=null,s=null){let a,{start:o,end:l}=n,h=this.points,c=1/0;for(let d=0;d<3;d++){let o=(d+1)%3;i.start.copy(h[d]),i.end.copy(h[o]),Gw(i,n,t,e),a=t.distanceToSquared(e),a<c&&(c=a,r&&r.copy(t),s&&s.copy(e))}return this.closestPointToPoint(o,t),a=o.distanceToSquared(t),a<c&&(c=a,r&&r.copy(t),s&&s.copy(o)),this.closestPointToPoint(l,t),a=l.distanceToSquared(t),a<c&&(c=a,r&&r.copy(t),s&&s.copy(l)),Math.sqrt(c)}}(),qw.prototype.intersectsTriangle=function(){let t=new qw,e=new Array(3),i=new Array(3),n=new Vw,r=new Vw,s=new be,a=new be,o=new be,l=new be,h=new lh,c=new lh,d=new lh;return function(u,p=null,f=!1){this.needsUpdate&&this.update(),u.isExtendedTriangle?u.needsUpdate&&u.update():(t.copy(u),t.update(),u=t);let m=this.plane,g=u.plane;if(Math.abs(m.normal.dot(g.normal))>1-1e-10){let t=this.satBounds,a=this.satAxes;i[0]=u.a,i[1]=u.b,i[2]=u.c;for(let e=0;e<4;e++){let r=t[e],s=a[e];if(n.setFromPoints(s,i),r.isSeparated(n))return!1}let o=u.satBounds,l=u.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let i=0;i<4;i++){let t=o[i],r=l[i];if(n.setFromPoints(r,e),t.isSeparated(n))return!1}for(let h=0;h<4;h++){let t=a[h];for(let a=0;a<4;a++){let o=l[a];if(s.crossVectors(t,o),n.setFromPoints(s,e),r.setFromPoints(s,i),n.isSeparated(r))return!1}}return p&&(p.start.set(0,0,0),p.end.set(0,0,0)),!0}{let t=this.points,e=!1,i=0;for(let o=0;o<3;o++){let n=t[o],r=t[(o+1)%3];h.start.copy(n),h.end.copy(r),h.delta(a);let s=e?c.start:c.end,l=Hw(g.distanceToPoint(n));
2if(Hw(g.normal.dot(a))&&l){c.copy(h),i=2;break}if((g.intersectLine(h,s)||l)&&!Hw(s.distanceTo(r))){if(i++,e)break;e=!0}}if(1===i&&u.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(2!==i)return!1;let n=u.points,r=!1,s=0;for(let a=0;a<3;a++){let t=n[a],e=n[(a+1)%3];h.start.copy(t),h.end.copy(e),h.delta(o);let i=r?d.start:d.end,l=Hw(m.distanceToPoint(t));if(Hw(m.normal.dot(o))&&l){d.copy(h),s=2;break}if((m.intersectLine(h,i)||l)&&!Hw(i.distanceTo(e))){if(s++,r)break;r=!0}}if(1===s&&this.containsPoint(d.end))return p&&(p.start.copy(d.end),p.end.copy(d.end)),!0;if(2!==s)return!1;if(c.delta(a),d.delta(o),a.dot(o)<0){let t=d.start;d.start=d.end,d.end=t}let f=c.start.dot(a),v=c.end.dot(a),y=d.start.dot(a),x=d.end.dot(a);return(f===x||y===v||v<y!==f<x)&&(p&&(l.subVectors(c.start,d.start),l.dot(a)>0?p.start.copy(c.start):p.start.copy(d.start),l.subVectors(c.end,d.end),l.dot(a)<0?p.end.copy(c.end):p.end.copy(d.end)),!0)}}}(),qw.prototype.distanceToPoint=function(){let t=new be;return function(e){return this.closestPointToPoint(e,t),e.distanceTo(t)}}(),qw.prototype.distanceToTriangle=function(){let t=new be,e=new be,i=["a","b","c"],n=new lh,r=new lh;return function(s,a=null,o=null){let l=a||o?n:null;if(this.intersectsTriangle(s,l))return(a||o)&&(a&&l.getCenter(a),o&&l.getCenter(o)),0;let h=1/0;for(let e=0;e<3;e++){let n,r=i[e],l=s[r];this.closestPointToPoint(l,t),n=l.distanceToSquared(t),n<h&&(h=n,a&&a.copy(t),o&&o.copy(l));let c=this[r];s.closestPointToPoint(c,t),n=c.distanceToSquared(t),n<h&&(h=n,a&&a.copy(c),o&&o.copy(t))}for(let c=0;c<3;c++){let l=i[c],d=i[(c+1)%3];n.set(this[l],this[d]);for(let c=0;c<3;c++){let l=i[c],d=i[(c+1)%3];r.set(s[l],s[d]),Gw(n,r,t,e);let u=t.distanceToSquared(e);u<h&&(h=u,a&&a.copy(t),o&&o.copy(e))}}return Math.sqrt(h)}}();var Xw=class{constructor(t,e,i){this.isOrientedBox=!0,this.min=new be,this.max=new be,this.matrix=new Ze,this.invMatrix=new Ze,this.points=new Array(8).fill().map(()=>new be),this.satAxes=new Array(3).fill().map(()=>new be),this.satBounds=new Array(3).fill().map(()=>new Vw),this.alignedSatBounds=new Array(3).fill().map(()=>new Vw),this.needsUpdate=!1,t&&this.min.copy(t),e&&this.max.copy(e),i&&this.matrix.copy(i)}set(t,e,i){this.min.copy(t),this.max.copy(e),this.matrix.copy(i),this.needsUpdate=!0}copy(t){this.min.copy(t.min),this.max.copy(t.max),this.matrix.copy(t.matrix),this.needsUpdate=!0}};Xw.prototype.update=function(){return function(){let t=this.matrix,e=this.min,i=this.max,n=this.points;for(let l=0;l<=1;l++)for(let r=0;r<=1;r++)for(let s=0;s<=1;s++){let a=n[1*l|2*r|4*s];a.x=l?i.x:e.x,a.y=r?i.y:e.y,a.z=s?i.z:e.z,a.applyMatrix4(t)}let r=this.satBounds,s=this.satAxes,a=n[0];for(let l=0;l<3;l++){let t=s[l],e=r[l],i=n[1<<l];t.subVectors(a,i),e.setFromPoints(t,n)}let o=this.alignedSatBounds;o[0].setFromPointsField(n,"x"),o[1].setFromPointsField(n,"y"),o[2].setFromPointsField(n,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}(),Xw.prototype.intersectsBox=function(){let t=new Vw;return function(e){this.needsUpdate&&this.update();let i=e.min,n=e.max,r=this.satBounds,s=this.satAxes,a=this.alignedSatBounds;if(t.min=i.x,t.max=n.x,a[0].isSeparated(t)||(t.min=i.y,t.max=n.y,a[1].isSeparated(t))||(t.min=i.z,t.max=n.z,a[2].isSeparated(t)))return!1;for(let o=0;o<3;o++){let i=s[o],n=r[o];if(t.setFromBox(i,e),n.isSeparated(t))return!1}return!0}}(),Xw.prototype.intersectsTriangle=function(){let t=new qw,e=new Array(3),i=new Vw,n=new Vw,r=new be;return function(s){this.needsUpdate&&this.update(),s.isExtendedTriangle?s.needsUpdate&&s.update():(t.copy(s),t.update(),s=t);let a=this.satBounds,o=this.satAxes;e[0]=s.a,e[1]=s.b,e[2]=s.c;for(let t=0;t<3;t++){let n=a[t],r=o[t];if(i.setFromPoints(r,e),n.isSeparated(i))return!1}let l=s.satBounds,h=s.satAxes,c=this.points;for(let t=0;t<3;t++){let e=l[t],n=h[t];if(i.setFromPoints(n,c),e.isSeparated(i))return!1}for(let t=0;t<3;t++){let s=o[t];for(let t=0;t<4;t++){let a=h[t];if(r.crossVectors(s,a),i.setFromPoints(r,e),n.setFromPoints(r,c),i.isSeparated(n))return!1}}return!0}}(),Xw.prototype.closestPointToPoint=function(){return function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix
2),e}}(),Xw.prototype.distanceToPoint=function(){let t=new be;return function(e){return this.closestPointToPoint(e,t),e.distanceTo(t)}}(),Xw.prototype.distanceToBox=function(){let t=["x","y","z"],e=new Array(12).fill().map(()=>new lh),i=new Array(12).fill().map(()=>new lh),n=new be,r=new be;return function(s,a=0,o=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(s))return(o||l)&&(s.getCenter(r),this.closestPointToPoint(r,n),s.closestPointToPoint(n,r),o&&o.copy(n),l&&l.copy(r)),0;let h=a*a,c=s.min,d=s.max,u=this.points,p=1/0;for(let t=0;t<8;t++){let e=u[t];r.copy(e).clamp(c,d);let i=e.distanceToSquared(r);if(i<p&&(p=i,o&&o.copy(e),l&&l.copy(r),i<h))return Math.sqrt(i)}let f=0;for(let n=0;n<3;n++)for(let r=0;r<=1;r++)for(let s=0;s<=1;s++){let a=(n+1)%3,o=(n+2)%3,l=1<<n|r<<a|s<<o,h=u[r<<a|s<<o],p=u[l];e[f].set(h,p);let m=t[n],g=t[a],v=t[o],y=i[f],x=y.start,b=y.end;x[m]=c[m],x[g]=r?c[g]:d[g],x[v]=s?c[v]:d[g],b[m]=d[m],b[g]=r?c[g]:d[g],b[v]=s?c[v]:d[g],f++}for(let t=0;t<=1;t++)for(let e=0;e<=1;e++)for(let i=0;i<=1;i++){r.x=t?d.x:c.x,r.y=e?d.y:c.y,r.z=i?d.z:c.z,this.closestPointToPoint(r,n);let s=r.distanceToSquared(n);if(s<p&&(p=s,o&&o.copy(n),l&&l.copy(r),s<h))return Math.sqrt(s)}for(let t=0;t<12;t++){let s=e[t];for(let t=0;t<12;t++){let e=i[t];Gw(s,e,n,r);let a=n.distanceToSquared(r);if(a<p&&(p=a,o&&o.copy(n),l&&l.copy(r),a<h))return Math.sqrt(a)}}return Math.sqrt(p)}}();var Yw=new be,Qw=new be,Zw=new be,Kw=new Ht,Jw=new Ht,$w=new Ht,tS=new be,eS=new be,iS=new be,nS=new be;function rS(t,e,i,n,r){let s=3*n,a=t.index.getX(s),o=t.index.getX(s+1),l=t.index.getX(s+2),{position:h,normal:c,uv:d,uv1:u}=t.attributes,p=function(t,e,i,n,r,s,a,o,l){Yw.fromBufferAttribute(e,s),Qw.fromBufferAttribute(e,a),Zw.fromBufferAttribute(e,o);let h=function(t,e,i,n,r,s){let a;return a=1===s?t.intersectTriangle(n,i,e,!0,r):t.intersectTriangle(e,i,n,2!==s,r),null===a?null:{distance:t.origin.distanceTo(r),point:r.clone()}}(t,Yw,Qw,Zw,nS,l);if(h){n&&(Kw.fromBufferAttribute(n,s),Jw.fromBufferAttribute(n,a),$w.fromBufferAttribute(n,o),h.uv=Oi.getInterpolation(nS,Yw,Qw,Zw,Kw,Jw,$w,new Ht)),r&&(Kw.fromBufferAttribute(r,s),Jw.fromBufferAttribute(r,a),$w.fromBufferAttribute(r,o),h.uv1=Oi.getInterpolation(nS,Yw,Qw,Zw,Kw,Jw,$w,new Ht)),i&&(tS.fromBufferAttribute(i,s),eS.fromBufferAttribute(i,a),iS.fromBufferAttribute(i,o),h.normal=Oi.getInterpolation(nS,Yw,Qw,Zw,tS,eS,iS,new be),h.normal.dot(t.direction)>0&&h.normal.multiplyScalar(-1));let e={a:s,b:a,c:o,normal:new be,materialIndex:0};Oi.getNormal(Yw,Qw,Zw,e.normal),h.face=e,h.faceIndex=s}return h}(i,h,c,d,u,a,o,l,e);return p?(p.faceIndex=n,r&&r.push(p),p):null}function sS(t,e,i,n){let r=t.a,s=t.b,a=t.c,o=e,l=e+1,h=e+2;i&&(o=i.getX(e),l=i.getX(e+1),h=i.getX(e+2)),r.x=n.getX(o),r.y=n.getY(o),r.z=n.getZ(o),s.x=n.getX(l),s.y=n.getY(l),s.z=n.getZ(l),a.x=n.getX(h),a.y=n.getY(h),a.z=n.getZ(h)}function aS(t,e,i,n,r,s,a){let o=i.index,l=i.attributes.position;for(let h=t,c=e+t;h<c;h++)if(sS(a,3*h,o,l),a.needsUpdate=!0,n(a,h,r,s))return!0;return!1}var oS=class{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){let t=this._primitives;return 0===t.length?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}};function lS(t,e){return 65535===e[t+15]}function hS(t,e){return e[t+6]}function cS(t,e){return e[t+14]}function dS(t){return t+8}function uS(t,e){return e[t+6]}var pS=new _e,fS=new be,mS=["x","y","z"];function gS(t,e,i,n,r){let s=2*t,a=SS,o=_S,l=AS;if(lS(s,o)){!function(t,e,i,n,r,s){for(let a=n,o=n+r;a<o;a++)rS(t,e,i,a,s)}(e,i,n,hS(t,l),cS(s,o),r)}else{let s=dS(t);bS(s,a,n,fS)&&gS(s,e,i,n,r);let o=uS(t,l);bS(o,a,n,fS)&&gS(o,e,i,n,r)}}function vS(t,e,i,n){let r=2*t,s=SS,a=_S,o=AS;if(lS(r,a)){return function(t,e,i,n,r){let s=1/0,a=null;for(let o=n,l=n+r;o<l;o++){let n=rS(t,e,i,o);n&&n.distance<s&&(a=n,s=n.distance)}return a}(e,i,n,hS(t,o),cS(r,a))}{let r,a,l=function(t,e){return e[t+7]}(t,o),h=mS[l],c=n.direction[h]>=0;c?(r=dS(t),a=uS(t,o)):(r=uS(t,o),a=dS(t));let d=bS(r,s,n,fS)?vS(r,e,i,n):null;if(d){let t=d.point[h];if(c?t<=s[a+l]:t>=s[a+l+3])return d}let u=bS(a,s,n,fS)?vS(a,e,i,n):null;return d&&u?d.distance<=u.distance?d:u:d||u||null}}var yS=function(){let t,e,i=[],n=new oS(()=>new _e);return function(...s){t=n.getPrimitive(),e=n.getPrimitive(),i.push(t,e);let a=r(...s);n.releasePrimitive(t),n.releasePrimitive(e),i.pop(),i.pop();let o=i.length;return o>0&&(e=i[o-1],t=i[o-2]),a};function r(i,n,s,a,o=null,l=0,h=0){function c(t){let e=2*t,i=_S,n=AS;for(;!lS(e,i);)e=2*(t=dS(t));return hS(t,n)}function d(t){let e=2*t,i=_S,n=AS;for(;!lS(e,i);)e=2*(t=uS(t,n));return hS(t,n)+cS(e,i)}let u=2*i,p=SS,f=_S,m=AS;if(lS(u,f)){let e=hS(i,m),n=cS(u,f);return Tw(i,p,t),a(e,n,!1,h,l+i,t)}{let u,g,v,y,x=dS(i),b=uS(i,m),w=x,S=b;
2if(o&&(v=t,y=e,Tw(w,p,v),Tw(S,p,y),u=o(v),g=o(y),g<u)){w=b,S=x;let t=u;u=g,g=t,v=y}v||(v=t,Tw(w,p,v));let _,A=s(v,lS(2*w,f),u,h+1,l+w);if(2===A){let t=c(w);_=a(t,d(w)-t,!0,h+1,l+w,v)}else _=A&&r(w,n,s,a,o,l,h+1);if(_)return!0;y=e,Tw(S,p,y);let M,C=s(y,lS(2*S,f),g,h+1,l+S);if(2===C){let t=c(S);M=a(t,d(S)-t,!0,h+1,l+S,y)}else M=C&&r(S,n,s,a,o,l,h+1);return!!M}}}(),xS=function(){let t=new qw,e=new qw,i=new Ze,n=new Xw,r=new Xw;return function s(a,o,l,h,c=null){let d=2*a,u=SS,p=_S,f=AS;if(null===c&&(l.boundingBox||l.computeBoundingBox(),n.set(l.boundingBox.min,l.boundingBox.max,h),c=n),!lS(d,p)){let t=a+8,e=f[a+6];return Tw(t,u,pS),!!(c.intersectsBox(pS)&&s(t,o,l,h,c)||(Tw(e,u,pS),c.intersectsBox(pS)&&s(e,o,l,h,c)))}{let n=o,s=n.index,c=n.attributes.position,m=l.index,g=l.attributes.position,v=hS(a,f),y=cS(d,p);if(i.copy(h).invert(),l.boundsTree)return Tw(a,u,r),r.matrix.copy(i),r.needsUpdate=!0,l.boundsTree.shapecast({intersectsBounds:t=>r.intersectsBox(t),intersectsTriangle:t=>{t.a.applyMatrix4(h),t.b.applyMatrix4(h),t.c.applyMatrix4(h),t.needsUpdate=!0;for(let i=3*v,n=3*(y+v);i<n;i+=3)if(sS(e,i,s,c),e.needsUpdate=!0,t.intersectsTriangle(e))return!0;return!1}});for(let r=3*v,a=y+3*v;r<a;r+=3){sS(t,r,s,c),t.a.applyMatrix4(i),t.b.applyMatrix4(i),t.c.applyMatrix4(i),t.needsUpdate=!0;for(let i=0,n=m.count;i<n;i+=3)if(sS(e,i,m,g),e.needsUpdate=!0,t.intersectsTriangle(e))return!0}}}}();function bS(t,e,i,n){return Tw(t,e,pS),i.intersectBox(pS,n)}var wS,SS,_S,AS,MS=[];function CS(t){wS&&MS.push(wS),wS=t,SS=new Float32Array(t),_S=new Uint16Array(t),AS=new Uint32Array(t)}function ES(){wS=null,SS=null,_S=null,AS=null,MS.length&&CS(MS.pop())}var PS=Symbol("skip tree generation"),TS=new _e,DS=new _e,IS=new Ze,OS=new Xw,RS=new Xw,LS=new be,BS=new be,zS=new be,FS=new be,NS=new be,US=new _e,kS=new oS(()=>new qw),VS=class{static serialize(t,e={}){if(e.isBufferGeometry)return VS.serialize(arguments[0],{cloneBuffers:void 0===arguments[2]||arguments[2]});e={cloneBuffers:!0,...e};let i,n=t.geometry,r=t._roots,s=n.getIndex();return i=e.cloneBuffers?{roots:r.map(t=>t.slice()),index:s.array.slice()}:{roots:r,index:s.array},i}static deserialize(t,e,i={}){if("boolean"==typeof i)return VS.deserialize(arguments[0],arguments[1],{setIndex:void 0===arguments[2]||arguments[2]});i={setIndex:!0,...i};let{index:n,roots:r}=t,s=new VS(e,{...i,[PS]:!0});if(s._roots=r,i.setIndex){let i=e.getIndex();if(null===i){let i=new Ni(t.index,1,!1);e.setIndex(i)}else i.array!==n&&(i.array.set(n),i.needsUpdate=!0)}return s}constructor(t,e={}){if(!t.isBufferGeometry)throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.");if((e=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[PS]:!1},e)).useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,e[PS]||(this._roots=function(t,e){let i,n,r,s=kw(t,e),a=[],o=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;c<s.length;c++){let t=s[c],e=new o(32*l(t));i=new Float32Array(e),n=new Uint32Array(e),r=new Uint16Array(e),h(0,t),a.push(e)}return a;function l(t){return t.count?1:1+l(t.left)+l(t.right)}function h(t,e){let s=t/4,a=t/2,o=!!e.count,l=e.boundingData;for(let n=0;n<6;n++)i[s+n]=l[n];if(o){let i=e.offset,o=e.count;return n[s+6]=i,r[a+14]=o,r[a+15]=65535,t+32}{let i,r=e.left,a=e.right,o=e.splitAxis;if(i=h(t+32,r),i/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return n[s+6]=i/4,i=h(i,a),n[s+7]=o,i}}}(t,e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new _e))),this.geometry=t}refit(t=null){t&&Array.isArray(t)&&(t=new Set(t));let e,i,n,r,s=this.geometry,a=s.index.array,o=s.attributes.position,l=0,h=this._roots;for(let d=0,u=h.length;d<u;d++)e=h[d],i=new Uint32Array(e),n=new Uint16Array(e),r=new Float32Array(e),c(0,l),l+=e.byteLength;function c(e,s,l=!1){let h=2*e;if(65535===n[h+15]){let t=i[e+6],s=1/0,l=1/0,c=1/0,d=-1/0,u=-1/0,p=-1/0;for(let e=3*t,i=3*(t+n[h+14]);e<i;e++){let t=a[e],i=o.getX(t),n=o.getY(t),r=o.getZ(t);i<s&&(s=i),i>d&&(d=i),n<l&&(l=n),n>u&&(u=n),r<c&&(c=r),r>p&&(p=r)}return(r[e+0]!==s||r[e+1]!==l||r[e+2]!==c||r[e+3]!==d||r[e+4]!==u||r[e+5]!==p)&&
2(r[e+0]=s,r[e+1]=l,r[e+2]=c,r[e+3]=d,r[e+4]=u,r[e+5]=p,!0)}{let n=e+8,a=i[e+6],o=n+s,h=a+s,d=l,u=!1,p=!1;t?d||(u=t.has(o),p=t.has(h),d=!u&&!p):(u=!0,p=!0);let f=d||p,m=!1;(d||u)&&(m=c(n,s,d));let g=!1;f&&(g=c(a,s,d));let v=m||g;if(v)for(let t=0;t<3;t++){let i=n+t,s=a+t,o=r[i],l=r[i+3],h=r[s],c=r[s+3];r[e+t]=o<h?o:h,r[e+t+3]=l>c?l:c}return v}}}traverse(t,e=0){let i=this._roots[e],n=new Uint32Array(i),r=new Uint16Array(i);!function e(s,a=0){let o=2*s,l=65535===r[o+15];if(l){let e=n[s+6],h=r[o+14];t(a,l,new Float32Array(i,4*s,6),e,h)}else{let r=s+8,o=n[s+6],h=n[s+7];t(a,l,new Float32Array(i,4*s,6),h)||(e(r,a+1),e(o,a+1))}}(0)}raycast(t,e=0){let i=this._roots,n=this.geometry,r=[],s=e.isMaterial,a=Array.isArray(e),o=n.groups,l=s?e.side:e;for(let h=0,c=i.length;h<c;h++){let s=a?e[o[h].materialIndex].side:l,c=r.length;if(CS(i[h]),gS(0,n,s,t,r),ES(),a){let t=o[h].materialIndex;for(let e=c,i=r.length;e<i;e++)r[e].face.materialIndex=t}}return r}raycastFirst(t,e=0){let i=this._roots,n=this.geometry,r=e.isMaterial,s=Array.isArray(e),a=null,o=n.groups,l=r?e.side:e;for(let h=0,c=i.length;h<c;h++){let r=s?e[o[h].materialIndex].side:l;CS(i[h]);let c=vS(0,n,r,t);ES(),null!=c&&(null==a||c.distance<a.distance)&&(a=c,s&&(c.face.materialIndex=o[h].materialIndex))}return a}intersectsGeometry(t,e){let i=this.geometry,n=!1;for(let r of this._roots)if(CS(r),n=xS(0,i,t,e),ES(),n)break;return n}shapecast(t,e,i){let n=this.geometry;if(t instanceof Function){if(e){let t=e;e=(e,i,n,r)=>{let s=3*i;return t(e,s,s+1,s+2,n,r)}}t={boundsTraverseOrder:i,intersectsBounds:t,intersectsTriangle:e,intersectsRange:null}}let r=kS.getPrimitive(),{boundsTraverseOrder:s,intersectsBounds:a,intersectsRange:o,intersectsTriangle:l}=t;if(o&&l){let t=o;o=(e,i,s,a,o)=>!!t(e,i,s,a,o)||aS(e,i,n,l,s,a,r)}else o||(o=l?(t,e,i,s)=>aS(t,e,n,l,i,s,r):(t,e,i)=>i);let h=!1,c=0;for(let d of this._roots){if(CS(d),h=yS(0,n,a,o,s,c),ES(),h)break;c+=d.byteLength}return kS.releasePrimitive(r),h}bvhcast(t,e,i){let{intersectsRanges:n,intersectsTriangles:r}=i,s=this.geometry.index,a=this.geometry.attributes.position,o=t.geometry.index,l=t.geometry.attributes.position;IS.copy(e).invert();let h=kS.getPrimitive(),c=kS.getPrimitive();if(r){let t=function(t,i,n,d,u,p,f,m){for(let g=n,v=n+d;g<v;g++){sS(c,3*g,o,l),c.a.applyMatrix4(e),c.b.applyMatrix4(e),c.c.applyMatrix4(e),c.needsUpdate=!0;for(let e=t,n=t+i;e<n;e++)if(sS(h,3*e,s,a),h.needsUpdate=!0,r(h,c,e,g,u,p,f,m))return!0}return!1};if(n){let e=n;n=function(i,n,r,s,a,o,l,h){return!!e(i,n,r,s,a,o,l,h)||t(i,n,r,s,a,o,l,h)}}else n=t}t.getBoundingBox(DS),DS.applyMatrix4(e);let d=this.shapecast({intersectsBounds:t=>DS.intersectsBox(t),intersectsRange:(e,i,r,s,a,o)=>(TS.copy(o),TS.applyMatrix4(IS),t.shapecast({intersectsBounds:t=>TS.intersectsBox(t),intersectsRange:(t,r,o,l,h)=>n(e,i,t,r,s,a,l,h)}))});return kS.releasePrimitive(h),kS.releasePrimitive(c),d}intersectsBox(t,e){return OS.set(t.min,t.max,e),OS.needsUpdate=!0,this.shapecast({intersectsBounds:t=>OS.intersectsBox(t),intersectsTriangle:t=>OS.intersectsTriangle(t)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,i={},n={},r=0,s=1/0){t.boundingBox||t.computeBoundingBox(),OS.set(t.boundingBox.min,t.boundingBox.max,e),OS.needsUpdate=!0;let a=this.geometry,o=a.attributes.position,l=a.index,h=t.attributes.position,c=t.index,d=kS.getPrimitive(),u=kS.getPrimitive(),p=BS,f=zS,m=null,g=null;n&&(m=FS,g=NS);let v=1/0,y=null,x=null;return IS.copy(e).invert(),RS.matrix.copy(IS),this.shapecast({boundsTraverseOrder:t=>OS.distanceToBox(t),intersectsBounds:(t,e,i)=>i<v&&i<s&&(e&&(RS.min.copy(t.min),RS.max.copy(t.max),RS.needsUpdate=!0),!0),intersectsRange:(i,n)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:t=>RS.distanceToBox(t),intersectsBounds:(t,e,i)=>i<v&&i<s,intersectsRange:(t,s)=>{for(let a=3*t,b=3*(t+s);a<b;a+=3){sS(u,a,c,h),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let t=3*i,e=3*(i+n);t<e;t+=3){sS(d,t,l,o),d.needsUpdate=!0;let e=d.distanceToTriangle(u,p,m);if(e<v&&(f.copy(p),g&&g.copy(m),v=e,y=t/3,x=a/3),e<r)return!0}}}});for(let t=0,s=c?c.count:h.count;t<s;
2t+=3){sS(u,t,c,h),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let e=3*i,s=3*(i+n);e<s;e+=3){sS(d,e,l,o),d.needsUpdate=!0;let i=d.distanceToTriangle(u,p,m);if(i<v&&(f.copy(p),g&&g.copy(m),v=i,y=e/3,x=t/3),i<r)return!0}}}}),kS.releasePrimitive(d),kS.releasePrimitive(u),v===1/0?null:(i.point?i.point.copy(f):i.point=f.clone(),i.distance=v,i.faceIndex=y,n&&(n.point?n.point.copy(g):n.point=g.clone(),n.point.applyMatrix4(IS),f.applyMatrix4(IS),n.distance=f.sub(n.point).length(),n.faceIndex=x),i)}closestPointToPoint(t,e={},i=0,n=1/0){let r=i*i,s=n*n,a=1/0,o=null;if(this.shapecast({boundsTraverseOrder:e=>(LS.copy(t).clamp(e.min,e.max),LS.distanceToSquared(t)),intersectsBounds:(t,e,i)=>i<a&&i<s,intersectsTriangle:(e,i)=>{e.closestPointToPoint(t,LS);let n=t.distanceToSquared(LS);return n<a&&(BS.copy(LS),a=n,o=i),n<r}}),a===1/0)return null;let l=Math.sqrt(a);return e.point?e.point.copy(BS):e.point=BS.clone(),e.distance=l,e.faceIndex=o,e}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(e=>{Tw(0,new Float32Array(e),US),t.union(US)}),t}},jS=h(d()),GS=.5*(Math.sqrt(3)-1),WS=(3-Math.sqrt(3))/6,HS=1/3,qS=1/6,XS=t=>0|Math.floor(t),YS=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]),QS=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 ZS(t){let e=new Uint8Array(512);for(let i=0;i<256;i++)e[i]=i;for(let i=0;i<255;i++){let n=i+~~(t()*(256-i)),r=e[i];e[i]=e[n],e[n]=r}for(let i=256;i<512;i++)e[i]=e[i-256];return e}var KS,JS=new Oi,$S=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let n=0;n<t.count;n+=3){let i=1;JS.a.fromBufferAttribute(t,n),JS.b.fromBufferAttribute(t,n+1),JS.c.fromBufferAttribute(t,n+2),i*=JS.getArea(),e[n/3]=i}this.distribution=new Float32Array(t.count/3);let i=0;for(let n=0;n<e.length;n++)i+=e[n],this.distribution[n]=i;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let i=this.distribution[this.distribution.length-1],n=this.binarySearch(this.randomFunction()*i);return this.sampleFace(n,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,i=0,n=e.length-1,r=-1;for(;i<=n;){let s=Math.ceil((i+n)/2);if(0===s||e[s-1]<=t&&e[s]>t){r=s;break}t<e[s]?n=s-1:i=s+1}return r}sampleFace(t,e,i){let n=this.randomFunction(),r=this.randomFunction();return n+r>1&&(n=1-n,r=1-r),JS.a.fromBufferAttribute(this.positionAttribute,3*t),JS.b.fromBufferAttribute(this.positionAttribute,3*t+1),JS.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(JS.a,n).addScaledVector(JS.b,r).addScaledVector(JS.c,1-(n+r)),JS.getNormal(i),this}},t_=h(u()),e_=new Ze,i_=new Ze,n_=new Ze;(KS||(KS={})).is=function(t){return t&&t.__isSPEObject};var r_,s_=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new Ze,this.copyPreviousMatrix=!0,this.hiddenMatrix=new Ze,this.matrixWorldRigid=new Ze,this.shearScale=new Ze,this.shearScaleInv=new Ze}get __isSPEObject(){return!0}isDescendantOf(t){t instanceof wi&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(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.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix
2):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),e)for(let n of this.children)n.updateWorldMatrix(!1,!0)}traverseChildren(t,e=0){for(let i of this.children)KS.is(i)&&i.traverseObject(t,e+1)}traverseObject(t,e=0){if(!0!==t(this,e))for(let i of this.children)KS.is(i)&&i.traverseObject(t,e+1)}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,e=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:i,v:n,q:r}=(0,t_.SVD)(e),s=e_.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),a=i_.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),o=n_.copy(a).transpose();this.shearScale.makeScale(r[0],r[1],r[2]).multiply(o).premultiply(a),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(s,o).copyPosition(this.matrixWorld),r.every(t=>Math.abs(r[0]-t)<.01)?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}attach(t,e){this.updateWorldMatrix(!0,!1);let i=(new Ze).copy(this.matrixWorld).invert();return null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),i.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof Ze?t.hiddenMatrix.premultiply(i):t.applyMatrix4(i),t.updateWorldMatrix(!1,!1),this.add(t),void 0!==e&&(this.children.pop(),this.children.splice(e,0,t)),this}copy(t,e=!1){return super.copy(t,e),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,e,i,n,r,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},a_=class extends(s_(wi)){},o_=class extends a_{constructor(t){super(),this.object=t,this.matrixAutoUpdate=!1,this.hasNonUniformScale=t.hasNonUniformScale}raycast(t,e){}expand(){let t=0,e=this.object.entityChildren(t);for(;e;){let i=this.children[t];i?.object!==e&&(i&&this.remove(i),i=new o_(e),this.add(i),this.children.splice(t,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=e.matrix,i.hiddenMatrix=e.hiddenMatrix),i.expand(),t+=1,e=this.object.entityChildren(t)}for(;this.children.length>t;)this.remove(this.children[t])}get visible(){return void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&!0===this.object.dataPatched.cloner?.hideBase}set visible(t){}get castShadow(){return this.object.castShadow}set castShadow(t){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(t){}get isMesh(){return(t=>"Mesh"===t.type)(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(t){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}},l_=new be,h_=new be,c_=new Ze,d_=[new be(-1,1,1),new be(-1,-1,1),new be(1,-1,1),new be(1,1,1),new be(-1,1,-1),new be(-1,-1,-1),new be(1,-1,-1),new be(1,1,-1)],u_=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],p_=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],f_=(t,e,i)=>{t.updateEntityBoxSize(l_,h_),c_.copy(e).multiply(t.matrixWorld),0===h_.x&&0===h_.y&&0===h_.z?i.push(new be(l_.x,l_.y,l_.z).applyMatrix4(c_)):d_.forEach(t=>{i.push(t.clone().multiply(h_).add(l_).applyMatrix4(c_))})},m_=class extends _e{constructor(){super(...arguments),this.matrix=new Ze,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(t=>t.clone()),this.faces=t.faces.map(t=>t.clone()),this.edges=t.edges.map(t=>t.clone()),this.centerEdges=t.centerEdges.map(t=>t.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=(new Ze).copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];return!0===i?t.traverseEntity(t=>{if(t.visible||t.cloner&&t.data.visible){if(!("geometry"in t))return void n.push(new be);f_(t,e,n)}}):f_(t,e,n),this.setFromPoints(n)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix
2),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(c_.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(h_).multiplyScalar(.5),this.getCenter(l_),c_.copy(this.matrix).setPosition(l_),this.vertices=d_.map(t=>t.clone().multiply(h_).applyMatrix4(c_))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=u_.map(([t,e])=>new lh(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new be))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=p_.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}},g_={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}},v_=class extends io{constructor(){super()}getPoints(t=12){let e,i=[],n=this.getCurveLengths(),r=n[n.length-1]/n.length;for(let s=0,a=this.curves;s<a.length;s++){let o=a[s],l=0===s?n[s]:n[s]-n[s-1],h=Math.ceil(t*l/r),c=o.getPoints(h);for(let t=0;t<c.length;t++){let n=c[t];e&&e.equals(n)||(i.push(n),e=n)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},y_=.001;function x_(t,e,i){return e.clone().sub(t).cross(e.clone().sub(i)).length()<=y_}function b_(t,e){let i=new be(...t.position),n=new be(...t.controlNext.position),r=new be(...e.controlPrevious.position),s=new be(...e.position);return x_(i,n,s)&&x_(i,r,s)}function w_(t){let e=t.points.map(t=>new be(...t.data.position)),i=[t.points[0]],n=new be(...i[0].data.position);for(let c=0;c<t.points.length-1;c++)x_(n,e[c],e[c+1])||(i.push(t.points[c]),n=e[c]);i.push(t.points[t.points.length-1]);let r=t.isClosed,s=i.length-(r?0:1),a=i.length,o=[];for(let c=0;c<a;c++){let e=i[c].data,n=new be(...e.position),s=new be(...e.controlPrevious.position),l=new be(...e.controlNext.position),h={position:n,baseRoundness:e.roundness,controlPrevious:s,controlNext:l};if(0===e.roundness||!t.isClosed&&(0===c||c===a-1)){o[c]={...h,removedLength:0};continue}let d=r&&c==a-1?0:c+1,u=i[r&&0==c?a-1:c-1].data,p=i[d].data,f=new be(...u.position),m=new be(...p.position),g=f.clone().sub(n).normalize(),v=m.clone().sub(n).normalize();Object.assign(h,{prevDir:g,nextDir:v});let y=b_(u,e),x=b_(e,p);if(y&&x){let t=g.clone().add(v).normalize(),i=t.clone().cross(g).length()/g.dot(t);o[c]={...h,tan:i,removedLength:e.roundness/i}}else o[c]={...h,removedLength:0}}for(let c=0;c<s;c++){let t=r&&c===a-1?0:c+1,e=o[c],i=o[t];if(0!==e.removedLength||0!==i.removedLength){let t=e.position.distanceTo(i.position);e.removedLength=Math.min(e.removedLength,t/2),i.removedLength=Math.min(i.removedLength,t/2)}}let l=[];for(let c=0;c<s;c++){let t=c,e=r&&c===a-1?0:c+1,n=o[t],s=o[e],h=null;if(b_(i[t].data,i[e].data)){let t=n.position.clone(),e=s.position.clone();(0!==n.removedLength||0!==s.removedLength)&&(n.nextDir&&t.add(n.nextDir.clone().setLength(n.removedLength)),s.prevDir&&e.add(s.prevDir.clone().setLength(s.removedLength))),t.distanceTo(e)>y_&&(h=new Za(t,t.clone().lerp(e,.3),e.clone().lerp(t,.3),e))}else n.position.distanceTo(s.position)>y_&&(h=new Za(n.position,n.controlNext,s.controlPrevious,s.position));l[2*c+1]=h}for(let c=0;c<a;c++){let t=o[c];if(0===t.removedLength){l[2*c]=null;continue}let e=t.position,i=t.prevDir.clone().multiplyScalar(t.removedLength).add(e),n=t.nextDir.clone().multiplyScalar(t.removedLength).add(e),r=t.tan*t.removedLength,s=t.prevDir.clone().add(t.nextDir).normalize(),a=i.clone().lerp(n,.5),h=i.distanceTo(n)/2,d=s.clone().multiplyScalar(Math.sqrt(Math.pow(r,2)-Math.pow(h,2))).add(a),u=s.clone().multiplyScalar(-r).add(d),p=e.distanceTo(u)/e.distanceTo(a),f=t.prevDir.clone().multiplyScalar(p*e.distanceTo(i)).add(e),m=f.clone().lerp(u,2),g=i.clone().lerp(f,4/3),v=n.clone().lerp(m,4/3);l[2*c]=new Za(i,g,v,n)}let h=new v_;return l.forEach(t=>{t&&h.add(t)}),h}(r_||(r_={})).is=function(t){return t&&t.__isEntity};var S_=t=>r_.is(t),__={type:"completeState",isfromEntity:!0},A_=["x","y","z"],M_=new be,C_=(new be).set(0,1,0),E_=t=>class extends(s_(t)){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.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new m_,this._recursiveBBox=new m_,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let e=this.children[t];if(r_.is(e))return e}entityChildrenCount(){let t=this.children.length;for(;t--;)if(r_.is(this.children[t]))return t+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 t=this;for(;"Instance"!==t.data.type;){let e=t.parent;if(!r_.is(e))return;t=e}return t}
vendor: 4,664 bytes, line 2
2forInstancesRec(t){this.instances.forEach(e=>{e.disposed||t(e),e.forInstancesRec(t)})}super_Entity(t,e){"string"==typeof t&&(this.uuid=t),this.identity=t,this.data=e,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,e,i=!1){if(0!==this.data.states.length||i){for(let t of this.data.states)yb.toOps(this.data,t.data).forEach(t=>{let i=Mg.replaceProps(t,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,e)});if(null!==t){let i=this.data.states.data(t);i&&(this.dataPatched=yb.patch(this.data,i),yb.toOps(this.data,i).forEach(t=>{this.updateByPatchedOp(t,this.dataPatched,e)}))}i&&this.updateTransformState(this.dataPatched,e),this.stateSelection=t,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(t,e){t.setScalar(0),e.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{S_(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let e;return this.traverseEntity(i=>{i.uuid===t&&(e=i)}),e}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children,i=e.indexOf(this)+1;if(r_.is(e[i]))return e[i];if(r_.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&r_.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let e=this;for(;t>0&&null!==e;)e=e.parent,t-=1;return e}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let e=this.parent;for(;e;){if(t===e)return!0;e=e.parent}return!1}countToAccestor(t){let e=0,i=this;for(;i!==t;){if(null===i)return-1;i=i.parent,e+=1}return e}forEachEntity(t){for(let e of this.children)S_(e)&&t(e)}traverseEntityAncestors(t){this.traverseAncestors(e=>{r_.is(e)&&t(e)})}traverseConcreteEntity(t,e=0){if(!0!==t(this,e))for(let i of this.children)S_(i)&&i.isConcreteEntity&&i.traverseEntity(t,e+1)}traverseEntity(t,e=0){if(!0!==t(this,e))for(let i of this.children)S_(i)&&i.traverseEntity(t,e+1)}traverseVisibleEntity(t){t(this);for(let e of this.children)S_(e)&&e.visible&&e.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,e=!1){return super.copy(t,e),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>S_(t))}isAncestorOf(t){if(this.uuid===t)return!1;let e=!1;return this.traverseEntity(i=>{i.uuid===t&&(e=!0)}),e}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let e={position:this.position.toArray(),rotation:[this.rotation.x*Wt.RAD2DEG,this.rotation.y*Wt.RAD2DEG,this.rotation.z*Wt.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return Cm(e,t)}getTransformValues(t,e,i){return e[t].map((e,n)=>i?.shared.getVariable(e,[this.uuid,t,A_[n]])??e)}updateTransformState(t,e){let i=!1;return t.position&&(this.position.fromArray(this.getTransformValues("position",t,e)),i=!0),t.rotation&&(M_.fromArray(this.getTransformValues("rotation",t,e)).multiplyScalar(Wt.DEG2RAD),this.rotation.setFromVector3(M_),i=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,e)),i=!0),void 0!==t.hiddenMatrix&&(i=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??Jy.identity)),i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(t=>{t.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&void 0!==t.hiddenMatrix&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(t=!1){t?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(t=>{t.invalidateClonerTransform(this)}))}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let t of this.children)r_.is(t)&&t.disposeRecursively()}
vendor: 5,365 bytes, line 2
2disposeRecursively(){this.dispose(),this.children.forEach(t=>{r_.is(t)&&t.disposeRecursively()})}toState(t=[]){let e={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)};return Cm(e,t)}updateByObjUpdateOp(t,e){void 0!==t&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},e,!1)}updateByOp(t,e,i,n){let r=this.data;this.data=e;let s=t,a=ev(t.path,["states","*"]);if(null!==a){if(0===t.type){let[e]=a;if(this?.stateSelection===e){let e={...t.props};if(delete e.name,Object.values(t.props).some(t=>void 0===t)){let i=this.data;if(void 0!==i){let n=Qg.zoom(i,t.path.slice(2));if(n)for(let i in t.props)void 0===t.props[i]&&i in n&&(e[i]=n[i])}}s={...t,props:e,path:t.path.slice(2)}}}}else if(0===t.type){let e=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==e){if(void 0!==t.props.name&&e.name){let{name:t,...i}=e;e=i}if(void 0!==t.props.material&&"material"in e){let{material:t,...i}=e;e=i}let i=Qg.removeOverridden(t.path,t.props,e);s={...t,props:i}}}if(this.updateByPatchedOpBase(s,yb.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),ev(t.path,["overrides"])){let n=[],r=[...t.path];for(n.push(r[1]),r.splice(0,2);r.length>0&&"descendants"===r[0];)n.push(r[1]),r.splice(0,2);if(void 0===n[n.length-1]){if(0===t.type)for(let e of Object.keys(t.props)){n[n.length-1]=e;let r=i.scene.findInstance([this.uuid,...n]);r&&(r.overrideData=t.props[e],r.updateState(_g.apply(r.component.data,r.overrideData),i))}}else{let s=i.scene.findInstance([this.uuid,...n]);if(s){let a=Qg.zoom(s.component.data,r);if(0===(t={...t,path:r}).type){let e=t.props;if(a)for(let[i,n]of Object.entries(t.props))void 0===n&&(e===t.props&&(e={...t.props}),e[i]=a[i]);t={...t,props:e}}s.overrideData=fb.resolve(e.overrides,n),s.updateByOp(t,Cg.applySimple(s.data,t),i,!1)}}}else if(this.instances.length>0){let n;if(0===t.path.length&&0===t.type){let e;for(let i of mb.rootOverrideProps)i in t.props&&(void 0===e&&(e={}),e[i]=t.props[i]);e&&(n={...t,props:e})}else for(let e of mb.rootOverrideProps)if(ev(t.path,[e])){n=t;break}void 0!==n&&this.instances.forEach(t=>{if(t.isInstanceRoot){let e=_g.filterOp(t.overrideData,n);e&&t.updateByOp(e,Cg.applySimple(t.data,e),i,!0)}}),this.instances.forEach(n=>{if(!n.isInstanceRoot){let s=_g.filterOp(n.overrideData,t);if(s){let a;a=r===n.data&&t===s?e:Cg.applySimple(n.data,s),n.updateByOp(s,a,i,!0)}}})}}updateByPatchedOpBase(t,e,i){if(this.dataPatched=e,0===t.path.length&&0===t.type)void 0!==t.props.type&&!ux.is(t.props.type)&&g_.changeEntityProptotype(this,e,i);else if(1===t.path.length&&"geometry"===t.path[0]&&0===t.type&&"type"in t.props){g_.changeEntityProptotype(this,e,i);for(let t of this.children)r_.is(t)&&t.updateVisible(i.scene)}this.updateByPatchedOp(t,e,i)}updateByPatchedOp(t,e,i){if(0===t.path.length&&0===t.type?this.updateState(t.props,i):0===t.type&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(e,i),"morphTargetInfluences"===t.path[0]&&0===t.type){let n=e.morphTargetInfluences.get(t.path[1])?.data.name;n&&this.updateMorphInfluences(n,i.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",n]))}if(null!==ev(t.path,["pathSnapping"])&&this.updatePathSnapping(e.pathSnapping),null!==ev(t.path,["cloner"])){let n=Cg.drop(t,1);0===n.path.length&&0===n.type&&!0===n.props.disabled?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(e.cloner,i.scene):(this.setFromClonerState(e.cloner,i),this.expandCloner(i.scene)),this.updateVisible(i.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){let e=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,n=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,r=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(null===e)return;let s=t.find(e);if(!s||!1===this._needApplyPathSnapping)return;this._needApplyPathSnapping=!1;let a=s.data;if(a.geometry.path.points.length<=1)return;let o=w_(a.geometry.path),l=(i+n)%1;i+n===1&&0===l&&(l=1);let h=null;try{h=o.curves.length?o.getPointAt(l):null}catch(p){}if(null===h)return;let c=this.parent?this.parent?.matrixWorld:new Ze;s.updateMatrixWorld();let d=(new Ze).multiplyMatrices(c.clone().invert(),s.matrixWorld);h.applyMatrix4(d);let u={position:h.toArray(),rotation:a.rotation};if("tangential"===r){let t=(new Ze).extractRotation(s.matrixWorld),e=o.getTangentAt(l).applyMatrix4(t).add(h),i=(new Ze).lookAt(h,e,C_),n=M_.setFromEuler((new ai).setFromRotationMatrix(i)).multiplyScalar(Wt.RAD2DEG);u={...u,rotation:n.toArray()}}this.updateTransformState(u),this.traverseEntity(t=>{t._cameraType&&t.dispatchEvent(__)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||!0!==this.dataPatched.cloner?.hideBase),!t)return;let e=!1;this.traverseEntity(t=>{if("Splat"===t.data.type)return e=!0,!0}),e&&t.reloadSplats()}updateState_Entity(t,e){void 0!==t.name&&(this.name=t.name),void 0!==t.raycastLock&&(this.raycastLock=t.raycastLock),void 0!==t.visible&&(this.updateVisible(e?.sce
2ne),this.resetBBoxNeedsUpdate()),e&&"cloner"in t&&void 0!==t.cloner&&(this.setFromClonerState(t.cloner,e),this.updateVisible(e.scene)),this.updateTransformState(t,e)}get attachedSurfaceCloners(){return this.children.filter(t=>t instanceof g_.Cloner&&"toObject"===t.parameters.type)}setFromClonerState(t,e){this.disposed||(null===t||t.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):void 0===this.cloner?(this.cloner=new g_.Cloner(this,t),e.scene.addPendingExpandCloner(this)):this.cloner.updateState(t,e.scene))}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}},P_=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=t.parameters?.radiusTop,n=t.parameters?.radiusBottom,r=Object.assign({},e?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},t.parameters);r.thetaLength=Wt.clamp(r.thetaLength,0,360);let s=r.width/2,a=r.radiusTop??s,o=r.radiusBottom??s;if(a===o?(a=s,o=s):a>o?(a=s,o=o*s/a):(a=a*s/o,o=s),r.shapeBlendNode){a=i??s,o=n??s;let t=2*Math.max(a,o);r.width=t,r.depth=t}return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(r.height??r.width),depth:Math.abs(r.depth??r.width),radiusTop:a,radiusBottom:o})}}static build(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:c,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=t.parameters;return 0===h?(e=new Qi,e.setAttribute("position",new Vi([],3))):e=u||f?new I_(c,d,r,s,a,o,l,h*Math.PI/180,u,u,p,f):new so(c,d,r,s,a,o,l,h*Math.PI/180),e.scale(1,1,n/i),Object.assign(e,{userData:{...t,type:"CylinderGeometry"}})}};function T_(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function D_(t){return new Ht(t.y,-t.x)}var I_=class extends Qi{constructor(t,e,i,n,r,s,a,o,l,h,c,d,u=!1){super(),this.type="RoundedCylinderBufferGeometry",t=void 0!==t?t:1,e=void 0!==e?e:1,i=i||1,n=Math.floor(n)||8,r=Math.floor(r)||1,s=void 0!==s&&s,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,s&&(l=0,h=0);let p=[],f=[],m=[],g=[],v=0,y=i/2,x=new be,b=new be;u&&0==t&&(t=l),u&&0==e&&(e=h);let w=new Ht(t,y),S=new Ht(e,-y),_=null,A=null,M=null,C=null,E=w.clone().sub(S),P=0,T=0,D=0;d>0&&(P=Math.min(t,e)*(1-d),T=t-P,D=e-P);let I=w.clone();I.x-=P;let O=Math.PI-E.angle(),R=E.angle(),L=Math.tan(R/2),B=Math.tan(O/2),z=L+B,F=d?z:B,N=d?z:L;if(l=Math.min(l,(t-T)/F,E.length()/z),h=Math.min(h,(e-D)/N,E.length()/z),l>0){let t=l/L;_=w.clone().sub(new Ht(t,l)),d&&(M=_.clone(),M.x-=P-z*l),w.sub(E.clone().setLength(t))}if(h>0){let t=h/B;A=S.clone().sub(new Ht(t,-h)),S.add(E.clone().setLength(t)),d&&(C=A.clone(),C.x-=P-z*h,I.sub(E.clone().setLength(t)))}E=w.clone().sub(S);let U=E.length()<.5,k=[];for(let W=0;W<=n;W++){let c=[],u=W/n,p=u*o+a,y=new Ht(Math.sin(p),Math.cos(p));if(C&&A?(V(c,u,y,O,h,C,-1,!0),V(c,u,y,R,h,A,-1,!1)):A?(j(c,y,A.x,0,-1),V(c,u,y,R,h,A,-1,!1)):s||j(c,y,e,D,-1),T_(D_(E).normalize(),y,x),!U)for(let t=0;t<=r;t++){let e=t/r;T_(E.clone().multiplyScalar(e).add(S),y,b),f.push(b.x,b.y,b.z),m.push(x.x,x.y,x.z),g.push(u,.5+b.y/i),c.push(v++)}if(M&&_?(V(c,u,y,O,l,_,1,!1),V(c,u,y,R,l,M,1,!0)):_?(V(c,u,y,O,l,_,1,!1),j(c,y,_.x,0,1)):s||j(c,y,t,T,1),d&&!U){T_(D_(E).multiplyScalar(-1).normalize(),y,x);for(let t=0;t<=r;t++){let e=t/r;T_(E.clone().multiplyScalar(-e).add(I),y,b),f.push(b.x,b.y,b.z),m.push(x.x,x.y,x.z),g.push(u,.5+b.y/i),c.push(v++)}}d&&!s&&c.push(c[0]),k.push(c)}for(let W=0;W<k.length-1;W++)for(let t=0;t<k[0].length-1;t++){if(s&&d&&t==r)continue;let e=k[W][t],i=k[W+1][t],n=k[W+1][t+1],a=k[W][t+1],o=f[3*n+0],l=f[3*n+2];p.push(e,i,a),(0!=o||0!=l)&&p.push(i,n,a)}function V(t,e,n,r,s,a,o,l){for(let h=0;h<c+1;h++){let d=h/c,u=o<0?d:1-d;l&&(u-=1),u*=r;let p=new Ht(Math.sin(u),Math.cos(u)*o);T_(p.clone().multiplyScalar(s).add(a),n,b),f.push(b.x,b.y,b.z),T_(p,n,x),m.push(x.x,x.y,x.z),g.push(e,.5+b.y/i),t.push(v++)}}function j(t,e,i,n,r){let s=new be,a=new Ht,o=[i,n];r<0&&o.reverse();
2for(let l of o)a.set(l,y*r),T_(a,e,s),f.push(s.x,s.y,s.z),m.push(0,r,0),g.push(.5,.5),t.push(v++)}function G(i,n,r){let s=new Ht(Math.sin(r),Math.cos(r)),a=new Ht(-Math.cos(r),Math.sin(r)),o=new be,l=i<0?(t,e,i)=>p.push(t,e,i):(t,e,i)=>p.push(t,i,e);T_(new Ht((t+e+T+D)/4,0),s,o),f.push(o.x,o.y,o.z),m.push(a.x,0,a.y),g.push(.5,.5);let h=v++;for(let t of n){let e=f.slice(3*t,3*t+3);f.push(...e),m.push(a.x,0,a.y);let i=g.slice(2*t,2*t+2);g.push(...i),v++}for(let t=h+1;t<v-1;t++)l(h,t,t+1);l(h,v-1,h+1)}o<2*Math.PI&&(G(-1,k[0],a),G(1,k[k.length-1],a+o)),this.setIndex(p),this.setAttribute("position",new Vi(f,3)),this.setAttribute("normal",new Vi(m,3)),this.setAttribute("uv",new Vi(g,2))}},O_=Math.PI/2,R_=class extends Qi{constructor(t=1,e=1,i=1,n=1,r=1,s=1,a=0,o=4){super(),this.type="BoxGeometry",n=Math.floor(n),r=Math.floor(r),s=Math.floor(s),o=Math.floor(o),a=Math.min(a,t/2,e/2,i/2);let l=[],h=[],c=[],d=[],u=0;function p(t,e,i,n,r,s,o,p,f,m){let g=(s-2*a)/f,v=(o-2*a)/m,y=s/2-a,x=o/2-a,b=p/2,w=f+1,S=m+1,_=0,A=new be;for(let a=0;a<S;a++){let s=a*v-x;for(let o=0;o<w;o++){let l=o*g-y;A[t]=l*n,A[e]=s*r,A[i]=b,h.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[i]=p>0?1:-1,c.push(A.x,A.y,A.z),d.push(o/f),d.push(1-a/m),_+=1}}for(let a=0;a<m;a++)for(let t=0;t<f;t++){let e=u+t+w*a,i=u+t+w*(a+1),n=u+(t+1)+w*(a+1),r=u+(t+1)+w*a;l.push(e,i,r),l.push(i,n,r)}u+=_}function f(t,e,i,n,r,s,p,f,m,g){let v=(p-2*a)/g,y=p/2-a,x=f/2-a,b=m/2,w=g+1,S=0,_=new be,A=new be;for(let l=0;l<o+1;l++){let u=l/o*O_,p=Math.sin(u)*a,f=(1-Math.cos(u))*a,m=Math.sin(u),M=Math.cos(u);_[e]=(x+p)*r,_[i]=(b-f)*s,A[t]=0,A[e]=m*Math.sign(_[e]),A[i]=M*Math.sign(_[i]);for(let e=0;e<w;e++){let i=e*v-y;_[t]=i*n,h.push(_.x,_.y,_.z),c.push(A.x,A.y,A.z),d.push(e/g),d.push(0),S+=1}}for(let a=0;a<o;a++)for(let t=0;t<g;t++){let e=u+t+w*a,i=u+t+w*(a+1),n=u+(t+1)+w*(a+1),r=u+(t+1)+w*a;l.push(e,i,r),l.push(i,n,r)}u+=S}function m(n,r,s){let p=new be,f=new be(t/2,e/2,i/2);f.subScalar(a);let m=[],g=n*r*s>0?(t,e,i)=>l.push(t,e,i):(t,e,i)=>l.push(t,i,e);for(let t=0;t<=o;t++){let e=[],i=O_*(1-t/o),l=Math.cos(i),g=Math.sin(i),v=0;for(let o=0;o<=t;o++){let i=Math.cos(v),o=Math.sin(v);p.x=l*i,p.y=g,p.z=l*o;let m=f.clone().addScaledVector(p,a);h.push(n*m.x,r*m.y,s*m.z),c.push(n*p.x,r*p.y,s*p.z),d.push(0,0),e.push(u++),v+=O_/t}m.push(e)}let v=m.length-1;for(let t=0;t<v;t++){let e=m[t],i=m[t+1],n=e.length-1;g(e[0],i[1],i[0]);for(let t=1;t<=n;t++)g(e[t-1],e[t],i[t]),g(e[t],i[t+1],i[t])}}p("z","y","x",-1,-1,i,e,t,s,r),p("z","y","x",1,-1,i,e,-t,s,r),p("x","z","y",1,1,t,i,e,n,s),p("x","z","y",1,-1,t,i,-e,n,s),p("x","y","z",1,-1,t,e,i,n,r),p("x","y","z",-1,-1,t,e,-i,n,r),a>0&&(f("z","y","x",-1,-1,1,i,e,t,s),f("z","y","x",1,-1,-1,i,e,t,s),f("z","y","x",-1,1,-1,i,e,t,s),f("z","y","x",1,1,1,i,e,t,s),f("x","y","z",-1,-1,-1,t,e,i,n),f("x","y","z",1,-1,1,t,e,i,n),f("x","y","z",-1,1,1,t,e,i,n),f("x","y","z",1,1,-1,t,e,i,n),f("y","x","z",-1,-1,1,e,t,i,r),f("y","x","z",1,-1,-1,e,t,i,r),f("y","x","z",1,1,1,e,t,i,r),f("y","x","z",-1,1,-1,e,t,i,r),m(1,1,1),m(-1,1,1),m(1,-1,1),m(-1,-1,1),m(1,1,-1),m(-1,1,-1),m(1,-1,-1),m(-1,-1,-1)),this.setIndex(l),this.setAttribute("position",new Vi(h,3)),this.setAttribute("normal",new Vi(c,3)),this.setAttribute("uv",new Vi(d,2))}},L_=class extends Qi{constructor(t=[],e=[],i="",n=1,r=.2,s=4){super(),this.type="PolyhedronGeometryRound";let a=[],o=[],l=[];return function(){0==(r=Math.min(.99999,r))&&(s=0);let o={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],h=new be,c=h.clone(),d=new Oi,u=r*n,p=n-u,f=s+1,m=new be,g=(t,e)=>m.subVectors(t,e).normalize(),v=(t,e)=>Array(t).fill(void 0).map(e),y=v(t.length/3,(e,i)=>(new be).fromArray(t,3*i).setLength(n)),x=[],b=1e6;for(let t=0;t<y.length;t++){let i,n,r,s=y[t],a=[],o=1e10,l=-1;for(;-1!=(l=e.indexOf(t,l+1));){let t=l-l%3;i=e[t+(l+1)%3],n=e[t+(l+2)%3],r=s.distanceToSquared(y[i]),o=Math.min(o,r),a.push([i,n,r])}o+=1e-6;let h=[],c=0,d=a.length;for(let e=0;e<d;e++){[i,n,r]=a[c];let e=1==x[i]?.includes(t);r<=o&&h.push(i+ +e*b),c=a.findIndex(t=>t[0]==n)}x.push(h)}let w=[];{let t,e,i=0,n=0,r=3==o;for(let a=0;a<=s;a++){t=a*(a+1)/2,e=(a+1)*(a+2)/2;for(let o=0;o<s-a;o++)[i,n]=[t+o+a+2,e+o+a+3],w.push(t,e,...r?[n,t]:[i,e],n,i),[t,e]=[i,n];w.push(t,e,t+s+2)}}let S=h.clone(),_=h.clone(),A=h.clone(),M=h.clone(),C=h.clone(),E=[],P=v(y.length,()=>v(o,()=>h.clone()));for(let t=0;t<y.length;t++){h.copy(y[t]).normalize(),S.copy(h).multiplyScalar(p);let e=x[t];for(let s=0;s<e.length;s++){let i=e[s],n=e[(s+1)%o];d.setFromPointsAndIndices(y,t,i%b,n%b),d.b.sub(d.a).setLength(1e10).add(d.a),d.c.sub(d.a).setLength(1e10).add(d.a),d.closestPointToPoint(S,P[t][s])}let i=[],n=[],r=[],v=new be;0==s&&[...P[t]].reduce((t,e)=>t.add(e),v).multiplyScalar(1/o);for(let a=0;a<o;a++){let e=[],l=(a-1+o)%o,d=P[t][l],y=P[t][a];h.copy(d).sub(S),c.copy(y).sub(S);let x=S.angleTo(h),b=h.angleTo(c),w=Math.cos(x)*u;0==s?_.copy(v):_.copy(S).setLength(p+w),n.push(w);let E=[_,d,y];for(let t=0;t<2;t++){let n=E[t],r=E[t+1];M.subVectors(n,S),C.subVectors(r,S),A.crossVectors(M,C).normalize();for(let s=0;s<f;s++){let r=[x,b][t]*s/f;h.copy(M).applyAxisAngle(A,r).add(S),i.push(h.clone()),t&&(g(h,S),e.push([0==s?n:h.clone(),m.clone()]))}t&&(g(r,S),e.push([r,m.clone()]))}r.push(e)}E.push(r);let T=2*f,D=2;for(let t=0;t<o;t++){let e=T*t,r=T*((t+1)%o),s=[i[e]];for(let a=1;a<f;a++){M=i[e+a],C=i[r+a],s.push(M);for(let e=1,i=a-D+1;e<=i;e++)h.lerpVectors(M,C,e/(i+1)),h.sub(S).setLength(n[t]).add(S),s.push(h.clone());s.push(C)}for(let t=0;t<f;t++)s.push(i[t+f+e]);s.push(i[r+f]);let c=w.map(t=>s[t]);a.push(...c.map(t=>[t.x,t.y,t.z]).flat()),l.push(...c.map(t=>(g(t,S),[m.x,m.y,m.z])).flat())}}let T=[];for(let t=0;t<x.length;t++)for(let e=0;e<o;e++){let i=x[t][e];if(i<b){let n=x[i].findIndex(e=>e%b==t),r=E[t][e],s=E[i][n];for(let t=0;t<f;t++){let e=r[t],i=s[f-t],n=r[t+1];
2[e,i,n,n,i,s[f-(t+1)]].forEach(t=>{a.push(t[0].x,t[0].y,t[0].z),l.push(t[1].x,t[1].y,t[1].z)})}T.push(r[0][0],s[f][0],r[f][0],s[0][0])}}for(;T.length;){let t,e,i,n;[t,e]=T.splice(0,2);let r=[t];for(;t!=e;)r.push(e),i=T.indexOf(e),n=i%2,e=T.splice(i-n,2)[1-n];m.subVectors(r[0],r[1]).cross(h.subVectors(r[0],r[2])).normalize();let s=m.dot(r[0])<0;s&&m.negate();for(let o=1;o<=r.length-2;o++)[r[o+ +s],r[o+1-+s],r[0]].forEach(t=>{a.push(t.x,t.y,t.z),l.push(m.x,m.y,m.z)})}}(),function(){let t=new be;for(let p=0;p<a.length;p+=3){t.x=a[p+0],t.y=a[p+1],t.z=a[p+2];let e=d(t)/2/Math.PI+.5,i=u(t)/Math.PI+.5;o.push(e,1-i)}let e=new be,i=new be,n=new be,r=new be,s=new Ht,l=new Ht,h=new Ht,c=(t,e,i,n)=>{n<0&&1===t.x&&(o[e]=t.x-1),0===i.x&&0===i.z&&(o[e]=n/2/Math.PI+.5)};for(let p=0,f=0;p<a.length;p+=9,f+=6){e.set(a[p+0],a[p+1],a[p+2]),i.set(a[p+3],a[p+4],a[p+5]),n.set(a[p+6],a[p+7],a[p+8]),s.set(o[f+0],o[f+1]),l.set(o[f+2],o[f+3]),h.set(o[f+4],o[f+5]),r.copy(e).add(i).add(n).divideScalar(3);let t=d(r);c(s,f+0,e,t),c(l,f+2,i,t),c(h,f+4,n,t)}for(let a=0;a<o.length;a+=6){let t=o[a+0],e=o[a+2],i=o[a+4],n=Math.max(t,e,i),r=Math.min(t,e,i);n>.9&&r<.1&&(t<.2&&(o[a+0]+=1),e<.2&&(o[a+2]+=1),i<.2&&(o[a+4]+=1))}function d(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}}(),this.setAttribute("position",new Vi(a,3)),this.setAttribute("normal",new Vi(l,3)),void this.setAttribute("uv",new Vi(o,2))}static fromJSON(t){return new L_(t.vertices,t.indices,t.radius,t.corner,t.cornerSides)}},B_=class extends L_{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r=1/n,s="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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,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,
vendor: 4,117 bytes, line 2
219,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],s,t,e,i),this.type=s}static fromJSON(t){return new B_(t.radius,t.corner,t.cornerSides)}},z_=1e-12,F_=class{constructor(t){this.position=new Ht,this.startPosition=new Ht,this.uuid=Wt.generateUUID(),this.position=t.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(t){this.position.copy(this.startPosition).add(t)}copy(t){return this.position.copy(t.position),this.startPosition.copy(t.startPosition),this}clone(){return new F_(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},N_=class extends F_{constructor(t){super(t.position),this.parent=t}copy(t){return super.copy(t),this}clone(){return new N_(this.parent).copy(this)}},U_=class extends F_{constructor(t,e){super(e),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=t,this.controls.push(new N_(this),new N_(this))}static create(t,e){let i=new U_(t,new Ht(...e.position));return i.controls[0].position.set(...e.controlPrevious.position),i.controls[1].position.set(...e.controlNext.position),i.roundness=e.roundness,i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored,i}getOppositeControl(t){let e=this.controls.indexOf(t);return 0===e?this.controls[1]:1===e?this.controls[0]:null}applyOffsetToControls(t,e=1){for(let i=0,n=this.controls.length;i<n;i++){let n=this.controls[i];this.position.distanceTo(n.position)<=e?n.position.copy(this.position):n.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new U_(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let t=this.curveBefore?.getTangentAt(1),e=this.curveAfter?.getTangentAt(0);return[t,e]}computeNormals(t=new Ht,e=new Ht){let[i,n]=this.computeTangents();return i&&n&&(k_(i,t),k_(n,e)),[t,e]}computeTangent(t=new Ht){let[e,i]=this.computeTangents();return e&&i&&t.copy(e).add(i).normalize(),t}computeNormal(t=new Ht){let[e,i]=this.computeNormals();return t.copy(e).add(i).normalize(),t}};function k_(t,e=new Ht){let i=t.length();return e.set(-t.y/i,t.x/i)}var V_=t=>t,j_=new Ht,G_=new Ht,W_=new Ht,H_=new Ht,q_=new Ht,X_=new Ht,Y_=new be,Q_=new be;function Z_(t){let e=new Ht;e.addVectors(t.v0,j_.subVectors(t.v1,t.v0).multiplyScalar(2/3));let i=new Ht;return i.addVectors(t.v2,G_.subVectors(t.v1,t.v2).multiplyScalar(2/3)),new Qa(t.v0,e,i,t.v2)}function K_(t,e,i=Number.EPSILON){return Math.abs(t-e)<i}function J_(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function $_(t,e,i=Number.EPSILON){return t.distanceTo(e)<i}function tA(t,e,i){let n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2));return Math.acos((r*r+n*n-s*s)/(2*r*n))}function eA(t,e,i){return oA(t,e)&&oA(e,i)&&iA(t.position,e.position,i.position)}function iA(t,e,i){return 0===j_.copy(e).sub(t).cross(G_.copy(i).sub(t))}function nA(t,e,i,n,r){let s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),a=(t.y+e.y)/2,o=(t.x+e.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(t.y-e.y)/s,h=Math.sqrt(Math.pow(i,2)-Math.pow(s/2,2))*(e.x-t.x)/s;return n.set(o+l,a+h),r.set(o-l,a-h),[n,r]}function rA(t,e,i){return t.distanceTo(i)<e.distanceTo(i)?e:t}function sA(t,e,i,n,r,s){let a,o=e.x-t.x,l=e.y-t.y,h=i.x-t.x,c=i.y-t.y,d=Math.sqrt((o+h)*(o+h)+(l+c)*(l+c));return tA(e,t,i)>Math.PI&&(d*=-1),a=K_(c,l)?(l+c)*(n/d-.5)*8/3/(o-h):(o+h)*(n/d-.5)*8/3/(c-l),r.set(e.x-a*l,e.y+a*o),s.set(i.x+a*c,i.y-a*h),[r,s]}function aA(t,e){return t.position.equals(t.controls[1].position)&&e.position.equals(e.controls[0].position)}function oA(t,e){return iA(t.position,t.controls[1].position,e.position)&&iA(t.position,e.controls[0].position,e.position)}function lA(t,e=12,i=!1){let n=[];for(let r=0,s=t.length;r<s;r++){let s=t[r],a=0;
vendor: 4,546 bytes, line 2
2if(i&&void 0!==s.roundedCurveCorner){let t=.5*hA(s.roundedCurveCorner,e);r>0&&(n[r-1]+=t),a+=t}void 0!==s.curveAfter&&(a+=hA(s.curveAfter,e)),n.push(a)}return t.length>0&&i&&void 0!==t[0].roundedCurveCorner&&(n[t.length-1]+=.5*hA(t[0].roundedCurveCorner,e)),n}function hA(t,e=12){return t&&t instanceof ka?2*e:t&&(t instanceof Ka||t instanceof Ja)?1:t&&t instanceof to?e*t.points.length:e}var cA,dA,uA=new Ht,pA=new Ht,fA=new Ht,mA=new Ht,gA=new Ht,vA=new Ht,yA=class extends ho{constructor(t=100,e=100){super(),this.points=[],this.shapeHoles=[],this.plane=new En(new be(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=Wt.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=t,this._height=e}static createFromState(t,e,i){let n=new yA;return n.isClosed=t.isClosed,n.points=t.points.map(t=>U_.create(t.id,t.data)),"number"==typeof t.roundness&&(n.roundness=t.roundness),n.shapeHoles=t.shapeHoles.map(t=>yA.createFromState(t)),void 0!==e&&void 0!==i&&n.applySize(e,i),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let e=0,i=this.points.length;e<i;e++)this.points[e].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(t){let e=this.points.length,i=this.points.findIndex(e=>e.uuid===t);if(i<0){let i=e;for(let e=0,n=this.shapeHoles.length;e<n;e++){let n=this.shapeHoles[e],r=n.points.length,s=n.getPointIndexById(t);if(!(s<0))return s+i;i+=r}}return i}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0){let e=this.points.length;for(let i=0,n=this.shapeHoles.length;i<n;i++){let n=this.shapeHoles[i],r=t-e;if(r<=n.points.length-1)return n.points[r];e+=n.points.length}}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let e=this.points.indexOf(t);if(e>=0)return e;if(e=this.points.length,this.shapeHoles.length>0)for(let i=0,n=this.shapeHoles.length;i<n;i++){let n=this.shapeHoles[i],r=n.points.indexOf(t);if(r>=0)return e+r;e+=n.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...t]}applySize(t,e){0===t&&(t=.001),0===e&&(e=.001),this._width=t,this._height=e}applyScale(t,e){let i=uA.set(t,e);for(let n=0,r=this.points.length;n<r;n++){let t=this.points[n];t.position.multiply(i),t.controls[0].position.multiply(i),t.controls[1].position.multiply(i)}for(let n=0,r=this.shapeHoles.length;n<r;n++)this.shapeHoles[n].applyScale(t,e);this._update()}createPoint(t,e=0,i=Wt.generateUUID()){let n;n=t instanceof Ht?t:new Ht(t,e);let r=new U_(i,n);return r.roundness=this.roundness,r}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,e){this.points.splice(e,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let e=0,i=this.points.length;e<i;e++){let i=this.points[e];if(i.uuid===t)return i}for(let e=0,i=this.shapeHoles.length;e<i;e++){let i=this.shapeHoles[e].getPointByUuid(t);if(i)return i}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let e=this.points.indexOf(t);e>=0&&this.points.splice(e,1),this.needsUpdate=!0}removePointById(t){let e=this.points.find(e=>e.uuid===t);e&&this.removePoint(e)}update(){for(let t=0,e=this.shapeHoles.length;t<e;t++)this.shapeHoles[t].update();this._update()}extractShapePointsToBuffer(t,e=12,i=!1){this.subdivision=e,void 0===this.curveDivisions&&this.computeCurveDivisions(e);let n=i?this.roundedCurveDivisions:this.curveDivisions;return function(t,e,i=12,n=!0){let r,s=Q_.set(0,0,0),a=0;for(let o=0;o<e.length;o++){let n=V_(e[o]),l=j_,h=hA(n,i);for(let e=0;e<=h;e++)if(n instanceof Qa||n instanceof $a||n instanceof Ka){if(n.getPoint(e/h,l),s.set(l.x,l.y,0),void 0!==r&&$_(r,s))continue;void 0===r&&(r=Y_),r.copy(s),t.setXYZ(a,s.x,s.y,s.z),a++}}n&&a>1&&!(t.getX(a-1)===t.getX(0)&&t.getY(a-1)===t.getY(0)&&t.getZ(a-1)===t.getZ(0))&&(t.setXYZ(a,t.getX(0),t.getY(0),t.getZ(0)),a++)}(t,i?this.roundedCurves:this.curves,e,this.autoClose),n.reduce((t,e)=>t+e,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=lA(this.points,t,!1),this.roundedCurveDivisions=lA(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,e,i=12){return 2*function(t,e,
vendor: 25,511 bytes, line 2
2i,n=12,r=!0){let s=Q_.set(0,0,0),a=0,o=[];for(let l=0;l<e.length;l++){if(!1===i[l])continue;let r,h=V_(e[l]),c=j_,d=hA(h,n);o.push(d);for(let e=0;e<=d;e++)if(h instanceof Qa||h instanceof $a||h instanceof Ka){if(h.getPoint(e/d,c),s.set(c.x,c.y,0),r?.equals(s))continue;void 0===r?r=Y_:(t.setXYZ(a,r.x,r.y,r.z),a++,t.setXYZ(a,s.x,s.y,s.z),a++),r.copy(s)}}return r&&a>1&&!(t.getX(a-1)===t.getX(0)&&t.getY(a-1)===t.getY(0)&&t.getZ(a-1)===t.getZ(0))&&(t.setXYZ(a,t.getX(0),t.getY(0),t.getZ(0)),a++),o}(t,this.curves,e,i,this.autoClose).reduce((t,e)=>t+e,0)}extractShapePointsToFlatArray(t,e=12){return this.subdivision=e,void 0===this.curveDivisions&&this.computeCurveDivisions(e),function(t,e,i=12,n=!0){let r,s=0;for(let a=0;a<e.length;a++){let n=V_(e[a]),o=hA(n,i),l=j_;for(let e=0;e<=o;e++)if(n instanceof Qa||n instanceof $a||n instanceof Ka){if(n.getPoint(e/o,l),void 0!==r&&J_(r,l,z_))continue;void 0===r&&(r=G_),r.copy(l),t.push(l.x,l.y),s++}}return K_(t[0],t[t.length-2],z_)&&K_(t[1],t[t.length-1],z_)&&(t.pop(),t.pop()),n&&s>1&&!(K_(t[s-1],t[1],z_)&&K_(t[s-2],t[0],z_))&&(t.push(t[0],t[1]),s++),t}(t,this.roundedCurves,e,this.autoClose)}getCurveIndexFromVertexId(t,e=!1){let i=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);let n=e?this.roundedCurveDivisions:this.curveDivisions,r=0;e&&void 0!==this.points[0].roundedCurveCorner&&(r=.5*hA(this.points[0].roundedCurveCorner,this.subdivision));let s=t-r;s<0&&(s+=n.reduce((t,e)=>t+e,0));for(let a=0,o=n.length;a<o;a++){let t=n[a];if(s<i+t)return[a,(s-i+1)/t];i+=t}return[0,1]}getCurveT(t,e,i){let n=this.points[t],r=this.points[t>=this.points.length-1?0:t+1],s=this.curveDivisions,a=s[t];if(aA(n,r)){let t=n.position.distanceTo(r.position);return n.position.distanceTo(uA.set(i.x,i.y))/t}let o=0;for(let l=0;l<t;l++)o+=s[l];return(e-o)/a}dispose(){}_applyCurveForPoint(t,e){aA(e,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(e.controls[1].position.x,e.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let i=this.curves[this.curves.length-1];t.curveBefore=i,e.curveAfter=i;let n=i.clone();t.roundedCurveBefore=n,e.roundedCurveAfter=n,t.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,i=this.points.length;e<i;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 t=this.getLastPoint();if(t?.curveAfter&&(t.curveAfter=void 0),this.isClosed){let t=this.points[0],e=this.points[this.points.length-1];this._applyCurveForPoint(t,e)}if(this.points.length>2){let t=0;for(let e=0,i=this.points.length;e<i;e++){let i=this.points[e],n=this.points[e-1]??this.points[this.points.length-1],r=this.points[e+1]??this.points[0],s=i.roundness,a=n&&r&&eA(n,i,r);if(!i.controlsMoved()&&s>0&&!a){let n=i.curveBefore,r=i.curveAfter;if(void 0===n||void 0===r)continue;let a,o=i.roundedCurveBefore,l=i.roundedCurveAfter,h=n.getLength(),c=r.getLength(),d=Math.min(s,.499*h),u=Math.min(s,.499*c),p=Math.min(d,u),f=1-p/h,m=p/c,g=n.getPointAt(f,uA),v=r.getPointAt(m,pA);if(this._subSplitCurve(n,o,f,g,void 0),this._subSplitCurve(r,l,m,void 0,v),this.useCubicForRoundedCorners){let t=tA(g,i.position,v)/2,e=Math.tan(t)*g.distanceTo(i.position),[n,r]=nA(g,v,e,fA,mA),s=rA(n,r,i.position),[o,l]=sA(s,g,v,e,gA,vA);a=new Qa(g.clone(),o.clone(),l.clone(),v.clone())}else a=new $a(g.clone(),i.position.clone(),v.clone());i.roundedCurveCorner=a,this.roundedCurves.splice(e+t,0,a),t++}}}}_subSplitCurve(t,e,i,n,r){if(!(t instanceof Ka)){let s=t,a=e,o=s.getUtoTmapping(i,0),l=function(t,e,i,n,r=.5){let s=j_.subVectors(e,t).multiplyScalar(r).add(t),a=G_.subVectors(i,e).multiplyScalar(r).add(e),o=W_.subVectors(n,i).multiplyScalar(r).add(i),l=s,h=H_.subVectors(a,s).multiplyScalar(r).add(s),c=q_.subVectors(o,a).multiplyScalar(r).add(a),d=o,u=X_.subVectors(c,h).multiplyScalar(r).add(h);return[t.x,t.y,l.x,l.y,h.x,h.y,u.x,u.y,c.x,c.y,d.x,d.y,n.x,n.y]}(s.v0,s.v1,s.v2,s.v3,o);return void 0!==n&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),void 0!==r&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return void 0!==n&&e.v2.copy(n),void 0!==r&&e.v1.copy(r),e}clone(){let t=new yA(this._width,this._height);return t.points=this.points.map(t=>t.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(t=>t.clone()),t}toJSON(){return{points:this.points.reduce((t,e)=>t.concat(e.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){this.points=[],this.pointIDs=0;let e=t.points.length/7;for(let i=0;i<e;i++){let e=7*i,n=t.points[e+0],r=t.points[e+1],s=t.points[e+2],a=t.points[e+3],o=t.points[e+4],l=t.points[e+5],h=t.points[e+6],c=new U_(Wt.generateUUID(),new Ht(n,r));c.controls[0].position.set(s,a),c.controls[1].position.set(o,l),c.roundness=h,this.points.push(c)}return this.shapeHoles=t.shapeHoles?.length?t.shapeHoles.map(t=>{let e=new yA;return e.fromJSON(t),e}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t,e=!1){this.isText=e;let i=(t,e)=>{e instanceof Qa&&e.v3.equals(t.position)&&t.controls[0].position.copy(e.v2)};return this.points=(t=>{let e,n,r=[];for(e=0,n=t.length;e<n;e++)t[e]instanceof $a&&(t[e]=Z_(t[e]));for(e=0,n=t.length;e<n;e++){let n,s=t[e],a=e>0?t[e-1]:null;s instanceof Qa?(n=this.createPoint(s.v0),n.controls[1].position.copy(s.v1)):s instanceof Ka&&(n=this.createPoint(s.v1)),void 0!==n&&(null!==a&&i(n,a),r.push(n))}let s=t[t.length-1],a=!1;return s instanceof Qa?s.v3.equals(r[0].position)&&(r[0].controls[0].position.copy(s.v2),a=!0):s instanceof Ka&&s.v2.equals(r[0].position)&&(a=!0),this.isClosed=a,r})(t.curves),t instanceof ho&&(this.shapeHoles=t.holes.map(t=>{let e=new yA;return e.fromShape(t),e})),this.update(),this}updatePoint(t,e){let i=this.getPointByUuid(t);i&&(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.roundness&&(i.roundness=e.roundness),void 0!==e.areControlsDirectionsMirrored&&(i.areControlsDirectionsMirrored=e.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(t,e){let i=this.getPointByUuid(t)?.controls[0];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}updateNextControl(t,e){let i=this.getPointByUuid(t)?.controls[1];i&&(e.position&&i.position.fromArray(e.position),this.needsUpdate=!0)}},xA=2*Math.PI;function bA({x:t,y:e},i,n,r,s){return{x:t*i+r,y:e*n+s}}function wA(t,e){let i=1.5707963267948966===e?.551915024494:-1.5707963267948966===e?-.551915024494:1.3333333333333333*Math.tan(e/4),n=Math.cos(t),r=Math.sin(t),s=Math.cos(t+e),a=Math.sin(t+e);return[{x:n-r*i,y:r+n*i},{x:s+a*i,y:a-s*i},{x:s,y:a}]}function SA(t,e,i,n){let r=t*n-e*i<0?-1:1,s=Math.min(1,Math.max(-1,t*i+e*n));return r*Math.acos(s)}function _A({px:t,py:e,cx:i,cy:n,rx:r,ry:s,largeArcFlag:a,sweepFlag:o}){let l=[];if(0===r||0===s)return[];let h=(t-i)/2,c=(e-n)/2;if(0===h&&0===c)return[];r=Math.abs(r),s=Math.abs(s);let d=Math.pow(h,2)/Math.pow(r,2)+Math.pow(c,2)/Math.pow(s,2);d>1&&(r*=Math.sqrt(d),s*=Math.sqrt(d));let u=function(t,e,i,n,r,s,a,o,l,h){let c=Math.pow(r,2),d=Math.pow(s,2),u=Math.pow(a,2),p=Math.pow(o,2),f=c*d-c*p-d*u;f<0&&(f=0),f/=c*p+d*u,f=Math.sqrt(f)*(l===h?-1:1);let m=f*r/s*o,g=f*-s/r*a,v=m+(t+i)/2,y=g+(e+n)/2,x=(a-m)/r,b=(o-g)/s,w=(-a-m)/r,S=(-o-g)/s,_=SA(1,0,x,b),A=SA(x,b,w,S);return A<0&&(A+=xA),{centerx:v,centery:y,ang1:_,ang2:A}}(t,e,i,n,r,s,h,c,a,o),{ang1:p,ang2:f}=u,{centerx:m,centery:g}=u,v=Math.abs(f)/(xA/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);f/=y;for(let x=0;x<y;x++)l.push(wA(p,f)),p+=f;return l.map(t=>{let{x:e,y:i}=bA(t[0],r,s,m,g),{x:n,y:a}=bA(t[1],r,s,m,g),{x:o,y:l}=bA(t[2],r,s,m,g);return{x1:e,y1:i,x2:n,y2:a,x:o,y:l}})}function AA(t,e){if(!t)throw e||"Assertion Failed!"}!function(t){t[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"}(cA||(cA={})),function(t){t[t.POLYGONS=0]="POLYGONS",t[t.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",t[t.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(dA||(dA={}));var MA=function(){function t(){}return t.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},t.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},t.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},t.edgeGoesLeft=function(e){return t.vertLeq(e.Dst,e.Org)},t.edgeGoesRight=function(e){return t.vertLeq(e.Org,e.Dst)},t.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},t.edgeEval=function(e,i,n){AA(t.vertLeq(e,i)&&t.vertLeq(i,n));var r=i.s-e.s,s=n.s-i.s;return r+s>0?r<s?i.t-e.t+(e.t-n.t)*(r/(r+s)):i.t-n.t+(n.t-e.t)*(s/(r+s)):0},t.edgeSign=function(e,i,n){AA(t.vertLeq(e,i)&&t.vertLeq(i,n));var r=i.s-e.s,s=n.s-i.s;return r+s>0?(i.t-n.t)*r+(i.t-e.t)*s:0},t.transEval=function(e,i,n){AA(t.transLeq(e,i)&&t.transLeq(i,n));var r=i.t-e.t,s=n.t-i.t;return r+s>0?r<s?i.s-e.s+(e.s-n.s)*(r/(r+s)):i.s-n.s+(n.s-e.s)*(s/(r+s)):0},t.transSign=function(e,i,n){AA(t.transLeq(e,i)&&t.transLeq(i,n));var r=i.t-e.t,s=n.t-i.t;return r+s>0?(i.s-n.s)*r+(i.s-e.s)*s:0},t.vertCCW=function(t,e,i){return t.s*(e.t-i.t)+e.s*(i.t-t.t)+i.s*(t.t-e.t)>=0},t.interpolate=function(t,e,i,n){return(t=t<0?0:t)<=(i=i<0?0:i)?0===i?(e+n)/2:e+t/(t+i)*(n-e):n+i/(t+i)*(e-n)},t.intersect=function(e,i,n,r,s){var a,o,l;t.vertLeq(e,i)||(l=e,e=i,i=l),t.vertLeq(n,r)||(l=n,n=r,r=l),t.vertLeq(e,n)||(l=e,e=n,n=l,l=i,i=r,r=l),t.vertLeq(n,i)?t.vertLeq(i,r)?((a=t.edgeEval(e,n,i))+(o=t.edgeEval(n,i,r))<0&&(a=-a,o=-o),s.s=t.interpolate(a,n.s,o,i.s)):((a=t.edgeSign(e,n,i))+(o=-t.edgeSign(e,r,i))<0&&(a=-a,o=-o),s.s=t.interpolate(a,n.s,o,r.s)):s.s=(n.s+i.s)/2,t.transLeq(e,i)||(l=e,e=i,i=l),t.transLeq(n,r)||(l=n,n=r,r=l),t.transLeq(e,n)||(l=e,e=n,n=l,l=i,i=r,r=l),t.transLeq(n,i)?t.transLeq(i,r)?((a=t.transEval(e,n,i))+(o=t.transEval(n,i,r))<0&&(a=-a,o=-o),s.t=t.interpolate(a,n.t,o,i.t)):((a=t.transSign(e,n,i))+(o=-t.transSign(e,r,i))<0&&(a=-a,o=-o),s.t=t.interpolate(a,n.t,o,r.t)):s.t=(n.t+i.t)/2},t}(),CA=function(){return function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}}(),EA=function(){function t(t){this.side=t,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(t.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(t){this.Sym.Lface=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(t){this.Sym.Org=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(t){this.Sym.Lnext=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(t){this.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(t){this.Lnext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(t){this.Sym.Onext=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(t){this.Sym.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(t){this.Sym.Lnext.Sym=t},enumerable:!0,configurable:!0}),t}(),PA=function(){return 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}}(),TA=function(){function t(){var t=new PA,e=new CA,i=new EA(0),n=new EA(1);t.next=t.prev=t,t.anEdge=null,e.next=e.prev=e,i.next=i,i.Sym=n,n.next=n,n.Sym=i,this.vHead=t,this.fHead=e,this.eHead=i,this.eHeadSym=n}return t.prototype.makeEdge_=function(t){var e=new EA(0),i=new EA(1);t.Sym.side<t.side&&(t=t.Sym);var n=t.Sym.next;return i.next=n,n.Sym.next=e,e.next=t,t.Sym.next=i,e.Sym=i,e.Onext=e,e.Lnext=i,e.Org=null,e.Lface=null,e.winding=0,e.activeRegion=null,i.Sym=e,i.Onext=i,i.Lnext=e,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,e},t.prototype.splice_=function(t,e){var i=t.Onext,n=e.Onext;i.Sym.Lnext=e,n.Sym.Lnext=t,t.Onext=n,e.Onext=i},t.prototype.makeVertex_=function(t,e,i){var n=t;AA(n,"Vertex can't be null!");var r=i.prev;n.prev=r,r.next=n,n.next=i,i.prev=n,n.anEdge=e;var s=e;do{s.Org=n,s=s.Onext}while(s!==e)},t.prototype.makeFace_=function(t,e,i){var n=t;AA(n,"Face can't be null");var r=i.prev;n.prev=r,r.next=n,n.next=i,i.prev=n,n.anEdge=e,n.trail=null,n.marked=!1,n.inside=i.inside;var s=e;do{s.Lface=n,s=s.Lnext}while(s!==e)},t.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,i=t.Sym.next;e.Sym.next=i,i.Sym.next=e},t.prototype.killVertex_=function(t,e){var i=t.anEdge,n=i;do{n.Org=e,n=n.Onext}while(n!==i);var r=t.prev,s=t.next;s.prev=r,r.next=s},t.prototype.killFace_=function(t,e){var i=t.anEdge,n=i;do{n.Lface=e,n=n.Lnext}while(n!==i);var r=t.prev,s=t.next;s.prev=r,r.next=s},t.prototype.makeEdge=function(){var t=new PA,e=new PA,i=new CA,n=this.makeEdge_(this.eHead);return this.makeVertex_(t,n,this.vHead),this.makeVertex_(e,n.Sym,this.vHead),this.makeFace_(i,n,this.fHead),n},t.prototype.splice=function(t,e){var i=!1,n=!1;if(t!==e){if(e.Org!==t.Org&&(n=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(i=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),!n){var r=new PA;this.makeVertex_(r,e,t.Org),t.Org.anEdge=t}if(!i){var s=new CA;this.makeFace_(s,e,t.Lface),t.Lface.anEdge=t}}},t.prototype.delete=function(t){var e=t.Sym,i=!1;if(t.Lface!==t.Rface&&(i=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!i){var n=new CA;this.makeFace_(n,t,t.Lface)}e.Onext===e?(this.killVertex_(e.Org,null),this.killFace_(e.Lface,null)):(t.Lface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),this.killEdge_(t)},t.prototype.addEdgeVertex=function(t){var e=this.makeEdge_(t),i=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var n=new PA;return this.makeVertex_(n,i,e.Org),e.Lface=i.Lface=t.Lface,e},t.prototype.splitEdge=function(t){var e=this.addEdgeVertex(t).Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,e),t.Dst=e.Org,e.Dst.anEdge=e.Sym,e.Rface=t.Rface,e.winding=t.winding,e.Sym.winding=t.Sym.winding,e.idx=t.idx,e.Sym.idx=t.Sym.idx,e},t.prototype.connect=function(t,e){var i=!1,n=this.makeEdge_(t),r=n.Sym;if(e.Lface!==t.Lface&&(i=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(n,t.Lnext),this.splice_(r,e),n.Org=t.Dst,r.Org=e.Org,n.Lface=r.Lface=t.Lface,t.Lface.anEdge=r,!i){var s=new CA;this.makeFace_(s,n,t.Lface)}return n},t.prototype.zapFace=function(t){var e,i,n,r,s,a=t.anEdge;i=a.Lnext;do{i=(e=i).Lnext,e.Lface=null,null===e.Rface&&(e.Onext===e?this.killVertex_(e.Org,null):(e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),(n=e.Sym).Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(e))}while(e!=a);r=t.prev,(s=t.next).prev=r,r.next=s},t.prototype.countFaceVerts_=function(t){var e=t.anEdge,i=0;do{i++,e=e.Lnext}while(e!==t.anEdge);return i},t.prototype.mergeConvexFaces=function(t){var e,i,n,r,s;for(e=this.fHead.next;e!==this.fHead;e=e.next)if(e.inside)for(s=(i=e.anEdge).Org;n=i.Lnext,(r=i.Sym)&&r.Lface&&r.Lface.inside&&(this.countFaceVerts_(e)+this.countFaceVerts_(r.Lface)-2<=t&&MA.vertCCW(i.Lprev.Org,i.Org,r.Lnext.Lnext.Org)&&MA.vertCCW(r.Lprev.Org,r.Org,i.Lnext.Lnext.Org)&&(n=r.Lnext,this.delete(r),i=null,r=null)),!i||i.Lnext.Org!==s;)i=n;return!0},t.prototype.check=function(){var t,e,i,n,r,s,a=this.fHead,o=this.vHead,l=this.eHead;for(e=a,e=a;(t=e.next)!==a;e=t){AA(t.prev===e),r=t.anEdge;do{AA(r.Sym!==r),AA(r.Sym.Sym===r),AA(r.Lnext.Onext.Sym===r),AA(r.Onext.Sym.Lnext===r),AA(r.Lface===t),r=r.Lnext}while(r!==t.anEdge)}for(AA(t.prev===e&&null===t.anEdge),n=o,n=o;(i=n.next)!==o;n=i){AA(i.prev===n),r=i.anEdge;do{AA(r.Sym!==r),AA(r.Sym.Sym===r),AA(r.Lnext.Onext.Sym===r),AA(r.Onext.Sym.Lnext===r),AA(r.Org===i),r=r.Onext}while(r!==i.anEdge)}for(AA(i.prev===n&&null===i.anEdge),s=l,s=l;(r=s.next)!==l;s=r)AA(r.Sym.next===s.Sym),AA(r.Sym!==r),AA(r.Sym.Sym===r),AA(null!==r.Org),AA(null!==r.Dst),AA(r.Lnext.Onext.Sym===r),AA(r.Onext.Sym.Lnext===r);AA(r.Sym.next===s.Sym&&r.Sym===this.eHeadSym&&r.Sym.Sym===r&&null===r.Org&&null===r.Dst&&null===r.Lface&&null===r.Rface)},t}(),DA=function(){return function(){this.handle=null}}(),IA=function(){return function(){this.key=null,this.node=0}}(),OA=function(){function t(t,e){this.leq=e,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=t,this.nodes=[],this.handles=[];for(var i=0;i<t+1;i++)this.nodes[i]=new DA,this.handles[i]=new IA;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return t.prototype.floatDown_=function(t){var e,i,n,r=this.nodes,s=this.handles;for(e=r[t].handle;;){if((n=t<<1)<this.size&&this.leq(s[r[n+1].handle].key,s[r[n].handle].key)&&++n,AA(n<=this.max),i=r[n].handle,n>this.size||this.leq(s[e].key,s[i].key)){r[t].handle=e,s[e].node=t;break}r[t].handle=i,s[i].node=t,t=n}},t.prototype.floatUp_=function(t){var e,i,n,r=this.nodes,s=this.handles;for(e=r[t].handle;;){if(i=r[n=t>>1].handle,0===n||this.leq(s[i].key,s[e].key)){r[t].handle=e,s[e].node=t;break}r[t].handle=i,s[i].node=t,t=n}},t.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},t.prototype.min=function(){return this.handles[this.nodes[1].handle].key},t.prototype.insert=function(t){var e,i;if(2*(e=++this.size)>this.max){var n,r;for(this.max*=2,r=this.nodes.length,this.nodes.length=this.max+1,n=r;n<this.nodes.length;n++)this.nodes[n]=new DA;for(r=this.handles.length,this.handles.length=this.max+1,n=r;n<this.handles.length;n++)this.handles[n]=new IA}return 0===this.freeList?i=e:(i=this.freeList,this.freeList=this.handles[i].node),this.nodes[e].handle=i,this.handles[i].node=e,this.handles[i].key=t,this.initialized&&this.floatUp_(e),i},t.prototype.extractMin=function(){var t=this.nodes,e=this.handles,i=t[1].handle,n=e[i].key;return this.size>0&&(t[1].handle=t[this.size].handle,e[t[1].handle].node=1,e[i].key=null,e[i].node=this.freeList,this.freeList=i,--this.size,this.size>0&&this.floatDown_(1)),n},t.prototype.delete=function(t){var e,i=this.nodes,n=this.handles;AA(t>=1&&t<=this.max&&null!==n[t].key),i[e=n[t].node].handle=i[this.size].handle,n[i[e].handle].node=e,--this.size,e<=this.size&&(e<=1||this.leq(n[i[e>>1].handle].key,n[i[e].handle].key)?this.floatDown_(e):this.floatUp_(e)),n[t].key=null,n[t].node=this.freeList,this.freeList=t},t}(),RA=function(){return function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}}(),LA=function(){return function(){this.key=null,this.next=null,this.prev=null}}(),BA=function(){function t(t,e){this.frame=t,this.leq=e,this.head=new LA,this.head.next=this.head,this.head.prev=this.head}return t.prototype.min=function(){return this.head.next},t.prototype.max=function(){return this.head.prev},t.prototype.insert=function(t){return this.insertBefore(this.head,t)},t.prototype.search=function(t){var e=this.head;do{e=e.next}while(null!==e.key&&!this.leq(this.frame,t,e.key));return e},t.prototype.insertBefore=function(t,e){do{t=t.prev}while(null!==t.key&&!this.leq(this.frame,t.key,e));var i=new LA;return i.key=e,i.next=t.next,t.next.prev=i,i.prev=t,t.next=i,i},t.prototype.delete=function(t){t.next.prev=t.prev,t.prev.next=t.next},t}(),zA=function(){function t(){}return t.regionBelow=function(t){return t.nodeUp.prev.key},t.regionAbove=function(t){return t.nodeUp.next.key},t.debugEvent=function(t){},t.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},t.edgeLeq=function(t,e,i){var n=t.event,r=e.eUp,s=i.eUp;return r.Dst===n?s.Dst===n?MA.vertLeq(r.Org,s.Org)?MA.edgeSign(s.Dst,r.Org,s.Org)<=0:MA.edgeSign(r.Dst,s.Org,r.Org)>=0:MA.edgeSign(s.Dst,n,s.Org)<=0:s.Dst===n?MA.edgeSign(r.Dst,n,r.Org)>=0:MA.edgeEval(r.Dst,n,r.Org)>=MA.edgeEval(s.Dst,n,s.Org)},t.deleteRegion=function(t,e){e.fixUpperEdge&&AA(0===e.eUp.winding),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},t.fixUpperEdge=function(t,e,i){AA(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,e.eUp=i,i.activeRegion=e},t.topLeftRegion=function(e,i){var n,r=i.eUp.Org;do{i=t.regionAbove(i)}while(i.eUp.Org===r);if(i.fixUpperEdge){if(null===(n=e.mesh.connect(t.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;t.fixUpperEdge(e,i,n),i=t.regionAbove(i)}return i},t.topRightRegion=function(e){var i=e.eUp.Dst;do{e=t.regionAbove(e)}while(e.eUp.Dst===i);return e},t.addRegionBelow=function(t,e,i){var n=new RA;return n.eUp=i,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,i.activeRegion=n,n},t.isWindingInside=function(t,e){switch(t.windingRule){case cA.ODD:return!!(1&e);case cA.NONZERO:return 0!==e;case cA.POSITIVE:return e>0;case cA.NEGATIVE:return e<0;case cA.ABS_GEQ_TWO:return e>=2||e<=-2}throw new Error("Invalid winding rulle")},t.computeWinding=function(e,i){i.windingNumber=t.regionAbove(i).windingNumber+i.eUp.winding,i.inside=t.isWindingInside(e,i.windingNumber)},t.finishRegion=function(e,i){var n=i.eUp,r=n.Lface;r.inside=i.inside,r.anEdge=n,t.deleteRegion(e,i)},t.finishLeftRegions=function(e,i,n){for(var r,s=null,a=i,o=i.eUp;a!==n;){if(a.fixUpperEdge=!1,(r=(s=t.regionBelow(a)).eUp).Org!=o.Org){if(!s.fixUpperEdge){t.finishRegion(e,a);break}r=e.mesh.connect(o.Lprev,r.Sym),t.fixUpperEdge(e,s,r)}o.Onext!==r&&(e.mesh.splice(r.Oprev,r),e.mesh.splice(o,r)),t.finishRegion(e,a),o=s.eUp,a=s}return o},t.addRightEdges=function(e,i,n,r,s,a){var o,l,h,c,d=!0;h=n;do{AA(MA.vertLeq(h.Org,h.Dst)),t.addRegionBelow(e,i,h.Sym),h=h.Onext}while(h!==r);for(null===s&&(s=t.regionBelow(i).eUp.Rprev),l=i,c=s;(h=(o=t.regionBelow(l)).eUp.Sym).Org===c.Org;)h.Onext!==c&&(e.mesh.splice(h.Oprev,h),e.mesh.splice(c.Oprev,h)),o.windingNumber=l.windingNumber-h.winding,o.inside=t.isWindingInside(e,o.windingNumber),l.dirty=!0,!d&&t.checkForRightSplice(e,l)&&(t.addWinding(h,c),t.deleteRegion(e,l),e.mesh.delete(c)),d=!1,l=o,c=h;l.dirty=!0,AA(l.windingNumber-h.winding===o.windingNumber),a&&t.walkDirtyRegions(e,l)},t.spliceMergeVertices=function(t,e,i){t.mesh.splice(e,i)},t.vertexWeights=function(t,e,i){var n=MA.vertL1dist(e,t),r=MA.vertL1dist(i,t),s=.5*r/(n+r),a=.5*n/(n+r);t.coords[0]+=s*e.coords[0]+a*i.coords[0],t.coords[1]+=s*e.coords[1]+a*i.coords[1],t.coords[2]+=s*e.coords[2]+a*i.coords[2]},t.getIntersectData=function(e,i,n,r,s,a){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,t.vertexWeights(i,n,r),t.vertexWeights(i,s,a)},t.checkForRightSplice=function(e,i){var n=t.regionBelow(i),r=i.eUp,s=n.eUp;if(MA.vertLeq(r.Org,s.Org)){if(MA.edgeSign(s.Dst,r.Org,s.Org)>0)return!1;MA.vertEq(r.Org,s.Org)?r.Org!==s.Org&&(e.pq.delete(r.Org.pqHandle),t.spliceMergeVertices(e,s.Oprev,r)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(r,s.Oprev),i.dirty=n.dirty=!0)}else{if(MA.edgeSign(r.Dst,s.Org,r.Org)<0)return!1;t.regionAbove(i).dirty=i.dirty=!0,e.mesh.splitEdge(r.Sym),e.mesh.splice(s.Oprev,r)}return!0},t.checkForLeftSplice=function(e,i){var n,r=t.regionBelow(i),s=i.eUp,a=r.eUp;if(AA(!MA.vertEq(s.Dst,a.Dst)),MA.vertLeq(s.Dst,a.Dst)){if(MA.edgeSign(s.Dst,a.Dst,s.Org)<0)return!1;t.regionAbove(i).dirty=i.dirty=!0,n=e.mesh.splitEdge(s),e.mesh.splice(a.Sym,n),n.Lface.inside=i.inside}else{if(MA.edgeSign(a.Dst,s.Dst,a.Org)>0)return!1;i.dirty=r.dirty=!0,n=e.mesh.splitEdge(a),e.mesh.splice(s.Lnext,a.Sym),n.Rface.inside=i.inside}return!0},t.checkForIntersect=function(e,i){var n,r,s=t.regionBelow(i),a=i.eUp,o=s.eUp,l=a.Org,h=o.Org,c=a.Dst,d=o.Dst,u=new PA;if(AA(!MA.vertEq(d,c)),AA(MA.edgeSign(c,e.event,l)<=0),AA(MA.edgeSign(d,e.event,h)>=0),AA(l!==e.event&&h!==e.event),AA(!i.fixUpperEdge&&!s.fixUpperEdge),l===h||Math.min(l.t,c.t)>Math.max(h.t,d.t))return!1;if(MA.vertLeq(l,h)){if(MA.edgeSign(d,l,h)>0)return!1}else if(MA.edgeSign(c,h,l)<0)return!1;return t.debugEvent(e),MA.intersect(c,l,d,h,u),AA(Math.min(l.t,c.t)<=u.t),AA(u.t<=Math.max(h.t,d.t)),AA(Math.min(d.s,c.s)<=u.s),AA(u.s<=Math.max(h.s,l.s)),MA.vertLeq(u,e.event)&&(u.s=e.event.s,u.t=e.event.t),n=MA.vertLeq(l,h)?l:h,MA.vertLeq(n,u)&&(u.s=n.s,u.t=n.t),MA.vertEq(u,l)||MA.vertEq(u,h)?(t.checkForRightSplice(e,i),!1):!MA.vertEq(c,e.event)&&MA.edgeSign(c,e.event,u)>=0||!MA.vertEq(d,e.event)&&MA.edgeSign(d,e.event,u)<=0?d===e.event?(e.mesh.splitEdge(a.Sym),e.mesh.splice(o.Sym,a),i=t.topLeftRegion(e,i),a=t.regionBelow(i).eUp,t.finishLeftRegions(e,t.regionBelow(i),s),t.addRightEdges(e,i,a.Oprev,a,a,!0),!0):c===e.event?(e.mesh.splitEdge(o.Sym),e.mesh.splice(a.Lnext,o.Oprev),s=i,i=t.topRightRegion(i),r=t.regionBelow(i).eUp.Rprev,s.eUp=o.Oprev,o=t.finishLeftRegions(e,s,null),t.addRightEdges(e,i,o.Onext,a.Rprev,r,!0),!0):(MA.edgeSign(c,e.event,u)>=0&&(t.regionAbove(i).dirty=i.dirty=!0,e.mesh.splitEdge(a.Sym),a.Org.s=e.event.s,a.Org.t=e.event.t),MA.edgeSign(d,e.event,u)<=0&&(i.dirty=s.dirty=!0,e.mesh.splitEdge(o.Sym),o.Org.s=e.event.s,o.Org.t=e.event.t),!1):(e.mesh.splitEdge(a.Sym),e.mesh.splitEdge(o.Sym),e.mesh.splice(o.Oprev,a),a.Org.s=u.s,a.Org.t=u.t,a.Org.pqHandle=e.pq.insert(a.Org),t.getIntersectData(e,a.Org,l,c,h,d),t.regionAbove(i).dirty=i.dirty=s.dirty=!0,!1)}
vendor: 5,604 bytes, line 2
2,t.walkDirtyRegions=function(e,i){for(var n,r,s=t.regionBelow(i);;){for(;s.dirty;)i=s,s=t.regionBelow(s);if(!i.dirty&&(s=i,null===(i=t.regionAbove(i))||!i.dirty))return;if(i.dirty=!1,n=i.eUp,r=s.eUp,n.Dst!==r.Dst&&t.checkForLeftSplice(e,i)&&(s.fixUpperEdge?(t.deleteRegion(e,s),e.mesh.delete(r),r=(s=t.regionBelow(i)).eUp):i.fixUpperEdge&&(t.deleteRegion(e,i),e.mesh.delete(n),n=(i=t.regionAbove(s)).eUp)),n.Org!==r.Org)if(n.Dst===r.Dst||i.fixUpperEdge||s.fixUpperEdge||n.Dst!==e.event&&r.Dst!==e.event)t.checkForRightSplice(e,i);else if(t.checkForIntersect(e,i))return;n.Org===r.Org&&n.Dst===r.Dst&&(t.addWinding(r,n),t.deleteRegion(e,i),e.mesh.delete(n),i=t.regionAbove(s))}},t.connectRightVertex=function(e,i,n){var r,s=n.Onext,a=t.regionBelow(i),o=i.eUp,l=a.eUp,h=!1;o.Dst!==l.Dst&&t.checkForIntersect(e,i),MA.vertEq(o.Org,e.event)&&(e.mesh.splice(s.Oprev,o),i=t.topLeftRegion(e,i),s=t.regionBelow(i).eUp,t.finishLeftRegions(e,t.regionBelow(i),a),h=!0),MA.vertEq(l.Org,e.event)&&(e.mesh.splice(n,l.Oprev),n=t.finishLeftRegions(e,a,null),h=!0),h?t.addRightEdges(e,i,n.Onext,s,s,!0):(r=MA.vertLeq(l.Org,o.Org)?l.Oprev:o,r=e.mesh.connect(n.Lprev,r),t.addRightEdges(e,i,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,t.walkDirtyRegions(e,i))},t.connectLeftDegenerate=function(e,i,n){var r,s,a,o,l;return r=i.eUp,MA.vertEq(r.Org,n)?(AA(!1),void t.spliceMergeVertices(e,r,n.anEdge)):MA.vertEq(r.Dst,n)?(AA(!1),i=t.topRightRegion(i),s=o=(a=(l=t.regionBelow(i)).eUp.Sym).Onext,l.fixUpperEdge&&(AA(s!==a),t.deleteRegion(e,l),e.mesh.delete(a),a=s.Oprev),e.mesh.splice(n.anEdge,a),MA.edgeGoesLeft(s)||(s=null),void t.addRightEdges(e,i,a.Onext,o,s,!0)):(e.mesh.splitEdge(r.Sym),i.fixUpperEdge&&(e.mesh.delete(r.Onext),i.fixUpperEdge=!1),e.mesh.splice(n.anEdge,r),void t.sweepEvent(e,n))},t.connectLeftVertex=function(e,i){var n,r,s,a,o,l,h=new RA;if(h.eUp=i.anEdge.Sym,n=e.dict.search(h).key,r=t.regionBelow(n)){if(a=n.eUp,o=r.eUp,0===MA.edgeSign(a.Dst,i,a.Org))return void t.connectLeftDegenerate(e,n,i);if(s=MA.vertLeq(o.Dst,a.Dst)?n:r,n.inside||s.fixUpperEdge){if(s===n)l=e.mesh.connect(i.anEdge.Sym,a.Lnext);else l=e.mesh.connect(o.Dnext,i.anEdge).Sym;s.fixUpperEdge?t.fixUpperEdge(e,s,l):t.computeWinding(e,t.addRegionBelow(e,n,l)),t.sweepEvent(e,i)}else t.addRightEdges(e,n,i.anEdge,i.anEdge,null,!0)}},t.sweepEvent=function(e,i){e.event=i,t.debugEvent(e);for(var n=i.anEdge;null===n.activeRegion;)if((n=n.Onext)===i.anEdge)return void t.connectLeftVertex(e,i);var r=t.topLeftRegion(e,n.activeRegion);AA(null!==r);var s=t.regionBelow(r),a=s.eUp,o=t.finishLeftRegions(e,s,null);o.Onext===a?t.connectRightVertex(e,r,o):t.addRightEdges(e,r,o.Onext,a,a,!0)},t.addSentinel=function(t,e,i,n){var r=new RA,s=t.mesh.makeEdge();s.Org.s=i,s.Org.t=n,s.Dst.s=e,s.Dst.t=n,t.event=s.Dst,r.eUp=s,r.windingNumber=0,r.inside=!1,r.fixUpperEdge=!1,r.sentinel=!0,r.dirty=!1,r.nodeUp=t.dict.insert(r)},t.initEdgeDict=function(e){e.dict=new BA(e,t.edgeLeq);var i=e.bmax[0]-e.bmin[0],n=e.bmax[1]-e.bmin[1],r=e.bmin[0]-i,s=e.bmax[0]+i,a=e.bmin[1]-n,o=e.bmax[1]+n;t.addSentinel(e,r,s,a),t.addSentinel(e,r,s,o)},t.doneEdgeDict=function(e){for(var i,n=0;null!==(i=e.dict.min().key);)i.sentinel||(AA(i.fixUpperEdge),AA(1===++n)),AA(0===i.windingNumber),t.deleteRegion(e,i)},t.removeDegenerateEdges=function(e){var i,n,r,s=e.mesh.eHead;for(i=s.next;i!==s;i=n)n=i.next,r=i.Lnext,MA.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(t.spliceMergeVertices(e,r,i),e.mesh.delete(i),r=(i=r).Lnext),r.Lnext===i&&(r!==i&&((r===n||r===n.Sym)&&(n=n.next),e.mesh.delete(r)),(i===n||i===n.Sym)&&(n=n.next),e.mesh.delete(i))},t.initPriorityQ=function(t){var e,i,n,r=0;for(i=(n=t.mesh.vHead).next;i!==n;i=i.next)r++;for(r+=8,e=t.pq=new OA(r,MA.vertLeq),i=(n=t.mesh.vHead).next;i!==n;i=i.next)i.pqHandle=e.insert(i);return i===n&&(e.init(),!0)},t.donePriorityQ=function(t){t.pq=null},t.removeDegenerateFaces=function(e,i){var n,r,s;for(n=i.fHead.next;n!==i.fHead;n=r)r=n.next,AA((s=n.anEdge).Lnext!==s),s.Lnext.Lnext===s&&(t.addWinding(s.Onext,s),e.mesh.delete(s));return!0},t.computeInterior=function(e,i){var n,r;if(void 0===i&&(i=!0),t.removeDegenerateEdges(e),!t.initPriorityQ(e))return!1;for(t.initEdgeDict(e);null!==(n=e.pq.extractMin());){for(;null!==(r=e.pq.min())&&MA.vertEq(r,n);)r=e.pq.extractMin(),t.spliceMergeVertices(e,n.anEdge,r.anEdge);t.sweepEvent(e,n)}return e.event=e.dict.min().key.eUp.Org,t.debugEvent(e),t.doneEdgeDict(e),t.donePriorityQ(e),!!t.removeDegenerateFaces(e,e.mesh)&&(i&&e.mesh.check(),!0)},t}(),FA=function(){function t(){this.mesh=new TA,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=cA.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 t.prototype.dot_=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.prototype.normalize_=function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!e)throw"Zero-size vector!";e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},t.prototype.longAxis_=function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},t.prototype.computeNormal_=function(t){var e,i,n,r,s,a,o=[0,0,0],l=[0,0,0],h=[0,0,0],c=[0,0,0],d=[0,0,0],u=[null,null,null],p=[null,null,null],f=this.mesh.vHead;e=f.next;for(var m=0;m<3;++m)r=e.coords[m],l[m]=r,p[m]=e,o[m]=r,u[m]=e;for(e=f.next;e!==f;e=e.next)for(var g=0;g<3;++g)(r=e.coords[g])<l[g]&&(l[g]=r,p[g]=e),r>o[g]&&(o[g]=r,u[g]=e);var v=0;if(o[1]-l[1]>o[0]-l[0]&&(v=1),o[2]-l[2]>o[v]-l[v]&&(v=2),l[v]>=o[v])return t[0]=0,t[1]=0,void(t[2]=1);
vendor: 5,007 bytes, line 2
2for(a=0,i=p[v],n=u[v],h[0]=i.coords[0]-n.coords[0],h[1]=i.coords[1]-n.coords[1],h[2]=i.coords[2]-n.coords[2],e=f.next;e!==f;e=e.next)c[0]=e.coords[0]-n.coords[0],c[1]=e.coords[1]-n.coords[1],c[2]=e.coords[2]-n.coords[2],d[0]=h[1]*c[2]-h[2]*c[1],d[1]=h[2]*c[0]-h[0]*c[2],d[2]=h[0]*c[1]-h[1]*c[0],(s=d[0]*d[0]+d[1]*d[1]+d[2]*d[2])>a&&(a=s,t[0]=d[0],t[1]=d[1],t[2]=d[2]);a<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(h)]=1)},t.prototype.checkOrientation_=function(){for(var t,e,i=this.mesh.fHead,n=this.mesh.vHead,r=0,s=i.next;s!==i;s=s.next)if(!((e=s.anEdge).winding<=0))do{r+=(e.Org.s-e.Dst.s)*(e.Org.t+e.Dst.t),e=e.Lnext}while(e!==s.anEdge);if(r<0){for(t=n.next;t!==n;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},t.prototype.projectPolygon_=function(){var t,e,i=this.mesh.vHead,n=[0,0,0],r=!1;n[0]=this.normal[0],n[1]=this.normal[1],n[2]=this.normal[2],!n[0]&&!n[1]&&!n[2]&&(this.computeNormal_(n),r=!0),t=this.sUnit,e=this.tUnit;var s=this.longAxis_(n);t[s]=0,t[(s+1)%3]=1,t[(s+2)%3]=0,e[s]=0,e[(s+1)%3]=0,e[(s+2)%3]=n[s]>0?1:-1;for(var a=i.next;a!==i;a=a.next)a.s=this.dot_(a.coords,t),a.t=this.dot_(a.coords,e);r&&this.checkOrientation_();for(var o=!0,l=i.next;l!==i;l=l.next)o?(this.bmin[0]=this.bmax[0]=l.s,this.bmin[1]=this.bmax[1]=l.t,o=!1):(l.s<this.bmin[0]&&(this.bmin[0]=l.s),l.s>this.bmax[0]&&(this.bmax[0]=l.s),l.t<this.bmin[1]&&(this.bmin[1]=l.t),l.t>this.bmax[1]&&(this.bmax[1]=l.t))},t.prototype.addWinding_=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},t.prototype.tessellateMonoRegion_=function(t,e){var i,n;if((i=e.anEdge).Lnext===i||i.Lnext.Lnext===i)throw"Mono region invalid";for(;MA.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;MA.vertLeq(i.Org,i.Dst);i=i.Lnext);n=i.Lprev;for(;i.Lnext!==n;)if(MA.vertLeq(i.Dst,n.Org)){for(;n.Lnext!==i&&(MA.edgeGoesLeft(n.Lnext)||MA.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)n=t.connect(n.Lnext,n).Sym;n=n.Lprev}else{for(;n.Lnext!==i&&(MA.edgeGoesRight(i.Lprev)||MA.edgeSign(i.Dst,i.Org,i.Lprev.Org)>=0);)i=t.connect(i,i.Lprev).Sym;i=i.Lnext}if(n.Lnext===i)throw"Mono region invalid";for(;n.Lnext.Lnext!==i;)n=t.connect(n.Lnext,n).Sym;return!0},t.prototype.tessellateInterior_=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)if(e=i.next,i.inside&&!this.tessellateMonoRegion_(t,i))return!1;return!0},t.prototype.discardExterior_=function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside||t.zapFace(i)},t.prototype.setWindingNumber_=function(t,e,i){for(var n,r=t.eHead.next;r!==t.eHead;r=n)n=r.next,r.Rface.inside!==r.Lface.inside?r.winding=r.Lface.inside?e:-e:i?t.delete(r):r.winding=0},t.prototype.getNeighbourFace_=function(t){return t.Rface&&t.Rface.inside?t.Rface.n:-1},t.prototype.outputPolymesh_=function(t,e,i,n){var r,s,a=0,o=0;i>3&&t.mergeConvexFaces(i);for(var l=t.vHead.next;l!==t.vHead;l=l.next)l.n=-1;for(var h=t.fHead.next;h!==t.fHead;h=h.next)if(h.n=-1,h.inside){r=h.anEdge,s=0;do{-1===(l=r.Org).n&&(l.n=o,o++),s++,r=r.Lnext}while(r!==h.anEdge);if(s>i)throw"Face vertex greater that support polygon";h.n=a,++a}this.elementCount=a,e===dA.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*i,this.vertexCount=o,this.vertices=[],this.vertices.length=o*n,this.vertexIndices=[],this.vertexIndices.length=o;for(l=t.vHead.next;l!==t.vHead;l=l.next)if(-1!==l.n){var c=l.n*n;this.vertices[c+0]=l.coords[0],this.vertices[c+1]=l.coords[1],n>2&&(this.vertices[c+2]=l.coords[2]),this.vertexIndices[l.n]=l.idx}var d=0;for(h=t.fHead.next;h!==t.fHead;h=h.next)if(h.inside){r=h.anEdge,s=0;do{l=r.Org;this.elements[d++]=l.n,s++,r=r.Lnext}while(r!==h.anEdge);for(var u=s;u<i;++u)this.elements[d++]=-1;if(e===dA.CONNECTED_POLYGONS){r=h.anEdge;do{this.elements[d++]=this.getNeighbourFace_(r),r=r.Lnext}while(r!==h.anEdge);for(var p=s;p<i;++p)this.elements[d++]=-1}}},t.prototype.outputContours_=function(t,e){var i,n,r=0,s=0;this.vertexCount=0,this.elementCount=0;for(var a=t.fHead.next;a!==t.fHead;a=a.next)if(a.inside){n=i=a.anEdge;do{this.vertexCount++,i=i.Lnext}while(i!==n);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var o=0,l=0,h=0;r=0;for(a=t.fHead.next;a!==t.fHead;a=a.next)if(a.inside){s=0,n=i=a.anEdge;do{this.vertices[o++]=i.Org.coords[0],this.vertices[o++]=i.Org.coords[1],e>2&&(this.vertices[o++]=i.Org.coords[2]),this.vertexIndices[l++]=this.vertexIdCallback?this.vertexIdCallback(i):i.Org.idx,s++,i=i.Lnext}while(i!==n);this.elements[h++]=r,this.elements[h++]=s,r+=s}},t.prototype.addContour=function(t,e){null===this.mesh&&(this.mesh=new TA),t<2&&(t=2),t>3&&(t=3);for(var i=null,n=0;n<e.length;n+=t)null===i?(i=this.mesh.makeEdge(),this.mesh.splice(i,i.Sym)):(this.mesh.splitEdge(i),i=i.Lnext),i.Org.coords[0]=e[n+0],i.Org.coords[1]=e[n+1],i.Org.coords[2]=t>2?e[n+2]:0,i.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(i),i.winding=1,i.Sym.winding=-1}
2,t.prototype.tesselate=function(t,e,i,n,r,s){if(void 0===t&&(t=cA.ODD),void 0===e&&(e=dA.POLYGONS),void 0===s&&(s=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,r&&(this.normal[0]=r[0],this.normal[1]=r[1],this.normal[2]=r[2]),this.windingRule=t,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),zA.computeInterior(this,s);var a=this.mesh;return e===dA.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),s&&a.check(),e===dA.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,e,i,n),!0},t}();function NA(t){var e=t.windingRule,i=void 0===e?cA.ODD:e,n=t.elementType,r=void 0===n?dA.POLYGONS:n,s=t.polySize,a=void 0===s?3:s,o=t.vertexSize,l=void 0===o?2:o,h=t.normal,c=void 0===h?[0,0,1]:h,d=t.contours,u=void 0===d?[]:d,p=t.strict,f=void 0===p||p,m=t.debug,g=void 0!==m&&m;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new FA;t.edgeCreateCallback&&(v.edgeCreateCallback=t.edgeCreateCallback),t.vertexIdCallback&&(v.vertexIdCallback=t.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[y]);return v.tesselate(i,r,a,l,c,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}cA.ODD,cA.NONZERO,cA.POSITIVE,cA.NEGATIVE,cA.ABS_GEQ_TWO,dA.POLYGONS,dA.CONNECTED_POLYGONS,dA.BOUNDARY_CONTOURS;var UA=class{constructor(t=256,e=!1){this.capacity=t,this.size=0,this.debug=e,this.debug;let i=t*UA.eSize;this.buffer=new ArrayBuffer(i);let n=Float32Array.BYTES_PER_ELEMENT,r=0;this.positions=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.normals=new Float32Array(this.buffer,r*n,3*t),r+=3*t,this.uvs=new Float32Array(this.buffer,r*n,2*t)}realloc(t,e=!1){if(t<this.size)throw Error("cannot shrink buffer");if(t<=this.capacity&&!e)return;this.debug;let i=t*UA.eSize,n=new ArrayBuffer(i),r=Float32Array.BYTES_PER_ELEMENT,s=0,a=new Float32Array(n,s*r,3*t);s+=3*t;let o=new Float32Array(n,s*r,3*t);s+=3*t;let l=new Float32Array(n,s*r,2*t);e?(a.set(this.positions.subarray(0,3*this.size)),o.set(this.normals.subarray(0,3*this.size)),l.set(this.uvs.subarray(0,2*this.size))):(a.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=n,this.positions=a,this.normals=o,this.uvs=l,this.capacity=t}get(t=1){let e=this.size+t;if(e>this.capacity){let t=this.capacity;for(;e>t;)t*=2;this.realloc(t)}let i=this.size;return this.size=e,i}reserve(t){let e=this.size+t;e>this.capacity&&this.realloc(e)}shrink(){this.debug,this.realloc(this.size,!0)}},kA=UA;kA.eSize=8*Float32Array.BYTES_PER_ELEMENT;var VA=class{constructor(t=[],e=(t,e)=>t<e?-1:t>e?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,n=e[t];for(;t>0;){let r=t-1>>1,s=e[r];if(i(n,s)>=0)break;e[t]=s,t=r}e[t]=n}_down(t){let{data:e,compare:i}=this,n=this.length>>1,r=e[t];for(;t<n;){let n=1+(t<<1),s=n+1;if(s<this.length&&i(e[s],e[n])<0&&(n=s),i(e[n],r)>=0)break;e[t]=e[n],t=n}e[t]=r}};function jA(t,e,i=1,n=!1){let r=1/0,s=1/0,a=-1/0,o=-1/0;for(let[v,y]of t[0])v<r&&(r=v),y<s&&(s=y),v>a&&(a=v),y>o&&(o=y);let l=a-r,h=o-s,c=Math.max(i,Math.min(l,h));if(c===i){let t=[r,s];return t.distance=0,t.distance}let d=new VA([],(t,e)=>e.max-t.max),u=function(t){let e=0,i=0,n=0,r=t[0];for(let a=0,o=r.length,l=o-1;a<o;l=a++){let t=r[a],s=r[l],o=t[0]*s[1]-s[0]*t[1];i+=(t[0]+s[0])*o,n+=(t[1]+s[1])*o,e+=3*o}let s=new GA(i/e,n/e,0,t);return 0===e||s.d<0?new GA(r[0][0],r[0][1],0,t):s}(t),p=new GA(r+l/2,s+h/2,0,t);p.d>u.d&&(u=p);function f(n,r,s){let a=new GA(n,r,s,t);if(a.max>u.d+i&&d.push(a),a.d>u.d&&(u=a,u.d>e))return e}let m=c/2;for(let v=r;v<a;v+=c)for(let t=s;t<o;t+=c)f(v+m,t+m,m);for(;d.length;){let{max:t,x:e,y:n,h:r}=d.pop();if(t-u.d<=i)break;m=r/2,f(e-m,n-m,m),f(e+m,n-m,m),f(e-m,n+m,m),f(e+m,n+m,m)}let g=[u.x,u.y];return g.distance=u.d,g.distance}function GA(t,e,i,n){this.x=t,this.y=e,this.h=i,this.d=function(t,e,
2i){let n=!1,r=1/0;for(let s of i)for(let i=0,a=s.length,o=a-1;i<a;o=i++){let a=s[i],l=s[o];a[1]>e!=l[1]>e&&t<(l[0]-a[0])*(e-a[1])/(l[1]-a[1])+a[0]&&(n=!n),r=Math.min(r,WA(t,e,a,l))}return 0===r?0:(n?1:-1)*Math.sqrt(r)}(t,e,n),this.max=this.d+this.h*Math.SQRT2}function WA(t,e,i,n){let r=i[0],s=i[1],a=n[0]-r,o=n[1]-s;if(0!==a||0!==o){let i=((t-r)*a+(e-s)*o)/(a*a+o*o);i>1?(r=n[0],s=n[1]):i>0&&(r+=a*i,s+=o*i)}return a=t-r,o=e-s,a*a+o*o}var HA={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},qA={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},XA={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},YA=(t,e)=>([i,n])=>(n<i&&(n+=e),(t>=i?t:t+e)<=n),QA=class extends Qi{constructor(t,e,i=0,n=12,r=3,s=cA.ODD,a=!1){super(),this.forPathBevel=a,this.type="ShapeGeometry",this.vertexCache={},this._shape=t,this._depth=e,this._curveSegments=n,this._bevelSegmentsInput=r;let o,l,h,c=this._shape.extractShapePointsToFlatArray([],n),d=this._shape.shapeHoles.map(t=>{let e=t.extractShapePointsToFlatArray([],n),i=[];for(let n=e.length-1;n>=1;n-=2){let t=e[n-1],r=e[n-0];i.push(t,r)}return i}),u=[],p=[];for(let M=0;M<c.length;M+=2)p.push([c[M],c[M+1]]);u.push(p);for(let M=0;M<d.length;M++){let t=d[M],e=[];for(let i=0;i<t.length;i+=2)e.push([t[i],t[i+1]]);u.push(e)}o=t.isText?.1*(new sh).setFromPoints(t.points.map(t=>t.position)).getSize(new Ht).length():0===u[0].length?i:i>0?jA(u,i):1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,o,e/2),this._bevelSegments=Math.floor(r));try{l=NA({windingRule:s,elementType:dA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[c]})}catch{l=HA}try{h=NA({windingRule:cA.ODD,elementType:dA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...d]})}catch{h=qA}if(!l)throw new Error("error generating geometry");let f=l.elementCount;if(h){l.elementCount+=h.elementCount;for(let t=0;t<h.elements.length;t++){let e=h.elements[t],i=t%2==0?l.vertexCount:0;l.elements.push(e+i)}for(let t=0;t<h.vertexIndices.length;t++){let e=h.vertexIndices[t],i=l.vertexCount;l.vertexIndices.push(e+i)}for(let t=0;t<h.vertices.length;t++){let e=h.vertices[t];l.vertices.push(e)}}let m=1/0,g=-1/0,v=1/0,y=-1/0;for(let M=0,C=l.vertexCount;M<C;M++){let t=2*M,e=l.vertices[t+0],i=l.vertices[t+1];e<m&&(m=e),e>g&&(g=e),i<v&&(v=i),i>y&&(y=i)}this._minX=m,this._minY=v,this._width=g-m,this._height=y-v,this._buffer=new kA(this._computeBufferEstimatedSize(l));let x=[],b=[];for(let M=l.elementCount-1;M>=0;M--){let t=M>=f,e=2*M,i=l.elements[e+0],r=l.elements[e+1],s=i+r,h={start:i,count:r,normals:[],continuous:[],concave:[]},c=i,u=s-1,p=i+1,m=this._shape.roundedCurves.length;do{let e=c-i,n=l.vertices[2*u+0],a=l.vertices[2*u+1],o=l.vertices[2*c+0],d=l.vertices[2*c+1],f=l.vertices[2*p+0],g=l.vertices[2*p+1],v=o-n,y=d-a,x=Math.sqrt(v*v+y*y);v/=x,y/=x;let b=o-f,w=d-g,S=Math.sqrt(b*b+w*w);b/=S,w/=S,h.normals[2*e+0]=-w,h.normals[2*e+1]=b,h.concave[e]=v*w-y*b>0;let _=l.vertexIndices[c];if(Array.isArray(_))h.continuous[e]=!1;else{let[t,i]=this._shape.getCurveIndexFromVertexId(_-1,!0);if(i>0&&i<1)h.continuous[e]=!0;else{let n=1===i?t+1:t-1;n=(n+m)%m;let r=1===i?0:1,s=this._shape.roundedCurves[t].getTangent(i),a=this._shape.roundedCurves[n].getTangent(r);h.continuous[e]=s.dot(a)>.95}}t&&(h.normals[2*e+0]*=-1,h.normals[2*e+1]*=-1),[u,c,p]=[c,p,p+1],p>=s&&(p-=r)}while(p!==i+1);let g=[];g.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(2*i,2*s),vertexCount:r,vertexIndices:new Array(r).fill(!0).map((t,e)=>[e,e]),elements:[0,r],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(2*i,2*s)});let v=0;for(let a=1;a<=this._bevelSegments;a++){let e=a/this._bevelSegments*Math.PI/2,i=(1-Math.cos(e))*this._bevel,s=[],o=[],c=0;for(let a=0;a<r;a++){let e=2*a,d=(a-1+r)%r*2,u=l.vertices[2*h.start+e+0],p=l.vertices[2*h.start+e+1],f=-h.normals[d+0]*i,m=-h.normals[d+1]*i,g=-h.normals[e+0]*i,v=-h.normals[e+1]*i;if(h.concave[a]||!h.concave[a]&&t){let e=Math.atan2(m,f),r=Math.atan2(v,g);r>e&&(r-=2*Math.PI);let l=r-e;if(h.continuous[a]||t){let n=e+l/2,r=Math.cos(n)*i,h=Math.sin(n)*i;s[2*c+0]=u+r*(t?-1:1),s[2*c+1]=p+h*(t?-1:1),o[c]=a,c++}else{let t=Math.max(1,Math.floor(n/4*Math.abs(l)/Math.PI));for(let n=0;n<=t;n++){let r=e+l*(n/t),h=Math.cos(r)*i,d=Math.sin(r)*i;s[2*c+0]=u+h,s[2*c+1]=p+d,o[c]=a,c++}}}else s[2*c+0]=u+f,s[2*c+1]=p+m,o[c]=a,c++,s[2*c+0]=u,s[2*c+1]=p,o[c]=a,c++,s[2*c+0]=u+g,s[2*c+1]=p+v,o[c]=a,c++}let d=NA({windingRule:cA.POSITIVE,elementType:dA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s],edgeCreateCallback:t=>{let e=t.Org.idx,i=o[e],n=o[(e+1)%o.length];t.idx=[i,n],t.Sym.idx=[n,i]},vertexIdCallback:t=>{let e=t.Lprev.idx;return[e?e[1]:0,t.idx?t.idx[0]:0]}});if(!d)throw new Error(`error generating bevel geometry for ${a}'th loop`);if(!d.vertexCount){let t=(a-1)/this._bevelSegments*Math.PI/2;v=(1-Math.sin(t))*this._bevel;break}for(let t=0;t<d.vertexIndices.length;t++){let[e,i]=d.vertexIndices[t];if(e===i)continue;let n=i;i<e&&(n+=r);for(let s=e;s<n;s++){let n=s%r,a=(s+1)%r;if(!h.continuous[n]||!h.continuous[a]){d.vertexIndices[t]=[e,n],d.vertexIndices.splice(t+1,0,[a,i]),d.vertices.splice(2*(t+1),0,d.vertices[2*t],d.vertices[2*t+1]);break}}}g.push({bevelI:a,angle:e,size:i,boundary:d,reverseMap:o,insetPoints:s})}let y=(t,e,i)=>
2{let n=0,r=t.boundary.vertexIndices.length;for(;n<r&&i(t.boundary.vertexIndices[e]);)e=(e+1)%r,n++;return n},w=x.length;for(let n=1;n<g.length;n++){let t=g[n-1],e=g[n],i=t.boundary.vertexIndices.length,s=e.boundary.vertexIndices.length;if(!i||!s)break;let o=h.concave.length,l=0,c=YA(l,r);for(;!t.boundary.vertexIndices.filter(c).length||!e.boundary.vertexIndices.filter(c).length;)l++,c=YA(l,r);let d=t.boundary.vertexIndices.findIndex(c),u=e.boundary.vertexIndices.findIndex(c);do{d=(d+1)%i}while(c(t.boundary.vertexIndices[d]));do{u=(u+1)%s}while(c(e.boundary.vertexIndices[u]));l=(l+1)%r;let p,f,m=l,v=0,b=this._buildBevelVert(h,t,(d-1+i)%i,void 0,v),w=this._buildBevelVert(h,e,(u-1+s)%s,void 0,v),S=!1;do{v=(l||o)/o,c=YA(l,r);let n=y(t,d,c),m=y(e,u,c),g=S;if(S=!1,n&&!m){for(let e=0;e<n;e++)p=this._buildBevelVert(h,t,(d+e)%i,e/(n-1),v),x.push(b.topN,p.topP,w.topN),!1===a&&x.push(p.bottomP,b.bottomN,w.bottomN),b=p;S=!0}else if(!n&&m)for(let t=0;t<m;t++)f=this._buildBevelVert(h,e,(u+t)%s,t/(m-1),v),x.push(w.topN,b.topP,f.topP),!1===a&&x.push(b.bottomP,w.bottomN,f.bottomP),w=f;else if(n&&m)if(p=this._buildBevelVert(h,t,d,0,v),f=this._buildBevelVert(h,e,u,0,v),g?(x.push(b.topN,f.topP,w.topN),x.push(b.topN,p.topP,f.topP),!1===a&&(x.push(f.bottomP,b.bottomN,w.bottomN),x.push(f.bottomP,p.bottomP,b.bottomN))):(x.push(w.topN,b.topN,p.topP),x.push(w.topN,p.topP,f.topP),!1===a&&(x.push(p.bottomP,b.bottomN,w.bottomN),x.push(p.bottomP,w.bottomN,f.bottomP))),b=p,w=f,n===m)for(let r=1;r<n;r++)p=this._buildBevelVert(h,t,(d+r)%i,r/(n-1),v),f=this._buildBevelVert(h,e,(u+r)%s,r/(m-1),v),x.push(b.topN,p.topP,w.topN),x.push(w.topN,p.topP,f.topP),!1===a&&(x.push(p.bottomP,b.bottomN,w.bottomN),x.push(p.bottomP,w.bottomN,f.bottomP)),b=p,w=f;else if(n>m){let r=n/m,o=0;for(let l=1;l<n;l++)p=this._buildBevelVert(h,t,(d+l)%i,l/(n-1),v),x.push(b.topN,p.topP,w.topN),!1===a&&x.push(p.bottomP,b.bottomN,w.bottomN),b=p,l>(o+1)*r&&(o++,f=this._buildBevelVert(h,e,(u+o)%s,o/(m-1),v),x.push(w.topN,p.topP,f.topP),!1===a&&x.push(p.bottomP,w.bottomN,f.bottomP),w=f)}else{let r=m/n,o=0;for(let l=1;l<m;l++)f=this._buildBevelVert(h,e,(u+l)%s,l/(m-1),v),x.push(w.topN,p.topP,f.topP),!1===a&&x.push(p.bottomP,w.bottomN,f.bottomP),w=f,l>(o+1)*r&&(o++,p=this._buildBevelVert(h,t,(d+o)%i,o/(n-1),v),x.push(b.topN,p.topP,w.topN),!1===a&&x.push(p.bottomP,b.bottomN,w.bottomN),b=p)}d=(d+n)%i,u=(u+m)%s,l=(l+1)%o}while(l!==m)}if(!1===a&&this._depth>2*this._bevel&&this._buildWall(g,h,x),t){let t=[];for(let e=x.length-1;e>=w+2;e-=3){let i=x[e-2],n=x[e-1],r=x[e-0];t.push(r,n,i)}x.splice(w,x.length-w,...t)}if(t){let t=[];for(let e=g[g.length-1].boundary.vertices.length-1;e>=1;e-=2){let i=g[g.length-1].boundary.vertices[e-1],n=g[g.length-1].boundary.vertices[e-0];t.push(i,n)}b.push(t)}if(!t){let t,e=g[g.length-1];try{t=NA({windingRule:g.length>1?cA.POSITIVE:cA.ODD,elementType:dA.POLYGONS,vertexSize:2,strict:!0,contours:[e.insetPoints,...b]})}catch{t=XA}if(!t)throw new Error("Error generating geometry for surface");0===d.length&&this._bevel<o&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let i=0;i<3*t.elementCount;i+=3){let e=this._buildSurfaceVert(t,t.elements[i+0],v),n=this._buildSurfaceVert(t,t.elements[i+1],v),r=this._buildSurfaceVert(t,t.elements[i+2],v);x.push(e.top,n.top,r.top),!1===a&&x.push(r.bottom,n.bottom,e.bottom)}}this.vertexCache={}}this._buffer.shrink();let w=new Ni(Uint32Array.from(x),1),S=new Ni(this._buffer.positions,3),_=new Ni(this._buffer.normals,3),A=new Ni(this._buffer.uvs,2);S.needsUpdate=!0,_.needsUpdate=!0,A.needsUpdate=!0,w.needsUpdate=!0,this.setAttribute("position",S),this.setAttribute("normal",_),this.setAttribute("uv",A),this.setIndex(w)}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let n=t[0];for(let r=0,s=n.boundary.vertexCount;r<s;r++){let t=this._buildBevelVert(e,n,r),a=this._buildBevelVert(e,n,(r+1)%s);i.push(a.topP,t.topN,t.bottomN),i.push(a.topP,t.bottomN,a.bottomP)}}_buildSurfaceVert(t,e,i){let n=e.toString();if(n in this.vertexCache)return this.vertexCache[n];let r=t.vertices[2*e+0],s=t.vertices[2*e+1],a=(r-this._minX)/this._width,o=(s-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),h=3*l,c=2*l,d={top:l+0,bottom:l+1};return this._buffer.positions[h+0]=r,this._buffer.positions[h+1]=s,this._buffer.positions[h+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[c+0]=a,this._buffer.uvs[c+1]=o,!1===this.forPathBevel&&(this._buffer.positions[h+3]=r,this._buffer.positions[h+4]=s,this._buffer.positions[h+5]=i,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[c+2]=a,this._buffer.uvs[c+3]=o),this.vertexCache[n]=d,d}_buildBevelVert(t,e,i,n=1,r){let s=`${e.bevelI}:${i}`;
2if(s in this.vertexCache&&0!==r&&1!==r&&(!r||r===this.vertexCache[s].pathBevelUCoord))return this.vertexCache[s];let a,o,l,h,[c,d]=e.boundary.vertexIndices[i];c!==d?(o=c,a=d,h=!1,l=t.continuous[o]&&t.continuous[a]):(a=c,o=(a-1+t.count)%t.count,h=t.concave[a]&&e.bevelI>0,l=t.continuous[a]||h);let u=Math.cos(e.angle),p=Math.sin(e.angle),f=2*i,m=2*a,g=2*o,v=e.boundary.vertices[f+0],y=e.boundary.vertices[f+1],x=(1-p)*this._bevel,b=(v-this._minX)/this._width,w=(y-this._minY)/this._height;this.forPathBevel&&(void 0!==r&&(b=r),w=1);let S=t.normals[m+0],_=t.normals[m+1],A=t.normals[g+0],M=t.normals[g+1];if(h){S+=(A-S)*(1-n),_+=(M-_)*(1-n);let t=Math.sqrt(S*S+_*_);S/=t,_/=t}let C=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),E=3*C,P=2*C,T={i:i,fi:a,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1,pathBevelUCoord:r};return this._buffer.positions[E+0]=v,this._buffer.positions[E+1]=y,this._buffer.positions[E+2]=(this.forPathBevel?this._bevel:this._depth)-x,this._buffer.normals[E+0]=S*u,this._buffer.normals[E+1]=_*u,this._buffer.normals[E+2]=p,this._buffer.uvs[P+0]=b,this._buffer.uvs[P+1]=w,!1===this.forPathBevel&&(this._buffer.positions[E+3]=v,this._buffer.positions[E+4]=y,this._buffer.positions[E+5]=x,this._buffer.normals[E+3]=S*u,this._buffer.normals[E+4]=_*u,this._buffer.normals[E+5]=-p,this._buffer.uvs[P+2]=w,this._buffer.uvs[P+3]=b),l||(this.forPathBevel?(C+=1,E+=3,P+=2):(C+=2,E+=6,P+=4),T.topP=C+0,T.bottomP=C+1,this._buffer.positions[E+0]=v,this._buffer.positions[E+1]=y,this._buffer.positions[E+2]=(this.forPathBevel?this._bevel:this._depth)-x,this._buffer.normals[E+0]=A*u,this._buffer.normals[E+1]=M*u,this._buffer.normals[E+2]=p,this._buffer.uvs[P+0]=b,this._buffer.uvs[P+1]=w,!1===this.forPathBevel&&(this._buffer.positions[E+3]=v,this._buffer.positions[E+4]=y,this._buffer.positions[E+5]=x,this._buffer.normals[E+3]=A*u,this._buffer.normals[E+4]=M*u,this._buffer.normals[E+5]=-p,this._buffer.uvs[P+2]=w,this._buffer.uvs[P+3]=b)),this.vertexCache[s]=T,T}clone(){let t=new QA(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Gf(this.userData),t}},ZA=class extends Qi{constructor(t,e=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=cA.ODD,this.elementType=dA.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=t,this._curveSegments=e,this._triangulationOptions=Object.assign({windingRule:cA.ODD,elementType:dA.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let n,r,s,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(t=>t.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,h=!0;for(let u=0,p=a.length/2;u<p;u++){let t=2*u,e=a[t+0],i=a[t+1];if(void 0!==r&&e!==r&&(l=!1),void 0!==s&&i!==s&&(h=!1),r=e,s=i,!l&&!h)break}if(!l&&!h)try{n=NA({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{n=HA}let c=n?.vertexCount??1,d=n?.elementCount??1;if(this._positionAttribute=new Ni(new Float32Array(3*c),3),this._normalAttribute=new Ni(new Float32Array(3*c),3),this._uvAttribute=new Ni(new Float32Array(2*c),2),this._indexAttribute=new Ni(new Uint32Array(3*d),1),n){let t=1/0,e=-1/0,i=1/0,r=-1/0;for(let o=0,l=c;o<l;o++){let s=2*o,a=n.vertices[s+0],l=n.vertices[s+1];a<t&&(t=a),a>e&&(e=a),l<i&&(i=l),l>r&&(r=l)}let s=e-t,a=r-i;for(let o=0,l=c;o<l;o++){let e=2*o,r=n.vertices[e+0],l=n.vertices[e+1],h=(r-t)/s,c=(l-i)/a;this._positionAttribute.setXYZ(o,r,l,0),this._normalAttribute.setXYZ(o,0,0,1),this._uvAttribute.setXY(o,h,c)}for(let o=0,l=d;o<l;o++){let t=3*o,e=n.elements[t+0],i=n.elements[t+1],r=n.elements[t+2];this._indexAttribute.setX(t+0,e),this._indexAttribute.setX(t+1,i),this._indexAttribute.setX(t+2,r)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(n?.elementCount??1))}clone(){let t=new ZA(this._shape,this._curveSegments);return t.userData=Gf(this.userData),t}},KA=class extends QA{constructor(t,e,i=0,n=12,r=3,s=cA.ODD){super(t,e,i,n,r,s),this.type="ShapeGeometry"}_computeBufferEstimatedSize(t){return 2*t.vertexCount*(2+this._bevelSegments)}_buildWall(t,e,i){let n=t[0];for(let r=0,s=n.boundary.vertexCount;r<s;r++){let t=this._buildBevelVert(e,n,r),a=this._buildBevelVert(e,n,(r+1)%s);
2i.push(a.topP,t.topN,t.bottomN),i.push(a.topP,t.bottomN,a.bottomP)}}clone(){let t=new KA(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Gf(this.userData),t}},JA=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:cA.ODD},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width),s=Math.abs(i.depth??0),a=t.shape??e?.shape,o=a?.roundness??i.roundness;void 0!==a&&(a instanceof yA?(a.width!==n||a.height!==r)&&a.applySize(n,r):a=new yA(n,r).fromJSON(a),void 0!==t.parameters?.roundness&&t.parameters?.roundness>0&&a.update());let l=a??new yA(n,r);return{parameters:Object.assign(i,{width:n,height:r,depth:s,roundness:o}),shape:l}}static build(t){let e,{depth:i,extrudeBevelSize:n,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:o}=t.parameters;return t.shape.roundness=a,e=i<=0?new ZA(t.shape,s,{windingRule:o}
vendor: 5,266 bytes, line 2
2):new KA(t.shape,i,n,s,r,o),Object.assign(e,{userData:{...t,type:"VectorGeometry"}})}},$A=2*Math.PI,tM=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return i.angle=Wt.clamp(i.angle,0,360),{shape:t.shape&&t.shape instanceof yA?t.shape:new yA,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let e,{width:i,height:n,spikes:r,angle:s,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=t.parameters,c=t.shape,d=function(t,e,i,n,r,s){if(n>=$A)return r>30||r%4==0?(function(t,e,i,n=0,r=0,s=0){let a=.5522847498,o=e*a,l=i*a;t.addPoint(nM(r-e,s,r-e,s-l,r-e,s+l)),t.addPoint(nM(r,s+i,r-o,s+i,r+o,s+i)),t.addPoint(nM(r+e,s,r+e,s+l,r+e,s-l)),t.addPoint(nM(r,s-i,r+o,s-i,r-o,s-i)),n>0&&sM(t,e,i,n)}(t,e,i,s),Math.round(r/4)):eM(t,n,r,e,i,s);n=Math.max(n,.001);let a={x:0,y:i},o=n+.5*Math.PI,l={x:Math.cos(o)*e,y:Math.sin(o)*i},h=_A({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:e,ry:i,largeArcFlag:n>Math.PI,sweepFlag:!0});return r>30||r%h.length===0?function(t,e,i,n,r,s,a,o){let l=Math.round(r/n.length);t.addPoint(iM(e,i));for(let h=0,c=n.length;h<c;h++){let e=n[h],i=t.points[h],r=iM(e.x,e.y);i.controls[1].position.set(e.x1,e.y1),r.controls[0].position.set(e.x2,e.y2),t.addPoint(r)}return o>0?rM(t,s,a,o):t.addPoint(iM(0,0)),l}(t,a.x,a.y,h,r,e,i,s):eM(t,n,r,e,i,s)}(c,.5*i,.5*n,s*Math.PI/180,r,a);return c.isClosed=!0,c.update(),0===s?(e=new Qi,e.setAttribute("position",new Vi([],3))):e=JA.create({shape:c,parameters:{subdivisions:d,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),Object.assign(e,{userData:{...t,type:"EllipseGeometry"}})}};function eM(t,e,i,n,r,s){let a=-e/i;for(let o=0;o<=i;o++){let e=a*o,i=Math.sin(e)*n,s=Math.cos(e)*r;t.addPoint(iM(i,s))}return e<$A?s>0?rM(t,n,r,s):t.addPoint(iM(0,0)):(t.removePoint(t.points[t.points.length-1]),s>0&&sM(t,n,r,s)),1}function iM(t,e){return new U_(Wt.generateUUID(),new Ht(t,e))}function nM(t,e,i,n,r,s){let a=iM(t,e);return a.controls[0].position.set(i,n),a.controls[1].position.set(r,s),a}function rM(t,e,i,n){aM(t,e,i,n).forEach(e=>t.addPoint(e))}function sM(t,e,i,n){let r=aM(t,e,i,n),s=new yA;r.forEach(t=>s.addPoint(t)),s.isClosed=!0,t.shapeHoles.push(s)}function aM(t,e,i,n){let r=n*e/100,s=r*(Math.abs(i)/Math.abs(e)),a=new Ht(r/e,s/i),o=t.points.map(t=>{let e=t.clone();return e.uuid=Wt.generateUUID(),e}).reverse();return o.forEach(t=>{t.position.multiply(a);let e=t.controls[0].position.clone().multiply(a),i=t.controls[1].position.clone().multiply(a);t.controls[0].position.copy(i),t.controls[1].position.copy(e)}),o}var oM=new ki([0,0,0],1),lM=class extends Qi{constructor(t=!0,e=1,i=1,n=1,r=1,s=1,a=1,o=1,l=1,h=1,c=1,d=1){if(super(),0===s)return;let u=t&&1===s;u&&(d=0),c>100&&(c=100),0===c&&(d=0);let p,f,m,g,v,y,x,b,w=()=>new be,S=new be,_=w(),A=w(),M=w(),C=w(),E=w(),P=w(),T=w(),D=w(),I=w(),O=w(),R=w(),L=i-2*o+.001,B=L/s,z=Math.ceil(a*s),F=z+1,N=L/z,U=-L/2,k=h+1,V=2*Math.PI/h,j=Math.PI/2/d,G=Math.min((1-c/100)*o,o-.01),W=o-G,H=0,q=2*d+2,X=k*q/2,Y=X+k*F,Q=Math.max(0,k*(F+q)),[Z,K,J]=[3,3,2].map(t=>Array(Q*t).fill(0)),$=[],tt=r-o;function et(e,i){let n=Math.PI/2;y=i*N,b=2*Math.PI*(y%B)/B+n,y+=U,x=Math.sin(b)*tt,v=Math.cos(b)*tt,t?e.set(v,x,y):e.set(v,y,x)}et(S,-1e-10),et(_,0),C.copy(S),et(S,1);let it=S.distanceTo(_),nt=u?0:W+G,rt=it*z+2*nt,st=G,at=rt-nt;for(let ct=0;ct<=z;ct++){et(A,ct),R.subVectors(A,C).normalize(),C.copy(A),I.copy(A).setComponent(+t+1,0).normalize(),O.crossVectors(R,I).normalize();let e=0===ct,i=ct===z,n=e?3*Math.PI/2:j,r=e?st:at,s=e?k:Y,a=e?0:Q-k,l=R.clone().multiplyScalar(e?-W:W).add(A),c=R.clone().multiplyScalar(e?-1:1).normalize();for(let t=0;t<k;t++){let p=t*V;if(E.addVectors(S.copy(I).multiplyScalar(o*Math.cos(p)),_.copy(O).multiplyScalar(o*Math.sin(p))),P.copy(E).normalize(),e||i){u||(H=a+t,[0,1,2].forEach(t=>{Z[3*H+t]=l.getComponent(t),K[3*H+t]=c.getComponent(t)}),J[2*H]=+i,J[2*H+1]=t/h),_.copy(P).multiplyScalar(G),M.addVectors(A,_);for(let i=0;i<d;i++){let a=i*j+n;T.addVectors(S.copy(R).multiplyScalar(W*Math.sin(a)),_.copy(P).multiplyScalar(W*Math.cos(a))),D.copy(T).normalize(),_.addVectors(M,T),T.normalize(),H=s+i*k+t,[0,1,2].forEach(t=>{Z[3*H+t]=_.getComponent(t),K[3*H+t]=D.getComponent(t)});let o=+e+Math.sin(a);J[2*H]=(r+W*o)/rt,J[2*H+1]=t/h}}_.addVectors(A,E),H=X+ct*k+t,[0,1,2].forEach(t=>{Z[3*H+t]=_.getComponent(t),K[3*H+t]=P.getComponent(t)}),J[2*H]=(nt+ct*it)/rt,J[2*H+1]=t/h}}let ot=F+2*d+2,[lt,ht]=[+u,ot-1];for(let ct=lt;ct<=ht-1;ct++){let t=u&&ct===ht-1;for(let e=0;e<k-1;e++)p=ct*k+e,f=p+1,m=(t?e:p)+k,g=(t?e+1:f)+k,0===ct?$.push(f,g,m):ct===ot-2?$.push(p,f,m):$.push(p,f,m,f,g,m)}this.setIndex($),this.setAttribute("position",new Vi(Z,3)),this.setAttribute("normal",new Vi(K,3)),this.setAttribute("uv",new Vi(J,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,n,r=this.userData.parameters,s=Math.ceil(r.tubularSegments),a=r.radialSegments+1,o=Array.from(this.getIndex().array),l=6*(s-1)*r.radialSegments,h=s,c=h===s;for(let d=0;d<r.radialSegments;d++)t=h*a+d,e=t+1,i=(c?d:t)+a,n=(c?d+1:e)+a,o[l++]=t,o[l++]=e,o[l++]=i,o[l++]=e,o[l++]=n,o[l
2++]=i;return o.length=l,oM.array=o,oM.count=o.length,oM}},hM=class extends L_{constructor(t=1,e=.2,i=4){let n=(1+Math.sqrt(5))/2,r="IcosahedronGeometry";super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,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],r,t,e,i),this.type=r}static fromJSON(t){return new hM(t.radius,t.corner,t.cornerSides)}},cM=new Ze,dM=new wi,uM=new be,pM=class extends Dt{constructor(){super(),this.uuid=Wt.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(t){let e=(new qt).getNormalMatrix(t);for(let i=0,n=this.vertices.length;i<n;i++)this.vertices[i].applyMatrix4(t);for(let i=0,n=this.faces.length;i<n;i++){let t=this.faces[i];t.normal.applyMatrix3(e).normalize();for(let i=0,n=t.vertexNormals.length;i<n;i++)t.vertexNormals[i].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(t){return cM.makeRotationX(t),this.applyMatrix4(cM),this}rotateY(t){return cM.makeRotationY(t),this.applyMatrix4(cM),this}rotateZ(t){return cM.makeRotationZ(t),this.applyMatrix4(cM),this}translate(t,e,i){return cM.makeTranslation(t,e,i),this.applyMatrix4(cM),this}scale(t,e,i){return cM.makeScale(t,e,i),this.applyMatrix4(cM),this}lookAt(t){return dM.lookAt(t),dM.updateMatrix(),this.applyMatrix4(dM.matrix),this}fromBufferGeometry(t){let e=this,i=null!==t.index?t.index:void 0,n=t.attributes;if(void 0===n.position)return this;let r=n.position,s=n.normal,a=n.color,o=n.uv,l=n.uv2;void 0!==l&&(this.faceVertexUvs[1]=[]);for(let d=0;d<r.count;d++)e.vertices.push((new be).fromBufferAttribute(r,d)),void 0!==a&&e.colors.push((new le).fromBufferAttribute(a,d));function h(t,i,n,r){let h=void 0===a?[]:[e.colors[t].clone(),e.colors[i].clone(),e.colors[n].clone()],c=void 0===s?[]:[(new be).fromBufferAttribute(s,t),(new be).fromBufferAttribute(s,i),(new be).fromBufferAttribute(s,n)],d=new mM(t,i,n,c,h,r);e.faces.push(d),void 0!==o&&e.faceVertexUvs[0].push([(new Ht).fromBufferAttribute(o,t),(new Ht).fromBufferAttribute(o,i),(new Ht).fromBufferAttribute(o,n)]),void 0!==l&&e.faceVertexUvs[1].push([(new Ht).fromBufferAttribute(l,t),(new Ht).fromBufferAttribute(l,i),(new Ht).fromBufferAttribute(l,n)])}let c=t.groups;if(c.length>0)for(let d=0;d<c.length;d++){let t=c[d],e=t.start;for(let n=e,r=e+t.count;n<r;n+=3)void 0!==i?h(i.getX(n),i.getX(n+1),i.getX(n+2),t.materialIndex):h(n,n+1,n+2,t.materialIndex)}else if(void 0!==i)for(let d=0;d<i.count;d+=3)h(i.getX(d),i.getX(d+1),i.getX(d+2));else for(let d=0;d<r.count;d+=3)h(d,d+1,d+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(uM).negate(),this.translate(uM.x,uM.y,uM.z),this}normalize(){this.computeBoundingSphere();let t=this.boundingSphere.center,e=this.boundingSphere.radius,i=0===e?1:1/e,n=new Ze;return n.set(i,0,0,-i*t.x,0,i,0,-i*t.y,0,0,i,-i*t.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let t=new be,e=new be;for(let i=0,n=this.faces.length;i<n;i++){let n=this.faces[i],r=this.vertices[n.a],s=this.vertices[n.b],a=this.vertices[n.c];t.subVectors(a,s),e.subVectors(r,s),t.cross(e),t.normalize(),n.normal.copy(t)}}computeVertexNormals(t=!0){let e=new Array(this.vertices.length);for(let i=0,n=this.vertices.length;i<n;i++)e[i]=new be;if(t){let t=new be,i=new be;for(let n=0,r=this.faces.length;n<r;n++){let r=this.faces[n],s=this.vertices[r.a],a=this.vertices[r.b],o=this.vertices[r.c];t.subVectors(o,a),i.subVectors(s,a),t.cross(i),e[r.a].add(t),e[r.b].add(t),e[r.c].add(t)}}else{this.computeFaceNormals();for(let t=0,i=this.faces.length;t<i;t++){let i=this.faces[t];e[i.a].add(i.normal),e[i.b].add(i.normal),e[i.c].add(i.normal)}}for(let i=0,n=this.vertices.length;i<n;i++)e[i].normalize();for(let i=0,n=this.faces.length;i<n;i++){let t=this.faces[i],n=t.vertexNormals;3===n.length?(n[0].copy(e[t.a]),n[1].copy(e[t.b]),n[2].copy(e[t.c])):(n[0]=e[t.a].clone(),n[1]=e[t.b].clone(),n[2]=e[t.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let t=0,e=this.faces.length;t<e;t++){let e=this.faces[t],i=e.vertexNormals;3===i.length?(i[0].copy(e.normal),i[1].copy(e.normal),i[2].copy(e.normal)):(i[0]=e.normal.clone(),i[1]=e.normal.clone(),i[2]=e.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let e=0,i=this.faces.length;e<i;e++){let t=this.faces[e];
2t.__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 t=new pM;t.faces=this.faces;for(let e=0,i=this.morphTargets.length;e<i;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];let t=this.morphNormals[e].faceNormals,i=this.morphNormals[e].vertexNormals;for(let e=0,n=this.faces.length;e<n;e++){let e=new be,n={a:new be,b:new be,c:new be};t.push(e),i.push(n)}}let i=this.morphNormals[e];t.vertices=this.morphTargets[e].vertices,t.computeFaceNormals(),t.computeVertexNormals();for(let t=0,e=this.faces.length;t<e;t++){let e=this.faces[t],n=i.faceNormals[t],r=i.vertexNormals[t];n.copy(e.normal),r.a.copy(e.vertexNormals[0]),r.b.copy(e.vertexNormals[1]),r.c.copy(e.vertexNormals[2])}}for(let e=0,i=this.faces.length;e<i;e++){let t=this.faces[e];
2t.normal=t.__originalFaceNormal,t.vertexNormals=t.__originalVertexNormals}}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new _e),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ve),this.boundingSphere.setFromPoints(this.vertices)}merge(t,e,i=0){if(!t||!t.isGeometry)return;let n,r=this.vertices.length,s=this.vertices,a=t.vertices,o=this.faces,l=t.faces,h=this.colors,c=t.colors;void 0!==e&&(n=(new qt).getNormalMatrix(e));for(let d=0,u=a.length;d<u;d++){let t=a[d].clone();void 0!==e&&t.applyMatrix4(e),s.push(t)}for(let d=0,u=c.length;d<u;d++)h.push(c[d].clone());for(let d=0,u=l.length;d<u;d++){let t,e,s=l[d],a=s.vertexNormals,h=s.vertexColors,c=new mM(s.a+r,s.b+r,s.c+r);c.normal.copy(s.normal),void 0!==n&&c.normal.applyMatrix3(n).normalize();for(let i=0,r=a.length;i<r;i++)t=a[i].clone(),void 0!==n&&t.applyMatrix3(n).normalize(),c.vertexNormals.push(t);c.color.copy(s.color);for(let i=0,n=h.length;i<n;i++)e=h[i],c.vertexColors.push(e.clone());c.materialIndex=s.materialIndex+i,o.push(c)}for(let d=0,u=t.faceVertexUvs.length;d<u;d++){let e=t.faceVertexUvs[d];void 0===this.faceVertexUvs[d]&&(this.faceVertexUvs[d]=[]);for(let t=0,i=e.length;t<i;t++){let i=e[t],n=[];for(let t=0,e=i.length;t<e;t++)n.push(i[t].clone());this.faceVertexUvs[d].push(n)}}}mergeMesh(t){t&&t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix))}mergeVertices(t=4){let e={},i=[],n=[],r=Math.pow(10,t);for(let o=0,l=this.vertices.length;o<l;o++){let t=this.vertices[o],s=Math.round(t.x*r)+"_"+Math.round(t.y*r)+"_"+Math.round(t.z*r);void 0===e[s]?(e[s]=o,i.push(this.vertices[o]),n[o]=i.length-1):n[o]=n[e[s]]}let s=[];for(let o=0,l=this.faces.length;o<l;o++){let t=this.faces[o];t.a=n[t.a],t.b=n[t.b],t.c=n[t.c];let e=[t.a,t.b,t.c];for(let i=0;i<3;i++)if(e[i]===e[(i+1)%3]){s.push(o);break}}for(let o=s.length-1;o>=0;o--){let t=s[o];this.faces.splice(t,1);for(let e=0,i=this.faceVertexUvs.length;e<i;e++)this.faceVertexUvs[e].splice(t,1)}let a=this.vertices.length-i.length;return this.vertices=i,a}setFromPoints(t){this.vertices=[];for(let e=0,i=t.length;e<i;e++){let i=t[e];this.vertices.push(new be(i.x,i.y,i.z||0))}return this}sortFacesByMaterialIndex(){let t=this.faces,e=t.length;for(let a=0;a<e;a++)t[a]._id=a;t.sort(function(t,e){return t.materialIndex-e.materialIndex});let i,n,r=this.faceVertexUvs[0],s=this.faceVertexUvs[1];r&&r.length===e&&(i=[]),s&&s.length===e&&(n=[]);for(let a=0;a<e;a++){let e=t[a]._id;i&&i.push(r[e]),n&&n.push(s[e])}i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)}toJSON(){let t={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){let e=this.parameters;for(let i in e)void 0!==e[i]&&(t[i]=e[i]);return t}let e=[];for(let p=0;p<this.vertices.length;p++){let t=this.vertices[p];e.push(t.x,t.y,t.z)}let i=[],n=[],r={},s=[],a={},o=[],l={};for(let p=0;p<this.faces.length;p++){let t=this.faces[p],e=!0,n=!1,r=void 0!==this.faceVertexUvs[0][p],s=t.normal.length()>0,a=t.vertexNormals.length>0,o=1!==t.color.r||1!==t.color.g||1!==t.color.b,l=t.vertexColors.length>0,f=0;if(f=h(f,0,0),f=h(f,1,e),f=h(f,2,n),f=h(f,3,r),f=h(f,4,s),f=h(f,5,a),f=h(f,6,o),f=h(f,7,l),i.push(f),i.push(t.a,t.b,t.c),i.push(t.materialIndex),r){let t=this.faceVertexUvs[0][p];i.push(u(t[0]),u(t[1]),u(t[2]))}if(s&&i.push(c(t.normal)),a){let e=t.vertexNormals;i.push(c(e[0]),c(e[1]),c(e[2]))}if(o&&i.push(d(t.color)),l){let e=t.vertexColors;i.push(d(e[0]),d(e[1]),d(e[2]))}}function h(t,e,i){return i?t|1<<e:t&~(1<<e)}function c(t){let e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==r[e]||(r[e]=n.length/3,n.push(t.x,t.y,t.z)),r[e]}function d(t){let e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==a[e]||(a[e]=s.length,s.push(t.getHex())),a[e]}function u(t){let e=t.x.toString()+t.y.toString();return void 0!==l[e]||(l[e]=o.length/2,o.push(t.x,t.y)),l[e]}return t.data={},t.data.vertices=e,t.data.normals=n,s.length>0&&(t.data.colors=s),o.length>0&&(t.data.uvs=[o]),t.data.faces=i,t}clone(){return(new pM).copy(this)}copy(t){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=t.name;let e=t.vertices;for(let d=0,u=e.length;d<u;d++)this.vertices.push(e[d].clone());let i=t.colors;for(let d=0,u=i.length;d<u;d++)this.colors.push(i[d].clone());let n=t.faces;for(let d=0,u=n.length;d<u;d++)this.faces.push(n[d].clone());for(let d=0,u=t.faceVertexUvs.length;d<u;d++){let e=t.faceVertexUvs[d];void 0===this.faceVertexUvs[d]&&(this.faceVertexUvs[d]=[]);for(let t=0,i=e.length;t<i;t++){let i=e[t],n=[];for(let t=0,e=i.length;t<e;t++){let e=i[t];n.push(e.clone())}this.faceVertexUvs[d].push(n)}}let r=t.morphTargets;for(let d=0,u=r.length;d<u;d++){let t={};if(t.name=r[d].name,void 0!==r[d].vertices){t.vertices=[];for(let e=0,i=r[d].vertices.length;e<i;e++)t.vertices.push(r[d].vertices[e].clone())}if(void 0!==r[d].normals){t.normals=[];for(let e=0,i=r[d].normals.length;e<i;e++)t.normals.push(r[d].normals[e].clone())}this.morphTargets.push(t)}let s=t.morphNormals;for(let d=0,u=s.length;d<u;d++){let t={};if(void 0!==s[d].vertexNormals){t.vertexNormals=[];for(let e=0,i=s[d].vertexNormals.length;e<i;e++){let i=s[d].vertexNormals[e],n={};n.a=i.a.clone(),n.b=i.b.clone(),n.c=i.c.clone(),t.vertexNormals.push(n)}}if(void 0!==s[d].faceNormals){t.faceNormals=[];for(let e=0,i=s[d].faceNormals.length;e<i;e++)t.faceNormals.push(s[d].faceNormals[e].clone())}this.morphNormals.push(t)}let a=t.skinWeights;for(let d=0,u=a.length;d<u;d++)this.skinWeights.push(a[d].clone());let o=t.skinIndices;for(let d=0,u=o.length;d<u;d++)this.skinIndices.push(o[d].clone());let l=t.lineDistances;for(let d=0,u=l.length;d<u;d++)this.lineDistances.push(l[d]);let h=t.boundingBox;null!==h&&(this.boundingBox=h.clone());let c=t.boundingSphere;return null!==c&&(this.boundingSphere=c.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}toBufferGeometry(){let t=(new fM).fromGeometry(this),e=new Qi,i=new Float32Array(3*t.vertices.length);if(e.setAttribute("position",xM.call(new Ni(i,3),t.vertices)),t.normals.length>0){let i=new Float32Array(3*t.normals.length);e.setAttribute("normal",xM.call(new Ni(i,3),t.normals))}if(t.colors.length>0){let i=new Float32Array(3*t.colors.length);e.setAttribute("color",vM.call(new Ni(i,3),t.colors))}if(t.uvs.length>0){let i=new Float32Array(2*t.uvs.length);e.setAttribute("uv",yM.call(new Ni(i,2),t.uvs))}if(t.uvs2.length>0){let i=new Float32Array(2*t.uvs2.length);e.setAttribute("uv2",yM.call(new Ni(i,2),t.uvs2))}e.groups=t.groups;for(let n in t.morphTargets){let i=[],r=t.morphTargets[n];for(let t=0,e=r.length;t<e;t++){let e=r[t],n=new Vi(3*e.data.length,3);
2n.name=e.name,i.push(xM.call(n,e.data))}e.morphAttributes[n]=i}if(t.skinIndices.length>0){let i=new Vi(4*t.skinIndices.length,4);e.setAttribute("skinIndex",bM.call(i,t.skinIndices))}if(t.skinWeights.length>0){let i=new Vi(4*t.skinWeights.length,4);e.setAttribute("skinWeight",bM.call(i,t.skinWeights))}return null!==t.boundingSphere&&(e.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(e.boundingBox=t.boundingBox.clone()),e}computeTangents(){}computeLineDistances(){}applyMatrix(t){return this.applyMatrix4(t)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(t){let e=new Qi,i=t.geometry;if(t.isPoints||t.isLine){let t=new Vi(3*i.vertices.length,3),n=new Vi(3*i.colors.length,3);if(e.setAttribute("position",xM.call(t,i.vertices)),e.setAttribute("color",vM.call(n,i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let t=new Vi(i.lineDistances.length,1);e.setAttribute("lineDistance",gM.call(t,i.lineDistances))}null!==i.boundingSphere&&(e.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(e.boundingBox=i.boundingBox.clone())}else t.isMesh&&(e=i.toBufferGeometry());return e}};pM.prototype.isGeometry=!0;var fM=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(t){let e,i,n,r=[],s=t.faces;for(i=0;i<s.length;i++){let t=s[i];t.materialIndex!==n&&(n=t.materialIndex,void 0!==e&&(e.count=3*i-e.start,r.push(e)),e={start:3*i,materialIndex:n})}void 0!==e&&(e.count=3*i-e.start,r.push(e)),this.groups=r}fromGeometry(t){let e,i=t.faces,n=t.vertices,r=t.faceVertexUvs,s=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=t.morphTargets,l=o.length;if(l>0){e=[];for(let t=0;t<l;t++)e[t]={name:o[t].name,data:[]};this.morphTargets.position=e}let h,c=t.morphNormals,d=c.length;if(d>0){h=[];for(let t=0;t<d;t++)h[t]={name:c[t].name,data:[]};this.morphTargets.normal=h}let u=t.skinIndices,p=t.skinWeights,f=u.length===n.length,m=p.length===n.length;n.length>0&&i.length;for(let g=0;g<i.length;g++){let t=i[g];this.vertices.push(n[t.a],n[t.b],n[t.c]);let v=t.vertexNormals;if(3===v.length)this.normals.push(v[0],v[1],v[2]);else{let e=t.normal;this.normals.push(e,e,e)}let y=t.vertexColors;if(3===y.length)this.colors.push(y[0],y[1],y[2]);else{let e=t.color;this.colors.push(e,e,e)}if(!0===s){let t=r[0][g];void 0!==t?this.uvs.push(t[0],t[1],t[2]):this.uvs.push(new Ht,new Ht,new Ht)}if(!0===a){let t=r[1][g];void 0!==t?this.uvs2.push(t[0],t[1],t[2]):this.uvs2.push(new Ht,new Ht,new Ht)}for(let i=0;i<l;i++){let n=o[i].vertices;e[i].data.push(n[t.a],n[t.b],n[t.c])}for(let e=0;e<d;e++){let t=c[e].vertexNormals[g];h[e].data.push(t.a,t.b,t.c)}f&&this.skinIndices.push(u[t.a],u[t.b],u[t.c]),m&&this.skinWeights.push(p[t.a],p[t.b],p[t.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}},mM=class{constructor(t,e,i,n,r,s=0){this.a=t,this.b=e,this.c=i,this.normal=n&&n.isVector3?n:new be,this.vertexNormals=Array.isArray(n)?n:[],this.color=r&&r.isColor?r:new le,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=s}clone(){return(new this.constructor).copy(this)}copy(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(let e=0,i=t.vertexNormals.length;e<i;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(let e=0,i=t.vertexColors.length;e<i;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}};function gM(t){return this.array.set(t),this}function vM(t){let e=this.array,i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(r=new le),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this}function yM(t){let e=this.array,i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(r=new Ht),e[i++]=r.x,e[i++]=r.y}return this}function xM(t){let e=this.array,i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(r=new be),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this}function bM(t){let e=this.array,i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(r=new me),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this}var wM=["a","b","c"];function SM(t,e){switch(e){case"c":return t.c;case"b":return t.b;default:return t.a}}function _M(t,e,i){let n=Math.min(t,e)+"_"+Math.max(t,e);return i.get(n)}function AM(t,e,i,n,r,s){let a,o=Math.min(t,e),l=Math.max(t,e),h=o+"_"+l;if(n.has(h))a=n.get(h);else{a={a:i[o],b:i[l],newEdge:null,faces:[]},n.set(h,a)}a.faces.push(r),s[t].edges.push(a),s[e].edges.push(a)}function MM(t,e,i,n,r){t.push(new mM(e,i,n,void 0,void 0,r))}function CM(t,e){return Math.abs(e-t)/2+Math.min(t,e)}function EM(t,e,i,n){t.push([e.clone(),i.clone(),n.clone()])}var PM=class{constructor(t=1){this.subdivisions=t}modify(t){(t=t instanceof Qi?(new pM).fromBufferGeometry(t):t.clone()).mergeVertices();let e=this.subdivisions;for(;e-- >0;)this._smooth(t);return t.computeFaceNormals(),t.computeVertexNormals(),t}_smooth(t){let e,i,n,r,s,a=new be,o=t.vertices,l=t.faces,h=t.faceVertexUvs[0],c=void 0!==h&&h.length>0,d=[],u=new Map;
2!function(t,e,i,n){let r,s,a;for(r=0,s=t.length;r<s;r++)i[r]={edges:[]};for(r=0,s=e.length;r<s;r++)a=e[r],AM(a.a,a.b,t,n,a,i),AM(a.b,a.c,t,n,a,i),AM(a.c,a.a,t,n,a,i)}(o,l,d,u);let p,f,m,g,v,y,x,b=[];for(let G of Array.from(u.keys())){for(f=u.get(G),m=new be,v=3/8,y=1/8,x=f.faces.length,2!=x&&(v=.5,y=0),m.addVectors(f.a,f.b).multiplyScalar(v),a.set(0,0,0),r=0;r<x;r++){for(g=f.faces[r],s=0;s<3&&(p=o[SM(g,wM[s])],p===f.a||p===f.b);s++);p&&a.add(p)}a.multiplyScalar(y),m.add(a),f.newEdge=b.length,b.push(m)}let w,S,_,A,M,C,E,P=[];for(i=0,n=o.length;i<n;i++){for(C=o[i],M=d[i].edges,e=M.length,3==e?w=3/16:e>3&&(w=3/(8*e)),S=1-e*Number(w),_=w,e<=2&&(2==e&&(S=3/4,_=1/8)),E=C.clone().multiplyScalar(S),a.set(0,0,0),r=0;r<e;r++)A=M[r],p=A.a!==C?A.a:A.b,a.add(p);a.multiplyScalar(Number(_)),E.add(a),P.push(E)}let T,D,I,O,R,L,B,z=P.concat(b),F=P.length,N=[],U=[],k=new Ht,V=new Ht,j=new Ht;for(i=0,n=l.length;i<n;i++)g=l[i],T=Number(_M(g.a,g.b,u).newEdge)+F,D=Number(_M(g.b,g.c,u).newEdge)+F,I=Number(_M(g.c,g.a,u).newEdge)+F,MM(N,T,D,I,g.materialIndex),MM(N,g.a,T,I,g.materialIndex),MM(N,g.b,D,T,g.materialIndex),MM(N,g.c,I,D,g.materialIndex),c&&(O=h[i],R=O[0],L=O[1],B=O[2],k.set(CM(R.x,L.x),CM(R.y,L.y)),V.set(CM(L.x,B.x),CM(L.y,B.y)),j.set(CM(R.x,B.x),CM(R.y,B.y)),EM(U,k,V,j),EM(U,R,k,j),EM(U,L,V,k),EM(U,B,j,V));t.vertices=z,t.faces=N,c&&(t.faceVertexUvs[0]=U)}},TM=new be,DM=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters);return{shape:t.shape&&t.shape instanceof yA?t.shape:new yA,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,spikes:n,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}=t.parameters,l=t.shape,h=.5*e,c=.5*i,d=2*Math.PI/n;for(let p=0;p<n;p++){let t=d*p,e=0+Math.sin(t)*h,i=0+Math.cos(t)*c;l.addPoint(l.createPoint(e,i))}l.isClosed=!0;for(let p=0,f=l.points.length;p<f;p++)l.points[p].roundness=r;l.roundness=r,l.update();let u=JA.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(u,{userData:{...t,type:"PolygonGeometry"}})}};function IM(t,e,i){i.x=t.x*e.x,i.y=t.y,i.z=t.x*e.y}function OM(t,e,i,n,r,s){let a=e.clone().sub(t),o=i.clone().sub(t),l=a.angleTo(o);if(a.normalize(),o.normalize(),n===r){let e=a.add(o).normalize();s.copy(t).addScaledVector(e,n/Math.sin(l/2))}else{let e=a.angleTo(o);s.copy(t),s.addScaledVector(a,r/Math.sin(e)),s.addScaledVector(o,n/Math.sin(e))}}function RM(t,e,i){let n=t.clone().sub(e),r=i.clone().sub(e);return n.projectOnVector(r),n.add(e)}var LM=class extends Qi{constructor(t=.5,e=1,i=4,n=1,r=!1,s=0,a=4){super(),i=Math.floor(Math.max(3,i)),n=Math.floor(n),a=Math.floor(a);let o,l=[],h=[],c=[],d=[],u=0,p=e/2,f=Math.PI/i,m=t*Math.cos(Math.PI/i),g=2*Math.PI/i,v=(i-2)*Math.PI/i,y=Math.PI-v,x=new be(0,-p,0),b=new be(0,p,0),w=new Ht(t,-p),S=new Ht(m,-p),_=new Ht(0,b.y).sub(S),A=new Ht(0,b.y).sub(w),M=new Ht(_.y,-_.x).normalize(),C=new Ht(A.y,-A.x).normalize(),E=t*Math.cos(Math.PI/i)*Math.tan((Math.PI-_.angle())/2)-1e-8;s=Math.min(s,E);{let t=new be(M.x,M.y,0),e=new be(Math.cos(g)*t.x,t.y,Math.sin(g)*t.x);o=t.angleTo(e)}let P=s/Math.tan((Math.PI-_.angle())/2),T=s/Math.tan((Math.PI-o)/2),D=new be;if(!r){h.push(x.x,x.y,x.z),c.push(0,-1,0),d.push(0,0);let t=u++,e=[],n=w.clone(),r=P/Math.cos(Math.PI/i);n.x-=r;for(let s=0;s<i;s++){let t=s/i*Math.PI*2+f;IM(n,new Ht(Math.sin(t),Math.cos(t)),D),h.push(D.x,D.y,D.z),c.push(0,-1,0),d.push(0,0),e.push(u++)}for(let i=0;i<e.length;i++)l.push(e[i],t,e[(i+1)%e.length])}{let t=new be,e=new be,n=new be,r=new be,p=new be,m=new be;for(let g=0;g<i;g++){let v=g/i*Math.PI*2+f,y=(g+.5)/i*Math.PI*2+f,S=(g+1)/i*Math.PI*2+f,A=new Ht(Math.sin(v),Math.cos(v)),E=new Ht(Math.sin(y),Math.cos(y)),D=new Ht(Math.sin(S),Math.cos(S));IM(w,A,e),IM(w,D,n),IM(M,E,t),OM(b,e,n,T,T,r),h.push(r.x,r.y,r.z),OM(e,b,n,T,P,p),h.push(p.x,p.y,p.z),OM(n,e,b,P,T,m),h.push(m.x,m.y,m.z),c.push(t.x,t.y,t.z),c.push(t.x,t.y,t.z),c.push(t.x,t.y,t.z),d.push(0,0),d.push(0,0),d.push(0,0);let R=u++,L=u++,B=u++;if(l.push(R,L,B),s>0){{let t=e.clone().add(n).multiplyScalar(.5),i=b.clone().sub(t).normalize(),r=x.clone().sub(t).normalize().add(i).normalize().multiplyScalar(-1);I(t,m.clone().sub(p),r,_.angle())}let f,g;{let t=new be;IM(C,D,t);let e=m.clone().add(r).multiplyScalar(.5);e=RM(e,n,b);let i=m.clone().sub(r);[f,g]=I(e,i,t,o,r.y)}{let t=f,e=t.clone().setY(0).normalize(),i=new be(0,-1,0),n=e.clone().cross(i);O(t,e,i,n)}{let e=_.angle(),n=Math.PI-e,r=b.clone();r.y-=s/Math.sin(e-Math.PI/2);let o=new be,p=[];for(let l=0;l<a;l++){let e=[],f=Math.PI/2-n*l/a,m=Math.cos(f),g=Math.sin(f),v=y;for(let n=0;n<=l;n++){let n=Math.cos(v),a=Math.sin(v);t.x=m*a,t.y=g,t.z=m*n,o.copy(r).addScaledVector(t,s),h.push(o.x,o.y,o.z),c.push(t.x,t.y,t.z),d.push(0,0),e.push(u++),v+=2*Math.PI/l/i}p.push(e)}g.reverse(),p.push(g);let f=p.length-1;for(let t=0;t<f;t++){let e=p[t],i=p[t+1],n=e.length-1;l.push(i[1],e[0],i[0]);for(let t=1;t<=n;t++)l.push(e[t],e[t-1],i[t]),l.push(i[t+1],e[t],i[t])}}}}}function I(t,e,i,n,r){let o=-n/2,p=(Math.PI-n)/2,f=e.clone().normalize().cross(i);t.addScaledVector(i,-s/Math.sin(p));let m=new be,g=new be,v=u,y=[];for(let l=0;l<=a;l++){let p=o+l/a*n;g.set(0,0,0),g.addScaledVector(f,Math.sin(p)),g.addScaledVector(i,Math.cos(p));for(let i=0;i<=1;i++){let n=i/1-.5;if(m.copy(t),m.addScaledVector(e,n),m.addScaledVector(g,s),null!=r){let t=Math.max(0,m.y-r);m.addScaledVector(e,-t/e.y)}h.push(m.x,m.y,m.z),c.push(g.x,g.y,g.z),d.push(0,0),0===i&&y.push(u),u++}}for(let s=0;s<a;s++)for(let t=0;t<1;t++){let e=v+t+2*s,i=e+2,n=i+1,r=e+1;l.push(e,i,r),l.push(i,n,r)}return[t.clone().addScaledVector(e,.5),y]}function O(t,e,i,n){let r=Math.PI/2,o=A.angle()-r,p=[],f=new be,m=new be;for(let l=0;l<=a;l++){let g=[],v=l/a;for(let a=0;a<=l;a++){let p=((l?a/l:0)-.5)*y,x=Math.cos(p),b=Math.sin(p),w=(r+Math.atan(Math.tan(o)*x))*v,S=Math.cos(w),_=Math.sin(w);f.set(0,0,0),f.addScaledVector(e,_*x),f.addScaledVector(i,S),f.addScaledVector(n,_*b),m.copy(t).addScaledVector(f,s),h.push(m.x,m.y,m.z),c.push(f.x,f.y,f.z),d.push(0,0),g.push(u++)}p.push(g)}let g=p.length-1;for(let s=0;s<g;s++){let t=p[s],e=p[s+1],i=t.length-1;l.push(t[0],e[1],e[0]);for(let n=1;n<=i;
vendor: 1,371 bytes, line 2
2n++)l.push(t[n-1],t[n],e[n]),l.push(t[n],e[n+1],e[n])}}this.setIndex(l),this.setAttribute("position",new Vi(h,3)),this.setAttribute("normal",new Vi(c,3)),this.setAttribute("uv",new Vi(d,2))}},BM=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters),n=Object.assign(e?.ui??{enabledIndieCorners:!1},t.ui);return{shape:t.shape&&t.shape instanceof yA?t.shape:new yA,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:n}}static build(t){let e=t.shape,{width:i,height:n,cornerRadius:r,cornerType:s,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}=t.parameters,h={x:.5*i,y:.5*n},c={x:-h.x,y:-h.y},d={x:h.x,y:h.y};function u(t,e,r){return e>i&&r>n?Math.min(t*i/e,t*n/r):e>i?t*i/e:r>n?t*n/r:t}let p=[];p[0]=0===r[0]?0:u(r[0],r[0]+r[3],r[0]+r[1]),p[1]=0===r[1]?0:u(r[1],r[1]+r[2],r[1]+r[0]),p[2]=0===r[2]?0:u(r[2],r[2]+r[1],r[2]+r[3]),p[3]=0===r[3]?0:u(r[3],r[3]+r[0],r[3]+r[2]);let f=c.x,m=d.x,g=d.y,v=c.y;e.addPoint(e.createPoint(f,g)),e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(f,v)),e.isClosed=!0;let y=!0;for(let b=0,w=e.points.length;b<w;b++)e.points[b].roundness=p[b],b>
20&&p[b]!==p[b-1]&&(y=!1);y&&(e.roundness=p[0]),e.useCubicForRoundedCorners=1!==s,e.update();let x=JA.create({shape:e,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(x,{userData:{...t,type:"RectangleGeometry"}})}},zM=class extends Qi{constructor(t=1,e=1,i=1,n=90,r=10,s=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;0==r&&(s=1),s=Math.max(1,Math.floor(s)),r=Math.min(r,100),n=Math.min(180-h,n),n*=Math.PI/180;let c=[],d=Math.PI/2,u=(t=0,e=0,i=0)=>new be(t,e,i),p=u(),f=u(),[m,g,v]=[e/2,t/2,i/2],y=-g,x=+g,[b,w,S]=[u(y,-m,+v),u(y,-m,-v),u(y,+m,-v)],_=(t,e=!1)=>Math.sin(t-Math.PI/(+e+1)),A=(t,e=!1)=>Math.cos(t-Math.PI/(+e+1));S.y=Math.sin(n)*e-m;let M=Math.cos(n)*e-v,C=b.z-h;n<=d?(S.z=Math.min(M,C),S.z==C&&(S.y-=(M-C)/Math.tan(d-n))):w.z=Math.min(w.z-M-v,b.z-h),p.subVectors(b,w),f.subVectors(S,w);let E=Math.min(p.length(),f.length())*r/100,P=E*Math.tan(n/2),T=E/Math.cos(n/2),D=p.clone().normalize().add(f.normalize()).setLength(T).add(w);p.set(0,_(n,!0),A(n,!0)),c.push([S,p.clone()]);let I=(Math.PI-n)/s;for(let j=0;j<=s;j++){let t=d+n+j*I;p.set(0,Math.sin(t)*P,Math.cos(t)*P),p.add(D),f.set(0,_(t),A(t)),c.push([p.clone(),f.clone()])}c.push([b,u(0,1,0)]);let O=Math.sin(I/2)*P*2,R=c.length-1,L=c[0][0].distanceTo(c[1][0]),B=L+O*s+c[R-1][0].distanceTo(c[R][0]);c[0].push(1);for(let j=0;j<=s;j++)c[j+1].push(1-(L+j*O)/B);c[R].push(0);let z,F,N,[U,k,V]=c[0];for(let j=1;j<c.length;j++)[z,F,N]=c[j],a.push(y,U.y,U.z,y,z.y,z.z,x,U.y,U.z,x,U.y,U.z,y,z.y,z.z,x,z.y,z.z),o.push(0,k.y,k.z,0,F.y,F.z,0,k.y,k.z,0,k.y,k.z,0,F.y,F.z,0,F.y,F.z),l.push(0,V,0,N,1,V,1,V,0,N,1,N),[U,k,V]=[z,F,N];this.setAttribute("position",new Vi(a,3)),this.setAttribute("normal",new Vi(o,3)),this.setAttribute("uv",new Vi(l,2))}},FM=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},t.parameters);return{shape:t.shape&&t.shape instanceof yA?t.shape:new yA,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(t){let{width:e,height:i,innerRadiusPercent:n,spikes:r,cornerRadius:s,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=t.parameters,c=t.shape,d=.5*e,u=.5*i,p=a*Math.PI/360/r,f=Math.PI/2*3*-1,m=d*n/100,g=u*n/100;if(3===r&&50===n){p=2*Math.PI/r;for(let t=0;t<r;t++){let e=p*t,i=0+Math.sin(e)*d,n=0+Math.cos(e)*u;c.addPoint(c.createPoint(i,n))}}else for(let y=0;y<r;y++){let t=0+Math.cos(f)*d,e=0+Math.sin(f)*u;c.addPoint(c.createPoint(t,e)),f+=p,t=0+Math.cos(f)*m,e=0+Math.sin(f)*g,c.addPoint(c.createPoint(t,e)),f+=p}c.isClosed=!0;for(let y=0,x=c.points.length;y<x;y++)c.points[y].roundness=s;c.roundness=s,c.update();let v=JA.create({shape:c,parameters:{roundness:s,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(v,{userData:{...t,type:"StarGeometry"}})}};var NM={parseRgba:function(t){return/^(rgba)?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t.toLowerCase())},hsvToRgb:function(t,e,i){let n,r,s,a=Math.floor(6*t),o=6*t-a,l=i*(1-e),h=i*(1-o*e),c=i*(1-(1-o)*e);switch(a%6){case 0:n=i,r=c,s=l;break;case 1:n=h,r=i,s=l;break;case 2:n=l,r=i,s=c;break;case 3:n=l,r=h,s=i;break;case 4:n=c,r=l,s=i;break;default:n=i,r=l,s=h}return{r:255*n,g:255*r,b:255*s}},rgbToHsv:function(t,e,i){t/=255,e/=255,i/=255;let n,r=Math.max(t,e,i),s=Math.min(t,e,i),a=r,o=r-s,l=0==r?0:o/r;if(r==s)n=0;else{switch(r){case t:n=(e-i)/o+(e<i?6:0);break;case e:n=(i-t)/o+2;break;default:n=(t-e)/o+4}n/=6}return{h:n,s:l,v:a}},hexToRgb:function(t){return{r:(t=Math.floor(t))>>16&255,g:t>>8&255,b:255&t}},rgbToHex:function(t,e,i){return(t<<16)+(e<<8)+i},rgbToHexString:function(t,e,i){return"#"+[t=Math.round(t),e=Math.round(e),i=Math.round(i)].map(t=>t.toString(16).padStart(2,"0")).join("").toUpperCase()},hexStringToRgb:function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(t,e,i,n)=>String(e+e+i+i+n+n));let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}},UM=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+UM.version}static addUnaryOp(t){return UM.max_unop_len=Math.max(t.length,UM.max_unop_len),UM.unary_ops[t]=1,UM}static addBinaryOp(t,e,i){return UM.max_binop_len=Math.max(t.length,UM.max_binop_len),UM.binary_ops[t]=e,i?UM.right_associative.add(t):UM.right_associative.delete(t),UM}static addIdentifierChar(t){return UM.additional_identifier_chars.add(t),UM}static addLiteral(t,e){return UM.literals[t]=e,UM}static removeUnaryOp(t){return delete UM.unary_ops[t],t.length===UM.max_unop_len&&(UM.max_unop_len=UM.getMaxKeyLen(UM.unary_ops)),UM}static removeAllUnaryOps(){return UM.unary_ops={},UM.max_unop_len=0,UM}static removeIdentifierChar(t){return UM.additional_identifier_chars.delete(t),UM}static removeBinaryOp(t){return delete UM.binary_ops[t],t.length===UM.max_binop_len&&(UM.max_binop_len=UM.getMaxKeyLen(UM.binary_ops)),UM.right_associative.delete(t),UM}static removeAllBinaryOps(){return UM.binary_ops={},UM.max_binop_len=0,UM}static removeLiteral(t){return delete UM.literals[t],UM}static removeAllLiterals(){return UM.literals={},UM}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new UM(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(t=>t.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return UM.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!UM.binary_ops[String.fromCharCode(t)]||UM.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return UM.isIdentifierStart(t)||UM.isDecimalDigit(t)}throwError(t){let e=new Error(t+" at character "+this.index);throw e.index=this.index,e.description=t,e}runHook(t,e){if(UM.hooks[t]){let i={context:this,node:e};return UM.hooks.run(t,i),i.node}return e}searchHook(t){if(UM.hooks[t]){let e={context:this};return UM.hooks[t].find(function(t){return t.call(e.context,e),e.node}),e.node}}gobbleSpaces(){let t=this.code;for(;t===UM.SPACE_CODE||t===UM.TAB_CODE||t===UM.LF_CODE||t===UM.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),e=1===t.length?t[0]:{type:UM.COMPOUND,body:t};return this.runHook("after-all",e)}
vendor: 4,175 bytes, line 2
2gobbleExpressions(t){let e,i,n=[];for(;this.index<this.expr.length;)if(e=this.code,e===UM.SEMCOL_CODE||e===UM.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())n.push(i);else if(this.index<this.expr.length){if(e===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,UM.max_binop_len),e=t.length;for(;e>0;){if(UM.binary_ops.hasOwnProperty(t)&&(!UM.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!UM.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=e,t;t=t.substr(0,--e)}return!1}gobbleBinaryExpression(){let t,e,i,n,r,s,a,o,l;if(s=this.gobbleToken(),!s||(e=this.gobbleBinaryOp(),!e))return s;for(r={value:e,prec:UM.binaryPrecedence(e),right_a:UM.right_associative.has(e)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+e),n=[s,r,a];e=this.gobbleBinaryOp();){if(i=UM.binaryPrecedence(e),0===i){this.index-=e.length;break}r={value:e,prec:i,right_a:UM.right_associative.has(e)},l=e;let o=t=>r.right_a&&t.right_a?i>t.prec:i<=t.prec;for(;n.length>2&&o(n[n.length-2]);)a=n.pop(),e=n.pop().value,s=n.pop(),t={type:UM.BINARY_EXP,operator:e,left:s,right:a},n.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+l),n.push(r,t)}for(o=n.length-1,t=n[o];o>1;)t={type:UM.BINARY_EXP,operator:n[o-1].value,left:n[o-2],right:t},o-=2;return t}gobbleToken(){let t,e,i,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(t=this.code,UM.isDecimalDigit(t)||t===UM.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===UM.SQUOTE_CODE||t===UM.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(t===UM.OBRACK_CODE)n=this.gobbleArray();else{for(e=this.expr.substr(this.index,UM.max_unop_len),i=e.length;i>0;){if(UM.unary_ops.hasOwnProperty(e)&&(!UM.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!UM.isIdentifierPart(this.expr.charCodeAt(this.index+e.length)))){this.index+=i;let t=this.gobbleToken();return t||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:UM.UNARY_EXP,operator:e,argument:t,prefix:!0})}e=e.substr(0,--i)}UM.isIdentifierStart(t)?(n=this.gobbleIdentifier(),UM.literals.hasOwnProperty(n.name)?n={type:UM.LITERAL,value:UM.literals[n.name],raw:n.name}:n.name===UM.this_str&&(n={type:UM.THIS_EXP})):t===UM.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let e=this.code;for(;e===UM.PERIOD_CODE||e===UM.OBRACK_CODE||e===UM.OPAREN_CODE||e===UM.QUMARK_CODE;){let i;if(e===UM.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==UM.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),e=this.code}this.index++,e===UM.OBRACK_CODE?(t={type:UM.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},this.gobbleSpaces(),e=this.code,e!==UM.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):e===UM.OPAREN_CODE?t={type:UM.CALL_EXP,arguments:this.gobbleArguments(UM.CPAREN_CODE),callee:t}:(e===UM.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:UM.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),i&&(t.optional=!0),this.gobbleSpaces(),e=this.code}return t}gobbleNumericLiteral(){let t,e,i="";for(;UM.isDecimalDigit(this.code);)i+=this.expr.charAt(this.index++);if(this.code===UM.PERIOD_CODE)for(i+=this.expr.charAt(this.index++);UM.isDecimalDigit(this.code);)i+=this.expr.charAt(this.index++);if(t=this.char,"e"===t||"E"===t){for(i+=this.expr.charAt(this.index++),t=this.char,("+"===t||"-"===t)&&(i+=this.expr.charAt(this.index++));UM.isDecimalDigit(this.code);)i+=this.expr.charAt(this.index++);UM.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+i+this.char+")")}return e=this.code,UM.isIdentifierStart(e)?this.throwError("Variable names cannot start with a number ("+i+this.char+")"):(e===UM.PERIOD_CODE||1===i.length&&i.charCo
vendor: 9,133 bytes, line 2
2deAt(0)===UM.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:UM.LITERAL,value:parseFloat(i),raw:i}}gobbleStringLiteral(){let t="",e=this.index,i=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let e=this.expr.charAt(this.index++);if(e===i){n=!0;break}if("\\"===e)switch(e=this.expr.charAt(this.index++),e){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=e}else t+=e}return n||this.throwError('Unclosed quote after "'+t+'"'),{type:UM.LITERAL,value:t,raw:this.expr.substring(e,this.index)}}gobbleIdentifier(){let t=this.code,e=this.index;for(UM.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,UM.isIdentifierPart(t));)this.index++;return{type:UM.IDENTIFIER,name:this.expr.slice(e,this.index)}}gobbleArguments(t){let e=[],i=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===t){i=!0,this.index++,t===UM.CPAREN_CODE&&n&&n>=e.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}if(r===UM.COMMA_CODE){if(this.index++,n++,n!==e.length)if(t===UM.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===UM.CBRACK_CODE)for(let t=e.length;t<n;t++)e.push(null)}else if(e.length!==n&&0!==n)this.throwError("Expected comma");else{let t=this.gobbleExpression();(!t||t.type===UM.COMPOUND)&&this.throwError("Expected comma"),e.push(t)}}return i||this.throwError("Expected "+String.fromCharCode(t)),e}gobbleGroup(){this.index++;let t=this.gobbleExpressions(UM.CPAREN_CODE);if(this.code===UM.CPAREN_CODE)return this.index++,1===t.length?t[0]:!!t.length&&{type:UM.SEQUENCE_EXP,expressions:t};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:UM.ARRAY_EXP,elements:this.gobbleArguments(UM.CBRACK_CODE)}}},kM=new class{add(t,e,i){if("string"!=typeof arguments[0])for(let n in arguments[0])this.add(n,arguments[0][n],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(t){this[t]=this[t]||[],e&&this[t][i?"unshift":"push"](e)},this)}run(t,e){this[t]=this[t]||[],this[t].forEach(function(t){t.call(e&&e.context?e.context:e,e)})}};Object.assign(UM,{hooks:kM,plugins:new class{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(t=>{if("object"!=typeof t||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)})}}(UM),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"}),UM.max_unop_len=UM.getMaxKeyLen(UM.unary_ops),UM.max_binop_len=UM.getMaxKeyLen(UM.binary_ops);var VM=t=>new UM(t).parse();Object.getOwnPropertyNames(UM).forEach(t=>{void 0===VM[t]&&"prototype"!==t&&(VM[t]=UM[t])}),VM.Jsep=UM;var jM={name:"ternary",init(t){t.hooks.add("after-expression",function(e){if(e.node&&this.code===t.QUMARK_CODE){this.index++;let i=e.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===t.COLON_CODE){this.index++;let r=this.gobbleExpression();if(r||this.throwError("Expected expression"),e.node={type:"ConditionalExpression",test:i,consequent:n,alternate:r},i.operator&&t.binary_ops[i.operator]<=.9){let n=i;for(;n.right.operator&&t.binary_ops[n.right.operator]<=.9;)n=n.right;e.node.test=n.right,n.right=e.node,e.node=i}}else this.throwError("Expected :")}})}};function GM(t){return{all:t=t||new Map,on:function(e,i){var n=t.get(e);n?n.push(i):t.set(e,[i])},off:function(e,i){var n=t.get(e);n&&(i?n.splice(n.indexOf(i)>>>0,1):t.set(e,[]))},emit:function(e,i){var n=t.get(e);n&&n.slice().map(function(t){t(i)}),(n=t.get("*"))&&n.slice().map(function(t){t(e,i)})}}}VM.plugins.register(jM);var WM=class{constructor(t,e,i){this.id=t,this.userAPI=e,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise(t=>t()),this.emitter=GM(),this._innerCallUserAPI=async t=>{this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await async function(t,e,i=new AbortController){let n,r,s=t.url,a=t.proxy?.enabled??!1;if("OpenAI"===t.integration?.type){let i=XM(""===t.integration.prompt?[]:JSON.parse(t.integration.prompt),e),n=""===t.integration.behavior?[]:XM(JSON.parse(t.integration.behavior),e);r=`{\n\t\t"model": "${t.integration.model}",\n\t\t"messages": [${t.integration.useBehavior?`\n\t\t{\n\t\t\t"role": "system",\n\t\t\t"content": "${n}"\n\t\t},`:""}\n\t\t{\n\t\t\t"role": "user",\n\t\t\t"content": "${i}"\n\t\t}\n\t\t]\n\t}`}if(a){let i;s=`https://apis.spline.design/file/${t.proxy.fileId}/external-api/request?uuidexternalapi=${t.proxy.proxyId}`,void 0!==r?i=r:"POST"===t.method&&t.body&&(i=XM(JSON.parse(t.body),e)),void 0!==i&&(s+=`&data=${encodeURIComponent(i.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else"OpenAI"===t.integration?.type?n=r:"POST"===t.method&&t.body&&(n=XM(JSON.parse(t.body),e));let o=await fetch(s,{method:a?"GET":t.method,headers:a?void 0:HM(t),signal:i.signal,body:n});if(!o.ok)throw new Error("status:"+o.status+"_:_"+o.statusText);if("OpenAI"===t.integration?.type){let t=await o.json();return a&&(t=t.response),{content:t.choices[0].message.content}}{let t=await o.json();return a&&(t=t.response),t}}(this.userAPI,t),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(e){let t=e.message?.split("_:_")?.[0]?.replace("status:","")??"null";this.error=t,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},"OpenAI"===e?.integration?.type?this.result={content:""}:"GET"===e.method&&""!==e.url&&(this.prefetchPromise=this.prefetch(i)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=gm(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=void 0!==this.userAPI.debounce&&this.userAPI.debounce>0?gm(this._innerCallUserAPI,this.userAPI.debounce,{leading:!0,trailing:!0}):this._innerCallUserAPI}async prefetch(t){await this.callUserAPI(t)}async callUserAPI(t){await this._debouncedCallUserAPI(t)}update(t,e,i=!0){this.userAPI=t,this._updateDebouncedCallUserAPI(),""!==this.userAPI.url&&"GET"===this.userAPI.method&&i&&this._debouncedPrefetch(e)}retrieveValue(t){if(this.result)try{return Qg.zoom(this.result,t)}catch(by){}}retrieveZoomedKeyValues(t){if(this.result){let e=t&&t.length?Qg.zoom(this.result,t):this.result;if(function(t){return"object"==typeof t&&null!==t}(e))return Object.entries(e);if(function(t){return Array.isArray(t)}(e))return e.map((t,e)=>[e.toString(),t]);throw function(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t}(e)?new Error("This path points to a value, use retrieveValue() instead. "+t?.join(".")):new Error("Path error"+t?.join("."))}}dispose(){}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}get autostart(){return this.userAPI.autoStart}};function HM(t){let e=new Headers;return t.headers.forEach(t=>{""!==t.data.key&&e.append(t.data.key,t.data.value)}),e}var qM=(t,e)=>{if("string"==typeof t){let i=e.getVariable(t);if(i)return qM(i,e)}return Tb.isBoolean(t)?Tb.getDisplayedValue(t).toLowerCase():Tb.getDisplayedValue(t)},XM=(t,e)=>t.map((t,i)=>{if("text"in t)return t.text;if("type"in t){if("paragraph"===t.type)return(i>0?"\n":"")+XM(t.children,e);if("variable"===t.type){let i=e.getVariable(t.variableId);if(void 0!==i)return qM(i,e)}}return""}).join(""),YM=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],QM=["0","1","2","3","4","5","6","7","8","9","."],ZM=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function KM(t){return"string"==typeof t&&(!isNaN(t)&&!isNaN(parseFloat(t)))}function JM(t,e,i="number"){let n,r,s="";for(let a=0;a<t.length;a++){let n=t[a];if("objType"in n&&"api"===n.objType){let t=JSON.parse(n.id),i=t[0],r=e.getUserAPI(i);if(void 0!==r&&r instanceof WM){let e=r.retrieveValue(t.slice(1));void 0!==e&&(s+=e)}continue}if("objType"in n&&"webhook"===n.objType){let t=JSON.parse(n.id),[i,r]=t,a=e.getUserWebhook(i);if(void 0!==a){let t=a.getParameterValue(r);void 0!==t&&(s+=t)}continue}if("objType"in n&&"aiAssistant"===n.objType){let t=e.openAIRealtime;if("objId"in n&&void 0!==n.objId){let i;if(e.scene.data.objects.traverse((t,e)=>{let r=e.events?.find(t=>
2t.id===n.objId);r&&(i=r)}),void 0!==i&&"AIAssistantListener"===i.data.type){let e=t?.computeAnalysisForListenerEvent(i.data);if(void 0!==e){s+=e;continue}}}s+=t?.voice??0;continue}if("id"in n){let r=t[a-1];if(a>0&&"id"in r)return;let o=e.getVariable(n.id),l=Tb.getDisplayedValue(o);"number"===i&&Tb.isTextValue(o)&&Array.isArray(o.textValue)&&1===o.textValue.length?l=parseFloat(l).toString():"boolean"===i&&Tb.isBoolean(o)?l=o?"true":"false":"boolean"===i&&Tb.isTextValue(o)&&!Array.isArray(o.textValue)&&(l='"'+l+'"'),s+=l;continue}"string"!==i?"and"!==n.name?"or"!==n.name?"True"!==n.name?"False"!==n.name?"boolean"!==i||KM(n.name)||QM.includes(n.name)||YM.includes(n.name)||ZM.includes(n.name.replace(/\($/g,""))?s+=n.name:s+='"'+n.name+'"':s+="false":s+="true":s+="||":s+="&&":('"'!==n.name&&("+"!==n.name||n.escaped)&&(s+=n.name),"+"===n.name&&!n.escaped&&"\\"===s[s.length-1]&&(s=s.slice(0,-1)+n.name))}if("string"===i)return s;if(0===t.length){if("number"===i)return 0;if("boolean"===i)return!1}try{n=VM(s)}catch(ky){return}try{r=$M(n)}catch(ky){}return r}function $M(t){switch(t.type){case"BinaryExpression":switch(t.operator){case"==":return Number($M(t.left)===$M(t.right));case"!=":return Number($M(t.left)!==$M(t.right));case">":return Number($M(t.left)>$M(t.right));case">=":return Number($M(t.left)>=$M(t.right));case"<":return Number($M(t.left)<$M(t.right));case"<=":return Number($M(t.left)<=$M(t.right));case"+":return $M(t.left)+$M(t.right);case"-":return $M(t.left)-$M(t.right);case"*":return $M(t.left)*$M(t.right);case"/":return $M(t.left)/$M(t.right);case"%":return $M(t.left)%$M(t.right);case"&&":return $M(t.left)&&$M(t.right);case"||":return $M(t.left)||$M(t.right);case"^":return Math.pow($M(t.left),$M(t.right));default:throw new Error("Unknown operator: "+t.operator)}case"UnaryExpression":switch(t.operator){case"-":return-$M(t.argument);case"!":return Number(!$M(t.argument));default:throw new Error("Unknown operator: "+t.operator)}case"Identifier":throw new Error("Unknown identifier: "+t.name);case"Literal":return t.value;case"CallExpression":if("Identifier"===t.callee.type){if("random"===t.callee.name){let e=0,i=1;if(t.arguments.length>=1)try{e=$M(t.arguments[0])}catch(Ag){}if(t.arguments.length>=2)try{i=$M(t.arguments[1])}catch(Ag){}return e=Math.min(i,e),i=Math.max(i,e),e+Math.random()*(i-e)}return Math[t.callee.name].apply(null,t.arguments.map($M))}throw new Error("Unknown node");default:throw new Error("Unknown node type: "+t.type)}}VM.addBinaryOp("^",11,!0);var tC=new Ze,eC=new Ze;var iC=class extends Qi{constructor(t){super(),this.type="PathExtrusionGeometry",this.inputs=t,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&1===this.inputs.parameters.extrusion.depth}_isOpenEnded(){let t=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&1===t.depth&&function(t,e){let i=2*Math.PI;return(t%i+i)%i===(e%i+i)%i}(t.twist,0)&&t.startScale===t.endScale)}build(){let t=this._extractPathPoints();if(t.length<2)return;let e=this._computeBasisMatrices(t),{depth:i,offset:n}=this.inputs.parameters.extrusion;i=Math.max(0,Math.min(i,1)),n=Math.max(0,Math.min(n,1));let r=this.inputs.path.isClosed?t.length:t.length-1,s=Math.floor(n*r),a=this.inputs.path.isClosed?Math.ceil((i+n)*r):Math.ceil(Math.min(1,i+n)*r),o=Math.min(Math.max(2,a-s+1),r+2),l=[],h=[];for(let R=0;R<o;R++){let i=this.inputs.path.isClosed?(R+s)%t.length:Math.min(R+s,t.length-1);l.push(t[i].clone()),h.push(e[i].clone())}let c=(t,e,i)=>{l[t]=l[t].clone().lerp(l[e],i),h[t]=function(t,e,i){let n=[new be,new be,new be],r=[new be,new be,new be];return t.extractBasis(n[0],n[1],n[2]),e.extractBasis(r[0],r[1],r[2]),n.forEach((t,e)=>{let n=r[e],s=Wt.lerp(t.length(),n.length(),i);t.lerp(n,i).setLength(s)}),(new Ze).makeBasis(n[0],n[1],n[2])}(h[t],h[e],i)},d=0,u=n*r%1;(!this.inputs.path.isClosed||i<=1)&&(u||0===n)&&(d=u,c(0,1,d));let p=0,f=(n+i)*r%1;if((this.inputs.path.isClosed&&i<=1||!this.inputs.path.isClosed&&n+i<1)&&f&&(p=f,c(l.length-1,l.length-2,1-p)),0===i){let t=l.length-1;l[t].copy(l[0]),h[t].copy(h[0])}this._applyPathModifiers(h,d,p);let{bevel:m,bevelSides:g}=this.inputs.parameters.extrusion,v=m>0?this.inputs.parameters.extrusion.capType:"flat",y=5;"Custom"===this.inputs.parameters.extrusion.shape.type&&(y="low"===this.inputs.parameters.extrusion.shape.shapeQuality?5:12);let x,{regions:b,infos:w,vertices:S}=this._computeShapePoints(y),_=0;"round"===v&&(x=new QA(this.inputs.shapeData,2*m,m,y,g,void 0,!0),_=x.getAttribute("position").count);let A=0,M=0;
2w.sort((t,e)=>t.start-e.start),w.forEach(t=>{t.verticesStart=A,t.verticesCount=t.continuous.reduce((t,e,i)=>t+(0!==i&&e?1:2),0),M+=t.verticesCount,A=M});let C,E=M*o,P=0;if(this._isOpenEnded()&&"flat"===v){try{C=NA({windingRule:cA.ODD,elementType:dA.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:b})}catch{C=XA}P=C.vertexCount}let T=E+2*P+2*_,D=E+2*P,I={positions:new Float32Array(3*T),normals:new Float32Array(3*T),uvs:new Float32Array(2*T)},O=[];if(w.forEach(t=>{this._extrudeRegion(t,S,h,l,I,O,this._isGeometryClosed()&&!this._isOpenEnded())}),C&&(this._closeEnd(C,E,O,I,h[0],l[0],!1),this._closeEnd(C,E+P,O,I,h[h.length-1],l[l.length-1],!0)),x){I.positions.set(x.getAttribute("position").array,3*D),I.normals.set(x.getAttribute("normal").array,3*D),I.uvs.set(x.getAttribute("uv").array,2*D);for(let n=D;n<D+_;n++)I.uvs[2*n+1]=1e-4;let t=O.length;O.push(...x.getIndex().array.map(t=>t+D)),D+=_,I.positions.set(x.getAttribute("position").array,3*D),I.normals.set(x.getAttribute("normal").array,3*D),I.uvs.set(x.getAttribute("uv").array,2*D);let e=O.length;O.push(...x.getIndex().array.map(t=>t+D)),this.setAttribute("position",new Ni(I.positions,3)),this.setAttribute("normal",new Ni(I.normals,3)),this.setAttribute("uv",new Ni(I.uvs,2)),this.setIndex(O);let i=tC;i.copy(h[h.length-1]).setPosition(l[l.length-1]),this.applyMatrix4OnRange(i,D,T),i.copy(h[0]).setPosition(l[0]).multiply(eC.makeScale(1,1,-1)),this.applyMatrix4OnRange(i,D-_,D),this.reverseIndicesOnRange(t,e)}else this.setAttribute("position",new Ni(I.positions,3)),this.setAttribute("normal",new Ni(I.normals,3)),this.setAttribute("uv",new Ni(I.uvs,2)),this.setIndex(O)}_extractPathPoints(){let t=w_(this.inputs.path).getPoints(this.inputs.path.subdivisions);if(t.length<2)return[];let e=[t[0]];return t.forEach(t=>{e[e.length-1].distanceToSquared(t)>.001&&e.push(t)}),this.inputs.path.isClosed&&e[e.length-1].distanceTo(e[0])<.001&&e.pop(),e}_computeBasisMatrices(t){let e=[],i=t.length,n=this.inputs.path.isClosed,r=new be,s=new be,a=new be,o=new be,l=new be(0,1,0);for(let f=0;f<i;f++){let h,c,d=t[f];h=0===f?n?t[t.length-2]:d.clone().multiplyScalar(2).sub(t[1]):t[f-1],c=f===i-1?n?t[1]:d.clone().multiplyScalar(2).sub(t[f-1]):t[f+1];let u=d.clone().sub(h).normalize(),p=c.clone().sub(d).normalize(),m=u.clone().add(p).normalize();a.copy(m),0===f&&(m.equals(l)||m.clone().negate().equals(l))&&l.set(0,0,1);let g=l.clone().cross(m).normalize(),v=m.clone().cross(g).normalize();l.copy(v),o.copy(g),0===f&&(r.copy(v),s.copy(m));let y=(new Ze).makeBasis(g,v,m);e.push(y)}let h=n?s:a,c=n?r:new be(0,1,0),d=h.clone().cross(o).normalize(),u=Math.acos(c.dot(d));if(isNaN(u))return e;let p=c.clone().cross(d);h.dot(p)>0&&(u*=-1);for(let f=1;f<e.length;f++){let t=(new Ze).makeRotationZ(u*f/e.length);e[f].multiply(t)}return e}_applyPathModifiers(t,e,i){let n=t.length,{angle:r,twist:s,startScale:a,endScale:o}=this.inputs.parameters.extrusion,l=new Ze,h=new Ze;return t.forEach((t,c)=>{let d=0===c?0:c===n-1?1:(c-e)/(n-(0===i?0:1)-(e+(1-i)));l.makeRotationZ(Wt.lerp(r,r+s,d)*Wt.DEG2RAD);let u=Wt.lerp(a,o,d);h.makeScale(u,u,u),t.multiply(l).multiply(h)}),t}_computeShapePoints(t=12,e=cA.ODD){let i,n,r=this.inputs.shapeData,s=r.extractShapePointsToFlatArray([],t),a=r.shapeHoles.map(e=>{let i=e.extractShapePointsToFlatArray([],t),n=[];for(let t=i.length-1;t>=1;t-=2){let e=i[t-1],r=i[t-0];n.push(e,r)}return n});try{i=NA({windingRule:e,elementType:dA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]})}catch{i=HA}try{n=NA({windingRule:cA.ODD,elementType:dA.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]})}catch{n=qA}if(!i)throw new Error("error generating geometry");let o=i.elementCount;if(n){i.elementCount+=n.elementCount;for(let t=0;t<n.elements.length;t++){let e=n.elements[t],r=t%2==0?i.vertexCount:0;i.elements.push(e+r)}for(let t=0;t<n.vertexIndices.length;t++){let e=n.vertexIndices[t],r=i.vertexCount;i.vertexIndices.push(e+r)}for(let t=0;t<n.vertices.length;t++){let e=n.vertices[t];i.vertices.push(e)}}for(let h=0,c=i.vertexCount;h<c;h++){let t=2*h;i.vertices[t+0],i.vertices[t+1]}let l=[];for(let h=i.elementCount-1;h>=0;h--){let t=h>=o,e=2*h,n=i.elements[e+0],s=i.elements[e+1],a=n+s,c={start:n,count:s,normals:[],isHole:t,continuous:[],verticesStart:0,verticesCount:0};l.push(c);let d=n,u=a-1,p=n+1,f=r.roundedCurves.length;do{let e=d-n;i.vertices[2*u+0],i.vertices[2*u+1];let o=i.vertices[2*d+0],l=i.vertices[2*d+1],h=o-i.vertices[2*p+0],m=l-i.vertices[2*p+1],g=Math.sqrt(h*h+m*m);h/=g,m/=g,c.normals[2*e+0]=-m,c.normals[2*e+1]=h;let v=i.vertexIndices[d];if(Array.isArray(v))c.continuous[e]=!1;else{let[t,i]=r.getCurveIndexFromVertexId(v-1,!0);if(i>0&&i<1)c.continuous[e]=!0;else{let n=1===i?t+1:t-1;n=(n+f)%f;let s=1===i?0:1,a=r.roundedCurves[t].getTangent(i),o=r.roundedCurves[n].getTangent(s);c.continuous[e]=a.dot(o)>.95}}t&&(c.normals[2*e+0]*=-1,c.normals[2*e+1]*=-1),[u,d,p]=[d,p,p+1],p>=a&&(p-=s)}while(p!==n+1)}return{regions:[s,...a],infos:l,vertices:i.vertices}}_insertVertex(t,e,i,n,r){let s=2*e,a=3*e;t.positions[a+0]=i.x,t.positions[a+1]=i.y,t.positions[a+2]=i.z,t.normals[a+0]=n.x,t.normals[a+1]=n.y,t.normals[a+2]=n.z,t.uvs[s+0]=r.x,t.uvs[s+1]=r.y}
2_extrudeRegion(t,e,i,n,r,s,a){let o=new be,l=new be,h=new be,c=new be,d=new Ht;i.forEach((s,a)=>{let u=n[a],p=t.verticesStart*i.length+t.verticesCount*a;for(let n=0;n<t.count;n++){let f=2*(t.start+n);if(o.set(e[f+0],e[f+1],0),h.copy(o).applyMatrix4(s).add(u),t.continuous[n])c.set(t.normals[2*n+0],t.normals[2*n+1],0);else{let i=0===n?2*(t.start+t.count-1):f-2;l.set(e[i+0],e[i+1],0),c.copy(o).sub(l),c.set(-c.y,c.x,0),t.isHole||c.negate()}if(c.applyMatrix4(s).normalize(),d.set(0===n?1:n/t.count,a/(i.length-1)),this._insertVertex(r,p,h,c,d),p++,!t.continuous[n]||0===n){if(0===n)c.set(t.normals[2*n+0],t.normals[2*n+1],0),d.set(0,a/(i.length-1));else{let i=n===t.count-1?2*t.start:f+2;l.set(e[i+0],e[i+1],0),c.copy(l).sub(o),c.set(-c.y,c.x,0),t.isHole||c.negate()}c.applyMatrix4(s).normalize(),this._insertVertex(r,p,h,c,d),p++}}});let u=i.length-1;for(let p=0;p<u;p++){let e=t.verticesStart*i.length+t.verticesCount*p,n=t.verticesStart*i.length+t.verticesCount*(p+1),r=0;for(let i=0;i<t.count;i++){(!t.continuous[i]||0===i)&&r++;let a=i===t.count-1?0:r+1,o=e+r,l=e+a,h=n+a,c=n+r;t.isHole?s.push(o,h,l,o,c,h):s.push(o,l,h,o,h,c),r++}}}_closeEnd(t,e,i,n,r,s,a){let o=t.vertexCount,l=new be(0,0,a?-1:1).applyMatrix4(r),h=new be,c=new Ht;for(let u=0;u<o;u++){let i=2*u;h.set(t.vertices[i+0],t.vertices[i+1],0).applyMatrix4(r).add(s),this._insertVertex(n,e+u,h,l,c)}let d=t.elements;for(let u=0;u<t.elementCount;u++){let t=3*u,n=d[t+0]+e,r=d[t+(a?1:2)]+e,s=d[t+(a?2:1)]+e;i.push(n,r,s)}}applyMatrix4OnRange(t,e,i){let n,r,s,a,o=t.elements,l=(new qt).getNormalMatrix(t).elements,h=this.attributes.position,c=this.attributes.normal;if(!h||!c)return;let d=h.array,u=c.array,p=h.itemSize;for(let f=e*p,m=i*p;f<m;f+=p)n=d[f+0],r=d[f+1],s=d[f+2],a=1/(o[3]*n+o[7]*r+o[11]*s+o[15]),d[f+0]=(o[0]*n+o[4]*r+o[8]*s+o[12])*a,d[f+1]=(o[1]*n+o[5]*r+o[9]*s+o[13])*a,d[f+2]=(o[2]*n+o[6]*r+o[10]*s+o[14])*a,n=u[f+0],r=u[f+1],s=u[f+2],u[f+0]=l[0]*n+l[3]*r+l[6]*s,u[f+1]=l[1]*n+l[4]*r+l[7]*s,u[f+2]=l[2]*n+l[5]*r+l[8]*s;h.needsUpdate=!0,c.needsUpdate=!0}reverseIndicesOnRange(t,e){let i=this.index;if(i){for(let n=t;n<e;n+=3){let t=i.getX(n),e=i.getX(n+1),r=i.getX(n+2);i.setXYZ(n,r,e,t)}i.needsUpdate=!0}}};function nC(){let t=new Qi;return t.setAttribute("position",new Ni(new Float32Array([]),3)),t.setIndex(new Ni(new Uint16Array([]),1)),t}var rC=nC().attributes,sC=class extends Qi{constructor(t,e){super(),this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,rC),this.userData={parameters:t,type:"TextGeometry"};let i=e.getFont(t.font);i?.isLoaded?(this.font=i,this.update(t,e)):this.updateFont(t.font,e).then(()=>{this.update(t,e),e?.requestRender()})}async updateFont(t,e){let i=e.getFont(t);i&&(this.font=i,await i.loadingPromise)}update(t,e){let i=this.font;if(this.userData={parameters:t,type:"TextGeometry"},!i?.isLoaded)return;let{width:n,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:h}=t,c=Tb.getDisplayedValue(l),d=function(t,e,i,n){let r="string"==typeof t.width?Number(n.getVariable(t.width)):t.width,s=[""],a="";for(let o of i)a+=o," "===o||"\n"===o?(s[s.length-1]+=a,a="","\n"===o&&s.push("")):e.getTextWidth(s[s.length-1]+a,t)>r&&(s[s.length-1].length&&s.push(""),e.getTextWidth(s[s.length-1]+a,t)>r&&(1===a.length?(s[s.length-1]+=a,a=""):(s[s.length-1]+=a.slice(0,-1),a=a[a.length-1],s.push(""))));return s[s.length-1]+=a,s}(t,i,2===h?c.toUpperCase():3===h?c.toLowerCase():c,e),{shapes:u,charWidths:p,charCoords:f}=i.generateShapes(d,t,e),m=.5*("number"==typeof n?n:Number(e.getVariable(n))),g=.5*("number"==typeof r?r:Number(e.getVariable(r))),v=u.map(t=>(new yA).fromShape(t,!0));this.vectorShapes=v;let y=v.map(t=>JA.create({shape:t,parameters:{depth:s,extrudeBevelSegments:o,extrudeBevelSize:a,windingRule:s<=0?cA.NONZERO:cA.ODD,subdivisions:this.isLowResolution&&s>0?1:12}})),x=y.length?Mw(y):nC();x.translate(-m,g,0),this.dispose(),this.wrappedText=d,this.charCoords=f,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([t,e])=>{this.setAttribute(t,e)}),this.setIndex(x.index),this.computeBoundingSphere()}clone(){let t=zm(new Qi,sC.prototype);return t.copy(this),t}
2copy(t){return Object.entries(t.attributes).forEach(([t,e])=>{this.setAttribute(t,e)}),this.setIndex(t.index),this.userData={parameters:{...t.userData.parameters},type:"TextGeometry"},this}async setText(t,e){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:t}},e)}get text(){return this.userData.parameters.text??""}};var aC,oC,lC=new Promise(t=>{aC=t}),hC=!1;function cC(t){if(!hC)return oC||(oC=async function(){let i=t??"https://unpkg.com/@splinetool/[email protected]/build",n=e(()=>import("./process-BIjiAElH.js"),[]),[r,s]=await Promise.all([n,fetch(`${i}/process.wasm`).then(t=>t.arrayBuffer())]),a=r.default,o=await a({wasmBinary:s});aC(o),hC=!0}(),oC)}var dC=["font"];function uC(t,e,i,n){let r,s,a;"PathGeometry"===t.type?(s=JSON.parse(JSON.stringify(t)),a=[[],["extrusion"]]):(s={...t},a=[[]]);for(let h of a){let t=s;for(let e of h)t=t[e];for(r in t){let i=t[r];vx(i)&&!dC.includes(r)&&(t[r]=e.getVariable(i,[n.uuid,"geometry",...h,r]),vx(t[r])&&(t[r]=1))}}let o,l={parameters:s,type:s.type};if("PathGeometry"===s.type)l.path=s.path;else if("VectorGeometry"===s.type){let t=yA.createFromState(s.shape,s.width,s.height);l.shape=t}else if("NonParametricGeometry"===s.type){if(s.data.groups&&s.data.groups?.forEach(t=>t.materialIndex=Math.max(t.materialIndex??0,0)),l.geometry=(new Bl).parse(s),0===l.geometry.groups.length){let t=l.geometry;t.addGroup(0,Math.max(t.getIndex()?.count??0,t.getAttribute("position").count),0)}}else{if("SubdivGeometry"===s.type){let e=new wC(s,i);return e.data=t,e}if("TextGeometry"===s.type)return new sC(s,e);if("InputGeometry"===s.type)return new sC(s,e);if("UIGeometry"===s.type)return BM.create({parameters:{width:s.width,height:s.height,cornerRadius:s.cornerRadius,cornerType:s.cornerType}})}try{o=HC(l)}catch(nx){}if(!o){let t=yA.createFromState(Fx.defaultData(),100,100);l.shape=t,o=HC(l)}return o}var pC=new Ze;function fC(t,e,i,n){let r,s,a,o=t.position.array,l=t.normal.array,h=pC.makeScale(e,i,n).invert().elements;for(var c=0,d=o.length;c<d;c+=3)o[c]*=e,o[c+1]*=i,o[c+2]*=n,r=l[c],s=l[c+1],a=l[c+2],l[c]=h[0]*r+h[4]*s+h[8]*a,l[c+1]=h[1]*r+h[5]*s+h[9]*a,l[c+2]=h[2]*r+h[6]*s+h[10]*a;t.position.needsUpdate=!0,t.normal.needsUpdate=!0}var mC,gC=new _e,vC=new be;lC.then(t=>{mC=t});var yC=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),xC=new Uint32Array([0,1,2,3]),bC=new Uint8Array([4]),wC=class extends Qi{constructor(t,e){super(),this.data=t,this.flatShading=e,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(t,e){this.freeSubdivPointer();let i=this.data.scaleBaked,n=Yy.div(e,i);this.subdividedGeometry&&fC(this.subdividedGeometry.attributes,...n),this.originalGeometry&&fC(this.originalGeometry.attributes,...n),this.data=t;let r=this.userData.parameters;this.userData.parameters={width:r.width*n[0],height:r.height*n[1],depth:r.depth*n[2]},this.originalGeometry.boundingSphere.center.multiply(vC.fromArray(n));let s=vC.set(r.width,r.height,r.depth).length();this.originalGeometry.boundingSphere.radius=s/2}ensureSubdivPointer(){return 0===this.subdivPointer&&this.rebuild(),this.subdivPointer}rebuild(){let t,e,i;try{({originalGeometry:t,subdividedGeometry:e,subdivPointer:i}=wC.build(this.data,void 0,!this.flatShading,void 0))}catch{t=new un(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=t,this.subdividedGeometry=e??void 0;let n=this.subdividedGeometry??this.originalGeometry;Object.assign(this,n),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(wC.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let t=this.originalGeometry;null===t.boundingSphere&&(t.boundingSphere=new Ve,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;gC.setFromBufferAttribute(e),gC.getCenter(i),t.boundingSphere.radius=i.distanceTo(gC.max),isNaN(t.boundingSphere.radius),gC.getSize(vC);let n={width:vC.x,height:vC.y,depth:vC.z};return this.userData.parameters=n,n}static build(t,e,i,n){let r,s,a,o=t?.phongAngle??35;!1===i&&(o=-1),e&&(mC.free_bvh(e),mC.free_subdivision_surface(e));try{r=wC.allocate(t,n)}catch(l){r=wC.allocate({positionWASM:yC,indexWASM:xC,verticesPerFaceWASM:bC},n)}if(mC.set_destination_refinement_level(r,0),s=wC.buildLevel(r,!0,o),t.subdivisions>0)try{mC.set_destination_refinement_level(r,t.subdivisions),a=wC.buildLevel(r,!1,o)}catch{try{mC.set_destination_refinement_level(r,t.subdivisions-1),a=wC.buildLevel(r,!1,o)}catch{a=null}}else a=null;return{subdivPointer:r,originalGeometry:s,subdividedGeometry:a}}static primitiveToQuads(t,e,i){t.widthSegments>16&&(t.widthSegments=16),t.heightSegments>16&&(t.heightSegments=16),t.depthSegments>16&&(t.depthSegments=16),t.radialSegments>16&&(t.radialSegments=16),"DodecahedronGeometry"===t.type&&(t.detail=0);let n,r,s,a,o,l,h=void 0!==t.shape||void 0!==t.path?e.geometry:uC(t,i,!1);if(n="TorusGeometry"===t.type&&t.arc===2*Math.PI?h.getClosedTorusIndicesForBooleanOrSubdiv():h.getIndex(),({positions:r,triIndices:o}=_C(h.getAttribute("position"),n)),"CylinderGeometry"===t.type&&0===t.cornerRadius&&0===t.hollow&&!1===t.openEnded){let e=t.radialSegments*t.heightSegments*3*2;l=[e,e+3*t.radialSegments]}return({indices:s,verticesPerFace:a}=PC(r,o,h,l)),{positions:r,indices:s,verticesPerFace:a}}static allocate(t,e){let i,n,r,s=[],a=[];t.positionWASM&&t.positionWASM.length>0?(i=t.positionWASM,n=t.indexWASM,r=t.verticesPerFaceWASM):(i=yC,n=xC,r=bC);let o,l=i.length,h=n.length,c=r.length,d=i.length+s.length+a.length,u=n.length+r.length,p=d*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,m=mC._malloc(p),g=new Float32Array(mC.HEAPF32.buffer,m,d),v=new Uint32Array(mC.HEAPU32.buffer,m+f,u);g.set(i,0),g.set(s,i.length),g.set(a,i.length+s.length),v.set(n,0),v.set(r,n.length),t?.scaleBaked?.s
2ome(t=>1!==t)&&(o=(new Ze).makeScale(...t.scaleBaked)),e&&(o?o.premultiply(e):o=e);let y=o?mC.alloc_subdivision_surface2(m,l,m+f,h,m+f+n.length*Uint32Array.BYTES_PER_ELEMENT,c,o.elements):mC.alloc_subdivision_surface(m,l,m+f,h,m+f+n.length*Uint32Array.BYTES_PER_ELEMENT,c);return mC._free(m),y}static buildLevel(t,e,i,n,r){let s=r?mC.get_mesh_data2(t,e?mC.Level.CONTROL:mC.Level.REFINED,i,r.elements):mC.get_mesh_data(t,e?mC.Level.CONTROL:mC.Level.REFINED,i),a=mC.HEAPU32.subarray(s>>2,8+(s>>2)),o=a.subarray(4,8),l=0,h=mC.HEAPU32[a[l]>>2],c=mC.HEAPF32.subarray(h>>2,(h>>2)+o[l]);l++;let d=mC.HEAPU32[a[l]>>2],u=mC.HEAPF32.subarray(d>>2,(d>>2)+o[l]);l++;let p=mC.HEAPU32[a[l]>>2],f=mC.HEAPU32.subarray(p>>2,(p>>2)+o[l]);l++;let m=mC.HEAPU32[a[l]>>2],g=mC.HEAPU32.subarray(m>>2,(m>>2)+o[l]);if(l++,void 0===n){let t=new Qi;if(t.setIndex(new ki(g,1)),t.setAttribute("position",new Vi(c,3)),t.setAttribute("normal",new Vi(u,3)),e){t.setAttribute("faceMap",new ki(f,1));let e=new Float32Array(u.length/3*4).fill(0);t.setAttribute("color",new
2Ni(e,4))}return mC.free_mesh_data(s),t.userData.type="SubdivGeometry",t}n.getAttribute("position").copyArray(c),n.getAttribute("normal").copyArray(u),n.attributes.position.needsUpdate=!0,n.attributes.normal.needsUpdate=!0,mC.free_mesh_data(s)}static freeSubdivPointer(t){mC.free_bvh(t),mC.free_subdivision_surface(t)}static buildControlCageWireframe(t,e,i){let n=mC.get_wireframe_data_for_base_level(t),r=mC.HEAPU32.subarray(n>>2,4+(n>>2)),s=r.subarray(2,4),a=0,o=mC.HEAPU32[r[a]>>2],l=mC.HEAPF32.subarray(o>>2,(o>>2)+s[a]);a++;let h=mC.HEAPU32[r[a]>>2],c=mC.HEAPU32.subarray(h>>2,(h>>2)+s[a]);if(void 0===e){let t=new Qi;t.setAttribute("position",new Vi(l,3));let e=new Float32Array(l.length);for(let n=0,r=l.length;n<r;)e[n++]=i.r,e[n++]=i.g,e[n++]=i.b;return t.setAttribute("color",new Ni(e,3)),t.setIndex(new ki(c,1)),mC.free_wireframe_data_for_base_level(n),t}e.getAttribute("position").copyArray(l),e.attributes.position.needsUpdate=!0,mC.free_wireframe_data_for_base_level(n)}static updateCollabMesh(t,e,i){let n=0===e;n||mC.set_destination_refinement_level(t,e);let r=i?mC.get_topological_data2(t,n?mC.Level.CONTROL:mC.Level.REFINED,i.elements):mC.get_topological_data(t,n?mC.Level.CONTROL:mC.Level.REFINED),s=mC.HEAPU32.subarray(r>>2,6+(r>>2)),a=s.subarray(3,6),o=0,l=mC.HEAPU32[s[o]>>2],h=new Float32Array(mC.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let c=mC.HEAPU32[s[o]>>2],d=new Uint32Array(mC.HEAPU32.subarray(c>>2,(c>>2)+a[o]));o++;let u=mC.HEAPU32[s[o]>>2],p=new Uint8Array(mC.HEAPU32.subarray(u>>2,(u>>2)+a[o]));return mC.free_topological_data(r),{positions:h,indices:d,verticesPerFace:p}}},SC=["getX","getY","getZ"];function _C(t,e){let i={},n=e?e.count:t.count,r=0,s=[],a=[];for(let l=0;l<n;l++){let n=e?e.getX(l):l,o="";for(let e=0;e<3;e++)o+=~~(1e4*t[SC[e]](n))+",";if(o in i)s.push(i[o]);else{for(let e=0;e<3;e++)a.push(t[SC[e]](n));i[o]=r,s.push(r),r++}}let o=[];for(let l=0;l<s.length;l+=3)s[l]===s[l+1]||s[l]===s[l+2]||s[l+1]===s[l+2]||o.push(s[l],s[l+1],s[l+2]);return{positions:a,triIndices:o}}var AC=new be,MC=new be,CC=new be,EC=new be;function PC(t,e,i,n){let r=[],s=[];if(void 0!==i.userData.shape&&0===i.userData.parameters.depth&&0===i.userData.shape.shapeHoles.length){let e=i.userData.shape.extractShapePointsToFlatArray([]),n=i.userData.parameters.spikes;if("EllipseGeometry"===i.userData.type&&n<=24&&n%4==0&&i.userData.parameters.angle>=360){let t=e.length/2/n;e=e.filter((e,i)=>Math.floor(i/2)%t===0)}let a=0;for(let t=0;t<e.length;t+=2)a+=(e[t]-e[(0===t?e.length:t)-2])*(e[t+1]+e[(0===t?e.length:t)-1]);t.length=0;let o=0;if(a<0)for(let i=0;i<e.length;i+=2)t.push(e[i],e[i+1],0),r.push(o++);else for(let i=e.length-2;i>=0;i-=2)t.push(e[i],e[i+1],0),r.push(o++);return s.push(o),{indices:r,verticesPerFace:s}}let a=new Float32Array([i.userData.parameters.depth])[0],o=0;for(;o<e.length;){if(i.useNgonForTopBottomFaceDuringBake){let i=0;if((t[3*e[o]+2]===a||0===t[3*e[o]+2])&&i++,(t[3*e[o+1]+2]===a||0===t[3*e[o+1]+2])&&i++,(t[3*e[o+2]+2]===a||0===t[3*e[o+2]+2])&&i++,3===i)break}if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){AC.set(t[3*e[o]],t[3*e[o]+1],t[3*e[o]+2]),MC.set(t[3*e[o+1]],t[3*e[o+1]+1],t[3*e[o+1]+2]),CC.set(t[3*e[o+4]],t[3*e[o+4]+1],t[3*e[o+4]+2]),EC.set(t[3*e[o+5]],t[3*e[o+5]+1],t[3*e[o+5]+2]),MC.sub(AC).normalize(),CC.sub(AC).normalize(),EC.sub(AC).normalize();let i=MC.cross(CC).dot(EC);Math.abs(i)>.005||n&&n.some((t,e)=>e%2!=1&&(o>=n[e]&&o<n[e+1]))?(r.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3):(r.push(e[o],e[o+1],e[o+4],e[o+5]),s.push(4),o+=6)}else r.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3}if(i.useNgonForTopBottomFaceDuringBake){let e=[],n=[],o=0;for(let i=0,r=0;i<t.length;i+=3,r++)0===t[i+2]&&(e.push(r),o++),t[i+2]===a&&n.push(r);if(0===i.userData.parameters.extrudeBevelSize){let t=n[0];n[0]=n[1],n[1]=t}e.reverse(),r.push(...e,...n),s.push(o,o)}return{indices:r,verticesPerFace:s}}var TC={};((t,e)=>{for(var i in e)n(t,i,{get:e[i],enumerable:!0})})(TC,{calcBoolean:()=>UC,calcBooleanTopological:()=>NC,freeMeshSet:()=>GC,getMeshSet:()=>kC,hasOpenEdges:()=>VC,transformMeshSet:()=>jC});var DC,IC,OC,RC,LC=new Promise(t=>{DC=t});function BC(t){if(IC)return IC;return IC=async function(){let i=t??"https://unpkg.com/@splinetool/[email protected]/build",n=e(()=>import("./boolean-CkdMazNe.js"),[]),[r,s]=await Promise.all([n,fetch(`${i}/boolean.wasm`).then(t=>t.arrayBuffer())]),a=r.default,o=await a({wasmBinary:s}
2);DC(o)}(),IC}function zC(t){let e=t.length,i=e*Uint32Array.BYTES_PER_ELEMENT,n=e*Float32Array.BYTES_PER_ELEMENT,r=Number.isInteger(t[0])?i:n,s=OC._malloc(r);return(Number.isInteger(t[0])?new Uint32Array(OC.HEAPU32.buffer,s,e):new Float32Array(OC.HEAPF32.buffer,s,e)).set(t,0),s}function FC(t){switch(t){case 0:return OC.OP.UNION;case 1:return OC.OP.INTERSECTION;case 2:return OC.OP.A_MINUS_B;default:throw new Error("Unknown boolean operation "+t)}}function NC(t,e){void 0===RC&&(RC=OC.init_csg());let i=zC(t),n=OC.csg_calc_topological(RC,i,t.length,FC(e));OC._free(i);let r=OC.HEAPU32.subarray(n>>2,6+(n>>2)),s=r.subarray(3,6),a=0,o=OC.HEAPU32[r[a]>>2],l=new Float32Array(OC.HEAPF32.subarray(o>>2,(o>>2)+s[a]));a++;let h=OC.HEAPU32[r[a]>>2],c=new Uint32Array(OC.HEAPU32.subarray(h>>2,(h>>2)+s[a]));a++;let d=OC.HEAPU32[r[a]>>2],u=new Uint8Array(OC.HEAPU32.subarray(d>>2,(d>>2)+s[a]));return OC.free_mesh_data(n),{positions:l,indices:c,verticesPerFace:u}}function UC(t,e,i,n){void 0===RC&&(RC=OC.init_csg());let r=zC(t),s=OC.csg_calc(RC,r,t.length,n,FC(e));OC._free(r);let a=OC.HEAPU32.subarray(s>>2,5+(s>>2)),o=a.subarray(2,5),l=0,h=OC.HEAPU32[a[l]>>2],c=OC.HEAPF32.subarray(h>>2,(h>>2)+o[l]);l++;let d=OC.HEAPU32[a[l]>>2],u=OC.HEAPF32.subarray(d>>2,(d>>2)+o[l]);l++;let p=o[l];i.setAttribute("position",new Vi(c,3)),i.setAttribute("normal",new Vi(u,3));let f=OC.HEAPF32.subarray(5+(s>>2),5+(s>>2)+6);return null===i.boundingSphere&&(i.boundingSphere=new Ve),i.boundingSphere.center.set(f[0],f[1],f[2]),i.boundingSphere.radius=(f[3]**2+f[4]**2+f[5]**2)**.5,i.userData.parameters={width:2*f[3],height:2*f[4],depth:2*f[5]},OC.free_mesh_data(s),p}function kC(t,e,i){if(void 0===OC)return-1;let n,r,s;if(e&&void 0!==t.userData.positions){let e=t.userData;s=e.verticesPerFace.length,n=e.positions,r=Array(e.verticesPerFace.reduce((t,e)=>t+e,0)+s);for(let t=0,i=0,n=0;t<e.verticesPerFace.length;t++){r[n++]=e.verticesPerFace[t];for(let s=0;s<e.verticesPerFace[t];s++)r[n++]=e.indices[i++]}}else({positions:n,faceIndices:r,nFaces:s}=function(t,e,i){let n,r;r="TorusGeometry"===t.userData.parameters.type&&t.userData.parameters.arc===2*Math.PI?t.getClosedTorusIndicesForBooleanOrSubdiv():t.getIndex();let s,{positions:a,triIndices:o}=_C(t.getAttribute("position"),r);if(e&&i){let{indices:e,verticesPerFace:i}=PC(a,o,t);s=i.length,n=[];for(let t=0,r=0;t<s;t++){n.push(i[t]);for(let s=0;s<i[t];s++)n.push(e[r++])}}else{let t=o.length;n=Array(t+t/3),s=0;for(let e=0,i=0;i<n.length;)n[i++]=3,s++,n[i++]=o[e++],n[i++]=o[e++],n[i++]=o[e++]}return{positions:a,faceIndices:n,nFaces:s}}(t,e,i));let a=n.length,o=r.length,l=n.length,h=r.length,c=l*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,d=l*Float32Array.BYTES_PER_ELEMENT,u=OC._malloc(c),p=new Float32Array(OC.HEAPF32.buffer,u,l),f=new Uint32Array(OC.HEAPU32.buffer,u+d,h);p.set(n,0),f.set(r,0);let m=OC.get_csg_mesh(u,a,u+d,o,s);return OC._free(u),m}function VC(t){return OC.has_open_edges(t)}function jC(t,e){OC.transform_csg_mesh(t,e.elements)}function GC(t){OC.free_csg_mesh(t)}LC.then(t=>OC=t);var WC={ConeGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},t.parameters);return i.thetaLength=Wt.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(t){let e,{width:i,depth:n,height:r,radialSegments:s,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,cornerRadiusTop:c,cornerRadiusBottom:d,cornerSegments:u}=t.parameters;return 0===h?(e=new Qi,e.setAttribute("position",new Vi([],3))):e=c>0||d>0||h<360?new I_(0,i/2,r,s,a,o,l,h*Math.PI/180,c,d,u,0,!0):new ao(i/2,r,s,a,o),e.scale(1,1,n/i),Object.assign(e,{userData:{...t,type:"ConeGeometry"}})}},CubeGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},t.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(t){let e,{width:i,height:n,depth:r,widthSegments:s,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=t.parameters;return e=0===l?new un(i,n,r,s,a,o):new R_(i,n,r,s,a,o,l,h),Object.assign(e,{userData:{...t,type:"CubeGeometry"}})}},CylinderGeometry:P_,DodecahedronGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.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(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=0===r&&0!==s?new B_(.5*e,s,a):new lo(.5*e,r);return o.scale(1,i/e,n/e),Object.assign(o,{userData:{...t,type:"DodecahedronGeometry"}})}},EllipseGeometry:tM,HelixGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??n),s=Math.abs(i.depth??n),a=Math.abs(Math.min(n,s))/2;return{parameters:Object.assign(i,{width:n,height:r,depth:s,radius:a,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:n,radius:r,revolutions:s,segments:a,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:c,cornerSegments:d}=t.parameters,u=new lM(!1,e,i,n,r,s,a,o,l,h,c,d);return Object.assign(u,{userData:{...t,type:"HelixGeometry"}})}},IcosahedronGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,detail:0,corner:0,cornerSides:4},t.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(t){let{width:e,height:i,depth:n,detail:r,corner:s,cornerSides:a}=t.parameters,o=0===r&&0!==s?new hM(.5*e,s,a):new Uo(.5*e,r);return o.scale(1,i/e,n/e),Object.assign(o,{userData:{...t,type:"IcosahedronGeometry"}})}},LatheGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}
vendor: 5,702 bytes, line 2
2static normalizeInputs(t,e){(t.parameters?.points??[]).forEach(t=>{Array.isArray(t)&&(t.x=t[0],t.y=t[1])});let i=Object.assign({},e?.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}]},t.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(t){let{points:e,segments:i,verticalSegments:n}=t.parameters,r=new ho;r.moveTo(e[0].x,e[0].y),r.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new ro(r.extractPoints(n).shape,i);return s.rotateZ(Math.PI),Object.assign(s,{userData:{...t,type:"LatheGeometry"}})}},NonParametricGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i,n=t.geometry??e?.geometry??(new Qi).copy(new un(100,100,100));void 0===e?(n.computeBoundingBox(),n.boundingBox.getSize(TM),i={width:TM.x,height:TM.y,depth:TM.z,subdivisions:0}):i=e.parameters;let r={...i,...t.parameters};return{parameters:{width:Math.abs(r.width),height:Math.abs(r.height),depth:Math.abs(r.depth),subdivisions:Math.abs(r.subdivisions)},geometry:n}}static build(t){let{width:e,height:i,depth:n,subdivisions:r}=t.parameters,s=t.geometry??(new Qi).copy(new un(100,100,100)),a=s.userData.parameters;void 0===a?(s.computeBoundingBox(),s.boundingBox.getSize(TM)):TM.set(a.width,a.height,a.depth),(e!==TM.x||i!==TM.y||n!==TM.z)&&s.scale(0===TM.x?1:e/TM.x,0===TM.y?1:i/TM.y,0===TM.z?1:n/TM.z);let o=s.originalGeometry;try{r>0?(void 0===o||a?.subdivisions!==r)&&(void 0===o&&(o=s),s=new PM(r).modify(o).toBufferGeometry()):(void 0!==o&&(s=o),o=void 0,void 0===s.getAttribute("normal")&&s.computeVertexNormals())}catch{void 0!==o&&(s=o),o=void 0,void 0===s.getAttribute("normal")&&s.computeVertexNormals()}return void 0!==o&&Object.assign(s,{originalGeometry:o}),delete t.geometry,Object.assign(s,{userData:{...t,type:"NonParametricGeometry"}})}static loadFromUrl(t,e,i){new Bl(i).load(t,t=>{let i=this.normalizeInputs({geometry:t});t.boundingBox.getSize(TM);let n=100/TM.x;Object.assign(i.parameters,{width:100,height:TM.y*n,depth:TM.z*n}),e(this.build(i))})}},PolygonGeometry:DM,PyramidGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},t.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(t){let{width:e,height:i,depth:n,radialSegments:r,heightSegments:s,openEnded:a,cornerRadius:o,cornerSegments:l}=t.parameters,h=new LM(.5*e,i,r,s,a,o,l);return h.scale(1,1,n/e),Object.assign(h,{userData:{...t,type:"PyramidGeometry"}})}},RectangleGeometry:BM,SphereGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},t.parameters);return i.thetaLength=Wt.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(t){let e,{width:i=100,height:n=i,depth:r=i,widthSegments:s=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:h,thetaLength:c}=t.parameters;return 0===c?(e=new Qi,e.setAttribute("position",new Vi([],3))):e=new ko(.5*i,s,a,o,l,h,c*Wt.DEG2RAD),e.scale(1,n/i,r/i),Object.assign(e,{userData:{...t,type:"SphereGeometry"}})}},PlaneGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},t.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(t){let{width:e=100,height:i=e,widthSegments:n=8,heightSegments:r=8}=t.parameters,s=new Rn(e,i,n,r);return s.scale(1,1,1),Object.assign(s,{userData:{...t,type:"PlaneGeometry"}})}},BackdropGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},t.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(t){let{width:e,height:i,depth:n,angle:r,cornerRadius:s,cornerSegments:a}=t.parameters,o=new zM(e,i,n,r,s,a);return Object.assign(o,{userData:{...t,type:"BackdropGeometry"}})}},StarGeometry:FM,TextFrameGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0},t.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(t){let{width:e,height:i}=t.parameters,n=new Rn(e,i);return Object.assign(n,{userData:{...t,type:"TextFrameGeometry"}})}},TorusGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width);i.shapeBlendNode&&(r=n);let s=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:n,height:r,depth:s})}}static build(t){let{width:e,height:i,depth:n,radialSegments:r,tubularSegments:s,arc:a,cornerRadius:o,cornerSegments:l}
2=t.parameters,h=function(t,e,i,n,r,s,a,o,l,h,c){[e,i]=[i,e],a=e/2;let d=Wt.clamp(r/360,0,1);if(0===d){let t=new Qi;return t.setAttribute("position",new Vi([],3)),t}return 1===d&&(h=0),new lM(!0,t,e,i,n,d,s,a,o,l,h,c)}(e,i,n,.5*e,a,s,0,0,r,o,l);return h.scale(1,i/e,1),Object.assign(h,{userData:{...t,type:"TorusGeometry"}})}},TorusKnotGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},t.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(t){let{width:e,tube:i,tubularSegments:n,radialSegments:r,p:s,q:a}=t.parameters,o=.5*e;o!==i&&(o-=i);let l=new jo(o,i,n,r,s,a);return Object.assign(l,{userData:{...t,type:"TorusKnotGeometry"}})}},TriangleGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},t.parameters);return{shape:t.shape&&t.shape instanceof yA?t.shape:new yA,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(t){let{width:e=100,height:i,cornerRadius:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a,isRect:o}=t.parameters,l=t.shape,h=.5*e,c=.5*i;o?(l.addPoint(l.createPoint(-h,c)),l.addPoint(l.createPoint(h,-c)),l.addPoint(l.createPoint(-h,-c))):(l.addPoint(l.createPoint(0,c)),l.addPoint(l.createPoint(h,-c)),l.addPoint(l.createPoint(-h,-c))),l.isClosed=!0;for(let u=0,p=l.points.length;u<p;u++)l.points[u].roundness=n;l.roundness=n,l.update();let d=JA.create({shape:l,parameters:{roundness:n,depth:r,extrudeBevelSize:s,extrudeBevelSegments:a}});return Object.assign(d,{userData:{...t,type:"TriangleGeometry"}})}},PathGeometry:class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},t.parameters),n=Math.abs(i.width),r=Math.abs(i.height??i.width),s=Math.abs(i.depth??0),a=e?.shapeData??tM.create({parameters:jx}).userData.shape;return{path:t.path??Nx.defaultData(),parameters:Object.assign(i,{width:n,height:r,depth:s,extrusion:{...Xx,...i.extrusion}}),shapeData:a}}static build(t){if(t.path.points.length>=2){let e=new iC(t);return Object.assign(e,{userData:{...t,type:"PathGeometry"}})}return Object.assign(new Qi,{userData:{...t,type:"PathGeometry"}})}},VectorGeometry:JA},HC=t=>WC[t.type].create(t);function qC(t){return null!==t&&"booleanOp"in t}var XC=class extends(E_(cn)){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new Ze}updateVisible(t){super.updateVisible(t),this.visible=!qC(this.parent)&&this.visible,qC(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){-1!==this.booleanMeshSetAddress&&(TC.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),qC(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof XC&&(t.freeBooleanPointer(),qC(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&qC(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),qC(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},YC=new _e;function QC(t,e=0,i=t.count,n,r){let s=1/0,a=1/0,o=1/0,l=-1/0,h=-1/0,c=-1/0;for(let d=e;d<i;d++){let e=t.getX(d),i=t.getY(d),n=t.getZ(d);e<s&&(s=e),i<a&&(a=i),n<o&&(o=n),e>l&&(l=e),i>h&&(h=i),n>c&&(c=n)}YC.min.set(s,a,o),YC.max.set(l,h,c),YC.getCenter(n),YC.getSize(r).multiplyScalar(.5)}var ZC=new Qi,KC=new Bi,JC=class extends XC{constructor(t,e){super(ZC,KC),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");void 0!==i?QC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}},$C=class{constructor(t){if(this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},null===$C.uuidContext)throw new Error("plz startContext");$C.uuidContext===$C.globalContext?this.uuid="_gid"+$C.uuidContext.nodeContextUuid++:this.uuid="_uid"+$C.uuidContext.nodeContextUuid++,this.type=t,this.name=""}static startContext(t){(null===this.uuidContext||this.uuidContext===$C.globalContext)&&(this.uuidContext=t)}static endContext(t){this.uuidContext,this.uuidContext=null}analyze(t,e){e=e??{}
vendor: 4,482 bytes, line 2
2,t.analyzing=!0,this.build(t.addFlow(e.slot,e.cache,e.context),"v4"),t.clearVertexNodeCode(),t.clearFragmentNodeCode(),t.removeFlow(),t.analyzing=!1}analyzeAndFlow(t,e,i){return i=i??{},this.analyze(t,i),this.flow(t,e,i)}flow(t,e,i){i=i??{},t.addFlow(i.slot,i.cache,i.context);let n={result:this.build(t,e),code:t.clearNodeCode(),extra:t.context.extra};return t.removeFlow(),n}build(t,e,i){e=e??this.getType(t,e);let n=t.getNodeData(i??this);return t.analyzing&&this.appendDepsNode(t,n,e),-1===t.nodes.indexOf(this)&&t.nodes.push(this),void 0!==this.updateFrame&&-1===t.updaters.indexOf(this)&&t.updaters.push(this),this.generate(t,e,i)}updateFrame(t){}generateReadonly(t,e,i,n,r,s){return""}generate(t,e,i,n,r){return""}parse(t,e,i,n){}appendDepsNode(t,e,i){e.deps=(e.deps||0)+1;let n=t.getTypeLength(i);(n>(e.outputMax||0)||this.getType(t,i))&&(e.outputMax=n,e.output=i)}setName(t){this.name=t}getName(){return this.name}getType(t,e){return"sampler2D"===e||"samplerCube"===e?e:this.type}},tE=$C;tE.globalContext={nodeContextUuid:0},tE.uuidContext=$C.globalContext;var eE=class{constructor(t){t=t??{},this.name=t.name,this.type=t.type,this.node=t.node,this.size=t.size,this.needsUpdate=t.needsUpdate}get value(){return this.node.value}set value(t){this.node.value=t}},iE=new class{constructor(){this.nodes={},this.keywords={}}add(t){this.nodes[t.name]=t}addKeyword(t,e,i){i=void 0===i||i,this.keywords[t]={callback:e,cache:i}}remove(t){delete this.nodes[t.name]}removeKeyword(t){delete this.keywords[t]}get(t){return this.nodes[t]}getKeyword(t,e){return this.keywords[t].callback(e)}getKeywordData(t){return this.keywords[t]}contains(t){return void 0!==this.nodes[t]}containsKeyword(t){return void 0!==this.keywords[t]}},nE=class extends tE{constructor(t,e){super(t),this.scope="",e=e??{},this.shared=void 0===e.shared||e.shared,this.unique=void 0!==e.unique&&e.unique}build(t,e,i,n){if(e=e??this.getType(t),this.getShared(t,e)){let r=this.getUnique(t,e);r&&void 0===this.uuid&&(this.uuid=Wt.generateUUID()),i=t.getUUID(i??this.getUUID(),!r);let s=t.getNodeData(i),a=s.output||this.getType(t);if(t.analyzing)return(s.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,s,e),this.generate(t,e,i)):super.build(t,e,i);if(r)return s.name=s.name||super.build(t,e,i),s.name;if(!this.getLabel()&&(!this.getShared(t,a)||t.context.ignoreCache||1===s.deps))return super.build(t,e,i);i=this.getUUID(!1);let o=this.getTemp(t,i);if(o)return t.format(o,a,e);{o=super.generate(t,e,i,s.output,n);let r=this.generate(t,a,i);return t.addNodeCode(o+" = "+r+";"),t.format(o,a,e)}}return super.build(t,e,i)}getShared(t,e){return"sampler2D"!==e&&"samplerCube"!==e&&this.shared}getUnique(t,e){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let e=this.uuid;return"string"==typeof this.scope&&(e=this.scope+"-"+e),e}getTemp(t,e){e=e||this.uuid;let i=t.getVars()[e];return i?i.name:void 0}generate(t,e,i,n,r){return this.getShared(t,e),i=i??this.uuid,t.getTempVar(i,n??this.getType(t),r,this.getLabel()).name}},rE=class extends nE{constructor(t,e){(e=e??{}).shared=void 0!==e.shared&&e.shared,super(t,e),this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(t,e,i,n,r,s){i=t.getUUID(i??this.getUUID()),n=n??this.getType(t);let a=t.getNodeData(i);return this.getReadonly()&&void 0!==this.generateReadonly?this.generateReadonly(t,e,i,n,r,s):t.isShader("vertex")?(a.vertex||(a.vertex=t.createVertexUniform(n,this,r,s,this.getLabel())),t.format(a.vertex.name,n,e)):(a.fragment||(a.fragment=t.createFragmentUniform(n,this,r,s,this.getLabel())),t.format(a.fragment.name,n,e))}},sE=class extends rE{constructor(t=0,e){super("v2"),this.nodeType="Vector2",this.value=t instanceof Ht?t:new Ht(t,e)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,e,i,n,r,s){return t.format("vec2("+this.value.x+", "+this.value.y+")",n,e)}},aE=class extends rE{constructor(t=0,e,i){super("v3"),this.nodeType="Vector3",this.value=t instanceof be?t:new be(t,e,i)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,e,i,n,r,s){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",n,e)}},oE=class extends le{constructor(t,e,i,n){super(t,e,i),this.isColorA=!0,this.a=n}
vendor: 5,345 bytes, line 2
2setRGBA(t,e,i,n){super.setRGB(t,e,i),this.a=n}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(t){return super.equals(t)&&this.a===t.a}setStyle(t,e="srgb"){let i;if("transparent"===t)return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(t)){let n,r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a="rgba"===r?parseFloat(n[4]):1,super.setStyle(t,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.a="hsla"===r?parseFloat(n[4]):1,super.setStyle(t,e)}}return super.setStyle(t,e)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}},lE=class extends rE{constructor(t){super("v4"),this.nodeType="Vector4",this.value=t instanceof oE?t:new oE(t.r,t.g,t.b,t.a)}generateReadonly(t,e,i,n,r,s){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",n,e)}},hE=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,cE=/[a-z_0-9]+/gi,dE=class extends nE{constructor(t,e,i,n,r){super(r),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=void 0===r,this.isInterface=!1,this.parse(t,e,i,n)}getShared(t,e){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let e=this.inputs.length;for(;e--;)if(this.inputs[e].name===t)return this.inputs[e]}}getIncludeByName(t){if(this.includes){let e=this.includes.length;for(;e--;)if(this.includes[e].name===t)return this.includes[e]}}generate(t,e,i,n,r){let s,a=0,o=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)t.include(this.includes[h],this);for(let h in this.extensions)t.extensions[h]=!0;let l=[];for(;s=cE.exec(this.src);)l.push(s);for(let h=0;h<l.length;h++){let e=l[h],i=e[0],n=!this.isMethod||!this.getInputByName(i),r=i;if(this.keywords[i]||this.useKeywords&&n&&iE.containsKeyword(i)){let e=this.keywords[i];if(!e){let n=iE.getKeywordData(i);n.cache&&(e=t.keywords[i]),e=e||iE.getKeyword(i,t),n.cache&&(t.keywords[i]=e)}r=e.build(t)}i!==r&&"."!==o[e.index+a-1]&&(o=o.substring(0,e.index+a)+r+o.substring(e.index+i.length+a),a+=r.length-i.length),void 0===this.getIncludeByName(r)&&iE.contains(r)&&t.include(iE.get(r))}return"source"===e?o:this.isMethod?(this.isInterface||t.include(this,void 0,o),this.name):t.format("( "+o+" )",this.getType(t),e)}parse(t,e,i,n){if(this.src=t||"",this.includes=e??[],this.extensions=i??{},this.keywords=n??{},this.isMethod){let t=hE.exec(this.src);if(this.inputs=[],t&&4==t.length){this.type=t[1],this.name=t[2];let e=t[3].match(cE);if(e){let t=0;for(;t<e.length;){let i,n=e[t++];"in"===n||"out"===n||"inout"===n?i=e[t++]:(i=n,n="");let r=e[t++];this.inputs.push({name:r,type:i,qualifier:n})}}this.isInterface=-1===this.src.indexOf("{")}else this.type="",this.name=""}}},uE=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,pE=class extends nE{constructor(t="",e){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(t||pE.PI,void 0,void 0,void 0,e)}getType(t){return t.getTypeByFormat(this.type)}parse(t,e,i,n,r){this.src=t||"";let s,a,o="",l=uE.exec(t);this.useDefine=r??"#"===this.src.charAt(0),l&&l.length>1?(a=l[1],s=l[2],o=l[3]):(s=this.src,a="f"),this.name=s,this.type=a,this.value=o}build(t,e){if("source"===e){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 t.include(this),t.format(this.name,this.getType(t),e)}generate(t,e,i,n,r){return t.format(this.name,this.getType(t),e)}},fE=pE;fE.PI="PI",fE.PI2="PI2",fE.RECIPROCAL_PI="RECIPROCAL_PI",fE.RECIPROCAL_PI2="RECIPROCAL_PI2",fE.LOG2="LOG2",fE.EPSILON="EPSILON";var mE=new RegExp("^structs*([a-z_0-9]+)s*{s*((.|\n)*?)}","gim"),gE=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),vE=class extends nE{constructor(t=""){super(),this.inputs=[],this.src="",this.nodeType="Struct",this.parse(t)}getType(t){return t.getTypeByFormat(this.name)}getInputByName(t){let e=this.inputs.length;for(;e--;)if(this.inputs[e].name===t)return this.inputs[e]}generate(t,e,i,n,r){return"source"===e?this.src+";":t.format("( "+this.src+" )",this.getType(t),e)}parse(t=""){this.src=t,this.inputs=[];let e=mE.exec(t);if(e){let t,i=e[2];for(;t=gE.exec(i);)this.inputs.push({type:t[1],name:t[2]});this.name=e[1]}else this.name="";this.type=this.name}},yE=class extends nE{constructor(t){super("v2",{shared:!1}),this.nodeType="UV",this.index=t??0}generate(t,e){t.requires.uv[this.index]=!0;let i=this.index>0?this.index+1:"",n=t.isShader("vertex")?"uv"+i:"vUv"+i;return t.format(n,this.getType(t),e)}};iE.addKeyword("uv",function(){return new yE}),iE.addKeyword("uv2",function(){return new yE(1)});var xE=class extends nE{constructor(t,e){super("v4"),this.nodeType="ColorSpace",this.input=t,this.method=e??xE.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(t){switch(t){case wt:return["Linear"];case St:return["sRGB"];default:return[]}}generate(t,e){let i=this.input.build(t,"v4"),n=this.getType(t),r=xE.Nodes[this.method],s=t.include(r);
vendor: 11,198 bytes, line 2
2if(s===xE.LINEAR_TO_LINEAR)return t.format(i,n,e);if(2===r.inputs?.length){let r=this.factor.build(t,"f");return t.format(s+"( "+i+", "+r+" )",n,e)}return t.format(s+"( "+i+" )",n,e)}fromEncoding(t){let e=xE.getEncodingComponents(t);this.method="LinearTo"+e[0],this.factor=e[1]}fromDecoding(t){let e=xE.getEncodingComponents(t);this.method=e[0]+"ToLinear",this.factor=e[1]}},bE=xE;bE.Nodes={LinearToLinear:new dE(["vec4 LinearToLinear( in vec4 value ) {","\treturn value;","}"].join("\n")),sRGBToLinear:new dE(["vec4 sRGBToLinear( in vec4 value ) {","\treturn 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("\n")),LinearTosRGB:new dE(["vec4 LinearTosRGB( in vec4 value ) {","\treturn 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("\n"))},bE.LINEAR_TO_LINEAR="LinearToLinear",bE.SRGB_TO_LINEAR="sRGBToLinear",bE.LINEAR_TO_SRGB="LinearTosRGB";var wE=class extends dE{constructor(t="",e,i,n,r){super(t,r,n,i,e),this.nodeType="Expression"}},SE=class extends rE{constructor(t=new fe,e,i,n){super("v4",{shared:!0}),this.nodeType="Texture",this.value=t,this.uv=e??new yE,this.bias=i,this.project=void 0!==n&&n}getTexture(t,e){return super.generate(t,e,this.value.uuid,"t")}generate(t,e){if("sampler2D"===e)return this.getTexture(t,e);let i,n,r=this.getTexture(t,e),s=this.uv.build(t,this.project?"v4":"v2"),a=this.bias?this.bias.build(t,"f"):void 0;void 0===a&&t.context.bias&&(a=t.context.bias.setTexture(this).build(t,"f")),i=this.project?"texture2DProj":a?"tex2DBias":"tex2D",n=a?i+"( "+r+", "+s+", "+a+" )":i+"( "+r+", "+s+" )";let o={include:t.isShader("vertex"),ignoreCache:!0},l=this.getType(t);return t.addContext(o),this.colorSpace=this.colorSpace??new bE(new wE("",l)),this.colorSpace.fromDecoding(t.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(n),n=this.colorSpace.build(t,l),t.removeContext(),t.format(n,l,e)}},_E=class extends rE{constructor(t){super("f"),this.nodeType="Float",this.value=t??0}generateReadonly(t,e,i,n,r,s){return t.format(this.value+(this.value%1?"":".0"),n,e)}},AE=class extends nE{constructor(t,e){super(),this.inputs=[],this.nodeType="FunctionCall",this.value=t,this.inputs=e??[]}getFunction(){return this.value}getType(t){return this.value.getType(t)}generate(t,e,i,n,r){n=this.getType(t);let s=this.value,a=s.build(t,e)+"( ",o=[];if(s.inputs){for(let e=0;e<s.inputs.length;e++){let i=s.inputs[e],n=this.inputs[e]||this.inputs[i.name];o.push(n.build(t,t.getTypeByFormat(i.type)))}a+=o.join(", ")+" )"}return t.format(a,n,e)}},ME=class extends nE{constructor(t,e,i=ME.ADD){super(),this.nodeType="Operator",this.type=t.type,this.a=t,this.b=e,this.op=i}getType(t){let e=this.a.getType(t),i=this.b.getType(t);return t.isTypeMatrix(e)?"v4":t.getTypeLength(i)>t.getTypeLength(e)?i:e}generate(t,e){let i=this.getType(t);this.type=i;let n=this.a.build(t,i),r=this.b.build(t,i);return t.format("( "+n+" "+this.op+" "+r+" )",i,e)}},CE=ME;CE.ADD="+",CE.SUB="-",CE.MUL="*",CE.DIV="/";var EE=class extends nE{constructor(t,e=EE.ABS,i,n){super(),this.nodeType="Math",this.a=t,"string"!=typeof e?this.b=e:n=e,"string"!=typeof i?this.c=i:n=i,this.method=n,this.hashProperties=["method"]}getNumInputs(t){switch(this.method){case EE.MIX:case EE.CLAMP:case EE.REFRACT:case EE.SMOOTHSTEP:case EE.FACEFORWARD:return 3;case EE.MIN:case EE.MAX:case EE.MOD:case EE.STEP:case EE.REFLECT:case EE.DISTANCE:case EE.DOT:case EE.CROSS:case EE.POW:return 2;default:return 1}}getInputType(t){let e=t.getTypeLength(this.a.getType(t)),i=this.b?t.getTypeLength(this.b.getType(t)):0,n=this.c?t.getTypeLength(this.c.getType(t)):0;return e>i&&e>n?this.a.getType(t):i>n?this.b.getType(t):this.c.getType(t)}getType(t){switch(this.method){case EE.LENGTH:case EE.DISTANCE:case EE.DOT:return"f";case EE.CROSS:return"v3"}return this.getInputType(t)}generate(t,e){let i,n,r,s=this.a?t.getTypeLength(this.a.getType(t)):0,a=this.b?t.getTypeLength(this.b.getType(t)):0,o=this.c?t.getTypeLength(this.c.getType(t)):0,l=this.getInputType(t),h=this.getType(t);switch(this.type=h,this.method){case EE.NEGATE:return t.format("( -"+this.a.build(t,l)+" )",l,e);case EE.INVERT:return t.format("( 1.0 - "+this.a.build(t,l)+" )",l,e);case EE.CROSS:i=this.a.build(t,"v3"),n=this.b.build(t,"v3");break;case EE.STEP:i=this.a.build(t,1===s?"f":l),n=this.b.build(t,l);break;case EE.MIN:case EE.MAX:case EE.MOD:i=this.a.build(t,l),n=this.b.build(t,1===a?"f":l);break;case EE.REFRACT:i=this.a.build(t,l),n=this.b.build(t,l),r=this.c.build(t,"f");break;case EE.MIX:i=this.a.build(t,l),n=this.b.build(t,l),r=this.c.build(t,1===o?"f":l);break;default:i=this.a.build(t,l),this.b&&(n=this.b.build(t,l)),this.c&&(r=this.c.build(t,l))}let c=[];c.push(i),n&&c.push(n),r&&c.push(r);let d=this.getNumInputs(t);if(c.length!==d)throw Error(`Arguments not match used in "${this.method}". Require ${d}, currently ${c.length}.`);return t.format(this.method+"( "+c.join(", ")+" )",h,e)}},PE=EE;PE.RAD="radians",PE.DEG="degrees",PE.EXP="exp",PE.EXP2="exp2",PE.LOG="log",PE.LOG2="log2",PE.SQRT="sqrt",PE.INV_SQRT="inversesqrt",PE.FLOOR="floor",PE.CEIL="ceil",PE.NORMALIZE="normalize",PE.FRACT="fract",PE.SATURATE="saturate",PE.SIN="sin",PE.COS="cos",PE.TAN="tan",PE.ASIN="asin",PE.ACOS="acos",PE.ARCTAN="atan",PE.ABS="abs",PE.SIGN="sign",PE.LENGTH="length",PE.NEGATE="negate",PE.INVERT="invert",PE.MIN="min",PE.MAX="max",PE.MOD="mod",PE.STEP="step",PE.REFLECT="reflect",PE.DISTANCE="distance",PE.DOT="dot",PE.CROSS="cross",PE.POW="pow",PE.MIX="mix",PE.CLAMP="clamp",PE.REFRACT="refract",PE.SMOOTHSTEP="smoothstep",PE.FACEFORWARD="faceforward";var TE=class extends nE{constructor(t,e,i){super("v4"),this.nodeType="TextureCubeUV",this.value=t,this.uv=e,this.bias=i}bilinearCubeUV(t,e,i,n){let r=new AE(TE.Nodes.bilinearCubeUV,[e,i,n]);this.colorSpaceTL=this.colorSpaceTL??new bE(new wE("","v4")),this.colorSpaceTL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(r.build(t)+".tl"),this.colorSpaceTR=this.colorSpaceTR??new bE(new wE("","v4")),this.colorSpaceTR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(r.build(t)+".tr"),this.colorSpaceBL=this.colorSpaceBL??new bE(new wE("","v4")),this.colorSpaceBL.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(r.build(t)+".bl"),this.colorSpaceBR=this.colorSpaceBR??new bE(new wE("","v4")),this.colorSpaceBR.fromDecoding(t.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(r.build(t)+".br");let s={include:t.isShader("vertex"),ignoreCache:!0};t.addContext(s),this.colorSpaceTLExp=new wE(this.colorSpaceTL.build(t,"v4"),"v4"),this.colorSpaceTRExp=new wE(this.colorSpaceTR.build(t,"v4"),"v4"),this.colorSpaceBLExp=new wE(this.colorSpaceBL.build(t,"v4"),"v4"),this.colorSpaceBRExp=new wE(this.colorSpaceBR.build(t,"v4"),"v4"),t.removeContext();let a=new wE("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return a.keywords.cubeUV_TL=this.colorSpaceTLExp,a.keywords.cubeUV_TR=this.colorSpaceTRExp,a.keywords.cubeUV_BL=this.colorSpaceBLExp,a.keywords.cubeUV_BR=this.colorSpaceBRExp,a.keywords.cubeUV=r,a}generate(t,e){if(t.isShader("fragment")){let i=this.uv,n=this.bias||t.context.roughness,r=new AE(TE.Nodes.roughnessToMip,[n]),s=new PE(r,TE.Nodes.m0,TE.Nodes.cubeUV_maxMipLevel,PE.CLAMP),a=new PE(s,PE.FLOOR),o=new PE(s,PE.FRACT),l=this.bilinearCubeUV(t,this.value,i,a),h=this.bilinearCubeUV(t,this.value,i,new CE(a,new _E(1).setReadonly(!0),CE.ADD)),c=new PE(l,h,o,PE.MIX);return t.format(c.build(t),"v4",e)}return t.format("vec4( 0.0 )",this.getType(t),e)}},DE=TE;DE.Nodes=function(){let t=new vE("struct TextureCubeUVData {\n\t\t\tvec4 tl;\n\t\t\tvec4 tr;\n\t\t\tvec4 br;\n\t\t\tvec4 bl;\n\t\t\tvec2 f;\n\t\t}"),e=new fE("float cubeUV_maxMipLevel 8.0",!0),i=new fE("float cubeUV_minMipLevel 4.0",!0),n=new fE("float cubeUV_maxTileSize 256.0",!0),r=new fE("float cubeUV_minTileSize 16.0",!0),s=new dE("float getFace(vec3 direction) {\n\t\t\t\tvec3 absDirection = abs(direction);\n\t\t\t\tfloat face = -1.0;\n\t\t\t\tif (absDirection.x > absDirection.z) {\n\t\t\t\t\tif (absDirection.x > absDirection.y)\n\t\t\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\t\t\telse\n\t\t\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t\t\t} else {\n\t\t\t\t\tif (absDirection.z > absDirection.y)\n\t\t\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\t\t\telse\n\t\t\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t\t\t}\n\t\t\t\treturn face;\n\t\t}");s.useKeywords=!1;let a=new dE("vec2 getUV(vec3 direction, float face) {\n\t\t\t\tvec2 uv;\n\t\t\t\tif (face == 0.0) {\n\t\t\t\t\tuv = vec2(direction.z, direction.y) / abs(direction.x); // pos x\n\t\t\t\t} else if (face == 1.0) {\n\t\t\t\t\tuv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y\n\t\t\t\t} else if (face == 2.0) {\n\t\t\t\t\tuv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z\n\t\t\t\t} else if (face == 3.0) {\n\t\t\t\t\tuv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x\n\t\t\t\t} else if (face == 4.0) {\n\t\t\t\t\tuv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y\n\t\t\t\t} else {\n\t\t\t\t\tuv = vec2(direction.x, direction.y) / abs(direction.z); // neg z\n\t\t\t\t}\n\t\t\t\treturn 0.5 * (uv + 1.0);\n\t\t}");a.useKeywords=!1;let o=new dE("TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n\t\t\tfloat face = getFace(direction);\n\t\t\tfloat filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n\t\t\tmipInt = max(mipInt, cubeUV_minMipLevel);\n\t\t\tfloat faceSize = exp2(mipInt);\n\t\t\tfloat texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n\t\t\tvec2 uv = getUV(direction, face) * (faceSize - 1.0);\n\t\t\tvec2 f = fract(uv);\n\t\t\tuv += 0.5 - f;\n\t\t\tif (face > 2.0) {\n\t\t\t\tuv.y += faceSize;\n\t\t\t\tface -= 3.0;\n\t\t\t}\n\t\t\tuv.x += face * faceSize;\n\t\t\tif(mipInt < cubeUV_maxMipLevel){\n\t\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t\t}\n\t\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\t\tuv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n\t\t\tuv *= texelSize;\n\t\t\tvec4 tl = texture2D(envMap, uv);\n\t\t\tuv.x += texelSize;\n\t\t\tvec4 tr = texture2D(envMap, uv);\n\t\t\tuv.y += texelSize;\n\t\t\tvec4 br = texture2D(envMap, uv);\n\t\t\tuv.x -= texelSize;\n\t\t\tvec4 bl = texture2D(envMap, uv);\n\t\t\treturn TextureCubeUVData( tl, tr, br, bl, f );\n\t\t}",[t,s,a,e,i,n,r]);o.useKeywords=!1;let l=new fE("float r0 1.0",!0),h=new fE("float v0 0.339",!0),c=new fE("float m0 -2.0",!0),d=new fE("float r1 0.8",!0),u=new fE("float v1 0.276",!0),p=new fE("float m1 -1.0",!0),f=new fE("float r4 0.4",!0),m=new fE("float v4 0.046",!0),g=new fE("float m4 2.0",!0),v=new fE("float r5 0.305",!0),y=new fE("float v5 0.016",!0),x=new fE("float m5 3.0",!0),b=new fE("float r6 0.21",!0),w=new fE("float v6 0.0038",!0),S=new fE("float m6 4.0",!0);return{bilinearCubeUV:o,roughnessToMip:new dE("float roughnessToMip(float roughness) {\
2n\t\t\tfloat mip = 0.0;\n\t\t\tif (roughness >= r1) {\n\t\t\t\tmip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n\t\t\t} else if (roughness >= r4) {\n\t\t\t\tmip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n\t\t\t} else if (roughness >= r5) {\n\t\t\t\tmip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n\t\t\t} else if (roughness >= r6) {\n\t\t\t\tmip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n\t\t\t} else {\n\t\t\t\tmip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25\n\t\t\t}\n\t\t\treturn mip;\n\t\t}",[l,h,c,d,u,p,f,m,g,v,y,x,b,w,S]),m0:c,cubeUV_maxMipLevel:e}}();var IE=class extends nE{constructor(t){super("v3"),this.nodeType="Normal",this.scope=t??IE.VIEW}getShared(){return this.scope===IE.WORLD}build(t,e,i,n){let r=t.context[this.scope+"Normal"];return r?r.build(t,e,i,n):super.build(t,e,i)}generate(t,e,i,n,r){let s;switch(this.scope){case IE.VIEW:s=t.isShader("vertex")?"transformedNormal":"geometryNormal";break;case IE.LOCAL:t.isShader("vertex")?s="objectNormal":(t.requires.normal=!0,s="vObjectNormal");break;case IE.WORLD:t.isShader("vertex")?s="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(t.requires.worldNormal=!0,s="vWNormal")}return t.format(s,this.getType(t),e)}},OE=IE;OE.LOCAL="local",OE.WORLD="world",OE.VIEW="view",OE.NORMAL="normal",iE.addKeyword("viewNormal",function(){return new OE(OE.VIEW)}),iE.addKeyword("localNormal",function(){return new OE(OE.NORMAL)}),iE.addKeyword("worldNormal",function(){return new OE(OE.WORLD)});var RE=class extends nE{constructor(t){super("v3"),this.nodeType="Position",this.scope=t??RE.LOCAL}getType(){return this.scope===RE.PROJECTION?"v4":this.type}getShader(){switch(this.scope){case RE.LOCAL:case RE.WORLD:return!1}return!0}generate(t,e,i,n,r){let s;switch(this.scope){case RE.LOCAL:t.isShader("vertex")?s="transformed":(t.requires.position=!0,s="vPosition");break;case RE.WORLD:if(t.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";t.requires.worldPosition=!0,s="vWPosition";break;case RE.VIEW:s=t.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case RE.PROJECTION:s=t.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )"}return t.format(s,this.getType(),e)}},LE=RE;LE.LOCAL="local",LE.WORLD="world",LE.VIEW="view",LE.PROJECTION="projection",iE.addKeyword("position",function(){return new LE}),iE.addKeyword("worldPosition",function(){return new LE(LE.WORLD)}),iE.addKeyword("viewPosition",function(){return new LE(LE.VIEW)});var BE=class extends nE{constructor(t){super("v3"),this.nodeType="Reflect",this.scope=t??BE.CUBE}getUnique(t){return!t.context.viewNormal}getType(){return this.scope===BE.SPHERE?"v2":this.type}generate(t,e){let i=this.getUnique(t);if(t.isShader("fragment")){let n;switch(this.scope){case BE.VECTOR:{let e=new OE(OE.VIEW),r=t.context.roughness,s=e.build(t,"v3"),a=new LE(LE.VIEW).build(t,"v3"),o=r?r.build(t,"f"):void 0,l=`reflect( -normalize( ${a} ), ${s} )`;o&&(l=`normalize( mix( ${l}, ${s}, ${o} * ${o} ) )`);let h=`inverseTransformDirection( ${l}, viewMatrix )`;i?(t.addNodeCode(`vec3 reflectVec = ${h};`),n="reflectVec"):n=h;break}case BE.CUBE:{let e=new BE(BE.VECTOR).build(t,"v3"),r="vec3( -"+e+".x, "+e+".yz )";i?(t.addNodeCode(`vec3 reflectCubeVec = ${r};`),n="reflectCubeVec"):n=r;break}case BE.SPHERE:{let e="normalize( ( viewMatrix * vec4( "+new BE(BE.VECTOR).build(t,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(t.addNodeCode(`vec2 reflectSphereVec = ${e};`),n="reflectSphereVec"):n=e;break}}return t.format(n,this.getType(),e)}return t.format("vec3( 0.0 )",this.type,e)}},zE=BE;zE.CUBE="cube",zE.SPHERE="sphere",zE.VECTOR="vector";var FE=class extends nE{constructor(t=new SE,e,i){super("v4"),this.nodeType="TextureCube",this.value=t,this.radianceNode=new DE(this.value,e??new zE(zE.VECTOR),i),this.irradianceNode=new DE(this.value,new OE(OE.WORLD),new _E(1).setReadonly(!0))}generate(t,e){return t.isShader("fragment")?(t.require("irradiance"),t.context.bias&&t.context.bias.setTexture(this.value),("irradiance"===t.slot?this.irradianceNode:this.radianceNode).build(t,e)):t.format("vec4( 0.0 )",this.getType(t),e)}},NE=class extends rE{constructor(t=new Sn,e,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=t,this.uv=e??new zE,this.bias=i}getTexture(t,e){return super.generate(t,e,this.value.uuid,"tc")}generate(t,e){if("samplerCube"===e)return this.getTexture(t,e);let i,n=this.getTexture(t,e),r=this.uv?.build(t,"v3"),s=this.bias?this.bias.build(t,"f"):void 0;void 0===s&&t.context.bias&&(s=t.context.bias.setTexture(this).build(t,"f")),i=s?"texCubeBias( "+n+", "+r+", "+s+" )":"texCube
2( "+n+", "+r+" )";let a={include:t.isShader("vertex"),ignoreCache:!0},o=this.getType(t);return t.addContext(a),this.colorSpace=this.colorSpace??new bE(new wE("",o)),this.colorSpace.fromDecoding(t.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(i),i=this.colorSpace.build(t,o),t.removeContext(),t.format(i,o,e)}},UE=["x","y","z","w"],kE=["float","vec2","vec3","vec4"],VE={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},jE={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[]"},GE=class{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.needsJitter=!0,this.getIncludesCode=function(){function t(t,e){return t.deps.length-e.deps.length}return function(e,i){let n=this.getIncludes(e,i);if(!n)return"";let r="";n=n.sort(t);for(let t=0;t<n.length;t++)n[t].src&&(r+=n[t].src+"\n");return r}}(),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={},this.prefixCode=["#ifdef TEXTURE_LOD_EXT","\t#define texCube(a, b) textureCube(a, b)","\t#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)","\t#define tex2D(a, b) texture2D(a, b)","\t#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else","\t#define texCube(a, b) textureCube(a, b)","\t#define texCubeBias(a, b, c) textureCube(a, b, c)","\t#define tex2D(a, b) texture2D(a, b)","\t#define tex2DBias(a, b, c) texture2D(a, b, c)","#endif","\n\t\t\t// NOTE: Include Spline's blending modes. This could be part of BlendNode\n\t\t\t#define SPE_BLENDING_NORMAL 0\n\t\t\t#define SPE_BLENDING_MULTIPLY 1\n\t\t\t#define SPE_BLENDING_SCREEN 2\n\t\t\t#define SPE_BLENDING_OVERLAY 3\n\n\t\t\tvec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) {\n\t\t\t\treturn mix( a, b, alpha );\n\t\t\t}\n\n\t\t\tvec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) {\n\t\t\t\treturn mix( a, a * b, alpha );\n\t\t\t}\n\n\t\t\tvec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) {\n\t\t\t\tvec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b );\n\t\t\t\treturn mix( a, tmp, alpha );\n\t\t\t}\n\n\t\t\tvec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) {\n\t\t\t\tvec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) );\n\t\t\t\treturn clamp( mix( a, tmp, alpha ), 0.0, 1.0 );\n\t\t\t}\n\n\t\t\tvec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) {\n\t\t\t\tif ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha );\n\t\t\t\telse if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha );\n\t\t\t\telse if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha );\n\t\t\t\telse if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha );\n\t\t\t\treturn vec3( 1.0 );\n\t\t\t}\n\t\t\t","#include <packing>","#include <common>"].join("\n"),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join("\n"),fragment:["float accumAlpha = 0.0;","void accumulateAlpha(float alpha) {\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * alpha;\n\t\t\t\t}",""].join("\n")},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(t,e){this.addVertexParsCode("\nuniform int frameIndex;\nuniform vec2 resolution;\nuniform mat4 previousModelViewMatrix;\nuniform mat4 previousProjectionMatrix;\n\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n"),this.addFragmentParsCode("\nlayout(location = 1) out vec4 gVelocity;\n\nuniform int frameIndex;\nuniform vec2 resolution;\n\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n\nconst vec2 haltonSequence[16] = vec2[16](\nvec2( 0.000000,-0.333334),\nvec2(-0.500000, 0.333334),\nvec2( 0.500000,-0.777778),\nvec2(-0.750000,-0.111112),\nvec2( 0.250000, 0.555556),\nvec2(-0.250000,-0.555556),\nvec2( 0.750000, 0.111112),\nvec2(-0.875000, 0.777778),\nvec2(0.125000, -0.925926),\nvec2(-0.375000, -0.259260),\nvec2(0.625000, 0.407408),\nvec2(-0.625000, -0.703704),\nvec2(0.375000, -0.037038),\nvec2(-0.125000, 0.629630),\nvec2(0.875000, -0.481482),\nvec2(-0.937500, 0.185186));\n\nvec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {\n const float goldenAngle = 2.399963f; // radians\n float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));\n float theta = float(sampleIndex) * goldenAngle + angle;\n float sine = sin(theta);\n float cosine = cos(theta);\n return vec2(cosine, sine) * r;\n}\n\n// Derived from the interleaved gradient function from Jimenez 2014 http:goo.gl/eomGso\nfloat getNoiseInterleavedGradient(vec2 screenPos) {\n vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f);\n return fract(magic.z * fract(dot(screenPos, magic.xy)));\n}\n\n"),this.buildShader("vertex",t),this.buildShader("fragment",e);for(let i=0;i<this.requires.uv.length;i++)if(this.requires.uv[i]){let t=i>0?i+1:"";this.addVaryCode("varying vec2 vUv"+t+";"),i>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("\n\t\t\t\t#ifndef SHAPEBLEND \n\t\t\t\t\tvObjectNormal = normal;\n\t\t\t\t#else\n\t\t\t\t\tvObjectNormal = objectNormal;\n\t\t\t\t#endif\n\t\t\t")),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
2)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.needsJitter&&(this.addVertexFinalCode("\n// TODO: This could be generated CPU side and passed to the shader every frame\nconst vec2 haltonSequence[16] = vec2[16](\nvec2( 0.000000,-0.333334),\nvec2(-0.500000, 0.333334),\nvec2( 0.500000,-0.777778),\nvec2(-0.750000,-0.111112),\nvec2( 0.250000, 0.555556),\nvec2(-0.250000,-0.555556),\nvec2( 0.750000, 0.111112),\nvec2(-0.875000, 0.777778),\nvec2(0.125000, -0.925926),\nvec2(-0.375000, -0.259260),\nvec2(0.625000, 0.407408),\nvec2(-0.625000, -0.703704),\nvec2(0.375000, -0.037038),\nvec2(-0.125000, 0.629630),\nvec2(0.875000, -0.481482),\nvec2(-0.937500, 0.185186));\n\n// TODO: Pass correct view size\nvec2 offset = haltonSequence[frameIndex];\noffset.x /= resolution.x;\noffset.y /= resolution.y;\n\nvec4 currentPosition = gl_Position;\nvec4 currentPositionJittered = currentPosition + (vec4(offset.x, offset.y, 0.0, 0.0) * currentPosition.w);\n\n// We want to calculate the velocity with unjittered positions\n// so that things that are not moving get a velocity = 0\nvCurrentPosition = currentPosition;\nvPreviousPosition = previousProjectionMatrix * previousModelViewMatrix * vec4(transformed, 1.0);\n#ifdef OUTLINE_COMPENSATION\nvPreviousPosition.xy += OUTLINE_COMPENSATION;\n#endif\ngl_Position = currentPositionJittered;\n\n"),this.addFragmentFinalCode("\nvec2 oldPos = vPreviousPosition.xy;\n oldPos /= vPreviousPosition.w;\n oldPos.xy = (oldPos.xy+1.)/2.0;\n\nvec2 newPos = vCurrentPosition.xy;\n newPos /= vCurrentPosition.w;\n newPos.xy = (newPos.xy+1.)/2.0;\n\nvec2 velocity = (newPos - oldPos);\n\n// Discard fully transparent pixels \nif (gl_FragColor.a <= 0.0) discard;\n\ngVelocity = vec4(velocity, 0.0, 1.0);\n")),this}buildShader(t,e){this.resultCode[t]=e.build(this.setShader(t),"v4")}setMaterial(t,e){return this.defines={},this}addFlow(t,e,i){return this.addSlot(t).addCache(e).addContext(i)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(t){return this.cache=t??"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(t){return this.context=Object.assign({},this.context,t),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(t){return this.slot=t||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(t,e){void 0===this.fragmentVariables[t]&&(this.addFragmentCode(`${e} ${t};`),this.fragmentVariables[t]="")}addFragmentParsVariable(t,e){void 0===this.fragmentParsVariables[t]&&(this.addFragmentParsCode(`${e} ${t};`),this.fragmentParsVariables[t]="")}addVertexParsVariable(t,e){void 0===this.vertexParsVariables[t]&&(this.addVertexParsCode(`${e} ${t};`),this.vertexParsVariables[t]="")}addVertexCode(t){this.addCode(t,"vertex")}addFragmentCode(t){this.addCode(t,"fragment")}addCode(t,e){this.code[e??this.shader]+=t+"\n"}addVertexNodeCode(t){this.addNodeCode(t,"vertex")}addFragmentNodeCode(t){this.addNodeCode(t,"fragment")}addNodeCode(t,e){this.nodeCode[e??this.shader]+=t+"\n"}clearNodeCode(t){t=t??this.shader;let e=this.nodeCode[t];return this.nodeCode[t]="",e}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(t){this.addFinalCode(t,"vertex")}addFragmentFinalCode(t){this.addFinalCode(t,"fragment")}addFinalCode(t,e){this.finalCode[e??this.shader]+=t+"\n"}addVertexParsCode(t){this.addParsCode(t,"vertex")}addFragmentParsCode(t){this.addParsCode(t,"fragment")}addParsCode(t,e){this.parsCode[e??this.shader]+=t+"\n"}addVaryCode(t){this.addVertexParsCode(t),this.addFragmentParsCode(t)}isCache(t){return-1!==this.caches.indexOf(t)}isSlot(t){return-1!==this.slots.indexOf(t)}define(t,e){this.defines[t]=void 0===e?1:e}require(t){this.requires[t]=!0}isDefined(t){return void 0!==this.defines[t]}getVar(t,e,i,n="varying",r="V",s=""){let a=this.getVars(n),o=a[t];if(!o){let n=a.length;o={name:i||"node"+r+n+(s?"_"+s:""),type:e},a.push(o),a[t]=o}return o}getTempVar(t,e,i,n){return this.getVar(t,e,i,this.shader,"T",n)}getAttribute(t,e){if(!this.attributes[t]){let i=this.getVar(t,e);this.addVertexParsCode("attribute "+e+" "+t+";"),this.addVertexFinalCode(i.name+" = "+t+";"),this.attributes[t]={varying:i,name:t,type:e}}return this.attributes[t]}getCode(t){return[this.prefixCode,this.parsCode[t],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[t],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[t],"uniform"),this.getIncludesCode("consts",t),this.getIncludesCode("structs",t),this.getIncludesCode("functions",t),"void main() {",this.getVarListCode(this.getVars(t)),this.code[t],this.resultCode[t],this.finalCode[t],"}"].join("\n")}getVarListCode(t,e){e=e??"";let i="";for(let n=0,r=t.length;n<r;++n){let r=t[n],s=r.type,a=r.name,o=r.size,l=this.getFormatByType(s);if(void 0===l)throw new Error("Node pars "+l+" not found.");l.includes("[]")?i+=e+" "+l.substring(0,l.length-2)+" "+a+`[${o}];\n`:i+=e+" "+l+" "+a+";\n"}return i}getVars(t){return this.inputs.vars[t??this.shader]}getNodeData(t){let e=t instanceof tE?t.uuid:t;return this.nodeData[e]=this.nodeData[e]||{}}createUniform(t,e,i,n,r,s){if(e.includes("[]")){let a=this.inputs.arrayUniforms,o=a.list.length,l=new eE({type:e,size:i.size,name:n||"nodeUA"+o+(s?"_"+s:""),node:i,needsUpdate:r});return a.list.push(l),a[t].push(l),a[t][l.name]=l,this.uniforms[l.name]=l,l}{let a=this.inputs.uniforms,o=a.list.length,l=new eE({type:e,name:n||"nodeU"+o+(s?"_"+s:""),node:i,needsUpdate:r});return a.list.push(l),a[t].push(l),a[t][l.name]=l,this.uniforms[l.name]=l,l}}createVertexUniform(t,e,i,n,r){return this.createUniform("vertex",t,e,i,n,r)}createFragmentUniform(t,e,i,n,r){return this.createUniform("fragment",t,e,i,n,r)}include(t,e,i){let n;
vendor: 6,100 bytes, line 2
2if(t="string"==typeof t?iE.get(t):t,!1===this.context.include)return t.name;t instanceof dE?n=this.includes.functions:t instanceof fE?n=this.includes.consts:t instanceof vE&&(n=this.includes.structs);let r=n[this.shader]=n[this.shader]||[];if(t){let n=r[t.name];if(n||(n=r[t.name]={node:t,deps:[]},r.push(n),n.src=t.build(this,"source")),t instanceof dE&&e&&r[e.name]&&-1===r[e.name].deps.indexOf(t)&&(r[e.name].deps.push(t),t.includes?.length)){let i=0;do{this.include(t.includes[i++],e)}while(i<t.includes.length)}return i&&(n.src=i),t.name}throw new Error("Include not found.")}colorToVectorProperties(t){return t.replace("r","x").replace("g","y").replace("b","z").replace("a","w")}colorToVector(t){return t.replace(/c/g,"v3")}getIncludes(t,e){return this.includes[t][e||this.shader]}getConstructorFromLength(t){return kE[t-1]}isTypeMatrix(t){return/^m/.test(t)}getTypeLength(t){return"f"===t?1:parseInt(this.colorToVector(t).substr(1))}getTypeFromLength(t){return 1===t?"f":"v"+t}findNode(...t){for(let e=0;e<arguments.length;e++){let i=t[e];if(i?.isNode)return i}}resolve(...t){for(let e=0;e<arguments.length;e++){let i=t[e];if(void 0!==i){if(i.isNode)return i;if(i.isTexture)switch(i.mapping){case k:case V:return new NE(i);case j:return new FE(new SE(i));default:return new SE(i)}else{if(i.isVector2)return new sE(i);if(i.isVector3)return new aE(i);if(i.isVector4)return new lE(i)}}}}format(t,e,i){switch(this.colorToVector(i+" <- "+e)){case"f <- v2":case"f <- v3":case"f <- v4":return t+".x";case"f <- i":case"f <- b":return"float( "+t+" )";case"v2 <- f":return"vec2( "+t+" )";case"v2 <- v3":case"v2 <- v4":return t+".xy";case"v2 <- i":case"v2 <- b":case"v3 <- i":case"v3 <- b":return"vec2( float( "+t+" ) )";case"v3 <- f":return"vec3( "+t+" )";case"v3 <- v2":return"vec3( "+t+", 0.0 )";case"v3 <- v4":return t+".xyz";case"v4 <- f":return"vec4( "+t+" )";case"v4 <- v2":return"vec4( "+t+", 0.0, 1.0 )";case"v4 <- v3":return"vec4( "+t+", 1.0 )";case"v4 <- i":case"v4 <- b":return"vec4( float( "+t+" ) )";case"i <- f":case"i <- b":return"int( "+t+" )";case"i <- v2":case"i <- v3":case"i <- v4":return"int( "+t+".x )";case"b <- f":return"( "+t+" != 0.0 )";case"b <- v2":return"( "+t+" != vec2( 0.0 ) )";case"b <- v3":return"( "+t+" != vec3( 0.0 ) )";case"b <- v4":return"( "+t+" != vec4( 0.0 ) )";case"b <- i":return"( "+t+" != 0 )"}return t}getTypeByFormat(t){return VE[t]||t}getFormatByType(t){return jE[t]||t}getUUID(t,e){return(e=void 0===e||e)&&this.cache&&(t=this.cache+"-"+t),t}getElementByIndex(t){return UE[t]}getIndexByElement(t){return UE.indexOf(t)}isShader(t){return this.shader===t}setShader(t){return this.shader=t,this}mergeDefines(t){for(let e in t)this.defines[e]=t[e];return this.defines}mergeUniform(t){for(let e in t)this.uniforms[e]=t[e];return this.uniforms}getTextureEncodingFromMap(t){let e;return t?t.isTexture&&(e=t.encoding):e=wt,e===wt&&this.context.gamma&&(e=St),e}},WE=class extends rE{constructor(t=0,e,i,n){super("c"),this.nodeType="Color",this.value=t instanceof oE?t:new oE(t||0,e,i,n)}setRGBA(t){this.value.setRGBA(t.r,t.g,t.b,t.a)}generate(t,e,i,n,r,s){i=t.getUUID(i??this.getUUID()),n=n??this.getType(t);let a=t.getNodeData(i),o=this.getReadonly()&&void 0!==this.generateReadonly;if(this.alpha){let e=this.alpha.build(t,"f");t.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${e};`)}return o?this.generateReadonly(t,e,i,n,r,s):t.isShader("vertex")?(a.vertex||(a.vertex=t.createVertexUniform(n,this,r,s,this.getLabel())),t.format(a.vertex.name,n,e)):(a.fragment||(a.fragment=t.createFragmentUniform(n,this,r,s,this.getLabel())),t.format(a.fragment.name,n,e))}generateReadonly(t,e,i,n,r,s){return t.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",n,e)}},HE=class extends rE{constructor(t){super("i"),this.nodeType="Int",this.value=Math.floor(t??0)}generateReadonly(t,e,i,n,r,s){return t.format(this.value.toString(),n,e)}},qE=class extends rE{constructor(t){super("b"),this.nodeType="Bool",this.value=t??!1}generateReadonly(t,e,i,n){return t.format(this.value?"true":"false",n,e)}},XE=class extends rE{constructor(t=1,e){super("f[]"),this.nodeType="FloatArray",this.size=t,this.value=Array.isArray(e)?e:"number"==typeof e?new Array(t).fill(e):new Array(t).fill(0)}},YE=class extends rE{},QE=class extends YE{constructor(t){super("v3"),this.image=t,this._value=new be}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}},ZE=class extends YE{constructor(t,e,i=1008,n=1006){super("t"),this.image=t,this.wrap=e,this.minFilter=i,this.magFilter=n}get value(){return this.image.getTexture(this.wrap,this.minFilter,this.magFilter)}},KE=class extends rE{constructor(t){super("m3"),this.nodeType="Matrix3",this.value=t??new qt}generateReadonly(t,e,i,n,r,s){return t.format("mat3("+this.value.elements.join(", ")+")",n,e)}get elements(){return this.value.elements}set elements(t){this.value.fromArray(t)}},JE=class extends rE{constructor(t){super("m4"),this.nodeType="Matrix4",this.value=t??new Ze}generateReadonly(t,e,i,n,r,s){return t.format("mat4("+this.value.elements.join(", ")+")",n,e)}get elements(){return this.value.elements}set elements(t){this.value.fromArray(t)}};function $E(t,e,i,n=0){t.setUvTransform(i[0],i[1],e[0],e[1],0,0,0).premultiply((new qt).makeRotation(n*Wt.DEG2RAD))}var tP=class extends KE{constructor(t,e,i=0){super(new qt),this.repeat=t,this.offset=e,this.rotation=i,$E(this.value,t,e,i)}updateMatrix(){$E(this.value,this.repeat,this.offset,this.rotation)}},eP=class extends rE{constructor(t=1,e){super("v4[]"),this.nodeType="Vector4Array",this.size=t,this.value=Array.isArray(e)?e:e instanceof me?new Array(t).fill(e):new Array(t).fill(new me(0))}},iP=class extends nE{constructor(t,e,i,n){super("v3"),this.nodeType="Blend",this.a=t,this.b=e,this.alpha=i,this.mode=n}generate(t,e){if(t.isShader("fragment")){let i=[];return i.push(this.a.build(t,"c")),i.push(this.b.build(t,"c")),i.push(this.alpha.build(t,"f")),i.push(this.mode.build(t,"i")),t.format("spe_blend("
2+i.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},nP=class extends nE{constructor(t,e){super("v3"),this.nodeType="CustomColor",this.color=t,this.alpha=e,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.isShader("fragment")){let i=t.include(nP.Nodes.customColor);t.addFragmentVariable(this.calpha,"float");let n=[];return n.push(this.color.build(t,"v3")),n.push(this.mask?`luminance(${this.mask.build(t,"v3")})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},rP=nP;rP.Nodes={customColor:new dE("vec3 customColor(vec3 color, float mask, float alpha, out float calpha) {\n\t\t\t\tfloat lalpha = alpha * mask;\n\t\t\t\tcalpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha;\n\n\t\t\t\treturn color;\n\t\t\t}")};var sP=class extends nE{constructor(t,e){super("v3"),this.nodeType="CustomNormal",this.cnormal=t,this.alpha=e,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.isShader("fragment")){let i=t.include(sP.Nodes.customNormal);t.addFragmentVariable(this.calpha,"float");let n=[];return n.push(this.cnormal.build(t,"v3")),n.push("normal"),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},aP=sP;aP.Nodes={customNormal:new dE("vec3 customNormal(vec3 cnormal, vec3 norm, float mask, float alpha, out float calpha) {\n\t\t\t\tvec3 normal = packNormalToRGB( norm ).rgb;\n\t\t\t\tnormal *= step( vec3(0.5), cnormal );\n\n\t\t\t\tfloat lalpha = alpha * mask;\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\n\t\t\t\treturn normal;\n\t\t\t}")};var oP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h,c,d){super("v3"),this.nodeType="CustomTexture",this.texture=t,this.textureSize=e,this.crop=i,this.projection=n,this.axis=r,this.side=s,this.size=a,this.blending=o,this.mat=l,this.isMask=d,this.alpha=h,this.mode=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){t.require("position"),t.require("normal"),t.require("uv"),t.requires.uv=[!0],t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0;let i,n=`g${this.uuid.toString().replace(/-/g,"")}`;switch(this.projection.value){case 3:i=t.include(oP.Nodes.cylindrical);break;case 2:i=t.include(oP.Nodes.spherical);break;case 1:let e=["vec3(1.0, 0.0, 0.0)","vec3(0.0, 1.0, 0.0)","vec3(0.0, 0.0, 1.0)"][this.axis.value],r=["zy","xz","xy"][this.axis.value],s=new dE(`\n\t\tvec3 ${n}_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) {\n\t\t\t\tvec2 projected = (1. + (position.${r})) / 2.;\n\t\t\t\tvec2 uvs = ( mat * vec3( (projected * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n\t\t\t\tvec4 tmp = texture2D( tex, uvs );\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\t${2===this.side.value?"":`lalpha *= step(0.0, ${1===this.side.value?"-1.0 * ":""}dot(vObjectNormal, ${e}));`}\n\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlalpha *= mask;\n\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}`);i=t.include(s);break;case 4:i=t.include(oP.Nodes.triplanar);break;default:i=t.include(oP.Nodes.uv)}t.addFragmentVariable(this.calpha,"float");let r=[];if(r.push("normal"),r.push(this.texture.generate(t,"t")),r.push(this.textureSize.build(t,"v2")),r.push(this.crop.build(t,"f")),r.push(this.mat.build(t,"mat3")),r.push(this.size.build(t,"v2")),r.push(this.blending.build(t,"f")),r.push(this.isMask.build(t,"b")),r.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),r.push(this.alpha.build(t,"f")),r.push(this.mode.build(t,"i")),r.push(this.calpha),4===this.projection.value){let e=`${n}_writeUvs`,i=e+"0",s=e+"1",a=e+"2",o=`${n}_triplanarWeights`;t.addFragmentVariable(i,"vec2"),t.addFragmentVariable(s,"vec2"),t.addFragmentVariable(a,"vec2"),t.addFragmentVariable(o,"vec3"),r.push(i),r.push(s),r.push(a),r.push(o)}else{let e=`${n}_writeUvs`;t.addFragmentVariable(e,"vec2"),r.push(e)}return t.format(i+"("+r.join(",")+")",this.getType(t),e)}},lP=oP;
2lP.Nodes={cylindrical:new dE("\nvec3 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) {\n vec3 posN = normalize(position);\n float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);\n float scaledHeight = position.y / (size.y * 0.5);\n float v = (scaledHeight / 2.) + .5;\n\n vec2 calculatedUv = vec2(u,v);\n\t\t\t\tvec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n vec2 df = fwidth(uvs);\n \tif(df.x > 0.5) df.x = 0.;\n\n\t\t\t\t#ifdef GL_EXT_shader_texture_lod\n vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#else\n vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#endif\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlalpha *= mask;\n\t\t\t\t\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}\n"),spherical:new dE("\nvec3 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) {\n vec3 posN = normalize(vPosition);\n float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);\n float v = 0.5 + asin(posN.y) / 3.1415;\n\n vec2 calculatedUv = vec2(u,v);\n\t\t\t\tvec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n vec2 df = fwidth(uvs);\n \tif(df.x > 0.5) df.x = 0.;\n\t\t\t\t#ifdef GL_EXT_shader_texture_lod\n vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#else\n vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));\n\t\t\t\t#endif\n\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlalpha *= mask;\n\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}\n"),uv:new dE("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) {\n\t\t\t\tvec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;\n\t\t\t\twriteUv = uvs;\n\n\t\t\t\tvec4 tmp = texture2D( tex, uvs );\n\n\t\t\t\tvec3 col = tmp.rgb;\n\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tlalpha *= mask;\n\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;\n\t\t\t}"),triplanar:new dE("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) {\n\t\t\t\tvec3 p = position;\n\t\t\t\tvec2 uv0 = (1.0 + p.xy) / 2.0; \n\t\t\t\tvec2 uv1 = (1.0 + p.zy) / 2.0;\t\t\n\t\t\t\tvec2 uv2 = (1.0 + p.xz) / 2.0;\t\t\n\t\n\t\t\t\tuv0 = (mat * vec3((uv0 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;\n\t\t\t\tuv1 = (mat * vec3((uv1 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;\n\t\t\t\tuv2 = (mat * vec3((uv2 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;\n\n\t\t\t\t// Range from 3 to 128 seems to be good\n\t\t\t\tfloat exponent = (1.0 - blending) * 125.0 + 3.0;\n\n\t\t\t\tvec3 n = vObjectNormal;\n\t\t\t\tvec3 weights = abs(normalize(n));\n\t\t\t\tweights = pow(weights, vec3(exponent));\n\t\t\t\tweights /= dot(weights, vec3(1.0));\n\n\t\t\t\t// Write out all sets of UVs that we generated\n\t\t\t\twriteUvs0 = uv0;\n\t\t\t\twriteUvs1 = uv1;\n\t\t\t\twriteUvs2 = uv2;\n\t\t\t\twriteWeights = weights;\n\n\t\t\t\t// Derivatives for LOD\n\t\t\t\tvec2 df0 = fwidth(uv0);\n\t\t\t\tvec2 df1 = fwidth(uv1);\n\t\t\t\tvec2 df2 = fwidth(uv2);\n\t\t\t\tif (df0.x > 0.5) df0.x = 0.0;\n\t\t\t\tif (df1.x > 0.5) df1.x = 0.0;\n\t\t\t\tif (df2.x > 0.5) df2.x = 0.0;\n\n\t\t\t\t#ifdef GL_EXT_shader_texture_lod\n \tvec4 tmp = \n\t\t\t\t\t\ttexture2DLodEXT(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + \n\t\t\t\t\t\ttexture2DLodEXT(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + \n\t\t\t\t\t\ttexture2DLodEXT(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;\n\t\t\t\t#else\n \tvec4 tmp = \n\t\t\t\t\t\ttextureLod(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + \n\t\t\t\t\t\ttextureLod(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + \n\t\t\t\t\t\ttextureLod(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;\n\t\t\t\t#endif\n\n\t\t\t\tvec3 col = tmp.rgb;
2\n\t\t\t\tfloat lalpha = alpha * tmp.a;\n\n\t\t\t\t// Apply cropping across all 3 planes\n\t\t\t\tif ( crop > 0.5 ) {\n\t\t\t\t\tif ( uv0.x < 0.0 || uv0.x > 1.0 || uv0.y < 0.0 || uv0.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t\tif ( uv1.x < 0.0 || uv1.x > 1.0 || uv1.y < 0.0 || uv1.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t\tif ( uv2.x < 0.0 || uv2.x > 1.0 || uv2.y < 0.0 || uv2.y > 1.0 ) {\n\t\t\t\t\t\tlalpha = 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlalpha *= mask;\n\t\t\t\tcalpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn col;//n * 0.5 + 0.5;\n\t\t\t}\t\t\t\n\t\t\t")};var hP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h,c,d){super("v3"),this.nodeType="Depth",this.gradientType=t,this.smooth=e,this.near=i,this.far=n,this.isVector=r,this.isWorldSpace=s,this.origin=a,this.direction=o,this.colors=l,this.steps=h,this.isMask=d,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){let i=`g${this.uuid.toString().replace(/-/g,"")}`,n=new dE(`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) {\n vec4 color = colors[0];\n #ifdef ${i}_IS_VECTOR\n #ifdef ${i}_LINEAR\n #ifdef ${i}_WORLDSPACE\n float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far);\n #else\n float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far);\n #endif\n #else\n #ifdef ${i}_WORLDSPACE\n float depth = vectorSphericalWorldSpaceDepth(origin, near, far);\n #else\n float depth = vectorSphericalObjectSpaceDepth(origin, near, far);\n #endif\n #endif\n #else\n float dist = length(vWPosition - cameraPosition);\n\t\t\t float depth = ( dist - near ) / ( far - near );\n #endif\n\n\n float p;\n #ifdef ${i}_SMOOTH\n\t\t\t\tfor ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {\n\t\t\t\t\t\tp = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix(color, colors[i], smoothstep(0.0, 1.0, p));\n\t\t\t\t\t}\n #else\n for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {\n p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0);\n color = mix(color, colors[i], p);\n }\n #endif\n\n float lalpha = alpha * color.a * mask;\n calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\t\t\t \n return color.rgb;\n\t\t\t}`,[hP.Nodes.vectorLinearWorldSpaceDepth,hP.Nodes.vectorLinearObjectSpaceDepth,hP.Nodes.vectorSphericalObjectSpaceDepth,hP.Nodes.vectorSphericalWorldSpaceDepth]);if(t.isShader("fragment")){t.define(`${i}_MAX_COLORS`,this.colors.value.length),this.smooth.value&&t.define(`${i}_SMOOTH`),this.isVector.value>.5&&t.define(`${i}_IS_VECTOR`),0===this.gradientType.value&&t.define(`${i}_LINEAR`),this.isWorldSpace.value>.5&&t.define(`${i}_WORLDSPACE`),t.require("worldPosition"),t.addFragmentVariable(this.calpha,"float");let r=t.include(n),s=[];return s.push(this.near.build(t,"f")),s.push(this.far.build(t,"f")),s.push(this.origin.build(t,"v3")),s.push(this.direction.build(t,"v3")),s.push(this.colors.build(t,"v4[]")),s.push(this.steps.build(t,"f[]")),s.push(this.isMask.build(t,"b")),s.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),s.push(this.alpha.build(t,"f")),s.push(this.calpha),t.format(r+"("+s.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},cP=hP;
vendor: 5,165 bytes, line 2
2cP.Nodes={vectorLinearWorldSpaceDepth:new dE("float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {\n vec3 n = normalize(direction);\n float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));\n return ( dist - near ) / ( far - near );\n }"),vectorLinearObjectSpaceDepth:new dE("float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) {\n vec3 n = normalize(direction);\n float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z));\n return ( dist - near ) / ( far - near );\n }"),vectorSphericalWorldSpaceDepth:new dE("float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {\n float dist = length(vWPosition - origin);\n return ( dist - near ) / ( far - near );\n }"),vectorSphericalObjectSpaceDepth:new dE("float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {\n float dist = length(position - origin);\n return ( dist - near ) / ( far - near );\n }")};var dP=class extends nE{constructor(t,e,i,n,r,s,a,o){super("v3"),this.nodeType="Fresnel",this.color=t,this.bias=e,this.scale=i,this.intensity=n,this.factor=r,this.isMask=o,this.alpha=s,this.mode=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let i=new dE("vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, bool isMask, float mask, float alpha, int mode, out float calpha) {\n\t\t\t\t\tfloat fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );\n\n\t\t\t\t\tfloat lalpha = clamp(fresnel, 0.0, 1.0) * alpha * mask;\n\t\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\t\treturn color;\n\t\t\t\t}"),n=t.include(i),r=[];return r.push(this.color.build(t,"c")),r.push(this.bias.build(t,"f")),r.push(this.scale.build(t,"f")),r.push(this.intensity.build(t,"f")),r.push(this.factor.build(t,"f")),r.push(this.isMask.build(t,"b")),r.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),r.push(this.alpha.build(t,"f")),r.push(this.mode.build(t,"i")),r.push(this.calpha),t.format(n+"("+r.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},uP=class extends nE{constructor(t,e,i,n,r,s,a,o,l){super("v3"),this.nodeType="Gradient",this.gradientType=t,this.smooth=e,this.colors=i,this.steps=n,this.offset=r,this.morph=s,this.angle=a,this.isMask=l,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.isShader("fragment")){t.define("GRAD_MAX",10),t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let i=t.include(uP.Nodes.gradient),n=[];return n.push(this.gradientType.build(t,"i")),n.push(this.smooth.build(t,"b")),n.push(this.colors.build(t,"v4[]")),n.push(this.steps.build(t,"f[]")),n.push(this.offset.build(t,"v2")),n.push(this.morph.build(t,"v2")),n.push(this.angle.build(t,"f")),n.push(this.isMask.build(t,"b")),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},pP=uP;pP.Nodes={gradient:new dE("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) {\n\t\t\t\tvec4 color = colors[0];\n\t\t\t\tvec2 m = morph / vUv.xy;\n\t\t\t\tvec2 rot = vec2( 0.5 + m.x, m.y );\n\t\t\t\tvec2 dt = vec2(\n\t\t\t\t\tcos( angle ) * rot.x - sin( angle ) * rot.y,\n\t\t\t\t\tsin( angle ) * rot.x + cos( angle ) * rot.y\n\t\t\t\t);\n\t\t\t\tvec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;\n\t\t\t\tfloat t = dot( pt, dt ) / dot( dt, dt );\n\t\t\t\tif ( gradientType == 1 ) {\n\t\t\t\t\tt = distance (\n\t\t\t\t\t\t( vUv + morph ) * 3.0,\n\t\t\t\t\t\t( vUv + offset ) + 1.0\n\t\t\t\t\t) + angle;\n\t\t\t\t} else if ( gradientType == 2 ) {\n\t\t\t\t\tfloat polar = atan(\n\t\t\t\t\t\tvUv.x + morph.x - 0.5 + offset.x,\n\t\t\t\t\t\tvUv.y + morph.y - 0.5 + offset.y\n\t\t\t\t\t) * -1.0;\n\t\t\t\t\tt = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );\n\t\t\t\t}\n\n\t\t\t\tfloat p;\n\t\t\t\tif (smoothed) {\n\t\t\t\t\tfor ( int i = 1; i < GRAD_MAX; i++ ) {\n\t\t\t\t\t\tp = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix(color, colors[i], smoothstep(0.0, 1.0, p));\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tfor ( int i = 1; i < GRAD_MAX; i++ ) {\n\t\t\t\t\t\tp = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );\n\t\t\t\t\t\tcolor = mix(color, colors[i], p);\n\t\t\t\t\t}\n\t\t\t\t}
2\n\n\t\t\t\tfloat lalpha = alpha * color.a * mask;\n\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\t\t\t\t\n\t\t\t\treturn color.xyz;\n\t\t\t}")};var fP=class extends nE{constructor(t,e,i,n,r){super("v3"),this.nodeType="Matcap",this.texture=t,this.isMask=n,this.alpha=e,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`,this.rotation=r}generate(t,e){if(t.isShader("fragment")){t.addFragmentVariable(this.calpha,"float");let i=t.include(fP.Nodes.matcap);t.require("normal"),t.requires.normal=!0;let n=[];return n.push(this.texture.generate(t,"t")),n.push("normal"),n.push(this.isMask.build(t,"b")),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.mode.build(t,"i")),n.push(this.calpha),n.push(this.rotation.build(t,"f")),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},mP=fP;mP.Nodes={matcap:new dE("vec3 matcap(sampler2D matcapTex, vec3 normal, bool isMask, float mask, float alpha, int mode, out float calpha, float rotation) {\n\t\t\t\t\tvec3 viewDir = normalize( vViewPosition );\n\t\t\t\t\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\t\t\t\t\tvec3 y = cross( viewDir, x );\n\t\t\t\t\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) );\n\t\t\t\t\tuv = mat2( cos(rotation), sin(rotation), -sin(rotation), cos(rotation) ) * uv;\n\t\t\t\t\tuv = uv * 0.495 + 0.5;\n\t\t\t\t\tvec4 matcapColor = texture2D( matcapTex, uv );\n\n\t\t\t\t\tfloat lalpha = alpha * mask;\n\t\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\t\t\t\t\t\n\t\t\t\t\treturn matcapColor.rgb;\n \t}")};
2var gP=function(){let t=new dE("vec3 random3(vec3 c) {\n\t\t\tfloat j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));\n\t\t\tvec3 r;\n\t\t\tr.z = fract(512.0*j);\n\t\t\tj *= .125;\n\t\t\tr.x = fract(512.0*j);\n\t\t\tj *= .125;\n\t\t\tr.y = fract(512.0*j);\n\t\t\treturn r-0.5;\n\t\t}"),e=new dE("float simplexFast(vec3 p) {\n\t\t\t vec3 s = floor(p + dot(p, vec3(F3)));\n\t\t\t mediump vec3 x = p - s + dot(s, vec3(G3));\n\t\t\t mediump vec3 hs = s;\n\t\t\t \n\t\t\t mediump vec3 e = step(vec3(0.0), x - x.yzx);\n\t\t\t mediump vec3 i1 = e*(1.0 - e.zxy);\n\t\t\t mediump vec3 i2 = 1.0 - e.zxy*(1.0 - e);\n\t\t\t\t\n\t\t\t mediump vec3 x1 = x - i1 + G3;\n\t\t\t mediump vec3 x2 = x - i2 + 2.0*G3;\n\t\t\t mediump vec3 x3 = x - 1.0 + 3.0*G3;\n\t\t\t \n\t\t\t mediump vec4 w, d;\n\t\t\t \n\t\t\t w.x = dot(x, x);\n\t\t\t w.y = dot(x1, x1);\n\t\t\t w.z = dot(x2, x2);\n\t\t\t w.w = dot(x3, x3);\n\t\t\t \n\t\t\t w = max(0.6 - w, 0.0);\n\t\t\t \n\t\t\t d.x = dot(random3(hs), x);\n\t\t\t d.y = dot(random3(hs + i1), x1);\n\t\t\t d.z = dot(random3(hs + i2), x2);\n\t\t\t d.w = dot(random3(hs + 1.0), x3);\n\t\t\t \n\t\t\t w *= w;\n\t\t\t w *= w;\n\t\t\t d *= w;\n\t\t\t \n\t\t\t return dot(d, vec4(52.0));\n\t\t}",[t]);e.keywords.F3=new fE("float F3 0.3333333"),e.keywords.G3=new fE("float G3 0.1666667");let i=new dE("float simplexPrecise(vec3 p) {\n\t\t\t vec3 s = floor(p + dot(p, vec3(F3)));\n\t\t\t vec3 x = p - s + dot(s, vec3(G3));\n\t\t\t \n\t\t\t vec3 e = step(vec3(0.0), x - x.yzx);\n\t\t\t vec3 i1 = e*(1.0 - e.zxy);\n\t\t\t vec3 i2 = 1.0 - e.zxy*(1.0 - e);\n\t\t\t\t\n\t\t\t vec3 x1 = x - i1 + G3;\n\t\t\t vec3 x2 = x - i2 + 2.0*G3;\n\t\t\t vec3 x3 = x - 1.0 + 3.0*G3;\n\t\t\t \n\t\t\t vec4 w, d;\n\t\t\t \n\t\t\t w.x = dot(x, x);\n\t\t\t w.y = dot(x1, x1);\n\t\t\t w.z = dot(x2, x2);\n\t\t\t w.w = dot(x3, x3);\n\t\t\t \n\t\t\t w = max(0.6 - w, 0.0);\n\t\t\t \n\t\t\t d.x = dot(random3(s), x);\n\t\t\t d.y = dot(random3(s + i1), x1);\n\t\t\t d.z = dot(random3(s + i2), x2);\n\t\t\t d.w = dot(random3(s + 1.0), x3);\n\t\t\t \n\t\t\t w *= w;\n\t\t\t w *= w;\n\t\t\t d *= w;\n\t\t\t \n\t\t\t return dot(d, vec4(52.0));\n\t\t}",[t]);i.keywords.F3=new fE("float F3 0.3333333"),i.keywords.G3=new fE("float G3 0.1666667");let n=new dE("float simplexFractal(vec3 m) {\n\t\t\tmat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);\n\t\t\tmat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);\n\t\t\tmat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);\n\t\t\treturn 0.5333333 * simplexFast(m * rot1)\n\t\t\t\t + 0.2666667 * simplexFast(2.0 * m * rot2)\n\t\t\t\t + 0.1333333 * simplexFast(4.0 * m * rot3)\n\t\t\t\t + 0.0666667 * simplexFast(8.0 * m);\n\t\t}",[e]),r=new dE("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),s=new dE("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),a=new dE("float simplexAshima(vec3 v) {\n\t\t const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n\t\t const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\t\t vec3 i = floor(v + dot(v, C.yyy) );\n\t\t vec3 x0 = v - i + dot(i, C.xxx) ;\n\t\t vec3 g = step(x0.yzx, x0.xyz);\n\t\t vec3 l = 1.0 - g;\n\t\t vec3 i1 = min( g.xyz, l.zxy );\n\t\t vec3 i2 = max( g.xyz, l.zxy );\n\t\t vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n\t\t vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n\t\t vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n\t\t i = mod(i, 289.0 ); \n\t\t vec4 p = permute( permute( permute( \n\t\t\t\t\t i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n\t\t\t\t + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) \n\t\t\t\t + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\t\t float n_ = 1.0/7.0; // N=7\n\t\t vec3 ns = n_ * D.wyz - D.xzx;\n\t\t vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)\n\t\t vec4 x_ = floor(j * ns.z);\n\t\t vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\t\t vec4 x = x_ *ns.x + ns.yyyy;\n\t\t vec4 y = y_ *ns.x + ns.yyyy;\n\t\t vec4 h = 1.0 - abs(x) - abs(y);\n\t\t vec4 b0 = vec4( x.xy, y.xy );\n\t\t vec4 b1 = vec4( x.zw, y.zw );\n\t\t vec4 s0 = floor(b0)*2.0 + 1.0;\n\t\t vec4 s1 = floor(b1)*2.0 + 1.0;\n\t\t vec4 sh = -step(h, vec4(0.0));\n\t\t vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n\t\t vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\t\t vec3 p0 = vec3(a0.xy,h.x);\n\t\t vec3 p1 = vec3(a0.zw,h.y);\n\t\t vec3 p2 = vec3(a1.xy,h.z);\n\t\t vec3 p3 = vec3(a1.zw,h.w);\n\t\t vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n\t\t p0 *= norm.x;\n\t\t p1 *= norm.y;\n\t\t p2 *= norm.z;\n\t\t p3 *= norm.w;\n\t\t vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n\t\t m = m * m;
2\n\t\t return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), \n\t\t\t\t\t\t\t\t\t\tdot(p2,x2), dot(p3,x3) ) );\n\t\t}",[r,s]),o=new dE("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),l=new dE("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[o]),h=new dE("float noise(vec3 p){\n\t\t\tvec3 a = floor(p);\n\t\t\tvec3 d = p - a;\n\t\t\td = d * d * (3.0 - 2.0 * d);\n\t\t\tvec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);\n\t\t\tvec4 k1 = perm(b.xyxy);\n\t\t\tvec4 k2 = perm(k1.xyxy + b.zzww);\n\t\t\tvec4 c = k2 + a.zzzz;\n\t\t\tvec4 k3 = perm(c);\n\t\t\tvec4 k4 = perm(c + 1.0);\n\t\t\tvec4 o1 = fract(k3 * (1.0 / 41.0));\n\t\t\tvec4 o2 = fract(k4 * (1.0 / 41.0));\n\t\t\tvec4 o3 = o2 * d.z + o1 * (1.0 - d.z);\n\t\t\tvec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);\n\t\t\treturn o4.y * d.y + o4.x * (1.0 - d.y);\n\t\t}",[l]),c=new dE("float fbm(vec3 x) {\n\t\t\tfloat v = 0.0;\n\t\t\tfloat a = 0.5;\n\t\t\tvec3 shift = vec3(100);\n\t\t\tfor (int i = 0; i < NUM_OCTAVES; ++i) {\n\t\t\t\tv += a * noise(x);\n\t\t\t\tx = x * 2.0 + shift;\n\t\t\t\ta *= 0.5;\n\t\t\t}\n\t\t\treturn v;
2\n\t\t}",[h]);c.keywords.NUM_OCTAVES=new fE("int NUM_OCTAVES 5");let d=new dE("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),u=new dE("float perlin(vec3 P){\n\t\t vec3 Pi0 = floor(P);\n\t\t vec3 Pi1 = Pi0 + vec3(1.0);\n\t\t Pi0 = mod(Pi0, 289.0);\n\t\t Pi1 = mod(Pi1, 289.0);\n\t\t vec3 Pf0 = fract(P);\n\t\t vec3 Pf1 = Pf0 - vec3(1.0);\n\t\t vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n\t\t vec4 iy = vec4(Pi0.yy, Pi1.yy);\n\t\t vec4 iz0 = Pi0.zzzz;\n\t\t vec4 iz1 = Pi1.zzzz;\n\t\t vec4 ixy = permute(permute(ix) + iy);\n\t\t vec4 ixy0 = permute(ixy + iz0);\n\t\t vec4 ixy1 = permute(ixy + iz1);\n\t\t vec4 gx0 = ixy0 / 7.0;\n\t\t vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;\n\t\t gx0 = fract(gx0);\n\t\t vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n\t\t vec4 sz0 = step(gz0, vec4(0.0));\n\t\t gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n\t\t gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\t\t vec4 gx1 = ixy1 / 7.0;\n\t\t vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;\n\t\t gx1 = fract(gx1);\n\t\t vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n\t\t vec4 sz1 = step(gz1, vec4(0.0));\n\t\t gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n\t\t gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\t\t vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n\t\t vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n\t\t vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n\t\t vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n\t\t vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n\t\t vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n\t\t vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n\t\t vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\t\t vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n\t\t g000 *= norm0.x;\n\t\t g010 *= norm0.y;\n\t\t g100 *= norm0.z;\n\t\t g110 *= norm0.w;\n\t\t vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n\t\t g001 *= norm1.x;\n\t\t g011 *= norm1.y;\n\t\t g101 *= norm1.z;\n\t\t g111 *= norm1.w;\n\t\t float n000 = dot(g000, Pf0);\n\t\t float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n\t\t float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n\t\t float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n\t\t float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n\t\t float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n\t\t float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n\t\t float n111 = dot(g111, Pf1);\n\t\t vec3 fade_xyz = fade(Pf0);\n\t\t vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n\t\t vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n\t\t float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); \n\t\t return 2.2 * n_xyz;\n\t\t}",[r,s,d]),p=new dE("float hashwithoutsine13(vec3 p3)\n\t\t{\n\t\t\tp3 = fract(p3 * .1031);\n\t\t\tp3 += dot(p3, p3.yzx + 33.33);\n\t\t\treturn fract((p3.x + p3.y) * p3.z);\n\t\t}"),f=new dE("vec3 hashwithoutsine33(vec3 p3)\n\t\t{\n\t\t\tp3 = fract(p3 * vec3(.1031, .1030, .0973));\n\t\t\tp3 += dot(p3, p3.yxz+33.33);\n\t\t\treturn fract((p3.xxy + p3.yxx)*p3.zyx);\n\t\t}"),m=new dE("float metric(in vec3 p)\n\t\t{\n\t\t\t// L2 \n\t\t\treturn length(p);\n\n\t\t\t// Chebyshev \n\t\t\t// vec3 a = abs(p);\n\t\t\t// return max(a.x, max(a.y, a.z));\n\t\t}"),g=new dE("float smin( float a, float b, float k )\n\t\t{\n\t\t\tfloat h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (b - a) / k);\n\t\t\tfloat correction = k * h * (1.0 - h);\n\t\t\treturn mix(b, a, h) - correction;\n\t\t}"),v=new dE("float smax( float a, float b, float k )\n\t\t{\n\t\t\tfloat h = smoothstep(1.0, 0.0, 0.5 + 0.5 * (a - b) / k);\n\t\t\tfloat correction = k * h * (1.0 - h);\n\t\t\treturn mix(a, b, h) + correction;\n\t\t}"),y=new dE("float remap(float value, float input_min, float input_max, float output_min, float output_max) {\n\t\t\t// Compute width of each interval\n\t\t\tfloat input_width = input_max - input_min;\n\t\t\tfloat output_width = output_max - output_min;\n\t\t\n\t\t\t// Convert input range into a 0-1 range \n\t\t\tfloat scaled = (value - input_min) / input_width;\n\t\t\n\t\t\t// Convert the 0-1 range into a value in output range\n\t\t\treturn output_min + (scaled * output_width);\n\t\t}");
2return{simplexFast:e,simplexPrecise:i,simplexFractal:n,simplexAshima:a,fbm:c,perlin:u,voronoi:new dE('float voronoi(in vec3 x, in int style, in float smoothness, in float seed, in int quality) \n\t\t{\n\t\t\t// Integer and fractional parts of this point\'s coordinates\n\t\t\tivec3 p = ivec3(floor(x));\n\t\t\tvec3 f = fract(x);\n\n\t\t\t// Different variables that we will use to construct noise:\n\t\t\t//\n\t\t\t// f1: distance to the closest feature point\n\t\t\t// f2: distance to the second closest feature point\n\t\t\t// e: distance to the closest edge (cell boundary)\n\t\t\t//\n\t\t\t// We also compute "smooth" versions of all of the above quantites, essentially\n\t\t\t// replacing "hard" minimums with "smooth" minimums (described by IQ)\n\t\t\tfloat f1_smooth = 8.0;\n\t\t\tfloat f1 = 8.0;\n\t\t\tfloat f2_smooth = 8.0;\n\t\t\tfloat f2 = 8.0;\n\t\t\tfloat e_smooth = 8.0;\n\t\t\tfloat e = 8.0;\n\n\t\t\t// Variables stored from closest cell\n\t\t\tivec3 mb;\n\t\t\tvec3 mr; \n\n\t\t\tint steps = quality;\n\t\t\t\n\t\t\tfor (int x = -steps; x <= steps; x++) \n\t\t\tfor (int y = -steps; y <= steps; y++)\n\t\t\tfor (int z = -steps; z <= steps; z++)\n\t\t\t{\n\t\t\t\tivec3 b = ivec3(x, y, z);\n\t\t\t\tvec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;\n\t\t\t\tfloat d = length(r);\n\t\t\t\t\n\t\t\t\tf1_smooth = smin(d, f1_smooth, smoothness);\n\n\t\t\t\t// Store un-smoothed distances too \n\t\t\t\tif (d < f1) \n\t\t\t\t{\n\t\t\t\t\tf2 = f1;\n\t\t\t\t\tf1 = d;\n\n\t\t\t\t\tmb = ivec3(x, y, z);\n\t\t\t\t\tmr = r;\n\t\t\t\t} \n\t\t\t\telse if (d < f2) \n\t\t\t\t{\n\t\t\t\t\tf2 = d;\n\t\t\t\t}\n\t\t\t}\t\n\t\t\t\n\t\t\t// Second pass for edge distance \n\t\t\t// skip for styles don\'t need\n\t\t\tif (style != 0 && style != 5 && style != 7)\n\t\t\tfor (int x = -steps; x <= steps; x++) \n\t\t\tfor (int y = -steps; y <= steps; y++)\n\t\t\tfor (int z = -steps; z <= steps; z++)\n\t\t\t{\n\t\t\t\t// Start search at the cell that contains the closest point to "x" (found in 1st pass)\n\t\t\t\tivec3 b = mb + ivec3(x, y, z);\n\t\t\t\tvec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;\n\t\t\t\tfloat d1 = dot(0.5 * (mr + r), (r - mr)); \t\t\t\t// IQ normalizes "r - mr" but that breaks things for the smooth version?\n\t\t\t\tfloat d2 = dot(0.5 * (mr + r), normalize(r - mr));\n\n\t\t\t\te_smooth = smin(d1, e_smooth, smoothness);\n\n\t\t\t\te = min(e, d2);\n\n\t\t\t\t// Also compute a smooth version of F2 in this pass\n\t\t\t\t{\n\t\t\t\t\tivec3 b = ivec3(x, y, z);\n\t\t\t\t\tif (b != mb) \n\t\t\t\t\t{\n\t\t\t\t\t\tvec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;\n\t\t\t\t\t\tfloat d = length(r);\n\n\t\t\t\t\t\tf2_smooth = smin(d, f2_smooth, smoothness);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Different visualization modes \n\t\t\tif (style == 0) \n\t\t\t{\n\t\t\t\treturn f1_smooth;\n\t\t\t}\n\t\t\tif (style == 1) \n\t\t\t{\n\t\t\t\treturn f2_smooth;\n\t\t\t}\n\t\t\tif (style == 2) \n\t\t\t{\n\t\t\t\treturn f2_smooth - f1_smooth;\n\t\t\t\t\n\t\t\t\t// "Pebbles" also cool\n\t\t\t\t//return step(0.2, f2_smooth - f1_smooth);\n\t\t\t}\n\t\t\tif (style == 3) \n\t\t\t{\n\t\t\t\t// This one is really good for rock / stone effects\n\t\t\t\tfloat a = f1; \n\t\t\t\tfloat b = f2;\n\t\t\t\tfloat k = 3.0;\n\t\t\t\tfloat h = max(k - abs(a - b), 0.0) / k;\n\t\t\t\tfloat final = min(a, b) - h * h * k * (1.0 / 4.0);\n\t\t\t\treturn final;\n\t\t\t}\n\t\t\tif (style == 4) \n\t\t\t{\n\t\t\t\t// Some random adjustments to make this style stand out more \n\t\t\t\treturn exp(5.0 * e_smooth);\n\t\t\t}\n\t\t\tif (style == 5) \n\t\t\t{\n\t\t\t\treturn pow(f1_smooth, 3.0);\n\t\t\t}\n\t\t\tif (style == 6) \n\t\t\t{\t\t\t\t\n\t\t\t\tconst float eps = 0.0125;\n\n\t\t\t\t// Thicker lines as the user increases the smoothness slider\n\t\t\t\tfloat thickness = smoothness * 0.25 + eps;\n\n\t\t\t\t// Blurrier lines as the user increases the smoothness slider\n\t\t\t\tfloat blur = pow(smoothness, 3.0) * 0.25 + eps;\n\n\t\t\t\treturn smoothstep(\n\t\t\t\t\tthickness - thickness * blur, \n\t\t\t\t\tthickness + thickness * blur, \n\t\t\t\t\te\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (style == 7) \n\t\t\t{\n\t\t\t\treturn hashwithoutsine13(vec3(p + mb) + seed);\n\t\t\t}\n\t\t}\n\t',[p,f,m,g,v,y])}}(),vP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h,c,d,u,p,f,m,g,v,y){super("v3"),this.nodeType="Noise",this.scale=t,this.size=e,this.move=i,this.fA=n,this.fB=r,this.distortion=s,this.colorA=a,this.colorB=o,this.colorC=l,this.colorD=h,this.noiseType=d,this.voronoiStyle=p,this.highCut=f,this.lowCut=m,this.smoothness=g,this.seed=v,this.qual
vendor: 6,948 bytes, line 2
2ity=y,this.isMask=u,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e,i,n,r){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let s=["simplexFast","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseType.value],a=new dE(`vec3 ${s}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) \n\t\t\t{\n // Prevent scale of zero \n\t\t\t\tscale = max(abs(scale), 0.001);\n\n\t\t\t\tvec3 st = position / size;\n\t\t\t\tst /= scale;\n\n\t\t\t\t${"voronoi"==s?`\n\t\tfloat v = ${s}(st + move, voronoiStyle, smoothness, seed, quality);\n\n\t\t// Apply clipping to colors\n\t\tv = remap(v, lowCut, highCut, 0.0, 1.0);\n\t\tv = smax(v, 0.0, smoothness * 0.25);\n\t\tv = smin(v, 1.0, smoothness * 0.25);\n\n\t\t// Note that the voronoi mode only uses colors "A" and "C" from the UI \n\t\tvec4 color = mix(colorA, colorC, v); \n\t\t`:`\n\t\tvec3 q = vec3(${s}(st),\n\t\t\t\t\t ${s}(st + vec3(1.0)),\n\t\t\t\t\t ${s}(st + vec3(1.0)));\n\t\tvec3 r = vec3(${s}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),\n\t\t\t\t\t ${s}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), \n\t\t\t\t\t ${s}(st * q));\n\t\tfloat f = ${s}(st + r);\n\t\tvec4 color;\n\t\tcolor = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0));\n\t\tcolor = mix(color, colorC, clamp(length(q), 0.0, 1.0));\n\t\tcolor = mix(color, colorD, clamp(length(r.x), 0.0, 1.0));\n\t\t`}\n\n\t\t\t\tfloat lalpha = alpha * color.a * mask;\n\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn clamp(color, 0.0, 1.0).rgb;\n\t\t\t}`,[gP.simplexFast,gP.simplexFractal,gP.simplexAshima,gP.fbm,gP.perlin,gP.voronoi]),o=t.include(a),l=[];return l.push(this.scale.build(t,"f")),l.push(this.size.build(t,"v3")),l.push(this.move.build(t,"f")),l.push(this.fA.build(t,"v2")),l.push(this.fB.build(t,"v2")),l.push(this.distortion.build(t,"v2")),l.push(this.colorA.build(t,"v4")),l.push(this.colorB.build(t,"v4")),l.push(this.colorC.build(t,"v4")),l.push(this.colorD.build(t,"v4")),l.push(this.voronoiStyle.build(t,"i")),l.push(this.highCut.build(t,"f")),l.push(this.lowCut.build(t,"f")),l.push(this.smoothness.build(t,"f")),l.push(this.seed.build(t,"f")),l.push(this.quality.build(t,"i")),l.push(this.isMask.build(t,"b")),l.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),l.push(this.alpha.build(t,"f")),l.push(this.calpha),t.format(o+"("+l.join(",")+")",this.getType(t),e)}};vP.numOctaves=5;var yP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h,c,d,u,p,f,m){super("v3"),this.nodeType="Outline",this.firstTime=!0,this.outlineColor=t,this.contourColor=e,this.outlineWidth=i,this.contourWidth=n,this.contourThreshold=r,this.outlineThreshold=s,this.contourFrequency=a,this.outlineSmoothing=o,this.contourDirection=l,this.positionalLines=h,this.compensation=c,this.resolution=d,this.normalMap=u,this.depthMap=p,this.pixelRatio=f,this.alpha=m,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){let i=`g${this.uuid.toString().replace(/-/g,"")}`;if(t.require("vWorldViewDir"),t.require("worldNormal"),t.extensions.derivatives=!0,this.compensation.value&&t.define("OUTLINE_COMPENSATION",`${i}_offset`),this.firstTime){let e=this.outlineWidth.build(t,"f"),n=this.resolution.build(t,"v2"),r=this.compensation.build(t,"b"),s=this.pixelRatio.build(t,"f");t.addVertexParsVariable("randomColor","attribute vec3"),t.addVertexParsVariable("extrudeNormal","attribute vec3"),t.addVertexParsVariable(e,"uniform float"),t.addVertexParsVariable(n,"uniform vec2"),t.addVertexParsVariable(r,"uniform bool"),t.addVertexParsVariable(s,"uniform float"),t.addVertexParsVariable("vID","flat out float"),t.addFragmentParsVariable("vID","flat in float"),t.addVertexFinalCode(`\n vID = randomColor.r;\n vec2 ${i}_offset = vec2(0.0);\n if (${r}) {\n vec4 ${i}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0));\n // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the\n // normals face the camera directly. So we hackily fix this by offsetting the normal\n // by a tiny amount.\n vec3 ${i}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001;\n ${i}_offset = normalize(${i}_clipNormal.xy) / ${n} * (${e} / 2.0) * ${i}_clipPosition.w * 2.0 * ${s};\n ${i}_clipPosition.xy += ${i}_offset;\n // TODO(MAX): To handle multiple outline layers, we only want to extrude\n // if this offset is the biggest of all the potential offsets\n gl_Position = ${i}_clipPosition;\n }\n `)}if(t.isShader("fragment")){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let i=t.include(yP.Nodes.outline),n=[];return n.push(this.outlineColor.build(t,"c")),n.push(this.contourColor.build(t,"c")),n.push(this.outlineWidth.build(t,"f")),n.push(this.contourWidth.build(t,"f")),n.push(this.contourThreshold.build(t,"f")),n.push(this.outlineThreshold.build(t,"f")),n.push(this.contourFrequency.build(t,"f")),n.push(this.outlineSmoothing.build(t,"f")),n.push(this.contourDirection.build(t,"v3")),n.push(this.positionalLines.build(t,"b")),n.push(this.resolution.build(t,"v2")),n.push(this.normalMap.getTexture(t,"t")),n.push(this.depthMap.getTexture(t,"t")),n.push(this.pixelRatio.build(t,"f")),n.push(this.compensation.build(t,"b")),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),this.firstTime=!this.firstTime,t.format(i+"("+n.join(",")+")",this.getType(t),e)}return""}},xP=yP;xP.Nodes=function(){let t=new dE("\nfloat sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio)\n{\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\n vec2 texelSize = (vec2(1.0) / resolution);\n vec2 offsetSize = texelSize * outlineWidth * pixelRatio;\n\n vec2 uvSamples[9];\n vec4 normalSamples[9];\n\n\tuvSamples[0] = uv + vec2( -offsetSize.x, -offsetSize.y) + (vogelDiskSample(0, 9, temporalAngle) * texelSize);\n\tuvSamples[1] = uv + vec2(0.0, -offsetSize.y) + (vogelDiskSample(1, 9, temporalAngle) * texelSize);\n\tuvSamples[2] = uv + vec2( offsetSize.x, -offsetSize.y) + (vogelDiskSample(2, 9, temporalAngle) * texelSize);
2\n\tuvSamples[3] = uv + vec2( -offsetSize.x, 0.0) + (vogelDiskSample(3, 9, temporalAngle) * texelSize);\n\tuvSamples[4] = uv;\n\tuvSamples[5] = uv + vec2( offsetSize.x, 0.0) + (vogelDiskSample(5, 9, temporalAngle) * texelSize);\n\tuvSamples[6] = uv + vec2( -offsetSize.x, offsetSize.y) + (vogelDiskSample(6, 9, temporalAngle) * texelSize);\n\tuvSamples[7] = uv + vec2(0.0, offsetSize.y) + (vogelDiskSample(7, 9, temporalAngle) * texelSize);\n\tuvSamples[8] = uv + vec2( offsetSize.x, offsetSize.y) + (vogelDiskSample(8, 9, temporalAngle) * texelSize);\n\n\n normalSamples[0] = texture2D(t, uvSamples[0]);\n normalSamples[1] = texture2D(t, uvSamples[1]);\n normalSamples[2] = texture2D(t, uvSamples[2]);\n normalSamples[3] = texture2D(t, uvSamples[3]);\n normalSamples[4] = texture2D(t, uvSamples[4]);\n normalSamples[5] = texture2D(t, uvSamples[5]);\n normalSamples[6] = texture2D(t, uvSamples[6]);\n normalSamples[7] = texture2D(t, uvSamples[7]);\n normalSamples[8] = texture2D(t, uvSamples[8]);\n\n float depthBias = 0.0001;\n // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?!\n if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n\n if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) {\n float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias;\n if (gl_FragCoord.z > depthAtSample) {\n return 0.0;\n }\n }\n\n 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);\n \tvec3 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);\n\n float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v));\n return edgeNormal;\n}\n");return{outline:new dE("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) {\n vec3 result = outlineColor;\n float resultAlpha = 0.0;\n\n vec3 N = normalize(vWNormal);\n vec2 nuv = (gl_FragCoord.xy / resolution);\n float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio);\n resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample);\n\n //resultAlpha = 1.0;\n //result = vec3(sobelSample);\n\n float t = 1.0 - contourThreshold;\n if(positionalLines) {\n vec3 NDir = position * contourDirection;\n float NT = NDir.x + NDir.y + NDir.z;\n float f = fract(NT * contourFrequency * 0.01);\n float df = fwidth(NT * contourFrequency);\n\n float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f);\n if (g < 1.0 && resultAlpha == 0.0) {\n result = contourColor;\n resultAlpha = 1.0;\n }\n }\n else {\n vec3 NDir = N * contourDirection;\n float NT = NDir.x + NDir.y + NDir.z;\n float df = fwidth(NT * contourThreshold);\n float f = sin(NT * 1.0 * contourFrequency);\n float g = smoothstep(0.0, df * contourWidth, 1.0 - f);\n\n if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) {\n result = contourColor;\n resultAlpha = 1.0 - g;\n }\n }
2\n\n float lalpha = alpha * resultAlpha * mask;\n calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n accumAlpha += ( 1.0 - accumAlpha ) * lalpha;\n\t\t\t\t \n return result;\n }",[t])}}();var bP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h,c,d,u,p,f,m,g,v){super("v3"),this.nodeType="Pattern",this.style=t,this.projection=e,this.axis=i,this.blending=n,this.offset=r,this.colorA=s,this.colorB=a,this.frequency=o,this.size=l,this.variation=h,this.smoothness=c,this.zigzag=d,this.rotation=u,this.vertical=p,this.horizontal=f,this.sides=m,this.isMask=v,this.alpha=g,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.isShader("fragment")){let i;switch(t.require("position"),t.require("uv"),t.requires.uv=[!0],t.require("normal"),t.requires.normal=!0,t.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 n=`g${this.uuid.toString().replace(/-/g,"")}`,r=new dE("float hashwithoutsine12(vec2 p)\n\t\t\t\t{\n\t\t\t\t\tvec3 p3 = fract(vec3(p.xyx) * .1031);\n\t\t\t\t\tp3 += dot(p3, p3.yzx + 33.33);\n\t\t\t\t\treturn fract((p3.x + p3.y) * p3.z);\n\t\t\t\t}"),s=new dE("vec2 rotate_uv(in vec2 uv, float a, bool repeat) \n\t\t\t\t{\n\t\t\t\t\tconst float mid = 0.5;\n\t\t\t\t\tfloat radians = a * (PI / 180.0);\n\t\t\t\t\tvec2 rotated = vec2(\n\t\t\t\t\t\tcos(radians) * (uv.x - mid) + sin(radians) * (uv.y - mid) + mid,\n\t\t\t\t\t\tcos(radians) * (uv.y - mid) - sin(radians) * (uv.x - mid) + mid\n\t\t\t\t\t);\n\t\t\t\t\treturn repeat ? fract(rotated): rotated;\n\t\t\t\t}"),a="";if(4===this.projection.value){a=`\n\t\t\t\tvec3 p = position;\n\t\t\t\tfloat factor = 0.0125;\n\t\t\t\tvec2 uv0 = fract(p.xy * factor);\n\t\t\t\tvec2 uv1 = fract(p.zy * factor);\n\t\t\t\tvec2 uv2 = fract(p.xz * factor);\n\t\t\t\t\n\t\t\t\tuv0 = rotate_uv(uv0 + offset, rotation, true);\n\t\t\t\tuv1 = rotate_uv(uv1 + offset, rotation, true);\n\t\t\t\tuv2 = rotate_uv(uv2 + offset, rotation, true);\n\t\n\t\t\t\tfloat d0 = ${2===this.style.value?`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation)`};\n\t\t\t\tfloat d1 = ${2===this.style.value?`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)`};\n\t\t\t\tfloat d2 = ${2===this.style.value?`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)`};\n\t\t\t\t\n\t\t\t\t// Range from 3 to 128 seems to be good\n\t\t\t\tfloat exponent = (1.0 - blending) * 125.0 + 3.0;\n\n\t\t\t\tvec3 n = vObjectNormal;\n\t\t\t\tvec3 weights = abs(normalize(n));\n\t\t\t\tweights = pow(weights, vec3(exponent));\n\t\t\t\tweights /= dot(weights, vec3(1.0));\n\t\t\t\td0 *= weights.z;\n\t\t\t\td1 *= weights.x;\n\t\t\t\td2 *= weights.y;\n\t\t\t\tfloat draw = d0 + d1 + d2;\n\t\n\t\t\t\tvec2 custom_uv = uv0 * weights.z + uv1 * weights.x + uv2 * weights.y;\n\t\t\t\t`}else{let t=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)`,e="";0===this.axis.value?e="float radius = length(p);\n\t\t\t\t\tfloat theta = atan(p.y, p.z);\n\t\t\t\t\tfloat phi = acos(p.x / radius);":1===this.axis.value?e="float radius = length(p);\n\t\t\t\t\tfloat theta = atan(p.x, p.z);\n\t\t\t\t\tfloat phi = acos(p.y / radius);":(this.axis.value,e="float radius = length(p);\n\t\t\t\t\tfloat theta = atan(p.y, p.x);\n\t\t\t\t\tfloat phi = acos(p.z / radius);");let n="";switch(this.projection.value){case 0:n="custom_uv = vUv.st;";break;case 1:break;case 2:n=`\n\t\t\t\t\t\t\tvec3 p = position;\n\t\t\t\t\t\t\t${e}\n\t\t\t\t\t\t\tcustom_uv = vec2(theta, phi);\n\t\t\t\t\t\t\tcustom_uv /= PI;\n\t\t\t\t\t\t\t`}a=`\n\t\t\t\tvec2 custom_uv;\n\t\t\t\t${n}\n\t\n\t\t\t\tcustom_uv += offset;\n\t\t\t\tcustom_uv = fract(custom_uv);\n\t\t\t\tcustom_uv = rotate_uv(custom_uv, rotation, true);\n\t\n\t\t\t\tfloat draw = ${t};\n\t\t\t\t`}let o=new dE(`vec3 ${n}_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) {\n\t\t\t\t\tconst float TWO_PI = PI * 2.0;\n\t\t\t\t\tfloat smoothness_remapped = pow(smoothness, 5.0);\t\n\n\t\t\t\t\t${a}\n\n\t\t\t\t\t// Construct final output color\n\t\t\t\t\tvec4 color = mix(colorA, colorB, draw);\n\t\t\t\t\tcolor.a = clamp(color.a, 0.0, 1.0);\n\n\t\t\t\t\t// Apply cuts\n\t\t\t\t\tcolor.a *= \n\t\t\t\t\t\tstep(vertical.x, custom_uv.y) * \n\t\t\t\t\t\tstep(custom_uv.y, vertical.y);\n\t\t\t\t\tcolor.a *= \n\t\t\t\t\t\tstep(horizontal.x, abs(custom_uv.x)) * \n\t\t\t\t\t\tstep(abs(custom_uv.x), horizontal.y);
2\n\n\t\t\t\t\t// Accumulate alpha \n\t\t\t\t\tfloat lalpha = alpha * clamp(color.a, 0.0, 1.0) * mask;\n\t\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\t\treturn clamp(color, 0.0, 1.0).rgb;\n\t\t\t\t}`,[s,r,bP.DrawFunctions.circle,bP.DrawFunctions.ring,bP.DrawFunctions.polygon,bP.DrawFunctions.cross,bP.DrawFunctions.diamond,bP.DrawFunctions.checkerboard,bP.DrawFunctions.line,bP.DrawFunctions.wave]),l=t.include(o),h=[];return h.push("normal"),h.push(this.blending.build(t,"f")),h.push(this.style.build(t,"i")),h.push(this.offset.build(t,"v2")),h.push(this.colorA.build(t,"v4")),h.push(this.colorB.build(t,"v4")),h.push(this.frequency.build(t,"v2")),h.push(this.size.build(t,"f")),h.push(this.variation.build(t,"f")),h.push(this.smoothness.build(t,"f")),h.push(this.zigzag.build(t,"f")),h.push(this.rotation.build(t,"f")),h.push(this.vertical.build(t,"v2")),h.push(this.horizontal.build(t,"v2")),h.push(this.sides.build(t,"i")),h.push(this.isMask.build(t,"b")),h.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),h.push(this.alpha.build(t,"f")),h.push(this.calpha),t.format(l+"("+h.join(",")+")",this.getType(t),e)}return t.format("vec3(0.0)",this.getType(t),e)}},wP=bP;wP.DrawFunctions=function(){let t=new dE("float hashwithoutsine12(vec2 p) {\n\t\t\t\tvec3 p3 = fract(vec3(p.xyx) * 0.1031);\n\t\t\t\tp3 += dot(p3, p3.yzx + 33.33);\n\t\t\t\treturn fract((p3.x + p3.y) * p3.z);\n\t\t\t}"),e=new dE("vec2 tile_and_center(in vec2 uv, in vec2 frequency, in float variation, in float zigzag, in float rotation) {\n // Create tiles in UV-space\n uv *= frequency;\n\n // Integer coords\n vec2 i = floor(uv);\n\n // Offset every other row based on zigzag param, then compute fractional coords\n float row_offset = mod(i.y, 2.0);\n uv.x += row_offset * zigzag;\n vec2 f = fract(uv);\n\n\t\t\t\t// Rotate the tile itself:\n\t\t\t\t// const float mid = 0.5;\n\t\t\t\t// f = vec2(\n\t\t\t\t// \tcos(rotation) * (f.x - mid) + sin(rotation) * (f.y - mid) + mid,\n\t\t\t\t// \tcos(rotation) * (f.y - mid) - sin(rotation) * (f.x - mid) + mid\n\t\t\t\t// );\n\t\t\t\t// f = fract(f);\n\n f = f * 2.0 - 1.0;\n\n\t\t\t\t// Recompute integer coords after shifting - then, random value per tile \n\t\t\t\ti = floor(uv);\n\t\t\t\tfloat rand = (hashwithoutsine12(i) * 5.0 + 1.0);\n\t\t\t\tfloat jitter = mix(1.0, rand, variation);\n\t\t\t\tf *= jitter;\n\n return f;\n }",[t]);return{tileAndCenter:e,circle:new dE("float circle(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n return smoothstep(\n -smoothness, \n smoothness, \n length(f) - size\n );\n }",[e]),ring:new dE("float ring(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n\n\t\t\t\tfloat d = length(f);\n const float inner_width = 0.5;\n\n float outer = smoothstep(-smoothness, smoothness, d - size);\n float inner = smoothstep(-smoothness, smoothness, d - size * inner_width);\n\t\t\t\treturn outer + (1.0 - inner); \n }",[e]),polygon:new dE("float sdf_ngon(in vec2 p, in float r, in int n) {\n float an = (PI * 2.0) / float(n);\n float he = r * tan(0.5 * an);\n \n // Rotate to first sector\n p = -p.yx; \n float bn = an * floor((atan(p.y, p.x) + 0.5 * an) / an);\n vec2 cs = vec2(cos(bn), sin(bn));\n p = mat2(cs.x, -cs.y, cs.y, cs.x)*p;\n \n // Side of polygon\n return length(p - vec2(r, clamp(p.y, -he, he))) * sign(p.x - r);\n }\n \n 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) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n return smoothstep(-smoothness, smoothness, sdf_ngon(f, size, sides));\n }",[e]),cross:new dE("float sdf_cross(in vec2 p, in vec2 b, float r ) {\n p = abs(p); \n\t\t\t\tp = (p.y > p.x) ? p.yx : p.xy;\n vec2 q = p - b;\n float k = max(q.y, q.x);\n vec2 w = (k > 0.0) ? q : vec2(b.y - p.x, -k);\n return sign(k) * length(max(w, 0.0)) + r;\n }\n \n // Avoid namespace conflicts \n float xcross(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n return smoothstep(-smoothness, smoothness, sdf_cross(f, vec2(size, size * 0.25), smoothness));\n }",[e]),diamond:new dE("float ndot(vec2 a, vec2 b) { \n return a.x*b.x - a.y*b.y; \n }\n \n float sdf_diamond(in vec2 p, in vec2 b) {\n p = abs(p);\n float h = clamp(ndot(b - 2.0 * p, b) / dot(b, b), -1.0, 1.0);\n float d = length(p - 0.5 * b * vec2(1.0 - h, 1.0 + h));\n return d * sign(p.x * b.y + p.y * b.x - b.x * b.y);\n }\n\n float diamond(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);\n\t return smoothstep(-smoothness, smoothness, sdf_diamond(f, vec2(size)));\n }",[e]),checkerboard:new dE("float checkerboard(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n uv *= frequency;\n vec2 i = floor(uv);\n\n float offset = mod(i.y, 2.0);\n\n uv.x += offset + zigzag * offset;\n float x = floor(uv.x);\n \n return mod(x, 2.0);\n }"),line:new dE("float line(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n vec2 f = tile_and_center(uv, frequency, 0.0, zigzag, rotation);\n\t\t\t\t\n\t\t\t\t// Different approach for variation param here\n\t\t\t\tfloat row = floor(uv * frequency).y;\n\t\t\t\tfloat rand = hashwithoutsine12(vec2(row));\n\t\t\t\tfloat s = mix(size, size * rand, variation);\n\n\t\t\t\treturn smoothstep(\n\t\t\t\t\ts - smoothness, \n\t\t\t\t\ts + smoothness, \n\t\t\t\t\tabs(f.y)\n\t\t\t\t);\n }",[e]),wave:new dE("// Uses bisection \n float udf_cos(in vec2 p, in float a, in float b, in float c, in float d) {\n // Convert all data to a primitive cosine wave\n p = c * (p - vec2(d, a));\n \n const float TWO_PI = PI * 2.0;\n\n // Reduce to principal half cycle\n p.x = mod(p.x, TWO_PI); \n if (p.x > PI) {\n p.x = TWO_PI - p.x;\n }\n \n // Find zero of derivative (minimize distance)\n float xa = 0.0;\n float xb = TWO_PI;\n\n // 24 bit precision\n for (int i = 0; i < 24;
2 i++) {\n float x = 0.5 * (xa + xb);\n float y = x - p.x + b * c * sin(x) * (p.y - b * c * cos(x));\n if (y < 0.0) xa = x; \n else xb = x;\n }\n float x = 0.5 * (xa + xb);\n \n // Compute distance \n vec2 q = vec2(x, b * c * cos(x));\n return length(p - q) / c;\n }\n\n float wave(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {\n float repeat = frequency.x;\n uv *= repeat;\n vec2 i = floor(uv);\n float row_offset = mod(i.y, 2.0);\n uv.x += row_offset * zigzag;\n vec2 f = vec2(uv.x, fract(uv.y));\n\n // Generalized cosine: y(x) = a + b * cos(cx + d)\n const float amplitude = 0.125;\n float wave_frequency = frequency.y * 0.1;\n float distance_estimate = udf_cos(f, 0.50, amplitude, wave_frequency * (2.0 * PI), 0.0);\n\n\t\t\t\t// Different approach for variation param here\n\t\t\t\tfloat rand = hashwithoutsine12(vec2(i.y));\n\t\t\t\tfloat s = mix(size, size * rand, variation);\n\n return smoothstep(-smoothness, smoothness, distance_estimate - s * 0.5);\n }")}}();var SP=class extends nE{constructor(t,e,i,n,r,s,a,o){super("v3"),this.nodeType="Rainbow",this.filmThickness=t,this.movement=e,this.wavelengths=i,this.noiseStrength=n,this.noiseScale=r,this.offset=s,this.isMask=o,this.alpha=a,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("vWorldViewDir"),t.require("worldNormal"),t.isShader("fragment")){t.require("uv"),t.requires.uv=[!0],t.addFragmentVariable(this.calpha,"float");let i=t.include(SP.Nodes.rainbow),n=[];return n.push(this.filmThickness.build(t,"f")),n.push(this.movement.build(t,"f")),n.push(this.wavelengths.build(t,"v3")),n.push(this.noiseStrength.build(t,"f")),n.push(this.noiseScale.build(t,"f")),n.push(this.offset.build(t,"v3")),n.push(this.isMask.build(t,"b")),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},_P=SP;_P.Nodes=function(){let t=new dE("vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {\n\t\t\t\tfloat f = 0.0;\n\t\t\t\t\n\t\t\t\tif (noiseStrength != 0.0) {\n\t\t\t\t\tvec3 st = position / noiseScale;\n\t\t\t\t\tfloat noise = simplexFast(1.6 * st + vec3(1.8, 1.5, 1.9) * simplexFast(st) + vec3(1.7, 9.2, 1.0));\n\t\t\t\t\tf = noise * noiseStrength;\n\t\t\t\t}\n\n\t\t\t\tvec3 waves = wavelengths * vec3(1.0, 0.8, 0.6) + 1.0;\n\t\t\t\tfloat angle = dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal));\n\n\t\t\t\tmediump vec3 color = cos((((filmThickness + f) / waves) * angle) + movement);\n\t\t\t\treturn .5 + .5 * color;\n\t\t\t }",[gP.simplexFast]);return{rainbow:new dE("vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, bool isMask, float mask, float alpha, out float calpha) {\n\t\t\t\tmediump vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);\n\n\t\t\t\tfloat rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);\n\n\t\t\t\tfloat lalpha = alpha * rainbowContribution * mask;\n\t\t\t\tcalpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));\n\n\t\t\t\treturn res;\n\t\t\t }",[t])}}();var AP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h){super("v3"),this.nodeType="Toon",this.positioning=t,this.colors=e,this.steps=i,this.source=n,this.isWorldSpace=r,this.noiseStrength=s,this.noiseScale=a,this.shadowColor=o,this.offset=l,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.require("worldNormal"),t.require("worldPosition"),t.isShader("fragment")){t.define("COLORS_MAX",10),t.addFragmentVariable(this.calpha,"float");let i=t.include(AP.Nodes.toon),n=[];return n.push(this.positioning.build(t,"i")),n.push(this.colors.build(t,"v4[]")),n.push(this.steps.build(t,"f[]")),n.push(this.source.build(t,"v3")),n.push(this.isWorldSpace.build(t,"b")),n.push(this.noiseStrength.build(t,"f")),n.push(this.noiseScale.build(t,"f")),n.push(this.shadowColor.build(t,"v4")),n.push(this.offset.build(t,"v3")),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},MP=AP;MP.Nodes=function(){let t=new dE("float rand(float n) {\n\t\t\t\treturn fract(sin(n) * 43758.5453123);\n\t\t\t}"),e=new dE("float hash1(float p) { \n\t\t\t\tp = fract(p * 0.011); \n\t\t\t\tp *= p + 7.5; \n\t\t\t\tp *= p + p; \n\t\t\t\treturn fract(p); \n\t\t\t}"),i=new dE("float valueNoise(vec3 x) {\n\t\t\t\tconst vec3 step = vec3(110, 241, 171);\n\t\t\t\n\t\t\t\tvec3 i = floor(x);\n\t\t\t\tvec3 f = fract(x);\n\t\t\t \n\t\t\t\t// For performance, compute the base input to a 1D hash from the integer part of the argument and the \n\t\t\t\t// incremental change to the 1D based on the 3D ->
2 1D wrapping\n\t\t\t\tfloat n = dot(i, step);\n\t\t\t\n\t\t\t\tvec3 u = f * f * (3.0 - 2.0 * f);\n\t\t\t\treturn mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x),\n\t\t\t\t\t\t\t mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\n\t\t\t\t\t\t mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x),\n\t\t\t\t\t\t\t mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\n\t\t\t}",[e]),n=new dE("vec3 hash3(vec3 x) {\n\t\t\t\tx = vec3(dot(x,vec3(127.1, 311.7, 74.7)),\n\t\t\t\t\t\t dot(x,vec3(269.5, 183.3, 246.1)),\n\t\t\t\t\t\t dot(x,vec3(113.5, 271.9, 124.6)));\n\t\t\t\n\t\t\t\treturn fract(sin(x)*43758.5453123);\n\t\t\t}"),r=new dE('vec3 voronoiNoise(in vec3 x)\n\t\t\t{\n\t\t\t\tvec3 p = floor(x);\n\t\t\t\tvec3 f = fract(x);\n\n\t\t\t\tfloat id = 0.0;\n\t\t\t\tvec2 res = vec2(100.0);\n\n\t\t\t\tfor(int k=-1; k<=1; k++)\n\t\t\t\tfor(int j=-1; j<=1; j++)\n\t\t\t\tfor(int i=-1; i<=1; i++)\n\t\t\t\t{\n\t\t\t\t\tvec3 b = vec3(float(i), float(j), float(k));\n\n\t\t\t\t\t// Comment out the "+ hash(p + b);" part below to get "square" cells\n\t\t\t\t\tvec3 r = vec3(b) - f + hash3(p + b);\n\t\t\t\t\tfloat d = dot(r, r);\n\n\t\t\t\t\tif (d < res.x)\n\t\t\t\t\t{\n\t\t\t\t\t\tid = dot(p + b, vec3(1.0, 57.0, 113.0));\n\t\t\t\t\t\tres = vec2(d, res.x);\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse if (d < res.y)\n\t\t\t\t\t{\n\t\t\t\t\t\tres.y = d;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn vec3(sqrt(res), abs(id));\n\t\t\t}\n\t\t\t',[n]);return{toon:new dE('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) {\n\t\t\t\tfloat t = 0.0;\n\t\t\t\tfloat shadow = 1.0;\n\n\t\t\t\tif (positioning == 0) {\n\n\t\t\t\t\t// Can\'t do this mode if lighting is "none"\n\t\t\t\t\t#if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD))\n\n\t\t\t\t\t\t// Algorithm from Chapter 10 of Graphics Shaders\n\t\t\t\t\t\tconst vec3 weights = vec3(0.2125, 0.7154, 0.0721);\n\t\t\t\t\t\tvec3 lpos;\n\t\t\t\t\t\tvec3 l;\n\t\t\t\t\t\tfloat dproduct;\n\n\t\t\t\t\t\t#if (NUM_POINT_LIGHTS > 0)\n\n\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0)\n\t\t\t\t\t\t\t\tPointLightShadow pointLightShadow;\n\t\t\t\t\t\t\t#endif \n\n\t\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\t\tfor (int i = 0; i < NUM_POINT_LIGHTS; i++) {\n\t\t\t\t\t\t\t\t// Light positions are in view-space for some reason?\n\t\t\t\t\t\t\t\tlpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;\n\t\t\t\t\t\t\t\tl = normalize(lpos - worldPosition);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t// TODO: we want to use "intensity" but it isn\'t available in the shader code\n\t\t\t\t\t\t\t\t//dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights);\n\n\t\t\t\t\t\t\t\tt = max(t, dproduct);\n\n\t\t\t\t\t\t\t\t// Accumulate shadow contribution\n\t\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS)\n\t\t\t\t\t\t\t\t\tpointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX];\n\t\t\t\t\t\t\t\t\tshadow *= getPointShadow( \n\t\t\t\t\t\t\t\t\t\t\tpointShadowMap[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowMapSize, \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowBias, \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowRadius,\n\t\t\t\t\t\t\t\t\t\t\tvPointShadowCoord[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowCameraNear, \n\t\t\t\t\t\t\t\t\t\t\tpointLightShadow.shadowCameraFar);\n\t\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t\t\t\t#endif\n\n\t\t\t\t\t\t#if NUM_DIR_LIGHTS > 0 \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0)\n\t\t\t\t\t\t\t\tDirectionalLightShadow directionalLightShadow;\n\t\t\t\t\t\t\t#endif \n\n\t\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\t\tfor (int i = 0; i < NUM_DIR_LIGHTS;
2 i++) {\n\t\t\t\t\t\t\t\t// Use the direction vector for directional lights instead\n\t\t\t\t\t\t\t\tl = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz;\n\t\t\n\t\t\t\t\t\t\t\tdproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;\n\t\t\t\t\t\t\t\tt = max(t, dproduct);\n\n\t\t\t\t\t\t\t\t// Accumulate shadow contribution\n\t\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS)\n\t\t\t\t\t\t\t\t\tdirectionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX];\n\t\t\t\t\t\t\t\t\tshadow *= getShadow( \n\t\t\t\t\t\t\t\t\t\tUNROLLED_LOOP_INDEX,\n\t\t\t\t\t\t\t\t\t\tdirectionalShadowMap[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\tdirectionalLightShadow.shadowMapSize, \n\t\t\t\t\t\t\t\t\t\tdirectionalLightShadow.shadowBias, \n\t\t\t\t\t\t\t\t\t\tdirectionalLightShadow.shadowRadius, \n\t\t\t\t\t\t\t\t\t\tvDirectionalShadowCoord[UNROLLED_LOOP_INDEX]);\n\t\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t\t\t\t#endif\n\n\t\t\t\t\t\t#if NUM_SPOT_LIGHTS > 0 \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0)\n\t\t\t\t\t\t\t\tSpotLightShadow spotLightShadow;\n\t\t\t\t\t\t\t#endif \n\n\t\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\t\tfor (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\n\t\t\t\t\t\t\t\tlpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;\n\t\t\t\t\t\t\t\tl = normalize(lpos - worldPosition);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;\n\t\t\t\t\t\t\t\tt = max(t, dproduct);\n\n\t\t\t\t\t\t\t\t// Accumulate shadow contribution\n\t\t\t\t\t\t\t\t#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS)\n\t\t\t\t\t\t\t\t\tspotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX];\n\t\t\t\t\t\t\t\t\tshadow *= getShadow(\n\t\t\t\t\t\t\t\t\t\tUNROLLED_LOOP_INDEX,\n\t\t\t\t\t\t\t\t\t\tspotShadowMap[UNROLLED_LOOP_INDEX], \n\t\t\t\t\t\t\t\t\t\tspotLightShadow.shadowMapSize, \n\t\t\t\t\t\t\t\t\t\tspotLightShadow.shadowBias, \n\t\t\t\t\t\t\t\t\t\tspotLightShadow.shadowRadius, \n\t\t\t\t\t\t\t\t\t\tvSpotLightCoord[UNROLLED_LOOP_INDEX]);\n\t\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t\t\t\t#endif\n\n\t\t\t\t\t\tt = clamp(t, 0.0, 1.0);\n\t\t\t\t\n\t\t\t\t\t#endif\n\n\t\t\t\t} else if (positioning == 1) {\n\t\t\t\t\t\n\t\t\t\t\tvec3 origin = mix(position, worldPosition, float(isWorldSpace));\n\t\t\t\t\tvec3 direction = normalize(source - origin);\n\t\t\t\t\tt = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;\t\n\n\t\t\t\t} else {\n\n\t\t\t\t\tvec3 origin = worldPosition;\n\t\t\t\t\tvec3 source = cameraPosition - offset;\n\t\t\t\t\tvec3 direction = normalize(source - origin);\n\t\t\t\t\tt = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;\t\n\t\t\t\t\t\n\t\t\t\t}\n\n\t\t\t\tif (noiseStrength > 0.0) {\n\t\t\t\t\t// Distort with noise\n\t\t\t\t\tvec3 st = position / noiseScale;\n\t\t\t\t\t\n\t\t\t\t\t// Voronoi "smooth" noise\n\t\t\t\t\tfloat noise = 1.0 - voronoiNoise(st).x;\n\n\t\t\t\t\t// Voronoi cellular noise\n\t\t\t\t\t//float noise = 1.0 - rand(voronoiNoise(st).z);\n\n\t\t\t\t\t// Position warp noise\n\t\t\t\t\t// vec3 offset = vec3(\n\t\t\t\t\t// \tsimplexFast(st),\n\t\t\t\t\t// \tsimplexFast(st + vec3(111.1, 143.89, 217.19)),\n\t\t\t\t\t// \tsimplexFast(st + vec3(171.1, 247.89, 117.23))\n\t\t\t\t\t// );\n\t\t\t\t\t// st += offset;\n\t\t\t\t\t// float noise = valueNoise(st);\n\n\t\t\t\t\tt += noise * noiseStrength;\n\t\t\t\t}\n\n\t\t\t\tt = clamp(t, 0.0, 1.0);\n\n\t\t\t\t// Compute ramp color\n\t\t\t\tfloat p;\n\t\t\t\tvec4 color = colors[0];\n\t\t\t\tfor (int i = 1; i < COLORS_MAX; i++) {\n\t\t\t\t\tp = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0);\n\t\t\t\t\tcolor = mix(color, colors[i], smoothstep(0.0, 1.0, p));\n\t\t\t\t}\n\n\t\t\t\t// Incorporate custom shadow color\n\t\t\t\tif (positioning == 0) {\n\n\t\t\t\t\tvec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a);\n\t\t\t\t\tcolor.rgb = mix(blendedShadow, color.rgb, shadow);\n\t\t\t\t\n\t\t\t\t}
2\n\n\t\t\t\t// Accumulate alpha as usual\n\t\t\t\tfloat lalpha = alpha * color.a * mask;\n\t\t\t\tcalpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);\n\t\t\t\taccumAlpha += (1.0 - accumAlpha) * lalpha;\n\n\t\t\t\treturn color.xyz;\n\n }',[gP.simplexFast,t,i,r])}}();var CP={textureBicubic:new dE("float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n \n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n \n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n \n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n \n // g0 and g1 are the two amplitude functions\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n \n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n \n // h0 and h1 are the two offset functions\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n \n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n \n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n \n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n \n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n \n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n \n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + \n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }")};var EP=class extends nE{constructor(t,e,i,n,r,s,a,o){super("v3"),this.nodeType="Transmission",this.thickness=t,this.ior=e,this.roughness=i,this.transmissionSamplerSize=n,this.transmissionSamplerMap=r,this.transmissionDepthMap=s,this.aspectRatio=a,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(t,e){if(t.extensions.shaderTextureLOD=!0,t.extensions.derivatives=!0,t.isShader("fragment")){t.define("NUM_SAMPLES",6),t.define("BLUR_SLOD",Math.pow(2,OP.transmissionLod.value)),t.require("worldPosition"),t.requires.worldNormal=!0,t.requires.modelMatrix=!0,t.requires.projectionMatrix=!0,t.addFragmentVariable(this.calpha,"float");let i=t.include(EP.Nodes.transmission),n=[];return n.push(this.thickness.build(t,"f")),n.push(this.ior.build(t,"f")),n.push(this.roughness.build(t,"f")),n.push(this.transmissionSamplerSize.build(t,"v2")),n.push(this.transmissionSamplerMap.getTexture(t,"t")),n.push(this.transmissionDepthMap.getTexture(t,"t")),n.push(this.aspectRatio.build(t,"v2")),n.push("normal"),n.push(this.mask?`luminance(${this.mask.flow(t,"v3").result})`:"1.0"),n.push(this.alpha.build(t,"f")),n.push(this.calpha),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}}
2,PP=EP;PP.Nodes=function(){let t=new dE("vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {\n // Slightly modified version of this:\n // https://www.shadertoy.com/view/ltScRG\n\n\t\t\t\t// Special case for blur == 0.0\n\t\t\t\tif (lod == 0.0) {\n\t\t\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\t\treturn texture2DLodEXT( sp, U, 0.0).rgb;\n\t\t\t\t\t#else\n\t\t\t\t\treturn textureLod( sp, U, 0.0).rgb;\n\t\t\t\t\t#endif\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvec2 texelSize = vec2(1.0) / resolution;\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\t\t\t\tvec3 res = vec3(0.0);\n vec2 uv = vec2(0.0);\n vec2 offset = vec2(0.0);\n vec2 vogelSample = vec2(0.0);\n for (int i = 0; i < NUM_SAMPLES; i++) {\n vogelSample = vogelDiskSample(i, NUM_SAMPLES, temporalAngle) * texelSize;\n offset = vogelSample * scale * (lod * 10.0); // TODO: used to be hardcoded to 20\n uv = U + offset;\n float opaqueDepth = unpackRGBAToDepth(textureLod(dm, uv, lod));\n if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) {\n uv = unrefractedU;\n lod = lod > 4.0 ? lod : lod / 2.0;\n }\n res += textureLod(sp, uv, lod).rgb;\n }\n return res / float(NUM_SAMPLES);\n }"),e=new dE("vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\t // Direction of refracted light.\n\t\t vec3 refractionVector = refract( -v, n, 1.0 / ior );\n\t\t \n\t\t\t\t// Compute rotation-independant scaling of the model matrix.\n\t\t vec3 modelScale;\n\t\t modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\t modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\t modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t // The thickness is specified in local space\n\t\t return normalize( refractionVector ) * thickness * modelScale;\n\t }"),i=new dE("float applyIorToRoughness( float roughness, float ior ) {\n\t\t\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\t\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t\t\t}"),n=new dE('vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {\n\t\t\t\t// Threejs exports do not pass a depth map to this shader, so we have to fallback to the "Threejs method of blurring" - see\n\t\t\t\t// also the code in convertTransmission.ts, which runs during export\n\t\t\t\t#ifdef IS_THREEJS_EXPORT\n\t\t\t\t\tfloat lod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness / 5.0, ior);\n\t\t\t\t\treturn textureBicubic(transmissionSamplerMap, fragCoord.xy, lod).rgb;\n\t\t\t\t#else\n\t\t\t\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t\t\t\tfloat lod = applyIorToRoughness(roughness, ior);\n\t\t\t\t\treturn blur(transmissionSamplerMap, fragCoord, vec2(lod), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);\n\t\t\t\t#endif\n\t\t\t}',[CP.textureBicubic,i,t]),r=new dE("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 ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\n\t\t\t\tvec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 );\n\t\t\t\tvec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w;\n\t\t\t\tunrefractedCoords += 1.0;\n\t\t\t\tunrefractedCoords /= 2.0;\n\n\t\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\
2n\t\t\t\treturn getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );\n \t\t}",[n,e]);return{transmission:new dE("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) {\n vec3 v = vec3(0.);\n if (isOrthographic) {\n v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n v = normalize(vWPosition - cameraPosition);\n }\n vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness, vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio );\n \n\t\t\t\tfloat lalpha = alpha * mask;\n\t\t\t\tcalpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );\n\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * alpha;\n\n\t\t\t\treturn transmission;\n }",[r])}}();var TP=(t=>(t.NOISE="noise",t.MAP="map",t))(TP||{}),DP=class extends nE{constructor(t,e,i,n,r,s,a,o,l,h,c){super("v3"),this.displacementTypeIndex=new HE(0),this.nodeType="VertexDisplacement",this.intensity=t,this.movementOrTexture=e,"map"===Object.values(TP)[this.displacementTypeIndex.value]&&(this.mat=new KE(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=h,this.noiseFunctionIndex=c,this.voronoiStyle=n,this.smoothness=r,this.seed=s,this.highCut=a,this.lowCut=o,this.quality=l}generate(t,e){if(t.isShader("vertex")){t.define("USE_LAYER_DISPLACE");let i,n=[];switch(n.push("displaced_position"),n.push("displaced_normal"),Object.values(TP)[this.displacementTypeIndex.value]){case"map":i=t.include(DP.Nodes.map),n.push(this.movementOrTexture.getTexture(t,"t")),n.push("uv"),n.push(this.cropOrOffset.build(t,"f")),this.mat&&n.push(this.mat.build(t,"mat3"));break;case"noise":{let e=["simplexPrecise","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseFunctionIndex.value],r=new dE("vec3 orthogonal(vec3 v) {\n\t\t\t\t\t\t\treturn normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));\n\t\t\t\t\t\t}"),s=new dE(`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) {\n\t\t\t\t\t\t\t${"voronoi"==e?`\n\t\t\t\t\tfloat v = ${e}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1), voronoiStyle, smoothness, seed, quality);\n\t\t\t\t\tv = remap(v, lowCut, highCut, 0.0, 1.0);\n\t\t\t\t\tv = smax(v, 0.0, smoothness * 0.25);\n\t\t\t\t\tv = smin(v, 1.0, smoothness * 0.25);\n\n\t\t\t\t\treturn p + n * v * intensity;\n\t\t\t\t\t`:`\n\t\t\t\t\treturn p + n * ${e}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;\n\t\t\t\t\t`}\n\t\t\t\t\t\t}`,[gP.simplexPrecise,gP.simplexFractal,gP.simplexAshima,gP.fbm,gP.perlin,gP.voronoi]),a=new dE("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) {\n\t\t\t\t\t\t\tvec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);\n\t\t\t\t\t\t\tvec3 tangent1 = orthogonal(normal);\n\t\t\t\t\t\t\tvec3 tangent2 = normalize(cross(normal, tangent1));\n\n // TODO(Max): The distance to the neighbors was originally scaled by 0.1.\n // This caused some small oval/circular visual artifacts in the lighting.\n // For now, simply using neighbors further away betters the problem,\n // but we should figure out the underlying cause when we have some time.\n // Maybe its related to how we
2calculate the tangent and bitangent?\n\t\t\t\t\t\t\tvec3 nearby1 = position + tangent1;\n\t\t\t\t\t\t\tvec3 nearby2 = position + tangent2;\n\t\t\t\t\t\t\tvec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);\n\t\t\t\t\t\t\tvec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);\n\t\t\t\t\t\t\tdisplaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));\n\t\t\t\t\t\t\treturn displaced_position;\n\t\t\t\t\t\t}",[s,r]);i=t.include(a),n.push(this.scale.build(t,"f")),n.push(this.cropOrOffset.build(t,"v3")),n.push(this.movementOrTexture.build(t,"f")),n.push(this.voronoiStyle.build(t,"i")),n.push(this.smoothness.build(t,"f")),n.push(this.seed.build(t,"f")),n.push(this.highCut.build(t,"f")),n.push(this.lowCut.build(t,"f")),n.push(this.quality.build(t,"i"));break}}return n.push(this.intensity.build(t,"f")),n.push("displaced_normal"),t.format(i+"("+n.join(",")+")",this.getType(t),e)}return t.format("vec3( 0.0 )",this.getType(t),e)}},IP=DP;IP.Nodes=function(){let t=new dE("vec3 orthogonal(vec3 v) {\n\t\t\t\treturn normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));\n\t\t\t}"),e=new dE("float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {\n\t\t\t\tvec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;\n\t\t\t\tvec4 tmp = texture2D(tex, uvs);\n\t\t\t\tvec3 col = tmp.rgb;\n\t\t\t\tif (crop > 0.5) {\n\t\t\t\t\tif ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) {\n\t\t\t\t\t\treturn 0.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn col.r;\n\t\t\t}");return{map:new dE("vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {\n\t\t\t\tvec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;\n\t\t\t\tvec3 tangent1 = normalize(orthogonal(normal));\n\t\t\t\tvec3 tangent2 = normalize(cross(normal, tangent1));\n\t\t\t\tvec3 nearby1 = position + tangent1 * 0.1;\n\t\t\t\tvec3 nearby2 = position + tangent2 * 0.1;\n\t\t\t\tvec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;\n\t\t\t\tvec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;\n\t\t\t\tdisplaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));\n\t\t\t\treturn displaced_position;\n\t\t\t}",[t,e])}}();var OP={normalRenderTarget:new SE,normalRenderTargetDepth:new SE,transmissionRenderTarget:new SE,aspectRatio:new sE,transmissionSize:new sE(2048,2048),transmissionRenderTargetDepth:new SE,aoRenderTarget:new SE,aoEnabled:new qE,pixelRatioNode:new _E(1),resolution:new sE,penumbraSize:new XE(5,.5),frameIndex:new HE(0),transmissionLod:new HE(2)};for(let oG of Object.values(OP))oG.isRenderGlobal=!0;var RP,LP={skiaWasmUrl:"https://unpkg.com/@splinetool/[email protected]/build/ui.wasm"},BP=class extends tE{constructor(){super("basic"),this.nodeType="Basic",this.color=new WE(ox),this.shadingAlpha=new _E(1),this.shadingBlend=new HE(0),this.previousModelViewMatrix=new JE,this.previouseProjectionMatrix=new JE}get category(){return"phong"}generate(t){let e;if(t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({resolution:OP.resolution}),t.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),t.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),t.mergeUniform(gn.merge([Bn.fog])),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>"].join("\n"));let n=["#include <beginnormal_vertex>","#include <morphnormal_vertex>","\n\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = normal;\n\n\t\t\t\t#if defined( USE_LAYER_DISPLACE )\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include <normal_vertex>","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
2":""),n.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","\tvNormal = transformedNormal;","#endif"),n.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>","\tvViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join("\n")}else{void 0===this.color&&(this.color=new WE(ox)),this.color.analyze(t,{slot:"color"}),this.alpha&&this.alpha.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"});let i=this.color.flow(t,"c",{slot:"color"}),n=this.alpha?this.alpha.flow(t,"f"):void 0,r=this.alphaOverride?this.alphaOverride.flow(t,"f"):void 0,s=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0;t.requires.transparent=void 0!==n,t.addParsCode(["varying vec3 vWPosition;","#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#include <normal_pars_fragment>"].join("\n"));let a=["#include <normal_fragment_begin>",i.code];n&&a.push(n.code,"#ifdef ALPHATEST"," if ( "+n.result+" <= ALPHATEST ) discard;","#endif"),s?a.push(s.code,`vec3 outgoingLight = ${i.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${s.result}, 1.0, SPE_BLENDING_NORMAL);`):a.push(`vec3 finalColor = ${i.result};`);let o="1.0";this.mask&&(this.mask.analyze(t),o=`luminance(${this.mask.flow(t,"v3").result})`),n?a.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${n.result} * ${o} );`):a.push("gl_FragColor = vec4("+i.result+", 1.0 );"),r&&a.push(`gl_FragColor.a *= ${r.result};`),a.push("#include <fog_fragment>","#include <dithering_fragment>"),e=a.join("\n")}return e}},zP=class extends tE{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new WE(ox),this.emissive=new WE(0),this.emissiveIntensity=new _E(1),this.previousModelViewMatrix=new JE,this.previouseProjectionMatrix=new JE,this.shadingAlpha=new _E(1),this.shadingBlend=new HE(0),this.occlusion=new qE(!0)}get category(){return"lambert"}build(t){let e;if(t.define("LAMBERT"),t.requires.lights=!0,t.extensions.derivatives=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({resolution:OP.resolution}),t.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),t.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),t.mergeUniform(gn.merge([Bn.fog,Bn.lights])),t.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying 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("\n"));let n=["#include <beginnormal_vertex>","#include <morphnormal_vertex>","\n\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = objectNormal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include <normal_vertex>","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t#endif\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
2":""),n.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("\t#include <project_vertex>","\t#include <clipping_planes_vertex>","\tvViewPosition = - mvPosition.xyz;","\t#include <worldpos_vertex>","\n\t\t\t\t\tvec3 diffuse = vec3( 1.0 );\n\t\t\t\t\tGeometricContext geometry;\n\t\t\t\t\tgeometry.position = mvPosition.xyz;\n\t\t\t\t\tgeometry.normal = normalize( transformedNormal );\n\t\t\t\t\tgeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\t\t\t\t"),n.push("\n\t\t\t\t\tGeometricContext backGeometry;\n\t\t\t\t\tbackGeometry.position = geometry.position;\n\t\t\t\t\tbackGeometry.normal = -geometry.normal;\n\t\t\t\t\tbackGeometry.viewDir = geometry.viewDir;\n\t\t\t\t\tvLightFront = vec3( 0.0 );\n\t\t\t\t\tvIndirectFront = vec3( 0.0 );\n\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\tvLightBack = vec3( 0.0 );\n\t\t\t\t\t\tvIndirectBack = vec3( 0.0 );\n\t\t\t\t\t#endif\n\t\t\t\t\tIncidentLight directLight;\n\t\t\t\t\tfloat dotNL;\n\t\t\t\t\tvec3 directLightColor_Diffuse;\n\t\t\t\t\tvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\n\t\t\t\t\tvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\t\t\t\t\t\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_POINT_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_SPOT_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_DIR_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\t\t\t\t\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\t\t\t\t\t\tdirectLightColor_Diffuse = directLight.color;\n\t\t\t\t\t\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t\t#if NUM_HEMI_LIGHTS > 0\n\t\t\t\t\t\t#pragma unroll_loop_start\n\t\t\t\t\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\t\t\t\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t\t\t\t\t\t#ifdef DOUBLE_SIDED\n\t\t\t\t\t\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t\t\t\t\t\t#endif\n\t\t\t\t\t\t}\n\t\t\t\t\t\t#pragma unroll_loop_end\n\t\t\t\t\t#endif\n\t\t\t\t","\t#include <shadowmap_vertex>","\t#include <fog_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join("\n")}else{t.mergeUniform({penumbraSize:OP.penumbraSize}),t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({aoMap:OP.aoRenderTarget}),t.mergeUniform({aoEnabled:OP.aoEnabled}),void 0===this.color&&(this.color=new WE(ox)),this.color.analyze(t,{slot:"color"}
vendor: 4,331 bytes, line 2
2),this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t);let i=this.color.flow(t,"c",{slot:"color"}),n=this.emissive.flow(t,"c",{slot:"emissive"}),r=this.emissiveIntensity.flow(t,"f",{slot:"emissive"}),s=this.occlusion.flow(t,"b",{slot:"occlusion"}),a=this.shadingAlpha.flow(t,"f"),o=this.shadingBlend.flow(t,"i"),l=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(t,"f"):void 0,c=this.alphaOverride?this.alphaOverride.flow(t,"f"):void 0;t.requires.transparent=void 0!==h,t.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","\tvarying vec3 vLightBack;","\tvarying 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("\n"));let d=["#include <normal_fragment_begin>","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx, viewdy));\n\t\t\t\tbool isFrontFacing = (dot(normal, faceNormal) >= 0.0);\n\t\t\t\t","#include <clipping_planes_fragment>"];d.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),h&&d.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),d.push("#ifdef DOUBLE_SIDED","\treflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else","\treflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED","\treflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else","\treflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),n&&d.push(n.code,"reflectedLight.directDiffuse += "+n.result+" * "+r.result+";"),d.push("vec3 ao = aoEnabled && "+s.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");let u="1.0";this.mask&&(this.mask.analyze(t),u=`luminance(${this.mask.flow(t,"v3").result})`),d.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${u} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${u}, ${o.result} );\n\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t`),l&&d.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&d.push(`gl_FragColor.a *= ${c.result};`),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=d.join("\n")}return e}},FP={dHdxy:new dE("vec2 dHdxy(sampler2D bumpMap, vec2 bumpMapUv, float bumpScale) {\n\n // Gradient of UVs w.r.t. X coordinate (in screen-space)\n vec2 dSTdx = dFdx(bumpMapUv);\n\n // Gradient of UVs w.r.t. Y coordinate (in screen-space)\n vec2 dSTdy = dFdy(bumpMapUv);\n \n // Forward differencing\n float Hll = bumpScale * luminance(texture(bumpMap, bumpMapUv).rgb);\n float dBx = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdx).rgb) - Hll;\n float dBy = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdy).rgb) - Hll;\n \n return vec2( dBx, dBy );\n }
2"),perturbNormalArb:new dE("vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm; // normalized\n \n vN = normalize(vN);\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n R1 = normalize(R1);\n R2 = normalize(R2);\n \n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n \n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * vN - vGrad );\n }")},NP=class extends tE{constructor(){super("phong"),this.nodeType="Phong",this.color=new WE(ox),this.specular=new WE(1118481),this.shininess=new _E(30),this.previousModelViewMatrix=new JE,this.previouseProjectionMatrix=new JE,this.shadingAlpha=new _E(1),this.shadingBlend=new HE(0),this.occlusion=new qE(!0)}get category(){return"phong"}build(t){let e;if(t.define("PHONG"),t.requires.lights=!0,t.extensions.derivatives=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({resolution:OP.resolution}),t.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),t.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),t.mergeUniform(gn.merge([Bn.fog,Bn.lights])),t.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("\n"));let n=["#include <beginnormal_vertex>","#include <morphnormal_vertex>","\n\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = objectNormal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include <normal_vertex>","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t#endif\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
2":""),n.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("\t#include <project_vertex>","\t#include <clipping_planes_vertex>","\tvViewPosition = - mvPosition.xyz;","\t#include <worldpos_vertex>","\t#include <shadowmap_vertex>","\t#include <fog_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join("\n")}else{t.mergeUniform({penumbraSize:OP.penumbraSize}),t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({aoMap:OP.aoRenderTarget}),t.mergeUniform({aoEnabled:OP.aoEnabled}),void 0===this.color&&(this.color=new WE(ox)),this.color.analyze(t,{slot:"color"}),this.specular.analyze(t),this.shininess.analyze(t);let i=this.occlusion.flow(t,"b",{slot:"occlusion"});this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t);let n=this.color.flow(t,"c",{slot:"color"}),r=this.specular.flow(t,"c"),s=this.shininess.flow(t,"f"),a=this.shadingAlpha.flow(t,"f"),o=this.shadingBlend.flow(t,"i"),l=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(t,"f"):void 0,c=this.alphaOverride?this.alphaOverride.flow(t,"f"):void 0;t.requires.transparent=void 0!==h,t.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("\n"));let d=["#include <normal_fragment_begin>","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx,viewdy));\n\t\t\t\tif (dot(normal, faceNormal) < 0.0) {\n\t\t\t\t\tnormal *= -1.0;\n\t\t\t\t}\n\t\t\t\t","\tBlinnPhongMaterial material;"];
vendor: 5,535 bytes, line 2
2if(this.bumpMap){t.include(FP.dHdxy),t.include(FP.perturbNormalArb);let e=this.bumpMap.texture.flow(t,"t"),i=this.bumpMap.flow(t,"v3"),n=this.bumpMapIntensity?this.bumpMapIntensity.flow(t,"f").result:"1.0",r="";r=4===this.bumpMap.projection.value?`\n\t\t\t\t\tvec3 bumpNormal = vec3(0.0);\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(${e.result}, uv0, ${n});\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(${e.result}, uv1, ${n});\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(${e.result}, uv2, ${n});\n\t\t\t\t\t\tvec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;\n\t\t\t\t\t\tbumpNormal = normalize(bumpNormal);\n\t\t\t\t\t}\n\n\t\t\t\t\tnormal = bumpNormal;\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(${e.result}, bumpMapCachedUv, ${n});\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t`,d.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\t\t\t\t\t${r}\n\t\t\t\t\t`)}d.push(n.code,"\tvec3 diffuseColor = "+n.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","\tvec3 totalEmissiveRadiance = emissive;",r.code,"\tvec3 specular = "+r.result+";",s.code,"\tfloat shininess = max( 0.0001, "+s.result+" );","\tfloat specularStrength = 1.0;"),h&&d.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),d.push("material.diffuseColor = diffuseColor;"),d.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),d.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 u="1.0";this.mask&&(this.mask.analyze(t),u=`luminance(${this.mask.flow(t,"v3").result})`),d.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${u} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${u}, ${o.result} );\n\t\t\t\t\t\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t`),l&&d.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result});`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&d.push(`gl_FragColor.a *= ${c.result};`),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=d.join("\n")}return e}},UP=class extends tE{constructor(){super("standard"),this.nodeType="Standard",this.color=new WE(ox),this.roughness=new _E(.3),this.metalness=new _E(0),this.reflectivity=new _E(.5),this.previousModelViewMatrix=new JE,this.previouseProjectionMatrix=new JE,this.shadingAlpha=new _E(1),this.shadingBlend=new HE(0),this.occlusion=new qE(!0)}get category(){return"physical"}build(t){let e;if(t.define("STANDARD"),t.requires.lights=!0,t.extensions.derivatives=!0,t.extensions.shaderTextureLOD=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({resolution:OP.resolution}),t.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),t.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),t.mergeUniform(gn.merge([Bn.fog,Bn.lights])),Bn.LTC_1&&(t.uniforms.ltc_1={value:void 0},t.uniforms.ltc_2={value:void 0}),t.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("\n"));let n=["#include <beginnormal_vertex>","#include <morphnormal_vertex>","\n\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = objectNormal;\n\n\t\t\t\t#if defined( USE_LAYER_DISPLACE )\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include <normal_vertex>","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
2":""),n.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>","\tvViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join("\n")}else{t.mergeUniform({penumbraSize:OP.penumbraSize}),t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({aoMap:OP.aoRenderTarget}),t.mergeUniform({aoEnabled:OP.aoEnabled});let i={gamma:!0};void 0===this.color&&(this.color=new WE(ox)),this.color.analyze(t,{slot:"color",context:i}),this.roughness.analyze(t),this.metalness.analyze(t);let n=this.occlusion.flow(t,"b",{slot:"occlusion"});this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t),this.reflectivity&&this.reflectivity.analyze(t);let r=this.color.flow(t,"c",{slot:"color",context:i}),s=this.roughness.flow(t,"f"),a=this.metalness.flow(t,"f"),o=this.shadingAlpha.flow(t,"f"),l=this.shadingBlend.flow(t,"i"),h=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(t,"f"):void 0,d=this.alphaOverride?this.alphaOverride.flow(t,"f"):void 0,u=this.reflectivity?this.reflectivity.flow(t,"f"):void 0;t.requires.transparent=void 0!==c,t.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("\n"));let p=["#include <clipping_planes_fragment>","\t#include <normal_fragment_begin>","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx,viewdy));\n\t\t\t\tif (dot(normal, faceNormal) < 0.0) {\n\t\t\t\t\tnormal *= -1.0;\n\t\t\t\t}\n\t\t\t\t","\tPhysicalMaterial material;","\tmaterial.diffuseColor = vec3( 1.0 );"];
vendor: 7,171 bytes, line 2
2if(this.bumpMap){t.include(FP.dHdxy),t.include(FP.perturbNormalArb);let e=this.bumpMap.texture.flow(t,"t"),i=this.bumpMap.flow(t,"v3"),n=this.bumpMapIntensity?this.bumpMapIntensity.flow(t,"f").result:"1.0",r="";r=4===this.bumpMap.projection.value?`\n\t\t\t\t\tvec3 bumpNormal = vec3(0.0);\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(${e.result}, uv0, ${n});\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(${e.result}, uv1, ${n});\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(${e.result}, uv2, ${n});\n\t\t\t\t\t\tvec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;\n\t\t\t\t\t\tbumpNormal = normalize(bumpNormal);\n\t\t\t\t\t}\n\n\t\t\t\t\tnormal = bumpNormal;\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(${e.result}, bumpMapCachedUv, ${n});\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\t\t\t\t\t${r}\n\t\t\t\t\t`)}if(p.push(r.code,"\tvec3 diffuseColor = "+r.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",a.code,"\tfloat metalnessFactor = "+a.result+";"),this.roughnessMap){let e=this.roughnessMap.texture.flow(t,"t"),i=this.roughnessMap.flow(t,"v3"),n="";n=4===this.roughnessMap.projection.value?`\n\t\t\t\t\tfloat roughnessChange = 1.0;\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tfloat r0 = luminance(texture(${e.result}, uv0).rgb) * roughnessScale;\n\t\t\t\t\t\tfloat r1 = luminance(texture(${e.result}, uv1).rgb) * roughnessScale;\n\t\t\t\t\t\tfloat r2 = luminance(texture(${e.result}, uv2).rgb) * roughnessScale;\n\n\t\t\t\t\t\troughnessChange = (r0 * weights.z + r1 * weights.x + r2 * weights.y);\n\t\t\t\t\t}\n\t\t\t\t\tfloat roughnessFactor = roughnessChange * ${s.result};\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 roughnessMapCachedUv = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\n\t\t\t\t\tvec4 vals = texture(${e.result}, roughnessMapCachedUv);\n\t\t\t\t\tfloat roughnessFactor = luminance(vals.rgb) * ${s.result};\n\t\t\t\t\t`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\n\t\t\t\t\tconst float roughnessScale = 1.0;\n\n\t\t\t\t\t${n}\n\t\t\t\t`)}else p.push(s.code,"\tfloat roughnessFactor = "+s.result+";");c&&p.push(c.code,"#ifdef ALPHATEST","\tif ( "+c.result+" <= ALPHATEST ) discard;","#endif"),p.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),p.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 );"),u?p.push(u.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+u.result+" ) ), diffuseColor, metalnessFactor );"):p.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),p.push("#include <lights_fragment_begin>"),p.push("#include <lights_fragment_end>"),p.push("vec3 ao = aoEnabled && "+n.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular;");let f="1.0";this.mask&&(this.mask.analyze(t),f=`luminance(${this.mask.flow(t,"v3").result})`),p.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${l.result} );\n\t\t\t\t\t\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t`),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>"),e=p.join("\n")}return e}},kP=class extends tE{constructor(){super("toon"),this.nodeType="Toon",this.color=new WE(ox),this.specular=new WE(1118481),this.shininess=new _E(30),this.previousModelViewMatrix=new JE,this.previouseProjectionMatrix=new JE,this.shadingAlpha=new _E(1),this.shadingBlend=new HE(0)}get category(){return"toon"}build(t){let e;if(t.define("TOON"),t.requires.lights=!0,t.extensions.derivatives=!0,t.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(t,"v3",{cache:"position"}):void 0;t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({resolution:OP.resolution}),t.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),t.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),t.mergeUniform(gn.merge([Bn.fog,Bn.lights])),t.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("\n"));let n=["#include <beginnormal_vertex>","#include <morphnormal_vertex>","\n\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#endif\n\n\t\t\t\tvec3 displaced_position = position;\n\t\t\t\tvec3 displaced_normal = objectNormal;\n\n\t\t\t\t#ifdef USE_LAYER_DISPLACE\n\t\t\t\t\tvec3 transformed;\n\t\t\t\t\tvec3 transformedNormal;\n\t\t\t\t#endif\n\t\t\t\t","#include <normal_vertex>","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t#endif\n\t\t\t\t"];i&&n.push(i.code,i.result?"displaced_position = "+i.result+";
2":""),n.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("\t#include <project_vertex>","\t#include <fog_vertex>","\t#include <clipping_planes_vertex>","\tvViewPosition = - mvPosition.xyz;","\t#include <worldpos_vertex>","\t#include <shadowmap_vertex>","\t#include <fog_vertex>"),n.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),e=n.join("\n")}else{t.mergeUniform({penumbraSize:OP.penumbraSize}),t.mergeUniform({frameIndex:OP.frameIndex}),t.mergeUniform({aoMap:OP.aoRenderTarget}),t.mergeUniform({aoEnabled:OP.aoEnabled}),void 0===this.color&&(this.color=new WE(ox)),this.color.analyze(t,{slot:"color"}),this.specular.analyze(t),this.shininess.analyze(t),this.shadingAlpha.analyze(t),this.shadingBlend.analyze(t),this.afterColor&&this.afterColor.analyze(t,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(t);let i=this.color.flow(t,"c",{slot:"color"}),n=this.specular.flow(t,"c"),r=this.shininess.flow(t,"f"),s=this.shadingAlpha.flow(t,"f"),a=this.shadingBlend.flow(t,"i"),o=this.afterColor?this.afterColor.flow(t,"c",{slot:"afterColor"}):void 0,l=this.alpha?this.alpha.flow(t,"f"):void 0,h=this.alphaOverride?this.alphaOverride.flow(t,"f"):void 0;t.requires.transparent=void 0!==l,t.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>","\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t\tstruct ToonMaterial {\n\t\t\t\t\t\tvec3\tdiffuseColor;\n\t\t\t\t\t\tvec3\tspecularColor;\n\t\t\t\t\t\tfloat\tspecularShininess;\n\t\t\t\t\t\tfloat\tspecularStrength;\n\t\t\t\t\t};\n\t\t\t\t\tvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\t\t\t\t\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t\t\t\n\t\t\t\t\t\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\t\t\t\t\t\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\t\t\t\t\t}\n\t\t\t\t\tvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\t\t\t\t\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\t\t\t\t\t}\n\t\t\t\t\t#define RE_Direct\t\t\t\tRE_Direct_Toon\n\t\t\t\t\t#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\t\t\t\t\t#define Material_LightProbeLOD( material )\t(0)\n\t\t\t\t\t","#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join("\n"));let c=["#include <normal_fragment_begin>","\n\t\t\t\t// NOTE: gl_FrontFacing alternative using face normal estimation.\n\t\t\t\tvec3 viewdx = dFdx(vViewPosition);\n\t\t\t\tvec3 viewdy = dFdy(vViewPosition);\n\t\t\t\tvec3 faceNormal = normalize(cross(viewdx,viewdy));\n\t\t\t\tif (dot(normal, faceNormal) < 0.0) {\n\t\t\t\t\tnormal *= -1.0;\n\t\t\t\t}\n\t\t\t\t","\tToonMaterial material;"];
2if(this.bumpMap){t.include(FP.dHdxy),t.include(FP.perturbNormalArb);let e=this.bumpMap.texture.flow(t,"t"),i=this.bumpMap.flow(t,"v3"),n=this.bumpMapIntensity?this.bumpMapIntensity.flow(t,"f").result:"1.0",r="";r=4===this.bumpMap.projection.value?`\n\t\t\t\t\tvec3 bumpNormal = vec3(0.0);\n\t\t\t\t\t{\n\t\t\t\t\t\tvec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(${e.result}, uv0, ${n});\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(${e.result}, uv1, ${n});\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(${e.result}, uv2, ${n});\n\t\t\t\t\t\tvec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;\n\t\t\t\t\t\tbumpNormal = normalize(bumpNormal);\n\t\t\t\t\t}\n\n\t\t\t\t\tnormal = bumpNormal;\n\t\t\t\t\t`:`\n\t\t\t\t\tvec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(${e.result}, bumpMapCachedUv, ${n});\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t`,c.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t${i.result};\n\t\t\t\t\t${r}\n\t\t\t\t\t`)}c.push(i.code,"\tvec3 diffuseColor = "+i.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",n.code,"\tvec3 specular = "+n.result+";",r.code,"\tfloat shininess = max( 0.0001, "+r.result+" );","\tfloat specularStrength = 1.0;"),l&&c.push(l.code,"#ifdef ALPHATEST","if ( "+l.result+" <= ALPHATEST ) discard;","#endif"),c.push("material.diffuseColor = diffuseColor;"),c.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),c.push("vec3 ao = aoEnabled ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * ao) + reflectedLight.directSpecular;");let d="1.0";this.mask&&(this.mask.analyze(t),d=`luminance(${this.mask.flow(t,"v3").result})`),c.push(`\n\t\t\t\tif (outgoingLight != diffuseColor) {\n\t\t\t\t\tfloat lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );\n\t\t\t\t\taccumAlpha += ( 1.0 - accumAlpha ) * ${s.result} * ${d} * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ${s.result} * ${d}, ${a.result} );\n\t\t\t\t}\n\t\t\t\t`),o&&c.push(o.code,`outgoingLight = spe_blend(outgoingLight, ${o.result}, 1.0, SPE_BLENDING_NORMAL);`),l?c.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${l.result} );`):c.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h&&c.push(`gl_FragColor.a *= ${h.result};`),c.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),e=c.join("\n")}return e}},VP=class{constructor(t=1e4){this.timeout=t,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.head.next=this.tail,this.tail.prev=this.head}log(...t){}remove(t){let e=this.cache.get(t);e&&(this.dispose(t,e.data),this.cache.delete(t),e.prev.next=e.next,e.next.prev=e.prev)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,setTimeout(()=>{this.hasClean=!1,this.log("cleaning");let t=Date.now(),e=this.head.next;for(;e.time<t-this.timeout;)this.dispose(e.src,e.data),this.cache.delete(e.src),e=e.next,e.prev=this.head,this.head.next=e;this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(t){return this.cache.get(t)?.data}load(t){let e=Date.now(),i=this.cache.get(t);return void 0===i?(i={data:this.create(t),src:t,time:e,next:null,prev:null},this.cache.set(t,i)):(i.time=e,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}},jP=class extends VP{create(t){return URL.createObjectURL(new Blob([t]))}dispose(t,e){URL.revokeObjectURL(e)}};var GP=class{constructor(t,e){this.data=t,this.cache=e,this.refCount=0}deref(){this.refCount,this.refCount-=1,0===this.refCount&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount,0}},WP=class{constructor(){this.cache=new Map}remove(t){this.cache.delete(t.data),0}load(t){let e=this.cache.get(t);return void 0===e&&(e=this.create(t),this.cache.set(t,e)),e.refCount+=1,e}},HP=class extends GP{constructor(t,e){super(t,e.imageHolderCache),this.data=t,this.shared=e,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo="video"===t.type,this.isBuffer=!0===t.isWebGLRenderTarget,this.loadPromise=this.updateSrc(this.isBuffer?t:t.data)}async updateSrc(t){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1;let e=()=>{this.loaded=!0;for(let t of Object.values(this._cache))for(let e of Object.values(t))for(let t of Object.values(e))t&&(t.image=this.img,t.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=t,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInl
2ine=!0,this.img.currentTime=.01,"string"!=typeof t){var i=new FileReader;let e;i.readAsDataURL(new Blob([t],{type:"video/mp4"})),await new Promise(t=>{i.onloadend=i=>{e=i.target?.result,t(null)}}),this.img.src=e}else this.img.src=t;this.img.onloadeddata=()=>{e()}}else this.img=new Image,this.img.src=function(t){return"string"==typeof t?t:(RP||(RP=new jP),RP.load(t))}(t),this.img.onload=e,await new Promise(t=>{this.img.onload=()=>{e(),t(null)}})}getTexture(t,e=1008,i=1006){let n=this._cache[t]?.[e]?.[i];if(n)return n;{let n;return n=this.isBuffer?this.img.texture:this.isVideo?new Fa(this.img,void 0,t,t):new fe(this.img,void 0,t,t,i,e),this.loaded&&(n.needsUpdate=!0),void 0===this._cache[t]&&(this._cache[t]={}),void 0===this._cache[t][e]&&(this._cache[t][e]={}),this._cache[t][e][i]=n,n}}setNeedsUpdate(t){for(let e of Object.values(this._cache))for(let i of Object.values(e))for(let e of Object.values(i))e&&(e.needsUpdate=t)}disposeTextures(){for(let[t,e]of Object.entries(this._cache))for(let[i,n]of Object.entries(e))for(let[e,r]of Object.entries(n))r?.dispose(),void 0!==this._cache[t]&&void 0!==this._cache[t][i]&&(this._cache[t][i][e]=void 0)}dispose(){super.dispose(),this.disposeTextures()}},qP=class extends HP{};function XP(t,e){var i=function(t){if(!QP[t]){var e=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")),i="06/25/2014, 00:00:00"===e||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===e;QP[t]=i?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return QP[t]}(e);return i.formatToParts?function(t,e){try{for(var i=t.formatToParts(e),n=[],r=0;r<i.length;r++){var s=YP[i[r].type];s>=0&&(n[s]=parseInt(i[r].value,10))}return n}catch(ky){if(ky instanceof RangeError)return[NaN];throw ky}}(i,t):function(t,e){var i=t.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[n[3],n[1],n[2],n[4],n[5],n[6]]}(i,t)}var YP={year:0,month:1,day:2,hour:3,minute:4,second:5};var QP={};function ZP(t,e,i,n,r,s,a){var o=new Date(0);return o.setUTCFullYear(t,e,i),o.setUTCHours(n,r,s,a),o}var KP=36e5,JP={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function $P(t,e,i){var n,r,s;if(!t||(n=JP.timezoneZ.exec(t)))return 0;if(n=JP.timezoneHH.exec(t))return eT(s=parseInt(n[1],10))?-s*KP:NaN;if(n=JP.timezoneHHMM.exec(t)){s=parseInt(n[1],10);var a=parseInt(n[2],10);return eT(s,a)?(r=Math.abs(s)*KP+6e4*a,s>0?-r:r):NaN}if(function(t){if(iT[t])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:t}),iT[t]=!0,!0}catch{return!1}}(t)){e=new Date(e||Date.now());var o=i?e:function(t){return ZP(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}(e),l=tT(o,t),h=i?l:function(t,e,i){var n=t.getTime(),r=n-e,s=tT(new Date(r),i);if(e===s)return e;r-=s-e;var a=tT(new Date(r),i);return s===a?s:Math.max(s,a)}(e,l,t);return-h}return NaN}function tT(t,e){var i=XP(t,e),n=ZP(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),r=t.getTime(),s=r%1e3;return n-(r-=s>=0?s:1e3+s)}function eT(t,e){return-23<=t&&t<=23&&(null==e||0<=e&&e<=59)}var iT={};var nT=h(p(),1),rT=h(f(),1),sT=36e5,aT=6e4,oT={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 lT(t,e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===t)return new Date(NaN);var i={},n=null==i.additionalDigits?2:(0,nT.default)(i.additionalDigits);if(2!==n&&1!==n&&0!==n)throw new RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))return new Date(t.getTime());if("number"==typeof t||"[object Number]"===Object.prototype.toString.call(t))return new Date(t);if("string"!=typeof t&&"[object String]"!==Object.prototype.toString.call(t))return new Date(NaN);var r=function(t){var e,i={},n=oT.dateTimePattern.exec(t);if(n?(i.date=n[1],e=n[3]):(n=oT.datePattern.exec(t),n?(i.date=n[1],e=n[2]):(i.date=null,e=t)),e){var r=oT.timeZone.exec(e);r?(i.time=e.replace(r[1],""),i.timeZone=r[1].trim()):i.time=e}return i}(t),s=function(t,e){var i,n=oT.YYY[e],r=oT.YYYYY[e];if(i=oT.YYYY.exec(t)||r.exec(t),i){var s=i[1];return{year:parseInt(s,10),restDateString:t.slice(s.length)}}if(i=oT.YY.exec(t)||n.exec(t),i){var a=i[1];return{year:100*parseInt(a,10),restDateString:t.slice(a.length)}}return{year:null}}(r.date,n),a=s.year,o=function(t,e){if(null===e)return null;var i,n,r,s;if(0===t.length)return n=new Date(0),n.setUTCFullYear(e),n;if(i=oT.MM.exec(t),i)return n=new Date(0),r=parseInt(i[1],10)-1,pT(e,r)?(n.setUTCFullYear(e,r),n):new Date(NaN);if(i=oT.DDD.exec(t),i){n=new Date(0);var a=parseInt(i[1],10);return function(t,e){if(e<1)return!1;var i=uT(t);return!(i&&e>366||!i&&e>365)}(e,a)?(n.setUTCFullYear(e,0,a),n):new Date(NaN)}if(i=oT.MMDD.exec(t),i){n=new Date(0),r=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return pT(e,r,o)?(n.setUTCFullYear(e,r,o),n):new Date(NaN)}if(i=oT.Www.exec(t),i)return s=parseInt(i[1],10)-1,fT(e,s)?hT(e,s):new Date(NaN);if(i=oT.WwwD.exec(t),i){s=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return fT(e,s,l)?hT(e,s,l):new Date(NaN)}return null}(s.restDateString,a);if(isNaN(o))return new Date(NaN);if(o){var l,h=o.getTime(),c=0;if(r.time&&(c=function(t){var e,i,n;if(e=oT.HH.exec(t),e)return i=parseFloat(e[1].replace(",",".")),mT(i)?i%24*sT:NaN;if(e=oT.HHMM.exec(t),e)return i=parseInt(e[1],10),n=parseFloat(e[2].replace(",",".")),mT(i,n)?i%24*sT+n*aT:NaN;if(e=oT.HHMMSS.exec(t),e){i=parseInt(e[1],10),n=parseInt(e[2],10);var r=parseFloat(e[3].replace(",","."));return mT(i,n,r)?i%24*sT+n*aT+1e3*r:NaN}return null}(r.time),isNaN(c)))return new Date(NaN);if(r.timeZone||i.timeZone){if(l=$P(r.timeZone||i.timeZone,new Date(h+c)),isNaN(l))return new Date(NaN)}else l=(0,rT.default)(new Date(h+c)),l=(0,rT.default)(new Date(h+c+l));return new Date(h+c+l)}return new Date(NaN)}function hT(t,e,i){e=e||0,i=i||0;var n=new Date(0);n.setUTCFullYear(t,0,4);var r=7*e+i+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+r),n}var cT=[31,28,31,30,31,30,31,31,30,31,30,31],dT=[31,29,31,30,31,30,31,31,30,31,30,31];function uT(t){return t%400==0||t%4==0&&t%100!=0}function pT(t,e,i){if(e<0||e>11)return!1;if(null!=i){if(i<1)return!1;var n=uT(t);if(n&&i>dT[e]||!n&&i>cT[e])return!1}return!0}function fT(t,e,i){return!(e<0||e>52||null!=i&&(i<0||i>6))}function mT(t,e,i){return!(null!=t&&(t<0||t>=25)||null!=e&&(e<0||e>=60)||null!=i&&(i<0||i>=60))}function gT(t,e){return e.color(t)}function vT(t=new Date,e){let i=e.format,n=t.getSeconds(),r=t;
2e&&null!==e.timeZone&&(r=function(t,e,i){var n=lT(t,i),r=$P(e,n,!0),s=new Date(n.getTime()-r),a=new Date(0);return a.setFullYear(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()),a.setHours(s.getUTCHours(),s.getUTCMinutes(),s.getUTCSeconds(),s.getUTCMilliseconds()),a}(new Date,e.timeZone));let s,a=r.getHours(),o=r.getMinutes();"12ampm"===e.format12h24h&&(s=a>=12?"PM":"AM");let l,h,c=a;switch("24"!==e.format12h24h&&(c=a%12,0===c&&(c=12)),i){case"HH:mm:ss":l=[c,o,n];break;case"HH:mm":l=[c,o];break;case"HH":l=[c],s=void 0;break;case"mm":l=[o],s=void 0;break;case"ss":l=[n],s=void 0;break;case"year":h=r.getFullYear();break;case"month":h=r.getMonth()+1;break;case"dayOfYear":h=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":h=r.getDate();break;case"secondOfDay":h=60*a*60+60*o+n;break;default:h=0}return void 0!==l?{textValue:l,suffix:s}:h}function yT(t,e){switch(t.type){case"fresnel":return function(t,e){let{bias:i,scale:n,intensity:r,factor:s,color:a}=t;return{...bT(t,e),color:gT(a,e),bias:i,scale:n,intensity:r,factor:s}}(t,e);case"gradient":return function(t,e){let{gradientType:i,smooth:n,colors:r,steps:s,angle:a,offset:o,morph:l}=t;return{...bT(t,e),gradientType:i,smooth:n,colors:r.map(t=>new me(t[0],t[1],t[2],t[3])),num:r.length,steps:s,offset:new Ht(...o),morph:new Ht(...l),angle:a}}(t,e);case"depth":return function(t,e){let{gradientType:i,near:n,far:r,isVector:s,isWorldSpace:a,origin:o,direction:l,colors:h,steps:c,smooth:d}=t;return{...bT(t,e),gradientType:i,near:n,far:r,isVector:s,isWorldSpace:a,origin:new be(...o),direction:l?new be(...l):new be(1,0,0),colors:h.map(t=>void 0!==t?new me(t[0],t[1],t[2],t[3]):new me(0,0,0,0)),steps:c.slice(0,h.length),smooth:d}}(t,e);case"normal":return function(t,e){let{cnormal:i}=t;return{...bT(t,e),cnormal:new be(i[0],i[1],i[2])}}(t,e);case"noise":return function(t,e){return{...bT(t,e),scale:t.scale,move:t.move,fA:new Ht(...t.fA),fB:new Ht(...t.fB),size:new be(...t.size),distortion:new Ht(...t.distortion),colorA:gT(t.colorA,e),colorB:gT(t.colorB,e),colorC:gT(t.colorC,e),colorD:gT(t.colorD,e),noiseType:t.noiseType,voronoiStyle:t.voronoiStyle,highCut:t.highCut,lowCut:t.lowCut,smoothness:t.smoothness,seed:t.seed,quality:t.quality}}(t,e);case"rainbow":return function(t,e){return{...bT(t,e),filmThickness:t.filmThickness,movement:t.movement,wavelengths:new be(...t.wavelengths),noiseStrength:t.noiseStrength,noiseScale:t.noiseScale,offset:new be(...t.offset)}}(t,e);case"toon":return function(t,e){return{...bT(t,e),positioning:t.positioning,colors:t.colors.map(t=>new me(t[0],t[1],t[2],t[3])),num:t.colors.length,steps:t.steps,source:new be(...t.source),isWorldSpace:t.isWorldSpace,noiseStrength:t.noiseStrength,noiseScale:t.noiseScale,shadowColor:gT(t.shadowColor,e),offset:new be(...t.offset)}}(t,e);case"outline":return function(t,e){return{...bT(t,e),outlineColor:gT(t.outlineColor,e),contourColor:gT(t.contourColor,e),outlineWidth:t.outlineWidth,contourWidth:t.contourWidth,outlineThreshold:t.outlineThreshold,contourThreshold:t.contourThreshold,outlineSmoothing:t.outlineSmoothing,contourFrequency:t.contourFrequency,contourDirection:new be(...t.contourDirection),positionalLines:t.positionalLines,compensation:t.compensation}}(t,e);case"transmission":return function(t,e){return{...bT(t,e),thickness:t.thickness,ior:t.ior,roughness:t.roughness}}(t,e);case"color":return function(t,e){return{...bT(t,e),color:gT(t.color,e)}}(t,e);case"pattern":return function(t,e){return{...bT(t,e),style:t.style,projection:t.projection,axis:t.axis,blending:t.blending,offset:new Ht(...t.offset),colorA:gT(t.colorA,e),colorB:gT(t.colorB,e),frequency:new Ht(...t.frequency),size:t.size,variation:t.variation,smoothness:t.smoothness,zigzag:t.zigzag,rotation:t.rotation,vertical:new Ht(...t.vertical),horizontal:new Ht(...t.horizontal),sides:t.sides}}(t,e)}}function xT(t){return{type:t.type}}function bT(t,e){let{alpha:i,mode:n,isMask:r}=t,s="string"==typeof i?(Number(e.getVariable(i))??100)/100:i;return{...xT(t),alpha:s,mode:n,isMask:r}}var wT=class extends oE{},ST={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},_T={depth:["colors"]};function AT(t,e,i){if("isMask"===e)return!0;let n=ST[t.type],r=_T[t.type];if(void 0!==r){let n=t.color;if(r.includes(e)){let t=n[e]?.value?.length;if(void 0!==t&&t!==i.length)return!0}}return void 0!==n&&n.includes(e)}function MT(t,e,i){let n=i.uniforms[`f${i.id}_texture`];if(!n)return!1;let r=!1,s=t;if("image"in s){let t=s.image,i=e.image(t),r=n;r.image instanceof qP||r.image.deref(),r.image=i}if("video"in s){let t=s.video,i=e.video(t),r=n;r.image instanceof qP||r.image.deref(),r.image=i}if("wrapping"in s){n.wrap=s.wrapping}if("minFilter"in s){n.minFilter=s.minFilter}if("magFilter"in s){n.magFilter=s.magFilter}if("rotation"in s&&i.uniforms[`f${i.id}_rotation`])return i.uniforms[`f${i.id}_rotation`].value=(s.rotation??0)*Wt.DEG2RAD,r;if("repeat"in s||"offset"in s||"rotation"in s){let t="mat",e=i.uniforms[`f${i.id}_${t}`];"repeat"in s&&(e.repeat=s.repeat),"offset"in s&&(e.offset=s.offset),"rotation"in s&&
2(e.rotation=s.rotation??0),e.updateMatrix()}return r}var CT=(t,e,i)=>Math.max(0,Math.min(1,Number(e.getVariable("number"==typeof t?100*t:t,i)??100)/100))??1,ET=class{constructor(t,e,i,n,r){this.id=t,this.uuid=e,this.data=i,this.uniforms={};for(let s in n)this.uniforms[`f${this.id}_${s}`]=n[s];for(let s in i)OT(s,this,i,r)}get type(){return this.data.type}static create(t,e,i,n){if("light"===i.type)return DT.createLightLayer(t,e,i,n);if("texture"===i.type||"video"===i.type){let r="texture"===i.type?n.uiBuffer(i.texture.image)??n.image(i.texture.image):n.video(i.texture.video),s=new ZE(r,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),a=new QE(r),o=new tP(i.texture.repeat,i.texture.offset,i.texture.rotation??0),l=new _E(i.crop?1:0),h=new HE(i.projection??0),c=new HE(["x","y","z"].indexOf(i.axis)??0),d=new HE(i.side??0),u=new sE(i.size?new Ht(i.size[0],i.size[1]):new Ht(100,100)),p=new _E(i.blending??0),f=new _E(CT(i.alpha,n)),m=new HE(i.mode??0),g=new qE(i.isMask??!1),v=new lP(s,a,l,h,c,d,u,p,o,f,m,g),y=new wE(v.calpha,"f");return new PT(t,e,i,{texture:s,textureSize:a,crop:l,projection:h,axis:c,side:d,size:u,blending:p,mat:o,alpha:f,mode:m,isMask:g},v,m,y,g,n)}if("matcap"===i.type){let r=n.image(i.texture.image),s=new ZE(r,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),a=new _E(CT(i.alpha,n)),o=new HE(i.mode??0),l=new qE(i.isMask??!1),h=new _E((i.texture.rotation??0)*Wt.DEG2RAD),c=new mP(s,a,o,l,h),d=new wE(c.calpha,"f");return new PT(t,e,i,{texture:s,alpha:a,mode:o,isMask:l,rotation:h},c,o,d,l,n)}if("displace"===i.type){if("noise"===i.displacementType){let r=new aE(new be(...i.offset)),s=new _E(i.scale??10),a=new _E(i.intensity??8),o=new _E(i.movement??1),l=new HE(i.noiseType??0),h=new HE(i.voronoiStyle??0),c=new _E(i.smoothness??.5),d=new _E(i.seed??0),u=new _E(i.highCut??1),p=new _E(i.lowCut??0),f=new HE(i.quality??1),m=new IP(a,o,r,h,c,d,u,p,f,s,l);return new TT(t,e,i,{offset:r,scale:s,intensity:a,movement:o,noiseType:l,voronoiStyle:h,smoothness:c,seed:d,highCut:u,lowCut:p,quality:f},m,n)}throw new Error}return function(t,e,i,n){let r=yT(i,n);return function(t,e,i,n,r){switch(t.type){case"color":{let s=new WE(n.color??ox),a=IT(n),o=new rP(s,a.alpha),l=new wE(o.calpha,"f");return new PT(e,i,t,{color:s,...a},o,a.mode,l,a.isMask,r)}case"fresnel":{let s=new WE(n.color??16777215),a=new _E(n.bias??.1),o=new _E(n.scale??1),l=new _E(n.intensity??2),h=new _E(n.factor??1),c=IT(n),d=new dP(s,a,o,l,h,c.alpha,c.mode,c.isMask),u=new wE(d.calpha,"f");return new PT(e,i,t,{color:s,bias:a,scale:o,intensity:l,factor:h,...c},d,c.mode,u,c.isMask,r)}case"rainbow":{let s=new _E(n.filmThickness??30),a=new _E(n.movement??0),o=new aE(n.wavelengths??new be(0,0,0)),l=new _E(n.noiseStrength??0),h=new _E(n.noiseScale??1),c=new aE(n.offset??new be(0,0,0)),d=IT(n),u=new _P(s,a,o,l,h,c,d.alpha,d.isMask),p=new wE(u.calpha,"f");return new PT(e,i,t,{filmThickness:s,movement:a,wavelengths:o,noiseStrength:l,noiseScale:h,offset:c,...d},u,d.mode,p,d.isMask,r)}case"transmission":{let s=new _E(n.thickness??10),a=new _E(n.ior??1.5),o=new _E(n.roughness??.5),l=OP.transmissionSize,h=OP.transmissionRenderTarget,c=OP.transmissionRenderTargetDepth,d=window.innerWidth,u=window.innerHeight,p=d>=u?new sE(u/d,1):new sE(1,d/u),f=IT(n),m=new PP(s,a,o,l,h,c,p,f.alpha),g=new wE(m.calpha,"f");return new PT(e,i,t,{thickness:s,ior:a,roughness:o,aspectRatio:p,...f},m,f.mode,g,f.isMask,r)}case"toon":{let s,a,o=new HE(n.positioning??0);n.colors?s=new eP(n.colors.length,n.colors):(s=new eP(10,new me(0,0,0,1)),s.value[1]=new me(1,1,1,1)),n.steps?a=new XE(n.steps.length,n.steps):(a=new XE(10,1),a.value[0]=0);let l=new aE(n.source??new be(0,0,0)),h=new qE(n.isWorldSpace??!0),c=new _E(n.noiseStrength??0),d=new _E(n.noiseScale??1),u=new lE(n.shadowColor),p=new aE(n.offset??new be(0,0,0)),f=IT(n),m=new MP(o,s,a,l,h,c,d,u,p,f.alpha),g=new wE(m.calpha,"f");return new PT(e,i,t,{positioning:o,colors:s,steps:a,source:l,isWorldSpace:h,noiseStrength:c,noiseScale:d,shadowColor:u,offset:p,...f},m,f.mode,g,f.isMask,r)}case"outline":{let s=new WE(n.outlineColor??16777215),a=new WE(n.contourColor??16777215),o=new _E(n.outlineWidth??.1),l=new _E(n.contourWidth??.1),h=new _E(n.outlineThreshold??.1),c=new _E(n.contourThreshold??.1),d=new _E(n.outlineSmoothing??.1),u=new _E(n.contourFrequency??.1),p=new aE(n.contourDirection??new be(0,1,0)),f=new qE(n.positionalLines??!1),m=new qE(n.compensation??!0),g=OP.normalRenderTarget,v=OP.normalRenderTargetDepth,y=OP.pixelRatioNode,x=OP.resolution,b=IT(n),w=new xP(s,a,o,l,h,c,d,u,p,f,m,x,g,v,y,b.alpha),S=new wE(w.calpha,"f");return new PT(e,i,t,{outlineColor:s,contourColor:a,outlineWidth:o,contourWidth:l,outlineThreshold:h,contourThreshold:c,outlineSmoothing:d,contourFrequency:u,contourDirection:p,positionalLines:f,compensation:m,...b},w,b.mode,S,b.isMask,r)}case"depth":{let s,a,o=new HE(n.gradientType??0),l=new qE(n.smooth??!1),h=new _E(n.near??50),c=new _E(n.far??200),d=new _E(n.isVector??1),u=new _E(n.isWorldSpace??0),p=new aE(n.origin??new be),f=new aE(n.direction??new be);n.colors?s=new eP(n.colors.length,n.colors):(s=new eP(2,new me(0,0,0,1)),s.value[1]=new me(1,1,1,1)),n.steps?a=new XE(n.steps.length,n.steps):(a=new XE(2,1),a.value[0]=0);let m=IT(n),g=new cP(o,l,h,c,d,u,p,f,s,a,m.alpha,m.isMask),v=new wE(g.calpha,"f");return new PT(e,i,t,{gradientType:o,smooth:l,near:h,far:c,isVector:d,isWorldSpace:u,origin:p,direction:f,colors:s,steps:a,...m},g,m.mode,v,m.isMask,r)}case"noise":{let s=new _E(n.scale??1),a=new aE(n.size??new be(100,100,100)),o=new _E(n.move??1),l=new sE(n.fA??new Ht(1.7,9.2)),h=new sE(n.fB??new Ht(8.3,2.8)),c=new sE(n.distortion??new Ht(1,1)),d=new lE(n.colorA),u=new lE(n.colorB),p=new lE(n.colorC),f=new lE(n.colorD),m=new HE(n.noiseType??0),g=new HE(n.voronoiStyle??0),v=new _E(n.highCut??1),y=new _E(n.lowCut??0),x=new _E(n.smoothness??.5),b=new _E(n.seed??.5),w=new HE(n.quality??1),S=IT(n),_=new vP(s,a,o,l,h,c,d,u,p,f,S.alpha,m,S.isMask,g,v,y,x,b,w),A=new wE(_.calpha,"f");return new PT(e,i,t,{scale:s,size:a,move:o,fA:l,fB:h,distortion:c,colorA:d,colorB:u,colorC:p,c
2olorD:f,noiseType:m,...S,voronoiStyle:g,highCut:v,lowCut:y,smoothness:x,seed:b,quality:w},_,S.mode,A,S.isMask,r)}case"normal":{let s=new aE(n.cnormal??new be(1,1,1)),a=IT(n),o=new aP(s,a.alpha),l=new wE(o.calpha,"f");return new PT(e,i,t,{cnormal:s,...a},o,a.mode,l,a.isMask,r)}case"gradient":{let s,a,o=new HE(n.gradientType??0),l=new qE(n.smooth??!1);n.colors?s=new eP(n.colors.length,n.colors):(s=new eP(10,new me(0,0,0,1)),s.value[1]=new me(1,1,1,1)),n.steps?a=new XE(n.steps.length,n.steps):(a=new XE(10,1),a.value[0]=0);let h=new sE(n.offset??new Ht(0,0)),c=new sE(n.morph??new Ht(0,0)),d=new _E(n.angle??0),u=IT(n),p=new pP(o,l,s,a,h,c,d,u.alpha,u.isMask),f=new wE(p.calpha,"f");return new PT(e,i,t,{gradientType:o,smooth:l,colors:s,steps:a,offset:h,morph:c,angle:d,...u},p,u.mode,f,u.isMask,r)}case"pattern":{let s=new HE(n.style??0),a=new HE(n.projection??0),o=new HE(["x","y","z"].indexOf(n.axis)??0),l=new _E(n.blending??0),h=new sE(n.offset??new Ht(0,0)),c=new lE(n.colorA),d=new lE(n.colorB),u=new sE(n.frequency??new Ht(10,10)),p=new _E(n.size??.5),f=new _E(n.variation??0),m=new _E(n.smoothness??.5),g=new _E(n.zigzag??0),v=new _E(n.rotation??0),y=new sE(n.vertical??new Ht(0,1)),x=new sE(n.horizontal??new Ht(0,1)),b=new HE(n.sides??6),w=IT(n),S=new wP(s,a,o,l,h,c,d,u,p,f,m,g,v,y,x,b,w.alpha,w.isMask),_=new wE(S.calpha,"f");return new PT(e,i,t,{style:s,projection:a,axis:o,blending:l,offset:h,colorA:c,colorB:d,frequency:u,size:p,variation:f,smoothness:m,zigzag:g,rotation:v,vertical:y,horizontal:x,sides:b,...w},S,w.mode,_,w.isMask,r)}default:{let s=new WE(1,0,0,1),a=IT(n),o=new rP(s,a.alpha),l=new wE(o.calpha,"f");return new PT(e,i,t,{color:s,...a},o,a.mode,l,a.isMask,r)}}}(i,t,e,r,n)}(t,e,i,n)}updateByOp(t,e,i){let n=t;if(void 0===n.path[0]){if(0===n.type)return"type"in n.props||"category"in n.props||"visible"in n.props||"noiseType"in n.props?(i.scene.markNeedsUpdateRendererDirty(),!0):function(t,e,i,n){let r=!1;for(let[s,a]of Object.entries(t)){if("bumpMap"===s||"roughnessMap"===s){r=!0;continue}if(!s||void 0===a)continue;if(OT(s,i,n,e)){"visible"===s&&"light"===i.type&&(r=!0);continue}i.visible=n.visible;let t=i.uniforms[`f${i.id}_${s}`];if(t&&!(t instanceof YE))switch(r=r||AT(i,s,a),t.constructor){case WE:if("string"==typeof a){let i=e.getColor(a);i&&(t.value=i);break}{let e=a;t.value instanceof wT?t.value=new oE(e.r,e.g,e.b,e.a):t.setRGBA(e);break}case lE:if("string"==typeof a){let i=e.getColor(a);i&&(t.value=i);break}{let e=a;t.value instanceof wT?t.value=new oE(e.r,e.g,e.b,e.a):t.value.setRGBA(e.r,e.g,e.b,e.a);break}case sE:{let e=a;t.value.setX(e[0]),t.value.setY(e[1]);break}case aE:{let e=a;t.value.setX(e[0]),t.value.setY(e[1]),t.value.setZ(e[2]);break}case SE:MT(a,e,i);break;case eP:t.value=a.map(t=>new me(...t));break;default:t.value=a}}return r}(n.props,i.shared,this,e)}else if("texture"===n.path[0])return!("texture"in e)&&!("video"in e)||MT(n.props,i.shared,this);return!1}dispose(){if(function(t){let e=t instanceof ET?t.type:t;return"texture"===e||"video"===e||"displace_map"===e||"matcap"===e}(this)){let t=this.uniforms[`f${this.id}_texture`];if(!t)return!1;let e=t;e.image instanceof qP||e.image.deref()}}hasValueByKey(t){return void 0!==this.uniforms[t]}hasValue(t){return this.hasValueByKey(`f${this.id}_${t}`)}setValue(t,e){let i=`f${this.id}_${t}`;this.hasValueByKey(i)&&void 0!==e&&(this.uniforms[i].value=e)}getNode(t){let e=`f${this.id}_${t}`;if(this.hasValueByKey(e))return this.uniforms[e]}getValue(t){let e=`f${this.id}_${t}`;if(this.hasValueByKey(e))return this.uniforms[e].value}getName(t){let e=/f\d+_(.*)/.exec(t);if(e&&e.length>1)return e[1]}getNames(){let t=[];for(let e in this.uniforms){let i=this.getName(e);i&&t.push(i)}return t}},PT=class extends ET{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,l),this.params=n,this.color=r,this.mode=s,this.alpha=a,this.isMask=o}},TT=class extends ET{constructor(t,e,i,n,r,s){super(t,e,i,n,s),this.position=r}},DT=class extends ET{constructor(t,e,i,n,r,s){super(t,e,i,r,s),this.node=n}static createLightLayer(t,e,i,n){let r,s,a=new _E(CT(i.alpha,n)),o=new HE(i.mode),l=new _E(i.bumpMapIntensity),h=new _E(CT(i.alphaOverride,n));if(i.visible)if("lambert"===i.category){r=new zP;let t=new WE(n.color(i.emissive)??0),e=new qE(i.occlusion??!0);s={emissive:t,occlusion:e},r.emissive=t,r.occlusion=e}else if("toon"===i.category){r=new kP;let t=new _E(i.shininess??30),e=new WE(n.color(i.specular)??1118481);s={shininess:t,specular:e},r.shininess=t,r.specular=e}else if("physical"===i.category){r=new UP;let t=new _E(i.roughness??.3),e=new _E(i.metalness??0),n=new _E(i.reflectivity??.5),a=new qE(i.occlusion??!0);s={roughness:t,metalness:e,reflectivity:n,occlusion:a},r.roughness=t,r.metalness=e,r.reflectivity=n,r.occlusion=a}else{r=new NP;let t=new _E(i.shininess??30),e=new WE(void 0!==i.specular?n.color(i.specular)??1118481:1118481),a=new qE(i.occlusion??!0);s={shininess:t,specular:e,occlusion:a},r.shininess=t,r.specular=e,r.occlusion=a}else r=new BP,s={};
2return r.alpha=new _E(1),r.shadingAlpha=a,r.shadingBlend=o,r.bumpMapIntensity=l,r.alphaOverride=h,s.alpha=r.shadingAlpha,s.mode=r.shadingBlend,s.bumpMapIntensity=r.bumpMapIntensity,s.alphaOverride=r.alphaOverride,new DT(t,e,i,r,s,n)}get category(){return this.node.category}};function IT(t){return{alpha:new _E(t.alpha??1),mode:new HE(t.mode??0),isMask:new qE(t.isMask??!1)}}function OT(t,e,i,n){if("displace"===i.type&&("intensity"===t||"visible"===t)){let t=e.uniforms[`f${e.id}_intensity`];return t?(t.value=i.intensity*(i.visible?1:0),t):void 0}if("displace"!==i.type&&("alpha"===t||"visible"===t)){let r=e.uniforms[`f${e.id}_alpha`];if(!r)return;if(r.value=CT(i.alpha,n)*(i.visible?1:0),"outline"===i.type&&"visible"===t){let t=e.uniforms[`f${e.id}_compensation`];t&&(t.value=i.compensation&&i.visible)}return r}}function RT(t,e){let i=0,n=t.layers.find(t=>"light"===t.data.type);if(n){let t=n.data,i=Number(e.getVariable(t.alphaOverride));if(("string"==typeof t.alphaOverride?i/100:t.alphaOverride)<1)return!0}for(let r of t.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 t=r.data.visible?r.data.alpha:0;if("string"==typeof t&&(t=Math.max(0,Math.min(1,Number(e.getVariable(t)??100)/100))),1===t&&"depth"===r.data.type||"gradient"===r.data.type){for(let e of r.data.colors)if(e[3]<1){t=e[3];break}}else if(1===t&&"noise"===r.data.type){let i=e.color(r.data.colorA).a,n=e.color(r.data.colorB).a,s=e.color(r.data.colorC).a,a=e.color(r.data.colorD).a,o=Math.min(i,Math.min(n,Math.min(s,a)));o<1&&(t=o)}i+=(1-i)*t}}return i<1}var LT=class extends vn{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.transparent=!0}customProgramCacheKey(){return""}},BT=class extends LT{constructor(t,e,i,n){super(),this.flatShading=t,this.side=e,this.wireframe=i,this.root=n}updateAfterBuild(){let t=this.root;this.lights=t.lights,this.vertexShader=t.vertexShader,this.fragmentShader=t.fragmentShader,Object.assign(this.defines,t.defines),Object.assign(this.uniforms,t.uniforms),this.extensions=t.extensions,this.transparent=t.transparent,this.cacheKey=t.customProgramCacheKey()+"flat"+this.flatShading+this.side}onBeforeCompile(t,e){this.root.onBeforeCompile(t)}get data(){return this.root.data}get category(){return this.root.category}get hasAO(){return this.root.hasAO}getFlavor(t,e,i,n){return this.root.getFlavor(t,e,i,n)}get layers(){return this.root.layers}get fragment(){return this.root.fragment}getLayersOfType(t){return this.root.getLayersOfType(t)}getLayerByUuid(t){return this.root.getLayerByUuid(t)}updateByOp(t,e,i){this.root.updateByOp(t,e,i)}nodeMaterialDispose(){this.root.nodeMaterialDispose()}},zT=class extends LT{constructor(t,e,i=!0){super(),this.data=t,this.allowVariableSaves=i,this.layerIdGen=0,this.flavors=[],this.masks={},this.type="NodeMaterial",this.updaters=[],this.needsJitter=e.shared.needsJitter,tE.startContext(this),this.reset0(t,e),tE.endContext(this)}get nodeMaterial(){return this}getFlavor(t,e,i,n){let r=i?6:(t?3:0)+e;if(r+=7*((n?.resolutionLevel??0)-(n?.useChildrenColors?4:0)),0===r)return this;void 0===this.flavors&&(this.flavors=[]),r-=1;let s=this.flavors[r];return void 0===s&&(s=new BT(t,e,i,this),s.needsJitter=this.needsJitter,this.flavors[r]=s,s.flatShading=t,s.side=e,s.updateAfterBuild(),n&&(s.defines.SHAPEBLEND=n.resolutionLevel,s.defines.SHAPEBLEND_C=n.useChildrenColors?1:0)),s}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.category}get hasAO(){return this.lightLayer.getNode("occlusion")?.value??!1}reset(t,e,i=!1){tE.startContext(this),(this.data!==t||i)&&this.reset0(t,e),tE.endContext(this)}reset0(t,e){this.data=t;let i=t.layers??zx.defaultTwoLayerData("phong").layers;try{this.layers=i.map(t=>ET.create(this.layerIdGen++,t.id,t.data,e.shared))}catch{this.layers=[]}this.layers.reverse(),this.name=t.name??"Untitled Material",this.onUpdate(e.shared),this.transparent=RT(t,e.
vendor: 5,027 bytes, line 2
2shared),this.saveVariableLocations(e)}onVariableUpdate(t,e,i){if("alphaOverride"===t[0])this.transparent=RT(this.data,i.shared),this.lightLayer.setValue("alphaOverride",Math.max(0,Math.min(Number(e)/100,1)));else if("layer"===t[0]){let n=t[1],r=t[2];if(n&&r){let t=this.layers.find(t=>t.uuid===n);t?.hasValue(r)&&("alpha"===r?(this.transparent=RT(this.data,i.shared),t.setValue(r,Math.max(0,Math.min(Number(e)/100,1)))):t.setValue(r,e))}}}saveVariableLocations(t){if(!this.allowVariableSaves)return;let e=this.data.layers.find(t=>"light"===t.data.type);e&&t.shared.getVariable(e.data.alphaOverride,["material",this.uuid,"alphaOverride"]),this.data.layers.forEach(e=>{"alpha"in e.data&&"string"==typeof e.data.alpha&&t.shared.getVariable(e.data.alpha,["material",this.uuid,"layer",e.id,"alpha"])})}getLayersOfType(t){return this.layers.filter(e=>e.type===t)}getLayerByUuid(t){return this.layers.find(e=>e.uuid===t)}onUpdate(t){this.lightLayer=this.layers.find(t=>t instanceof DT),void 0===this.lightLayer&&(this.lightLayer=new DT(0,"",{...Bx.defaultData("light","phong"),visible:!1},new BP,{},t)),this.dispose();for(let e of this.flavors)e&&e.dispose();this.applyTextureMaps(),this.applyMasks(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.build(),this.nodeContextUuid=0}applyTextureMaps(){let t=this.layers.find(t=>t instanceof DT);if(!t)return;let e=t.data,i=e.bumpMap,n=e.roughnessMap;t.node.bumpMap=void 0,t.node.roughnessMap=void 0;for(let r=0;r<this.layers.length;++r){let e=this.layers[r];e instanceof PT&&e.color instanceof lP&&(e.uuid===i&&(t.node.bumpMap=e.color),e.uuid===n&&(t.node.roughnessMap=e.color))}}updateByOp(t,e,i){if(tE.startContext(this),void 0!==e?this.data=e:e=this.data,this.transparent=RT(e,i.shared),"layers"===t.path[0]){let n=i.shared,r=t.path[1];if(void 0===r)i.scene.markNeedsUpdateRendererDirty(),this.reset0(e,i);else{0===t.type&&void 0!==t.props.occlusion&&i.scene.markNeedsUpdateRendererDirty();let s=this.layers.find(t=>t.uuid===r);if(s){let a,o=e.layers.data(r);0===t.type&&("alpha"in t.props||"alphaOverride"in t.props)&&(a="alpha"in t.props?{...t.props,alpha:CT(t.props.alpha,n,["material",this.uuid,"layer",r,"alpha"])}:{...t.props,alphaOverride:CT(t.props.alphaOverride,n,["material",this.uuid,"alphaOverride"])}),s.updateByOp({...t,...a?{props:a}:{},path:t.path.slice(2)},o,i)&&this.reset0(e,i)}}}else this.reset0(e,i);tE.endContext(this)}applyMasks(){for(let t=0;t<this.layers.length;++t){let e=this.layers[t];e instanceof PT?e.color.mask=void 0:e instanceof DT&&(e.node.mask=void 0)}for(let t=0;t<this.layers.length;++t){let e=this.layers[t];if(e instanceof PT&&e.isMask.value&&e.data.visible&&t>0){let i=t-1,n=this.layers[i];n instanceof DT?n.node.mask=new CE(e.color,e.alpha,CE.MUL):n instanceof PT&&(n.isMask.value||(n.color.mask=new CE(e.color,e.alpha,CE.MUL)))}}}blendColors(){let t=this.layers.findIndex(t=>t instanceof PT),e=this.layers.findIndex(t=>t instanceof DT);if(-1!==t&&t<e){let i=this.layers[t].color;for(let n=t+1;n<e;++n){let t=this.layers[n];if(t instanceof PT){if(t.isMask.value)continue;i=new iP(i,t.color,t.alpha,t.mode)}}this.fragment.color=i}else this.fragment.color=void 0}blendAfterColors(){let t=new wE("outgoingLight","f"),e=this.layers.findIndex(t=>t instanceof DT);if(this.layers.length>e+1){for(let i=e+1;i<this.layers.length;++i){let e=this.layers[i];if(e instanceof PT){if(e.isMask.value)continue;t=new iP(t,e.color,e.alpha,e.mode)}}this.fragment.afterColor=t}else this.fragment.afterColor=void 0}blendPositions(){let t=this.layers.filter(t=>t instanceof TT);if(t.length>0){let e=t[0].position;for(let i=1;i<t.length;++i)t[i]&&(e=new CE(e,t[i].position,CE.ADD),e=new CE(e,new _E(.5).setReadonly(!0),CE.MUL));this.fragment.position=e}else this.fragment.position=void 0}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}onBeforeCompile(t){this.shapeBlendhack&&this.shapeBlendhack(this),t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.extensionDerivatives=!0===this.extensions.derivatives,t.extensionFragDepth=!0===this.extensions.fragDepth,t.extensionDrawBuffers=!0===this.extensions.drawBuffers,t.extensionShaderTextureLOD=!0===this.extensions.shaderTextureLOD}clampUniformsForPreview(t,e){let i=(t,e,i)=>Math.min(Math.max(t,e),i);for(let n of this.layers)if("displace"===n.type){let r=i(n.uniforms[`f${n.id}_intensity`].value,t,e);n.uniforms[`f${n.id}_intensity`].value=r}}updateFrame(t){for(let e=0;e<this.updaters.length;++e)t.updateNode(this.updaters[e])}build(){let t=new GE;t.needsJitter=this.needsJitter,this.lights=this.lightLayer.data.visible,t.build(this.fragment,this.fragment),this.vertexShader=t.getCode("vertex"),this.fragmentShader=t.getCode("fragment"),this.defines=t.defines,this.uniforms=t.uniforms,this.extensions=t.extensions,this.updaters=t.updaters;for(let e of this.flavors)e&&e.updateAfterBuild();return this.shadersPatchedForShapeBlend=!1,this}
2nodeMaterialDispose(){this.layers.forEach(t=>t.dispose()),super.dispose();for(let t of this.flavors)t&&t.dispose()}assetsLoaded(){for(let t of this.layers)if(t instanceof PT){let e=t.params.texture;if(e instanceof ZE&&!e.image.loaded)return!1}return!0}};Object.defineProperties(LT.prototype,{properties:{get:function(){return this.fragment.properties}}});var FT=class extends zT{constructor(t,e,i){super(t,e,!1),this.uuid=i,this.allowVariableSaves=!0,this.saveVariableLocations(e)}},NT=new Map;function UT(t){if("string"==typeof t)return t;let e=NT.get(t);return e||(e={url:URL.createObjectURL(new Blob([t]))},NT.set(t,e)),e.url}var kT,VT,jT,GT=new Promise(t=>{kT=t}),WT=!1;function HT(){if(!WT)return VT||(VT=async function(){await e(()=>import("./howler-wePr8Kjv.js").then(t=>t.h),__vite__mapDeps([0,1])),kT(void 0!==window?window:globalThis),WT=!0}())}function qT(t,e){t.forEach(t=>{"dragDropActions"in t.data?(e.push(...t.data.dragDropActions.drag),e.push(...t.data.dragDropActions.drop)):"inActions"in t.data?(e.push(...t.data.inActions),e.push(...t.data.outActions)):"gameActions"in t.data?(e.push(...t.data.gameActions.idle),e.push(...t.data.gameActions.move),e.push(...t.data.gameActions.jump),e.push(...t.data.gameActions.run)):"breakpoints"in t.data?t.data.breakpoints.forEach(t=>{e.push(...t.data.actions)}):"actions"in t.data&&(e.push(...t.data.actions),t.data.actions.forEach(t=>{"Conditional"===t.data.type&&t.data.ifActions&&(e.push(...t.data.ifActions),e.push(...t.data.elseActions))}))})}function XT(t){let e=!1,i=[];return t.scene.objects.traverse((t,n)=>{if("Page"===n.type&&void 0!==n.uiScene&&n.uiScene.objects.traverse((t,n)=>{if(void 0===n.events||!1===Array.isArray(n.events))return!0;qT(n.events,i),e=e||i.some(t=>"Audio"===t.data.type)}),void 0===n.events||!1===Array.isArray(n.events))return!0;qT(n.events,i),e=e||i.some(t=>"Audio"===t.data.type)}),e}GT.then(t=>jT=t);var YT,QT,ZT=class{constructor({src:t,volume:e,delay:i,loop:n}){let r;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)},r="string"==typeof t?{src:t}:{src:UT(t),format:"wav"},this.sound=new jT.Howl(r),this.sound.on("end",this.onEnd),this.src=t,void 0!==e&&(this.volume=e),void 0!==i&&(this.delay=i),void 0!==n&&(this.loop=n)}get status(){return this._status}get volume(){return this._volume}set volume(t){this._volume=t,this.sound.volume(t)}get loop(){return this._loop}set loop(t){this._loop=t,this.loopsRemaining=t}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(t,e=1e3){t?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,e),this.clearFade()},t)):this.sound.fade(this._volume,0,e)}on(t,e,i){this.sound.on(t,e,i)}off(t,e,i){this.sound.off(t,e,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(t=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}},KT=class{constructor(){this.type="ShapePath",this.color=new le,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new no,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath?.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath?.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,r,s){return this.currentPath?.bezierCurveTo(t,e,i,n,r,s),this}splineThru(t){return this.currentPath?.splineThru(t),this}toShapes(){let t=0,e=1,i=2,n=3,r=4,s=5,a=6,o={loc:t,t:0};function l(e,n,r,s){let a=e.x,l=n.x,c=r.x,d=s.x,u=e.y,p=n.y,f=r.y,m=s.y,g=(d-c)*(u-f)-(m-f)*(a-c),v=(m-f)*(l-a)-(d-c)*(p-u),y=g/v,x=((l-a)*(u-f)-(p-u)*(a-c))/v;if(0===v&&0!==g||y<=0||y>=1||x<0||x>1)return null;if(0===g&&0===v){for(let c=0;c<2;c++){if(h(0===c?r:s,e,n),o.loc===t){let t=0===c?r:s;return{x:t.x,y:t.y,t:o.t}}if(o.loc===i){return{x:+(a+o.t*(l-a)).toPrecision(10),y:+(u+o.t*(p-u)).toPrecision(10),t:o.t}}}return null}for(let i=0;i<2;i++)if(h(0===i?r:s,e,n),o.loc===t){let t=0===i?r:s;return{x:t.x,y:t.y,t:o.t}}return{x:+(a+y*(l-a)).toPrecision(10),y:+(u+y*(p-u)).toPrecision(10),t:y}}function h(l,h,c){let d,u=c.x-h.x,p=c.y-h.y,f=l.x-h.x,m=l.y-h.y,g=u*m-f*p;return l.x===h.x&&l.y===h.y?(o.loc=t,void(o.t=0)):l.x===c.x&&l.y===c.y?(o.loc=e,void(o.t=1)):void(g<-Number.EPSILON?o.loc=n:g>Number.EPSILON?o.loc=r:u*f<0||p*m<0?o.loc=s:Math.sqrt(u*u+p*p)<Math.sqrt(f*f+m*m)?o.loc=a:(d=0!==u?f/u:m/p,o.loc=i,o.t=d))}function c(t,e,i){let n=new Ht;e.getCenter(n);let r=[];
vendor: 18,627 bytes, line 2
2return i.forEach(e=>{e.boundingBox.containsPoint(n)&&function(t,e){let i=[],n=[];for(let r=1;r<t.length;r++){let s=t[r-1],a=t[r];for(let t=1;t<e.length;t++){let r=l(s,a,e[t-1],e[t]);null!==r&&void 0===i.find(t=>t.t<=r.t+Number.EPSILON&&t.t>=r.t-Number.EPSILON)&&(i.push(r),n.push(new Ht(r.x,r.y)))}}return n}(t,e.points).forEach(t=>{r.push({identifier:e.identifier,isCW:e.isCW,point:t})})}),r.sort((t,e)=>t.point.x-e.point.x),r}let d=0,u=999999999,p=-999999999,f=[];this.subPaths.forEach(t=>{let e=t.getPoints(),i=-999999999,n=999999999,r=-999999999,s=999999999;for(let a=0;a<e.length;a++){let t=e[a];t.y>i&&(i=t.y),t.y<n&&(n=t.y),t.x>r&&(r=t.x),t.x<s&&(s=t.x)}p<=r&&(p=r+1),u>=s&&(u=s-1),e.length&&f.push({curves:t.curves,points:e,isCW:zo.isClockWise(e),identifier:d++,boundingBox:new sh(new Ht(s,n),new Ht(r,i))})});let m=f.map(t=>function(t,e,i,n,r){(null==r||""===r)&&(r="nonzero");let s=new Ht;t.boundingBox.getCenter(s);let a=c([new Ht(i,s.y),new Ht(n,s.y)],t.boundingBox,e);a.sort((t,e)=>t.point.x-e.point.x);let o=[],l=[];a.forEach(e=>{e.identifier===t.identifier?o.push(e):l.push(e)});let h=o[0].point.x,d=[],u=0;for(;u<l.length&&l[u].point.x<h;)d.length>0&&d[d.length-1]===l[u].identifier?d.pop():d.push(l[u].identifier),u++;if(d.push(t.identifier),"evenodd"===r){let e=d.length%2==0,i=d[d.length-2];return{identifier:t.identifier,isHole:e,for:i}}if("nonzero"===r){let i=!0,n=null,r=null;for(let t=0;t<d.length;t++){let s=d[t];e[s]&&(i?(r=e[s].isCW,i=!1,n=s):r!==e[s].isCW&&(r=e[s].isCW,i=!0))}return{identifier:t.identifier,isHole:i,for:n}}}(t,f,u,p,this.userData?.style.fillRule)),g=[];return f.forEach(t=>{let e=m[t.identifier];if(e&&!e.isHole){let e=new ho;e.curves=t.curves,m.filter(e=>e?.isHole&&e.for===t.identifier).forEach(t=>{if(t){let i=f[t.identifier],n=new no;n.curves=i.curves,e.holes.push(n)}}),g.push(e)}}),g}},JT=!1,$T=new Promise(t=>{YT=t}),tD=!1;function eD(){if(JT=!0,!tD)return QT||(QT=async function(){let t=await e(()=>import("./opentype-BvX4L9Fp.js"),[]);YT(t),tD=!0}(),QT)}var iD=new class{async load(t,e,i=()=>{}){let{load:n}=await $T;n(t,(t,n)=>{t||!n?i(t??"Something went wrong"):e(n)})}async parse(t){let{parse:e,Bidi:i}=await $T;try{let n=e(t),r=new i,s=t=>n.charToGlyphIndex(t.char);return r.registerModifier("glyphIndex",null,s),r.applyFeatures(n,n.defaultRenderOptions.features),{font:n,bidi:r}}catch($y){}}};async function nD(t){let e,i,n=!1;if(t.url?(e=await async function(t){return await(await fetch(t)).arrayBuffer()}(t.url),i=t.url,n=t.url.startsWith("/")):t.data&&(e=t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength)),e){if(!JT)return{font:void 0,url:i,intercepted:n,arr:e,bidi:null};{let t=await iD.parse(e);if(t)return{font:t.font,url:i,intercepted:n,arr:e,bidi:t.bidi}}}}function rD(t,e){return e.state.glyphIndex===t||e.state.fina===t||e.state.medi===t||e.state.init===t}var sD=class{constructor(t){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=nD(t).then(t=>{t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)})}update(t){this._isLoaded=!1,this._isUserFont=t.isUserFont??!1,this._loadingPromise=nD(t).then(t=>{t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(t,e,i){if(!this._bidi)return[];let n=this._bidi;n.getTextGlyphs(e);let r=n.tokenizer.tokens,s=[],a=0,o=i.length===r.length;for(let l=0;l<i.length;l++){let n=i[l].index,h=String.fromCharCode(i[l].unicode),c=r[a];if(rD(n,c)||o)s.push({char:h,index:n,replacements:[c.state.glyphIndex],replacementChars:[c.char]}),a++;else{let i=c.char,r="",o=[c.state.glyphIndex],l=[],d=!1;for(;!d;)a++,r=e.charAt(a),i+=r,o.push(t.charToGlyphIndex(r)),l=t.stringToGlyphs(i),1===l.length&&l[0].index===n&&(d=!0),a>e.length&&(d=!0);s.push({char:h,index:n,replacements:o,replacementChars:Array.from(i)}),a++}}return s}generateShapes(t,e,i){if(!this._isLoaded)return;let n=this.font,r=e.fontSize/this.unitsPerEm,s=e.fontSize*e.lineHeight,a=t.map(t=>this.getTextWidth(t,e)),o="string"==typeof e.width?Number(i.getVariable(e.width)):e.width,l="string"==typeof e.height?Number(i.getVariable(e.height)):e.height,h=this.getCharWidth("\n",e),c=1===e.horizontalAlign?h:0,d=this.getLineInitialOffsetX(a[0],o,e.horizontalAlign,t[0],h),u=this.getLineInitialOffsetY(s,t.length,l,r,e.verticalAlign),p=[],f=t.map(t=>[]),m=t.map(t=>[]);for(let y=0;y<t.length;y++){let l=t[y],g={features:{liga:!0},letterSpacing:e.letterSpacing},x=[];try{x=n.stringToGlyphs(l,g)}catch(v){}d=this.getLineInitialOffsetX(a[y],o,e.horizontalAlign,l,h);let b=[];try{b=this.reverseLigaturesTable(n,l,x)}catch(v){}let w=this.computeSpaceWidthForLine(t,y,e,i),S=0,_=x[0];_&&2===e.horizontalAlign&&void 0!==_.leftSideBearing&&(d-=_.leftSideBearing*r),this.font?.forEachGlyph(l,d,u,e.fontSize,g,(t,i,s,a,o)=>{let l=0===t.index?"\n":t.unicode?String.fromCharCode(t.unicode):void 0,h=b[S],d=0;if("\n"===l)d=c;else if(" "===l)d=w;else{let n=this.createPath(t,r,i,s,e);n&&(d=n.offsetX,p.push(n.path))}if(1===h.replacements.length)m[y].push([i,s]),f[y].push(d);else{let t=h.replacements.map(t=>(n.glyphs.get(t).advanceWidth??0)*r),e=t.reduce((t,e)=>t+e,0),a=t.map(t=>t/e),o=i;for(let i=0;i<a.length;i++){let t=d*a[i];m[y].push([o,s]),f[y].push(t),o+=t}}S++}),u-=s}let g=[];for(let y=0,x=p.length;y<x;y++)g.push(...p[y].toShapes());return{shapes:g,charWidths:f,lineWidths:a,charCoords:m}}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(t,e,i,n,r){return(3===i||2===i)&&n.indexOf("\n")>=0&&(t-=r),3===i?.5*e-.5*t:2===i?e-t:0}getLineInitialOffsetY(t,e,i,n,r){let s=e*t,a=t-Math.abs(this.ascender-this.descender)*n,o=-this.ascender*n-a/2;return 3===r?-(i-s-o):2===r?-(.5*i-.5*s-o):o}createPath(t,e,i,n,r){let s=t.getPath(i,-n,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(!s)return;let a=new KT,o=(t.advanceWidth??1)*e;if(t)for(let l of s.commands){let t=a.currentPath?.currentPoint;if(!t||"Z"===l.type||t.x!==l.x||-t.y!==l.y)switch(l.type){case"M":a.moveTo(l.x,-l.y);break;case"L":a.lineTo(l.x,-l.y);break;case"Q":a.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":a.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y)}}return a.subPaths.forEach(t=>{let e=function(t){if(t.length){let e=t[0];if(e instanceof Ka)return e.v1;if(e instanceof Qa||e instanceof $a)return e.v0}}(t.curves);void 0!==e&&t.currentPoint.distanceTo(e)>0&&t.lineTo(e.x,e.y)}),{offsetX:o,path:a}}getCharWidth(t,e){return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}getTextWidth(t,e){return this.font?.getAdvanceWidth(t,e.fontSize,{kerning:!0,letterSpacing:e.letterSpacing})??0}computeSpaceWidthForLine(t,e,i,n){let r=this.getCharWidth(" ",i),s=t[e];if(s){let a=this.countSpaces(s.trimEnd());if(4===i.horizontalAlign&&e<t.length-1&&a){return(("string"==typeof i.width?Number(n.getVariable(i.width)):i.width)-(this.getTextWidth(s,i)-a*r))/a}}return r}countSpaces(t){return(t.match(/ /g)||[]).length}};var aD=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(t){return this.objects.get(t)}get size(){return this.objects.size}get(t,e,i){let n=this.objects.get(t);return void 0===n?(n=this.createObject(t,e,i),this.objects.set(t,n)):n.isShared=!0,n}forceDelete(t){let e=this.objects.get(t);e&&(this.disposeObject(e),this.objects.delete(t))}mutateIfUnique(t,e){let i=this.objects.get(t);if(i&&!0!==i.isShared)return this.objects.delete(t),this.objects.set(e,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(t,e){e===this.objects.get(t)&&this.unreachable.delete(t)}endGc(){this.unreachable.forEach(t=>{this.disposeObject(this.objects.get(t)),this.objects.delete(t)}),this.unreachable.clear()}dispose(){this.objects.forEach(t=>{this.disposeObject(t)}),this.objects.clear()}},oD=class extends aD{constructor(t){super(),this.flatShading=t}disposeObject(t){t.dispose()}createObject(t,e,i){let n=uC(t,e,this.flatShading,i);return n.computeBoundingSphere(),n}},lD={markNeedsUpdateRendererDirty:()=>{}},hD=1e3,cD=512e3;var dD=class{constructor(t,e){this.id=t,this.userWebhook=e,this.result=void 0,this._connected=!1,this.emitter=GM(),this.reconnectWaitFor=hD,this._onError=t=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=t=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=hD,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=hD,this._connected=!1},this._onMessage=t=>{let e,i=t.data;try{e=JSON.parse(i)}catch($y){}if(e){let t=!1;this.userWebhook.parametersSchemas.forEach(({data:i})=>{void 0!==e[i.name]&&function(t,e){let i=typeof t;return!!(("string"===e||"number"===e)&&i===e||"boolean"===e&&("true"===t||"false"===t||!0===t||!1===t)||"image"===e&&"string"===i&&t.startsWith("http"))}(e[i.name],i.type)&&(void 0===this.result&&(this.result={}),this.result[i.name]=e[i.name],t=!0)}),t&&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>cD&&(this.reconnectWaitFor=cD),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(t){this.userWebhook=t}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(t=>t.data.name)}getParameterValue(t){if(this.getParametersKeys().includes(t)){if(this.result)return this.result?.[t];for(let e of this.userWebhook.parametersSchemas)if(e.data.name===t)return Eb.defaultParameterValueByType(e.data.type)}}},uD=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],pD=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],fD=[],mD=[];for(let oG=1;oG<=8;oG++)for(let t=0;t<uD.length;t++){let e=uD[t];fD.push(e/Math.pow(2,8-oG)),mD.push(pD[t]+oG)}var gD=[32,2e3],vD=fD.filter((t,e)=>fD[e]>gD[0]&&fD[e]<gD[1]),yD=mD.filter((t,e)=>fD[e]>gD[0]&&fD[e]<gD[1]),xD=class{static getFrequencies(t,e,i,n="frequency",r=-100,s=-30){i||(i=new Float32Array(t.frequencyBinCount),t.getFloatFrequencyData(i));let a,o,l,h=e/2,c=1/i.length*h;if("music"===n||"voice"===n){let t="voice"===n?vD:fD,e=Array(t.length).fill(r);for(let n=0;n<i.length;n++){let r=n*c,s=i[n];for(let i=t.length-1;i>=0;i--)if(r>t[i]){e[i]=Math.max(e[i],s);break}}a=e,o="voice"===n?vD:fD,l="voice"===n?yD:mD}else a=Array.from(i),o=a.map((t,e)=>c*e),l=o.map(t=>`${t.toFixed(2)} Hz`);let d=a.map(t=>Math.max(0,Math.min((t-r)/(s-r),1)));return{values:new Float32Array(d),frequencies:o,labels:l}}};var bD=class{constructor(t){this.value=0,this.frequencies=new Float32Array(0);let e=new AudioContext;this.source=e.createMediaStreamSource(t),this.analyser=e.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(t=-100,e=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return xD.getFrequencies(this.analyser,44100,void 0,"voice",t,e)}update(){let t=this.getFrequencies(),e=t.values.reduce((t,e)=>t+e,0)/t.values.length;this.value=e,this.frequencies=t.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},wD=class{constructor(t,e,i){this.data=t,this.id=e,this.shared=i,this.emitter=GM(),this.rafId=0,this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onMessage=t=>{let e=JSON.parse(t.data);if(this.appendEvent(e),"session.created"===e.type&&this.onSessionCreated(),"response.done"===e.type&&e.response?.output)for(let i of e.response.output)if("function_call"===i.type)for(let[t,e]of this.tools)i.name===t.name&&(e(JSON.parse(i.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 t=this.analyser.value,e=this.analyser.frequencies;this.voice=t,this.frequencies=e,this.emitter.emit("voice",{value:t,frequencies:e})}}}update(t){this.data=t}setColorByName(t,e){let i=this.shared.getColorByName(t);if(i){let{id:t}=i,{r:n,g:r,b:s}=NM.hexStringToRgb(e)??{r:0,g:0,b:0};this.shared.updateColor(t,{r:n/255,g:r/255,b:s/255})}}async connect(){if(this.isConnected)return;let t=await async function(e){try{return(await(await fetch("https://relayserver.spline.design/session?uuidfile="+e)).json()).token}catch(t){}}(this.data.integration.hash);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=t=>{let e=t.streams[0];this.audioElement.srcObject=e,this.analyser=new bD(e)};let e=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(e.getTracks()[0]),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 n={type:"answer",sdp:await(await fetch("https://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-12-17",{method:"POST",body:i.sdp,headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(n),this.animate()}appendEvent(t){this.events=[t,...this.events]}sendClientEvent(t){this.dc&&(t.event_id=t.event_id||crypto.randomUUID(),this.dc.send(JSON.stringify(t)),this.appendEvent(t))}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:t})=>{this.setColorByName("Voice Assistant Color",t)});let t=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: ${t}. 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:t,value:e})=>{let i=this.shared.getVariableByName(t);if(i){let t,n=this.shared.getVariable(i.id);t="number"==typeof n?parseFloat(e):"boolean"==typeof n?"true"===e.toLowerCase():{textValue:e},this.shared.updateVariable(i.id,t)}});let e=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: ${e}. 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:t,value:e})=>{this.setColorByName(t,e)});let i=this.shared.scene,n=[];i.traverseEntity(t=>{t.data.events.forEach(t=>{if("AIAssistantTrigger"===t.data.type){let{description:e}=t.data;n.push(e)}})}),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(n)}.`},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:t,direction:e})=>{this.emitter.emit("trigger_event",{description:t,direction:e})}),this.sendClientEvent({type:"session.update",session:{tools:this.tools.map(([t])=>t)}})}registerTool(t,e){this.tools.push([t,e])}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().forEac
2h(t=>{t.track&&t.track.stop()}),this.pc?.close(),this.pc=void 0}computeAnalysisForListenerEvent(t){if("range"===t.analysis){let e=this.frequencies.slice(...t.analysisRange);return e.reduce((t,e)=>t+e,0)/e.length}return"single"===t.analysis?this.frequencies[t.analysisSingle]:this.voice}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}};function SD(t){return"variable_"+t}var _D=class extends WP{constructor(t){super(),this.shared=t}create(t){return new HP(t,this.shared)}},AD=class{constructor(t,e={},i=!0,n=!1){if(this.data=t,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=n,this.geometryCache=new oD(!0),this.geometryCache2=new oD(!1),this.imageHolderCache=new _D(this),this.thisContext={scene:lD,shared:this},this.deletedMaterial=new FT(zx.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new qP(iw.emptyImage,this),this.deletedVideo=new qP(Cx.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},e.images)for(let[r,s]of Object.entries(e.images))this.addImage(r,s);if(e.videos)for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s);if(e.audios)for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);if(e.particles)for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);this.reset(t)}setRequestRender(t){this._requestRender=t}getImageLoadPromises(){return Object.values(this.images).map(t=>t.loadPromise)}setEntityOpContext(t){this.entityOpContext=t}reset(t,e=!1,i=!1){this.data=t,this.resetLib(t.lib);for(let{id:n,data:r}of t.variables)this.addVariableHolder(n,r),e&&this.updateVariableHolder(n,r);for(let[n,r]of Object.entries(t.userAPIs))this.addUserAPI(n,r);for(let[n,r]of Object.entries(t.userWebhooks))this.addUserWebhook(n,r);if(!i){for(let[e,i]of Object.entries(t.images))this.addImage(e,i);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i)}for(let[n,r]of Object.entries(t.colors))this.addColor(n,r);for(let[n,r]of Object.entries(t.materials))this.addMaterial(n,r);for(let[n,r]of Object.entries(t.audios))this.addAudio(n,r);for(let[n,r]of Object.entries(t.particles))this.addParticle(n,r);for(let[n,r]of Object.entries(t.fonts))this.addFont(n,r)}addMaterial(t,e){if(this.materials[t]){let i=this.materials[t];i.reset(e,this.thisContext),i.dispose()}else{let i=new FT(e,this.thisContext,t);this.materials[t]=i}}deleteMaterial(t){this.materials[t]&&(this.materials[t].nodeMaterialDispose(),delete this.materials[t])}getMaterial(t){return this.materials[t]}getMaterialOrDeletedPlaceholder(t){return this.materials[t]??this.deletedMaterial}material(t){return"string"==typeof t?this.getMaterialOrDeletedPlaceholder(t):null==t?this.deletedMaterial:new zT(t,this.thisContext)}getMaterials(){return this.materials}addImage(t,e){return this.images[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[t].updateSrc(e.data),!0):(this.images[t]=new qP(e,this),!1)}deleteImage(t){let e=this.images[t];e&&(e.dispose(),delete this.images[t])}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]??this.deletedImage}image(t){return"string"==typeof t?this.getImage(t):this.imageHolderCache.load(t)}addUIBuffer(t,e){return this.uiBuffers[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[t].updateSrc(e),!0):(this.uiBuffers[t]=new qP(e,this),!1)}uiBuffer(t){return this.uiBuffers[t]}addVideo(t,e){return this.videos[t]?(this.videos[t].updateSrc(e.data),!0):(this.videos[t]=new qP(e,this),!1)}deleteVideo(t){let e=this.videos[t];e&&(e.dispose(),delete this.videos[t])}getVideo(t){return this.videos[t]??this.deletedVideo}video(t){return"string"==typeof t?this.getVideo(t):this.imageHolderCache.load(t)}addColor(t,e){return this.colors[t]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):(this.colors[t]=new wT(e.r,e.g,e.b,"a"in e?e.a:1),!1)}updateColor(t,e){if(this.colors[t]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[t];return this.colors[t].r=e.r??i.r,this.colors[t].g=e.g??i.g,this.colors[t].b=e.b??i.b,this.colors[t].a=e.a??i.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}getColorNames(){return Object.values(this.data.colors).map(t=>t.name)}getColorByName(t){for(let e in this.data.colors)if(this.data.colors[e].name===t)return{color:this.colors[e],id:e}}color(t){let e;if("string"!=typeof t)return new oE(t.r,t.g,t.b,"a"in t?t.a:1);{let i=this.getColor(t);e=i||new oE(0,0,0,0)}return e}addAudio(t,e){this.audios[t]=e}getAudio(t){let e=this.audios[t];if(e instanceof ZT)return e;{let i=new ZT({src:e.data});return this.audios[t]=i,i}}
vendor: 9,385 bytes, line 2
2addParticle(t,e){this.particles[t]=e}getParticle(t){return this.particles[t]}deleteParticle(t){this.particles[t]&&delete this.particles[t]}deleteAudio(t){let e=this.audios[t];e&&(e instanceof ZT&&e.dispose(),delete this.audios[t])}addFont(t,e){this.fonts[t]=new sD(e),this.fonts[t].loadingPromise.then(()=>this.requestRender())}getFont(t){return this.fonts[t]}deleteFont(t){this.fonts[t]&&delete this.fonts[t]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._requestRender=void 0,Object.values(this.audios).forEach(t=>{t instanceof ZT&&t.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(t,e){if(void 0===this.variables[t]){let i=e.value;if(this.enableLocalStorageForPersistentVariables&&e.persistent){let n=localStorage.getItem(SD(t));i=null!==n?JSON.parse(n):e.value}return this.variables[t]={value:i,locations:[],persistent:e.persistent},"dynamicVariableType"in e&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0),!0}return this.variables[t].value=e.value,!1}resetDynamicVariablePlayState(){for(let t in this.variables)void 0!==this.variables[t].dynamicVariablePlayState&&(this.variables[t].dynamicVariablePlayState="Playing",this.variables[t].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(t,e){this.updateVariable(t,e.value)}updateVariable(t,e){if(void 0===this.variables[t])return!1;this.variables[t].value=e,this.enableLocalStorageForPersistentVariables&&this.variables[t].persistent&&localStorage.setItem(SD(t),JSON.stringify(e));let i=e;for(;"string"==typeof i;)i=this.variables[i].value;let n=this.entityOpContext.scene;for(let r=this.variables[t].locations.length-1;r>=0;r--){let e=this.variables[t].locations[r];if("material"===e[0]){let t=e[1],r=i,s={scene:n,shared:this},a=e.slice(2);n.traverseMaterial(e=>{let i=e.root??e;i.uuid===t&&i.onVariableUpdate(a,r,s)});let o=this.materials[t];o&&o.onVariableUpdate(a,r,s)}else{let s=n.find(e[0]);if(void 0===s){this.variables[t].locations.splice(r,1);continue}if("geometry"!==e[1]&&"particles"!==e[1]){for(let t=1;t<e.length-1;t++)s=s[e[t]];"rotation"===e[1]?s[e[e.length-1]]=i*Wt.DEG2RAD:s[e[e.length-1]]=i}if(s=n.find(e[0]),"ParticleEmitter"===s.type&&s.updateVariableState(i,e),r_.is(s))if("position"===e[1]||"rotation"===e[1]||"scale"===e[1])s.onVariableUpdate();else if("geometry"===e[1]){let t=s;s.component&&(t=s.component);let e=t.dataPatched;t.chooseGeoemtryCache(this).forceDelete(e.geometry),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),t.instances.forEach(t=>{let e=t.dataPatched;t.chooseGeoemtryCache(this).forceDelete(e.geometry),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData()})}else"morphTargetInfluences"===e[1]&&s.updateMorphInfluences(e[2],i)}}return this.requestRender(),!0}deleteVariable(t){this.variables[t]&&delete this.variables[t]}getVariable(t,e){if(Array.isArray(t)){if("mouse"===t[0])return this.mouseProperty?.[t[1]]??0;if("raycast"===t[0])return this.raycastProperty?.[t[1]]??0;let e=this.entityOpContext.scene.find(t[0]);if("width"===t[1]||"height"===t[1]||"depth"===t[1])return e.geometry.userData.parameters[t[1]];for(let i=1;i<t.length;i++)e=e[t[i]];return"rotation"===t[1]&&(e*=Wt.RAD2DEG),e}for(let i in this.variables){if(void 0===e)break;let t=this.variables[i],n=t.locations?.findIndex(t=>Qg.equal(t,e));void 0!==n&&-1!==n&&t.locations.splice(n,1)}if("string"==typeof t){let i=t,n=t;do{if(n=i,void 0===this.variables[i])break;let t=this.variables[i].value;e&&void 0!==this.variables[n]&&this.variables[n].locations.push(e),i=t}while("string"==typeof i);return i}return t}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(t=>t.data.name)}getVariableByName(t){for(let e of this.data.variables)if(e.data.name===t)return{variable:e.data,id:e.id}}getDynamicVariablePlayState(t){return this.variables[t]?.dynamicVariablePlayState}setDynamicVariablePlayState(t,e){void 0!==this.variables[t]&&(this.variables[t].dynamicVariablePlayState=e)}getDynamicVariableToggleIsForward(t){return this.variables[t]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(t,e){void 0!==this.variables[t]&&(this.variables[t].dynamicVariableToggleIsForward=e)}resetLib(t){for(let[e,i]of Object.entries(t.images))this.addImage(e,i.asset);for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i.asset);for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i.asset);for(let[e,i]of Object.entries(t.colors))this.addColor(e,i.asset);for(let[e,i]of Object.entries(t.fonts))this.addFont(e,i.asset);for(let[e,i]of Object.entries(t.materials))this.addMaterial(e,i.asset);for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i.asset);for(let[e,i]of Object.entries(t.variables))this.addVariableHolder(e,i.asset)}updateLibByOp(t,e){"images"===t.path[0]?1===t.path.length&&1===t.type?this.addImage(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteImage(t.id):"videos"===t.path[0]?1===t.path.length&&1===t.type?this.addVideo(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteVideo(t.id):"audios"===t.path[0]?1===t.path.length&&1===t.type?this.addAudio(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteAudio(t.id):"particles"===t.path[0]?1===t.path.length&&1===t.type?this.addParticle(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteParticle(t.id):"colors"===t.path[0]?1===t.path.length&&1===t.type?this.addColor(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteColor(t.id):"materials"===t.path[0]?1===t.path.length&&1===t.type?this.addMaterial(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteMaterial(t.id):"fonts"===t.path[0]?1===t.path.length&&1===t.type?this.addFont(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteFont(t.id):"variables"===t.path[0]?1===t.path.length&&1===t.type?this.addVariableHolder(t.id,t.data.asset):1===t.path.length&&2===t.type&&this.deleteVariable(t.id):"components"===t.path[0]&&e.updateByLibOp(t,this)}updateByOp(t,e,i){if(this.data=e,"images"===t.path[0])2===t.path.length&&0===t.type?t.props.data&&this.getImage(t.path[1]).updateSrc(t.props.data):1===t.path.length&&1===t.type?this.addImage(t.id,t.data):1===t.path.length&&2===t.type&&this.deleteImage(t.id);else if("videos"===t.path[0])2===t.path.length&&0===t.type?t.props.data&&this.getVideo(t.path[1]).updateSrc(t.props.data):1===t.path.length&&1===t.type?this.addVideo(t.id,t.data):1===t.path.length&&2===t.type&&this.deleteVideo(t.id);else if("audios"===t.path[0])2===t.path.length&&0===t.type?t.props.data&&this.addAudio(t.path[1],e.audios[t.path[1]]):1===t.path.length&&1===t.type?this.addAudio(t.id,t.data):1===t.path.length&&2===t.type&&this.deleteAudio(t.id);else if("particles"===t.path[0])2===t.path.length&&0===t.type?t.props.data&&this.addParticle(t.path[1],e.particles[t.path[1]]):1===t.path.length&&1===t.type?this.addParticle(t.id,t.data):1===t.path.length&&2===t.type&&this.deleteParticle(t.id);else if("colors"===t.path[0])2===t.path.length&&0===t.type?this.updateColor(t.path[1],t.props):1===t.path.length&&1===t.type?this.addColor(t.id,t.data):1===t.path.length&&2===t.type&&this.deleteColor(t.id);else if("materials"===t.path[0])1===t.path.length&&1===t.type?this.addMaterial(t.id,t.data):1===t.path.length&&2===t.type?this.deleteMaterial(t.id):t.path.length>1&&this.getMaterial(t.path[1]).updateByOp(Cg.drop(t,2),e.materials[t.path[1]],{shared:this,scene:i});else if("fonts"===t.path[0])2===t.path.length&&0===t.type?this.updateFont(t.path[1],t,i):1===t.path.length&&1===t.type?this.addFont(t.id,t.data):1===t.path.length&&2===t.type&&this.deleteFont(t.id);else if("variables"===t.path[0])2===t.path.length&&0===t.type?"value"in t.props?this.updateVariable(t.path[1],t.props.value):"persistent"in t.props&&(this.variables[t.path[1]].persistent=t.props.persistent):1===t.path.length&&4===t.type?this.addVariableHolder(t.id,t.data):1===t.path.length&&5===t.type&&this.deleteVariable(t.id);else if("userAPIs"===t.path[0]){if(1===t.path.length&&1===t.type)this.addUserAPI(t.id,t.data);else if(1===t.path.length&&2===t.type)this.deleteUserAPI(t.id);else if("string"==typeof t.path[1]){let i=e.userAPIs[t.path[1]];if(i){let e=0===t.type&&void 0===t.props.debounce,n=this.getUserAPI(t.path[1]);n instanceof wD?n.update(i):n?.update(i,this,e)}}}else if("userWebhooks"===t.path[0]){if(1===t.path.length&&1===t.type)this.addUserWebhook(t.id,t.data);else if(1===t.path.length&&2===t.type)this.deleteUserWebhook(t.id);else if("string"==typeof t.path[1]){let i=e.userWebhooks[t.path[1]];i&&this.getUserWebhook(t.path[1])?.update(i)}}else"lib"===t.path[0]&&this.updateLibByOp(Cg.drop(t,1),i)}updateFont(t,e,i){if(e.props.url){let n=this.getFont(t),r={...this.data.fonts[t],url:e.props.url};n.update(r),n.loadingPromise.then(()=>this.requestRender()),i.updateFont(t,this)}}addUserAPI(t,e){return this.userAPIs[t]?(this.userAPIs[t].update(e,this),!0):this.openAIRealtime?.id===t?(this.openAIRealtime.update(e),!0):"VoiceAssistant"===e.integration?.type?(this.openAIRealtime=new wD(e,t,this),!1):(this.userAPIs[t]=new WM(t,e,this),!1)}getUserAPI(t){return this.openAIRealtime?.id===t?this.openAIRealtime:this.userAPIs[t]}getUserAPIs(){return this.userAPIs}deleteUserAPI(t){let e=this.userAPIs[t];
2e&&(e.dispose(),delete this.userAPIs[t])}addUserWebhook(t,e){return this.userWebhooks[t]?(this.userWebhooks[t].update(e),!0):(this.userWebhooks[t]=new dD(t,e),!1)}getUserWebhook(t){return this.userWebhooks[t]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(t){let e=this.userWebhooks[t];e&&(e.dispose(),delete this.userWebhooks[t])}get scene(){return this.entityOpContext.scene}};new AD(Lb.emptyData());var MD=class extends JC{updateByPatchedOp(t,e,i){if(super.updateByPatchedOp(t,e,i),null!==function(t,e){let i=[];if(e.length!==t.length)return null;for(var n=0;n<t.length;){if("*"===e[n])i.push(t[n]);else if(t[n]!==e[n])return null;n+=1}return i}(t.path,["materials"])&&0===t.type&&Array.isArray(this.material))for(let[n,r]of Object.entries(t.props)){let t=i.shared.material(r);this.material[Number(n)]=t}else if(ev(t.path,["material"])&&this.material instanceof LT)"material"in e&&"string"!=typeof e.material&&this.material.updateByOp(Cg.drop(t,1),e.material,i);else if(ev(t.path,["materials","*"])&&Array.isArray(this.material)){let n=t.path[1];if("materials"in e&&n<this.material.length){let r=e.materials[n];"string"!=typeof r&&this.material[n].updateByOp(Cg.drop(t,2),r,i)}}}get needsAO(){return void 0!==this.material&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}updateState(t,e){super.updateState(t,e),void 0!==t.castShadow&&(this.castShadow=t.castShadow),void 0!==t.receiveShadow&&(this.receiveShadow=t.receiveShadow);let i,n=this.dataPatched;if("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}),"NonParametricGeometry"!==t.geometry?.type&&"material"in t&&void 0!==t.material&&(this.disposeMaterial(),this.material=e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe,i),e.scene.markNeedsUpdateRendererDirty()),("NonParametricGeometry"===t.geometry?.type||"materials"in t)&&("materials"in t&&void 0!==t.materials?(this.disposeMaterial(),this.material=t.materials.map(t=>e.shared.material(t).getFlavor(n.flatShading,n.side,n.wireframe)),e.scene.markNeedsUpdateRendererDirty()):"material"in t&&void 0!==t.material&&(this.disposeMaterial(),this.material=[e.shared.material(t.material).getFlavor(n.flatShading,n.side,n.wireframe)],e.scene.markNeedsUpdateRendererDirty())),void 0!==t.flatShading||void 0!==t.wireframe||void 0!==t.side)if(Array.isArray(this.material))for(let r=0;r<this.material.length;r++)this.material[r]=this.material[r].getFlavor(n.flatShading,n.side,n.wireframe);else this.material=this.material.getFlavor(n.flatShading,n.side,n.wireframe,i)}disposeMaterial(){this.material&&Wm(this.material).forEach(t=>{t instanceof LT&&(t instanceof FT||t.nodeMaterialDispose())})}dispose(){this.disposeMaterial(),super.dispose()}},CD=new be,ED=new me,PD=new me,TD=new be,DD=new Ze,ID=class extends MD{constructor(t,e,i){super(t,e),this.data=e,this.isSkinnedMesh=!1,this.localGeometry=void 0,e.bindMode&&e.bindMatrix&&(this.bindMode=e.bindMode,this.bindMatrix=(new Ze).fromArray(e.bindMatrix),this.bindMatrixInverse=new Ze)}chooseGeoemtryCache(t){return t.geometryCache}markGeometryAsReachable(t){this.geometryCreateDeleyed instanceof Qi&&this.chooseGeoemtryCache(t).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof AD){let t=this.geometryCreateDeleyed,e=this.chooseGeoemtryCache(t);this.geometryCreateDeleyed=e.get(this.dataPatched.geometry,t,this)}return this.geometryCreateDeleyed}set geometry(t){this.localGeometry=t}get is2DAndNoDepth(){let t=this.dataPatched.geometry;return Gx.is2DParametricMesh(t.type)&&0===t.depth}get is2DType(){return Gx.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ev(t.path,["geometry"])&&this.updateByPatchedOpGeometry(Cg.drop(t,1),e.geometry,i)}removeInteractionGeometry(t){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(t,e){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,n,r,s=t;if(void 0===this.localGeometry){let t={...this.data.geometry,...s};this.localGeometry=uC(t,e,this.data.flatShading,this)}s.scaleBaked?[i,n,r]=s.scaleBaked:({width:i,height:n,depth:r}=s);let a=this.localGeometry.userData;void 0!==a.sxPrev&&fC(this.localGeometry.attributes,i/a.sxPrev,n/a.syPrev,r/a.szPrev),a.sxPrev=i,a.syPrev=n,a.szPrev=r}else{let i={...this.data.geometry,...t};this.localGeometry?.dispose(),this.localGeometry=uC(i,e,this.data.flatShading,this)}}refreshAttachedClonersInteractions(){for(let t of this.attachedSurfaceCloners
vendor: 9,227 bytes, line 2
2)t.update()}refreshAttachedCloners(t){for(let e of this.attachedSurfaceCloners)t.scene.addPendingUpdateCloner(e.object)}refreshAttachedPaths(t){for(let e of this.attachedPaths)t.scene.addPendingCommand(()=>e.updateShape())}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.refreshAttachedCloners(t),this.refreshAttachedPaths(t)}updateByPatchedOpGeometry(t,e,i){let n=!1;0===t.type&&0===t.path.length&&Object.keys(t.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof wC&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,e)===this.geometryCreateDeleyed&&(n=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(e,t.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),n||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(t,e){this.createGeometryDelayed(e)}updateState(t,e){void 0!==t.geometry&&this.updateGeometryOnStateUpdate(t.geometry,e);let i=t.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:t,value:n}}of i)this.updateMorphInfluences(t,e.shared.getVariable(n,[this.uuid,"morphTargetInfluences",t]))}super.updateState(t,e)}updateMorphInfluences(t,e){if(void 0===this.morphTargetDictionary)return;let i=this.morphTargetDictionary[t];void 0!==i&&(this.morphTargetInfluences[i]=e)}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(t,e){let i=this.geometry.userData.parameters;this.is2DType?t.set(0,0,.5*i.depth):this.isNonParametric?(t.setScalar(0),this.geometry.boundingSphere&&t.copy(this.geometry.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?t.fromArray(i.centerOffset):t.setScalar(0),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(t,e){this.skeleton=t,this.isSkinnedMesh=!0,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(t){let e=new me,i=this.geometry.attributes.skinWeight;for(let n=0,r=i.count;n<r;n++){e.fromBufferAttribute(i,n);let t=1/e.manhattanLength();t!==1/0?e.multiplyScalar(t):e.set(1,0,0,0),i.setXYZW(n,e.x,e.y,e.z,e.w)}}boneTransform(t,e){let i=this.skeleton;if(void 0===i)return;let n=this.geometry;ED.fromBufferAttribute(n.attributes.skinIndex,t),PD.fromBufferAttribute(n.attributes.skinWeight,t),CD.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){let t=PD.getComponent(r);if(0!==t){let n=ED.getComponent(r);DD.multiplyMatrices(i.bones[n].matrixWorld,i.boneInverses[n]),e.addScaledVector(TD.copy(CD).applyMatrix4(DD),t)}}return e.applyMatrix4(this.bindMatrixInverse)}};function OD(t){if(Array.isArray(t.material)){for(let e of t.material)if(0===e.getLayersOfType("outline").length)return}else if(!(t.material instanceof LT)||0===t.material.getLayersOfType("outline").length)return;t instanceof ID&&t.is2DAndNoDepth?function(t){if(t.geometry.attributes.extrudeNormals||!t.geometry.attributes.position)return;let e=t.geometry.attributes.position.array,i=new Float32Array(e.length),n=new be;for(let r=0;r<e.length;r+=3)n.set(e[r],e[r+1],e[r+2]).normalize(),i[r]=n.x,i[r+1]=n.y,i[r+2]=n.z;t.geometry.setAttribute("extrudeNormal",new Vi(i,3))}(t):function(t){if(t.geometry.attributes.extrudeNormal||!t.geometry.attributes.position||!t.geometry.attributes.normal)return;let e=new Map,i=t.geometry.attributes,n=i.position.array,r=i.normal.array,s=new Float32Array(n.length);for(let a=0;a<n.length;a+=3){let t=`${n[a]}_${n[a+1]}_${n[a+2]}`,i=new be(r[a],r[a+1],r[a+2]);e.has(t)?e.get(t)?.normals.push(i):e.set(t,{normals:[i],result:new be})}e.forEach((t,e)=>{for(let i of t.normals)t.result.add(i);t.result.divideScalar(t.normals.length)});for(let a=0;a<n.length;a+=3){let t=`${n[a]}_${n[a+1]}_${n[a+2]}`,i=e.get(t)?.result;i&&(s[a]=i.x,s[a+1]=i.y,s[a+2]=i.z)}t.geometry.setAttribute("extrudeNormal",new Vi(s,3))}(t)}function RD(t){if(!t.geometry.attributes.position)return;let e=t.geometry.attributes.position.array,i=new Float32Array(e.length),n=parseInt(t.uuid.replace(/\D/g,"")),r=[Wt.seededRandom(n),Wt.seededRandom(n+1e4),Wt.seededRandom(n+2e4)];for(let s=0;s<e.length;s++)i[s]=r[s%3];t.geometry.setAttribute("randomColor",new Ni(i,3))}var LD=new _e,BD=new be;function zD(t){let e=!1;return t.scene.objects.traverse((t,i)=>{"Mesh"===i.type&&"SubdivGeometry"===i.geometry.type&&(e=!0)}),e}var FD=class extends ID{constructor(t,e,i){super(t,e,i),this.data=e,this.hiddenMatrixOld=new Ze,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(t){return this.dataPatched.flatShading?t.geometryCache:t.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(t,e){let i=this.geometry.userData.parameters;t.copy(this.originalGeometryNew.boundingSphere.center),e.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(t){if(!0===this.skipReactionUpdate)return;let e=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:n,subdivPointer:r}=wC.build(t,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=r,void 0!==i&&(this.originalGeometry?.dispose(),this.originalGeometry=i),void 0!==n&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=n??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,OD(this),RD(this),this.calcBoundingBox(),e&&(this.localGeometry.uuid=e)}updateState(t,e){if(super.updateState(t,e),void 0!==t.flatShading){let i=this.material;this.material=Array.isArray(i)?i.map(t=>t.getFlavor(!1,t.side,t.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!t.flatShading,this.createGeometryDelayed(e)}}updateMesh(t=!1){wC.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&wC.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=wC.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=wC.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry}raycast(t,e){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,JC.prototype.raycast.call(this,t,e),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 t=this.originalGeometry;null===t.boundingSphere&&(t.boundingSphere=new Ve,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=t.boundingSphere));let e=t.attributes.position,i=t.boundingSphere.center;LD.setFromBufferAttribute(e),LD.getCenter(i),t.boundingSphere.radius=i.distanceTo(LD.max),isNaN(t.boundingSphere.radius),LD.getSize(BD),this.hasNonUniformScale&&BD.divide(this.scale);let n={width:BD.x,height:BD.y,depth:BD.z};return this.geometry.userData.parameters=n,n}updateBoundingSphere(t){let e=this.originalGeometry;LD.min.set(t[0],t[2],t[4]),LD.max.set(t[1],t[3],t[5]),this.hasNonUniformScale&&(LD.min.applyMatrix4(this.shearScaleInv),LD.max.applyMatrix4(this.shearScaleInv)),null===e.boundingSphere&&(e.boundingSphere=new Ve);let i=e.boundingSphere.center;LD.getCenter(i),e.boundingSphere.radius=i.distanceTo(LD.max)}freeSubdivPointer(){this.subdivPointer&&(wC.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),this.localGeometry&&this.createGeometryByControls(e)}},ND={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},UD={polygon_center:0,edge:1,vertex:2},kD=(t,e)=>(i,n)=>e&&0!==i&&0!==t?t*n/100:0,VD=(t,e)=>{let i=Math.abs(e),n=-1*i;return(t- -1)*(i-n)/2+n},jD=new be,GD=new be,WD=new be,HD=new be;function qD(t,e){let i=WD.fromArray(t),n=HD.fromArray(e);GD.copy(n).sub(i);let r=GD.length();
vendor: 4,292 bytes, line 2
2return GD.normalize().multiplyScalar(.5*r),jD.copy(i).add(GD).toArray()}var XD=new Oi,YD=new be,QD=new be,ZD=new be;var KD=t=>.5*(1-Math.cos(t*Math.PI)),JD=class{constructor(){this.perlin=new Array(4096)}noise(t,e=0,i=0){if(null==this.perlin){this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),i<0&&(i=-i);let n,r,s,a,o,l=Math.floor(t),h=Math.floor(e),c=Math.floor(i),d=t-l,u=e-h,p=i-c,f=0,m=.5;for(let g=0;g<4;g++){let t=l+(h<<4)+(c<<8);n=KD(d),r=KD(u),s=this.perlin[4095&t],s+=n*(this.perlin[t+1&4095]-s),a=this.perlin[t+16&4095],a+=n*(this.perlin[t+16+1&4095]-a),s+=r*(a-s),t+=256,a=this.perlin[4095&t],a+=n*(this.perlin[t+1&4095]-a),o=this.perlin[t+16&4095],o+=n*(this.perlin[t+16+1&4095]-o),a+=r*(o-a),s+=KD(p)*(a-s),f+=s*m,m*=.5,l<<=1,d*=2,h<<=1,u*=2,c<<=1,p*=2,d>=1&&(l++,d--),u>=1&&(h++,u--),p>=1&&(c++,p--)}return f}noiseSeed(t){let e=(()=>{let t,e;return{setSeed(i){e=t=(i??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(e=(1664525*e+1013904223)%4294967296,e/4294967296)}})();e.setSeed(t),this.perlin=new Array(4096);for(let i=0;i<4096;i++)this.perlin[i]=e.rand()}},$D=new be,tI=new Ze,eI=new Qe;function iI(t){let e=!1;return t.scene.objects.traverse((t,i)=>{"Mesh"===i.type&&("TextGeometry"===i.geometry.type||"InputGeometry"===i.geometry.type)&&(e=!0)}),e}var nI,rI,sI,aI,oI=class extends ID{constructor(t,e,i){super(t,e,i),this.data=e}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 t=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,t.geometry.height,this.fontScale,t.geometry.verticalAlign)??0}get fontScale(){let t=this.dataPatched;return this.font?t.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 t=this.dataPatched;return t.geometry.fontSize*t.geometry.lineHeight}raycast(t,e){let{matrixWorld:i}=this;if(!isNaN(t.ray.origin.x)&&0!==this.scale.x&&0!==this.scale.y&&0!==this.scale.z&&(tI.copy(i).invert(),eI.copy(t.ray).applyMatrix4(tI),eI.intersectBox(this.singleBBox,$D))){let n=$D.applyMatrix4(i),r=t.ray.origin.distanceTo(n);e.push({distance:r,point:n.clone(),object:this})}}},lI=1e-4,hI=new be,cI=new be;lC.then(t=>{rI=[(nI=t).get_face_center,nI.get_edge_midpoint,nI.get_vertex_position],sI=[nI.get_face_normal,nI.get_edge_normal,nI.get_vertex_normal],aI=[nI.face_count,nI.edge_count,nI.vertex_count]});var dI=new Ze,uI=new Ze,pI=new be,fI=new be,mI=new be,gI=new be,vI=new be,yI=new be,xI=class{constructor(t,e){this.data=t,this.is3D=e,this.perlin=new JD,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=e?(t,e,i)=>this.perlin.noise(t,e,i):t=>this.perlin.noise(t)):this.noise=e?function(t=Math.random){let e=ZS(t),i=new Float64Array(e).map(t=>QS[t%12*3]),n=new Float64Array(e).map(t=>QS[t%12*3+1]),r=new Float64Array(e).map(t=>QS[t%12*3+2]);return function(t,s,a){let o,l,h,c,d,u,p,f,m,g,v=(t+s+a)*HS,y=XS(t+v),x=XS(s+v),b=XS(a+v),w=(y+x+b)*qS,S=t-(y-w),_=s-(x-w),A=a-(b-w);S>=_?_>=A?(d=1,u=0,p=0,f=1,m=1,g=0):S>=A?(d=1,u=0,p=0,f=1,m=0,g=1):(d=0,u=0,p=1,f=1,m=0,g=1):_<A?(d=0,u=0,p=1,f=0,m=1,g=1):S<A?(d=0,u=1,p=0,f=0,m=1,g=1):(d=0,u=1,p=0,f=1,m=1,g=0);let M=S-d+qS,C=_-u+qS,E=A-p+qS,P=S-f+2*qS,T=_-m+2*qS,D=A-g+2*qS,I=S-1+.5,O=_-1+.5,R=A-1+.5,L=255&y,B=255&x,z=255&b,F=.6-S*S-_*_-A*A;if(F<0)o=0;else{let t=L+e[B+e[z]];F*=F,o=F*F*(i[t]*S+n[t]*_+r[t]*A)}let N=.6-M*M-C*C-E*E;if(N<0)l=0;else{let t=L+d+e[B+u+e[z+p]];N*=N,l=N*N*(i[t]*M+n[t]*C+r[t]*E)}let U=.6-P*P-T*T-D*D;if(U<0)h=0;else{let t=L+f+e[B+m+e[z+g]];U*=U,h=U*U*(i[t]*P+n[t]*T+r[t]*D)}let k=.6-I*I-O*O-R*R;if(k<0)c=0;else{let t=L+1+e[B+1+e[z+1]];k*=k,c=k*k*(i[t]*I+n[t]*O+r[t]*R)}return 32*(o+l+h+c)}}((0,jS.default)(t.seed)):function(t=Math.random){let e=ZS(t),i=new Float64Array(e).map(t=>YS[t%12*2]),n=new Float64Array(e).map(t=>YS[t%12*2+1]);return function(t,r){let s,a,o=0,l=0,h=0,c=(t+r)*GS,d=XS(t+c),u=XS(r+c),p=(d+u)*WS,f=t-(d-p),m=r-(u-p);f>m?(s=1,a=0):(s=0,a=1);
2let g=f-s+WS,v=m-a+WS,y=f-1+2*WS,x=m-1+2*WS,b=255&d,w=255&u,S=.5-f*f-m*m;if(S>=0){let t=b+e[w];S*=S,o=S*S*(i[t]*f+n[t]*m)}let _=.5-g*g-v*v;if(_>=0){let t=b+s+e[w+a];_*=_,l=_*_*(i[t]*g+n[t]*v)}let A=.5-y*y-x*x;if(A>=0){let t=b+1+e[w+1];A*=A,h=A*A*(i[t]*y+n[t]*x)}return 70*(o+l+h)}}((0,jS.default)(t.seed))}},bI=class extends(s_(wi)){constructor(t,e){super(),this.parameters=e,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.object=t}resetOnMove(){this.removeFromParent(),this.parent=null}expandClones(t){if(null===this.parent)this.updateState(this.parameters,t);else for(let e of this.children)e instanceof o_&&e.expand()}invalidateTransform(t){this.matrixWorldNeedsUpdate=!0,this.traverse(e=>{e instanceof o_&&e.object===t&&(e.matrixWorldNeedsUpdate=!0)})}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters);break;case"toObject":this._updateToObject(this.parameters)}for(let t of this.children)t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldSVD())}_updateCount(t){let e;if(e=void 0!==t?t:"grid"===this.parameters.type?Math.round(this.parameters.grid.count[0])*Math.round(this.parameters.grid.count[1])*Math.round(this.parameters.grid.count[2]):this.parameters.count,"toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===t&&"random"!==this.parameters.toObject.spreadType)return}else e=0;if("toObject"===this.parameters.type&&this.objectForSample){let t=this.children;if(t.length===e)return;if(t.length<e)for(let i=0,n=e-t.length;i<n;++i){let t=new o_(this.object);t.expand(),this.add(t)}else for(let i=0,n=t.length-e;i<n;++i)this.remove(t[i])}else{if(this.children.length===e)return;if(this.children.length<e)for(let t=0,i=e-this.children.length;t<i;++t){let t=new o_(this.object);t.expand(),this.add(t)}else for(let t=0,i=this.children.length-e;t<i;++t)this.remove(this.children[t])}}getRandom(t,e=!1){return(null===this.random||this.random.data.seed!==t.seed||this.random.is3D!==e)&&(this.random=new xI(t,e)),this.random}_updateRadial(t){let e,i=t.radial,n=i.start*Wt.DEG2RAD,r=n-i.end*Wt.DEG2RAD,s=new ai(i.rotation[0],i.rotation[1],i.rotation[2]);switch(i.axis){case"z":e=new be(0,0,1);break;case"y":e=new be(0,1,0);break;default:e=new be(1,0,0)}let a=t.randomnessObject??fx.defaultData([1,1,1]).randomnessObject,o=this.getRandom(a),l=kD(a.strength,this.parameters.randomness);for(let[h,c]of this.children.entries()){let d=h*(a.freqScale/10)+a.movement,u=o.noise(d,d,d),p=h+1;c.scale.x=i.scale[0]+l(p,VD(u,a.scale[0]))||lI,c.scale.y=i.scale[1]+l(p,VD(u,a.scale[1]))||lI,c.scale.z=i.scale[2]+l(p,VD(u,a.scale[2]))||lI,c.position.setScalar(0);let f=r/t.count*h-n;switch(i.axis){case"x":c.rotation.set(0,f,0);break;case"y":c.rotation.set(0,0,f);break;case"z":c.rotation.set(f,0,0)}c.translateOnAxis(e,i.radius),c.position.x+=i.position[0]+l(p,VD(u,a.position[0])),c.position.y+=i.position[1]+l(p,VD(u,a.position[1])),c.position.z+=i.position[2]+l(p,VD(u,a.position[2]));let m=l(p,VD(u,a.rotation[0])),g=l(p,VD(u,a.rotation[1])),v=l(p,VD(u,a.rotation[2]));!0===i.alignment?(c.rotation.x+=s.x+m,c.rotation.y+=s.y+g,c.rotation.z+=s.z+v):c.rotation.set(s.x+m,s.y+g,s.z+v)}}_updateLinear(t){if("linear"!==t.type)throw new Error;let e=t.linear,i=new ai(e.rotation[0],e.rotation[1],e.rotation[2]),n=t.randomnessObject??fx.defaultData([1,1,1]).randomnessObject,r=this.getRandom(n),s=kD(n.strength,this.parameters.randomness);for(let[a,o]of this.children.entries()){let t=a*(n.freqScale/10)+n.movement,l=r.noise(t,t,t),h=a+1,c=s(h,VD(l,n.rotation[0])),d=s(h,VD(l,n.rotation[1])),u=s(h,VD(l,n.rotation[2]));o.scale.x=1+(e.scale[0]-1)*a+s(h,VD(l,n.scale[0]))||lI,o.scale.y=1+(e.scale[1]-1)*a+s(h,VD(l,n.scale[1]))||lI,o.scale.z=1+(e.scale[2]-1)*a+s(h,VD(l,n.scale[2]))||lI,o.rotation.x=i.x*a+c,o.rotation.y=i.y*a+d,o.rotation.z=i.z*a+u,o.position.x=e.position[0]*a+s(h,VD(l,n.position[0])),o.position.y=e.position[1]*a+s(h,VD(l,n.position[1])),o.position.z=e.position[2]*a+s(h,VD(l,n.position[2]))}}_updateGrid(t){let e=0,i=t.grid,n=t.randomnessObject??fx.defaultData([1,1,1]).randomnessObject,r=this.getRandom(n,!0),s=kD(n.strength,this.parameters.randomness);if(!0===i.useCenter){let t={x:i.count[0]%2==0?2:1,y:i.count[1]%2==0?2:1,z:i.count[2]%2==0?2:1},a=new be(i.size[0]*(i.count[0]-t.x)*.5,i.size[1]*(i.count[1]-t.y)*.5,i.size[2]*(i.count[2]-t.z)*.5);for(let o=0;o<i.count[0];o++)for(let t=0;t<i.count[1];t++)for(let l=0;l<i.count[2];l++){let h=r.noise((o+1)*(n.freqScale/10)+n.movement,(t+1)*(n.freqScale/10)+n.movement,(l+1)*(n.freqScale/10)+n.movement),c=this.children[e++];
2c.scale.x=1+s(e,VD(h,n.scale[0]))||lI,c.scale.y=1+s(e,VD(h,n.scale[1]))||lI,c.scale.z=1+s(e,VD(h,n.scale[2]))||lI;let d=s(e,VD(h,n.rotation[0])),u=s(e,VD(h,n.rotation[1])),p=s(e,VD(h,n.rotation[2]));c.rotation.set(d,u,p),c.position.x=i.size[0]*o-a.x+s(e,VD(h,n.position[0])),c.position.y=i.size[1]*t-a.y+s(e,VD(h,n.position[1])),c.position.z=i.size[2]*l-a.z+s(e,VD(h,n.position[2]))}}else for(let a=0;a<i.count[0];a++)for(let t=0;t<i.count[1];t++)for(let o=0;o<i.count[2];o++){let l=r.noise((a+1)*(n.freqScale/10)+n.movement,(t+1)*(n.freqScale/10)+n.movement,(o+1)*(n.freqScale/10)+n.movement),h=this.children[e++];h.scale.x=1+s(e,VD(l,n.scale[0]))||lI,h.scale.y=1+s(e,VD(l,n.scale[1]))||lI,h.scale.z=1+s(e,VD(l,n.scale[2]))||lI;let c=s(e,VD(l,n.rotation[0])),d=s(e,VD(l,n.rotation[1])),u=s(e,VD(l,n.rotation[2]));h.rotation.set(c,d,u),h.position.x=i.size[0]*a+s(e,VD(l,n.position[0])),h.position.y=-i.size[1]*t+s(e,VD(l,n.position[1])),h.position.z=-i.size[2]*o+s(e,VD(l,n.position[2]))}}_updateToObject(t){if("toObject"!==t.type)throw new Error;let{toObject:e}=t,i=new ai(e.rotation[0],e.rotation[1],e.rotation[2]),n=t.randomnessObject??fx.defaultData([1,1,1]).randomnessObject,r=this.getRandom(n),s=kD(n.strength,this.parameters.randomness);if(!e.object){for(let[,t]of this.children.entries())t.position.set(0,0,0),t.scale.setScalar(1),t.rotation.set(0,0,0);return void(this.objectForSample=void 0)}if(!this.objectForSample)return;if(this.objectForSample instanceof oI){if(!this.objectForSample.font?.isLoaded||void 0===this.objectForSample.geometry.attributes.position)return void(this._pendingMediaLoad=!0);this._pendingMediaLoad=!1}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return;let a=this.getSubdivData();if(a.length>0){let t=Math.round(a.length*e.count/100);this._updateCount(t)}else{let t=this.objectForSample.geometry.getAttribute("position");if(!t||isNaN(t.count)||0===t.count)return}this.objectForSample.updateMatrixWorld();let o=new $S(this.objectForSample).build(),l=ND[e.axis],h=this.children;o.setRandomGenerator((0,jS.default)(this.object.uuid+e.seed));for(let[c,d]of h.entries()){let t=c*(n.freqScale/10)+n.movement,h=r.noise(t,t,t),u=c+1,p=s(u,VD(h,n.rotation[0])),f=s(u,VD(h,n.rotation[1])),m=s(u,VD(h,n.rotation[2]));"random"===e.spreadType?o.sample(mI,gI):(a.length&&(mI.fromArray(a[c].pos),gI.fromArray(a[c].norm)),this.objectForSample instanceof FD&&mI.applyMatrix4(dI.copy(this.objectForSample.matrixWorld).invert())),mI.applyMatrix4(this.object.hiddenMatrix.clone().invert()),d.position.copy(mI),pI.fromArray(l);let g="normal"===e.align?gI:this.object.getWorldDirection(yI),v=fI.fromArray(e.position);fI.x+=s(u,VD(h,n.position[0])),fI.y+=s(u,VD(h,n.position[1])),fI.z+=s(u,VD(h,n.position[2]));
2let y=Math.acos(g.dot(pI)),x=vI.crossVectors(pI,g).normalize(),b=uI.makeRotationAxis(x,y),w=g.clone().cross(this.object.up).normalize(),S=w.clone().cross(g).normalize(),_=(new Ze).makeBasis(w,g,S),A=new be(pI.y,pI.z,pI.x).normalize(),M=A.clone().cross(pI).normalize(),C=(new Ze).makeBasis(A,pI,M).invert(),E=(new Ze).multiplyMatrices(_,C);d.rotation.setFromRotationMatrix(E),v.applyMatrix4(b),d.position.add(v),d.rotation.x=d.rotation.x+i.x+p,d.rotation.y=d.rotation.y+i.y+f,d.rotation.z=d.rotation.z+i.z+m,d.scale.setScalar(1),d.scale.x=d.scale.x+e.scale[0]+s(u,VD(h,n.scale[0]))||lI,d.scale.y=d.scale.y+e.scale[1]+s(u,VD(h,n.scale[1]))||lI,d.scale.z=d.scale.z+e.scale[2]+s(u,VD(h,n.scale[2]))||lI,d.scale.multiply(this.object.scale),d.hiddenMatrix=this.object.hiddenMatrix}}getSubdivData(){if(!this.objectForSample)return[];let t=this.parameters.toObject.spreadType,e=new Map,i=(t,i)=>{let n=Math.round(1e4*t[0])+"_"+Math.round(1e4*t[1])+"_"+Math.round(1e4*t[2]),r=e.get(n);r?(r.pos[0]+=t[0],r.pos[1]+=t[1],r.pos[2]+=t[2],r.norm[0]+=i[0],r.norm[1]+=i[1],r.norm[2]+=i[2],r.count+=1):e.set(n,{pos:[...t],norm:[...i],count:1})};if("random"===t)return[];if(this.objectForSample instanceof FD){let e=this.objectForSample,n=UD[t],r=aI[n],s=rI[n],a=sI[n],o=r(e.subdivPointerNew);for(let t=0;t<=o-1;t++){let n=s(e.subdivPointerNew,t),r=a(e.subdivPointerNew,t);hI.fromArray(n).applyMatrix4(e.matrixWorld),cI.fromArray(r),i(hI.toArray(),cI.toArray())}}else(this.objectForSample.geometry.index?function(t){let e=[];for(let i=0;i<=t.index.count;i++)if(YD.fromArray(t.index.array,3*i),XD.setFromAttributeAndIndices(t.attributes.position,YD.x,YD.y,YD.z),XD.getNormal(QD),XD.getMidpoint(ZD),!(isNaN(ZD.x)||isNaN(ZD.y)||isNaN(ZD.z))){let{a:t,b:i,c:n}=XD,r=t.toArray(),s=i.toArray(),a=n.toArray(),o=t.distanceTo(i),l=i.distanceTo(n),h=n.distanceTo(t),c=qD(r,s),d=qD(s,a),u=qD(a,r),p=[o,l,h],f=Math.max(...p),m=p.filter(t=>Math.round(t)===Math.round(f)).length>1,g=[],v=XD.getMidpoint(ZD).toArray();f===o&&!m&&(g=[d,u,u],v=c),f===l&&!m&&(g=[c,u,u],v=d),f===h&&!m&&(g=[c,d,d],v=u),m&&(g=[c,d,u]),e.push({vertices:[r,s,a],faceCenters:g,midpoint:v,norm:XD.getNormal(QD).toArray()})}return e}(this.objectForSample.geometry):function(t){let e=[],{position:i}=t.attributes;for(let n=0;n<i.count;n++){XD.setFromAttributeAndIndices(i,3*n,3*n+1,3*n+2),XD.getNormal(QD),XD.getMidpoint(ZD);let t=XD.a.toArray(),r=XD.b.toArray(),s=XD.c.toArray();e.push({vertices:[t,r,s],faceCenters:[qD(t,r),qD(r,s),qD(s,t)],midpoint:ZD.toArray(),norm:QD.toArray()})}return e}(this.objectForSample.geometry)).forEach((e,n)=>{"polygon_center"===t&&i(e.midpoint,e.norm),"vertex"===t&&(i(e.vertices[0],e.norm),i(e.vertices[1],e.norm),i(e.vertices[2],e.norm)),"edge"===t&&(i(e.faceCenters[0],e.norm),i(e.faceCenters[1],e.norm),i(e.faceCenters[2],e.norm))});let n=Array.from(e.values());for(let r of n)r.pos[0]/=r.count,r.pos[1]/=r.count,r.pos[2]/=r.count,r.norm[0]/=r.count,r.norm[1]/=r.count,r.norm[2]/=r.count;return n}updateState(t,e){if(this.parameters=Gf(t),"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 t=e.find(this.parameters.toObject.object);this.objectForSample=t instanceof JC?t:void 0,this.matrix=new Ze,this.hiddenMatrix=new Ze,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,t&&t.add(this)}this.update()}get pendingMediaLoad(){return this._pendingMediaLoad}},wI=t=>{var e;return(e=class extends t{}).geometryHelper=new un(30,30,30),e},SI=new Qe,_I=new Ve,AI=new Ze,MI=(t,e,i,n,r=!1,s=t)=>{let a=e,o=s.matrixWorld;if(null===a.boundingSphere&&a.computeBoundingSphere(),_I.copy(a.boundingSphere),_I.applyMatrix4(o),!1===i.ray.intersectsSphere(_I)||(AI.copy(o).invert(),SI.copy(i.ray).applyMatrix4(AI),null!==a.boundingBox&&!1===SI.intersectsBox(a.boundingBox)))return;let l,h,c,d,u,p,f=a.index,m=a.attributes.position,g=a.drawRange;if(!1===r){for(u=Math.max(0,g.start),p=Math.min(f.count,g.start+g.count);u<p;u+=3)if(h=f.getX(u),c=f.getX(u+1),d=f.getX(u+2),l=v(t,i,SI,m,h,c,d),l)return l.faceIndex=Math.floor(u/3),void n.push(l)}else{let e=a.attributes.position,r=new be,o=new be,l=new be,h=new be,c=2,d=1/((s.scale.x+s.scale.y+s.scale.z)/3),u=d*d;for(let a=Math.max(0,g.start),p=Math.min(e.count,g.start+g.count)-1;a<p;a+=c){if(r.fromBufferAttribute(e,a),o.fromBufferAttribute(e,a+1),SI.distanceSqToSegment(r,o,h,l)>u)continue;h.applyMatrix4(s.matrixWorld);let c=i.ray.origin.distanceTo(h);c<i.near||c>i.far||n.push({distance:c,point:l.clone().applyMatrix4(s.matrixWorld),object:t})}}function v(t,e,i,n,r,s,a){let o=new be,l=new be,h=new be,c=new be,d=new be;if(o.fromBufferAttribute(n,r),l.fromBufferAttribute(n,s),h.fromBufferAttribute(n,a),null===i.intersectTriangle(o,l,h,!1,c))return null;d.copy(c),d.applyMatrix4(t.matrixWorld);let u=e.ray.origin.distanceTo(d);return u<e.near||u>e.far?null:{faceIndex:1,distance:u,point:d.clone(),object:t}}},CI=new be,EI=new yn,PI=class extends za{constructor(t){let e=new Qi,i=new Ea({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],r=[],s={},a=new le(15711266),o=new le(15711266),l=new le(2857471);
vendor: 4,105 bytes, line 2
2function h(t,e,i){c(t,i),c(e,i)}function c(t,e){n.push(0,0,0),r.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(n.length/3-1)}h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",o),h("p","n2",o),h("p","n3",o),h("p","n4",o),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),e.setAttribute("position",new Vi(n,3)),e.setAttribute("color",new Vi(r,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let t=this.geometry,e=this.pointMap;EI.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=.8;TI("n1",e,t,EI,-1,-1,i),TI("n2",e,t,EI,1,-1,i),TI("n3",e,t,EI,-1,1,i),TI("n4",e,t,EI,1,1,i);let n=i;TI("f1",e,t,EI,-1,-1,n),TI("f2",e,t,EI,1,-1,n),TI("f3",e,t,EI,-1,1,n),TI("f4",e,t,EI,1,1,n);let r=n;TI("u1",e,t,EI,.35,1.1,r),TI("u2",e,t,EI,-.35,1.1,r),TI("u3",e,t,EI,0,1.55,r),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function TI(t,e,i,n,r,s,a){CI.set(r,s,a).unproject(n);let o=e[t];if(void 0!==o){let t=i.getAttribute("position");for(let e=0,i=o.length;e<i;e++)t.setXYZ(o[e],CI.x,CI.y,CI.z)}}var DI,II=class extends(wI(PI)){constructor(t){super(t),this.object=t,this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,e){MI(this.object,this.geometry,t,e,!0)}};(DI||(DI={})).is=t=>"objectHelper"in t;var OI=(t,e)=>class extends(E_(t)){constructor(){super(...arguments),this.objectHelper=new e(this),this.gizmos={}}get geometryHelper(){return e.geometryHelper}raycast(t,e){this.objectHelper.raycast(t,e)}showGizmos(){for(let t in this.gizmos){let e=this.gizmos[t];e instanceof bh&&(e.visible=!0)}}updateEntityBoxSize(t,e){this.objectHelper.visible&&this.geometryHelper instanceof un?(t.setScalar(0),e.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(t,e)}hideGizmos(){for(let t in this.gizmos){let e=this.gizmos[t];e instanceof bh&&(e.visible=!1)}}},RI=new be,LI=new be,BI=new xe,zI=new be,FI=new be,NI=new be,UI=class extends(OI(yn,II)){constructor(t="",e={...ub.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=px.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this.super_Entity(t,e),this.previousProjectionMatrix=new Ze,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,n=this.height;this.orthoCamera=new Wn(-.5*i,.5*i,.5*n,-.5*n,-5e4,1e4),this.perspCamera=new xn(45,i/n,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()}get isPerspectiveCamera(){return"PerspectiveCamera"===this.cameraType}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(t){this.perspCamera.fov=t}get fov(){return this.perspCamera.fov}setNear(t,e){"PerspectiveCamera"===t?this.perspCamera.near=e:this.orthoCamera.near=e}setZoom(t,e){e>=0&&("PerspectiveCamera"===t?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}set cameraType(t){"PerspectiveCamera"===t?this.toPerspective():"OrthographicCamera"===t&&this.toOrthographic()}get near(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near}
vendor: 4,750 bytes, line 2
2set near(t){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t,e,i){"number"==typeof t&&(t=new be(t,e,i)),super.lookAt(t),this.getWorldPosition(RI),this.targetOffset=RI.distanceTo(t)}getTarget(t=new be){return this.getWorldDirection(LI),this.getWorldPosition(RI),LI.multiplyScalar(this.targetOffset),t.copy(RI).add(LI),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(RI),RI.distanceTo(t)}updateUp(){this.getWorldQuaternion(BI),zI.set(0,0,1).applyQuaternion(BI),FI.copy(wi.DEFAULT_UP),this.isUpVectorFlipped&&FI.negate(),FI.applyQuaternion(BI),NI.copy(wi.DEFAULT_UP).projectOnPlane(zI),this.angleOffsetFromUp=NI.angleTo(FI),this.angleOffsetFromUp*=NI.cross(FI).dot(zI)>=0?1:-1}updateTransformState(t,e){let i=super.updateTransformState(t,e);return void 0!==t.isUpVectorFlipped&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(t){let e=t.getWorldPosition(new be),i=t.getWorldDirection(new be).multiplyScalar(this.targetOffset);return{position:e.clone().add(i),target:e}}getViewToTarget(t){let e=this.getWorldDirection(new be).multiplyScalar(this.targetOffset);return{position:t.clone().sub(e),target:t}}getViewToObject(t){let e=new be;return t.getWorldPosition(e),this.getViewToTarget(e)}setViewplaneSize(t,e,i=!1){if(this.aspect=t/e,i){let i=t>e?this.aspect:1,n=t>e?1:this.aspect;this.left=-395*i,this.right=395*i,this.top=1/n*395,this.bottom=1/n*-395}else this.left=.5*-t,this.right=.5*t,this.top=.5*e,this.bottom=.5*-e;this.updateProjectionMatrix()}copyViewPlaneSize(t){this.aspect=t.aspect,this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.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(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,e,i,n,r,s){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(t,e,i,n,r,s):this.orthoCamera.setViewOffset(t,e,i,n,r,s)}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():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,e){return super.copy(t,e),this.parent=t.parent,this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=null===t.view?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}toCameraState(t=[]){let e={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};return Cm(e,t)}updateCameraSubtype(t,e){let i="perspective"===t?"PerspectiveCamera":"Orthogra
2phicCamera";void 0!==e.zoom&&this.setZoom(i,e.zoom),void 0!==e.near&&this.setNear(i,e.near),void 0!==e.fov&&"PerspectiveCamera"===i&&(this.fov=e.fov)}updateState(t,e){this.updateCameraState(t,e)}updateCameraState(t,e){this.updateState_Entity(t,e),void 0!==t.far&&(this.far=t.far),void 0!==t.orthographic&&this.updateCameraSubtype("orthographic",t.orthographic),void 0!==t.perspective&&this.updateCameraSubtype("perspective",t.perspective),void 0!==t.type&&(this.cameraType=t.type),void 0!==t.up&&this.up.fromArray(t.up),void 0!==t.targetOffset&&(this.targetOffset=t.targetOffset),void 0!==t.isUpVectorFlipped&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),1===t.path.length&&0===t.type&&this.updateCameraSubtype(t.path[0],t.props)}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}},kI=new Ze,VI=new Ze;function jI(t){let e=!1;return t.scene.objects.traverse((t,i)=>{"BooleanGeometry"===i.geometry?.type&&(e=!0)}),e}var GI,WI=class extends MD{constructor(t,e,i){super(t,e),this.data=e,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new Qi,this.onAfterRender=(t,e,i,n,r,s)=>{super.onAfterRender(t,e,i,n,r,s),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(t,e,i){super.updateByPatchedOp(t,e,i),1===t.path.length&&"geometry"===t.path[0]&&0===t.type&&void 0!==t.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(t,e=!0){if(-1!==this.booleanMeshSetAddress&&!t)return;for(let n=0;n<this.children.length;n++){let i=this.children[n];i instanceof WI&&!0===i.dataPatched.visible&&i.recomputeBoolean(!0===t,e)}this.meshSetAddresses=[];for(let n=0;n<this.children.length;n++){let i=this.children[n];if(i instanceof JC&&!0===i.dataPatched.visible&&i.geometry.attributes.position?.count>0&&i.geometry.drawRange.count>0&&0!==i.booleanMeshSetAddress){kI.multiplyMatrices(i.hiddenMatrix,i.matrix);try{if(-1===i.booleanMeshSetAddress){if((i.geometry.index??i.geometry.getAttribute("position")).count/3<15e5&&(i.booleanMeshSetAddress=TC.getMeshSet(i.geometry,!0===t,e)),-1===i.booleanMeshSetAddress)return;TC.transformMeshSet(i.booleanMeshSetAddress,kI),i.booleanMatrixInvOld.copy(kI).invert(),i.booleanWasTransformed=!1}else i instanceof WI&&!0===i.needsTransformForDownstream?(TC.transformMeshSet(i.booleanMeshSetAddress,kI),i.needsTransformForDownstream=!1):!0===i.booleanWasTransformed&&(TC.transformMeshSet(i.booleanMeshSetAddress,VI.multiplyMatrices(kI,i.booleanMatrixInvOld)),i.booleanMatrixInvOld.copy(kI).invert(),i.booleanWasTransformed=!1)}catch(Qy){i.booleanMeshSetAddress=0,i.geometry.userData.booleanOperationDidFail=!0;continue}!1===TC.hasOpenEdges(i.booleanMeshSetAddress)||n===this.children.length-1&&2===this.booleanOp?(this.meshSetAddresses.push(i.booleanMeshSetAddress),i.geometry.userData.booleanOperationDidFail=!1):i.geometry.userData.booleanOperationDidFail="openEdges"}}if(0===this.meshSetAddresses.length)return this.geometry.setAttribute("position",new Vi([],0)),void this.geometry.setDrawRange(0,0);if(!0===t)return TC.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new Qi,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=TC.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(dx){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,OD(this),RD(this)}dispose(){super.dispose(),this.geometry.dispose()}};(GI||(GI={})).is=function(t){return r_.is(t)&&t instanceof xl};var HI=(t,e)=>class extends(OI(t,e)){updateState_Light(t,e){this.updateState_Entity(t,e),void 0!==t.color&&(this.color=e.shared.color(t.color)),void 0!==t.intensity&&(this.intensity=t.intensity),void 0!==t.depth&&(this.shadow.camera.far=t.depth,this.shadow.needsUpdate=!0),void 0!==t.shadows&&(this.castShadow=t.shadows)}},qI=t=>t instanceof JC,XI=t=>null!==t&&t instanceof WI,YI=t=>DI.is(t),QI=new be(1,1,1),ZI=new be,KI=new be,JI=new xe,$I=class extends(wI(wh)){constructor(t,e=15){super(e),this.object=t,this.dummy=new ia,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(t,e){MI(this.object,$I.geometryHelper,t,e,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(t){this.object.matrixWorld.decompose(ZI,JI,KI),this.matrix.compose(ZI,JI,QI),super.updateMatrixWorld(t)}updateWorldMatrix(t,e){}},tO=class extends(OI(ia,$I)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(
vendor: 24,294 bytes, line 2
2)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&1===Object.keys(t).length&&e.scene.reloadSplats()}},eO=class extends(OI(ia,$I)){constructor(t,e,i){super(),this.super_Entity(t,e),this.context=i,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}},iO=0,nO=1,rO="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",sO=class extends vn{constructor(t=!1,e=!1){super({name:"BokehMaterial",defines:{PASS:t?"2":"1"},uniforms:{kernel64:new $l(null),kernel16:new $l(null),inputBuffer:new $l(null),cocBuffer:new $l(null),texelSize:new $l(new Ht),scale:new $l(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;uniform vec4 kernel64[32];varying vec2 vUv;void main(){\n#ifdef FOREGROUND\nvec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale;\n#else\nfloat CoC=texture2D(cocBuffer,vUv).g*scale;\n#endif\nif(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{\n#ifdef FOREGROUND\nvec2 step=texelSize*max(CoC,CoCNearFar.g*scale);\n#else\nvec2 step=texelSize*CoC;\n#endif\nvec4 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;}}",vertexShader:rO}),this.toneMapped=!1,e&&(this.defines.FOREGROUND="1"),this.generateKernel()}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}set cocBuffer(t){this.uniforms.cocBuffer.value=t}setCoCBuffer(t){this.uniforms.cocBuffer.value=t}get scale(){return this.uniforms.scale.value}set scale(t){this.uniforms.scale.value=t}getScale(t){return this.uniforms.scale.value=t}setScale(t){this.uniforms.scale.value=t}generateKernel(){let t=new Float32Array(128),e=new Float32Array(32),i=0,n=0;for(let a=0;a<80;++a){let r=2.39996323*a,s=Math.sqrt(a)/Math.sqrt(80),o=s*Math.cos(r),l=s*Math.sin(r);a%5==0?(e[n++]=o,e[n++]=l):(t[i++]=o,t[i++]=l)}let r=[],s=[];for(let a=0;a<128;)r.push(new me(t[a++],t[a++],t[a++],t[a++]));for(let a=0;a<32;)s.push(new me(e[a++],e[a++],e[a++],e[a++]));this.uniforms.kernel64.value=r,this.uniforms.kernel16.value=s}setTexelSize(t,e){this.uniforms.texelSize.value.set(t,e)}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}};function aO(t,e,i){return t*(e-i)-e}function oO(t,e,i){return Math.min(Math.max((t+e)/(e-i),0),1)}var lO=class extends vn{constructor(t){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new $l(null),focusDistance:new $l(0),focusRange:new $l(0),cameraNear:new $l(.3),cameraFar:new $l(1e3)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <packing>\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}void main(){float depth=readDepth(vUv);\n#ifdef PERSPECTIVE_CAMERA\nfloat viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);\n#else\nfloat linearDepth=depth;\n#endif\nfloat signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}",vertexShader:rO}),this.toneMapped=!1,this.uniforms.focalLength=this.uniforms.focusRange,this.adoptCameraSettings(t)}get near(){return this.uniforms.cameraNear.value}get far(){return this.uniforms.cameraFar.value}set depthBuffer(t){this.uniforms.depthBuffer.value=t}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=_t){this.depthBuffer=t,this.depthPacking=e}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(t){this.uniforms.focusDistance.value=t}get worldFocusDistance(){return-aO(this.focusDistance,this.near,this.far)}set worldFocusDistance(t){this.focusDistance=oO(-t,this.near,this.far)}getFocusDistance(t){this.uniforms.focusDistance.value=t}setFocusDistance(t){this.uniforms.focusDistance.value=t}get focalLength(){return this.focusRange}set focalLength(t){this.focusRange=t}get focusRange(){return this.uniforms.focusRange.value}set focusRange(t){this.uniforms.focusRange.value=t}get worldFocusRange(){return-aO(this.focusRange,this.near,this.far)}set worldFocusRange(t){this.focusRange=oO(-t,this.near,this.far)}getFocalLength(t){return this.focusRange}setFocalLength(t){this.focusRange=t}adoptCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof xn?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},hO=class extends vn{constructor(t=new Ht){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new $l(null),texelSize:new $l(new Ht),halfTexelSize:new $l(new Ht),kernel:new $l(0),scale:new $l(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#include <dithering_pars_fragment>\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nvarying 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;\n#include <encodings_fragment>\n#include <dithering_fragment>\n}",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(t.x,t.y)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.inputBuffer=t}get scale(){return this.uniforms.scale.value}set scale(t){this.uniforms.scale.value=t}getScale(){return this.uniforms.scale.value}setScale(t){this.uniforms.scale.value=t}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(t){this.uniforms.kernel.value=t}setKernel(t){this.kernel=t}setTexelSize(t,e){this.uniforms.texelSize.value.set(t,e),this.uniforms.halfTexelSize.value.set(t,e).multiplyScalar(.5)}setSize(t,e){let i=this.uniforms;i.texelSize.value.set(1/t,1/e),i.halfTexelSize.value.copy(i.texelSize.value).multiplyScalar(.5)}},cO=class extends vn{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new $l(null),opacity:new $l(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;\n#include <encodings_fragment>\n}",vertexShader:rO}),this.toneMapped=!1}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}getOpacity(t){return this.uniforms.opacity.value}setOpacity(t){this.uniforms.opacity.value=t}},dO=2,uO=0,pO=class extends vn{constructor(t=new Ht,e=dO){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:y.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 $l(null),depthBuffer:new $l(null),predicationBuffer:new $l(null),texelSize:new $l(t)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\n#if EDGE_DETECTION_MODE == 1\n#include <common>\n#endif\n#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}\n#elif PREDICATION_MODE == 2\nuniform 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);}\n#endif\n#if PREDICATION_MODE != 0\nvec2 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);}\n#endif\n#if EDGE_DETECTION_MODE != 0\nuniform sampler2D inputBuffer;\n#endif\nvoid main(){\n#if EDGE_DETECTION_MODE == 0\nconst vec2 threshold=vec2(DEPTH_THRESHOLD);\n#elif PREDICATION_MODE != 0\nvec2 threshold=calculatePredicatedThreshold();\n#else\nconst vec2 threshold=vec2(EDGE_THRESHOLD);\n#endif\n#if EDGE_DETECTION_MODE == 0\nvec3 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);\n#elif EDGE_DETECTION_MODE == 1\nfloat 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);\n#elif EDGE_DETECTION_MODE == 2\nvec4 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);\n#endif\n}",vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;\n#if EDGE_DETECTION_MODE != 0\nvarying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;\n#endif\nvoid main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);\n#if EDGE_DETECTION_MODE != 0\nvUv2=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);\n#endif\ngl_Position=vec4(position.xy,1.0,1.0);}"}),this.toneMapped=!1,this.edgeDetectionMode=e}set depthBuffer(t){this.uniforms.depthBuffer.value=t}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=_t){this.depthBuffer=t,this.depthPacking=e}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(t){this.defines.EDGE_DETECTION_MODE=t.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(t){this.edgeDetectionMode=t}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(t){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=t.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(t){this.localContrastAdaptationFactor=t}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(t){this.defines.EDGE_THRESHOLD=t.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*t).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(t){this.edgeDetectionThreshold=t}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(t){this.defines.PREDICATION_MODE=t.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(t){this.predicationMode=t}set predicationBuffer(t){this.uniforms.predicationBuffer.value=t}setPredicationBuffer(t){this.uniforms.predicationBuffer.value=t}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(t){this.defines.PREDICATION_THRESHOLD=t.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(t){this.predicationThreshold=t}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(t){this.defines.PREDICATION_SCALE=t.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(t){this.predicationScale=t}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(t){this.defines.PREDICATION_STRENGTH=t.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(t){this.predicationStrength=t}setSize(t,e){this.uniforms.texelSize.value.set(1/t,1/e)}},fO="#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#define packFloatToRGBA(v) packDepthToRGBA(v)\n#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nuniform highp sampler2D depthBuffer;\n#else\nuniform mediump sampler2D depthBuffer;\n#endif\nuniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#if THREE_REVISION >= 137\nvec4 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);}\n#endif\nfloat readDepth(const in vec2 uv){\n#if DEPTH_PACKING == 3201\nreturn unpackRGBAToDepth(texture2D(depthBuffer,uv));\n#else\nreturn texture2D(depthBuffer,uv).r;\n#endif\n}float getViewZ(const in float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;\n#ifdef ENCODE_OUTPUT\n#include <encodings_fragment>\n#endif\n#include <dithering_fragment>\n}",mO={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"},gO=class extends vn{constructor(t,e,i,n,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:y.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new $l(null),depthBuffer:new $l(null),resolution:new $l(new Ht),texelSize:new $l(new Ht),cameraNear:new $l(.3),cameraFar:new $l(1e3),aspect:new $l(1),time:new $l(0)},blending:0,depthWrite:!1,depthTest:!1,dithering:r}),this.toneMapped=!1,t&&this.setShaderParts(t),e&&this.setDefines(e),i&&this.setUniforms(i),this.adoptCameraSettings(n)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(t){this.uniforms.depthBuffer.value=t}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(t){this.defines.DEPTH_PACKING=t.toFixed(0),this.needsUpdate=!0}setDepthBuffer(t,e=_t){this.depthBuffer=t,this.depthPacking=e}setShaderParts(t){return this.fragmentShader=fO.replace(mO.FRAGMENT_HEAD,t.get(mO.FRAGMENT_HEAD)).replace(mO.FRAGMENT_MAIN_UV,t.get(mO.FRAGMENT_MAIN_UV)).replace(mO.FRAGMENT_MAIN_IMAGE,t.get(mO.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(mO.VERTEX_HEAD,t.get(mO.VERTEX_HEAD)).replace(mO.VERTEX_MAIN_SUPPORT,t.get(mO.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(t){for(let e of t.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(t){for(let e of t.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(t){this.extensions={};for(let e of t)this.extensions[e]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(t){this.encodeOutput!==t&&(t?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(t){return this.encodeOutput}setOutputEncodingEnabled(t){this.encodeOutput=t}get time(){return this.uniforms.time.value}set time(t){this.uniforms.time.value=t}setDeltaTime(t){this.uniforms.time.value+=t}adoptCameraSettings(t){t&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far,t instanceof xn?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(t,e){let i=this.uniforms;i.resolution.value.set(t,e),i.texelSize.value.set(1/t,1/e),i.aspect.value=t/e}static get Section(){return mO}},vO=class extends vn{constructor(t=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:y.replace(/\D+/g,"")},uniforms:{inputBuffer:new $l(null),threshold:new $l(0),smoothing:new $l(1),range:new $l(null)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#include <common>\n#if THREE_REVISION < 143\n#define luminance(v) linearToRelativeLuminance(v)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef RANGE\nuniform vec2 range;\n#elif defined(THRESHOLD)\nuniform float threshold;uniform float smoothing;\n#endif\nvarying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);\n#ifdef RANGE\nfloat low=step(range.x,l);float high=step(l,range.y);l*=low*high;\n#elif defined(THRESHOLD)\nl=smoothstep(threshold,threshold+smoothing,l);\n#endif\n#ifdef COLOR\ngl_FragColor=vec4(texel.rgb*l,l);\n#else\ngl_FragColor=vec4(l);\n#endif\n}",vertexShader:rO}),this.toneMapped=!1,this.colorOutput=t,this.luminanceRange=e}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get threshold(){return this.uniforms.threshold.value}set threshold(t){this.smoothing>0||t>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=t}getThreshold(){return this.threshold}setThreshold(t){this.threshold=t}get smoothing(){return this.uniforms.smoothing.value}set smoothing(t){this.threshold>0||t>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=t}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(t){this.smoothing=t}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(t){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(t){t?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(t){return this.colorOutput}setColorOutputEnabled(t){this.colorOutput=t}get useRange(){return null!==this.luminanceRange}set useRange(t){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(t){null!==t?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=t,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(t){this.luminanceRange=t}},yO=0,xO=1,bO=class extends vn{constructor(t=null){super({name:"MaskMaterial",uniforms:{maskTexture:new $l(t),inputBuffer:new $l(null),strength:new $l(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\n#ifdef MASK_PRECISION_HIGH\nuniform mediump sampler2D maskTexture;\n#else\nuniform lowp sampler2D maskTexture;\n#endif\n#if MASK_FUNCTION != 0\nuniform float strength;\n#endif\nvarying vec2 vUv;void main(){\n#if COLOR_CHANNEL == 0\nfloat mask=texture2D(maskTexture,vUv).r;\n#elif COLOR_CHANNEL == 1\nfloat mask=texture2D(maskTexture,vUv).g;\n#elif COLOR_CHANNEL == 2\nfloat mask=texture2D(maskTexture,vUv).b;\n#else\nfloat mask=texture2D(maskTexture,vUv).a;\n#endif\n#if MASK_FUNCTION == 0\n#ifdef INVERTED\nmask=step(mask,0.0);\n#else\nmask=1.0-step(mask,0.0);\n#endif\n#else\nmask=clamp(mask*strength,0.0,1.0);\n#ifdef INVERTED\nmask=1.0-mask;\n#endif\n#endif\n#if MASK_FUNCTION == 2\ngl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);\n#else\ngl_FragColor=mask*texture2D(inputBuffer,vUv);\n#endif\n}",vertexShader:rO}),this.toneMapped=!1,this.setColorChannel(iO),this.setMaskFunction(yO)}set inputBuffer(t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}set maskTexture(t){this.uniforms.maskTexture.value=t,delete this.defines.MASK_PRECISION_HIGH,t.type!==J&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(t){this.maskTexture=t}set colorChannel(t){this.defines.COLOR_CHANNEL=t.toFixed(0),this.needsUpdate=!0}setColorChannel(t){this.colorChannel=t}set maskFunction(t){this.defines.MASK_FUNCTION=t.toFixed(0),this.needsUpdate=!0}setMaskFunction(t){this.maskFunction=t}get inverted(){return void 0!==this.defines.INVERTED}set inverted(t){this.inverted&&!t?delete this.defines.INVERTED:t&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(t){this.inverted=t}get strength(){return this.uniforms.strength.value}set strength(t){this.uniforms.strength.value=t}getStrength(){return this.strength}setStrength(t){this.strength=t}},wO=class extends vn{constructor(t=new Ht,e=new Ht){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 $l(null),searchTexture:new $l(null),areaTexture:new $l(null),resolution:new $l(e),texelSize:new $l(t)},blending:0
vendor: 8,306 bytes, line 2
2,depthWrite:!1,depthTest:!1,fragmentShader:"#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)\n#if __VERSION__ < 300\n#define round(v) floor(v + 0.5)\n#endif\n#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D inputBuffer;\n#else\nuniform lowp sampler2D inputBuffer;\n#endif\nuniform 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){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 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);\n#endif\n}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){\n#if !defined(DISABLE_CORNER_DETECTION)\nvec2 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);\n#endif\n}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){\n#if !defined(DISABLE_DIAG_DETECTION)\nweights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){\n#endif\nvec2 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);\n#if !defined(DISABLE_DIAG_DETECTION)\n}else{e.r=0.0;}\n#endif\n}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;}",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(
vendor: 15,726 bytes, line 2
2t){this.uniforms.inputBuffer.value=t}setInputBuffer(t){this.uniforms.inputBuffer.value=t}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(t){this.uniforms.searchTexture.value=t}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(t){this.uniforms.areaTexture.value=t}setLookupTextures(t,e){this.searchTexture=t,this.areaTexture=e}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(t){let e=Math.min(Math.max(t,0),112);this.defines.MAX_SEARCH_STEPS_INT=e.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=e.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(t){this.orthogonalSearchSteps=t}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(t){let e=Math.min(Math.max(t,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=e.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=e.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(t){this.diagonalSearchSteps=t}get diagonalDetection(){return void 0===this.defines.DISABLE_DIAG_DETECTION}set diagonalDetection(t){t?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(t){this.diagonalDetection=t}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(t){let e=Math.min(Math.max(t,0),100);this.defines.CORNER_ROUNDING=e.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(e/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(t){this.cornerRounding=t}get cornerDetection(){return void 0===this.defines.DISABLE_CORNER_DETECTION}set cornerDetection(t){t?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(t){this.cornerDetection=t}setSize(t,e){let i=this.uniforms;i.texelSize.value.set(1/t,1/e),i.resolution.value.set(t,e)}},SO=new yn,_O=null;var AO=class{constructor(t="Pass",e=new da,i=SO){this.name=t,this.renderer=null,this.scene=e,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(t){if(this.rtt===t){let e=this.getFullscreenMaterial();null!==e&&(e.needsUpdate=!0),this.rtt=!t}}setRenderer(t){this.renderer=t}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let e=this.screen;null!==e?e.material=t:(e=new cn(function(){if(null===_O){let t=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]);void 0!==(_O=new Qi).setAttribute?(_O.setAttribute("position",new Ni(t,3)),_O.setAttribute("uv",new Ni(e,2))):(_O.addAttribute("position",new Ni(t,3)),_O.addAttribute("uv",new Ni(e,2)))}return _O}(),t),e.frustumCulled=!1,null===this.scene&&(this.scene=new da),this.scene.add(e),this.screen=e)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(t){this.fullscreenMaterial=t}getDepthTexture(){return null}setDepthTexture(t,e=_t){}render(t,e,i,n,r){throw new Error("Render method not implemented!")}setSize(t,e){}initialize(t,e,i){}dispose(){for(let t of Object.keys(this)){let e=this[t];if(null!==e&&"object"==typeof e&&"function"==typeof e.dispose){if(e instanceof da||e===this.renderer)continue;this[t].dispose()}}}},MO=class extends AO{constructor(t,e=!0){super("CopyPass"),this.fullscreenMaterial=new cO,this.needsSwap=!1,this.renderTarget=t,void 0===t&&(this.renderTarget=new ge(1,1,{minFilter:Q,magFilter:Q,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(t){this.autoResize=t}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(t){this.autoResize=t}render(t,e,i,n,r){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){this.autoResize&&this.renderTarget.setSize(t,e)}initialize(t,e,i){void 0!==i&&(this.renderTarget.texture.type=i,i!==J?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":t.outputEncoding===St&&(this.renderTarget.texture.encoding=St))}},CO=class extends AO{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(t,e,i,n,r){let s=t.state.buffers.stencil;s.setLocked(!1),s.setTest(!1)}},EO=new le,PO=class extends AO{constructor(t=!0,e=!0,i=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=t,this.depth=e,this.stencil=i,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(t,e,i){this.color=t,this.depth=e,this.stencil=i}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(t){this.overrideClearColor=t}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(t){this.overrideClearAlpha=t}render(t,e,i,n,r){let s=this.overrideClearColor,a=this.overrideClearAlpha,o=t.getClearAlpha(),l=null!==s,h=a>=0;l?(EO.copy(t.getClearColor(EO)),t.setClearColor(s,h?a:o)):h&&t.setClearAlpha(a),t.setRenderTarget(this.renderToScreen?null:e),t.clear(this.color,this.depth,this.stencil),l?t.setClearColor(EO,o):h&&t.setClearAlpha(o)}},TO=-1,DO=class extends Dt{constructor(t,e=-1,i=-1,n=1){super(),this.resizable=t,this.base=new Ht(1,1),this.preferred=new Ht(e,i),this.target=this.preferred,this.s=n}get width(){let t,{base:e,preferred:i,scale:n}=this;return t=i.width!==TO?i.width:i.height!==TO?Math.round(i.height*(e.width/Math.max(e.height,1))):Math.round(e.width*n),t}set width(t){this.preferredWidth=t}get height(){let t,{base:e,preferred:i,scale:n}=this;return t=i.height!==TO?i.height:i.width!==TO?Math.round(i.width/Math.max(e.width/Math.max(e.height,1),1)):Math.round(e.height*n),t}set height(t){this.preferredHeight=t}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(t){this.s!==t&&(this.s=t,this.preferred.setScalar(TO),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getScale(){return this.scale}setScale(t){this.scale=t}get baseWidth(){return this.base.width}set baseWidth(t){this.base.width!==t&&(this.base.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseWidth(){return this.base.width}setBaseWidth(t){this.base.width!==t&&(this.base.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get baseHeight(){return this.base.height}set baseHeight(t){this.base.height!==t&&(this.base.height=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(t){this.baseHeight=t}setBaseSize(t,e){(this.base.width!==t||this.base.height!==e)&&(this.base.set(t,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get preferredWidth(){return this.preferred.width}set preferredWidth(t){this.preferred.width!==t&&(this.preferred.width=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(t){this.preferredWidth=t}get preferredHeight(){return this.preferred.height}set preferredHeight(t){this.preferred.height!==t&&(this.preferred.height=t,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(t){this.preferredHeight=t}setPreferredSize(t,e){(this.preferred.width!==t||this.preferred.height!==e)&&(this.preferred.set(t,e),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}copy(t){this.base.set(t.getBaseWidth(),t.getBaseHeight()),this.preferred.set(t.getPreferredWidth(),t.getPreferredHeight()),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height)}static get AUTO_SIZE(){return TO}},IO=!1,OO=class{constructor(t=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(t),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let e;if(t.material.flatShading)switch(t.material.side){case 2:e=this.materialsFlatShadedDoubleSide;break;case 1:e=this.materialsFlatShadedBackSide;break;default:e=this.materialsFlatShaded}else switch(t.material.side){case 2:e=this.materialsDoubleSide;break;case 1:e=this.materialsBackSide;break;default:e=this.materials}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=e[2]:t.isInstancedMesh?t.material=e[1]:t.material=e[0],++this.meshCount}}}setMaterial(t){if(this.disposeMaterials(),this.material=t,null!==t){let e=this.materials=[t.clone(),t.clone(),t.clone()];for(let i of e)i.uniforms=Object.assign({},t.uniforms),i.side=0;e[2].skinning=!0,this.materialsBackSide=e.map(e=>{let i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.side=1,i}),this.materialsDoubleSide=e.map(e=>{let i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.side=2,i}),this.materialsFlatShaded=e.map(e=>{let i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=e.map(e=>{let i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.flatShading=!0,i.side=1,i}),this.materialsFlatShadedDoubleSide=e.map(e=>{let i=e.clone();return i.uniforms=Object.assign({},t.uniforms),i.flatShading=!0,i.side=2,i})}}render(t,e,i){let n=t.shadowMap.enabled;if(t.shadowMap.enabled=!1,IO){let n=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),t.render(e,i);for(let t of n)t[0].material=t[1];this.meshCount!==n.size&&n.clear()}else{let n=e.overrideMaterial;e.overrideMaterial=this.material,t.render(e,i),e.overrideMaterial=n}t.shadowMap.enabled=n}disposeMaterials(){if(null!==this.material){let t=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(let e of t)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return IO}static set workaroundEnabled(t){IO=t}},RO=class extends AO{constructor(t,e,i=null){super("RenderPass",t,e),this.needsSwap=!1,this.clearPass=new PO,this.overrideMaterialManager=null===i?null:new OO(i),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}get renderToScreen(){return super.renderToScreen}set renderToScreen(t){super.renderToScreen=t,this.clearPass.renderToScreen=t}get overrideMaterial(){let t=this.overrideMaterialManager;return null!==t?t.material:null}set overrideMaterial(t){let e=this.overrideMaterialManager;null!==t?null!==e?e.setMaterial(t):this.overrideMaterialManager=new OO(t):null!==e&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(t){this.overrideMaterial=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getSelection(){return this.selection}setSelection(t){this.selection=t}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(t){this.ignoreBackground=t}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(t){this.skipShadowMapUpdate=t}getClearPass(){return this.clearPass}render(t,e,i,n,r){let s=this.scene,a=this.camera,o=this.selection,l=a.layers.mask,h=s.background,c=t.shadowMap.autoUpdate,d=this.renderToScreen?null:e;null!==o&&a.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(t.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(s.background=null),this.clearPass.enabled&&this.clearPass.render(t,e),t.setRenderTarget(d),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(t,s,a):t.render(s,a),a.layers.mask=l,s.background=h,t.shadowMap.autoUpdate=c}},LO=class extends AO{constructor(t,e,{resolutionScale:i=1,width:n=DO.AUTO_SIZE,height:r=DO.AUTO_SIZE,renderTarget:s}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new RO(t,e,new Qs({depthPacking:3201}));let a=this.renderPass;a.skipShadowMapUpdate=!0,a.ignoreBackground=!0;let o=a.getClearPass();o.overrideClearColor=new le(16777215),o.overrideClearAlpha=1,this.renderTarget=s,void 0===this.renderTarget&&(this.renderTarget=new ge(1,1,{minFilter:q,magFilter:q,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let l=this.resolution=new DO(this,n,r,i);l.addEventListener("change",t=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,i,n,r){let s=this.renderToScreen?null:this.renderTarget;this.renderPass.render(t,s)}setSize(t,e){let i=this.resolution;i.setBaseSize(t,e),this.renderTarget.setSize(i.width,i.height)}},BO={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},zO=new Map([[BO.SKIP,null],[BO.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);}"],[BO.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));}"],[BO.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);}"],[BO.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);}"],[BO.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);}"],[BO.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[BO.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[BO.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);}"],[BO.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[BO.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[BO.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);}"],[BO.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);}"],[BO.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*
2opacity+x*(1.0-opacity);}"],[BO.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);}"],[BO.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);}"],[BO.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);}"],[BO.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);}"],[BO.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);}"]]),FO=class extends Dt{constructor(t,e=1){super(),this.f=t,this.opacity=new $l(e)}getOpacity(){return this.opacity.value}setOpacity(t){this.opacity.value=t}get blendFunction(){return this.f}set blendFunction(t){this.f=t,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(t){this.blendFunction=t}getShaderCode(){return zO.get(this.blendFunction)}},NO=0,UO=1,kO=2,VO=class extends Dt{constructor(t,e,{attributes:i=NO,blendFunction:n=BO.SCREEN,defines:r=new Map,uniforms:s=new Map,extensions:a=null,vertexShader:o=null}={}){super(),this.name=t,this.renderer=null,this.attributes=i,this.fragmentShader=e,this.vertexShader=o,this.defines=r,this.uniforms=s,this.extensions=a,this.blendMode=new FO(n),this.blendMode.addEventListener("change",t=>this.setChanged())}getName(){return this.name}setRenderer(t){this.renderer=t}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(t){this.attributes=t,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(t){this.fragmentShader=t,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(t){this.vertexShader=t,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(t,e=_t){}update(t,e,i){}setSize(t,e){}initialize(t,e,i){}dispose(){for(let t of Object.keys(this)){let e=this[t];if(null!==e&&"object"==typeof e&&"function"==typeof e.dispose){if(e instanceof da||e===this.renderer)continue;this[t].dispose()}}}};function jO(t,e,i){for(let n of e){let e="$1"+t+n.charAt(0).toUpperCase()+n.slice(1),r=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(let t of i.entries())null!==t[1]&&i.set(t[0],t[1].replace(r,e))}}function GO(t,e,i,n,r,s,a){let o=new Map([["fragment",e.getFragmentShader()],["vertex",e.getVertexShader()]]),l=void 0!==o.get("fragment")&&/mainImage/.test(o.get("fragment")),h=void 0!==o.get("fragment")&&/mainUv/.test(o.get("fragment")),c=[],d=[],u=!1,p=!1;if(void 0===o.get("fragment"));else if(h&&0!==(a&kO));else if(l||h){let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=gO.Section;if(h){let e=`\t${t}MainUv(UV);\n`;i.set(m.FRAGMENT_MAIN_UV,i.get(m.FRAGMENT_MAIN_UV)+e),u=!0}if(null!==o.get("vertex")&&/mainSupport/.test(o.get("vertex"))){let e=`\t${t}MainSupport(`;e+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(o.get("vertex"))?"vUv);\n":");\n",i.set(m.VERTEX_MAIN_SUPPORT,i.get(m.VERTEX_MAIN_SUPPORT)+e),c=c.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(t=>t[1])),d=d.concat(c).concat([...o.get("vertex").matchAll(f)].map(t=>t[1]))}d=d.concat([...o.get("fragment").matchAll(f)].map(t=>t[1])),d=d.concat([...e.defines.keys()].map(t=>t.replace(/\([\w\s,]*\)/g,""))),d=d.concat([...e.uniforms.keys()]),e.uniforms.forEac
vendor: 13,937 bytes, line 2
2h((e,i)=>s.set(t+i.charAt(0).toUpperCase()+i.slice(1),e)),e.defines.forEach((e,i)=>r.set(t+i.charAt(0).toUpperCase()+i.slice(1),e)),jO(t,d,r),jO(t,d,o);let g=e.blendMode;if(n.set(g.blendFunction,g),l){let e=`${t}MainImage(color0, UV, `;0!==(a&UO)&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(o.get("fragment"))&&(e+="depth, ",p=!0),e+="color1);\n\t";let n=t+"BlendOpacity";s.set(n,g.opacity),e+=`color0 = blend${g.blendFunction}(color0, color1, ${n});\n\n\t`,i.set(m.FRAGMENT_MAIN_IMAGE,i.get(m.FRAGMENT_MAIN_IMAGE)+e),e=`uniform float ${n};\n\n`,i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+e)}i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+o.get("fragment")+"\n"),null!==o.get("vertex")&&i.set(m.VERTEX_HEAD,i.get(m.VERTEX_HEAD)+o.get("vertex")+"\n")}else;return{varyings:c,transformedUv:u,readDepth:p}}var WO=class extends AO{constructor(t,...e){super("EffectPass"),this.fullscreenMaterial=new gO(null,null,null,t),this.effects=e.sort((t,e)=>e.attributes-t.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(t){this.fullscreenMaterial.encodeOutput=t}get dithering(){return this.fullscreenMaterial.dithering}set dithering(t){let e=this.fullscreenMaterial;e.dithering=t,e.needsUpdate=!0}verifyResources(){let t=this.renderer.capabilities,e=Math.min(t.maxFragmentUniforms,t.maxVertexUniforms);this.uniformCount,e=t.maxVaryings,this.varyingCount}updateMaterial(){let t=gO.Section,e=new Map([[t.FRAGMENT_HEAD,""],[t.FRAGMENT_MAIN_UV,""],[t.FRAGMENT_MAIN_IMAGE,""],[t.VERTEX_HEAD,""],[t.VERTEX_MAIN_SUPPORT,""]]),i=new Map,n=new Map,r=new Map,s=new Set,a=0,o=0,l=0,h=!1,c=!1;for(let u of this.effects)if(u.blendMode.blendFunction===BO.SKIP)l|=u.getAttributes()&UO;else if(0!==(l&u.getAttributes()&kO));else{l|=u.getAttributes();let t=GO("e"+a++,u,e,i,n,r,l);if(o+=t.varyings.length,h=h||t.transformedUv,c=c||t.readDepth,null!==u.extensions)for(let e of u.extensions)s.add(e)}let d=/\bblend\b/g;for(let u of i.values()){let i=u.getShaderCode().replace(d,`blend${u.blendFunction}`);e.set(t.FRAGMENT_HEAD,e.get(t.FRAGMENT_HEAD)+i+"\n")}if(0!==(l&UO)){if(c){let i="float depth = readDepth(UV);\n\n\t";e.set(t.FRAGMENT_MAIN_IMAGE,i+e.get(t.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=null===this.getDepthTexture()}else this.needsDepthTexture=!1;if(h){let i="vec2 transformedUv = vUv;\n";e.set(t.FRAGMENT_MAIN_UV,i+e.get(t.FRAGMENT_MAIN_UV)),n.set("UV","transformedUv")}else n.set("UV","vUv");e.forEach((t,e,i)=>i.set(e,t.trim().replace(/^#/,"\n#"))),this.uniformCount=r.size,this.varyingCount=o,this.skipRendering=0===a,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(e).setExtensions(s).setUniforms(r).setDefines(n)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(t,e=_t){this.fullscreenMaterial.depthBuffer=t,this.fullscreenMaterial.depthPacking=e;for(let i of this.effects)i.setDepthTexture(t,e)}render(t,e,i,n,r){for(let s of this.effects)s.update(t,e,n);if(!this.skipRendering||this.renderToScreen){let r=this.fullscreenMaterial;r.inputBuffer=e.texture,r.time+=n,t.setRenderTarget(this.renderToScreen?null:i),t.render(this.scene,this.camera)}}setSize(t,e){this.fullscreenMaterial.setSize(t,e);for(let i of this.effects)i.setSize(t,e)}initialize(t,e,i){this.renderer=t;for(let n of this.effects)n.initialize(t,e,i),n.addEventListener("change",t=>this.handleEvent(t));this.updateMaterial(),this.verifyResources(),void 0!==i&&i!==J&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let t of this.effects)t.dispose()}handleEvent(t){if("change"===t.type)this.recompile()}},HO=[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])],qO=class extends AO{constructor({resolutionScale:t=.5,width:e=DO.AUTO_SIZE,height:i=DO.AUTO_SIZE,kernelSize:n=JO.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new ge(1,1,{minFilter:Q,magFilter:Q,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let r=this.resolution=new DO(this,e,i,t);r.addEventListener("change",t=>this.setSize(r.baseWidth,r.baseHeight)),this.blurMaterial=new hO,this.ditheredBlurMaterial=new hO,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=n}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get scale(){return this.blurMaterial.scale}set scale(t){this.blurMaterial.scale=t}getScale(){return this.blurMaterial.scale}setScale(t){this.blurMaterial.scale=t}getKernelSize(){return this.kernelSize}setKernelSize(t){this.kernelSize=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}render(t,e,i,n,r){let s,a,o=this.scene,l=this.camera,h=this.renderTargetA,c=this.renderTargetB,d=HO[this.kernelSize],u=this.blurMaterial,p=e;for(this.fullscreenMaterial=u,s=0,a=d.length-1;s<a;++s){let e=1&s?c:h;u.kernel=d[s],u.inputBuffer=p.texture,t.setRenderTarget(e),t.render(o,l),p=e}this.dithering&&(u=this.ditheredBlurMaterial,this.fullscreenMaterial=u),u.kernel=d[s],u.inputBuffer=p.texture,t.setRenderTarget(this.renderToScreen?null:i),t.render(o,l)}setSize(t,e){let i=this.resolution;i.setBaseSize(t,e);let n=i.width,r=i.height;this.renderTargetA.setSize(n,r),this.renderTargetB.setSize(n,r),this.blurMaterial.setSize(n,r),this.ditheredBlurMaterial.setSize(n,r)}initialize(t,e,i){void 0!==i&&(this.renderTargetA.texture.type=i,this.renderTargetB.texture.type=i,i!==J?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):t.outputEncoding===St&&(this.renderTargetA.texture.encoding=St,this.renderTargetB.texture.encoding=St))}static get AUTO_SIZE(){return DO.AUTO_SIZE}},XO=class extends AO{constructor({width:t=DO.AUTO_SIZE,height:e=DO.AUTO_SIZE,renderTarget:i,luminanceRange:n,colorOutput:r}={}){super("LuminancePass"),this.fullscreenMaterial=new vO(r,n),this.needsSwap=!1,this.renderTarget=i,void 0===this.renderTarget&&(this.renderTarget=new ge(1,1,{minFilter:Q,magFilter:Q,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let s=this.resolution=new DO(this,t,e);s.addEventListener("change",t=>this.setSize(s.baseWidth,s.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(t,e,i,n,r){this.fullscreenMaterial.inputBuffer=e.texture,t.setRenderTarget(this.renderToScreen?null:this.renderTarget),t.render(this.scene,this.camera)}setSize(t,e){let i=this.resolution;i.setBaseSize(t,e),this.renderTarget.setSize(i.width,i.height)}initialize(t,e,i){void 0!==i&&i!==J&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},YO=class extends AO{constructor(t,e){super("MaskPass",t,e),this.needsSwap=!1,this.clearPass=new PO(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(t){this.inverse=t}get clear(){return this.clearPass.enabled}set clear(t){this.clearPass.enabled=t}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(t){this.inverted=t}render(t,e,i,n,r){let s=t.getContext(),a=t.state.buffers,o=this.scene,l=this.camera,h=this.clearPass,c=this.inverted?0:1,d=1-c;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),a.stencil.setFunc(s.ALWAYS,c,4294967295),a.stencil.setClear(d),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?h.render(t,null):(h.render(t,e),h.render(t,i))),this.renderToScreen?(t.setRenderTarget(null),t.render(o,l)):(t.setRenderTarget(e),t.render(o,l),t.setRenderTarget(i),t.render(o,l)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(s.EQUAL,1,4294967295),a.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),a.stencil.setLocked(!0)}},QO=class extends AO{constructor(t,e="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=t,this.inputBufferUniform=null,this.setInput(e)}setInput(t){if(this.inputBufferUniform=null,null!==this.fullscreenMaterial){let e=this.fullscreenMaterial.uniforms;void 0!==e&&void 0!==e[t]&&(this.inputBufferUniform=e[t])}}render(t,e,i,n,r){null!==this.inputBufferUniform&&null!==e&&(this.inputBufferUniform.value=e.texture),t.setRenderTarget(this.renderToScreen?null:i),t.render(this.scene,this.camera)}initialize(t,e,i){void 0!==i&&i!==J&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},ZO=.001,KO=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(t){return this.fixedDeltaEnabled=t,this}isAutoResetEnabled(t){return this.autoReset}setAutoResetEnabled(t){return typeof document<"u"&&void 0!==document.hidden&&(t?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=t),this}getDelta(){return this.delta*ZO}getFixedDelta(){return this.fixedDelta*ZO}setFixedDelta(t){return this.fixedDelta=1e3*t,this}getElapsed(){return this.elapsed*ZO}getTimescale(){return this.timescale}setTimescale(t){return this.timescale=t,this}update(t){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=void 0!==t?t: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(t){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}},JO={MEDIUM:2,LARGE:3,HUGE:5},$O=class extends VO{constructor({blendFunction:t=BO.SCREEN,luminanceThreshold:e=.9,luminanceSmoothing:i=.025,resolutionScale:n=.5,intensity:r=1,width:s=DO.AUTO_SIZE,height:a=DO.AUTO_SIZE,kernelSize:o=JO.LARGE}={}){super("BloomEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D map;\n#else\nuniform lowp sampler2D map;\n#endif\nuniform 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);}",{blendFunction:t,uniforms:new Map([["map",new $l(null)],["intensity",new $l(r)]])}),this.renderTarget=new ge(1,1,{minFilter:Q,magFilter:Q,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 XO({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothingFactor=i,this.blurPass=new qO({resolutionScale:n,width:s,height:a,kernelSize:o});let l=this.blurPass.getResolution();l.addEventListener("change",t=>this.setSize(l.baseWidth,l.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(t){this.resolution.preferredWidth=t}get height(){return this.resolution.height}set height(t){this.resolution.preferredHeight=t}get dithering(){return this.blurPass.dithering}set dithering(t){this.blurPass.dithering=t}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(t){this.blurPass.kernelSize=t}get distinction(){return 1}set distinction(t){}get intensity(){return this.uniforms.get("intensity").value}set intensity(t){this.uniforms.get("intensity").value=t}getIntensity(){return this.intensity}setIntensity(t){this.intensity=t}getResolutionScale(){return this.resolution.scale}setResolutionScale(t){this.resolution.scale=t}update(t,e,i){let n=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(t,e,n),this.blurPass.render(t,n,n)):this.blurPass.render(t,e,n)}setSize(t,e){let i=this.resolution;i.setBaseSize(t,e),this.renderTarget.setSize(i.width,i.height),this.luminancePass.resolution.copy(i)}initialize(t,e,i){this.blurPass.initialize(t,e,i),void 0!==i&&(this.renderTarget.texture.type=i,t.outputEncoding===St&&(this.renderTarget.texture.encoding=St))}},tR=class extends VO{constructor({blendFunction:t=BO.NORMAL,brightness:e=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:t,uniforms:new Map([["brightness",new $l(e)],["contrast",new $l(i)]])})}get brightness(){return this.uniforms.get("brightness").value}set brightness(t){this.uniforms.get("brightness").value=t}getBrightness(t){return this.brightness}setBrightness(t){this.brightness=t}get contrast(){return this.uniforms.get("contrast").value}set contrast(t){this.uniforms.get("contrast").value=t}getContrast(t){return this.contrast}setContrast(t){this.contrast=t}},eR=class extends VO{constructor(t=BO.NORMAL){super("ColorAverageEffe
2ct","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(vec3(average(inputColor.rgb)),inputColor.a);}",{blendFunction:t})}},iR=class extends VO{constructor({blendFunction:t=BO.NORMAL,offset:e=new Ht(.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:t,attributes:kO,uniforms:new Map([["offset",new $l(e)]])})}get offset(){return this.uniforms.get("offset").value}set offset(t){this.uniforms.get("offset").value=t}getOffset(){return this.offset}setOffset(t){this.offset=t}},nR=class extends VO{constructor(t,{blendFunction:e=BO.NORMAL,worldFocusDistance:i,worldFocusRange:n,focusDistance:r=0,focalLength:s=.1,focusRange:a=s,bokehScale:o=1,width:l=DO.AUTO_SIZE,height:h=DO.AUTO_SIZE}={}){super("DepthOfFieldEffect","#ifdef FRAMEBUFFER_PRECISION_HIGH\nuniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;\n#else\nuniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;\n#endif\nuniform 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;}",{blendFunction:e,attributes:UO,uniforms:new Map([["nearColorBuffer",new $l(null)],["farColorBuffer",new $l(null)],["nearCoCBuffer",new $l(null)],["scale",new $l(1)]])}),this.camera=t,this.renderTarget=new ge(1,1,{minFilter:Q,magFilter:Q,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 QO(new lO(t));let c=this.cocMaterial;c.focusDistance=r,c.focusRange=a,void 0!==i&&(c.worldFocusDistance=i),void 0!==n&&(c.worldFocusRange=n),this.blurPass=new qO({kernelSize:JO.MEDIUM,width:l,height:h});let d=this.blurPass.getResolution();d.addEventListener("change",t=>this.setSize(d.getBaseWidth(),d.getBaseHeight())),this.maskPass=new QO(new bO(this.renderTargetCoC.texture));let u=this.maskPass.fullscreenMaterial;u.maskFunction=xO,u.colorChannel=nO,this.bokehNearBasePass=new QO(new sO(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new QO(new sO(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new QO(new sO(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new QO(new sO(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null,this.bokehScale=o}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(t){let e=[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];for(let i of e)i.fullscreenMaterial.setScale(t);this.maskPass.fullscreenMaterial.setStrength(t),this.uniforms.get("scale").value=t}getBokehScale(){return this.bokehScale}setBokehScale(t){this.bokehScale=t}getTarget(){return this.target}setTarget(t){this.target=t}calculateFocusDistance(t){let e=this.camera;return oO(-e.position.distanceTo(t),e.near,e.far)}setDepthTexture(t,e=_t){this.circleOfConfusionMaterial.depthBuffer=t,this.circleOfConfusionMaterial.depthPacking=e}update(t,e,i){let n=this.renderTarget,r=this.renderTargetCoC,s=this.renderTargetCoCBlurred,a=this.renderTargetMasked;if(null!==this.target){let t=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=t}this.cocPass.render(t,null,r),this.blurPass.render(t,r,s),this.maskPass.render(t,e,a),this.bokehFarBasePass.render(t,a,n),this.bokehFarFillPass.render(t,n,this.renderTargetFar),this.bokehNearBasePass.render(t,e,n),this.bokehNearFillPass.render(t,n,this.renderTargetNear)}setSize(t,e){let i=this.resolution;i.setBaseSize(t,e);let n=i.width,r=i.height,s=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];
vendor: 3,677 bytes, line 2
2s.push(this.renderTargetCoC,this.renderTargetMasked),s.forEach(i=>i.setSize(t,e)),s=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred],s.forEach(t=>t.setSize(n,r)),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(t=>t.fullscreenMaterial.setSize(n,r))}initialize(t,e,i){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(n=>n.initialize(t,e,i)),this.blurPass.initialize(t,e,J),void 0!==i&&(this.renderTarget.texture.type=i,this.renderTargetNear.texture.type=i,this.renderTargetFar.texture.type=i,this.renderTargetMasked.texture.type=i,t.outputEncoding===St&&(this.renderTarget.texture.encoding=St,this.renderTargetNear.texture.encoding=St,this.renderTargetFar.texture.encoding=St,this.renderTargetMasked.texture.encoding=St))}};new be,new Ze;var rR=class extends VO{constructor({blendFunction:t=BO.NORMAL,hue:e=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:t,uniforms:new Map([["hue",new $l(new be)],["saturation",new $l(i)]])}),this.hue=e}get saturation(){return this.uniforms.get("saturation").value}set saturation(t){this.uniforms.get("saturation").value=t}getSaturation(){return this.saturation}setSaturation(t){this.saturation=t}get hue(){let t=this.uniforms.get("hue").value;return Math.acos((3*t.x-1)/2)}set hue(t){let e=Math.sin(t),i=Math.cos(t);this.uniforms.get("hue").value.set((2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3)}getHue(){return this.hue}setHue(t){this.hue=t}};new le;var sR=class extends VO{constructor({blendFunction:t=BO.SCREEN,premultiply:e=!1}={}){super("NoiseEffect","void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time));\n#ifdef PREMULTIPLY\noutputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);\n#else\noutputColor=vec4(noise,inputColor.a);\n#endif\n}",{blendFunction:t}),this.premultiply=e}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(t){this.premultiply!==t&&(t?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}isPremultiplied(){return this.premultiply}setPremultiplied(t){this.premultiply=t}},aR=class extends VO{constructor(t=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 $l(!1)],["d",new $l(new Ht)]])}),this.resolution=new Ht,this.d=0,this.granularity=t}get granularity(){return this.d}set granularity(t){let e=Math.floor(t);e%2>0&&(e+=1),this.d=e,this.uniforms.get("active").value=e>0,this.setSize(this.resolution.width,this.resolution.height)}getGranularity(){return this.granularity}setGranularity(t){this.granularity=t}setSize(t,e){this.resolution.set(t,e),this.uniforms.get("d").value.setScalar(this.d).divide(this.resolution)}};new be,new be;var oR="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",lR
vendor: 6,469 bytes, line 2
2="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+DfAHzTxcVgWBroqMN8+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
vendor: 60,312 bytes, line 2
2R101AlZSUtGyfgZDkCWY1HnJdcBVe6325hTvelg2CQjZNDygG/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/OVksDgImgGgghHoYJbTWc7oJtFWc65/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/8b3VWaPIDZqsRV64DALsZHVHs1gEvsqFAeBSApQC8pHK90Oql4UEAyvCwNeGcBXNLOPMLftgZsI75ouUr9ousp2TEyIJ/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/WwjAj3jtFJZkU79g1ghkgEBf98+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/H3Zhk6+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+h9F6ugJDkC3gJPBEvRGrYoYCBX9IxEcS5K4i6cZAHIw8oXQ4mLBb35YH5d7OekadtTV1UZSjaEIPH4nQzYNwgjAHNwDuWGYpZc7lzPfX1cQur5oBorfzDf+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/mIBct63NhFZwEzDsBFgpDPeanNgATfCtGsX9TIKwNrg9tuVkhlng7TI/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/vL45Ff3vhpcAnvwos8d48DZX3M2hx9XIAnu0IIO0chu35AOgLL0yuG/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/9w9ADiICULrQRWuIB6w7nuZrwaZwLBGwClSqSyz3AhHbaRGEFGOmC44D72UVgjW2C2Z4lIF4ArjodODQcqUGqAxfcpG4mJVuVqcL5tbs2z/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/qWzQDgfAFAWyzR8rkFtDAKX75jo6nUguZxZ8NByHbvvqBQ36T1swcsBaBAGGRg40Ir+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+1DkMz1JIhR1BAHJ7zwqO3fIRRM5tmDK5CoQKsSgOeBYBKFZULTqcB9r6Ni5KYmd3WKDUA0BlhNLM8EbT1QBXBU72aI5ZjUcVOxz7WLkQ8d37vsart/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/x58zLzfw6Qf3ABd8pUgEYmqk5bGyek06IQl1bkXScnlN/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+KaIbaadYpem4aDgpJZQz6YJABV5VcHAJZ0v4FxX6KG5UpYs0KnqjhRuagEVgPglYAl9ciHf8mdUrJh0Qx9vkDBzBywfbkYQIGwahA/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/EJ9zGvqrxOPibiVihAOgrWQOf/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/DTAwD7zQeM52dqj8VsGEkVE2jKetG7AEhQ0frJAv6RC0trC1skl+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+2X2ifBRn9A8mKcW2UFjULVQcgVDl80u40SYh763FfvquhLCxitoBYUsoJfjXKttByMq9CKcHn4sPuCbgXNJwyWkECcz5Q376UX3LNncZyQAAADEklEQVT9fFgIJs6lBBwtn3Tt6FpIz4RWnuQxPh2XIGzm4CwQ9hWIFgBTK0gQHiIAJddKq0ELQh+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"
vendor: 3,069 bytes, line 2
2,hR=0,cR=1,dR=2,uR=3,pR=class extends VO{constructor({preset:t=cR,edgeDetectionMode:e=dO,predicationMode:i=uO}={}){let n,r;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:BO.NORMAL,attributes:kO|UO,uniforms:new Map([["weightMap",new $l(null)]])}),arguments.length>1&&(n=arguments[0],r=arguments[1],arguments.length>2&&(t=arguments[2]),arguments.length>3&&(e=arguments[3])),this.renderTargetEdges=new ge(1,1,{minFilter:Q,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 PO(!0,!1,!1),this.clearPass.overrideClearColor=new le(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new QO(new pO),this.edgeDetectionMaterial.edgeDetectionMode=e,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new QO(new wO);let s=new dl;s.onLoad=()=>{let t=new fe(n);t.name="SMAA.Search",t.magFilter=q,t.minFilter=q,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!0,this.weightsMaterial.searchTexture=t;let e=new fe(r);e.name="SMAA.Area",e.magFilter=Q,e.minFilter=Q,e.generateMipmaps=!1,e.needsUpdate=!0,e.flipY=!1,this.weightsMaterial.areaTexture=e,this.dispatchEvent({type:"load"})},s.itemStart("search"),s.itemStart("area"),void 0!==n&&void 0!==r?(s.itemEnd("search"),s.itemEnd("area")):typeof Image<"u"&&(n=new Image,r=new Image,n.addEventListener("load",()=>s.itemEnd("search")),r.addEventListener("load",()=>s.itemEnd("area")),n.src=oR,r.src=lR),this.applyPreset(t)}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}
2get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(t){this.edgeDetectionMaterial.edgeDetectionThreshold=t}setOrthogonalSearchSteps(t){this.weightsMaterial.orthogonalSearchSteps=t}applyPreset(t){let e=this.edgeDetectionMaterial,i=this.weightsMaterial;switch(t){case hR:e.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case cR:e.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case dR:e.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case uR:e.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0}}setDepthTexture(t,e=_t){this.edgeDetectionMaterial.depthBuffer=t,this.edgeDetectionMaterial.depthPacking=e}update(t,e,i){this.clearPass.render(t,this.renderTargetEdges),this.edgeDetectionPass.render(t,e,this.renderTargetEdges),this.weightsPass.render(t,this.renderTargetEdges,this.renderTargetWeights)}setSize(t,e){this.edgeDetectionMaterial.setSize(t,e),this.weightsMaterial.setSize(t,e),this.renderTargetEdges.setSize(t,e),this.renderTargetWeights.setSize(t,e)}dispose(){let{searchTexture:t,areaTexture:e}=this.weightsMaterial;null!==t&&null!==e&&(t.dispose(),e.dispose()),super.dispose()}static get searchImageDataURL(){return oR}static get areaImageDataURL(){return lR}},fR=0,mR=1,gR=class extends VO{constructor({blendFunction:t=BO.NORMAL,technique:e=fR,eskil:i=!1,offset:n=.5,darkness:r=.5}={}){super("VignetteEffect","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;\n#if VIGNETTE_TECHNIQUE == 0\nfloat d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));\n#else\nvec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));\n#endif\noutputColor=vec4(color,inputColor.a);}",{blendFunction:t,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new $l(n)],["darkness",new $l(r)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(t){this.technique!==t&&(this.defines.set("VIGNETTE_TECHNIQUE",t.toFixed(0)),this.setChanged())}get eskil(){return this.technique===mR}set eskil(t){this.technique=t?mR:fR}getTechnique(){return this.technique}setTechnique(t){this.technique=t}get offset(){return this.uniforms.get("offset").value}set offset(t){this.uniforms.get("offset").value=t}getOffset(){return this.offset}setOffset(t){this.offset=t}get darkness(){return this.uniforms.get("darkness").value}set darkness(t){this.uniforms.get("darkness").value=t}getDarkness(){return this.darkness}setDarkness(t){this.darkness=t}},vR=class{constructor(t,e){this.enabled=!1,this.effect=new t(e),Object.defineProperty(this,"opacity",{enumerable:!0,set(t){this.effect.blendMode.opacity.value=t},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(t){this.effect.blendMode.setBlendFunction(Number(t))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=BO.NORMAL}},yR=class extends vR{constructor(){super($O),this.blendFunction=BO.SCREEN}set intensity(t){this.effect.intensity=t}get intensity(){return this.effect.intensity}set luminanceThreshold(t){this.effect.luminanceMaterial.threshold=t}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(t){this.effect.luminanceMaterial.smoothing=t}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(t){this.effect.blurPass.scale=t}get blurScale(){return this.effect.blurPass.scale}set kernelSize(t){this.effect.blurPass.kernelSize=t}get kernelSize(){return this.effect.blurPass.kernelSize}},xR=class extends vR{constructor(){super(tR)}set contrast(t){this.effect.uniforms.get("contrast").value=t}
2get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(t){this.effect.uniforms.get("brightness").value=t}get brightness(){return this.effect.uniforms.get("brightness").value}},bR=class extends vR{constructor(){super(iR),this.effect.offset=new Ht(.01,.01)}set offset(t){this.effect.offset.set(t[0]/1e3,t[1]/1e3)}get offset(){return[1e3*this.effect.offset.x,1e3*this.effect.offset.y]}},wR=class extends vR{constructor(){super(eR)}},SR=class extends vR{constructor(){super(rR),this._hue=0}set hue(t){this._hue=t,this.effect.setHue(t)}get hue(){return this._hue}set saturation(t){this.effect.uniforms.get("saturation").value=t}get saturation(){return this.effect.uniforms.get("saturation").value}},_R=class extends vR{constructor(){super(sR),this.blendFunction=BO.OVERLAY}},AR=class extends vR{constructor(){super(gR)}get eskil(){return this.effect.eskil}set eskil(t){this.effect.eskil=t}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(t){this.effect.uniforms.get("darkness").value=t}get offset(){return this.effect.uniforms.get("offset").value}set offset(t){this.effect.uniforms.get("offset").value=t}},MR=class extends vR{constructor(t){super(nR)}set focalLength(t){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=t/2e3}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(t){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=this.isPerspectiveCamera?t/2e3:(t+992)/2e3}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(t){this.effect.bokehScale=t}setCamera(t){let e=!1;(t.isPerspectiveCamera&&!1===this.isPerspectiveCamera||!t.isPerspectiveCamera&&!0===this.isPerspectiveCamera)&&(e=!0),t.isPerspectiveCamera?(this.effect.circleOfConfusionMaterial.adoptCameraSettings(t.perspCamera),this.isPerspectiveCamera=!0):(this.effect.circleOfConfusionMaterial.adoptCameraSettings(t),this.isPerspectiveCamera=!1),e&&this.effect.setChanged()}},CR=class extends vR{constructor(){super(aR)}get granularity(){return this.effect.getGranularity()}set granularity(t){this.effect.setGranularity(t)}},ER=class extends vn{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new $l(null)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:"#define GLSLIFY 1\nvarying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}",fragmentShader:"#define GLSLIFY 1\nlayout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}"})}set inputBuffer(t){this.uniforms.inputBuffer.value=t}},PR=class extends AO{constructor(){super("TAAResolvePass"),this.MRTCompatible=!0,this.needsSwap=!1,this.passThroughMaterial=new ER,this.resolutionVector=new Ht,this.resolveMaterial=new vn({name:"TAAResolveMaterial",uniforms:{inputBuffer:new $l(null),historyBuffer:new $l(null),velocityBuffer:new $l(null),depthBuffer:new $l(null),resolution:new $l(new Ht)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:"#define GLSLIFY 1\nvarying 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);}",fragmentShader:"#define GLSLIFY 1\n#include <common>\nvarying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution;\n#define USE_YCOCG\n#define USE_CATMULL_ROM\nconst float feedback_min=0.5;const float feedback_max=0.95;
2vec3 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){\n#ifdef USE_YCOCG\nvec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a);\n#else\nreturn texture(tex,uv);\n#endif\n}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(){\n#ifdef CHOOSE_LONGEST_MOTION_VECTOR\nfloat 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;\n#else\nfloat 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;\n#endif\n}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);\n#ifdef USE_CATMULL_ROM\nvec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution);\n#else\nvec4 previousColor=sample_color(historyBuffer,previousPixelPos);\n#endif\n#ifdef USE_YCOCG\npreviousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a);\n#endif\nvec4 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))))))));vec4 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);\n#ifdef USE_YCOCG\nvec2 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;\n#endif\nvec4 previousColorClipped=clamp(previousColor,cmin,cmax);\n#ifdef LUMINANCE_DIFFERENCES\n#ifdef USE_YCOCG\nfloat lum0=currentColor.r;float lum1=previousColorClipped.r;\n#else\nfloat lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb);\n#endif\nfloat 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));\n#else\nconst float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha);\n#endif\n#ifdef USE_YCOCG\ngl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a);\n#else\ngl_FragColor=result;\n#endif\n}"}),this.historyRenderTarget=new ge(1024,1024,{minFilter:Q,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new ge(1024,1024,{minFilter:Q,stencilBuffer:!1,depthBuffer:!1}),this.resultRenderTarget.texture.name="TAA.Output"}setSize(t,e){this.historyRenderTarget.setSize(t,e),this.resultRenderTarget.setSize(t,e)}render(t,e){this.fullscreenMaterial=this.resolveMaterial,this.resolveMaterial.uniforms.inputBuffer.value=e.texture[0],this.resolveMaterial.uniforms.velocityBuffer.value=e.texture[1],this.resolveMaterial.uniforms.depthBuffer.value=e.depthTexture,this.resolveMaterial.uniforms.historyBuffer.value=this.historyRenderTarget.texture,this.resolveMaterial.uniforms.resolution.value.set(e.width,e.height),t.setRenderTarget(this.resultRenderTarget),t.render(this.scene,this.camera),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,t.setRenderTarget(this.historyRenderTarget),t.render(this.scene,this.camera);let i=this.renderToScreen?null:e;this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,t.setRenderTarget(i),t.render(this.scene,this.camera)}dispose(){this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}},TR=class extends AO{constructor(t,e,i){super("TransmissionPass",void 0,e),this.MRTCompatible=!0,this.depthPass=new LO(t,e,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new ER,this.splineScene=t,this.needsSwap=!1}updatePasses(t){this.passThroughMaterial=new ER,this.depthPass=new LO(this.splineScene,this.camera,{renderTarget:t.transmissionDepthTarget})}setCamera(t){this.camera=t}setScene(t){this.splineScene=t}render(t,e,i){let n=this.camera.layers.mask,r=t;r.setRenderTarget(r.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=e.texture[0],r.clear(),r.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(t,e,i),r.shadowMap.needsUpdate=!1,r.shadowMap.autoUpdate=!1;let s=this.renderToScreen?null:e;this.camera.layers.set(3),t.setRenderTarget(s),t.render(this.splineScene,this.camera),this.camera.layers.mask=n}},DR=new da,IR=new vn({transparent:!0,vertexShader:"\n void main() {\n gl_Position = vec4(0.0);\n }\n ",fragmentShader:"\n layout(location = 1) out vec4 gVelocity;\n\n void main() {\n gl_FragColor = vec4(0.0);\n\t\t\tgVelocity = vec4(0.0);\n }\n "}),OR=class extends AO{constructor(t,e,i){super("OpaquePass",e??DR,i),this.MRTCompatible=!0,this.originalMaterials=[],this.hasTransmissionPass=!1,this.clear=!0,this.clearColorOnly=!1,this.clearDepth=!1,this.needsSwap=!1,this.MRTCompatible=t}setCamera(t){this.camera=t}setScene(t){this.scene=t??DR}getScene(){return this.scene}render(t,e){this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.length=0,this.scene.traverse(t=>{t.layers.isEnabled(3)&&t instanceof JC&&(this.originalMaterials.push([t,t.material]),t.material=IR)}),t.shadowMap.needsUpdate=!0,t.shadowMap.autoUpdate=!0),this.camera.layers.enable(8);let i=this.renderToScreen?null:e;t.setRenderTarget(i),this.clearColorOnly&&t.clear(!0,!1,!0),this.clear&&t.clear(),t.render(this.scene,this.camera),this.clearDepth&&t.clear(!1,!0,!1),this.hasTransmissionPass&&this.originalMaterials.forEac
vendor: 11,641 bytes, line 2
2h(t=>{t[0].material=t[1]})}},RR=class{constructor(t,{depthBuffer:e=!0,stencilBuffer:i=!1,multisampling:n=0,frameBufferType:r=0}={}){this.renderer=t,this.helperStartIndex=0,this.copyPass=new MO,this.depthTexture=null,this.timer=new KO,this._width=1,this._height=1,this.passes=[],this.helperPasses=[],this.autoRenderToScreen=!0,this.inputBuffer=this.createBuffer(e,i,r,n,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(e,i,r,n,!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(e,i,r,n,!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(t)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(t){let e=this.inputBuffer,i=this.multisampling;i>0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(e.depthBuffer,e.stencilBuffer,e.texture.type,t,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,null!==t){let e=t.getSize(new Ht),i=t.getContext().getContextAttributes()?.alpha??!1,n=this.inputBuffer.texture[0].type;n===J&&t.outputEncoding===St&&(this.inputBuffer.texture[0].encoding=St,this.outputBuffer.texture[0].encoding=St,this.inputBuffer.dispose(),this.outputBuffer.dispose()),t.autoClear=!1,this.setSize(e.width,e.height,!1);for(let r of this.passes)r.initialize(t,i,n)}}replaceRenderer(t,e=!0){let i=this.renderer,n=i.domElement.parentNode;return this.setRenderer(t),e&&null!==n&&(n.removeChild(i.domElement),n.appendChild(t.domElement)),i}createDepthTexture(){let t=this.depthTexture=new sa(this._width,this._height);return this.inputBuffer.depthTexture=t,this.inputBuffer.stencilBuffer?(t.format=st,t.type=it):t.type=$,t}deleteDepthTexture(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let t of this.passes)t.setDepthTexture(null)}}createBuffer(t,e,i,n,r,s){let a,o=this.renderer,l=null===o?new Ht:o.getDrawingBufferSize(new Ht),h={minFilter:Q,magFilter:Q,wrapS:W,wrapT:W,stencilBuffer:e,depthBuffer:t};return n>0?(a=new ge(l.width,l.height,h),a.samples=n):(r?(a=new ye(l.width,l.height,2,h),a.texture[1].type=et):a=new ge(l.width,l.height,h),a.depthTexture=new sa(2048,2048),a.depthTexture.type=tt),i===J&&null!==o&&o.outputEncoding===St&&(Array.isArray(a.texture)?a.texture.forEach(t=>t.encoding=St):a.texture.encoding=St),Array.isArray(a.texture)?a.texture.forEach((t,e)=>{t.name=`EffectComposer.Buffer ${r} ${e}`,t.generateMipmaps=!1}):(a.texture.name=`EffectComposer.Buffer ${r}`,a.texture.generateMipmaps=!1),a.name=s,a}addPass(t,e){let i,n=this.passes,r=this.renderer,s=r.getDrawingBufferSize(new Ht),a=r.getContext().getContextAttributes()?.alpha??!1;if(t.MRTCompatible&&(i=this.inputBuffer.texture[0].type),t.MRTCompatible||(i=this.inputBuffer.texture.type),t.setRenderer(r),t.setSize(s.width,s.height),t.initialize(r,a,i),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==e?n.splice(e,0,t):n.push(t),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),t.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){let e=this.createDepthTexture();for(t of n)t.setDepthTexture(e)}else t.setDepthTexture(this.depthTexture)}setHelperStartIndex(t){this.helperStartIndex=t}removePass(t){let e=this.passes,i=e.indexOf(t);if(-1!==i&&e.splice(i,1).length>0){if(null!==this.depthTexture){let i=(t,e)=>t||e.needsDepthTexture;e.reduce(i,!1)||t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null)}this.autoRenderToScreen&&i===e.length&&(t.renderToScreen=!1,e.length>0&&(e[e.length-1].renderToScreen=!0))}}removeAllPasses(){let t=this.passes;t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){let e,i,n,r,s=this.renderer,a=this.copyPass,o=this.inputBuffer,l=this.outputBuffer,h=this.inputBufferSingle,c=this.outputBufferSingle,d=!1;void 0===t&&(t=this.timer.update().getDelta());for(let u of this.passes)u.enabled&&(u.MRTCompatible?u.render(s,o,l,t,d):u.render(s,h,c,t,d),u.needsSwap&&(d&&(a.renderToScreen=u.renderToScreen,e=s.getContext(),i=s.state.buffers.stencil,i.setFunc(e.NOTEQUAL,1,4294967295),a.render(s,o,l,t,d),i.setFunc(e.EQUAL,1,4294967295)),n=o,r=h,o=l,h=c,l=n,c=r),u instanceof YO?d=!0:u instanceof CO&&(d=!1))}setSize(t,e,i){let n=this.renderer;if(this._width=t,this._height=e,void 0===t||void 0===e){let i=n.getSize(new Ht);t=i.width,e=i.height}n.setSize(t,e,i);let r=n.getDrawingBufferSize(new Ht);this.inputBuffer.setSize(r.width,r.height),this.outputBuffer.setSize(r.width,r.height),this.inputBufferSingle.setSize(r.width,r.height),this.outputBufferSingle.setSize(r.width,r.height);for(let s of this.passes)s.setSize(r.width,r.height)}reset(){let t=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(t)}dispose(){for(let t of this.passes)t.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()}},LR=new vn({name:"CombineMaterial",uniforms:{inputBufferA:new $l(null),inputBufferB:new $l(null)},blending:0,depthWrite:!1,depthTest:!1,vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n gl_Position = vec4(position.xy, 1.0, 1.0);\n vUv = position.xy * 0.5 + 0.5;\n}\n",fragmentShader:"\n varying vec2 vUv;\n uniform sampler2D inputBufferA;\n uniform sampler2D inputBufferB;\n\n // TODO: Why do we need these when postpro of framemode is enabled???\n layout(location = 1) out vec4 gVelocity;\n\n void main() {\n\tvec4 resA = texture2D(inputBufferA, vUv);\n\tvec4 resB = texture2D(inputBufferB, vUv);\n float a = resA.a + resB.a * ( 1.0 - resA.a );\n\n\tvec4 res;\n\tres.rgb = resA.rgb + (resB.rgb * (1.0 - resA.a));\n\tres.a = resA.a + resB.a * (1.0 - resA.a);\n\tgl_FragColor = res;\n gVelocity = vec4(0.0);\n }\n"}),BR=class extends AO{constructor(t){super("HelperPass",void 0,t),this.MRTCompatible=!1,this.fullscreenMaterial=LR,this.helperPass=new OR(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new OR(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let e=new pR({preset:hR,edgeDetectionMode:dO});this.effectPass=new WO(this.camera,e),this.rt=new ge(10,10,{minFilter:Q,magFilter:Q,wrapS:W,wrapT:W,depthBuffer:!0})}setSize(t,e){this.rt.setSize(t,e),this.effectPass.setSize(t,e)}set sceneHelpers(t){this.helperPass.setScene(t)}get sceneHelpers(){return this.helperPass.getScene()}set sceneHelpersOnTop(t){this.helperPassOnTop.setScene(t)}get sceneHelpersOnTop(){return this.helperPassOnTop.getScene()}setCamera(t){this.helperPass.setCamera(t),this.helperPassOnTop.setCamera(t)}initialize(t,e,i){super.initialize(t,e,i),this.effectPass.initialize(t,e,i)}dispose(){super.dispose(),this.rt.dispose(),this.effectPass.dispose()}render(t,e,i){this.rt.depthTexture=e.depthTexture;let n=t.getClearAlpha();t.setClearAlpha(0),this.helperPass.clearDepth=!0,this.helperPass.clearColorOnly=!0,this.helperPass.render(t,this.rt),this.helperPassOnTop.render(t,this.rt),this.effectPass.renderToScreen=!1,this.effectPass.render(t,this.rt,i),this.fullscreenMaterial.uniforms.inputBufferA.value=i.texture,this.fullscreenMaterial.uniforms.inputBufferB.value=e.texture,t.setClearAlpha(n),t.setRenderTarget(null),t.clear(),t.render(this.scene,this.camera)}},zR=[[.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]],FR=new vn({vertexShader:"#define GLSLIFY 1\n#include <skinning_pars_vertex>\n#include <morphtarget_pars_vertex>\nout vec3 n;void main(){\n#include <beginnormal_vertex>\n#include <morphnormal_vertex>\n#include <skinbase_vertex>\n#include <skinnormal_vertex>\n#include <defaultnormal_vertex>\n#include <begin_vertex>\n#include <morphtarget_vertex>\n#include <skinning_vertex>\nvec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}",fragmentShader:"#define GLSLIFY 1\nin vec3 n;void main(){gl_FragColor=vec4(n,1.0);}"}),NR=new vn({vertexShader:"#define GLSLIFY 1\nout vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}",fragmentShader:"#define GLSLIFY 1\nin 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(){\n#ifdef DEBUG\nfloat 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));
2gl_FragColor=vec4(vec3(output_d),1.0);\n#else\nvec2 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;\n#endif\n}",uniforms:{texture_ao_lrez:new $l(null),texture_depth_lrez:new $l(null),texture_depth_hrez:new $l(null),near:new $l(null),far:new $l(null)}}),UR=class extends AO{constructor(t,e){super("AmbientOcclusionPass",void 0,e),this.fogEnabled=!1,this.fogNear=1,this.fogFar=1e3,this.frameIndex=0,this._runHalfRes=!0,this._width=1,this._height=1;let i=1024,n=1024;this.gBuffer=new ge(i,n,{type:Um?et:tt,depthTexture:new sa(i,n),minFilter:Q,magFilter:Q}),this.depthBufferHighRes=new ge(i,n,{depthTexture:new sa(i,n)}),this.aoBuffer=new ge(i,n,{minFilter:Q,magFilter:Q}),this.splineScene=t,this.splineCamera=e;let r=new Float32Array(2*zR.length);for(let a=0;a<zR.length;a++){let t=2*a;r[t+0]=zR[a][0],r[t+1]=zR[a][1]}this.blueNoiseInDiskTexture=new ga(r,zR.length,1,ot,tt),this.blueNoiseInDiskTexture.wrapS=G,this.blueNoiseInDiskTexture.wrapT=G,this.blueNoiseInDiskTexture.needsUpdate=!0,this.hbaoMaterial=new vn({vertexShader:"#define GLSLIFY 1\nout vec2 v_uv;void main(){v_uv=uv;gl_Position=vec4(position.xy,1.0,1.0);}",fragmentShader:"#define GLSLIFY 1\nin 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(int(mod(gl_FragCoord.x,128.0)),int(mod(gl_FragCoord.y,128.0)));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);}\n#define USE_GBUFFER_NORMALS\nvoid main(){vec3 view_space_p=get_view_position(v_uv);\n#ifdef USE_GBUFFER_NORMALS\nvec3 view_space_n=texture(texture_normals,v_uv).rgb;view_space_n.z*=-1.0;\n#else\nvec3 view_space_n=-rebuild_normal(v_uv,view_space_p);\n#endif\nfloat 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>
2=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);}",uniforms:{near:new $l(null),far:new $l(null),fov:new $l(null),proj_info:new $l(new me),is_ortho:new $l(!1),resolution:new $l(new Ht),radius_of_influence:new $l(8),radius_in_screen_space:new $l(1),exponent:new $l(1),ao_color:new $l(new be),bias:new $l(.5),texture_depth:new $l(null),texture_normals:new $l(null),texture_blue_noise:new $l(null),texture_blue_noise_in_disk:new $l(this.blueNoiseInDiskTexture),frame_index:new $l(0),fog_enabled:new $l(!1),fog_near:new $l(1),fog_far:new $l(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 ge(i,n,{minFilter:Q,magFilter:Q,wrapS:W,wrapT:W,depthBuffer:!1,type:tt});let s=new pR({preset:uR,edgeDetectionMode:dO});this.effectPass=new WO(this.camera,s)}initialize(t,e,i){super.initialize(t,e,i),this.effectPass.initialize(t,e,i)}setBlueNoiseTexture(t){this.hbaoMaterial.uniforms.texture_blue_noise.value=t}setSize(t,e){this._width=t,this._height=e,this.depthBufferHighRes.setSize(t,e);let i=this._runHalfRes?.5:1,n=t*i,r=e*i;this.gBuffer.setSize(n,r),this.aoBuffer.setSize(n,r),this.hbaoMaterial.uniforms.resolution.value.set(n,r),this.aaBuffer.setSize(n,r),this.effectPass.setSize(n,r)}get runHalfRes(){return this._runHalfRes}set runHalfRes(t){this._runHalfRes=t,this.setSize(this._width,this._height)}setCamera(t){this.splineCamera=t}setScene(t){this.splineScene=t}setDepthTexture(t){this.depthBufferHighRes.depthTexture=t,NR.uniforms.texture_depth_hrez.value=t,NR.needsUpdate=!0}render(t,e,i){this.splineScene.overrideMaterial=FR;let n=this.splineCamera.layers.mask;if(this.splineCamera.layers.set(5),t.setRenderTarget(this.gBuffer),t.clear(),t.render(this.splineScene,this.splineCamera),t.setRenderTarget(this.depthBufferHighRes),t.clear(),t.render(this.splineScene,this.splineCamera),this.splineScene.overrideMaterial=null,this.splineCamera.layers.mask=n,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 t=this.splineCamera.perspCamera.projectionMatrix.elements,e=2/t[0],i=2/t[5],n=-(1-t[8])/t[0],r=-(1+t[9])/t[5];this.hbaoMaterial.uniforms.proj_info.value.set(e,i,n,r);let s=this.splineCamera.perspCamera.fov*(Math.PI/180),a=this.hbaoMaterial.uniforms.resolution.value.y/(2*Math.tan(.5*s)),o=.5*this.hbaoMaterial.uniforms.radius_of_influence.value*a;this.hbaoMaterial.uniforms.radius_in_screen_space.value=o,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 t=this.splineCamera.orthoCamera.projectionMatrix.elements,e=2/t[0],i=2/t[5],n=-(1+t[12])/t[0],r=-(1-t[13])/t[5];this.hbaoMaterial.uniforms.proj_info.value.set(e,i,n,r);let s=this.hbaoMaterial.uniforms.resolution.value.y/i*.5,a=this.hbaoMaterial.uniforms.radius_of_influence.value*s;this.hbaoMaterial.uniforms.radius_in_screen_space.value=a,this.hbaoMaterial.uniforms.is_ortho.value=!0}this.runHalfRes?(this.fullscreenMaterial=this.hbaoMaterial,t.setRenderTarget(this.aoBuffer),t.clear(),t.render(this.scene,this.camera),this.fullscreenMaterial=NR,NR.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,NR.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,NR.uniforms.texture_depth_hrez.value=this.depthBufferHighRes.depthTexture,t.setRenderTarget(t.aoRenderTarget),t.clear(),t.render(this.scene,this.camera)):(this.fullscreenMaterial=this.hbaoMaterial,t.setRenderTarget(this.aaBuffer),t.clear(),t.render(this.scene,this.camera),this.effectPass.renderToScreen=!1,this.effectPass.render(t,this.aaBuffer,t.aoRenderTarget))}dispose(){this.gBuffer.dispose(),this.depthBufferHighRes.dispose(),this.aoBuffer.dispose()}},kR=class extends QO{constructor(){super(new vn({vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D tInput;\nuniform sampler2D tMap;\nuniform vec2 resolution;\nvarying vec2 vUv;\n\nuniform vec2 uResolution;\nuniform vec2 uCoords;\n\n// Draws a rectangle at center <st> with size <size>\nfloat rectangle(vec2 st, vec2 size) {\n size = vec2(0.5) - size * 0.5;\n vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y));\n uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y));\n\n return uv.x * uv.y;\n}\n\nuniform vec2 uSize;\nuniform float uScale;\nuniform float uDPR;\nuniform float uCurrent;\nuniform vec3 uSceneColor;\n\nvoid main() {\n vec2 screenUv = gl_FragCoord.xy / uResolution.xy;\n screenUv *= 1.0 / uDPR;\n\n vec2 center = vec2(0.5, -0.5);\n vec2 outsideUv = screenUv;\n outsideUv += center;\n outsideUv -= uCoords.xy / uResolution.xy;\n outsideUv = (outsideUv - 0.5) + 0.5;\n outsideUv -= center;\n vec2 s = (uSize / uResolution) * uScale;\n float isOutside = 1.0 - rectangle(outsideUv, s);\n \n vec2 mid = vec2(0.5);\n vec2 insideUv = (screenUv - mid + s * mid) / s;\n vec4 background = texture2D(tInput, screenUv);\n vec4 image = texture2D(tMap, insideUv);\n gl_FragColor = mix(image, background, isOutside);\n}
2\n",uniforms:{tInput:new $l(null),tMap:new $l(null),uResolution:new $l(new Ht),uSize:new $l(new Ht),uCoords:new $l(new Ht),uScale:new $l(1),uSceneColor:new $l(new le(16711680)),uDPR:new $l(1),uCurrent:new $l(0)}}),"tInput"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tMap.value}set texture(t){this.uniforms.tMap.value=t}},VR=[],jR=class extends QO{constructor(){super(new vn({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D toScene;\nuniform sampler2D fromScene;\nuniform vec2 resolution;\n\nuniform vec2 uResolution;\nuniform float uDPR;\n\nuniform float mixRatio;\nuniform sampler2D tMixTexture;\nuniform int useTexture;\nuniform float threshold;\n\nvoid main() {\n\tvec2 screenUv = gl_FragCoord.xy / uResolution.xy;\n\tscreenUv *= 1.0 / uDPR;\n\n\tvec4 texel1 = texture2D( fromScene, screenUv );\n\tvec4 texel2 = texture2D( toScene, screenUv );\n\n\tif (useTexture==1) {\n\t\t\n\t\tvec4 transitionTexel = texture2D( tMixTexture, screenUv );\n\t\tfloat r = mixRatio * (1.0 + threshold * 2.0) - threshold;\n\t\tfloat mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0);\n\t\t\n\t\tgl_FragColor = mix( texel1, texel2, mixf );\n\t} else {\n\t\t\n\t\tgl_FragColor = mix( texel1, texel2, mixRatio );\n\t\t\n\t}\n}\n",uniforms:{toScene:new $l(null),fromScene:new $l(null),uResolution:new $l(new Ht),uDPR:new $l(1),mixRatio:new $l(0),threshold:new $l(.1),useTexture:new $l(0),tMixTexture:{value:VR[0]}}}),"toScene"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.fromScene.value}set texture(t){this.uniforms.fromScene.value=t}},GR=class extends QO{constructor(){super(new vn({vertexShader:"\nvoid main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D inputBuffer;\nuniform sampler2D blurredInputBuffer;\nuniform sampler2D overlay;\nuniform float blurIntensity;\n\nuniform vec2 uResolution;\nuniform float uDPR;\n\nvoid main() {\n\tvec2 screenUv = gl_FragCoord.xy / uResolution.xy;\n\tscreenUv *= 1.0 / uDPR;\n\n\tvec4 texel1 = texture2D( overlay, screenUv );\n\tvec4 texel2 = texture2D( inputBuffer, screenUv );\n\tvec4 texel3 = texture2D( blurredInputBuffer, screenUv );\n\n\tfloat blurMask2 = max(sign(texel1.a), 0.0) * blurIntensity;\n gl_FragColor = mix( mix(texel2, texel3, blurMask2), texel1, texel1.a );\n}\n",uniforms:{inputBuffer:new $l(null),blurredInputBuffer:new $l(null),overlay:new $l(null),uResolution:new $l(new Ht),uDPR:new $l(1),blurIntensity:new $l(0)}})),this._blurEnabled=!1,this.blurTarget=new ge(1,1,{minFilter:Q,magFilter:Q,wrapS:W,wrapT:W}),this.blurPass=new qO({width:window.innerWidth,height:window.innerHeight,kernelSize:JO.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(t){this.uniforms.overlay.value=t}setResolution(t,e,i=1){this.uniforms.uResolution.value.set(t,e),this.uniforms.uDPR.value=i,this.blurPass.setSize(t,e),this.blurTarget.setSize(t,e),this.blurPass.setSize(t,e)}get uiCanvas(){return this._uiCanvas}set uiCanvas(t){this._uiCanvas=t,t.texture&&(this.uniforms.overlay.value=t.texture);let e=t.frame;if(e){let t=e.data.backgroundBlur,i=t.radius;this._blurEnabled=t.enabled,this.uniforms.blurIntensity.value=this._blurEnabled?1:0,this.blurPass.scale=i/3}}render(t,e,i,n,r){this._blurEnabled&&(this.blurPass.setDepthTexture(this.getDepthTexture()),this.blurPass.render(t,e,this.blurTarget,n,r)),super.render(t,e,i,n,r)}},WR=class extends QO{constructor(){super(new vn({vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"\nuniform sampler2D tInput;\nuniform sampler2D tOverlayImage;\nvarying vec2 vUv;\nuniform vec2 uResolution;\nuniform vec2 uRightBottom;\nuniform vec2 uImageSize;\nuniform float uScale;\nuniform float uDPR;\n\nvec3 blendNormal(vec3 base, vec3 blend) {\n\treturn blend;\n}\n\nvec3 blendNormal(vec3 base, vec3 blend, float opacity) {\n\treturn (blendNormal(base, blend) * opacity + base * (1.0 - opacity));\n}\n\nvec4 drawFixedSizeImage(sampler2D image, vec2 screenUV, vec2 imageSize, vec2 imageCoords, vec2 screenSize, float dpr) {\n\tvec2 uv = (screenUV * screenSize * dpr - imageCoords) / (imageSize * dpr);\n\tif (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n\t\treturn vec4(0.0);\n\t}\n\treturn texture2D(image, uv);\n}\n\nvoid main() {\n vec2 screenUV = gl_FragCoord.xy / (uResolution.xy * uDPR);\n\tvec2 imageCoords = vec2(uResolution.x * uDPR - uImageSize.x * uScale * uDPR - uRightBottom.x * uDPR, uRightBottom.y * uDPR);\n vec4 background = texture2D(tInput, screenUV);\n vec4 image = drawFixedSizeImage(tOverlayImage, screenUV, uImageSize * uScale, imageCoords, uResolution, uDPR);\n gl_FragColor = vec4(blendNormal(background.rgb, image.rgb, image.a), max(background.a, image.a));\n}\n",uniforms:{tInput:new $l(null),tOverlayImage:new $l(null),uResolution:new $l(new Ht),uImageSize:new $l(new Ht),uRightBottom:new $l(new Ht(20,20)),uScale:new $l(.25),uDPR:new $l(1)}}),"tInput")}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tOverlayImage.value}set texture(t){this.uniforms.tOverlayImage.value=t,this.uniforms.uImageSize.value.set(t.image.width,t.image.height)}};function HR(t,e){return e&&e.enabled&&t.push(e.effect),t}var qR=t=>Object.values(BO).includes(t)?t:BO.NORMAL,XR=class extends Dt{constructor(t,e){super(),this._needsDOFResize=e,this.postprocessingState=Zx.defaultData,this._scene=new da,this._camera=new UI,this.effects=new Map,this.blueNoiseTexture=new ga,this._renderToScreen=!0,this._isUIOverlayEnabled=!1,this.clock=new zl,this.renderer=t,this.debug=!1,this.effects.set("bloom",new yR),this.effects.set("chromaticAberration",new bR),this.effects.set("vignette",new AR),this.effects.set("noise",new _R),this.effects.set("colorAverage",new wR),this.effects.set("hueSaturation",new SR),this.effects.set("brightnessContrast",new xR),this.effects.set("depthOfField",new MR),this.effects.set("pixelation",new CR),this.effectComposer=new RR(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new OR(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new TR(this.scene,this.camera,this.renderer),this.aoPass=new UR(this.scene,this.camera),this.taaPass=new PR,this.taaPass.renderToScreen=!1,this.helperPass=new BR(this.camera),this.helperPass.renderToScreen=!1,this.stylesOverlayPass=new kR,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new GR,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new WR,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new jR,this.sceneTransitionPass.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(t){void 0!==t?(this.stylesOverlayPass.texture=t,this.stylesOverlayPass.enabled=!0):this.stylesOverlayPass.enabled=!1}get overlayTexture(){return this.stylesOverlayPass.texture}set sceneHelpers(t){this.helperPass.sceneHelpers=t}get sceneHelpers(){return this.helperPass.sceneHelpers}set sceneHelpersOnTop(t){this.helperPass.sceneHelpersOnTop=t}get sceneHelpersOnTop(){return this.helperPass.sceneHelpersOnTop}get scene(){return this._scene}set scene(t){this._scene=t,this.opaquePass.setScene(t),this.transmissionPass.setScene(t),this.aoPass.setScene(t)}get camera(){return this._camera}set camera(t){let e=this._camera!==t;this._camera=t,this.opaquePass.setCamera(t),this.transmissionPass.setCamera(t),e&&this.transmissionPass.updatePasses(this.renderer),this.aoPass.setCamera(t),this.helperPass.setCamera(t),this.effects.get("depthOfField").setCamera(t)}updateRenderToScreen(){let t=!1;for(let e=this.effectComposer.passes.length-1;e>=0;e--){let i=this.effectComposer.passes[e];!0!==i.enabled||t||!this._renderToScreen?i.renderToScreen=!1:(i.renderToScreen=!0,t=!0)}}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(t){this.blueNoiseTexture=new ga(t,128,128),this.blueNoiseTexture.wrapS=G,this.blueNoiseTexture.wrapT=G,this.blueNoiseTexture.minFilter=q,this.blueNoiseTexture.magFilter=q,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(t,e,i,n,r,s,a,o){this.aoPass.enabled=t,this.aoPass.radius=e,this.aoPass.bias=i,this.aoPass.aoColor=n,this.aoPass.fogEnabled=r,this.aoPass.fogNear=s,this.aoPass.fogFar=a,this.aoPass.runHalfRes!==!o&&(this.aoPass.runHalfRes=!o)}setTransmissionPassEnabled(t){this.transmissionPass.enabled=t,this.opaquePass.hasTransmissionPass=t}
vendor: 4,654 bytes, line 2
2_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.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let t=[this.effects.get("pixelation")].reduce(HR,[]);t.length>0&&(this.uvEffectPass=new WO(this.camera,...t),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let e=[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(HR,[]);if(e.length>0&&(this.effectPass=new WO(this.camera,...e),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&this.effects.get("depthOfField")?.enabled&&void 0!==window)){let t=this.renderer.viewportWidth,e=this.renderer.viewportHeight;this.renderer.setSize(t-1,e-1),this.renderer.setSize(t,e)}}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 t=new Ht;this.renderer.getDrawingBufferSize(t),this._rt=new ge(t.x,t.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:G,wrapT:G}),this._rt.samples=0,this._savePass=new MO(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(t){this._rt=t,this._savePass=new MO(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(t){if(this._renderToScreen===t)return;let e=this.effectComposer;!e||(!0===t?e.removePass(this._savePass):e.addPass(this._savePass),this._renderToScreen=t,this.updateRenderToScreen())}set sceneTransitionFromTexture(t){t!==this.sceneTransitionPass.texture&&(null!==t?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=t)}setWatermark(t){this.logoOverlayPass.enabled=null!==t,t&&(this.logoOverlayPass.texture=t)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}updatePostprocessing(t){let{enabled:e,...i}=t,n=!1;e!==this.postprocessingState.enabled&&(n=!0);for(let r of Object.entries(i)){let t=r[1],e=this.effects.get(r[0]);if(e){e.enabled!==t.enabled&&(n=!0),e.enabled=t.enabled;for(let[i,n]of Object.entries(t))"blendFunction"===i?e.blendFunction=qR(n):e[i]=n}}this.postprocessingState=t,n&&this._initPasses()}render(){this.effectComposer.render(this.clock.getDelta())}setScissor(t,e,i,n){t instanceof me?(this.effectComposer.inputBuffer.scissor.set(t.x,t.y,t.z,t.w),this.effectComposer.outputBuffer.scissor.set(t.x,t.y,t.z,t.w)):(this.effectComposer.inputBuffer.scissor.set(t,e,i,n),this.effectComposer.outputBuffer.scissor.set(t,e,i,n));let r=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(r),this.effectComposer.outputBuffer.scissor.multiplyScalar(r),this.renderer.setScissor(t,e,i,n)}setScissorTest(t){this.effectComposer.inputBuffer.scissorTest=t,this.effectComposer.outputBuffer.scissorTest=t,this.renderer.setScissorTest(t)}setViewport(t,e,i,n){t instanceof me?(this.effectComposer.inputBuffer.viewport.copy(t),this.effectComposer.outputBuffer.viewport.copy(t)):(this.effectComposer.inputBuffer.viewport.set(t,e,i,n),this.effectComposer.outputBuffer.viewport.set(t,e,i,n))}resize(t,e,i){if(this.effectComposer.setSize(t,e,i),this._rt){let i=this.renderer.getPixelRatio();this._rt.setSize(t*i,e*i)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose()}},YR=Ln.lights_fragment_begin,QR=Ln.shadowmask_pars_fragment,ZR=null,KR=new vn({vertexShader:"\nattribute vec3 randomColor;\nvarying vec3 vNormal;\nflat out vec3 vColor;\n#include <skinning_pars_vertex>\n#include <morphtarget_pars_vertex>\n\t\nvoid main()\n{\n#include <beginnormal_vertex>\n#include <morphnormal_vertex>\n#include <skinbase_vertex>\n#include <skinnormal_vertex>\nvec3 transformed = vec3(position);\n#include <morphtarget_vertex>\n#include <skinning_vertex>\n\nvNormal = normal;\nvColor = randomColor;\ngl_Position = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0));\n}\n",fragmentShader:"\nuniform float depthContrast;\nvarying vec3 vNormal;\nflat in vec3 vColor;\nvoid main()\n{\nvec3 normal = (normalize(vNormal)).rgb;
2\n\nfloat contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5;\n\nvec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4);\ngl_FragColor = vec4(resultColor, vColor.r);\ngl_FragColor = vec4(resultColor, vColor.r);\n}\n",uniforms:{depthContrast:{value:1}}}),JR=new fe,$R=new Ht,tL=class extends ha{constructor(t){super(t),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHeight=1,this.resolution=new Ht,this.dummyCamera=new UI,this.sceneTransitionDuration=0,this.sceneTransitionTimeRemaining=-1,this.isXRCopyPassSet=!1,this.clear=(t=!0,e=!0,i=!0)=>{let n=this.getContext(),r=0;t&&(r|=n.COLOR_BUFFER_BIT),e&&(r|=n.DEPTH_BUFFER_BIT),i&&(r|=n.STENCIL_BUFFER_BIT),n.clear(r),n.clearBufferfv(n.COLOR,1,[0,0,0,1])},this.pipeline=new XR(this,t?.needsDOFResize??!1),this.autoClear=!1;let e=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 n=this.getContext();if(n&&"drawingBufferColorSpace"in n)try{n.drawingBufferColorSpace="display-p3"}catch(ky){}this.setPixelRatio=t=>{this._pixelRatio!==t&&(this._pixelRatio=t,e(t))},this.setSize=(t,e,n=!0)=>{(this.viewportWidth!==t||this.viewportHeight!==e)&&(this.viewportWidth=t,this.viewportHeight=e,i(t,e,n),this.normalRenderTarget?.setSize(t*this._pixelRatio,e*this._pixelRatio),this._resizeTransmission(t,e),this.transmissionDepthTarget?.setSize(t*this._pixelRatio/2,e*this._pixelRatio/2),this.pipeline.resize(t,e,n))},this._superDispose=this.dispose,this.dispose=this._currentDispose}createAORenderTarget(){void 0===this.aoRenderTarget&&(this.aoRenderTarget=new ge(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:Q,magFilter:Q,wrapS:W,wrapT:W,depthBuffer:!1}))}_resizeTransmission(t,e){this.transmissionRenderTarget?.setSize(t*this._pixelRatio/(this.hdTransmission?1:2),e*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(t*this._pixelRatio/1,e*this._pixelRatio/1)}get hdTransmission(){return 1===OP.transmissionLod.value}set hdTransmission(t){OP.transmissionLod.value=!0===t?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){void 0===this.transmissionRenderTarget&&(this.transmissionRenderTarget=new ge(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:K,magFilter:Q,wrapS:W,wrapT:W,depthBuffer:!1}),this.transmissionDepthTarget=new ge(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:q,magFilter:q,depthBuffer:!1}))}createNormalRenderTarget(){void 0===this.normalRenderTarget&&(this.normalRenderTarget=new ge(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:q,magFilter:q,type:tt,depthTexture:new sa(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}))}renderNormal(t,e,i){this.normalRenderTarget&&(this.setClearColor(0),i.layers.enable(8),i.layers.disable(0),i.layers.disable(3),e.traverseEntity(t=>{t.layers.isEnabled(8)&&(t.copyPreviousMatrix=!1)}),this.setRenderTarget(this.normalRenderTarget),this.clear(),KR.uniforms.depthContrast.value=i instanceof UI?(i.far-i.near)/1e4:1,e.overrideMaterial=KR,this.render(e,i),this.setClearColor(e.bgColor,e.bgColor.a),this.setRenderTarget(null),e.overrideMaterial=t.wireframeState?Az:null,i.layers.enable(0),i.layers.enable(3),e.traverseEntity(t=>{t.layers.isEnabled(8)&&(t.copyPreviousMatrix=!0)}))}renderSplineSceneWithDummyCamera(t,e,i=1){this.dummyCamera.updateCameraState(e.dataPatched),this.dummyCamera.matrix.copy(e.matrixWorld);let n=e.height,r=e.width,s=this.viewportWidth/this.viewportHeight;r<n?r=n*s:n=r/s,this.dummyCamera.setViewplaneSize(r,n);for(let a=0;a<i;a++)this.renderSplineScene(t,this.dummyCamera)}renderSplineScene(t,e,{sceneHelpers:i=this.sceneHelpers,sceneHelpersOnTop:n=this.sceneHelpersOnTop,overrideTransmission:r,overrideNormal:s}={}){let a=t instanceof Cz?t.activePage:t,o=a.visible;a.visible=!0;let l=a.scene;this.xr.enabled&&(!1===this.isXRCopyPassSet&&null!==this.getRenderTarget()&&(this.pipeline.setCopyPass(this.getRenderTarget()),this.isXRCopyPassSet=!0),this.xr.updateCamera(e)),this.setClearColor(a.bgColor,a.bgColor.a),a.penumbraSizeArray.forEach((t,e)=>{OP.penumbraSize.value[e]=t}),OP.pixelRatioNode.value=this.getPixelRatio(),0!==this.resolution.x&&0!==this.resolution.y?OP.resolution.value.set(this.resolution.x,this.resolution.y):OP.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHe
2ight*this._pixelRatio),void 0!==s?(OP.normalRenderTarget.value=s,OP.normalRenderTargetDepth.value=JR):l.needsNormal()&&(this.createNormalRenderTarget(),OP.normalRenderTarget.value=this.normalRenderTarget.texture,OP.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(l,a,e));let h=a.data.ao,c=h.occlusion;if(c&&(this.createAORenderTarget(),OP.aoRenderTarget.value=this.aoRenderTarget.texture),OP.aoEnabled.value=c,this.pipeline.setAmbientOcclusionParams(h.occlusion,h.radius,h.bias,a.aoColor,null!==a.fog,a.backupFog.near,a.backupFog.far,h.aoFullRes&&!Um),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&a.uiCanvas?.enabled&&a.uiCanvas.texture&&a.uiCanvas.texture.image.width>0){let t=this.getSize($R),e=this.getPixelRatio();(a.uiCanvas.width!==this.viewportWidth||a.uiCanvas.height!==this.viewportHeight||a.uiCanvas.dpr!==e)&&a.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},e),a.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=a.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(t.x,t.y,e),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let t=this.getSize($R),e=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(t.x,t.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=e}let d=!1;if(void 0!==r)OP.transmissionRenderTarget.value=r,OP.transmissionRenderTargetDepth.value=JR,this.pipeline.setTransmissionPassEnabled(!1);else{let t=l.needsTransmission();t&&(void 0===this.transmissionRenderTarget&&(d=!0),this.createTransmissionRenderTarget(),OP.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,OP.aspectRatio.value=function(t,e){return t>=e?new Ht(e/t,1):new Ht(1,t/e)}(this.viewportWidth,this.viewportHeight),OP.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(t)}e.layers.enable(3),e.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=n,this.pipeline.scene=a,this.pipeline.camera=e,d&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState!==a.postprocessing&&(this.pipeline.updatePostprocessing(a.postprocessing),!i&&!n&&this.pipeline.disableHelpers()),void 0!==this.clearAlphaOverride&&this.setClearAlpha(this.clearAlphaOverride),l.shapeBlendIntances.forEach(t=>{t.onBeforeShadowPass(this)}),a.overrideMaterial=l.wireframeState?Az:null,this.pipeline.render(),OP.frameIndex.value=(OP.frameIndex.value+1)%16,e instanceof UI&&e.copyHistory(),a.visible=o}renderFromSceneForSceneTransitionPass(t,e,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(t,e),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let n=this.pipeline.sceneTransitionPass.uniforms;n.uDPR.value=window.devicePixelRatio,n.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.transmissionRenderTarget?.dispose(),this.transmissionDepthTarget?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget?.depthTexture?.dispose()}},eL=class extends(wI(mh)){constructor(t,e=15,i=10066329){super(t,e,i),this.object=t,this.added=!1,this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,e){MI(this.object,eL.geometryHelper,t,e)}},iL=class extends(wI(dh)){constructor(t,e=15,i=6710886){super(t,e,i),this.object=t,this.name=`PointLightHelper: ${t.uuid}`}raycast(t,e){MI(this.object,iL.geometryHelper,t,e)}},nL=class extends(wI(ch)){constructor(t,e=6710886){super(t,e),this.object=t,this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,e){MI(this.object,nL.geometryHelper,t,e)}update(){if(void 0!==this.object){let t=nL._vector,e=this.object.distance?this.object.distance:1e3,i=e*Math.tan(this.object.angle);this.cone.scale.set(i,i,e),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let n=void 0!==this.color?this.color:this.light.color;if(this.cone.material instanceof Array)for(let r=0,s=this.cone.material.length;r<s;r++)this.cone.material[r].color.set(n);else this.cone.material.color.set(n)}}},rL=nL;rL._vector=new be;var sL=class extends ia{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new cn(new Rn(1,1),new Bi({transparent:!0,opacity:0,side:2})),this.add(this.caretMesh),this.selectionMesh=new cn(new Rn(1,1),new Bi({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(t){this.visible=!0,this.object=t,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:t}=this.object.geometry.userData.parameters;this.caretMesh.position.z=t,this.selectionMesh.position.z=t}updateHelperMatrix(){if(void 0===this.object)return;let t=this.object,e=t.parent;null!==e&&e.updateWorldMatrix(!0,!1),t.matrixAutoUpdate&&t.updateMatrix(),null!==e?(this.matrixWorld.multiplyMatrices(e.matrixWorld,t.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,t.matrix)):this.matrixWorld.multiplyMatrices(t.hiddenMatrix,t.matrix),this.matrix.copy(this.matrixWorld);for(let i of this.children)i.matrixWorld.copy(this.matrixWorld);t.updateWorldMatrix(!0,!0)}setCaretColor(t){let e=this.caretMesh.material;e.color.setRGB(t.r,t.g,t.b);let i=this._caretVisibleAlpha===e.opacity;this._caretVisibleAlpha=t.a,i&&(e.opacity=this._caretVisibleAlpha)}setSelectionColor(t){this.selectionMesh.material.color.setRGB(t.r,t.g,t.b)}setCaretPosition(t,e={}){if(void 0===this.object)return;this.caretIndex=t;let i=this.object.wrappedText,[n,r]=oL(i,t),[s,a]=t>0?oL(i,t-1):[null,null];"\n"===(t>0&&i.length?i[s].charAt(a):null)&&(n++,r=0),this.current.start=t,this.current.end=void 0;let[o,l]=aL(this.object,n,r),{AD:h,descender:c}=this.object,d=c+.5*h,{width:u,height:p,depth:f}=this.object.geometry.userData.parameters,m="string"==typeof u?0:u,g="string"==typeof p?0:p;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-.5*m,l+d+.5*g,f),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(t,e){if(void 0===this.object)return;let i=this.object.wrappedText;this.current.start=t,this.current.end=e;
vendor: 4,491 bytes, line 2
2let n=[],r=[],s=function(t,e,i){let[n,r]=oL(t,e),[s,a]=oL(t,i),o=[];r>=t[n].length&&(n++,r=0);for(let l=n;l<=s;l++){let e=t[l],i=l===n?r:0,h=l===s?a:e.length;o.push([l,i,h])}return o}(i,t,e),{lineHeight:a,AD:o,descender:l}=this.object,h=l+.5*o-.5*a;for(let[g,v,y]of s)if(v!==y){let[t,e]=aL(this.object,g,v),[i,s]=aL(this.object,g,y);e+=h,s+=h,s+=a;let o=n.length/3;n.push(t,e,0),n.push(i,e,0),n.push(i,s,0),n.push(t,s,0),r.push(o+0,o+1,o+2),r.push(o+2,o+3,o+0)}let c=new Qi;c.setIndex(r),c.setAttribute("position",new Vi(n,3));let{width:d,height:u,depth:p}=this.object.geometry.userData.parameters,f="string"==typeof d?0:d,m="string"==typeof u?0:u;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=c,this.selectionMesh.position.x=.5*-f,this.selectionMesh.position.y=.5*m,this.selectionMesh.position.z=p,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(t,e,i="previous"){if(void 0===this.object||void 0===this.object.font)return;let n=this.object.wrappedText,r=n.length,s=this.object.lineHeight,a=r*s,{height:o,verticalAlign:l}=this.object.geometry.userData.parameters,h="string"==typeof o?0:o,c=0;3===l?c=h-a:2===l&&(c=.5*h-.5*a);let d=Math.min(Math.floor(Math.max(Math.min(-e-c,a),0)/s),r-1),u=this.object.charCoords[d],p=this.object.charWidths[d],f=0,m=!1;if("previous"===i){for(let g=0;g<u.length;g++)if(u[g][0]+.5*p[g]-t>0){f=g,m=!0;break}}else if("closest"===i){let e=1/0;for(let i=0;i<u.length;i++){let n=u[i][0]+.5*p[i],r=Math.abs(n-t);r<e&&(e=r,f=i,m=!0)}}else for(let g=0;g<u.length;g++){let e=u[g][0],i=u[g][0]+p[g];if(t>=e&&t<i){f=g,m=!0;break}}return m||(f=u.length),{index:this.getGlobalIndexFromLineAndCharIndexes(n,d,f),lineIndex:d,characterIndex:f}}getGlobalIndexFromLineAndCharIndexes(t,e,i){return t.slice(0,e).reduce((t,e)=>t+e.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 aL(t,e,i){let{charCoords:n,charWidths:r,initialOffsetY:s,lineHeight:a}=t;if(n[e]&&0===n[e].length||0===n.length){let i=0,{horizontalAlign:n}=t.data.geometry,r=t.wrappedText,{width:o}=t.geometry.userData.parameters;return 1===r.length&&0===r[0].length&&(3===n?i=.5*o:2===n&&(i=o)),[i,s-a*e]}let o=n[e];if(void 0===o||0===o.length)return[0,0];let[l,h]=o[Math.min(i,o.length-1)];return i>=o.length&&(l+=r[e][i-1]),[l,h]}function oL(t,e){let i=0;for(let n=0;n<t.length;n++){let r=t[n],s=e-i;if(s<=r.length)return[n,s];i+=r.length}return[Math.max(0,t.length-1),t[t.length-1]?.length??0]}function lL(t,e){return"string"==typeof t?e.data.colors[t]:t}function hL(t){return t.colors[0]}var cL,dL=class extends(HI(Rl,eL)){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.top=1250,n.bottom=-1250,n.right=1250,n.left=-1250,n.near=-1e4,n.far=2500;let r=new yh(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];e instanceof yh&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e);let i=void 0!==t.depth&&t.depth!==this.shadow.camera.far||void 0!==t.size&&t.size/2!==this.shadow.camera.right;void 0!==t.size&&function(t,e){t.shadow.camera.right=e/2,t.shadow.camera.left=-e/2,t.shadow.camera.top=e/2,t.shadow.camera.bottom=-e/2,t.shadow.needsUpdate=!0}(this,t.size),void 0!==t.shadowRadius&&(this.shadow.radius=t.shadowRadius),void 0!==t.shadowResolution&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),void 0!==t.penumbraSize&&e.scene.markPenumbraSizeDirty(),i&&this.update()}},uL=new be,pL=new be,fL=new xe,mL=class extends(HI(Cl,rL)){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=2*Wt.RAD2DEG*this.angle,n.aspect=1,n.near=100,n.far=2500;let r=new yh(this.shadow.camera);r.visible=!1,this.gizmos.shadowmap=r,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this.gizmos){let e=this.gizmos[t];
2e instanceof yh&&e.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),pL.setFromMatrixPosition(this.matrixWorld),fL.setFromRotationMatrix(this.matrixWorld),uL.copy(this.up).applyQuaternion(fL).negate().multiplyScalar(this.distance),this.target.position.copy(pL).add(uL),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(t,e){this.updateState_Light(t,e),void 0!==t.distance&&(this.distance=t.distance),void 0!==t.decay&&(this.decay=t.decay),void 0!==t.angle&&(this.angle=t.angle),void 0!==t.penumbra&&(this.penumbra=t.penumbra),void 0!==t.shadowRadius&&(this.shadow.radius=t.shadowRadius),void 0!==t.penumbraSize&&e.scene.markPenumbraSizeDirty(),void 0!==t.shadowResolution&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};function gL(t,e){return[[t[0][0]*e[0][0]+t[0][1]*e[1][0],t[0][0]*e[0][1]+t[0][1]*e[1][1]],[t[1][0]*e[0][0]+t[1][1]*e[1][0],t[1][0]*e[0][1]+t[1][1]*e[1][1]]]}function vL(t){return[[t[0][0],t[1][0]],[t[0][1],t[1][1]]]}function yL(t){let[e,i,n]=function(t){let e=(t[0][0]+t[1][1])/2,i=(t[0][0]-t[1][1])/2,n=(t[1][0]+t[0][1])/2,r=(t[1][0]-t[0][1])/2,s=Math.sqrt(e*e+r*r),a=Math.sqrt(i*i+n*n),o=s+a,l=s-a,h=Math.atan2(n,i),c=Math.atan2(r,e),d=(c-h)/2,u=(c+h)/2,p=[[Math.cos(u),Math.sin(u)],[-Math.sin(u),Math.cos(u)]],f=[[o,0],[0,l]],m=[[Math.cos(d),Math.sin(d)],[-Math.sin(d),Math.cos(d)]];return p[0][0]*=-1,p[0][1]*=-1,m[0][0]*=-1,m[1][0]*=-1,[p,f,m]}(t),r=gL(e,vL(n)),s=gL(gL(n,i),vL(n));return{rotation:Math.atan2(r[1][0],r[0][0]),scale:[s[0][0],s[1][1]],shear:[s[0][1]/s[1][1],s[1][0]/s[0][0]]}}(t=>{function e(t){return[t[0],t[3],t[1],t[4],t[2],t[5]]}t.identity=function(){return[1,0,0,0,1,0,0,0,1]},t.copy=function(e,i=t.identity()){for(let t=0,n=e.length;t<n;t++)i[t]=e[t];return i},t.create=function(e,i,n,r,s,a){return t.setAbcdef(t.identity(),e,i,n,r,s,a)},t.setAbcdef=function(t,e,i,n,r,s,a){return t[0]=e,t[1]=n,t[2]=s,t[3]=i,t[4]=r,t[5]=a,t},t.append=function(i,n){let[r,s,a,o,l,h]=e(i),[c,d,u,p,f,m]=e(n),g=c*r+d*a,v=c*s+d*o,y=u*r+p*a,x=u*s+p*o,b=f*r+m*a+l,w=f*s+m*o+h;return t.create(g,v,y,x,b,w)},t.prepend=function(i,n){let[r,s,a,o,l,h]=e(i),[c,d,u,p,f,m]=e(n),g=r,v=s,y=a,x=o;(1!==c||0!==d||0!==u||1!==p)&&(g=r*c+s*u,v=r*d+s*p,y=a*c+o*u,x=a*d+o*p);let b=l*c+h*u+f,w=l*d+h*p+m;return t.create(g,v,y,x,b,w)},t.getAbcdef=e,t.invert=function(e){let[i,n,r,s,a,o]=t.getAbcdef(e),l=i*s-n*r,h=s/l,c=-n/l,d=-r/l,u=i/l,p=(r*o-s*a)/l,f=-(i*o-n*a)/l;return t.create(h,c,d,u,p,f)},t.apply=function([e,i],n){let[r,s,a,o,l,h]=t.getAbcdef(n);return[r*e+a*i+l,s*e+o*i+h]}
vendor: 1,039 bytes, line 2
2,t.applyInverse=function(e,i){let[n,r,s,a,o,l]=t.getAbcdef(i),h=1/(n*a+s*-r),[c,d]=e;return[a*h*c+-s*h*d+(l*s-o*a)*h,n*h*d+-r*h*c+(-l*n+o*r)*h]},t.scale=function(e,i,n=i){let[r,s,a,o,l,h]=t.getAbcdef(e);return t.setAbcdef(e,r*i,s*n,a*i,o*n,l*i,h*n),e},t.rotate=function(e,i){let n=Math.cos(i),r=Math.sin(i),[s,a,o,l,h,c]=t.getAbcdef(e);return t.setAbcdef(e,s*n-a*r,s*r+a*n,o*n-l*r,o*r+l*n,h*n-c*r,h*r+c*n),e},t.rotateAround=function(e,i,n){let[r,s]=n,a=t.translate(e,-r,-s);return a=t.rotate(a,i),a=t.translate(a,r,s),a},t.translate=function(e,i,n){let[r,s,a,o,l,h]=t.getAbcdef(e);return t.setAbcdef(e,r,s,a,o,l+i,h+n),e},t.setTranslate=function(e,i,n){let[r,s,a,o]=t.getAbcdef(e);return t.setAbcdef(e,r,s,a,o,i,n),e},t.setPosition=function(e,i,n){let[r,s,a,o]=t.getAbcdef(e);return t.setAbcdef(e,r,s,a,o,i,n),e},t.getScale=function(e){let[i,n,r,s]=t.getAbcdef(e);return[Math.sqrt(i*i+n*n),Math.sqrt(r*r+s*s)]},t.getPosition=function(e){let[,,,,i,n]=t.getAbcdef(e);return[i,n]},t.getRotation=function(e,i){return t.decompose(e,i).rotation}
vendor: 8,288 bytes, line 2
2,t.decompose=function(e,i){let[n,r,s,a,o,l]=t.getAbcdef(e),{rotation:h,scale:c,shear:d}=yL([[n,s],[r,a]]);return{position:[o+(i[0]*n+i[1]*s)-i[0],l+(i[0]*r+i[1]*a)-i[1]],scale:c,rotation:h,shear:d,pivot:i}},t.compose=function(e,i,n,r,s=[0,0]){let[a,o]=e,[l,h]=r,[c,d,u,p]=function({rotation:t,scale:e,shear:i}){let n=Math.cos(t),r=Math.sin(t),s=gL([[n,-r],[r,n]],[[e[0],i[0]*e[1]],[i[1]*e[0],e[1]]]);return[s[0][0],s[1][0],s[0][1],s[1][1]]}({rotation:n,scale:i,shear:s}),f=a-(l*c+h*u)+l,m=o-(l*d+h*p)+h;return t.create(c,d,u,p,f,m)}})(cL||(cL={}));var xL=Math.PI/180;var bL=class{constructor(t,e,i){this.uuid=t,this.data=e,this.localMatrix=cL.identity(),this.worldMatrix=cL.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new DL,this._recursiveBBox=new DL,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=GM(),this.dpr=i.dpr??1,this.dataPatched=e}project(t,e){let i=this.worldMatrix;return e&&(i=cL.append(e.worldMatrix,i)),cL.applyInverse(t,i)}intersects(t,e,i,n=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([t,e],i),n)}intersectsInLocalSpace(t,e,i=!1){let{min:n,max:r}=i?this.recursiveBBox:this.singleBBox;return t>=n[0]&&t<=r[0]&&e>=n[1]&&e<=r[1]}applyTransforms(t){t.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=cL.compose(this.position,this.scale,function(t){return t*xL}(this.rotation),xw.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(t,e,i){let n=this.parent;e&&null!=n&&n.updateWorldMatrix(t,!0,!1),t&&this.updateLocalMatrix(),this.parent?this.worldMatrix=cL.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=cL.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return xw.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(t=>{t.resetBBoxNeedsUpdateSelf()})}updateTransformState(t){let e=!1;void 0!==t.position&&(e=!0,this.position=t.position),void 0!==t.rotation&&(e=!0,this.rotation=t.rotation),void 0!==t.scale&&(e=!0,this.scale=t.scale),void 0!==t.shear&&(e=!0,this.shear=t.shear),e&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(t,e,i){0===t.type&&void 0!==t.props.visible&&(this.visible=t.props.visible),this.data=e,this.data=e;let n=t,r=ev(t.path,["states","*"]);if(null!==r){if(0===t.type){let[e]=r;if(this?.stateSelection===e){let e={...t.props};if(delete e.name,Object.values(t.props).some(t=>void 0===t)){let i=this.data;if(void 0!==i){let n=Qg.zoom(i,t.path.slice(2));if(n)for(let i in t.props)void 0===t.props[i]&&i in n&&(e[i]=n[i])}}n={...t,props:e,path:t.path.slice(2)}}}}else if(0===t.type){let e=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==e){if(void 0!==t.props.name&&e.name){let{name:t,...i}=e;e=i}let i=Qg.removeOverridden(t.path,t.props,e);n={...t,props:i}}}this.updateByPatchedOpBase(n,lw.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i)}changeSelectedState(t,e,i=!1){if(0!==this.data.states.length||i){for(let t of this.data.states)lw.toOps(this.data,t.data).forEach(t=>{let i=Mg.replaceProps(t,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,e)});if(null!==t){let i=this.data.states.data(t);i&&(this.dataPatched=lw.patch(this.data,i),lw.toOps(this.data,i).forEach(t=>{this.updateByPatchedOp(t,this.dataPatched,e)}))}i&&this.updateTransformState(this.dataPatched),this.stateSelection=t}}updateState(t,e){void 0!==t.name&&(this.name=t.name),void 0!==t.visible&&(this.visible=t.visible),this.updateTransformState(t)}updateByPatchedOpBase(t,e,i){this.dataPatched=e,this.updateByPatchedOp(t,e,i)}updateByPatchedOp(t,e,i){0===t.path.length&&0===t.type&&this.updateState(t.props,i),this.requestRender()}traverseFrameAncestors(t){this.traverseAncestors(e=>{"frame2d"===e.data.type&&t(e)})}traverseAncestors(t){let e=this.parent;for(;e;)t(e),e=e.parent}requestRender(){this.traverseFrameAncestors(t=>{t.requestRender()})}clone(t){let e=new bL(this.uuid,this.data,t);return e.parent=void 0,e}addEventListener(t,e){this.emitter.on(t,e)}removeEventListener(t,e){this.emitter.off(t,e)}dispatchEvent(t){this.emitter.emit(t.type,{...t,target:t.target??this})}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children;if(e){let i=e.indexOf(this)+1;return e[i]?e[i]:t.traverseSortNextHelper()}}}sortNext(){let t=this.children;return t&&t.length>0&&t[0]?t[0]:this.traverseSortNextHelper()}isDescendantOf(t){t instanceof bL&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}},wL=class extends bL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.context=i,this.children=[]}add(t){t.parent&&t.parent instanceof wL&&t.parent.remove(t),this.children.push(t),t.parent=this}remove(t){let e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=void 0)}traverse(t){let e=t(this);if(!0!==e)for(let i of this.children)i instanceof wL?i.traverse(t):e=t(i)}intersectsChildrenHelper(t,e,i,n,r){for(let s of this.children)if(s.intersects(t,e,i,!1)&&(r.push(s),n)||s instanceof wL&&s.intersectsChildrenHelper(t,e,i,n,r))return!0;return!1}intersectsChildren(t,e,i,n=!1,r=[],s=!1){return this.intersectsChildrenHelper(t,e,i,n,r),r}intersectsChildrenHelperReverse(t,e,i,n,r){for(let s of this.children)if(s instanceof wL&&s.intersectsChildrenHelperReverse(t,e,i,n,r)||s.intersects(t,e,i,!1)&&(r.push(s),n))return!0;return!1}intersectsChildrenReverse(t,e,i,n=!1,r=[],s=!1){return this.intersectsChildrenHelperReverse(t,e,i,n,r),r}updateWorldMatrix(t,e,i){if(super.updateWorldMatrix(t,e,i),i&&this.children)for(let n of this.children)n.updateWorldMatrix(t,!1,!0)}find(t){let e;return this.traverse(i=>{i.uuid===t&&(e=i)}),e}innerDrawChildren(t){for(let e=this.children.length-1;e>=0;e--)this.children[e].draw(t)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(t=>{t.resetBBoxNeedsUpdateSelf()})}clone(t){let e=new wL(this.uuid,this.data,t);e.parent=void 0;for(let i of this.children)e.add(i.clone(t));return e}},SL=class extends wL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.updateState(e,i)}draw(t){!this.visible||(t.save(),this.applyTransforms(t),this.innerDrawChildren(t),t.restore())}clone(t){let e=new SL(this.uuid,this.data,t);e.parent=void 0;for(let i of this.children)e.add(i.clone(t));return e}};function _L(t,e){let[[i,n],[r,s]]=t,[[a,o],[l,h]]=e,c=(i-r)*(o-h)-(n-s)*(a-l);if(0===c)return!1;let d=((i-a)*(o-h)-(n-o)*(a-l))/c,u=-((i-r)*(n-o)-(n-s)*(i-a))/c;return d>=0&&d<=1&&u>=0&&u<=1}var AL,ML,CL,EL,PL=[[-1,1],[-1,-1],[1,-1],[1,1]],TL=(t,e,i)=>{let n=t.getCenter(),r=t.getHalfSize(),s=cL.append(e,t.worldMatrix);0===r[0]&&0===r[1]?i.push(cL.apply(n,s)):PL.forEach(t=>{let e=[t[0]*r[0]+n[0],t[1]*r[1]+n[1]];i.push(cL.apply(e,s))})},DL=class{constructor(){this.matrix=cL.identity(),this.min=[1/0,1/0],this.max=[-1/0,-1/0],this.vertices=[],this.edges=[]}setFromObjectSize(t,e=!1){t.updateWorldMatrix(),this.makeEmpty(),cL.copy(t.worldMatrix,this.matrix);let i=cL.invert(t.worldMatrix);this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let n=[];!0===i&&t instanceof wL?t.traverse(t=>{t.visible&&TL(t,e,n)}):TL(t,e,n),this.setFromPoints(n)}setFromSize(t,e,i){this.makeEmpty(),cL.copy(i,this.matrix),this.expandBySize(t,e,i)}expandBySize(t,e,i){[cL.apply([0,0],i),cL.apply([0,e],i),cL.apply([t,e],i),cL.apply([t,0],i)].forEac
2h(t=>this.expandByPoint(t))}getCenter(){let[t,e]=this.min,[i,n]=this.getHalfSize();return cL.apply([t+i,e+n],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[.5*(this.max[0]-this.min[0]),.5*(this.max[1]-this.min[1])]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(t){this.makeEmpty();for(let e of t)this.expandByPoint(e)}expandByPoint(t){this.min=[Math.min(this.min[0],t[0]),Math.min(this.min[1],t[1])],this.max=[Math.max(this.max[0],t[0]),Math.max(this.max[1],t[1])]}computeVertices(){let[t,e]=this.getHalfSize(),i=this.getCenter(),[n,r,s,a]=cL.getAbcdef(this.matrix),o=cL.create(n,r,s,a,i[0],i[1]);this.vertices=PL.map(([i,n])=>cL.apply([i*t,n*e],o))}computeEdges(){this.edges=[];for(let t=0,e=this.vertices.length;t<e;++t)this.edges.push([this.vertices[t],this.vertices[(t+1)%e]])}project(t,e){let i=this.matrix;return e&&(i=cL.append(e.worldMatrix,i)),cL.applyInverse(t,i)}intersects(t,e,i){return this.intersectsInLocalSpace(...this.project([t,e],i))}intersectsInLocalSpace(t,e){let{min:i,max:n}=this;return t>=i[0]&&t<=n[0]&&e>=i[1]&&e<=n[1]}containsPoint(t){let[e,i]=t,[n,r]=this.min,[s,a]=this.max;return e>=n&&e<=s&&i>=r&&i<=a}intersectsBBox2D(t){for(let e=0,i=this.edges.length;e<i;e++){let i=this.edges[e];for(let e=0,n=t.edges.length;e<n;e++){if(_L(i,t.edges[e]))return!0}}for(let e=0,i=t.vertices.length;e<i;e++){let i=t.vertices[e];if(this.containsPoint(i))return!0}return!1}ensureMinMax(){let t=this.min,e=this.max;this.min=[Math.min(t[0],e[0]),Math.min(t[1],e[1])],this.max=[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}copy(t){this.min=[...t.min],this.max=[...t.max],cL.copy(t.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let t=new DL;return t.copy(this),t}},IL=new Promise(t=>{AL=t}),OL=!1;function RL(){if(!OL)return ML||(ML=async function(){let t=await e(()=>import("./ui-Bz0dFjro.js"),[]);AL(t.default??t),OL=!0}(),ML)}function LL(t){let e=!1;return t.scene.objects.traverse((t,i)=>{("Mesh"===i.type&&"UIGeometry"===i.geometry.type||"Page"===i.type&&void 0!==i.uiFrame)&&(e=!0)}),e}var BL=cL.identity(),zL=class{constructor(t,e=1){this.canvas=t,this._dpr=e,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=ix.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=ix.transparent,this._fonts=new Map,this._isSizeDirty=!1;try{let i=t.getBoundingClientRect();t.width=i.width*e,t.height=i.height*e}catch{}this._currentM3Transform=BL,this._currentTransform=new Float32Array(BL)}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this._isSizeDirty=!0}
2async init(){if(!this.wasmURL)throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");await async function(t){let e=await IL;CL||(EL||(EL=e({locateFile:()=>t})),CL=await EL)}(this.wasmURL),this._surface=CL.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas(),this._paint=new CL.Paint,this._paint.setAntiAlias(!0),this._paintFill=this._paint.copy(),this._paintFill.setStyle(CL.PaintStyle.Fill),this._paintStroke=this._paint.copy(),this._paintStroke.setStyle(CL.PaintStyle.Stroke),this.ctx?.scale(this.dpr,this.dpr)}get currentTransform(){return this._currentM3Transform}get currentTransformBuffer(){return this._currentTransform}set currentTransform(t){this._currentM3Transform=t,this._currentTransform.set(t)}async loadFont(t,e){let i=await(await fetch(t)).arrayBuffer();this.registerFont(i,e)}registerFont(t,e){if(this._fonts.has(e))return;let i=CL.FontMgr.FromData(t);if(!i)throw new Error("Invalid font data for "+e);this._fonts.set(e,i)}get width(){return this._width}get height(){return this._height}set strokeColor(t){this._paintStroke&&this._paintStroke.setColor(NL(t),CL.ColorSpace.DISPLAY_P3)}set fillColor(t){this._paintFill&&this._paintFill.setColor(NL(t),CL.ColorSpace.DISPLAY_P3)}set lineWidth(t){this._paintStroke&&this._paintStroke.setStrokeWidth("center"===this._strokeMode?t:2*t)}set strokeMode(t){this._strokeMode=t}set dropShadowBlur(t){this._dropShadowBlur=t}set dropShadowColor(t){this._dropShadowColor=t}set dropShadowOffsetX(t){this._dropShadowOffsetX=t}set dropShadowOffsetY(t){this._dropShadowOffsetY=t}set innerShadowBlur(t){this._innerShadowBlur=t}set innerShadowColor(t){this._innerShadowColor=t}set innerShadowOffsetX(t){this._innerShadowOffsetX=t}set innerShadowOffsetY(t){this._innerShadowOffsetY=t}set innerShadowSpread(t){this._innerShadowSpread=t}set layerBlur(t){this._layerBlur=t}set backgroundBlur(t){this._backgroundBlur=t}clear(){this.ctx?.clear(CL.TRANSPARENT)}save(){this.ctx?.save()}restore(){this.ctx?.restore()}beginPath(){this._currentPath?.delete(),this._currentPath=new CL.Path}closePath(){let t=this._currentPath;if(t){if(t.isEmpty())return;let e=t.getBounds();(e[3]-e[1]||e[2]-e[0])&&t.close()}}fill(){this._paintInner(this._paintFill,!0)}stroke(){this._paintInner(this._paintStroke,!1)}clipRect(t,e,i,n,r=0,s=0,a=0,o=0){let l=CL.XYWHRect(t,e,i,n);if(0===r&&0===s&&0===o&&0===a)this.ctx?.clipRect(l,CL.ClipOp.Intersect,!0);else{let t=CL.RRectXY(l,r,r);t[4]=t[5]=r,t[6]=t[7]=s,t[8]=t[9]=a,t[10]=t[11]=o,this.ctx?.clipRRect(t,CL.ClipOp.Intersect,!0)}}_applyShadowOffsetMatrix(){if(this.ctx){let t=cL.invert(this.currentTransform);this.ctx.concat(t);let e=cL.translate(cL.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(e),this.ctx.concat(this._currentTransform)}}_applyEffectsToPaint(t,e,i=!0){if(this.ctx&&this._currentPath){let n,r=!1;if(i&&this._hasDropShadow()){let i,n=t.copy();n.setColor(NL(this._dropShadowColor)),this._dropShadowBlur>0&&(i=CL.MaskFilter.MakeBlur(CL.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(this.camera?.scale??1),!1),n.setMaskFilter(i)),this.ctx.save(),this.ctx.clipPath(this._currentPath,CL.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),e(n),this.ctx.restore(),n.delete(),i?.delete()}if(this._backgroundBlur>0&&i){this.ctx.save(),this.ctx.clipPath(this._currentPath,CL.ClipOp.Intersect,!0);let e=CL.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,CL.TileMode.Clamp,null),i=t.copy();i.setImageFilter(e),i.setAlphaf(1);let n=this._currentPath.computeTightBounds();this.ctx.saveLayer(i,n,null,CL.SaveLayerInitWithPrevious),this.ctx.drawColor(t.getColor()),this.ctx.restore(),this.ctx.restore(),i.delete(),e.delete(),r=!0}if(this._layerBlur>0){let i=t.copy();n=CL.MaskFilter.MakeBlur(CL.BlurStyle.Normal,this._layerBlur*this.dpr*(this.camera?.scale??1),!1),i.setMaskFilter(n),e(i),i.delete(),n.delete(),r=!0}if(r||e(t),i&&this._hasInnerShadow()){let t,e=new CL.Paint;e.setAntiAlias(!0),e.setStyle(CL.PaintStyle.Fill),e.setColor(NL(this._innerShadowColor)),this._innerShadowBlur>0&&(t=CL.MaskFilter.MakeBlur(CL.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(this.camera?.scale??1),!1),e.setMaskFilter(t));let i=this._currentPath.computeTightBounds(),[n,r,s,a]=i,o=s-n,l=a-r;this.ctx.save(),this.ctx.clipPath(this._currentPath,CL.ClipOp.Intersect,!0),this.ctx.saveLayer(e,i,null,CL.SaveLayerInitWithPrevious),this.ctx?.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(CL.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+o+Math.abs(2*this._innerShadowOffsetX),2e3+l+Math.abs(2*this._innerShadowOffsetY)),e),e.setBlendMode(CL.BlendMode.Clear),this.ctx.drawPath(this._currentPath,e),this.ctx.restore(
2),this.ctx.restore(),e.delete(),t?.delete()}}}_paintInner(t,e=!0){if(this.ctx&&this._currentPath&&t){let i=this.ctx,n=this._currentPath;this._applyEffectsToPaint(t,t=>{let r=!1;!e&&"center"!==this._strokeMode&&(i.save(),i.clipPath(n,"outside"===this._strokeMode?CL.ClipOp.Difference:CL.ClipOp.Intersect,!0),r=!0),i.drawPath(n,t),r&&i.restore()},e)}}_hasDropShadow(){return this._dropShadowColor?.a>0}_hasInnerShadow(){return this._innerShadowColor?.a>0}path(t){this._currentPath?.addPath(CL.Path.MakeFromSVGString(t))}ellipse(t,e,i,n,r,s,a,o){if(!FL([t,e,i,n])||!this._currentPath)return;if(i<0||n<0)throw Error("radii cannot be negative");let l=CL.XYWHRect(t-i,e-n,2*i,2*n);this._currentPath?.addOval(l)}rect(t,e,i,n,r=0,s=0,a=0,o=0){let l=CL.XYWHRect(t,e,i,n);if(FL(l))if(0===r&&0===s&&0===o&&0===a)this._currentPath?.addRect(l);else{let t=CL.RRectXY(l,r,r);t[4]=t[5]=r,t[6]=t[7]=s,t[8]=t[9]=a,t[10]=t[11]=o,this._currentPath?.addRRect(t)}}getHorizontalAlign(t){switch(t){case 2:return CL.TextAlign.Right;case 3:return CL.TextAlign.Center;case 4:return CL.TextAlign.Justify;default:return CL.TextAlign.Left}}drawTextInner(t,e,i,[n,r,s,a],o,l,h=!0){let c=0,{ctx:d}=this;if(!d)return c;let u=l.copy(),p=l.copy();return p.setAlphaf(0),this._applyEffectsToPaint(u,l=>{e.pushPaintStyle(i,l,p),e.addText(t);let h=e.build();h.layout(s);let u=r;2===o?u+=(a-h.getHeight())/2:3===o&&(u+=a-h.getHeight()),d.drawParagraph(h,n,u),c=h.getHeight(),e.reset(),h.delete()},h),u.delete(),p.delete(),c}drawText(t,e){let i=0,n=this._fonts.get(e.font),{ctx:r,_paintFill:s,_paintStroke:a}=this;if(n&&r){let r=new CL.TextStyle({fontFamilies:[e.font],fontSize:e.fontSize,heightMultiplier:e.lineHeight,letterSpacing:e.letterSpacing}),o=new CL.ParagraphStyle({textStyle:r,textAlign:this.getHorizontalAlign(e.horizontalAlign)}),l=CL.XYWHRect(e.x,e.y,e.width,e.height),h=CL.ParagraphBuilder.Make(o,n);s&&(i=this.drawTextInner(t,h,r,l,e.verticalAlign,s,!0)),a&&(i=this.drawTextInner(t,h,r,l,e.verticalAlign,a,!1)),h.delete()}return{height:i}}render(){this._surface?.flush()}moveTo(t,e){this._currentPath?.moveTo(t,e)}lineTo(t,e){this._currentPath?.lineTo(t,e)}bezierCurveTo(t,e,i,n,r,s){this._currentPath?.cubicTo(t,e,i,n,r,s)}quadraticCurveTo(t,e,i,n){this._currentPath?.quadTo(t,e,i,n)}setTransform(t,e=!1){if(!this.ctx)return;let i=this.ctx.getTotalMatrix(),n=cL.invert(i);if(n&&this.ctx.concat(n),this.ctx?.scale(this.dpr,this.dpr),this.camera?.enabled&&(this.ctx?.concat(this.camera.worldMatrix),e)){let t=cL.getScale(this.camera.worldMatrix);this.ctx?.scale(1/t[0],1/t[1])}this.ctx?.concat(t),this.currentTransform=t}transform(t){this.ctx?.concat(t)}setSize(t,e){!this._isSizeDirty&&t===this._width&&e===this._height||(this._isSizeDirty=!1,this._width=t,this._height=e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=t*this.dpr,this.canvas.height=e*this.dpr,this._surface&&(this._surface=CL.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas()))}};function FL(t){for(let e=0;e<t.length;e++)if(void 0!==t[e]&&!Number.isFinite(t[e]))return!1;return!0}function NL({r:t,g:e,b:i,a:n}){return CL.Color4f(t,e,i,n)}var UL,kL,VL,jL=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.color=ix.transparent,this.blurRadius=0,this.offset=[0,0],this.spread=0,this.update(e)}update(t){void 0!==t.color&&(this.color=t.color),void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.blurRadius&&(this.blurRadius=t.blurRadius),void 0!==t.offset&&(this.offset=t.offset),void 0!==t.spread&&(this.spread=t.spread)}},GL=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.radius=0,this.update(e)}update(t){void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.radius&&(this.radius=t.radius)}},WL=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.color=ix.transparent,this.update(e)}update(t){void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.color&&(this.color=t.color)}},HL=class{constructor(t,e,i){this.uuid=t,this.data=e,this.enabled=!1,this.color=ix.transparent,this.thickness=0,this.mode="inside",this.update(e)}update(t){void 0!==t.enabled&&(this.enabled=t.enabled),void 0!==t.color&&(this.color=t.color),void 0!==t.thickness&&(this.thickness=t.thickness),void 0!==t.mode&&(this.mode=t.mode)}},qL=class extends bL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.autoClose=!0,this.fill=new WL(t+"-fill",e.fill,i),this.stroke=new HL(t+"-stroke",e.stroke,i),this.dropShadow=new jL(t+"-dropShadow",e.dropShadow,i),this.innerShadow=new jL(t+"-innerShadow",e.innerShadow,i),this.backgroundBlur=new GL(t+"-backgroundBlur",e.backgroundBlur,i),this.layerBlur=new GL(t+"-layerBlur",e.layerBlur,i)}applyFillStroke(t){t.fillColor=this.fill.enabled?this.fill.color:ix.transparent,t.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:ix.transparent,t.strokeMode=this.stroke.mode,t.lineWidth=this.stroke.thickness}applyFilters(t){this.layerBlur.enabled?t.layerBlur=5*this.layerBlur.radius:t.layerBlur=0,this.backgroundBlur.enabled?t.backgroundBlur=5*this.backgroundBlur.radius:t.backgroundBlur=0,this.dropShadow.enabled?(t.dropShadowBlur=5*this.dropShadow.blurRadius,t.dropShadowColor=this.dropShadow.color,t.dropShadowOffsetX=this.dropShadow.offset[0],t.dropShadowOffsetY=this.dropShadow.offset[1]):t.dropShadowColor=ix.transparent,this.innerShadow.enabled?(t.innerShadowSpread=this.innerShadow.spread,t.innerShadowBlur=5*this.innerShadow.blurRadius,t.innerShadowColor=this.innerShadow.color,t.innerShadowOffsetX=this.innerShadow.offset[0],t.innerShadowOffsetY=this.innerShadow.offset[1]):t.innerShadowColor=ix.transparent}innerDraw(t){}draw(t){!this.visible||(t.save(),this.applyTransforms(t),this.applyFilters(t),this.applyFillStroke(t),t.beginPath(),this.innerDraw(t),this.autoClose&&t.closePath(),this.fill.enabled&&t.fill(),this.stroke.enabled&&t.stroke(),t.restore(
vendor: 16,497 bytes, line 2
2))}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),0===t.type&&(ev(t.path,["fill"])?this.fill.update(t.props):ev(t.path,["stroke"])?this.stroke.update(t.props):ev(t.path,["dropShadow"])?this.dropShadow.update(t.props):ev(t.path,["innerShadow"])?this.innerShadow.update(t.props):ev(t.path,["layerBlur"])?this.layerBlur.update(t.props):ev(t.path,["backgroundBlur"])?this.backgroundBlur.update(t.props):this.resetBBoxNeedsUpdate())}updateState(t,e){super.updateState(t,e),void 0!==t.fill&&this.fill.update(t.fill),void 0!==t.stroke&&this.stroke.update(t.stroke),void 0!==t.dropShadow&&this.dropShadow.update(t.dropShadow),void 0!==t.innerShadow&&this.innerShadow.update(t.innerShadow),void 0!==t.layerBlur&&this.layerBlur.update(t.layerBlur),void 0!==t.backgroundBlur&&this.backgroundBlur.update(t.backgroundBlur)}clone(t){let e=new qL(this.uuid,this.data,t);return e.parent=void 0,e}},XL=class extends qL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.width=0,this.height=0,this.updateState(e,i)}innerDraw(t){t.ellipse(.5*this.width,.5*this.height,.5*this.width,.5*this.height,0,0,2*Math.PI)}intersectsInLocalSpace(t,e){return function(t,e,i,n,r,s){let a=t-i,o=e-n;return a*a/(r*r)+o*o/(s*s)<=1}(t,e,.5*this.width,.5*this.height,.5*this.width,.5*this.height)}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateState(t,e){super.updateState(t,e),this.updateSizeState(t)}clone(t){let e=new XL(this.uuid,this.data,t);return e.parent=void 0,e}},YL=class extends qL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.width=0,this.height=0,this.cornerRadius=[0,0,0,0],this.updateState(e,i)}innerDraw(t){t.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(t){void 0!==t.cornerRadius&&(this.cornerRadius=t.cornerRadius)}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateState(t,e){super.updateState(t,e),this.updateSizeState(t),this.updateCornerState(t)}clone(t){let e=new YL(this.uuid,this.data,t);return e.parent=void 0,e}},QL=class extends qL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this._textHeight=0,this._textHeightDirty=!0,this.width=0,this.height=0,this.updateState(e,i)}get textHeight(){return this._textHeight}applyFillStroke(t){t.fillColor=this.fill.enabled?this.fill.color:ix.transparent,t.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:ix.transparent,t.strokeMode="center",t.lineWidth=this.stroke.thickness}innerDraw(t){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&t.registerFont(this._fontHolder.arrayBuffer,this.data.font);let e=this.data.textTransform,i=this.data.text.textValue.toString(),n=2===e?i.toUpperCase():3===e?i.toLowerCase():i,{height:r}=t.drawText(n,{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=r}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(t,{shared:e}){void 0!==t.font&&(this._fontHolder=e.getFont(t.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(t,e){super.updateState(t,e),this.updateSizeState(t),this.updateFontState(t,e)}clone(t){let e=new QL(this.uuid,this.data,t);return e.parent=void 0,e}},ZL=class extends qL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this.curves=[],this.extremasBBox={min:[0,0],max:[0,0]},this.updateState(e,i)}computeExtremas(){0===this.curves.length&&this.computeCurves();let t=this.curves.map(t=>UL.extremas(t)),e=[1/0,1/0],i=[-1/0,-1/0];for(let n=0,r=t.length;n<r;n++){let r=t[n];r[0][0]<e[0]&&(e[0]=r[0][0]),r[0][1]<e[1]&&(e[1]=r[0][1]),r[1][0]>i[0]&&(i[0]=r[1][0]),r[1][1]>i[1]&&(i[1]=r[1][1])}return this.extremasBBox.min=[e[0],e[1]],this.extremasBBox.max=[i[0],i[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let i=1,n=this.data.points.length;i<n;i++){let t=this.data.points[i].data,e=this.data.points[i-1].data,n={start:e.position,cp1:e.controlNext.position,cp2:t.controlPrevious.position,end:t.position};this.curves.push(n)}let t=this.data.points[0].data,e=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let i={start:e.position,cp1:e.controlNext.position,cp2:t.controlPrevious.position,end:t.position};this.curves.push(i)}}getCenter(){let[t,e]=this.extremasBBox.min,[i,n]=this.getHalfSize();return[t+i,e+n]}getHalfSize(){let{min:t,max:e}=this.extremasBBox;return[.5*(e[0]-t[0]),.5*(e[1]-t[1])]}innerDraw(t){for(let n=0,r=this.data.points.length;n<r;n++){let e=this.data.points[n].data;if(0===n){let[i,n]=e.position;t.moveTo(i,n)}else{let i=this.data.points[n-1].data,[r,s]=i.controlNext.position,[a,o]=e.controlPrevious.position,[l,h]=e.position,c={start:i.position,cp1:i.controlNext.position,cp2:e.controlPrevious.position,end:e.position};UL.derive(c),t.bezierCurveTo(r,s,a,o,l,h)}}let e=this.data.points[0].data,i=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[n,r]=i.controlNext.position,[s,a]=e.controlPrevious.position,[o,l]=e.position;t.bezierCurveTo(n,r,s,a,o,l)}}updateState(t,e){super.updateState(t,e),this.computeExtremas()}clone(t){let e=new ZL(this.uuid,this.data,t);return e.parent=void 0,e}};(t=>{function e(t,e,i,n=!1){let r=t-2*e+i;if(0!==r){let n=-Math.sqrt(Math.abs(e*e-t*i)),s=-t+e;return[-(n+s)/r,-(-n+s)/r]}return e!==i&&0===r?[(2*e-i)/(2*(e-i))]:[]}t.derive=function(t){let e=t.start,i=t.cp1,n=t.cp2,r=t.end,s={start:[3*(i[0]-e[0]),3*(i[1]-e[1])],cp:[3*(n[0]-i[0]),3*(n[1]-i[1])],end:[3*(r[0]-n[0]),3*(r[1]-n[1])]};return t.derivative=s,s.derivative=kL.derive(s),s},t.droot=function(i){let n=i.derivative??t.derive(i),r=n.start,s=n.cp,a=n.end;return[e(r[0],s[0],a[0]),e(r[1],s[1],a[1])]},t.extremas=function(e){let[i,n]=t.droot(e),r=[e.start[0],e.end[0]],s=[e.start[1],e.end[1]];for(let a of i)r.push(t.compute(e,Math.min(1,Math.max(0,a)))[0]);for(let a of n)s.push(t.compute(e,Math.min(1,Math.max(0,a)))[1]);return r.sort((t,e)=>t-e),s.sort((t,e)=>t-e),[[r[0],s[0]],[r[r.length-1],s[s.length-1]]]},t.compute=function(t,e){if(0===e)return[...t.start];if(1===e)return[...t.end];let i=1-e,n=i*i,r=e*e,s=n*i,a=n*e*3,o=i*r*3,l=e*r;return[s*t.start[0]+a*t.cp1[0]+o*t.cp2[0]+l*t.end[0],s*t.start[1]+a*t.cp1[1]+o*t.cp2[1]+l*t.end[1]]}})(UL||(UL={})),(t=>{t.derive=function(t){let e=t.start,i=t.cp,n=t.end,r={start:[2*(i[0]-e[0]),2*(i[1]-e[1])],end:[2*(n[0]-i[0]),2*(n[1]-i[1])]};return r.derivative=VL.derive(r),t.derivative=r,r},t.droot=function(e){let i=e.derivative??t.derive(e),n=i.start,r=i.end;return[n[0]!==r[0]?n[0]/(n[0]-r[0]):0,n[1]!==r[1]?n[1]/(n[1]-r[1]):0]},t.compute=function(t,e){if(0===e)return[...t.start];if(1===e)return[...t.end];let i=1-e,n=i*i,r=i*e*2,s=e*e;return[n*t.start[0]+r*t.cp[0]+s*t.end[0],n*t.start[1]+r*t.cp[1]+s*t.end[1]]}})(kL||(kL={})),(t=>{t.derive=function(t){let e=t.start,i=t.end,n=[i[0]-e[0],i[1]-e[1]];return t.derivative=n,t.derivative},t.compute=function(t,e){if(0===e)return[...t.start];if(1===e)return[...t.end];let i=t.start,n=t.end;return[i[0]+(n[0]-i[0])*e,i[1]+(n[1]-i[1])*e]}})(VL||(VL={}));var KL=class extends wL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.width=0,this.height=0,this.clipped=!0,this.background=new YL(t+"-background",pw.defaultData,i),this.background.parent=this,this.updateState(e,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(t){this.background.cornerRadius=t}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(t,e,i){super.updateWorldMatrix(t,e,i),this.background?.updateWorldMatrix(t,e,i)}draw(t){if(!this.visible)return;t.save();let e=this.width,i=this.height;this.applyTransforms(t),this.background.width=e,this.background.height=i,this.background.draw(t),this.clipped&&t.clipRect(0,0,e,i,...this.cornerRadius),this.innerDrawChildren(t),t.restore()}getCenter(){return[.5*this.width,.5*this.height]}getHalfSize(){return[.5*this.width,.5*this.height]}updateCornerState(t){void 0!==t.cornerRadius&&(this.cornerRadius=t.cornerRadius)}updateSizeState(t){let e=!1;void 0!==t.width&&(this.width="number"==typeof t.width?t.width:this.width,e=!0),void 0!==t.height&&(this.height="number"==typeof t.height?t.height:this.height,e=!0),e&&this.updateWorldMatrix(!0,!1,!0)}updateState(t,e){super.updateState(t,e),this.updateSizeState(t),this.updateCornerState(t),void 0!==t.fill&&this.fill.update(t.fill),void 0!==t.stroke&&this.stroke.update(t.stroke),void 0!==t.dropShadow&&this.dropShadow.update(t.dropShadow),void 0!==t.innerShadow&&this.innerShadow.update(t.innerShadow),void 0!==t.layerBlur&&this.layerBlur.update(t.layerBlur),void 0!==t.backgroundBlur&&this.backgroundBlur.update(t.backgroundBlur),void 0!==t.clipped&&(this.clipped=t.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),0===t.type&&(ev(t.path,["fill"])?this.fill.update(t.props):ev(t.path,["stroke"])?this.stroke.update(t.props):ev(t.path,["dropShadow"])?this.dropShadow.update(t.props):ev(t.path,["innerShadow"])?this.innerShadow.update(t.props):ev(t.path,["layerBlur"])?this.layerBlur.update(t.props):ev(t.path,["backgroundBlur"])?this.backgroundBlur.update(t.props):this.resetBBoxNeedsUpdate())}clone(t){let e=new KL(this.uuid,this.data,t);e.parent=void 0;for(let i of this.children)e.add(i.clone(t));return e}},JL=h(g(),1),$L=class extends qL{constructor(t,e,i){super(t,e,i),this.uuid=t,this.data=e,this._pathBBox=new DOMRect,this.path="",this.updateState(e,i),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let t=document.createElementNS("http://www.w3.org/2000/svg","svg"),e=document.createElementNS("http://www.w3.org/2000/svg","path");document.body.appendChild(t),e.setAttribute("d",this.path),t.appendChild(e),this._pathBBox=e.getBBox(),t.remove()}innerDraw(t){t.path(this.path)}intersectsInLocalSpace(t,e){return t>=this._pathBBox.x&&t<=this._pathBBox.x+this._pathBBox.width&&e>=this._pathBBox.y&&e<=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(t,e){super.updateState(t,e),void 0!==t.path&&(this.path=t.path,this.computeSVGBBox())}clone(t){let e=new $L(this.uuid,this.data,t);return e.parent=void 0,e}};var tB=class{constructor(t,e,i){this.uuid=t,this.data=e,this.group=new SL(tB.GROUP_ID,{...vw.defaultData},i),this.createChildrenObjects(e.objects,this.group,i)}createObject(t,e,i,n,r,s){let a=function(t,e,i){switch(e.type){case"ellipse2d":return new XL(t,e,i);case"rectangle2d":return new YL(t,e,i);case"text2d":return new QL(t,e,i);case"vector2d":return new ZL(t,e,i);case"path2d":return new $L(t,e,i);case"frame2d":return new KL(t,e,i);default:return new SL(t,e,i)}}(t,e,s);a&&(n.add(a),n.children.splice(r,0,n.children.pop()),a.updateWorldMatrix(),i.length>0&&(a instanceof SL||a instanceof KL)&&this.createChildrenObjects(i,a,s))}createChildrenObjects(t,e,i){let n=0;for(let r of t)this.createObject(r.id,r.data,r.children,e,n,i),n+=1}draw(t){this.group.draw(t)}updateEntityByOp(t,e,i,n){let r=this.find(t);if(r)try{r.updateByOp(e,i,{shared:n})}catch(ky){}}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let i=null===t.parent?this.group:this.find(t.parent);void 0!==i&&i instanceof wL&&(this.createObject(t.id,t.data,t.children,i,t.localIndex,e),i.requestRender())}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0!==e&&void 0!==e.parent&&e.parent instanceof wL){let t=e.parent;e.resetBBoxNeedsUpdate(),t?.remove(e),t?.requestRender()}}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0!==e){let i=e.parent,n=null===t.parent?this:this.find(t.parent);if(n instanceof wL||n===this){n.add(e);let r=t.localIndex;n.children.splice(r,0,n.children.pop()),e.updateWorldMatrix(!0,!1,!0),i?.requestRender(),e.requestRender()}e.resetBBoxNeedsUpdate()}}}add(t){this.group.add(t)}remove(t){this.group.remove(t)}traverse(t){this.group.traverse(e=>{e!==this.group&&t(e)})}intersectsChildren(t,e,i,n=!1,r=[]){return this.group.intersectsChildren(t,e,i,n,r,!0)}intersectsChildrenReverse(t,e,i,n=!1,r=[]){return this.group.intersectsChildrenReverse(t,e,i,n,r,!0)}find(t){return this.group.find(t)}get children(){return this.group.children}project(t,e){return this.group.project(t,e)}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let i=[],n=e;for(;n!==this.group;){let t=n;n=n.parent;let e=n.children.indexOf(t);i.splice(0,0,e)}return{entity:e,sortKey:i}}getAllSorted(t){let e=[];for(let i of t){let t=this.getWithSortKey(i.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>Hm(t.sortKey,e.sortKey)),e.map(t=>t.entity)}},eB=tB;function iB({constraints:t,newParentWidth:e,newParentHeight:i,initialParentWidth:n,initialParentHeight:r,objectInitialWidth:s,objectInitialHeight:a,objectInitialPosition:o}){let{horizontalConstraint:l,verticalConstraint:h}=t,c=e-n,d=i-r,u=s,p=a,f=o[0],m=o[1];if(0!==l)if(1===l)f+=c;else if(3===l)f+=c/2;else if(2===l)u=Math.max(1,u+c);else if(4===l){let t=e/n;u*=t,f*=t}if(0!==h)if(1===h)m+=d;else if(3===h)m+=d/2;else if(2===h)p=Math.max(1,p+d);else if(4===h){let t=i/r;p*=t,m*=t}return{width:u,height:p,position:[f,m]}}eB.GROUP_ID="scene2d",h(g(),1);var nB=new Wn(-1,1,1,-1,0,1),rB=new class extends Qi{constructor(){super(),this.setAttribute("position",new Vi([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Vi([0,2,0,0,2,0],2))}},sB=new vn({defines:{},uniforms:{tDiffuse:new $l(null)},vertexShader:"\n\tvarying vec2 vUv;\n\tvoid main() {\n\t\tvUv = uv;\n\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t}",fragmentShader:"\n\tuniform sampler2D tDiffuse;\n\tvarying vec2 vUv;\n\tvoid main() {\n\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\tgl_FragColor = texel;\n\t}"}),aB=new class{constructor(t){this._mesh=new cn(rB,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,nB)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}(sB),oB=null,lB=null,hB=cL.identity(),cB=class{constructor(t,e,i,n){this.uuid=t,this.width=e,this.height=i,this.context=n,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 t=this.width,e=this.height,i=this.dpr;this.renderer.dpr=this.isScreenSpace?i:Math.floor(2048/Math.max(t,e)),this.renderer.setSize(t,e)},this.onFrameOverrideObjectEvent=t=>{if(void 0!==t.target?.uuid){let e=this.frameRoot?.find(t.target.uuid);e&&e.dispatchEvent({...t,target:e})}},this.scene2d=new eB(Wt.generateUUID(),bw.defaultData,{dpr:window.devicePixelRatio,shared:n.shared}),this.canvas=(null===oB&&(oB=document.createElement("canvas")),oB),this.renderer=(t=>(null===lB&&(lB=new zL(t)),lB))(this.canvas),this.promise=this.init(),this.renderTarget=new ge(1,1,{type:et,stencilBuffer:!1,depthBuffer:!1}),n.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=n.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new Na(this.canvas)),this._canvasTexture}
2async init(){this.renderer instanceof zL&&(this.renderer.wasmURL=LP.skiaWasmUrl),await this.renderer.init()}render(t){if(this.isFrameDirty){this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),sB.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;let e=t.getRenderTarget();t.setRenderTarget(this.renderTarget),t.clear(),aB.render(t),t.setRenderTarget(e),this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(t,e,i,n){this.scene2d.updateEntityByOp(t,e,i,n),this.applySize()}updateTreeByOp(t,e){this.scene2d.updateTreeByOp(t,e),this.applySize()}applyOverrides(t){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let e=t?.width??this.width,i=t?.height??this.height;this.frameOverride.width=e,this.frameOverride.height=i,this.frameOverride.localMatrix=hB,this.isScreenSpace&&(this.frameOverride.fill.color=ix.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:e,height:i},dB({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(t,e=window.devicePixelRatio){let i=Math.max(1,t?.width??this.width),n=Math.max(1,t?.height??this.height);this.dpr=e,this.width=i,this.height=n,this._innerApplySize();let r=1;(i*e<512||n*e<512)&&(r=Math.max(512/(i*e),512/(n*e))),this.renderTarget.setSize(i*e*r,n*e*r),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(t),this.frameOverride?.requestRender()}applyFrame(t){let e=this.context.scene.find2D(t);if(e&&e instanceof KL)return this.disposeFrameOverride(),this.frameRoot=e,this.frameOverride=e.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(t=>{t.addEventListener("beginState",this.onFrameOverrideObjectEvent)}),this.frameOverride.traverse(t=>{t.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),e}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(t){return this.scene2d.find(t)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(t=>{t.removeEventListener("beginStateChange",this.onFrameOverrideObjectEvent)}),this.frameOverride?.traverse(t=>{t.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function dB({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){if(t instanceof KL&&e instanceof KL||t instanceof SL&&e instanceof SL)for(let a=0,o=t.children.length;a<o;a++){let o=t.children[a],l=e.children[a];o&&l&&o.uuid===l.uuid&&uB({objectOverride:o,objectRoot:l,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s})}}function uB({objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s}){let[a,o]=function(t){if(fB(t))return[t.width,t.height];if(t instanceof $L){let[e,i]=t.getHalfSize();return[2*e,2*i]}if(t instanceof SL){let[e,i]=t.recursiveBBox.getHalfSize();return[2*e,2*i]}return[0,0]}(e),{width:l,height:h,position:c}=iB({constraints:t.data,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:o,objectInitialPosition:e.position});if(t.position=c,t.data={...t.data,position:c},t.states)for(let d in t.states)pB({stateId:d,objectOverride:t,objectRoot:e,newParentWidth:i,newParentHeight:n,initialParentWidth:r,initialParentHeight:s});if(fB(t)||t instanceof SL)fB(t)&&(t.width=l,t.height=h,t.data={...t.data,width:l,height:h}),dB({objectOverride:t,objectRoot:e,newParentWidth:l,newParentHeight:h,initialParentWidth:a,initialParentHeight:o});else if(t instanceof $L){let i=e,n=0!==a?l/a:1,r=0!==o?h/o:1;t.path=function(t,e=1,i=1){if(e<=0||i<=0)return t;let n=(0,JL.parseSVG)(t).map(t=>{let n={...t};
2return"x"in n&&(n.x=n.x*e),"y"in n&&(n.y=n.y*i),"x1"in n&&(n.x1=n.x1*e),"x2"in n&&(n.x2=n.x2*e),"y1"in n&&(n.y1=n.y1*i),"y2"in n&&(n.y2=n.y2*i),"rx"in n&&(n.rx=n.rx*e),"ry"in n&&(n.ry=n.ry*i),n});return function(t){let e,i=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return t.map(t=>{let n=[];i.forEach(e=>{if(e in t){let i=1*t[e];n.length&&i>=0&&n.push(","),n.push(i)}});let r=(e===t.code?n[0]<0?"":",":t.code)+n.join("");return e=t.code,r}).join("")}(n)}(i.path,n,r),t.data={...t.data,path:t.path}}}function pB({stateId:t,objectOverride:e,objectRoot:i,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let o=e.states?.[t],l=i.states?.[t];if(o&&l){let{width:i,height:h,position:c}=iB({constraints:e.data,newParentWidth:n,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:xw.isResizeable(l)?l.width:0,objectInitialHeight:xw.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(e.states[t],{position:c}),xw.isResizeable(o)&&Object.assign(e.states[t],{width:i,height:h})}}function fB(t){return t instanceof YL||t instanceof KL||t instanceof XL||t instanceof QL}var mB=class extends(E_(da)){constructor(t,e,i){super(),this.data=e,this.bgColor=new oE(1,1,1,1),this.fog=null,this.backupFog=new ca(16777215,.1,2e3),this.fogUseBGColor=!1,this.isActive=!1,this.aoColor=new le,this.penumbraSizeArrayCache=null,this.super_Entity(t,e),this.personalCamera=new UI(sx,{...ub.defaultData,...e.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new bl(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),e.uiScene?this.uiScene=new eB((Array.isArray(t)?t[0]:t)+"-ui",e.uiScene,{dpr:window.devicePixelRatio,shared:i.shared}):e.uiFrame&&this.createUICanvas(e.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(t,e){this.uiCanvas=new cB(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,e),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(t),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(t){this.bgColor=t,!0===this.fogUseBGColor&&(this.backupFog.color=t)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(t,e){void 0!==t.color&&(this.ambientLight.color=gT(t.color,e)),void 0!==t.intensity&&(this.ambientLight.intensity=t.intensity),void 0!==t.enabled&&(t.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(t){this.isActive=!0,t.fog=this.fog,this.traverseEntity(t=>{t instanceof WI&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(t=>{if(t instanceof MD)if(Array.isArray(t.material))for(let e of t.material)e.needsUpdate=!0;else t.material.needsUpdate=!0,t.material.dispose()})}updateShadow(t){void 0!==t.softShadowQuality&&this.isActive&&((t="medium")=>{if(ZR===t)return!1;ZR=t;let e=(t=>{switch(t){case"low":return 8;case"medium":default:return 16;case"high":return 32}})(t);Ln.shadowmap_pars_fragment=(t=>`\n\n// PCSS implementation based on:\n// https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/\n// NOTE: This number affects how big the shadow blur can\n// possibly get. Bigger number == bigger blur, but less precise results\n\nconst float gPenumbraFilterSize = 80.0;\nconst int gPenumbraSamples = ${t};\nconst int gShadowSamples = ${t};\nconst float gShadowSamplesRpc = 1.0f / float(gShadowSamples);\n\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2\n\n #endif\n\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n #endif\n\n #if NUM_POINT_LIGHT_SHADOWS > 0\n\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n #endif\n\n /*\n #if NUM_RECT_AREA_LIGHTS > 0\n\n // TODO (abelnation): create uniforms for area light shadows\n\n #endif\n */\n\nfloat computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius)\n{\n float penumbra = 1.0;\n float blockerDepthAvg = 0.0;\n float blockerCount = 0.0;\n\n #pragma unroll_loop_start\n for(int i = 0; i < gPenumbraSamples; i ++)\n {\n vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar;\n float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) );\n\n if(depth < compare + 0.0001)\n {\n blockerDepthAvg += depth;\n blockerCount++;\n }\n }\n #pragma unroll_loop_end\n\n if (blockerCount > 0.0)\n {\n blockerDepthAvg /= blockerCount;\n\n // Compute penumbra\n penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg);\n penumbra *= penumbra;\n penumbra *= 200.0 * penumbraSize[min(index, 5 - 1)]; // Magic number that affects how quickly the penumbra grows\n\n return clamp(penumbra, 0.00, 1.0);\n }\n return 0.0;\n}\n\nfloat vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius)\n{\n float shadow = 0.0f;\n\n // NOTE: When using TAA, we should use screen space interleaved gradient noise\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\n float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.);\n float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius);\n if (penumbra == -1.0) {\n return 1.0;\n }\n\n #pragma unroll_loop_start\n for (int i = 0; i < gShadowSamples; i++)\n {\n vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;\n // Overall blurring offset\n vec2 offset = vogelSample * (shadowRadius * 2.);\n\n // Penumbra offset\n offset += vogelSample * (penumbra * texelScalar);\n\n shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );\n }\n #pragma unroll_loop_end\n\n return shadow * gShadowSamplesRpc;\n}\n\n\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n }\n\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n }\n\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n float occlusion = 1.0;\n\n vec2 distribution = texture2DDistribution( shadow, uv );\n\n float hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n if (hard_shadow != 1.0 ) {\n\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality\n softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n }\n return occlusion;\n\n }\n\n float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n float shadow = 1.0;\n\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n\n vec2 uv = shadowCoord.xy;
2\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n\n #elif defined( SHADOWMAP_TYPE_VSM )\n\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n #else // no percentage-closer filtering:\n\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n #endif\n\n }\n\n return shadow;\n\n }\n\n // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n // vector suitable for 2D texture mapping. This code uses the following layout for the\n // 2D texture:\n //\n // xzXZ\n // y Y\n //\n // Y - Positive y direction\n // y - Negative y direction\n // X - Positive x direction\n // x - Negative x direction\n // Z - Positive z direction\n // z - Negative z direction\n //\n // Source and test bed:\n // https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n // Number of texels to avoid at the edge of each square\n\n vec3 absV = abs( v );\n\n // Intersect unit cube\n\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n\n // Apply scale to avoid seams\n\n // two texels less per square (one texel will do for NEAREST)\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n // Unwrap\n\n // space: -1 ... 1 range for each square\n //\n // #X## dim := ( 4 , 2 )\n // # # center := ( 1 , 1 )\n\n vec2 planar = v.xy;\n\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n\n if ( absV.z >= almostOne ) {\n\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n\n } else if ( absV.x >= almostOne ) {\n\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n\n } else if ( absV.y >= almostOne ) {\n\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n\n }\n\n // Transform to UV space\n\n // scale := 0.5 / dim\n // translate := ( center + 0.5 ) / dim\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n }\n\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n float shadow = 1.0;\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n // for point lights, the uniform @vShadowCoord is re-purposed to hold\n // the vector from the light to the world-space position of the fragment.\n vec3 lightToPosition = shadowCoord.xyz;\n\n // dp = normalized distance from light to fragment position\n float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n compare += shadowBias;\n\n // bd3D = base direction 3D\n vec3 bd3D = normalize( lightToPosition );\n\n vec2 halton = haltonSequence[frameIndex];\n float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);\n float temporalAngle = temporalOffset * PI2;\n\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM )\n for (int i = 0; i < gShadowSamples;
2 i++) {\n vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;\n\n // Overall blurring offset\n vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);\n\n // NOTE: Removed for now\n // Penumbra offset\n //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y) * (penumbra * gPenumbraFilterSize);\n\n shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );\n\n }\n return shadow * gShadowSamplesRpc;\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n for (int i = 0; i < 16; i++) {\n vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;\n\n // Overall blurring offset\n vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);\n\n shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );\n\n }\n return shadow * (1.0 / 16.0);\n #else // no percentage-closer filtering\n\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare );\n\n #endif\n\n }\n\n#endif\n`)(e);let i=YR.slice();i=i.replace("getShadow( spotShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX + 3, spotShadowMap[ i ]"),i=i.replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),Ln.lights_fragment_begin=i;let n=QR.slice();return n=n.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),Ln.shadowmask_pars_fragment=n,!0})(t.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(t,e){if(t.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){this.scene.fog=this.fog}this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=gT(t.color,e),this.backupFog.near=t.near,this.backupFog.far=t.far}updateAo(t,e){void 0!==t.aoColor&&(this.aoColor=gT(t.aoColor,e))}updateByOp(t,e,i,n){let r=this.data.uiFrame;super.updateByOp(t,e,i,n);let s=e;ev(t.path,["fog"])?this.updateFog(s.fog,i.shared):ev(t.path,["ao"])?this.updateAo(s.ao,i.shared):ev(t.path,["ambient"])?this.updateAmbientLight(s.ambient,i.shared):ev(t.path,["shadow"])?this.updateShadow(s.shadow):0===t.type&&0===t.path.length&&(void 0!==t.props.uiFrame||r!==s.uiFrame)&&this.updateUIFrame(t.props.uiFrame,i)}updateUIFrame(t,e){t?(this.uiCanvas||this.createUICanvas(t,e),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(t)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(t,e){this.updateState_Entity(t,e),void 0!==t.backgroundColor&&this.setBackgroundColor(gT(t.backgroundColor,e.shared)),void 0!==t.fog&&this.updateFog(t.fog,e.shared),void 0!==t.ambient&&this.updateAmbientLight(t.ambient,e.shared),void 0!==t.ao&&this.updateAo(t.ao,e.shared),void 0!==t.shadow&&this.updateShadow(t.shadow)}createFrame(t,e){}raycast(t,e){super.raycast(t,e)}switchActiveCamera(t){t&&t.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.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=new Array(5).fill(.5);let t=0,e=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof dL&&i.visible&&t<3&&(this.penumbraSizeArrayCache[t]=i.data.penumbraSize??.5,t+=1),i instanceof mL&&i.visible&&t<2&&(this.penumbraSizeArrayCache[3+e]=i.data.penumbraSize??.5,e+=1)})}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let n=r.cloner;r_.is(r)&&(r.visible||n?.object.data.visible)&&((qI(r)||YI(r)&&this.scene.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),lz(r,t,e,!0)),i(r))}};return i(this),e}updateEntity2DByOp(t,e,i,n){this.uiCanvas?.updateEntity2DByOp(t,e,i,n)}},gB=class extends(HI(Il,iL)){constructor(t,e,i){super(),this.super_Entity(t,e),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let n=this.shadow.camera;n.fov=90,n.aspect=1,n.near=100,n.far=2500;let r=new be(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),s=new be(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z),a=new _e(r,s),o=new bh(a,new le(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let t in this.gizmos){let e=this.gizmos[t];if(e instanceof bh){let t=this.shadow.camera,i=new be(-t.far+this.position.x,-t.far+this.position.y,-t.far+this.position.z),n=new be(t.far+this.position.x,t.far+this.position.y,t.far+this.position.z);e.box.set(i,n),e.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update(
vendor: 15,275 bytes, line 2
2)}updateState(t,e){this.updateState_Light(t,e),void 0!==t.distance&&(this.distance=t.distance),void 0!==t.decay&&(this.decay=t.decay),void 0!==t.shadowRadius&&(this.shadow.radius=t.shadowRadius),void 0!==t.shadowResolution&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}},vB=class extends ID{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");void 0!==i?QC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}},yB=class extends ID{constructor(t,e,i){super(t,e,i),this._shapeId=null,this._context=i}updateState(t,e){super.updateState(t,e),this.updateShape(),this.refreshAttachedCloners(e)}updateShape(){let t,e={...this.data.geometry.extrusion.shape};for(let n in e)"string"==typeof e[n]&&(e[n]=this._context.shared.getVariable(e[n],[this.uuid,"geometry","extrusion","shape",n]));if("Custom"===e.type){let i=e.shapeId;if(i!==this._shapeId&&this.detachShape(),i){this._shapeId=i;let e=this._context.scene.find(i);e?.data&&(e.attachedPaths.add(this),t=e.geometry.userData?.shape),t||this._context.scene.addPendingCommand(()=>this.updateShape())}}else{let i;switch(e.type){case"Rectangle":i=BM;break;case"Ellipse":i=tM;break;case"Polygon":i=DM;break;case"Star":i=FM;break;default:throw new Error(`Unknown shape type: ${e.type}`)}t=i.create({parameters:e}).userData.shape}let i=this.geometry;t&&i.inputs&&(i.inputs.shapeData=t,i.build())}detachShape(){null!==this._shapeId&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}createGeometryDelayed(t){this.geometryCreateDeleyed=t.shared,this.updateShape(),this.refreshAttachedPaths(t)}updateTransformState(t,e){return super.updateTransformState(t,e)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.updateShape()}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");void 0!==i?QC(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}},xB=class extends oI{constructor(t,e,i){super(t,e,i),this.data=e}},bB=class extends(OI(ia,$I)){constructor(t,e,i){super(),"Instance"===e.type&&"string"==typeof t&&(e=this.transformAssignData(e,i)),this.super_Entity(t,e),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(t,e){let i=ew.getComponentData({scene:e.scene.data,shared:e.shared.data},t.component);if(i){let e,n;for(let r of mb.rootOverrideProps)void 0===t[r]?(void 0===e&&(e={...t}),e[r]=i.data[r]):(void 0===n&&(n={}),n[r]=t[r],void 0===e&&(e={...t}),e[r]=_g.apply(i.data[r],t[r]));return this.overrideData=n,e}return{...ab.defaultData,...t,...Im(ab.defaultData,mb.rootOverrideProps)}}updateByOp(t,e,i,n){let r;if(this.isInstanceRoot&&!n)if(e=this.transformAssignData(e,i),0===t.type&&0===t.path.length&&this.component)for(let s of mb.rootOverrideProps)s in t.props&&void 0===t.props[s]&&(void 0===r&&(r={...t,props:{...t.props}}),r.props[s]=this.component.data[s]);else if(0===t.type&&t.path.length>0&&mb.rootOverrideProps.includes(t.path[0])){let i=t.path[0];void 0===r&&(r={...t,path:[],props:{[i]:e[i]}})}super.updateByOp(r??t,e,i,n)}updateState(t,e){this.updateState_Entity(t,e)}expandInstanceChildren(t){let e=this.data;if(void 0===this.component){let i=t.scene.find(e.component)??null,n=!1;if(i!==this.oldComponent){if(this.oldComponent){let e=0;for(let i of this.children){if(!r_.is(i))break;t.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),wB(i),e+=1}this.children.splice(0,e)}n=!0}if(i){let r={};_B(t,[this.uuid],e.overrides,this,i,i,0,n,r);for(let e of this.children)if(r_.is(e)){let i=e.data;"Empty"===i.type&&i.animations&&e.traverseEntity(e=>{let i=e.dataPatched;if(e instanceof ID&&i.bones&&i.boneInverses){let i=e.dataPatched;if(i.bones&&i.boneInverses){let n=i.bones.map(e=>t.scene.find(r[e])),s=i.boneInverses.map(t=>(new Ze).fromArray(t)),a=new xa(n,s);e.bind(a,e.bindMatrix)}}else e.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function wB(t){if(t.component){let e=t.component.instances.indexOf(t);e>=0&&t.component.instances.splice(e,1);for(let i of t.children)r_.is(i)&&wB(i)}}function SB(t,e,i,n){return t.component===e&&bm(t.identity,n)?t.overrideData===i?2:1:0}function _B(t,e,i,n,r,s,a,o,l){if(a>50)return!1;if(n.component!==r){if(n.component){let t=n.component.instances.indexOf(n);t>=0&&n.component.instances.splice(t,1)}r.instances.find(t=>t===n)||r.instances.push(n),n.component=r}r instanceof bB&&r.isInstanceRoot&&r.expandInstanceChildren(t);let h=0;for(let c of r.children)if(r_.is(c)){let r=[...e,..."string"==typeof c.identity?[c.identity]:c.identity],d=fb.resolve(i,r,1);null==d||d instanceof Pg||Object.setPrototypeOf(d,Pg.prototype);let u,p=null;if(!o){let e=n.children[h];if(p=r_.is(e)?e:null,null!==p){let t=SB(p,c,d,r);u=t>=1?p.stateSelection:void 0,2!==t&&(p=null)}if(null===p&&(p=t.scene.findInstance(r)??null,null!==p)){let e=SB(p,c,d,r);if(u=e>=1?p.stateSelection:void 0,2!==e)p=null;else{let e=p.parent.children.indexOf(p);p.parent.children.splice(e,1),n.children.splice(h,0,p),p.parent===n||(p.parent=n,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),t.pendingDeletes.delete(p))}}}if(null===p){let e=d?_g.apply(c.data,d):c.data;ux.is(e.type)&&(e={...e,type:"Empty"}),p=g_.createEntity(r,e,t),p.overrideData=d,n.add(p),n.children.splice(n.children.length-1,1),n.children.splice(h,0,p),p.updateState(p.data,t),u&&p.changeSelectedState(u,t),t.scene.registerInstanceAndSetUuid(p)}if(p.isBone){l[p.identity[p.identity.length-1]]=p.uuid}h+=1,_B(t,e,i,p,c,s,a+1,o,l)}if(!o){let e=h;for(;;){let e=n.children[h];if(!r_.is(e))break;t.pendingDeletes.add(e),h+=1}n.children.splice(e,h-e)}return!0}var AB=class extends(OI(ma,$I)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}},MB=class extends ID{constructor(t,e,i){super(t,e,i),this.onBeforeRender=t=>{this.uiCanvas.render(t)},this.uiCanvas=new cB(t+"-canvas",e.geometry.width,e.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(t,e,i){super.updateByPatchedOpGeometry(t,e,i),0===t.type&&(void 0!==t.props.frame&&this.applyFrame(t.props.frame,i.shared),(void 0!==t.props.width||void 0!==t.props.height)&&this.applySize(t.props,i.shared))}applySize(t,e){let i=t?.width??this.dataPatched.geometry.width,n=t?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:n}),this.applyGeometryParametersFromFrame(e)}applyFrame(t,e){this.uiCanvas.applyFrame(t),this.applyGeometryParametersFromFrame(e),this.applyMaterialParametersFromFrame({shared:e})}applyGeometryParametersFromFrame(t){let e=this.frame;e&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:e.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=uC(this.dataPatched.geometry,t,this.data.flatShading,this))}applyMaterialParametersFromFrame(t){let e=this.frame;if(e){let i=e.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,t,!0)}}updateEntity2DByOp(t,e,i,n){this.uiCanvas.updateEntity2DByOp(t,e,i,n),t===this.frameId&&0===e.type&&(void 0!==e.props.cornerRadius?this.applyGeometryParametersFromFrame(n):ev(e.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:n}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(t){super.removeInteractionGeometry(t),this.applySize({},t)}updateGeometryInteractions(t,e){super.updateGeometryInteractions(t,e),this.applySize({width:t.width,height:t.height},e)}},CB=class{constructor(t,e,i){this.variables=[],this.currentTextureIndex=0;let n=tt,r=new da,s=new yn;s.position.z=1;let a={passThruTexture:{value:null}},o=c("uniform sampler2D passThruTexture;\n\nvoid main() {\n\n\tvec2 uv = gl_FragCoord.xy / resolution.xy;\n\n\tgl_FragColor = texture2D( passThruTexture, uv );\n\n}\n",a),l=new cn(new Rn(2,2),o);function h(i){i.defines.resolution="vec2( "+t.toFixed(1)+", "+e.toFixed(1)+" )"}function c(t,e){let i=new vn({uniforms:e=e||{},vertexShader:"void main()\t{\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:t});return h(i),i}r.add(l),this.setDataType=function(t){return n=t,this},this.addVariable=function(t,e,i){let n={name:t,initialValueTexture:i,material:this.createShaderMaterial(e),dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:q,magFilter:q};return this.variables.push(n),n},this.setVariableDependencies=function(t,e){t.dependencies=e},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 n=this.variables[i];n.renderTargets[0]=this.createRenderTarget(t,e,n.wrapS,n.wrapT,n.minFilter,n.magFilter),n.renderTargets[1]=this.createRenderTarget(t,e,n.wrapS,n.wrapT,n.minFilter,n.magFilter),this.renderTexture(n.initialValueTexture,n.renderTargets[0]),this.renderTexture(n.initialValueTexture,n.renderTargets[1]);let r=n.material,s=r.uniforms;if(null!==n.dependencies)for(let t=0;t<n.dependencies.length;t++){let e=n.dependencies[t];if(e.name!==n.name){let t=!1;for(let i=0;i<this.variables.length;i++)if(e.name===this.variables[i].name){t=!0;break}if(!t)return"Variable dependency not found. Variable="+n.name+", dependency="+e.name}s[e.name]={value:null},r.fragmentShader="\nuniform sampler2D "+e.name+";\n"+r.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){let t=this.currentTextureIndex,e=0===this.currentTextureIndex?1:0;for(let i=0,n=this.variables.length;i<n;i++){let n=this.variables[i];if(null!==n.dependencies){let e=n.material.uniforms;for(let i=0,r=n.dependencies.length;i<r;i++){let r=n.dependencies[i];e[r.name].value=r.renderTargets[t].texture}}this.doRenderTarget(n.material,n.renderTargets[e])}this.currentTextureIndex=e},this.getCurrentRenderTarget=function(t){return t.renderTargets[this.currentTextureIndex]},this.getAlternateRenderTarget=function(t){return t.renderTargets[0===this.currentTextureIndex?1:0]},this.dispose=function(){l.geometry.dispose(),l.material.dispose();let t=this.variables;for(let e=0;e<t.length;e++){let i=t[e];i.initialValueTexture&&i.initialValueTexture.dispose();let n=i.renderTargets;for(let t=0;t<n.length;t++)n[t].dispose()}},this.addResolutionDefine=h,this.createShaderMaterial=c,this.createRenderTarget=function(i,r,s,a,o,l){return new ge(i=i||t,r=r||e,{wrapS:s=s||W,wrapT:a=a||W,minFilter:o=o||q,magFilter:l=l||q,format:nt,type:n,depthBuffer:!1})},this.createTexture=function(){let i=new Float32Array(t*e*4),n=new ga(i,t,e,nt,tt);return n.needsUpdate=!0,n},this.renderTexture=function(t,e){a.passThruTexture.value=t,this.doRenderTarget(o,e),a.passThruTexture.value=null},this.doRenderTarget=function(t,e){let n=i.getRenderTarget(),a=i.xr.enabled,h=i.shadowMap.autoUpdate,c=i.outputEncoding,d=i.toneMapping;i.xr.enabled=!1,i.shadowMap.autoUpdate=!1,i.outputEncoding=wt,i.toneMapping=0,l.material=t,i.setRenderTarget(e),i.render(r,s),l.material=o,i.xr.enabled=a,i.shadowMap.autoUpdate=h,i.outputEncoding=c,i.toneMapping=d,i.setRenderTarget(n)}}},EB=new Oi,PB=new be,TB=class{constructor(t){let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.colorAttribute=this.geometry.getAttribute("color"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(t){return this.weightAttribute=t?this.geometry.getAttribute(t):null,this}build(){let t=this.positionAttribute,e=this.weightAttribute,i=new Float32Array(t.count/3);for(let r=0;r<t.count;r+=3){let n=1;e&&(n=e.getX(r)+e.getX(r+1)+e.getX(r+2)),EB.a.fromBufferAttribute(t,r),EB.b.fromBufferAttribute(t,r+1),EB.c.fromBufferAttribute(t,r+2),n*=EB.getArea(),i[r/3]=n}this.distribution=new Float32Array(t.count/3);let n=0;for(let r=0;r<i.length;r++)n+=i[r],this.distribution[r]=n;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e,i){let n=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*n);return this.sampleFace(r,t,e,i)}binarySearch(t){let e=this.distribution,i=0,n=e.length-1,r=-1;for(;i<=n;){let s=Math.ceil((i+n)/2);if(0===s||e[s-1]<=t&&e[s]>t){r=s;break}t<e[s]?n=s-1:i=s+1}return r}sampleFace(t,e,i,n){let r=this.randomFunction(),s=this.randomFunction();return r+s>1&&(r=1-r,s=1-s),EB.a.fromBufferAttribute(this.positionAttribute,3*t),EB.b.fromBufferAttribute(this.positionAttribute,3*t+1),EB.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(EB.a,r).addScaledVector(EB.b,s).addScaledVector(EB.c,1-(r+s)),void 0!==i&&EB.getNormal(i),void 0!==n&&void 0!==this.colorAttribute&&(EB.a.fromBufferAttribute(this.colorAttribute,3*t),EB.b.fromBufferAttribute(this.colorAttribute,3*t+1),EB.c.fromBufferAttribute(this.colorAttribute,3*t+2),PB.set(0,0,0).addScaledVector(EB.a,r).addScaledVector(EB.b,s).addScaledVector(EB.c,1-(r+s)),n.r=PB.x,n.g=PB.y,n.b=PB.z),this}};function DB(t,e){let i=t,n=new Float32Array(4*e*e);for(let s=0;s<e*e;s++)n[4*s]=i[3*s],n[4*s+1]=i[3*s+1],n[4*s+2]=i[3*s+2],n[4*s+3]=0;let r=new ga(n,e,e,nt,tt);return r.needsUpdate=!0,r}var IB="\n\n // Linear Fade In\n float linearFadeIn(float t) {\n return t;\n }\n\n\n // linear fade out\n float linearFadeOut(float t) {\n return 1.0 - t;\n }\n \n float linearInOut(float t) {\n return t < 0.5 ? t : (1.0 - t); \n }\n\n // lerp\n float lerp(float a, float b, float t) {\n return a + (b - a) * t;\n }\n\n // Ease In Out Quart\n float exponentialInOut(float t) {\n return t < 0.4 ? lerp(0.0, 1.0, t / 0.4) :\n t > 0.6 ? lerp(1.0, 0.0, (t - 0.6) / 0.4) :\n 1.0;\n }\n\n // constant\n float constant(float t) {\n return 1.0;\n } \n",OB=`\n uniform sampler2D uPosition;\n uniform float uSize;\n uniform float uSizeEnd;\n uniform vec3 uWorldOffset;\n uniform vec4 uWorldQuaternion;\n // Billboard Behavior - Currently at Zero, but we can change that\n uniform float uRotation;\n uniform float uRotationEnd;\n uniform vec2 center;\n\n // Randomness\n uniform float uRandScaleFactor;
2\n uniform float uRandRotationFactor;\n\n attribute vec2 ref;\n\n varying float v_LifeLeft; // normalized lifetime 1 to 0\n varying vec2 vUv;\n varying vec2 vRef;\n\n \n\nfloat rand(vec3 co){\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvec3 applyQuaternionToVector( vec4 q, vec3 v ){\n return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );\n}\n\nvec3 applyForce(vec3 force, float mass) {\n vec3 acceleration = force / mass;\n \n return acceleration;\n}\n\n ${IB}\n`,RB="\n uniform vec4 uColor; // start color\n uniform vec4 uColor2; // end color\n uniform sampler2D uTexture; // texture\n varying float v_LifeLeft; // normalized lifetime 1 to 0\n varying vec2 vUv;\n varying vec2 vRef;\n\n float random(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n }\n "+IB+" \n \nvec3 rgb2xyz (in vec3 rgb) {\n float r = rgb.r;\n\tfloat g = rgb.g;\n\tfloat b = rgb.b;\n\n\tr = r > 0.04045 ? pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n\tfloat x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tfloat y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tfloat z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n \n vec3 xyz = vec3(\n (r * 0.4124) + (g * 0.3576) + (b * 0.1805) * 100.0,\n (r * 0.2126) + (g * 0.7152) + (b * 0.0722) * 100.0,\n (r * 0.0193) + (g * 0.1192) + (b * 0.9505) * 100.0\n );\n return(xyz);\n}\n\nvec3 xyz2lab (in vec3 xyz) {\n\tfloat x = xyz.x / 95.047;\n\tfloat y = xyz.y / 100.0;\n\tfloat z = xyz.z / 108.883;\n\n\tx = x > 0.008856 ? pow(x, 1.0 / 3.0) : (7.787 * x) + (16.0 / 116.0);\n\ty = y > 0.008856 ? pow(y, 1.0 / 3.0) : (7.787 * y) + (16.0 / 116.0);\n\tz = z > 0.008856 ? pow(z, 1.0 / 3.0) : (7.787 * z) + (16.0 / 116.0);\n\n vec3 lab = vec3((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z));\n return(lab);\n}\n\nvec3 rgb2lab(in vec3 rgb) {\n vec3 xyz = rgb2xyz(rgb);\n vec3 lab = xyz2lab(xyz);\n return(lab);\n}\n\nvec3 xyz2rgb (in vec3 xyz) {\n\tfloat x = xyz.x / 100.0;\n\tfloat y = xyz.y / 100.0;\n\tfloat z = xyz.z / 100.0;\n\t\n \n\tfloat r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tfloat g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tfloat b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\tr = r > 0.0031308 ? ((1.055 * pow(r, 1.0 / 2.4)) - 0.055) : r * 12.92;\n\tg = g > 0.0031308 ? ((1.055 * pow(g, 1.0 / 2.4)) - 0.055) : g * 12.92;\n\tb = b > 0.0031308 ? ((1.055 * pow(b, 1.0 / 2.4)) - 0.055) : b * 12.92;\n\n\tr = min(max(0.0, r), 1.0);\n\tg = min(max(0.0, g), 1.0);\n\tb = min(max(0.0, b), 1.0);\n\n\treturn(vec3(r, g, b));\n}\n\nvec3 lab2xyz (in vec3 lab) {\n float l = lab.x;\n\tfloat a = lab.y;\n\tfloat b = lab.z;\n\n \tfloat y = (l + 16.0) / 116.0;\n\tfloat x = a / 500.0 + y;\n\tfloat z = y - b / 200.0;\n\n\tfloat y2 = pow(y, 3.0);\n\tfloat x2 = pow(x, 3.0);\n\tfloat z2 = pow(z, 3.0);\n\n \ty = y2 > 0.008856 ? y2 : (y - 16.0 / 116.0) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16.0 / 116.0) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16.0 / 116.0) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100.0;\n\tz *= 108.883;\n\n\treturn(vec3(x, y, z));\n}\nvec3 lab2rgb (in vec3 lab) {\n vec3 xyz = lab2xyz(lab);\n vec3 rgb = xyz2rgb(xyz);\n return(rgb);\n}\n\n\n\n",LB=class extends vn{constructor(t,e){super(),this.needsJitter=!0,this.type="ParticleMaterial",this.easeOpacity="linearFadeIn",this.easeSize="linearFadeIn",this.useSizeEnd=!1,this.isColoringRandom=!1,this.init(t,e),this.context=e}reset(){}init(t,e){this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.easeOpacity=t.ease,this.easeSize=t.easeSize,this.layers=[],tE.startContext(tE.globalContext),this.lightLayer=new DT(0,"",{...Bx.defaultData("light","phong"),visible:!1},new BP,{},e.shared),tE.endContext(tE.globalContext),this.build()}updateState(t){void 0!==t.coloring&&(this.isColoringRandom="random"===t.coloring),void 0!==t.color&&(t.color instanceof Array?this.uniforms.uColor.value=t.color:this.uniforms.uColor.value=this.context.shared.color(t.color)),void 0!==t.color2&&(t.color2 instanceof Array?this.uniforms.uColor2.value=t.color2:this.uniforms.uColor2.value=this.context.shared.color(t.color2)),void 0!==t.size&&(this.uniforms.uSize.value=t.size[0],this.uniforms.uSizeEnd.value=t.size[1],t.size[0]!==t.size[1]?this.useSizeEnd=!0:this.useSizeEnd=!1),void 0!==t.ease&&(this.easeOpacity=t.ease,this.build()),void 0!==t.easeSize&&(this.easeSize=t.easeSize,this.build()),this.needsUpdate=!0}onBeforeCompile(t){this.build(),t.defines=this.defines,t.uniforms=this.uniforms,t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader}build(){let t=new GE;return t.needsJitter=this.needsJitter,t.addFragmentParsCode("\nlayout(location = 1) out vec4 gVelocity;\n"),t.buildShader("vertex",this.fragment),t.buildShader("fragment",this.fragment),t.addFragmentFinalCode("\n // Discard fully transparent pixels \n if (gl_FragColor.a <= 0.0) discard;\n\n gVelocity = vec4(0.0, 0.0, 0.0, 1.0);\n"),this.isColoringRandom&&t.define("USE_RANDOM_COLORING"),this.useSizeEnd&&t.define("USE_SIZE_END"),t.addVertexParsCode(OB),t.addFragmentParsCode(RB),t.addVertexFinalCode((({easeSize:t="linearFadeOut"})=>`\n vUv = uv; \n vRef = ref;\n // Normalized LifeTime 1 to 0\n float lifeLeft = texture2D(uPosition, ref).w;\n v_LifeLeft = lifeLeft;\n // Position From DataTexture Simulation\n vec3 pos = texture2D(uPosition, ref).rgb - uWorldOffset;\n // Apply World Quaternion\n pos = applyQuaternionToVector(uWorldQuaternion, pos); \n \n #ifdef USE_SIZE_END\n // Scaled Over Time\n float t = 1. - lifeLeft;\n float currentSize = mix(uSize, uSizeEnd, t); // Linearly interpolate between uSize and uSizeEnd\n vec3 scaledPosition = position * vec3(currentSize);\n #else\n // Change Size Behavior over LifeTime\n float easeSize = ${t}(1. - lifeLeft);\n // Scaled Over Time\n vec3 scaledPosition = position * vec3(uSize * easeSize);
2\n #endif\n\n // Billboard Behavior\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); \n // Randomness \n float randRef = rand(ref);\n scale *= (1.0 - (uRandScaleFactor * randRef));\n // Rotation\n float randRotation = 2.0 * PI * ( uRandRotationFactor * randRef);\n float originalRotation = (1.0 - uRotation) * 2.0 * PI;\n float originalRotationEnd = (1.0 - uRotationEnd) * 2.0 * PI;\n // OverTime\n float finalRotation = mix(originalRotation + randRotation, originalRotationEnd + randRotation, lifeLeft);\n\n vec2 alignedPosition = ( scaledPosition.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( finalRotation ) * alignedPosition.x - sin( finalRotation ) * alignedPosition.y;\n rotatedPosition.y = sin( finalRotation ) * alignedPosition.x + cos( finalRotation ) * alignedPosition.y;\n \n mat4 instanceMatrix = mat4(\n vec4(1.0, 0.0, 0.0, 0.0),\n vec4(0.0, 1.0, 0.0, 0.0),\n vec4(0.0, 0.0, 1.0, 0.0),\n vec4(pos.x, pos.y, pos.z, 1.0)\n ); \n\n mvPosition = modelViewMatrix * instanceMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition; \n`)({easeSize:this.easeSize})),t.addFragmentFinalCode((({easeOpacity:t="linearFadeOut"})=>` \n // if Particle is dead, hide it\n if (v_LifeLeft <= 0.005 ) {\n discard;\n }\n\n #ifdef USE_RANDOM_COLORING\n float randVal = random(vRef); // Generate a random value based on the reference\n vec4 color = mix(uColor, uColor2, randVal); // Interpolate between the two colors\n #else\n vec4 color = mix(uColor, uColor2, 1. - v_LifeLeft);\n #endif\n\n // Opacity over Life Time\n float finalAlpha = ${t}(1. - v_LifeLeft); \n vec4 textureColor = texture2D(uTexture, vUv).rgba; \n finalColor = textureColor.rgb * color.rgb;\n finalAlpha = color.a * textureColor.a * finalAlpha;\n \n gl_FragColor = vec4(finalColor, finalAlpha); \n\n`)({easeOpacity:this.easeOpacity})),this.vertexShader=t.getCode("vertex"),this.fragmentShader=t.getCode("fragment"),this.defines=t.defines,this.uniforms={...t.uniforms,...this.uniforms},this.extensions=t.extensions,this}get nodeMaterial(){return this}get fragment(){return this.lightLayer.node}getDefines(){return this.defines}nodeMaterialDispose(){this.layers.forEach(t=>t.dispose()),super.dispose()}},BB=class{constructor(t,e,i,n){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=t,this.type=i,this.textureSize=function(t){let e=Math.ceil(Math.sqrt(t));return Math.max(e,1)}(e);this.targetMesh="BufferGeometry"===n?.geometry.type||"Mesh"===n?.type&&n&&n.geometry.hasAttribute("position")&&n.geometry.hasAttribute("normal")?n:this.getMesh(i,1);let{positions:r,dataTexture:s,dataTextureNormals:a}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(i,1));this.positionsTexture=s,this.positionsAttribute=r,this.directionsTexture=a}createPositions(t,e){let{positions:i,normals:n}=function(t,e){let i=new cn(t.geometry,t.material),n=[],r=[],s=new be,a=new be;null!==i.geometry.index&&(i.geometry=i.geometry.toNonIndexed());let o=new TB(i).build();for(let l=0;l<e;l++)o.sample(s,a),n.push(s.x,s.y,s.z),r.push(a.x,a.y,a.z);return{positions:new Float32Array(n),normals:new Float32Array(r)}}(e,t*t);return{dataTexture:DB(i,t),positions:i,dataTextureNormals:DB(n,t)}}getMesh(t,e){let i=null;switch(t){case"SphereEmitterShape":i=new ko(.5*e,32,32);break;case"TorusEmitterShape":i=new Vo(.5*e,.3,15,40);break;case"ConeEmitterShape":i=new ao(e,e,15);break;case"BoxEmitterShape":i=new un(e,e,e);break;case"PlaneEmitterShape":i=new Rn(e,e),i.rotateX(-Math.PI/2);break;default:i=new ko(e,32,32)}return new cn(i,new Bi({color:16711680}))}applyToShader(t,e){this.size=(new be).fromArray(e.size),t.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function zB(t){let e={...t},i=bx.defaultData;e.forceFieldObjectId&&(e.colliderEntityId=e.forceFieldObjectId);let n={...i.shape,...e.shape},r={...i.renderMaterial,...e.renderMaterial};return{...i,...e,shape:n,renderMaterial:r}}var FB=class extends wi{constructor(t,e){super(),this.type="ParticleEmitter",this.debugMode=!1,this.worldS
vendor: 5,689 bytes, line 2
2pace=!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 yl,this.currentWorldPosition=new be,this.systemQuaternion=new xe,this.worldGravity=new be(0,0,0),this.directionAxis=new be(0,0,0),this.colliderV3=new be(0,0,0),this.colliderQuaternion=new xe(0,0,0,1),this.matrixAutoUpdate=!0,this.renderer=t,this.system=e,this.shared=e.context.shared;let i=e.data;this.material=new LB(i.renderMaterial,e.context),this.material.uniforms={uSize:{value:0},uSizeEnd:{value:0},uColor:{value:i.renderMaterial.color},uColor2:{value:i.renderMaterial.color2},uPosition:{value:new be(0,0,0)},uEmissionData:{value:new be(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new be(0,0,0)},uWorldQuaternion:{value:new me(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(t,e){let i=e.data;if("string"==typeof e){let i=this.shared.image(e),n=new fe(i.img);return n.needsUpdate=!0,void(t.uTexture.value=n)}if("string"!=typeof i){let e=new Image;e.onload=()=>{let i=new fe(e);i.needsUpdate=!0,t.uTexture.value=i};let n=new Blob([i],{type:"image/*"}),r=URL.createObjectURL(n);e.src=r}}updateGeometryAttributes(t,e){let i=function(t){let e=new Float32Array(t*t*2);for(let i=0;i<t;i++)for(let n=0;n<t;n++){let r=i*t+n;e[2*r+0]=i/(t-1),e[2*r+1]=n/(t-1)}return e}(e);!this.emitterShape?.positionsAttribute||t.geometry.setAttribute("ref",new ba(i,2))}applyWorldSpace(){if(!(this.system.started&&this.worldSpace&&this.positionSimRT&&this.velocitySimRT))return;let t=this.system;t.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),t.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(t,e){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset)return void this.reset();this.applyWorldSpace(),this.globalTime=t,this.positionSimRT.material.uniforms.uTime.value=t,this.emissionRateSimRT.material.uniforms.uTime.value=t;let i=1e3/e,n=this.targetFPS/i,r=this.previousRatio+(n-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=r,this.previousRatio=r;let s=this.isEmitting?this.GoEmitSomeParticles(t,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=s,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 t=this.system.colliderEntities[0],e=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(t.destroyedInAction&&e&&this.init(zB({...this.system.data,colliderEntityId:null})),!t||t.destroyedInAction)return;t.getWorldPosition(this.colliderV3),0===this.colliderV3.y&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);let i=t.data.size;this.colliderV3.fromArray(i),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),t.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(t){!this.velocitySimRT||!this.positionSimRT||(t.renderMaterial&&this.updateMaterialState(t.renderMaterial),this.updateParticleState(t))}updateVariableState(t,e){if(!this.velocitySimRT||!this.positionSimRT)return;"size"===e[2]&&this.material.updateState({size:[t,this.material.uniforms.uSizeEnd.value]}),"sizeEnd"===e[2]&&this.material.updateState({size:[this.material.uniforms.uSize.value,t]});let i=(t,e)=>{let i=[...this.system.data.shape.size];i[t]=e,this.updateParticleState({shape:{...this.system.data.shape,size:i}})};"shape_size_0"===e[2]&&i(0,t),"shape_size_1"===e[2]&&i(1,t),"shape_size_2"===e[2]&&i(2,t),"speed"===e[2]&&(this.velocitySimRT.material.uniforms.uSpeed.value=t/10),"gravity"===e[2]&&this.worldGravity.set(0,t/100,0),"noiseStrength"===e[2]&&(this.noiseStrength=t,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),"n
2oiseScale"===e[2]&&(this.noiseScale=t,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),"direction_x"===e[2]&&(this.directionAxis=this.getDirectionAxis([Number(t),this.system.data.direction[1],this.system.data.direction[2]])),"direction_y"===e[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(t),this.system.data.direction[2]])),"direction_z"===e[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(t)]))}updateMaterialState(t){this.material.updateState({...t,size:t.size?[Number(this.shared.getVariable(t.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(t.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),t.texture&&(this.setTexture(this.material.uniforms,t.texture),this.material.needsUpdate=!0)}updateParticleState(t){if(this.positionSimRT&&this.velocitySimRT){if(this.shouldReInitGPUCompute(t)&&this.init(zB(this.system.data)),void 0!==t.life&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=t.life),void 0!==t.speed&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(t.speed,[this.uuid,"particles","speed"]))/10),void 0!==t.collisionBounce&&(this.velocitySimRT.material.uniforms.uBounce.value=t.collisionBounce),void 0!==t.noiseStrength&&(this.noiseStrength=Number(this.shared.getVariable(t.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),void 0!==t.noiseScale&&(this.noiseScale=Number(this.shared.getVariable(t.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),void 0!==t.noiseSeed&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=t.noiseSeed),void 0!==t.randomMass&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=t.randomMass),void 0!==t.renderMaterial?.size){let e=this.shared.getVariable(t.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(e)}if(void 0!==t.renderMaterial?.spriteRotation&&(this.material.uniforms.uRotation.value=t.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=t.renderMaterial.spriteRotation[1]),void 0!==t.shape){let e=t.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(e[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e[2],[this.uuid,"particles","shape_size_2"]))],n={...zB(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,n)}if(void 0!==t.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!==t.direction){let e=this.getDirectionFromVariable(t.direction);this.directionAxis=this.getDirectionAxis(e),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}void 0!==t.randomRotation&&(this.material.uniforms.uRandRotationFactor.value=t.randomRotation),void 0!==t.randomScale&&(this.material.uniforms.uRandScaleFactor.value=t.randomScale)}}updateForceFieldParameters(t){!this.velocitySimRT||(void 0!==t.forceIntensity&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=t.forceIntensity),void 0!==t.forceDambing&&(this.velocitySimRT.material.uniforms.uForceDamping.value=t.forceDambing))}getDirectionAxis(t){let e=[Number(t[0])*Wt.DEG2RAD,Number(t[1])*Wt.DEG2RAD,Number(t[2])*Wt.DEG2RAD],i=new ai(e[0],e[1],e[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(t){let{birthRatePerSec:e,rootObjectType:i,colliderEntityId:n,shape:r,emitTimeDuration:s,emitTimeCycle:a,life:o,directionMode:l,noiseType:h}=t;return void 0!==e||void 0!==i||n||null===n||void 0!==a||void 0!==r||void 0!==o||void 0!==s||void 0!==l||void 0!==h}init(t){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:t.birthRatePerSec,particleMaxLifeTime:t.life,loopDuration:"infinity"===t.emitTimeCycle?0:t.emitTimeDuration}),this.particlesAmount>1e5&&(this.particlesAmount=1e5),this.emitterShape=this.createShape(t.
2shape,this.particlesAmount);let e=setInterval(()=>{if(this.emitterShape){if(isNaN(this.emitterShape.positionsTexture.source.data.data[0]))return void this.init(t);clearInterval(e)}},100);if(!this.emitterShape)return;let i=new CB(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),n=this.updateSimulationDefinition(t),r=i.addVariable("uCurrentPosition",n+"\n// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU\n// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU\n// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU\nuniform sampler2D uOriginalPosition;\nuniform float uTime;\nuniform float uSpeed; // update speed of the particles\nuniform vec3 uWorldOffset; \nuniform vec4 uWorldQuaternion;\nuniform float uMaxLifeTime;\nuniform vec3 uEmitterSize;\nuniform float uFPSRatio; // 1 for 60 FPS\n\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy,\n vec2(12.9898,78.233)))*\n 43758.5453123);\n}\nvec3 applyQuaternionToVector( vec4 q, vec3 v ){\n return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );\n}\n\nvec3 applyForce(vec3 force, float mass) {\n vec3 acceleration = force / mass;\n \n return acceleration;\n }\n \n\nvoid main() {\n vec2 vUv = gl_FragCoord.xy / resolution.xy;\n vec3 position = texture2D( uCurrentPosition, vUv ).xyz;\n float currentLife = texture2D( uCurrentPosition, vUv ).w; // from 1 to 0\n float isSpawning = texture2D( uCurrentEmissionRate, vUv ).r; // 1. = spawning, 0. = not spawning\n float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active\n float timeStart = texture2D( uCurrentEmissionRate, vUv ).b; // timeStart in seconds when the particle was emitted\n vec3 originalPosition = ((texture2D( uOriginalPosition, vUv ).xyz) * uEmitterSize);\n vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz;\n float collisionFlag = texture2D( uCurrentVelocity, vUv ).w; // 1. = collided, 0. = not collided\n float lifeTime = uMaxLifeTime;
2\n\n // Calculate the position adjustment based on collision\n // if (collisionFlag > .5) { \n float isColliding = step(0.5, collisionFlag); // 1.0 if collisionFlag > 0.5, otherwise 0.0\n float bounceOffset = 3.0 * isColliding; // Becomes 3.0 if colliding, 0.0 otherwise\n vec3 collisionAdjustedVelocity = velocity * (1.0 + bounceOffset);\n\n // Update position based on collision or normal movement\n vec3 fpsVelocity = velocity * min(uFPSRatio, 5.0);\n position += mix(fpsVelocity, collisionAdjustedVelocity, isColliding);\n\n // EMISSION RATE - BIRTH\n // if (isSpawning == 1.0) {\n // Better Approach to avoid If statement\n vec3 newPosition = applyQuaternionToVector(uWorldQuaternion, originalPosition) + uWorldOffset;\n originalPosition = mix(originalPosition, newPosition, isSpawning);\n position = mix(position, originalPosition, isSpawning);;\n timeStart = mix(timeStart, uTime, isSpawning);\n\n // Calculate timeLeft for life normalization\n float timeLeft = max(lifeTime - (uTime - timeStart), 0.0
2);\n float life_Normalize = timeLeft / lifeTime;\n\n // Use isActive to blend between the calculated color and black\n vec4 activeColor = vec4(position, life_Normalize);\n // if (isActive == 1.0) {\n gl_FragColor = mix(vec4(0.0), activeColor, isActive);\n\n}\n",this.emitterShape.positionsTexture),s=i.addVariable("uCurrentVelocity",n+"\n// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU\n// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU\n// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU\nuniform sampler2D uOriginalPosition;\nuniform sampler2D uDirections; \nuniform vec3 uDirectionsAxis;\nuniform vec4 uWorldQuaternion;\nuniform vec3 uGravity; \nuniform float uNoiseStrength; // Variation of the noise\nuniform float uNoiseScale; // Scale of the noise\nuniform float uNoiseSeed; // Seed of the noise\nuniform float particleSize;\nuniform float uSpeed; // update speed of the particles\nuniform float uRandomMassFactor;\n\n// COLLIDER\nuniform vec3 uColliderPos; // Collider Position\nuniform vec3 uColliderSize; // Collider Dimension\nuniform vec4 uColliderQuaternion; // Collider Rotation\nuniform vec4 uColliderQuaternionInvert; // Collider Rotation\nuniform float uBounce; // Bounce factor\nuniform float uForceDamping;\nuniform float uForceIntensity;\n\n\n\n\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r)\n {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n vec3 fade(vec3 t) {\n return t*t*t*(t*(t*6.0-15.0)+10.0);\n}\n\n float snoise(vec3 v)\n {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n \n // Permutations\n i = mod289(i);\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n }\n \n vec3 snoiseVec3( vec3 x ){\n \n float s = snoise(vec3( x ));\n float s1 = snoise(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 ));\n float s2 = snoise(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 ));\n vec3 c = vec3( s , s1 , s2 );\n return c;\n \n }\n \n \n vec3 curlNoise( vec3 p, float seed){\n p += seed;\n const float e = .1;\n vec3 dx = vec3( e , 0.0 , 0.0 );\n vec3 dy = vec3( 0.0 , e , 0.0 );
2\n vec3 dz = vec3( 0.0 , 0.0 , e );\n \n vec3 p_x0 = snoiseVec3( p - dx );\n vec3 p_x1 = snoiseVec3( p + dx );\n vec3 p_y0 = snoiseVec3( p - dy );\n vec3 p_y1 = snoiseVec3( p + dy );\n vec3 p_z0 = snoiseVec3( p - dz );\n vec3 p_z1 = snoiseVec3( p + dz );\n \n float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;\n float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;\n float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;\n \n const float divisor = 1.0 / ( 2.0 * e );\n return normalize( vec3( x , y , z ) * divisor );\n \n }\n\n\n// Classic Perlin noise\nfloat cnoise(vec3 P)\n{\n vec3 Pi0 = floor(P); // Integer part for indexing\n vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1\n Pi0 = mod289(Pi0);\n Pi1 = mod289(Pi1);\n vec3 Pf0 = fract(P); // Fractional part for interpolation\n vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n vec4 iy = vec4(Pi0.yy, Pi1.yy);\n vec4 iz0 = Pi0.zzzz;\n vec4 iz1 = Pi1.zzzz;\n\n vec4 ixy = permute(permute(ix) + iy);\n vec4 ixy0 = permute(ixy + iz0);\n vec4 ixy1 = permute(ixy + iz1);\n\n vec4 gx0 = ixy0 * (1.0 / 7.0);\n vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n vec4 sz0 = step(gz0, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\n vec4 gx1 = ixy1 * (1.0 / 7.0);\n vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx1 = fract(gx1);\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n vec4 sz1 = step(gz1, vec4(0.0));\n gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\n vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);\n vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);\n vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);\n vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);\n vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);\n vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);\n vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);\n vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);\n\n vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n g000 *= norm0.x;\n g010 *= norm0.y;\n g100 *= norm0.z;\n g110 *= norm0.w;\n vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n g001 *= norm1.x;\n g011 *= norm1.y;\n g101 *= norm1.z;\n g111 *= norm1.w;\n\n float n000 = dot(g000, Pf0);\n float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n float n111 = dot(g111, Pf1);\n\n vec3 fade_xyz = fade(Pf0);\n vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); \n return 2.2 * n_xyz;\n}\n\n\nvec3 fbm_vec3(vec3 p, float frequency, float offset)\n{\n return vec3(\n cnoise((p+vec3(offset))*frequency),\n cnoise((p+vec3(offset+20.0))*frequency),\n cnoise((p+vec3(offset-30.0))*frequency)\n );\n}\n\n\nfloat rand(vec2 co){\n return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);\n}\nvec3 applyQuaternionToVector( vec4 q, vec3 v ){\n return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );\n } \nvec3 applyForce(vec3 force, float mass) {\n vec3 acceleration = force / mass;\n \n return acceleration;\n}\n\nvec4 conjugate(vec4 q) {\n return vec4(q.w, -q.x, -q.y, -q.z);\n}\n\n// Function to compute the normal of the ellipsoid at a given point\nvec3 ellipsoidNormal(vec3 p, vec3 radii) {\n return normalize(p / (radii * radii));\n}\n\nfloat friction = .3;\n\nvoid main() {\n vec2 vUv = gl_FragCoord.xy / resolution.xy;\n vec3 position = texture2D( uCurrentPosition, vUv ).xyz;\n vec3 originalPosition = texture2D( uOriginalPosition, vUv ).xyz;\n float timeLeft = texture2D( uCurrentPosition, vUv ).w;\n vec3 directions = texture2D( uDirections, vUv ).xyz; \n vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz;\n float mass = rand(originalPosition.xy) * 0.5 + 0.5;
2\n float isSpawning = texture2D( uCurrentEmissionRate, vUv ).x; // 1. = spawning, 0. = not spawning\n float isActive = texture2D( uCurrentEmissionRate, vUv ).y; // 1. = active, 0. = not active\n float collisionFlag =texture2D( uCurrentVelocity, vUv ).w; // Indicate collision\n\n // Randomness Mass\n mass = (1.0 - (uRandomMassFactor * mass));\n \n if (isActive == 1.0) {\n // **************************************************************\n // FORCES NOISES\n // **************************************************************\n #ifdef USE_CURL_NOISE\n if (uNoiseScale > 0.0 ) {\n velocity = curlNoise(position * uNoiseScale * .002, uNoiseSeed) * ( uNoiseStrength + 1.0) * .05 * uSpeed;\n }\n // Variation of the noise Over Time\n if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) {\n velocity += curlNoise( position, uNoiseSeed) * uNoiseStrength * 0.05 * uSpeed;\n }\n #endif\n // **************************************************************\n #ifdef USE_SIMPLEX_NOISE\n if (uNoiseScale > 0.0 ) {\n velocity = vec3(snoise(position * uNoiseScale * .001) * ( uNoiseStrength + 1.0) * .1);\n velocity *= uSpeed;\n }\n // Variation of the noise Over Time\n if (uNoiseStrength > 0.0 && uNoiseScale == 0.0) {\n velocity += vec3(snoise(position * uNoiseStrength * .001) * .05 * uSpeed);\n }\n #endif\n // ************************************************************** \n #ifdef USE_FBM_NOISE\n if (uNoiseScale > 0.0 ) {\n velocity = fbm_vec3(position * uNoiseScale * .001, ( uNoiseStrength + 1.0), uNoiseSeed);\n velocity *= uSpeed;\n }\n // Variation of the noise Over Time\n if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { \n velocity += fbm_vec3(position * uNoiseStrength * .001, ( uNoiseStrength + 1.0), uNoiseSeed) * .1 * uSpeed;\n }\n #endif\n\n // COLLIDER\n \n #ifdef USE_COLLIDER\n float restitution = max(uBounce * 2., .01); // Energy Loss\n // SPHERE COLLIDER\n // **************************************************************\n #ifdef USE_SPHERE_COLLIDER \n // Convert collider size to radii (assuming uColliderSize is the diameter in each axis)\n vec3 radii = uColliderSize;\n // Adjust position relative to collider\n vec3 relPos = position - uColliderPos;\n // Apply rotation of the collider to the relative position\n relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); \n // Scale relative position by radii (for ellipsoid collision detection)\n vec3 scaledPos = relPos / radii;\n // Calculate ellipsoidal distance\n float dist = length(scaledPos); // Distance in terms of ellipsoid\n \n // Check for c
2ollision\n if (dist <= 1. + particleSize / length(radii) && collisionFlag == 0.0) {\n // Compute the normal at the collision point, accounting for particle size\n vec3 adjustedPos = scaledPos * (1.0 + particleSize / length(radii)); \n // Compute the normal at the collision point\n vec3 normal = ellipsoidNormal(adjustedPos, radii);\n // Rotate the normal back to world space\n normal = applyQuaternionToVector(uColliderQuaternion, normal);\n // Reflect the velocity vector off the normal\n velocity = reflect(velocity, normal) * restitution;\n\n collisionFlag = 1.0;\n } else {\n collisionFlag = 0.0;\n }\n #endif\n\n // BOX COLLIDER or PLANE COLLIDER \n // **************************************************************\n #ifdef USE_BOX_COLLIDER\n // Box dimensions and repulsion variables\n vec3 boxHalfSize = uColliderSize / 2.0;\n // Convert world position to box's local space\n vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); \n // Collision detection\n vec3 localDistance = abs(localPos) - boxHalfSize;\n float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); \n\n // Collision Detected\n if (distToSurface <= particleSize * 0.5 && collisionFlag == 0.0) { \n // Find the nearest face normal for bounce direction\n vec3 normal;\n if (localDistance.x > localDistance.y && localDistance.x > localDistance.z) {\n normal = vec3(sign(localPos.x), 0.0, 0.0);\n } else if (localDistance.y > localDistance.z) {\n normal = vec3(0.0, sign(localPos.y), 0.0);\n } else {\n normal = vec3(0.0, 0.0, sign(localPos.z));\n } \n // Rotate normal back to world space\n normal = applyQuaternionToVector(uColliderQuaternion, normal); \n // Reflect velocity and apply repulsion force\n velocity = reflect(velocity, normal) * restitution;\n \n collisionFlag = 1.0;\n } else {\n collisionFlag = 0.0;\n }\n #endif \n #endif \n // END COLLIDER \n\n // ATTRACTION\n \n #ifdef USE_ATTRACTOR\n\n #ifdef USE_SPHERE_COLLIDER \n // Convert collider size to radii (assuming uColliderSize is the diameter in each axis)\n vec3 radii = uColliderSize;\n // Adjust position relative to collider\n vec3 relPos = position - uColliderPos;\n // Apply rotation of the collider to the relative position\n relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); \n // Scale relative position by radii (for ellipsoid collision detection)\n vec3 scaledPos = relPos / radii;\n // Calculate ellipsoidal distance\n float distToSurface = length(scaledPos); // Distance in terms of ellipsoid\n float insideCheck = 1.0;\n\n #endif\n\n\n #ifdef USE_BOX_COLLIDER\n // Box dimensions\n vec3 boxHalfSize = uColliderSize / 2.0;\n // Convert world position to box's local space\n vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); \n vec3 localDistance = abs(localPos) - boxHalfSize;\n float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));\n float insideCheck = particleSize;\n #endif \n \n // Apply vortex force inside the Helper\n #ifdef USE_FORCE_LOCAL_SPACE\n if (distToSurface <= insideCheck ) { \n // Define parameters for the attractor field\n #ifdef USE_SPHERE_COLLIDER \n float attractorStrength = (1.0 - distToSurface ) * uForceIntensity; // Adjust as needed\n #endif\n\n #ifdef USE_BOX_COLLIDER\n float attractorStrength = max((1.0 - insideCheck / distToSurface), 0.) * uForceIntensity; // Adjust as needed\n #endif\n\n float attractorDamping = uForceDamping; // Adjust as needed (higher values will attenuate velocity more)\n \n // Use the same radii calculation code as for the collider\n vec3 attractorRadii = uColliderSize;\n // Adjust position relative to attractor center\n vec3 relPos = position - uColliderPos;\n // Apply rotation of the collider to the relative position\n relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); \n // Scale relative position by radii (for ellipsoid attraction)\n vec3 scaledPos = relPos / attractorRadii;\n\n // Calculate ellipsoidal distance as attractor radius\n float attractorRadius = length(scaledPos);\n // Calculate the distance from the attractor center\n vec3 relativePosition = position - uColliderPos;\n // Calculate the force vector towards the attractor center\n vec3 attractorForce = normalize(relativePosition) * attractorStrength;\n // Apply the attractor force to the particle\n velocity -= attractorForce;\n // Attenuate the particle's velocity\n velocity *= attractorDamping;\n }\n #else \n // Calculate the distance from the attractor center\n vec3 relativePosition = position - uColliderPos;\n // Calculate the force vector towards the attractor center\n vec3 attractorForce = normalize(relativePosition) * uForceIntensity;\n // Apply the attractor force to the particle\n velocity -= attractorForce;\n // Attenuate the particle's velocity\n velocity *= uForceDamping;\n #endif \n #endif \n \n // VORTEX\n \n #ifdef USE_VORTEX\n // Box dimensions\n vec3 boxHalfSize = uColliderSize / 2.0;\n // Convert world position to box's local space\n vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); \n vec3 localDistance = abs(localPos) - boxHalfSize;\n float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));\n\n // Apply vortex force inside the box\n if (distToSurface <= particleSize) {\n float vortexStrength = uForceIntensity;\n vec3 localTopCenter = vec3(0.0, 0., 0.0);\n\n // Transform the local top center to the world space\n vec3 vortexCenter = uColliderPos + applyQuaternionToVector(uColliderQuaternion, localTopCenter);\n // Calculate the vector from particle to vortex center\n vec3 vortexVector = vortexCenter - position;\n\n // Calculate the rotation axis from the inverse of the collider's quaternion and the fixed up vector\n // Note: important to add a tiny z component to the up vector to avoid instability\n vec3 upVector = vec3(0.0, 1.0, 0.01);\n vec3 rotationAxis = cross(upVector, applyQuaternionToVector(uColliderQuaternion, vortexVector));\n rotationAxis = normalize(rotationAxis);\n\n // Add rotational component to velocity\n float rotationSpeed = length(vortexVector * vortexStrength * 3.0) ; \n\n vec3 rotationVelocity = rotationAxis * rotationSpeed;\n // velocity += rotationVelocity * 0.005 ;\n velocity = rotationVelocity * 0.005 ;\n\n // Calculate vortex force\n // vec3 vortexForce = normalize(vortexVector) * uSpeed * .1 ;\n // Apply the vortex force to the particle\n vec3 originDirection = applyQuaternionToVector(uWorldQuaternion, directions);\n velocity += applyForce( originDirection * uSpeed * (1. - uForceDamping) , mass * .5);\n }\n #endif \n\n } \n // End isActive\n\n // SPAWN BIRTH \n // **************************************************************\n // if (isSpawning == 1.)\n #ifdef USE_NORMALS\n velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, directions) * uSpeed, isSpawning);\n #else\n velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, uDirectionsAxis) * uSpeed, isSpawning); \n #endif\n \n // if (collisionFlag == 0.0)\n velocity += applyForce(uGravity, mass * .5) * (1.0 - collisionFlag);\n\n gl_FragColor = vec4(velocity, collisionFlag);\n}\n",this.emitterShape.directionsTexture),a=i.addVariable("uCurrentEmissionRate","\n// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU\n// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU\n// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU\n\nuniform sampler2D uIndex; // Texture with corresponding index\nuniform float uLastIndexEmitted; // Last emitted index\nuniform float uParticlesToEmit; // Number of particles to emit on that frame\nuniform float uTime;
2\n\nvoid main() {\n vec2 vUv = gl_FragCoord.xy / resolution.xy;\n float particleIndex = texture(uIndex, vUv).x;\n float timeLeft = texture2D( uCurrentPosition, vUv ).w;\n float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active\n float timeStart = texture2D( uCurrentEmissionRate, vUv ).b;\n\n\n // ********** Detect Colision to Create a flag and use it in position **********\n // We are doing this here, so\n\n // ********** Emit Particles **********\n // X = isSpawning 0.0 or 1.0\n // Y = isActive 0.0 or 1.0\n // Check if the vertex index is between the first value and the last value\n // if (particleIndex >= uLastIndexEmitted && particleIndex < uLastIndexEmitted + uParticlesToEmit) {\n // // Emit a particle by writing 1 to the red channel of the color output\n // // r: 1. == emit the particle\n // // g: 1. == particle is now active\n // timeStart = uTime;\n // gl_FragColor = vec4(1.0, 1.0, timeStart, 1.0);\n // } else {\n // // The Particle is either already emitted or not in the range of the particles to emit\n // // Do not emit a particle by writing 0 to the red channel of the color output \n // gl_FragColor = vec4(0.0, isActive, timeStart, 1.0);\n // }\n // Determine if the particle is within the emission range\n float emitLowerBound = step(uLastIndexEmitted, particleIndex);\n float emitUpperBound = step(particleIndex, uLastIndexEmitted + uParticlesToEmit - 1.0);\n float emitParticle = emitLowerBound * emitUpperBound; // 1.0 if in range, 0.0 otherwise\n\n // Set timeStart and color\n timeStart = mix(timeStart, uTime, emitParticle);\n gl_FragColor = vec4(emitParticle, mix(isActive, 1.0, emitParticle), timeStart, 1.0);\n\n\n}\n",function(t){let e=new Float32Array(4*t*t);for(let n=0;n<t*t;n++)e[4*n]=0,e[4*n+1]=0,e[4*n+2]=0,e[4*n+3]=0;let i=new ga(e,t,t,nt,tt);return i.needsUpdate=!0,i}(this.emitterShape.textureSize));i.setVariableDependencies(r,[r,s,a]),i.setVariableDependencies(s,[r,s,a]),i.setVariableDependencies(a,[r,s,a]);let o=function({size:t}){let e=new Float32Array(4*t*t);for(let n=0;n<t*t;n++)e[4*n]=n,e[4*n+1]=0,e[4*n+2]=0,e[4*n+3]=0;let i=new ga(e,t,t,nt,tt);return i.needsUpdate=!0,i}({size:this.emitterShape.textureSize}),l={uOriginalPosition:{value:this.emitterShape.positionsTexture},uWorldOffset:{value:new be(0,0,0)},uWorldQuaternion:{value:new me(0,0,0,1)},uTime:{value:0},uFPSRatio:{value:1},uMaxLifeTime:{value:t.life},uEmitterSize:{value:new be(Number(this.shared.getVariable(t.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t.shape.size[2],[this.uuid,"particles","shape_size_2"])))},particleSize:{value:0}};r.material.uniforms=l;let h=this.getDirectionFromVariable(t.direction);this.directionAxis=this.getDirectionAxis(h),this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.noiseStrength=Number(this.shared.getVariable(t.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.noiseScale=Number(this.shared.getVariable(t.noiseScale,[this.uuid,"particles","noiseScale"]));let c=t.colliderEntityId&&this.system.getColliderData(t.colliderEntityId),d={uOriginalPosition:{value:this.emitterShape.positionsTexture},uDirections:{value:this.emitterShape.directionsTexture},uDirectionsAxis:{value:this.directionAxis},uWorldQuaternion:{value:new me(0,0,0,1)},uColliderPos:{value:new be(0,0,0)},uColliderSize:{value:new be(0,0,0)},uForceIntensity:{value:c?c.forceIntensity:0},uForceDamping:{value:c?c.forceDambing:0},uColliderQuaternion:{value:new me(0,0,0,1)},uColliderQuaternionInvert:{value:new me(0,0,0,1)},particleSize:{value:0},uGravity:{value:this.worldGravity},uNoiseStrength:{value:this.noiseStrength},uNoiseScale:{value:this.noiseScale},uNoiseSeed:{value:t.noiseSeed},uRandomMassFactor:{value:t.randomMass},uBounce:{value:t.collisionBounce},uSpeed:{value:Number(this.shared.getVariable(t.speed,[this.uuid,"particles","speed"]))/10}};s.material.uniforms=d;let u={uIndex:{value:o},uTime:{value:0},uLastIndexEmitted:{value:0},uParticlesToEmit:{value:0}};a.material.uniforms=u;let p=[Number(this.shared.getVariable(t.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t.shape.size[2],[this.uuid,"particles","shape_size_2"]))],f={...zB(this.system.data).shape,size:p};this.emitterShape.applyToShader(r.material.uniforms,f),i.init(),this.gpuCompute=i,this.positionSimRT=r,this.velocitySimRT=s,this.emissionRateSimRT=a,this.rootObject=this.createPrimaryEmitter(this.emitterShape.textureSize),this.add(this.rootObject),this.material.needsUpdate=!0}getDirectionFromVariable(t){return[Number(this.shared.getVariable(t[0],[this.uuid,"particles","direction_x"])),Number(this.shared.getVariable(t[1],[this.uuid,"particles","direction_y"])),Number(this.shared.getVariable(t[2],[this.uuid,"particles","direction_z"]))]}updateSimulationDefinition(t){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,t.colliderEntityId&&this.system.colliderEntities.length>0){let e=this.system.getColliderData(t.colliderEntityId);switch(e?.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=e?.colliderType;"sphere"===i&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),"box"===i&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),"helper"===e?.forceRange&&(this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!0)}"normals"===t.directionMode&&(this.simFeaturesDefinition.USE_NORMALS=!0),"curl"===t.noiseType&&(this.simFeaturesDefinition.USE_CURL_NOISE=!0),"simplex"===t.noiseType&&(this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!0),"fbm"===t.noiseType&&(this.simFeaturesDefinition.USE_FBM_NOISE=!0);let e="";for(let[i,n]of Object.entries(this.simFeaturesDefinition))n&&(e+=`#define ${i}\n`);return e}createShape(t,e){this.emitterShape&&this.emitterShape.dispose();let i=new be(Number(this.shared.getVariable(t.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t.size[2],[this.uuid,"particles","shape_size_2"])));if("MeshEmitterShape"===t.type){let n=null;return this.system.context.scene.traverseEntity(e=>{e.uuid===t.fromMeshId&&(n=e)}),n?new BB(i,e,t.type,n):new BB(i,e,"SphereEmitterShape")}return new BB(i,e,t.type)}createPrimaryEmitter(t){let e,i=t*t;return e=new Ca(new Rn(1,1,1),this.material,i),this.updateGeometryAttributes(e,t),this.material.needsUpdate=!0,e.onBeforeRender=()=>{this.applyWorldSpace()},e}getMaxParticlesAmount({birthRatePerSecond:t,particleMaxLifeTime:e,loopDuration:i=0}){return Math.ceil(t*(e+i))}dispose(){!this.gpuCompute||(this.rootObject?.parent?.remove(this.rootObject),this.gpuCompute.dispose(),this.material.nodeMaterialDispose(),this.emitterShape?.dispose())}GoEmitSomeParticles(t,e){let i=t-this.lastEmitTime,n=1/e;if(i>=n){let e=Math.max(1,Math.floor(i/n));return this.lastEmitTime=t,this.emittedParticlesAmount+e>this.particlesAmount&&(this.emittedParticlesAmount=0),this.emittedParticlesAmount+=e,e}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(zB(this.system.data))}startEmitting(t){this.isEmitting=!0,this.hasBeenReset=!1,this.lastEmitTime=t}stopEmitting(){this.isEmitting=!1}},NB=class extends JC{constructor(t,e,i){super(t,e),this.type="ParticleSystem",this.geometry=new Qi,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=t=>{this._hasOnAfterRenderBeenCalled||(this._hasOnAfterRenderBeenCalled=!0,this.init(t))},this.context=i,this.data={...e,...zB(e)},this.geometry.setAttribute("position",new Vi([],3)),this.material=new Bi({colorWrite:!1}),this.frustumCulled=!1}init(t){this.renderer=t,this.emitter=new FB(t,this),this.add(this.emitter),this.updateParticleState(this.data)}update(t){if(!this.isReady||!this.started||this.isFrozen||this.isIdle)return;this.actualTime+=t,this.stopped||(this.currentLoopTime+=t);let e="one_time"===this.data.emitTimeCycle;if(("loop"===this.data.emitTimeCycle||e)&&this.currentLoopTime>1e3*this.data.emitTimeDuration&&(this.stopped||(this.stop(),e||this.start(1e3*this.data.emitTimeDelay))),this.emitter&&this.started){let e=this.actualTime/1e3;this.emitter.update(e,t)}this.scale.set(1,1,1),this.updateMatrix()}isReady(){return!!this.emitter}hasCollider(t){return this.colliderEntities.some(e=>e.identity===t)}getColliderData(t){let e=this.colliderEntities.find(e=>e.identity===t);return e?e.data:null}updateByPatchedOp(t,e,i){super.updateByPatchedOp(t,e,i),ev(t.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:{...this.data.renderMaterial,...Cg.drop(t,1).props}}),ev(t.path,["shape"])&&this.updateParticleState({shape:{...this.data.shape,...Cg.drop(t,1).props}})}updateState(t,e){super.updateState(t,e),this.updateParticleState(t)}updateParticleState(t){if(this.emitter){if(void 0!==t.colliderEntityId&&null!==t.colliderEntityId){let e=this.context.scene.find(t.colliderEntityId);this.colliderEntities=e?[e]:[]}null===t.colliderEntityId&&(this.colliderEntities=[]),this.emitter.updateState(t),t.emitTimeCycle&&this.started&&this.start()}}updateFromColliderEntity(t){!this.emitter||(this.emitter.updateForceFieldParameters(t),this.stop(),this.start())}start(t=0){this.currentLoopTime=0,t?this.timeoutId=window.setTimeout(()=>{this.start(0)},t):(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()}};var UB=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}();
2function kB(t,e,i){return"Mesh"===e.type?function(t,e,i){let n;return void 0!==UB&&(e?.geometry?.subdivisions??0)>UB&&(e.geometry.subdivisions=UB),"TextGeometry"===e.geometry.type?new oI(t,e,i):"InputGeometry"===e.geometry.type?new xB(t,e,i):(n="SubdivGeometry"===e.geometry.type?new FD(t,e,i):"PathGeometry"===e.geometry.type?new yB(t,e,i):"VectorGeometry"===e.geometry.type?new vB(t,e,i):"BooleanGeometry"===e.geometry.type?new WI(t,e,i):"ShapeBlendGeometry"===e.geometry.type?new XB(t,e,i):"UIGeometry"===e.geometry.type?new MB(t,e,i):new ID(t,e,i),n)}(t,e,i):"Empty"===e.type?new tO(t,e):"Particle"===e.type?new NB(t,e,i):"ParticleCollider"===e.type?new eO(t,e,i):"Splat"===e.type?new tO(t,e):"Bone"===e.type?new AB(t,e):"Page"===e.type?new mB(t,e,i):"PointLight"===e.type?new gB(t,e,i):"SpotLight"===e.type?new mL(t,e,i):"DirectionalLight"===e.type?new dL(t,e,i):"Component"===e.type||"Instance"===e.type?new bB(t,e,i):ux.is(e.type)?new UI(t,e):new tO(t,e)}g_.createEntity=kB,g_.changeEntityProptotype=function(t,e,i){let n=kB(t.identity,e,i),r=t.children,s=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,h=t.overrideData,c=t.uuid,d=t.stateSelection;t.dispose();for(let u of Object.keys(t))delete t[u];Object.setPrototypeOf(t,Object.getPrototypeOf(n));for(let u of Object.keys(n))t[u]=n[u];t.children=[...t.children,...r],t.attachedPaths=s,t.parent=a,t.component=o,t.instances=l,t.uuid=c,t.overrideData=h,t.updateState(t.data,i),d&&t.changeSelectedState(d,i),t.resetBBoxNeedsUpdate()},g_.Cloner=bI;var VB=new Qi;VB.setAttribute("position",new Ni(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var jB=class extends Go{constructor(t){super({...t,depthTest:!1,depthWrite:!1,glslVersion:Pt,vertexShader:"\n\t\t\t\tprecision highp float;\n\t\t\t\tin vec3 position;\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_Position = vec4(position, 1);\n\t\t\t\t}\n\t\t\t"})}customProgramCacheKey(){return""}};var GB=new yn,WB=96,HB={shapeInput:()=>"\n\t\t\tconst float posRowCoord = 0.1; // vec4: px py pz opType\n\t\t\tconst float quatRowCoord = 0.3; // vec4: qx qy qz qw\n\t\t\tconst float param1RowCoord = 0.5;// vec4: type param1 param2 param3\n\t\t\tconst float param2RowCoord = 0.7;// vec4: blendRange roundness scale param4\n\t\t\tconst float colorRowCoord = 0.9; // vec4: r g b a\n\t\t\tuniform sampler2D shapesDataTexture;\n\t\t\tvec4 shapePos(float iin) { \n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeQuat(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeParams1(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeParams2(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeColor(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t",getxyzi:"\n\t\t\t// this code must complement lookup\n\t\t\tfloat xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION);\n\t\t\tfloat yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION);\n\t\t\tfloat zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;\n\t\t",lookup:"\n\t\t\tuniform sampler2D potentialPassTexture;\n\t\t\tuniform sampler2D voxelPassTexture; // includes normal (in xyz) and key (in w)\n\t\t\t\n\t\t\t// box or marching cube lookup value in value texture, integer box coord inputs\n\t\t\t// this code must complement codebits.getxyzi\n\t\t\tvec4 look(float xi, float yi, float zi, sampler2D rt) {// range 0 .. numv etc
vendor: 11,230 bytes, line 2
2\n\t\t\t\tvec2 uv = vec2(\n\t\t\t\t\tmod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION,\n\t\t\t\t\tfloor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION\n\t\t\t\t); \n\t\t\t\tuv /= Z_LAYERS_PER_ROW;\n\t\t\t\treturn texture(rt, uv);\n\t\t\t}\n\t\t",getpart:"\n\t\t\tfloat getpart(inout float a, float b) {\n\t\t\t\tfloat t = floor(a/b);\n\t\t\t\tfloat r = a - t*b;\n\t\t\t\ta = t;\n\t\t\t\treturn r;\n\t\t\t}\n\t\t",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,6,-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])}
vendor: 1,939 bytes, line 2
2,qB=class extends ID{constructor(t,e,i){super(t,e,i),this.data=e,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 da,this.potentialPassScene=new da,this.voxelPassScene=new da,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new Qi,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new cn(VB,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let n=new ga(HB.triTable,16,256,at,tt);n.needsUpdate=!0;let r=new ga(HB.numTrisTable,256,1,at,tt);r.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:r}},this.voxelMesh=new cn(VB,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 cn(VB,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:n},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0}
vendor: 11,921 bytes, line 2
2,pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=t=>{if(iz.call(this),0===this.npart)return void(this.geometry.drawRange.count=0);let e=this.material.root;if(e.shadersPatchedForShapeBlend){if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new vn({vertexShader:e.vertexShader,fragmentShader:"\n\t\t\t\t\t\t#include <packing>\n\t\t\t\t\t\tvoid main()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n\t\t\t\t\t\t}\n\t\t\t\t\t",uniforms:e.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new vn({vertexShader:e.vertexShader,fragmentShader:"\n\t\t\t\t\t#include <common>\n\t\t\t\t\t#include <packing>\n\t\t\t\t\tuniform vec3 referencePosition;\n\t\t\t\t\tuniform float nearDistance;\n\t\t\t\t\tuniform float farDistance;\n\t\t\t\t\t// World-space position\n\t\t\t\t\tvarying vec3 vWPosition;\n\t\t\t\t\tvoid main()\n\t\t\t\t\t{\n\t\t\t\t\t\tfloat dist = length(vWPosition - referencePosition);\n\t\t\t\t\t\tdist = (dist - nearDistance) / (farDistance - nearDistance);\n\t\t\t\t\t\tdist = saturate(dist);\n\t\t\t\t\t\t// Required by Three.js for this to work\n\t\t\t\t\t\tgl_FragColor = packDepthToRGBA( dist );\n\t\t\t\t\t}",uniforms:{nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new be},opacity:{value:0},...e.uniforms},defines:this.material.defines});let t=this.customDistanceMaterial;t.referencePosition=new be,t.nearDistance=0,t.farDistance=0,t.opacity=1,t.isMeshDistanceMaterial=!0}}else this.patchVertexShaderForShapeBlend(e),e.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 t=this.pyramidLevelSizes.length%2==0?0:1,e=this.pyramidLevelSizes.length%2==0?1:0;this.marchPassUniforms.pyramidTexture2.value=this.pyramidRenderTarget[t].texture,this.marchPassUniforms.pyramidTexture2Size.value=new Ht(this.pyramidRenderTarget[t].width,this.pyramidRenderTarget[t].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[e].texture,this.marchPassUniforms.pyramidTexture1Size.value=new Ht(this.pyramidRenderTarget[e].width,this.pyramidRenderTarget[e].height),Object.assign(this.material.uniforms,this.marchPassUniforms)}let i=t.shadowMap.enabled;t.shadowMap.enabled=!1;let n=t.getRenderTarget();t.setRenderTarget(this.spatialPassRenderTarget),t.render(this.spatialscene,GB),t.setRenderTarget(this.potentialPassRenderTarget),t.render(this.potentialPassScene,GB),t.setRenderTarget(this.voxelPassRenderTarget),t.render(this.voxelPassScene,GB),qB.streamCompaction.renderPyramid(this.resolutionLevel,this.pyramidLevelSizes,t,this.voxelPassRenderTarget,this.pyramidRenderTarget).then(t=>{this.material.wireframe&&(3*t>this.geometry.attributes.position.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.dispose(),this.geometry=new Qi,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 Ni(new Float32Array(3*t*2),3)),(3*t>this.geometry.drawRange.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.drawRange.count=3*Math.floor(1.2*t)),this.drawRangeNeedsForceUpdate=!1}),t.shadowMap.enabled=i,t.setRenderTarget(n)}}set npart(t){t!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=t,this.spatialn=Math.ceil(t/96))}get npart(){return this._npart}set resolutionLevel(t){let e=Math.min(8,Math.max(5,t));if(e!==this._resolutionLevel){switch(this._resolutionLevel=e,this.resolution=Math.pow(2,e),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 t=this.pyramidLevelSizes.length-2;t>=0;t--)(this.pyramidLevelSizes.length-2)%2==t%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[t]:this.pyramidTexture2Width+=this.pyramidLevelSizes[t];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 t=this._spatialPassRenderTargets[this.resolutionLevel];return t||(t=new ge(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:nt,type:tt,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:q,magFilter:q}),this._spatialPassRenderTargets[this.resolutionLevel]=t),t}get potentialPassRenderTarget(){let t=this._potentialPassRenderTargets[this.resolutionLevel];return t||(t=new ge(this.basePyramidSize,this.basePyramidSize,{format:nt,type:tt,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:q,magFilter:q}),this._potentialPassRenderTargets[this.resolutionLevel]=t),t}get voxelPassRenderTarget(){let t=this._voxelPassRenderTargets[this.resolutionLevel];return t||(t=new ye(this.basePyramidSize,this.basePyramidSize,2,{stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:q,magFilter:q}),t.texture[0].format=nt,t.texture[0].type=tt,t.texture[1].format=at,t.texture[1].type=tt,this._voxelPassRenderTargets[this.resolutionLevel]=t),t}get pyramidRenderTarget(){let t=this._pyramidRenderTargets[this.resolutionLevel];if(!t){t=[new ge(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:nt,type:tt,stencilBuffer:!1,depthBuffer:!1,magFilter:q,minFilter:q}),new ge(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:nt,type:tt,stencilBuffer:!1,depthBuffer:!1,magFilter:q,minFilter:q})],this._pyramidRenderTargets[this.resolutionLevel]=t}return t}updateState(t,e){let i=this.material;super.updateState(t,e),i!==this.material&&(this.needsRebuild=!0),t.geometry&&(this.resolutionLevel=t.geometry.resolutionLevel,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]}),t.wireframe&&!this.geometry.getAttribute("position")?this.geometry.setAttribute("position",new Ni(new Float32Array(3*this.geometry.drawRange.count),3)):!t.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\t\t\tconst float spatialDivisions = ${this.spatialDivisions}.;\n\t\t\tuniform float span;\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\t${HB.shapeInput()}\n\n\t\t\tvec3 low, high; // range of current div; subset of -1 .. 1 with span border\n\n\t\t\t// lookup one element/channel's worth of spheres for current division\n\t\t\t// stating with low sphere number lowi\n\t\t\t// gives a key to which spheres from lowi..lowi+23 are active within given div (low..high)\n\t\t\tfloat spatialKey(float lowi) {\n\t\t\t\tfloat t = 0.;\n\t\t\t\tfor (float ii = 23.; ii >= 0.; ii--) {\n\t\t\t\t\tfloat i = ii + lowi;\n\t\t\t\t\tfloat iin = (i + 0.5) / 96.;\n\t\t\t\t\tvec4 shape = shapePos(iin);\n\t\t\t\t\tvec3 d = shape.xyz;\n\t\t\t\t\tfloat op = shape.w;\n\t\n\t\t\t\t\tt *= 2.;\n\t\t\t\t\tt += (\n\t\t\t\t\t\tlow.x < d.x && d.x < high.x &&\n\t\t\t\t\t\tlow.y < d.y && d.y < high.y &&\n\t\t\t\t\t\tlow.z < d.z && d.z < high.z &&\n\t\t\t\t\t\ti < npart || op == -2. // always include if op is -2, which is the intersection operation\n\t\t\t\t\t) ? 1. : 0.;\n\t\t\t\t}\n\t\t\t\treturn t;\n\t\t\t}\n\n\t\t\t${HB.getpart}\n\n\t\t\tvoid main() { // spatialial fragment shader\n\t\t\t\t// find active div\n\t\t\t\tvec3 div; // which div is current\n\t\t\t\t// out holds x=> x, lowi faster moving and y=> z, y faster moving\n\t\t\t\tfloat yz = float(gl_FragCoord.y - 0.5); // contains z, y faster moving\n\t\t\t\tdiv.y = getpart(yz, spatialDivisions);\n\t\t\t\tdiv.z = yz; // getpart(yz, spatialDivisions.z); // what's left, should be the same as getpart\n\n\t\t\t\tfloat lx = float(gl_FragCoord.x - 0.5); // contains x, lowi faster moving\n\t\t\t\tfloat lowi = getpart(lx, spatialn) * 96.;\n\t\t\t\tdiv.x = lx;\n\n\t\t\t\tlow = div / spatialDivisions * 2. - 1. - span;\n\t\t\t\thigh = (div+1.) / spatialDivisions * 2. - 1. + span;\n\n\t\t\t\t// find active range of spheres\n\t\t\t\tpc_FragColor.x = spatialKey(lowi);\n\t\t\t\tpc_FragColor.y = spatialKey(lowi+24.);\n\t\t\t\tpc_FragColor.z = spatialKey(lowi+48.);\n\t\t\t\tpc_FragColor.w = spatialKey(lowi+72.);\n\t\t\t}\n\t\t`;return new jB({name:"Spatial Pass",fragmentShader:t,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\n\t\t\t${HB.shapeInput()}\n\t\t\tuniform sampler2D spatialPassTexture;\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.;\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\tconst float spatialDivisions = ${this.spatialDivisions}.;\n\t\t\tconst float spatialDivisions2 = spatialDivisions * spatialDivisions;\n\t\t\tconst float spatialDivisionsSub1 = spatialDivisions - 1.;\n\n\t\t\t${HB.getpart}\n\n\t\t\tvec3 packRGBAToVec3(vec4 color) {\n\t\t\t\tuint r = uint(color.r * 255.);\n\t\t\t\tuint g = uint(color.g * 255.);\n\t\t\t\tuint combined = (r << 8) | g; \n\t\t\t\treturn vec3(float(combined) * 0.00001525902, color.b, color.a); // 1/65535\n\t\t\t}\n\n\t\t\tvoid applyQuaternionToVector(in vec4 q, inout vec3 v) {\n\t\t\t\tv += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * SDF functions (reference: https://iquilezles.org/articles/distfunctions/)\n\t\t\t */\n\n\t\t\t// branchless version of "Smooth Union, Subtraction and Intersection - bound, bound, bound" in above reference\n\t\t\tfloat smoothOperation(float op, float sdf, float d, float k) {\n\t\t\t // union: op = 1 =>
2 signSubtract = 1, signIntersection = 1\n\t\t\t // subtract: op = -1 => signSubtract = -1, signIntersection = 1\n\t\t\t\t// intersection: op = -2 => signSubtract = -1, signIntersection = -1\n\n\t\t\t\tfloat signSubtract = clamp(op, -1., 1.);\n\t\t\t\tfloat signIntersection = 2. * (op - signSubtract) + 1.;\n\t\t\t\tfloat h = clamp(\n\t\t\t\t\t0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k,\n\t\t\t\t\t0.0,\n\t\t\t\t\t1.0\n\t\t\t\t);\n\t\t\t\treturn mix(sdf, signSubtract * signIntersection * d, h) - \n\t\t\t\t\t\t\t signSubtract * k * h * (1.0 - h);\n\t\t\t}\n\n\t\t\tfloat sdSphere( vec3 p, float s )\n\t\t\t{\n\t\t\t\treturn length(p)-s;\n\t\t\t}\n\n\t\t\tfloat sdEllipsoid( vec3 p, vec3 r )\n\t\t\t{\n\t\t\t\tfloat k0 = length(p/r);\n\t\t\t\tfloat k1 = length(p/(r*r));\n\t\t\t\treturn k0*(k0-1.0)/k1;\n\t\t\t}\n\n\t\t\tfloat sdBox( vec3 p, vec3 b )\n\t\t\t{\n\t\t\t\tvec3 q = abs(p) - b;\n\t\t\t\treturn length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);\n\t\t\t}\n\n\t\t\tfloat sdTorus( vec3 p, vec2 t )\n\t\t\t{\n\t\t\t\tvec2 q = vec2(length(p.xy)-t.x,p.z);\n\t\t\t\treturn length(q)-t.y;\n\t\t\t}\n\n\t\t\tfloat sdCappedTorus( vec3 p, vec2 sc, float ra, float rb)\n\t\t\t{\n\t\t\t\tp.x = abs(p.x);\n\t\t\t\tfloat k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy);\n\t\t\t\treturn sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;\n\t\t\t}\n\n\t\t\tfloat dot2( in vec2 v ) { return dot(v,v); }\n\t\t\tfloat sdCappedCone( vec3 p, float h, float r1, float r2 )\n\t\t\t{\n\t\t\t\tvec2 q = vec2( length(p.xz), p.y );\n\t\t\t\tvec2 k1 = vec2(r2,h);\n\t\t\t\tvec2 k2 = vec2(r2-r1,2.0*h);\n\t\t\t\tvec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h);\n\t\t\t\tvec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 );\n\t\t\t\tfloat s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;\n\t\t\t\treturn s*sqrt( min(dot2(ca),dot2(cb)) );\n\t\t\t}\n\n\t\t\tfloat sdCappedCylinder( vec3 p, float h, float r )\n\t\t\t{\n\t\t\t\tvec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h);\n\t\t\t\treturn min(max(d.x,d.y),0.0) + length(max(d,0.0));\n\t\t\t}\n\n\t\t\tfloat maxBlend = 0.0;\n\t\t\t// compute potential from A (=24) spheres, using the bit flags in 'activeKey'\n\t\t\t// to avoid lookup/compute for inactive spheres\n\t\t\t// return field potential, side effect updates track,\n\t\t\t// compute and return +ve and -ve values separately\n\t\t\tvoid fillSpatialInner(\n\t\t\t\tfloat ii,\n\t\t\t\tfloat activeKey,\n\t\t\t\tvec3 corner,\n\t\t\t\tinout float sdf,\n\t\t\t\tinout float colorDivisor,\n\t\t\t\tinout vec4 trackColor\n\t\t\t) {\n\t\t\t\tfor (float i = 0.; i < 24.; i++) {\n\t\t\t\t\tif (activeKey < 1.) break; // activeKey exhausted, no more active spheres\n\t\t\t\t\tactiveKey *= 0.5;\n\t\t\t\t\tif (fract(activeKey) < 0.5) continue;\n\n\t\t\t\t\tfloat iin = (i + ii + 0.5) * ${1/WB};\n\t\t\t\t\tvec4 shape = shapePos(iin);\n\t\t\t\t\tvec4 quat = shapeQuat(iin);\n\t\t\t\t\tvec4 params1 = shapeParams1(iin);\n\t\t\t\t\tvec4 params2 = shapeParams2(iin);\n\n\t\t\t\t\tvec3 p = corner - shape.xyz;\n\t\t\t\t\tapplyQuaternionToVector(quat, p);\n\t\t\t\t\tp /= params2.z; // scale\n\t\t\t\t\tfloat d; // d in -1..1 coordinates\n\t\t\t\t\tswitch (int(params1.x)) {\n\t\t\t\t\t\tcase 0: d = sdSphere(p, params1.y); break;\n\t\t\t\t\t\tcase 1: d = sdEllipsoid(p, params1.yzw); break;\n\t\t\t\t\t\tcase 2: d = sdBox(p, params1.yzw); break;\n\t\t\t\t\t\tcase 3: d = sdCappedCylinder(p, params1.y, params1.z); break;\n\t\t\t\t\t\tcase 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break;\n\t\t\t\t\t\tcase 5: d = sdTorus(p, params1.yz); break;\n\t\t\t\t\t\tcase 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break;\n\t\t\t\t\t}\n\t\t\t\t\td -= params2.y; // rounded edge\n\t\t\t\t\td *= params2.z; // scale\n\n\t\t\t\t\tfloat k = params2.x;\n\t\t\t\t\tfloat op = shape.w;\n\n\t\t\t\t\tsdf = smoothOperation(shape.w, sdf, d, k);\n\n\t\t\t\t\tfloat isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise\n\t\t\t\t\tfloat colorCull = smoothstep(maxBlend, 0., -d);\n\t\t\t\t\tfloat cullFactor = mix(1.0, colorCull, isNegativeOne);\n\t\t\t\t\ttrackColor *= cullFactor;
2\n\t\t\t\t\tcolorDivisor *= cullFactor;\n\n\t\t\t\t\tmaxBlend = max(maxBlend, k);\n\n\t\t\t\t\tk += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k\n\t\t\t\t\tfloat nearness = smoothstep(k, 0., d);\n\n\t\t\t\t\tvec4 color = shapeColor(iin);\n\t\t\t\t\tnearness *= float(color.a >= 0.);\n\n\t\t\t\t\tcolorDivisor += nearness;\n\t\t\t\t\ttrackColor += color * nearness;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvec3 div;\n\t\t\t// compute potential from all spheres; collect +ve and =ve values separately\n\t\t\t// work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values\n\t\t\t// TODO check if extra vec3 output useful, not really used at present\n\t\t\tfloat fillSpatial(vec3 corner, inout vec4 trackColor) {\n\t\t\t\tfloat sdf = 1e3; // hack: initialize to large value\n\t\t\t\tfloat colorDivisor = 0.;\n\t\t\t\t// spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving\n\t\t\t\tfloat divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2);\n\t\t\t\tfor (float ii = 0.; ii < spatialn; ii++) {\n\t\t\t\t\tfloat i = ii * 96.;\n\n\t\t\t\t\tvec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz));\n\t\t\t\t\tfillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+24., activeKey.y, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+48., activeKey.z, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+72., activeKey.w, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t}\n\n\t\t\t\ttrackColor /= colorDivisor;\n\t\t\t\treturn mix(sdf, 0.0, step(1e20 - 0.1, sdf));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\t${HB.getxyzi} // get xi yi zi from 2d position\n\n\t\t\t\tvec3 xyzi = vec3(xi,yi,zi);\n\t\t\t\tvec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.; // -1..1 coords\n\n\t\t\t\tdiv = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1);\n\n\t\t\t\tvec4 c = vec4(0.);\n\t\t\t\tfloat t = fillSpatial(corner, c);\n\n\t\t\t\tpc_FragColor = vec4(t, packRGBAToVec3(c)); // RGB texture\n\t\t\t}\n\t\t`;return new jB({name:"PotentialPass",fragmentShader:t,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tlayout(location = 0) out vec4 pc_FragColor;\n\t\t\tlayout(location = 1) out vec4 numTris;\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; \n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\t\t\tuniform sampler2D numTrisTable; // 256 x 1\n\n\t\t\tfloat keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) {\n\t\t\t\treturn (float(f000 < 0.) * 1.) +\n\t\t\t\t\t\t\t (float(f100 < 0.) * 2.) +\n\t\t\t\t\t\t\t (float(f010 < 0.) * 8.) +\n\t\t\t\t\t\t\t (float(f110 < 0.) * 4.) +\n\t\t\t\t\t\t\t (float(f001 < 0.) * 16.) +\n\t\t\t\t\t\t\t (float(f101 < 0.) * 32.) +\n\t\t\t\t\t\t\t (float(f011 < 0.) * 128.) +\n\t\t\t\t\t\t\t (float(f111 < 0.) * 64.);\n\t\t\t}\n\n\t\t\t${HB.lookup}\n\n\t\t\tvec3 compNormi(float xi, float yi, float zi) {\n\t\t\t\tfloat dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r;\n\t\t\t\tfloat dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r;\n\t\t\t\tfloat dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r;\n\t\t\t\t// if we allow (common) 0,0,0 case through then NaN can spread\n\t\t\t\t// eg r = vec4(compNorm i(???), 1.) will pollute r.w\n\t\t\t\tif (dx == 0.0 && dy == 0.0 && dz == 0.0) {\n\t\t\t\t\treturn vec3(0.199, 0.299, 0.399);\n\t\t\t\t}\n\t\t\t\treturn normalize(vec3(dx, dy, dz));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\t${HB.getxyzi} // get xi yi zi from 2d\n\n\t\t\t\tvec3 normal = compNormi(xi, yi, zi); // even if our key is -1 this may be needed by a neighbouring voxel\n\n\t\t\t\tif (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) {\n\t\t\t\t\tpc_FragColor = vec4(normal, 0.);\n\t\t\t\t\tnumTris = vec4(0.);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfloat\n\t\t\t\t\tf000 = look(xi, yi, zi, potentialPassTexture).r,\n\t\t\t\t\tf100 = look(xi+1., yi, zi, potentialPassTexture).r,\n\t\t\t\t\tf010 = look(xi, yi+1., zi, potentialPassTexture).r,\n\t\t\t\t\tf110 = look(xi+1., yi+1., zi, potentialPassTexture).r,\n\t\t\t\t\tf001 = look(xi, yi, zi+1., potentialPassTexture).r,\n\t\t\t\t\tf101 = look(xi+1., yi, zi+1., potentialPassTexture).r,\n\t\t\t\t\tf011 = look(xi, yi+1., zi+1., potentialPassTexture).r,\n\t\t\t\t\tf111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r;\n\t\t\t\tfloat key = keyi(f000, f100, f010, f110, f001, f101, f011, f111);\n\n\t\t\t\tpc_FragColor = vec4(normal, key);\n\n\t\t\t\tnumTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5));\n\t\t\t}\n\t\t`;return new jB({name:"VoxelPass",fragmentShader:t,uniforms:this.voxelPassUniforms})}
vendor: 7,975 bytes, line 2
2patchVertexShaderForShapeBlend(t){let e=`\n\t\t#ifdef SHAPEBLEND \n\t\t\tprecision highp sampler2D;\n\n\t\t\tuniform float isol;\n\n\t\t\tuniform sampler2D triTable; // 256 x 16\n\t\t\tuniform sampler2D pyramidTexture1;\n\t\t\tuniform vec2 pyramidTexture1Size;\n\t\t\tuniform sampler2D pyramidTexture2;\n\t\t\tuniform vec2 pyramidTexture2Size;\n\n\t\t\tconst vec2 halfPixelOffset = vec2(0.5, 0.5);\n\n\t\t\tconst vec2 rShift = vec2(0., 1.);\n\t\t\tconst vec2 gShift = vec2(1., 1.);\n\t\t\tconst vec2 bShift = vec2(1., 0.);\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\n\t\t\tconst float scale_factor = 2.;\n\n\t\t\t#if SHAPEBLEND == 5\n\t\t\t\tconst float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.);\n\t\t\t\tconst float scale = 8. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(16.);\n\t\t\t#elif SHAPEBLEND == 7\n\t\t\t\tconst float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); \n\t\t\t\tconst float scale = 2. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(64.);\n\t\t\t#elif SHAPEBLEND == 8\n\t\t\t\tconst float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.);\n\t\t\t\tconst float scale = scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(128.);\n\t\t\t#else\n\t\t\t\tconst float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.);\n\t\t\t\tconst float scale = 4. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(32.);\n\t\t\t#endif\n\n\t\t\t${HB.lookup}\n\n\t\t\tconst vec3 offsets[24] = vec3[](\n\t\t\t\tvec3(0., 0., 0.), vec3(1., 0., 0.),\n\t\t\t\tvec3(1., 0., 0.), vec3(1., 1., 0.),\n\t\t\t\tvec3(0., 1., 0.), vec3(1., 1., 0.),\n\t\t\t\tvec3(0., 0., 0.), vec3(0., 1., 0.),\n\t\t\t\tvec3(0., 0., 1.), vec3(1., 0., 1.),\n\t\t\t\tvec3(1., 0., 1.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 1., 1.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 0., 1.), vec3(0., 1., 1.),\n\t\t\t\tvec3(0., 0., 0.), vec3(0., 0., 1.),\n\t\t\t\tvec3(1., 0., 0.), vec3(1., 0., 1.),\n\t\t\t\tvec3(1., 1., 0.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 1., 0.), vec3(0., 1., 1.)\n\t\t\t);\n\n\t\t\tvec2 computeShiftedPosition1(vec2 xy, float levelOriginX) {\n\t\t\t\tvec2 xyShifted = xy;\n\t\t\t\txyShifted.x += levelOriginX;\n\t\t\t\treturn (xyShifted + halfPixelOffset) / pyramidTexture1Size;\n\t\t\t}\n\n\t\t\tvec2 computeShiftedPosition2(vec2 xy, float levelOriginX) {\n\t\t\t\tvec2 xyShifted = xy;\n\t\t\t\txyShifted.x += levelOriginX;\n\t\t\t\treturn (xyShifted + halfPixelOffset) / pyramidTexture2Size;\n\t\t\t}\n\n\t\t\tvec4 unpackVec3ToRGBA(vec3 vec) {\n\t\t\t\tuint combined = uint(vec.x * 65535.0 + 0.5); // Add 0.5 for rounding\n\t\t\t\tfloat g = float(combined & uint(0xFF)) * 0.00392156862; // 1/255\n\t\t\t\tfloat r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; \n\t\t\n\t\t\t\treturn vec4(r, g, vec.y, vec.z);\n\t\t\t}\n\n\t\t\tout vec4 marchColor;\n\t\t\t// end of marchvertPre\n\t\t#endif\n\t\t`;t.vertexShader=e+t.vertexShader.replace("#include <project_vertex>","\n\t\t#ifdef SHAPEBLEND\n\t\t\tfloat triIndex = floor(float(gl_VertexID/3));\n\t\t\tfloat vertexIndex = float(gl_VertexID);\n\t\t\t\n\t\t\t// Initial pyramid lookup\n\t\t\tfloat levelOriginX1 = pyramidTexture1Size.x - 2.;\n\t\t\tfloat levelOriginX2 = pyramidTexture2Size.x - 1.;\n\t\t\tvec2 xy = vec2(0.);\n\t\t\tvec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));\n\t\t\t\n\t\t\t// Early exit check\n\t\t\tif (triIndex >= lookUp.r) return;\n\t\t\t\n\t\t\t// Optimize loop variables\n\t\t\tfloat start = 0.;\n\t\t\tvec4 triIndexVec = vec4(triIndex);\n\t\t\t\n\t\t\t// Main position computation loop\n\t\t\tfor (int i = 0; i < LOOP;) {\n\t\t\t\t// Compute boundaries\n\t\t\t\tvec4 ends = lookUp + vec4(start);\n\t\t\t\tvec4 starts = vec4(ends.gba, start);\n\t\t\t\tvec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * \n\t\t\t\t\t\t\t\t\t\t\tvec4(lessThan(triIndexVec, ends));\n\t\t\t\t\n\t\t\t\t// Update position\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\t\n\t\t\t\t// Update loop variables\n\t\t\t\tstart = dot(check, starts);\n\t\t\t\tlevelOriginX2 -= levelShiftX[i];\n\t\t\t\t\n\t\t\t\t// Update lookup\n\t\t\t\tlookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1));\n\t\t\t\ti++;\n\n\t\t\t\tends = lookUp + vec4(start);\n\t\t\t\tstarts = vec4(ends.gba, start);\n\t\t\t\tcheck = vec4(greaterThanEqual(triIndexVec, starts)) * \n\t\t\t\t\t\t\t\t\t\t\tvec4(lessThan(triIndexVec, ends));\n\t\t\t\t\n\t\t\t\t// Update position\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\t\n\t\t\t\t// Update loop variables\n\t\t\t\tstart = dot(check, starts);\n\t\t\t\tlevelOriginX1 -= levelShiftX[i];\n\t\t\t\t\n\t\t\t\t// Update lookup\n\t\t\t\tlookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\t#if HALF == 1\n\t\t\t\tvec4 ends = lookUp + vec4(start);\n\t\t\t\tvec4 starts = vec4(ends.gba, start);\n\t\t\t\tvec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends));\n\t\t\t\n\t\t\t\t// Update position\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\n\t\t\t\t// Update loop variables\n\t\t\t\tstart = dot(check, starts);\n\t\t\t#endif\n\t\t\t\n\t\t\t// Compute final coordinates\n\t\t\tvec3 gridPos;\n\t\t\tgridPos.x = mod(xy.x, VOXEL_RESOLUTION);\n\t\t\tgridPos.y = mod(xy.y, VOXEL_RESOLUTION);\n\t\t\tgridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + \n\t\t\t\t\t\t\t\t\tfloor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;\n\t\t\t\n\t\t\t// Vertex key computation\n\t\t\tvertexIndex -= start * 3.;\n\t\t\tfloat vk = vertexIndex * 0.0625 + 0.03125; // Optimized division by 16 and addition of 1/32\n\t\t\t\n\t\t\t// Voxel lookup and edge computation\n\t\t\tvec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture);\n\t\t\tfloat key = (voxel.w + 0.5) * 0.00390625; // Optimized division by 256\n\t\t\t\n\t\t\t// Edge lookup and offset computation\n\t\t\tfloat edgeNum = texture(triTable, vec2(vk, key)).x;\n\t\t\tint edgeIndex = int(edgeNum) * 2;\n\t\t\t\n\t\t\t// Compute edge positions\n\t\t\tvec3 p1 = gridPos + offsets[edgeIndex];\n\t\t\tvec3 p2 = gridPos + offsets[edgeIndex + 1];\n\t\t\t\n\t\t\t// Compute potentials and normals\n\t\t\tvec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture);\n\t\t\tvec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture);\n\t\t\t\n\t\t\t// Final position and normal computation\n\t\t\tfloat mu = potential1.r / (potential1.r - potential2.r);\n\n\t\t\tmarchColor = mix(\n\t\t\t\tunpackVec3ToRGBA(potential1.gba),\n\t\t\t\tunpackVec3ToRGBA(potential2.gba),\n\t\t\t\tmu\n\t\t\t);\n\n\t\t\ttransformed = p1 + (p2 - p1) * mu;\n\t\t\ttransformed -= originOffset;\n\t\t\ttransformed *= scale;\n\t\t\tvec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture);\n\t\t\tvec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture);\n\t\t\tobjectNormal = normalize(mix(data1.xyz, data2.xyz, mu));\n\t\t\ttransformedNormal = normalMatrix * objectNormal;\n\t\t\t#ifndef FLAT_SHADED\n\t\t\t\tvNormal = transformedNormal;\n\t\t\t#endif\n\t\t#endif\n\t\t\n#include <project_vertex>");let i=t.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!i)return;let n=`\n\t\t#ifdef SHAPEBLEND_C\n\t\t\t#if SHAPEBLEND_C == 1\n\t\t\t\t${i[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")}\n\t\t\t#else\n\t\t\t\t${i[0]}\n\t\t\t#endif\n\t\t#else\n\t\t\t${i[0]}\n\t\t#endif\n\t\t`;t.fragmentShader="in vec4 marchColor;\n"+t.fragmentShader.replace(i[0],n),Object.assign(t.uniforms,this.marchPassUniforms)}initDebugPass(t){this.geometry=new Rn(t.width,t.height),this.geometry.userData={parameters:{width:4,height:4}};
2let e={inputTexture:{value:Array.isArray(t.texture)?t.texture[1]:t.texture},pyramidTextureSize:{value:void 0}},i=t=>{t.vertexShader="\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\t\tvUv = uv;\n\t\t\t\t}\n\t\t\t",t.fragmentShader="\n\t\t\t\tlayout(location = 1) out vec4 gVelocity;\n\n\t\t\t\tprecision highp float;\n\t\t\t\t\n\t\t\t\tuniform sampler2D inputTexture;\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tuniform vec2 pyramidTextureSize;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\t\t// Sample the input texture using UV coordinates\n\t\t\t\t\t\tgl_FragColor = texture(inputTexture, vUv);\n\t\t\t\t\t\tgVelocity = vec4(0.0);\n\t\t\t\t}\n\t\t\t",e.pyramidTextureSize.value=new Ht(this.pyramidRenderTarget.width,this.pyramidRenderTarget.height),Object.assign(t.uniforms,e)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}},XB=qB;XB.streamCompaction=new class{constructor(){this.pyramidPassScene=new da,this.pyramidPassMaterial=new jB({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);this.pyramidPassMaterial.fragmentShader="\n\t\t\tprecision highp float;\n\t\t\tprecision highp sampler2D;\n\t\t\tlayout(location = 0) out vec4 pc_FragColor;\n\t\t\tuniform sampler2D inputTexture;\n\t\t\tuniform float inputWidth;\n\t\t\tuniform float inputHeight;\n\t\t\tuniform float inputShiftX;\n\t\t\tuniform float outputShiftX;\n\t\t\tconst vec2 half_unit_coord = vec2(0.5);\n\t\t\tconst vec4 one = vec4(1.0);\n\t\t\tvoid main() {\n\t\t\t\tvec2 inputSize = vec2(inputWidth, inputHeight);\n\t\t\t\tvec2 input_pixel_uv = 1. / inputSize;\n\t\t\t\tvec2 coord = gl_FragCoord.xy - half_unit_coord;\n\t\t\t\tcoord.x -= outputShiftX;\n\t\t\t\tcoord = coord * 2. + half_unit_coord;\n\t\t\t\tcoord.x += inputShiftX;\n\n\t\t\t\t// sample bottom left corner\n\t\t\t\tvec2 input_uv = coord / inputSize;\n\t\t\t\tfloat bl = texture(inputTexture, input_uv).r;\n\n\t\t\t\t// sample bottom right corner\n\t\t\t\tinput_uv.x += input_pixel_uv.x;\n\t\t\t\tfloat br = texture(inputTexture, input_uv).r;\n\n\t\t\t\t// sample top right corner\n\t\t\t\tinput_uv.y += input_pixel_uv.y;\n\t\t\t\tfloat tr = texture(inputTexture, input_uv).r;\n\n\t\t\t\t// sample top left corner\n\t\t\t\tinput_uv.x -= input_pixel_uv.x;\n\t\t\t\tfloat tl = texture(inputTexture, input_uv).r;\n\n\t\t\t\tpc_FragColor.a = bl;\n\t\t\t\tpc_FragColor.b = pc_FragColor.a + br;\n\t\t\t\tpc_FragColor.g = pc_FragColor.b + tr;\n\t\t\t\tpc_FragColor.r = pc_FragColor.g + tl; \n\t\t\t}\n\t\t",this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new cn(VB,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(t,e,i,n,r){(new sh).min.setScalar(0);let s=e.length-1,a=new me;i.getViewport(a),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let o=s-1;for(let h=o;h>=0;h--){let s=h%2==o%2?r[0]:r[1],a=h===o?n:h%2==o%2?r[1]:r[0];this.pyramidPassUniforms.inputTexture.value=Array.isArray(a.texture)?a.texture[1]:a.texture,this.pyramidPassUniforms.inputWidth.value=a.width,this.pyramidPassUniforms.inputHeight.value=a.height,i.setRenderTarget(s);let l=e[h],c=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/c,0,l/c,l/c),2===h&&t%2!=0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/c,0,3/c,3/c),i.render(this.pyramidPassScene,GB);let d=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=d,h<o&&(this.pyramidPassUniforms.outputShiftX.value+=e[h+1])}i.setViewport(a);let l=e.length%2==0?0:1;return i.readRenderTargetPixelsAsync(r[l],r[l].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}};var YB=new Ze,QB=new Ze,ZB=new xe,KB=new be,JB=new be,$B=new xe;function tz(t,e=0){let i=this.children.length;for(;i--;){let n=this.children[i];KS.is(n)&&ez.call(n,t,e+1)}}function ez(t,e=0){if(!0!==t(this,e)){let i=this.children.length;for(;i--;){let n=this.children[i];KS.is(n)&&ez.call(n,t,e+1)}}}function iz(){if(void 0===this.shapesDataTexture.value){let t=new ga(new Float32Array(1920),WB,5,nt,tt);this.shapesDataTexture.value=t}let t=this.shapesDataTexture.value,e=t.image.data;t.needsUpdate=!0;let i=0,n=this.data.geometry.blendRange,r=YB.copy(this.matrixWorld).invert(),s=0;tz.call(this,t=>{if(!1===t.visible)return!0;let a;if(t instanceof bI)return;if(t instanceof eO||t instanceof NB)return;a=t instanceof o_?t.object:t;let o=t.data?.cloner;if(r_.is(t)&&o&&!o.hideBase&&"radial"!==o.type&&!0!==o.disabled||!(a instanceof ID))return;let l=a.geometry.userData.parameters,h=l.shapeBlendNode;if(void 0===h)return;if(QB.multiplyMatrices(r,t.matrixWorld).decompose(JB,ZB,KB),"TorusGeometry"===l.type&&360!==l.arc){let t=l.arc*Math.PI/180;t/=4,ZB.multiply($B.set(0,0,Math.sin(t),Math.cos(t)))}let c=h.overrideGlobalBlend?h.blendRange:n;c=c/this.bboxSize*2,e[4*s]=(JB.x-this.bboxOffset)/this.bboxSize*2,e[4*s+1]=(JB.y-this.bboxOffset)/this.bboxSize*2,e[4*s+2]=(JB.z-this.bboxOffset)/this.bboxSize*2,e[4*s+3]=0===h.operation?1:2===h.operation?-1:-2,e[384+4*s]=-
2ZB.x,e[384+4*s+1]=-ZB.y,e[384+4*s+2]=-ZB.z,e[384+4*s+3]=ZB.w;let d=new Float32Array(4),u=0;if("SphereGeometry"===l.type)l.width===l.height&&l.width===l.depth?d[0]=0:d[0]=1,d[1]=l.width/this.bboxSize,d[2]=l.height/this.bboxSize,d[3]=l.depth/this.bboxSize,i=Math.max(i,d[1]*KB.x+c,d[2]*KB.x+c,d[3]*KB.x+c);else if("CubeGeometry"===l.type){u=l.cornerRadius;let t=l.width,e=l.height,n=l.depth;d[0]=2,d[1]=(t-2*u)/this.bboxSize,d[2]=(e-2*u)/this.bboxSize,d[3]=(n-2*u)/this.bboxSize,i=Math.max(i,Math.sqrt(t**2+e**2+n**2)/this.bboxSize*KB.x+c)}else if("CylinderGeometry"===l.type){u=l.cornerRadius;let t=l.height,e=l.radiusBottom,n=l.radiusTop;if(n>=e){let i=Math.atan2(n-e,t),r=(Math.PI/2-i)/2;n-=u/Math.tan(r),e-=u*Math.tan(r)}else if(e>n){let i=Math.atan2(e-n,t),r=(Math.PI/2-i)/2;n-=u*Math.tan(r),e-=u/Math.tan(r)}d[1]=(l.height-2*u)/this.bboxSize,e===n?(d[0]=3,d[2]=e/this.bboxSize*2):(d[0]=4,d[2]=e/this.bboxSize*2,d[3]=n/this.bboxSize*2),i=Math.max(i,4*d[1]*KB.x+c)}else if("TorusGeometry"===l.type){if(d[0]=5,d[1]=(l.width-l.depth)/this.bboxSize,d[2]=l.depth/this.bboxSize,360!==l.arc){d[0]=6,d[3]=d[1],e[1152+4*s+3]=d[2];let t=2*Math.atan2(d[2]/2,d[1]),i=l.arc*Math.PI/180/2-t;d[1]=Math.sin(i),d[2]=Math.cos(i)}i=Math.max(i,l.width*KB.x/this.bboxSize+c)}e.set(d,768+4*s),e[1152+4*s]=c,e[1152+4*s+1]=u/this.bboxSize*2,e[1152+4*s+2]=KB.x;let p=a.material,f=p.uniforms.nodeU0.node.value,m=p.uniforms.nodeU1.value;0!==h.operation&&!h.useColor&&(m=-1),e[1536+4*s]=f.r,e[1536+4*s+1]=f.g,e[1536+4*s+2]=f.b,e[1536+4*s+3]=m,m<1&&1===this.material.defines.SHAPEBLEND_C&&(this.material.transparent=!0),s++}),this.npart=s,this.spatialPassUniforms.span.value=1.4*i}function nz(t,e){let i=!1,n=512&t.layers.mask,r=e.getLayersOfType("transmission"),s=e.getLayersOfType("outline");return s.length>0&&(t.layers.set(8),r.length>0&&t.layers.enable(3),i=!0,RD(t),OD(t)),0===r.length&&0===s.length&&t.layers.set(0),n&&t.layers.set(9),t instanceof MD&&t.needsAO&&t.layers.enable(5),i}function rz(t,e){if(!e.layers)return!1;let i=512&t.layers.mask,n=!1,r=e.getLayersOfType("transmission").filter(t=>t.data.visible),s=e.getLayersOfType("outline").filter(t=>t.data.visible);return r.length>0&&(t.layers.set(3),s.length>0&&t.layers.enable(8),n=!0),0===r.length&&0===s.length&&t.layers.set(0),i&&t.layers.set(9),t.needsAO&&t.layers.enable(5),n}var sz=new th,az=new Ze,oz=new Qe;function lz(t,e,i,n=!1){let r=t.cloner;if(r)for(let s of r.children){let r=az.copy(s.matrixWorld).invert(),a=oz.copy(e.ray).applyMatrix4(r),o=t.matrixWorld;a.applyMatrix4(o);let l=sz;l.set(a.origin,a.direction),l.near=e.near,l.far=e.far;let h=l.intersectObject(t,!1);h.length>0&&i.push({...h[0],object:n?s:t})}}var hz=class{constructor(){this._constraints=new Map}setConstraint(t,e){null===e?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((i,n)=>{let r=[n,i],s=i;for(;this._constraints.has(s)&&(s=this._constraints.get(s),!r.includes(s));)e.has(s)||r.push(s);for(let a=r.length-2;a>=0;a--)if(!e.has(r[a])){let i=t.find(r[a]);i&&i.applyPathSnapping(t),e.add(r[a])}})}findDependency(t,e){let i=t;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===e)return!0;return!1}},cz=class{};function dz(t){let e,i,n,r,s,a,o,l,h,c,d,u,p,f,m,g;function v(t,e,a){let o=new Float32Array(c,s,3*i);n=0;let l=new Uint32Array(c,r,i);for(let i=0;i<a.length-1;i++){let r=e[i],s=t[i].elements,h=r.filter(t=>t.enabled&&"Include"===t.mode).map(t=>"Box"===t.type?x(t):w(t)),c=r.filter(t=>t.enabled&&"Exclude"===t.mode).map(t=>"Box"===t.type?x(t):w(t));for(let t=a[i];t<a[i+1];t++){let e=p[3*t],i=p[3*t+1],r=p[3*t+2];if((0===h.length||y(e,i,r,h))&&(0===c.length||!y(e,i,r,c))){let a=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);o[3*n]=(s[0]*e+s[4]*i+s[8]*r+s[12])*a,o[3*n+1]=(s[1]*e+s[5]*i+s[9]*r+s[13])*a,o[3*n+2]=(s[2]*e+s[6]*i+s[10]*r+s[14])*a,l[n]=t,n++}}}}function y(t,e,i,n,r){return n["Intersect"===r?"every":"some"](n=>{let r=function(t,e,i,n,r){let s=t-r[0],a=e-r[1],o=i-r[2],l=1/(n[3]*s+n[7]*a+n[11]*o+n[15]);return{x:(n[0]*s+n[4]*a+n[8]*o+n[12])*l+r[0],y:(n[1]*s+n[5]*a+n[9]*o+n[13])*l+r[1],z:(n[2]*s+n[6]*a+n[10]*
2o+n[14])*l+r[2]}}(t,e,i,n.invRotationMatrix,n.cropCenter);return Array.isArray(n)?function(t,e,i,n){return t>=n[0]&&t<=n[3]&&e>=n[1]&&e<=n[4]&&i>=n[2]&&i<=n[5]}(r.x,r.y,r.z,n):function(t,e,i,n){let r=(t-n.cropCenter[0])*n.invRadiusX,s=(e-n.cropCenter[1])*n.invRadiusY,a=(i-n.cropCenter[2])*n.invRadiusZ;return r*r+s*s+a*a<=1}(r.x,r.y,r.z,n)})}function x(t){let e=t.cropSize[0]/2,i=t.cropSize[1]/2,n=t.cropSize[2]/2,r=[t.cropCenter[0]-e,t.cropCenter[1]-i,t.cropCenter[2]-n,t.cropCenter[0]+e,t.cropCenter[1]+i,t.cropCenter[2]+n],s=b(t.cropRotation);return Object.assign(r,{invRotationMatrix:s,cropCenter:t.cropCenter})}function b(t){let e=[],i=t[0]*Math.PI/180,n=t[1]*Math.PI/180,r=t[2]*Math.PI/180,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r),d=s*h,u=s*c,p=a*h,f=a*c;return e[0]=o*h,e[1]=-o*c,e[2]=l,e[4]=u+p*l,e[5]=d-f*l,e[6]=-a*o,e[8]=f-d*l,e[9]=p+u*l,e[10]=s*o,e[12]=0,e[13]=0,e[14]=0,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function w(t){let e=2/t.cropSize[0],i=2/t.cropSize[1],n=2/t.cropSize[2],r=b(t.cropRotation);return{invRadiusX:e,invRadiusY:i,invRadiusZ:n,cropCenter:t.cropCenter,invRotationMatrix:r}}t.onmessage=b=>{if(b.data.getCroppedIndexes){let e=new Uint32Array(function(t,e){let i=[],n=e.filter(t=>t.enabled&&"Include"===t.mode).map(t=>"Box"===t.type?x(t):w(t)),r=e.filter(t=>t.enabled&&"Exclude"===t.mode).map(t=>"Box"===t.type?x(t):w(t)),s=t.length;for(let a=0;a<s;a+=3){let e=t[a],s=t[a+1],o=t[a+2];(0===n.length||y(e,s,o,n))&&(0===r.length||!y(e,s,o,r))||i.push(a/3)}return i}(new Float32Array(b.data.positions),b.data.crops)).buffer;t.postMessage({outOfBoundsIndexes:e},[e])}else if(b.data.positions)d=b.data.positions,p=new Float32Array(d),m=b.data.meshMatrixWorlds,g=b.data.cropsArray,f=b.data.meshIndexIntervals,v(m,g,f),t.postMessage({sortSetupComplete:!0});else if(b.data.sort||b.data.newMatrixWorlds||b.data.newCropsArray)(b.data.newMatrixWorlds||b.data.newCropsArray)&&(g=b.data.newCropsArray||g,m=b.data.newMatrixWorlds||m,v(m,g,f)),function(d){let p,f=new Float64Array(c,a,16);for(let t=0;t<16;t++)f[t]=d[t];if(n>1){e.exports.sortIndexes(r,s,h,a,o,l,u.DepthMapRange,n);let t=new Uint32Array(n);p=t.buffer,t.set(new Uint32Array(c,l,n))}else if(1===n){let t=new Uint32Array(n);t[0]=new Uint32Array(c,r,i)[0],p=t.buffer}else p=new ArrayBuffer(0);t.postMessage({sortDone:!0,indexesBuffer:p},[p])}(b.data.sort.view,b.data.sort.cameraPosition);else if(b.data.init){u=b.data.init.Constants,i=b.data.init.splatCount;let n=u.BytesPerInt,d=3*u.BytesPerFloat,p=new Uint8Array(b.data.init.sorterWasmBytes),f=i*(n+d)+(i*u.BytesPerInt*2+u.DepthMapRange*u.BytesPerInt*2)+32*u.MemoryPageSize,m=Math.floor(f/u.MemoryPageSize)+1,g={module:{},env:{memory:new WebAssembly.Memory({initial:2*m,maximum:3*m,shared:!0})}};WebAssembly.compile(p).then(t=>WebAssembly.instantiate(t,g)).then(p=>{e=p,r=0,s=i*n,a=s+i*d,h=a+16*u.BytesPerFloat*2,o=h+i*u.BytesPerInt,l=o+u.DepthMapRange*u.BytesPerInt,c=g.env.memory.buffer,t.postMessage({sortSetupPhase1Complete:!0})})}}}c(cz,"DepthMapRange",65536),c(cz,"MemoryPageSize",65536),c(cz,"BytesPerFloat",4),c(cz,"BytesPerInt",4);var uz=function(){let t=new Float32Array(1),e=new Int32Array(t.buffer);return function(i){return t[0]=i,e[0]}}(),pz=function(t,e,i,n){return t+(e<<8)+(i<<16)+(n<<24)},fz=new Ht;function mz(t){let e=!1;return t.scene.objects.traverse((t,i)=>{if(!1===i.visible)return!0;"Splat"===i.type&&(e=!0)}),e}var gz,vz,yz,xz=class extends cn{constructor(t,e,i,n,r=!1,s=1,a,o){super(i,n),this.splatCount=e,this.meshIndexIntervals=a,this.meshMatrixWorlds=o,this.splatBuffers=t,this.geometry=i,this.material=n,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=r,this.devicePixelRatio=s,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(t,e,i=!1,n=1,r,s){let a=xz.buildGeomtery(e),o=xz.buildMaterial(r);return new xz(t,e,a,o,i,n,r,s)}static buildMaterial(t){let e={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:t},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new Ht},viewport:{type:"v2",value:new Ht},basisViewport:{type:"v2",value:new Ht},debugColor:{type:"v3",value:new le},covariancesTextureSize:{type:"v2",value:new Ht(1024,1024)},centersColorsTextureSize:{type:"v2",value:new Ht(1024,1024)},orthoZoom:{type:"f",value:-1}};return new vn({uniforms:e,vertexShader:"\n precision highp float;\n #include <common>\n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform vec2 focal;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n\t\t\t\t\t\tuniform highp sampler2D meshMatrixWorldsTexture;\n\t\t\t\t\t\tuniform uint meshIndexIntervals[257];\n\t\t\t\t\t\tuniform float orthoZoom;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(
2offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n void main () {\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n vPosition = position.xy * 2.0;\n\n\t\t\t\t\t\t\t\tuint meshIndex;\n\t\t\t\t\t\t\t\tfor (int i = 1; i < 257; i++) {\n\t\t\t\t\t\t\t\t\tif (splatIndex < meshIndexIntervals[i]) {\n\t\t\t\t\t\t\t\t\t\tmeshIndex = uint(i - 1);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfloat strideMulmeshIndex = float(4u*meshIndex);\n\t\t\t\t\t\t\t\tfloat meshMatrixWorldsTextureLength = float(256*4);\n\n\t\t\t\t\t\t\t\tmat4 modelMat = mat4(\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tmat4 modelViewMat = viewMatrix * modelMat;\n\t\t\t\t\t\t\t\tvec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); \n vec4 clipCenter = projectionMatrix * viewCenter;\n\n vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;\n vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;\n vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);\n\n // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix\n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n\n mat3 W = transpose(mat3(modelViewMat));\n mat3 T = orthoZoom > 0.0 ? W : W * mat3(\n\t\t\t\t\t\t\t\t\tfocal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n\t\t\t\t\t\t\t\t\t0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n\t\t\t\t\t\t\t\t\t0., 0., 0.\n\t\t\t\t\t\t\t\t);\n mat3 cov2Dm = transpose(T) * Vrk * T;\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n\n // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because\n // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0],\n // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't\n // need cov2Dm[1][0] because it is a symetric matrix.\n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix\n // so that we can determine the 2D basis for the splat. This is done using the method described\n // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html\n //\n // This is a different approach than in the original work at INRIA. In that work they compute the\n // max extents of the 2D covariance matrix in screen space to form an axis aligned boun
2ding rectangle\n // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance\n // matrix (called 'conic') to determine fragment opacity.\n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(trace * trace / 4.0 - D);\n float eigenValue1 = traceOver2 + term2;\n\t\t\t\t\t\t\t\tfloat eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value\n\n const float maxSplatSize = 1024.0;\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n // since the eigen vectors are orthogonal, we derive the second one from the first\n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);\n vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;\n\n\t\t\t\t\t\t\t\tif (orthoZoom > 0.0) {\n\t\t\t\t\t\t\t\t\tndcOffset *= orthoZoom;\n\t\t\t\t\t\t\t\t}\n\n gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n }",fragmentShader:"\n precision highp float;\n #include <common>\n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\t\t\t\t\t\tlayout(location = 1) out vec4 gVelocity; \n\n void main () {\n // compute the negative squared distance from the center of the splat to the\n // current fragment in the splat's local space.\n float A = -dot(vPosition, vPosition);\n if (A < -4.0) discard;\n vec3 color = vColor.rgb;\n A = exp(A) * vColor.a;\n gl_FragColor = vec4(color.rgb, A);\n\t\t\t\t\t\t\t\tgVelocity = vec4(0.0); // so it is ignored by TAA\n }",transparent:!0,alphaTest:1,blending:1,depthTest:!0,depthWrite:!1,side:2})}static buildGeomtery(t){let e=new Qi;e.setIndex([0,1,2,0,2,3]);let i=new Float32Array(12),n=new Ni(i,3);e.setAttribute("position",n),n.setXYZ(0,-1,-1,0),n.setXYZ(1,-1,1,0),n.setXYZ(2,1,1,0),n.setXYZ(3,1,-1,0),n.needsUpdate=!0;let r=(new Ll).copy(e),s=new Uint32Array(t),a=new ba(s,1,!1);return a.setUsage(35048),r.setAttribute("splatIndex",a),r.instanceCount=t,r}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(t=>t.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,i=0;for(let n of this.splatBuffers){let r=n.nsplats;this.colors.subarray(t,t+4*r).set(n.colorsA),t+=4*r,this.centers.subarray(e,e+3*r).set(n.decoded.xyz.denormDequant().data),e+=3*r,this.covariances.subarray(i,i+6*r).set(new Float32Array(n.precomputedCovarianceBufferData)),i+=6*r}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new Ht(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let i,n,r=new Ht(4096,1024);for(;r.x*r.y*4<4*t;)r.y*=2;if(this.halfPrecisionCovariancesOnGPU){n=new Uint16Array(e.x*e.y*2);for(let t=0;t<this.covariances.length;t++)n[t]=_h.toHalfFloat(this.covariances[t]);i=new ga(n,e.x,e.y,ot,et)}else n=new Float32Array(e.x*e.y*2),n.set(this.covariances),i=new ga(n,e.x,e.y,ot,tt);i.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=i,this.material.uniforms.covariancesTextureSize.value.copy(e);let s=new Uint32Array(r.x*r.y*4);for(let h=0;h<t;h++){let t=4*h,e=3*h,i=4*h;s[i]=pz(this.colors[t],this.colors[t+1],this.colors[t+2],this.colors[t+3]),s[i+1]=uz(this.centers[e]),s[i+2]=uz(this.centers[e+1]),s[i+3]=uz(this.centers[e+2])}let a=new ga(s,r.x,r.y,1033,$);a.internalFormat="RGBA32UI",a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(r);let o=new Float32Array(4096);for(let h=0;h<this.meshMatrixWorlds.length;h++)o.set(this.meshMatrixWorlds[h].elements,16*h);let l=new ga(o,1024,1,nt,tt);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:n,texture:i,size:e},centerColors:{data:s,texture:a,size:r},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,i,n){this.splatCount>0&&(fz.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(fz),this.material.uniforms.basisViewport.value.set(2/fz.x,2/fz.y),this.material.uniforms.focal.value.set(e,i),this.material.uniforms.orthoZoom.value=n,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()}},bz=new Promise(t=>{gz=t}),wz=!1;function Sz(){if(!wz)return vz||(vz=async function(){let t=await e(()=>import("./gaussian-splat-compression-CcwPx0fu.js"),[]);gz(t),wz=!0}(),vz)}bz.then(t=>yz=t);var _z=class{constructor(t={}){c(this,"updateView",function(){let t=new Ze,e=[],i=new be(0,0,-1),n=new be(0,0,-1),r=new be,s=new be;return function(a=!1,o){let l=this.updateMatrixWorldsInWorkerIfNeeded(),h=this.cropsChanged();if(!a){n.set(0,0,-1).applyQuaternion(o.quaternion);let t=!1,e=!1;if(n.dot(i)<=.95&&(t=!0),s.copy(o.position).sub(r).length()>=1&&(e=!0),!(t||e||l||h||this.needsInitialRender))return}this.needsInitialRender=!1,r.copy(o.position),i.copy(n),t.copy(o.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=o.position.x,e[1]=o.position.y,e[2]=o.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...h?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}()),this.scene=t.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 Ze).makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let i=new Ht;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(t.getSize(i),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*i.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*i.y*.45,this.splatMesh.updateUniforms(i,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=(new be).fromArray(t.position)),t.orientation&&(t.orientation=(new xe).fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];
vendor: 4,241 bytes, line 2
2if(this.splatEntries=e,this.activePage.traverseVisibleEntity(t=>{"Splat"===t.data.type&&e.push(t)}),this.splatMesh&&this.splatMesh.dispose(),0===e.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(t=>t.matrixWorld),this.meshMatrixWorldsOld=e.map(t=>t.matrixWorld.clone()),this.cropsArray=e.map(t=>t.data.crops.map(t=>t.data));let i=e.map(t=>new yz.GSplineBuffer(new Uint8Array(t.data.buffer).buffer)),n=0,r=[0];for(let s of i)n+=s.getSplatCount(),r.push(n);return this.setupSplatMesh(i,n,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,r,this.meshMatrixWorlds),this.setupSortWorker(n),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((t,e)=>t.equals(this.meshMatrixWorldsOld[e]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,i)=>{e.data.crops.forEach((e,n)=>{void 0===this.cropsArray[i][n]?(t=!0,this.cropsArray[i][n]=e.data):Object.entries(e.data).forEach(([e,r])=>{(Array.isArray(r)&&r.some((t,r)=>t!==this.cropsArray[i][n][e][r])||r!==this.cropsArray[i][n]?.[e])&&(t=!0,this.cropsArray[i][n][e]=r)})}),e.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,i=new be,n=new xe,r=!1,s=1,a,o){this.splatMesh=xz.buildMesh(t,e,r,s,a,o),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(n),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(t,e,i)=>this.update(t,i)}setupSortWorker(t){this.sortWorker=function(t){let e=new Worker(URL.createObjectURL(new Blob(["(",dz.toString(),")(self)"],{type:"application/javascript"}))),i=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),n=new Uint8Array(i.length);for(let r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return e.postMessage({init:{sorterWasmBytes:n.buffer,splatCount:t,Constants:{BytesPerFloat:cz.BytesPerFloat,BytesPerInt:cz.BytesPerInt,DepthMapRange:cz.DepthMapRange,MemoryPageSize:cz.MemoryPageSize}}}),e}(t),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){null!==this.splatMesh&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}},Az=new Bi;Az.wireframe=!0;var Mz=new be,Cz=class extends da{constructor(t,e){super(),this.data=t,this.sharedAssets=e,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={}
vendor: 16,314 bytes, line 2
2,this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new hz,this.invisibleObjects=new tO("jflkdsafjasdifjaslk",{...ob.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,e),this.matrixAutoUpdate=!1,this.errorPage=new mB("fdasfa",{...gb.defaultData,name:""},{shared:e,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=function(t){let e=!1;return t.traverseEntity(t=>{if(t instanceof MD)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)rz(t,t.material[i])&&(e=!0);else rz(t,t.material)&&(e=!0)}),e}(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=function(t){let e=!1;return t.traverseEntity(t=>{if(t instanceof MD)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)nz(t,t.material[i])&&(e=!0);else nz(t,t.material)&&(e=!0)}),e}(this),this.needsNormalDirty=!1),this._needsNormal}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),i=this.entityIdentityToEntity[e];i&&(t.uuid=i.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof mB&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let i=[],n=e;for(;n!==this;){let t=n;n=n.parent;let e=n.children.indexOf(t);i.splice(0,0,e)}return{entity:e,sortKey:i}}getAllSorted(t){let e=[];for(let i of t){let t=this.getWithSortKey(i.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>Hm(t.sortKey,e.sortKey)),e.map(t=>t.entity)}nonExistOrDescendantOf(t,e){let i=this.find(t);if(void 0===i)return!0;for(;i;){if(i.uuid===e)return!0;i=i.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===t)return this.activePage.personalCamera;if(t===sx)return this.activePage.personalCamera}if(""===t||void 0===t)return;let e=this.entityByUuid[t];return void 0===e?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof mB&&e.uiScene){let i=e.uiScene.find(t);if(i)return i}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof mB&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(i=>{void 0===e&&i instanceof MB&&(e=i.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof mB&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e&&Array.isArray(e.identity)&&this.findInstance(e.identity)}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(){this.toExpandCloner.forEach(t=>{t.expandCloner(this)}),this.toExpandCloner.clear()}doPendingUpdateCloner(){this.toUpdateCloner.forEach(t=>{t.cloner?.update()}),this.toUpdateCloner.clear()}doPendingUpdates(){this.doPendingExpandCloner(),this.doPendingUpdateCloner(),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){1===t.path.length&&"components"===t.path[0]&&1===t.type&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let i=null===t.parent?this:this.find(t.parent);if(void 0===i)throw new Error("unexpected");let n=this.createObject(t.id,t.data,t.children,i,t.localIndex,e);n.updateVisible(this),n.resetBBoxNeedsUpdate(),qI(n)&&XI(n.parent)&&(n.invalidateUpstreamBooleanData(),n.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(n),this.markToExpandCloner(n),this.markPenumbraSizeDirty(),n.updatePathSnapping()}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0===e)throw new Error("unexpected");e.traverseEntity(t=>{t instanceof XB&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(e=>e!==t))}),this.markToExpandCloner(e),e.resetBBoxNeedsUpdate(),this.unregisterObject(e);let i=e.parent;this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(e),this.markPenumbraSizeDirty(),e.parent.remove(e),XI(e.parent)&&(e.parent.invalidateUpstreamBooleanData(),e.parent.invalidateDownstreamBooleanData().recomputeBoolean()),qI(e)&&(e.freeBooleanPointer(),i instanceof WI&&i.invalidateDownstreamBooleanData().recomputeBoolean()),e instanceof yB&&e.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(e),this.pathConstraints.removeDependencies(e.uuid),e.updatePathSnapping()}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0===e)throw new Error("unexpected");this.markNeedsRecomputeInstancesForChildren(e);let i=e.parent;this.markNeedsRecomputeInstancesForAncessors(i),e.cloner?.resetOnMove(),this.markToExpandCloner(e);let n=null===t.parent?this:this.find(t.parent);if(void 0===n)throw new Error("unexpected");n.add(e),this.markNeedsRecomputeInstancesForAncessors(n),this.markToExpandCloner(e),e.invalidateClonerTransform(e),e.updateVisible(this),e.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let r=t.localIndex;n.children.splice(r,0,n.children.pop()),qI(e)&&(e.invalidateUpstreamBooleanData(),XI(e.parent)?e.parent.invalidateDownstreamBooleanData().recomputeBoolean():i instanceof WI&&i.invalidateDownstreamBooleanData().recomputeBoolean()),e.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof mB&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,i,n){if(0===e.type){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:t}=e.props;e={...e,props:t},this.markNeedsRecomputeInstances()}"pathSnapping"===e.path[0]&&void 0!==e.props.pathId&&this.pathConstraints.setConstraint(t,e.props.pathId)}let r=this.find(t);if(r)try{(function(t,e,i,n){t.updateByOp(e,i,n,!1)})(r,e,i,{scene:this,shared:n}),r instanceof ID&&r.updateGeometryGroupsIfNeeded()}catch(Qy){}}updateEntity2DByOp(t,e,i,n,r,s=[]){t.updateEntityByOp(e,i,n,r),this.traverseEntity(t=>{(t instanceof MB||t instanceof mB)&&(s.includes(t.frameId??"")||t.frameId===e)&&t.updateEntity2DByOp(e,i,n,r)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let i=Object.entries(e.data.lib.components).map((t,e)=>({data:t[1].asset.data,children:t[1].asset.children,id:t[0],fi:e}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(t=>{t instanceof UI&&t.updateUp()}),this.doPendingExpandCloner(),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(t=>{("Component"===t.data.type||"Instance"===t.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){r_.is(t)&&("Component"===t.data.type&&this.markNeedsRecomputeInstances(),t.traverseAncestors(t=>{r_.is(t)&&"Component"===t.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,i,n,r,s,a){if(t){let o=n.find(t);o&&o!==n&&r.forInstancesRec(n=>{n.data=$g(n.data,r=>{let o=r.events.data(a.id),l=n.goUp(s);if(l){let n=[...Wm(l.identity),t].join("-"),r=this.entityIdentityToEntity[n];if(r){let t=r.uuid;Qg.zoom(o,e)[i]=t}}}).data})}}rewriteActions(t,e,i,n,r,s){t.forEach(t=>{"Transition"===t.data.type||"Animation"===t.data.type?this.relativeizeInner(t.data.object,[...e,t.id],"object",i,n,r,s):"Conditional"===t.data.type&&(this.rewriteActions(t.data.ifActions,[...e,t.id,"ifActions"],i,n,r,s),this.rewriteActions(t.data.elseActions,[...e,t.id,"elseActions"],i,n,r,s))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(t instanceof bB&&"string"==typeof t.identity&&"Component"===t.data.type)return t.traverseEntity((e,i)=>{e.data.events.forEach(n=>{if("GameControl"===n.data.type){let r=!1;if(e.forInstancesRec(t=>{t.data=$g(t.data,e=>{t.isInstanceRoot||(e.events.delete(n.id),r=!0)}).data}),!1===r)for(let s of Bb.list)this.rewriteActions(n.data.gameActions[s],["gameActions",s],t,e,i,n)}else"Conditional"===n.data.type?("Distance"===n.data.condition.type?(this.relativeizeInner(n.data.condition.fromObject,["condition"],"fromObject",t,e,i,n),this.relativeizeInner(n.data.condition.toObject,["condition"],"toObject",t,e,i,n)):"State"===n.data.condition.type?this.relativeizeInner(n.data.condition.object,["condition"],"object",t,e,i,n):"Comparison"===n.data.condition.type&&("Property"===n.data.condition.lOperand.type&&this.relativeizeInner(n.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,i,n),"Property"===n.data.condition.rOperand.type&&this.relativeizeInner(n.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,i,n)),this.rewriteActions(n.data.inActions,["inActions"],t,e,i,n),this.rewriteActions(n.data.outActions,["outActions"],t,e,i,n)):"actions"in n.data&&this.rewriteActions(n.data.actions,["actions"],t,e,i,n)})}),!0})}expandInstances(t,e,i){let n=new Set;this.traverseEntity(r=>{if(r instanceof bB&&r.isInstanceRoot)return r.expandInstanceChildren({scene:this,shared:t,pendingDeletes:n}),e||r.resetBBoxNeedsUpdate(),i&&r.traverseEntity(t=>{i.addClip(t)}),!0});for(let r of n)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(r),wB(r)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(t=>{t instanceof bB&&t.isInstanceRoot&&(t.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(t=>{let e="string"==typeof t.identity?t.identity:t.identity.join("-");this.entityIdentityToEntity[e]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[e]),t.dispose()})}clearScene(){for(let t of this.children)r_.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let i=[],n=r=>{for(let s of r.children){let r=s.cloner;if(r_.is(s)&&!s.raycastLock&&(s.visible||r?.object.data.visible))if(!0===e&&s.isInstanceRoot){let e=[];if(t.intersectObject(s,!0,e),e.length){let t=e[0];t.object=s,t.point.applyMatrix4(t.object.matrixWorld);let n=s.matrixWorld.clone().invert();t.point.applyMatrix4(n),i.push(t)}}else(qI(s)||YI(s)&&this.enableHelpers&&s.objectHelper.visible)&&(t.intersectObject(s,!1,i),lz(s,t,i)),n(s)}};return n(this.activePage),i}raycastWithClones(t){let e=[],i=n=>{for(let r of n.children){let n=r.cloner;r_.is(r)&&(r.visible||n?.object.data.visible)&&((qI(r)||YI(r)&&this.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,e),lz(r,t,e,!0)),i(r))}};return i(this),e}forEachEntity(t){for(let e of this.children)r_.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)r_.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)r_.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(i=>{if(i instanceof ID&&"Mesh"===i.data.type&&("TextGeometry"===i.data.geometry.type||"InputGeometry"===i.data.geometry.type)&&i.data.geometry.font===t){let n=i.geometry,r=i.data.geometry;n.updateFont(t,e).then(()=>{n.update(r,e);let t=i.invalidateDownstreamBooleanData();XI(t)&&t.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)KS.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)r_.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,i){let n=0;for(let r of t)this.createObject(r.id,r.data,r.children,e,n,i),n+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,i,n,r,s){let a={scene:this,shared:s},o=kB(t,e,a);return o instanceof XB&&this.shapeBlendIntances.push(o),o&&(this.entityByUuid[t]=o,n.add(o),n.children.splice(r,0,n.children.pop()),i.length>0&&(o.isInstanceRoot||this.createChildrenObjects(i,o,s)),o.updateState(e,a),o instanceof ID&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),"Empty"===e.type&&e.animations&&o.traverseEntity(t=>{let e=t.dataPatched;if(t instanceof ID&&e.bones&&e.boneInverses){let i=e.bones.map(t=>this.find(t)),n=e.boneInverses.map(t=>(new Ze).fromArray(t)),r=new xa(i,n);t.bind(r,t.bindMatrix)}else t.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,r=t.length;n<r;++n){let{id:i,recursive:r}=t[n],s=this.find(i),a=r?s.recursiveBBox:s.singleBBox;e.push(...a.vertices)}let i=new _e;return i.setFromPoints(e),i.getCenter(Mz),Mz}copyMatrixWorld(t,e){if(null===t)return void e.identity();let i=this.find(t);i?e.copy(i.matrixWorld):e.identity()}copyParentMatrixWorld(t,e){if(null===t)return void e.identity();let i=this.find(t)?.parent;i?e.copy(i.matrixWorld):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof JC)if(Array.isArray(e.material))for(let i=0;i<e.material.length;i++)e.material[i]instanceof LT&&t(e.material[i]);else e.material instanceof LT&&t(e.material)})}updateViewPlaneSize(t,e,i=!1){this.traverseConcreteEntity(n=>{n instanceof UI&&n.setViewplaneSize(t,e,i)})}initializeSplatViewer(){this.splatViewer=new _z({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}},Ez=(t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},Pz=t=>t*(Math.PI/180),Tz=t=>t*(180/Math.PI),Dz=new Map,Iz=t=>{Dz.has(t)&&clearTimeout(Dz.get(t)),Dz.set(t,setTimeout(t,100))},Oz=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent(n,i)},Rz=(t,e,i)=>{let n,r=e.split(/[ ,]+/g);for(let s=0;s<r.length;s+=1)n=r[s],t.removeEventListener?t.removeEventListener(n,i):t.detachEvent&&t.detachEvent(n,i)},Lz=t=>(t.preventDefault(),t.type.match(/^touch/)?t.changedTouches:t),Bz=()=>{if(typeof window>"u")return;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}},zz=(t,e)=>{e.top||e.right||e.bottom||e.left?(t.style.top=e.top,t.style.right=e.right,t.style.bottom=e.bottom,t.style.left=e.left):(t.style.left=e.x+"px",t.style.top=e.y+"px")},Fz=(t,e,i)=>{let n=Nz(t);for(let r in n)if(n.hasOwnProperty(r))if("string"==typeof e)n[r]=e+" "+i;else{let t="";for(let n=0,r=e.length;n<r;n+=1)t+=e[n]+" "+i+", ";n[r]=t.slice(0,-2)}return n},Nz=t=>{let e={};return e[t]="",["webkit","Moz","o"].forEach(function(i){e[i+t.charAt(0).toUpperCase()+t.slice(1)]=""}),e},Uz=(t,e)=>{for(let i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},kz=(t,e)=>{if(t.length)for(let i=0,n=t.length;i<n;i+=1)e(t[i]);else e(t)};typeof window<"u"&&(Vz="ontouchstart"in window,jz=!!window.PointerEvent,Gz=!!window.MSPointerEvent);
vendor: 16,630 bytes, line 2
2var Vz,jz,Gz,Wz,Hz={start:"mousedown",move:"mousemove",end:"mouseup"},qz={};function Xz(){}jz?Wz={start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"}:Gz?Wz={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:Vz?(Wz={start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},qz=Hz):Wz=Hz,Xz.prototype.on=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]=n._handlers_[i]||[],n._handlers_[i].push(e);return n},Xz.prototype.off=function(t,e){var i=this;return i._handlers_=i._handlers_||{},void 0===t?i._handlers_={}:void 0===e?i._handlers_[t]=null:i._handlers_[t]&&i._handlers_[t].indexOf(e)>=0&&i._handlers_[t].splice(i._handlers_[t].indexOf(e),1),i},Xz.prototype.trigger=function(t,e){var i,n=this,r=t.split(/[ ,]+/g);n._handlers_=n._handlers_||{};for(var s=0;s<r.length;s+=1)i=r[s],n._handlers_[i]&&n._handlers_[i].length&&n._handlers_[i].forEach(function(t){t.call(n,{type:i,target:n},e)})},Xz.prototype.config=function(t){var e=this;e.options=e.defaults||{},t&&(e.options=((t,e)=>{let i={};for(let n in t)t.hasOwnProperty(n)&&e.hasOwnProperty(n)?i[n]=e[n]:t.hasOwnProperty(n)&&(i[n]=t[n]);return i})(e.options,t))},Xz.prototype.bindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[e]=function(){"function"==typeof i["on"+e]&&i["on"+e].apply(i,arguments)},Oz(t,Wz[e],i._domHandlers_[e]),qz[e]&&Oz(t,qz[e],i._domHandlers_[e]),i},Xz.prototype.unbindEvt=function(t,e){var i=this;return i._domHandlers_=i._domHandlers_||{},Rz(t,Wz[e],i._domHandlers_[e]),qz[e]&&Rz(t,qz[e],i._domHandlers_[e]),delete i._domHandlers_[e],this};var Yz=Xz;function Qz(t,e){return this.identifier=e.identifier,this.position=e.position,this.frontPosition=e.frontPosition,this.collection=t,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(e),"dynamic"===this.options.mode&&(this.options.restOpacity=0),this.id=Qz.id,Qz.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}Qz.prototype=new Yz,Qz.constructor=Qz,Qz.id=0,Qz.prototype.buildEl=function(t){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},Qz.prototype.stylize=function(){if(this.options.dataOnly)return this;var t=this.options.fadeTime+"ms",e=((t,e)=>{let i=Nz(t);for(let n in i)i.hasOwnProperty(n)&&(i[n]=e);return i})("borderRadius","50%"),i=Fz("transition","opacity",t),n={};return n.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},n.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)"},n.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)"},Uz(n.el,i),"circle"===this.options.shape&&Uz(n.back,e),Uz(n.front,e),this.applyStyles(n),this},Qz.prototype.applyStyles=function(t){for(var e in this.ui)if(this.ui.hasOwnProperty(e))for(var i in t[e])this.ui[e].style[i]=t[e][i];return this},Qz.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)||this.options.zone.appendChild(this.ui.el),this},Qz.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)||this.options.zone.removeChild(this.ui.el),this},Qz.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()},Qz.prototype.show=function(t){var e=this;return e.options.dataOnly||(clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.addToDom(),e.restCallback(),setTimeout(function(){e.ui.el.style.opacity=1},0),e.showTimeout=setTimeout(function(){e.trigger("shown",e.instance),"function"==typeof t&&t.call(this)},e.options.fadeTime)),e},Qz.prototype.hide=function(t){var e=this;if(e.options.dataOnly)return e;if(e.ui.el.style.opacity=e.options.restOpacity,clearTimeout(e.removeTimeout),clearTimeout(e.showTimeout),clearTimeout(e.restTimeout),e.removeTimeout=setTimeout(function(){var i="dynamic"===e.options.mode?"none":"block";e.ui.el.style.display=i,"function"==typeof t&&t.call(e),e.trigger("hidden",e.instance)},e.options.fadeTime),e.options.restJoystick){let i=e.options.restJoystick,n={};n.x=!0===i||!1!==i.x?0:e.instance.frontPosition.x,n.y=!0===i||!1!==i.y?0:e.instance.frontPosition.y,e.setPosition(t,n)}return e},Qz.prototype.setPosition=function(t,e){var i=this;i.frontPosition={x:e.x,y:e.y};var n=i.options.fadeTime+"ms",r={};r.front=Fz("transition",["top","left"],n);var s={front:{}};s.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(r),i.applyStyles(s),i.restTimeout=setTimeout(function(){"function"==typeof t&&t.call(i),i.restCallback()},i.options.fadeTime)},Qz.prototype.restCallback=function(){var t=this,e={};e.front=Fz("transition","none",""),t.applyStyles(e),t.trigger("rested",t.instance)},Qz.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}},Qz.prototype.computeDirection=function(t){var e,i,n,r=t.angle.radian,s=Math.PI/4,a=Math.PI/2;if(r>s&&r<3*s&&!t.lockX?e="up":r>-s&&r<=s&&!t.lockY?e="left":r>3*-s&&r<=-s&&!t.lockX?e="down":t.lockY||(e="right"),t.lockY||(i=r>-a&&r<a?"left":"right"),t.lockX||(n=r>0?"up":"down"),t.force>this.options.threshold){var o,l={};for(o in this.direction)this.direction.hasOwnProperty(o)&&(l[o]=this.direction[o]);var h={};for(o in this.direction={x:i,y:n,angle:e},t.direction=this.direction,l)l[o]===this.direction[o]&&(h[o]=!0);if(h.x&&h.y&&h.angle)return t;(!h.x||!h.y)&&this.trigger("plain",t),h.x||this.trigger("plain:"+i,t),h.y||this.trigger("plain:"+n,t),h.angle||this.trigger("dir dir:"+e,t)}else this.resetDirection();return t};var Zz=Qz;function Kz(t,e){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=t,i.id=Kz.id,Kz.id+=1,i.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},i.config(e),("static"===i.options.mode||"semi"===i.options.mode)&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let n=getComputedStyle(i.options.zone.parentElement);return n&&"flex"===n.display&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}Kz.prototype=new Yz,Kz.constructor=Kz,Kz.id=0,Kz.prototype.prepareNipples=function(){var t=this,e=t.nipples;e.on=t.on.bind(t),e.off=t.off.bind(t),e.options=t.options,e.destroy=t.destroy.bind(t),e.ids=t.ids,e.id=t.id,e.processOnMove=t.processOnMove.bind(t),e.processOnEnd=t.processOnEnd.bind(t),e.get=function(t){if(void 0===t)return e[0];for(var i=0,n=e.length;i<n;i+=1)if(e[i].identifier===t)return e[i];return!1}},Kz.prototype.bindings=function(){var t=this;t.bindEvt(t.options.zone,"start"),t.options.zone.style.touchAction="none",t.options.zone.style.msTouchAction="none"},Kz.prototype.begin=function(){var t=this,e=t.options;if("static"===e.mode){var i=t.createNipple(e.position,t.manager.getIdentifier());i.add(),t.idles.push(i)}},Kz.prototype.createNipple=function(t,e){var i=this,n=i.manager.scroll,r={},s=i.options,a=i.parentIsFlex?n.x:n.x+i.box.left,o=i.parentIsFlex?n.y:n.y+i.box.top;if(t.x&&t.y)r={x:t.x-a,y:t.y-o};else if(t.top||t.right||t.bottom||t.left){var l=document.createElement("DIV");l.style.display="hidden",l.style.top=t.top,l.style.right=t.right,l.style.bottom=t.bottom,l.style.left=t.left,l.style.position="absolute",s.zone.appendChild(l);var h=l.getBoundingClientRect();s.zone.removeChild(l),r=t,t={x:h.left+n.x,y:h.top+n.y}}var c=new Zz(i,{color:s.color,size:s.size,threshold:s.threshold,fadeTime:s.fadeTime,dataOnly:s.dataOnly,restJoystick:s.restJoystick,restOpacity:s.restOpacity,mode:s.mode,identifier:e,position:t,zone:s.zone,frontPosition:{x:0,y:0},shape:s.shape});return s.dataOnly||(zz(c.ui.el,r),zz(c.ui.front,c.frontPosition)),i.nipples.push(c),i.trigger("added "+c.identifier+":added",c),i.manager.trigger("added "+c.identifier+":added",c),i.bindNipple(c),c},Kz.prototype.updateBox=function(){this.box=this.options.zone.getBoundingClientRect()},Kz.prototype.bindNipple=function(t){var e,i=this,n=function(t,n){e=t.type+" "+n.id+":"+t.type,i.trigger(e,n)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},Kz.prototype.pressureFn=function(t,e,i){var n=this,r=0;clearInterval(n.pressureIntervals[i]),n.pressureIntervals[i]=setInterval(function(){var i=t.force||t.pressure||t.webkitForce||0;i!==r&&(e.trigger("pressure",i),n.trigger("pressure "+e.identifier+":pressure",i),r=i)}.bind(n),100)},Kz.prototype.onstart=function(t){var e=this,i=e.options,n=t;t=Lz(t),e.updateBox();return kz(t,function(r){e.actives.length<i.maxNumberOfNipples?e.processOnStart(r):n.type.match(/^touch/)&&(Object.keys(e.manager.ids).forEach(function(i){if(Object.values(n.touches).findIndex(function(t){return t.identifier===i})<0){var r=[t[0]];r.identifier=i,e.processOnEnd(r)}}),e.actives.length<i.maxNumberOfNipples&&e.processOnStart(r))}),e.manager.bindDocument(),!1},Kz.prototype.processOnStart=function(t){var e,i=this,n=i.options,r=i.manager.getIdentifier(t),s=t.force||t.pressure||t.webkitForce||0,a={x:t.pageX,y:t.pageY},o=i.getOrCreate(r,a);o.identifier!==r&&i.manager.removeIdentifier(o.identifier),o.identifier=r;var l=function(e){e.trigger("start",e),i.trigger("start "+e.id+":start",e),e.show(),s>0&&i.pressureFn(t,e,e.identifier),i.processOnMove(t)};if((e=i.idles.indexOf(o))>=0&&i.idles.splice(e,1),i.actives.push(o),i.ids.push(o.identifier),"semi"!==n.mode)l(o);else{if(!(Ez(a,o.position)<=n.catchDistance))return o.destroy(),void i.processOnStart(t);l(o)}return o},Kz.prototype.getOrCreate=function(t,e){var i,n=this,r=n.options;return/(semi|static)/.test(r.mode)?(i=n.idles[0])?(n.idles.splice(0,1),i):"semi"===r.mode&&n.createNipple(e,t):i=n.createNipple(e,t)},Kz.prototype.processOnMove=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.scroll;if((t=>isNaN(t.buttons)?0!==t.pressure:0!==t.buttons)(t))if(r){if(i.dynamicPage){var a=r.el.getBoundingClientRect();r.position={x:s.x+a.left,y:s.y+a.top}}r.identifier=n;var o=r.options.size/2,l={x:t.pageX,y:t.pageY};i.lockX&&(l.y=r.position.y),i.lockY&&(l.x=r.position.x);var h,c,d=Ez(l,r.position),u=((t,e)=>{let i=e.x-t.x,n=e.y-t.y;return Tz(Math.atan2(n,i))})(l,r.position),p=Pz(u),f=d/o,m={distance:d,position:l};if("circle"===r.options.shape?(h=Math.min(d,o),c=((t,e,i)=>{let n={x:0,y:0};return i=Pz(i),n.x=t.x-e*Math.cos(i),n.y=t.y-e*Math.sin(i),n})(r.position,h,u)):(c=((t,e,i)=>({x:Math.min(Math.max(t.x,e.x-i),e.x+i),y:Math.min(Math.max(t.y,e.y-i),e.y+i)}))(l,r.position,o),h=Ez(c,r.position)),i.follow){if(d>o){let t=l.x-c.x,i=l.y-c.y;r.position.x+=t,r.position.y+=i,r.el.style.top=r.position.y-(e.box.top+s.y)+"px",r.el.style.left=r.position.x-(e.box.left+s.x)+"px",d=Ez(l,r.position)}}else l=c,d=h;var g=l.x-r.position.x,v=l.y-r.position.y;r.frontPosition={x:g,y:v},i.dataOnly||zz(r.ui.front,r.frontPosition);var y={identifier:r.identifier,position:l,force:f,pressure:t.force||t.pressure||t.webkitForce||0,distance:d,angle:{radian:p,degree:u},vector:{x:g/o,y:-v/o},raw:m,instance:r,lockX:i.lockX,lockY:i.lockY};(y=r.computeDirection(y)).angle={radian:Pz(180-u),degree:180-u},r.trigger("move",y),e.trigger("move "+r.id+":move",y)}else e.manager.removeIdentifier(n);else this.processOnEnd(t)},Kz.prototype.processOnEnd=function(t){var e=this,i=e.options,n=e.manager.getIdentifier(t),r=e.nipples.get(n),s=e.manager.removeIdentifier(r.identifier);!r||(i.dataOnly||r.hide(function(){"dynamic"===i.mode&&(r.trigger("removed",r),e.trigger("removed "+r.id+":removed",r),e.manager.trigger("removed "+r.id+":removed",r),r.destroy())}),clearInterval(e.pressureIntervals[r.identifier]),r.resetDirection(),r.trigger("end",r),e.trigger("end "+r.id+":end",r),e.ids.indexOf(r.identifier)>=0&&e.ids.splice(e.ids.indexOf(r.identifier),1),e.actives.indexOf(r)>=0&&e.actives.splice(e.actives.indexOf(r),1),/(semi|static)/.test(i.mode)?e.idles.push(r):e.nipples.indexOf(r)>=0&&e.nipples.splice(e.nipples.indexOf(r),1),e.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(e.manager.ids[s.id]=s.identifier))},Kz.prototype.onDestroyed=function(t,e){var i=this;i.nipples.indexOf(e)>=0&&i.nipples.splice(i.nipples.indexOf(e),1),i.actives.indexOf(e)>=0&&i.actives.splice(i.actives.indexOf(e),1),i.idles.indexOf(e)>=0&&i.idles.splice(i.idles.indexOf(e),1),i.ids.indexOf(e.identifier)>=0&&i.ids.splice(i.ids.indexOf(e.identifier),1),i.manager.removeIdentifier(e.identifier),i.manager.unbindDocument()},Kz.prototype.destroy=function(){var t=this;for(var e in t.unbindEvt(t.options.zone,"start"),t.nipples.forEach(function(t){t.destroy()}),t.pressureIntervals)t.pressureIntervals.hasOwnProperty(e)&&clearInterval(t.pressureIntervals[e]);t.trigger("destroyed",t.nipples),t.manager.unbindDocument(),t.off()};var Jz=Kz;function $z(t){var e=this;e.ids={},e.index=0,e.collections=[],e.scroll=Bz(),e.config(t),e.prepareCollections();var i=function(){var t;e.collections.forEach(function(i){i.forEach(function(i){t=i.el.getBoundingClientRect(),i.position={x:e.scroll.x+t.left,y:e.scroll.y+t.top}})})};if(typeof window>"u")return e.collections;Oz(window,"resize",function(){Iz(i)});var n=function(){e.scroll=Bz()};return Oz(window,"scroll",function(){Iz(n)}),e.collections}$z.prototype=new Yz,$z.constructor=$z,$z.prototype.prepareCollections=function(){var t=this;t.collections.create=t.create.bind(t),t.collections.on=t.on.bind(t),t.collections.off=t.off.bind(t),t.collections.destroy=t.destroy.bind(t),t.collections.get=function(e){var i;return t.collections.every(function(t){return!(i=t.get(e))}),i}},$z.prototype.create=function(t){return this.createCollection(t)},$z.prototype.createCollection=function(t){var e=this,i=new Jz(e,t);return e.bindCollection(i),e.collections.push(i),i},$z.prototype.bindCollection=function(t){var e,i=this,n=function(t,n){e=t.type+" "+n.id+":"+t.type,i.trigger(e,n)};t.on("destroyed",i.onDestroyed.bind(i)),t.on("shown hidden rested dir plain",n),t.on("dir:up dir:right dir:down dir:left",n),t.on("plain:up plain:right plain:down plain:left",n)},$z.prototype.bindDocument=function(){var t=this;t.binded||(t.bindEvt(document,"move").bindEvt(document,"end"),t.binded=!0)},$z.prototype.unbindDocument=function(t){var e=this;(!Object.keys(e.ids).length||!0===t)&&(e.unbindEvt(document,"move").unbindEvt(document,"end"),e.binded=!1)},$z.prototype.getIdentifier=function(t){var e;return t?void 0===(e=void 0===t.identifier?t.pointerId:t.identifier)&&(e=this.latest||0):e=this.index,void 0===this.ids[e]&&(this.ids[e]=this.index,this.index+=1),this.latest=e,this.ids[e]},$z.prototype.removeIdentifier=function(t){var e={};for(var i in this.ids)if(this.ids[i]===t){e.id=i,e.identifier=this.ids[i],delete this.ids[i];break}return e},$z.prototype.onmove=function(t){return this.onAny("move",t),!1},$z.prototype.onend=function(t){return this.onAny("end",t),!1},$z.prototype.oncancel=function(t){return this.onAny("end",t),!1},$z.prototype.onAny=function(t,e){var i,n=this,r="processOn"+t.charAt(0).toUpperCase()+t.slice(1);e=Lz(e);
2var s=function(t,e,i){i.ids.indexOf(e)>=0&&(i[r](t),t._found_=!0)};return kz(e,function(t){i=n.getIdentifier(t),kz(n.collections,s.bind(null,t,i)),t._found_||n.removeIdentifier(i)}),!1},$z.prototype.destroy=function(){var t=this;t.unbindDocument(!0),t.ids={},t.index=0,t.collections.forEach(function(t){t.destroy()}),t.off()},$z.prototype.onDestroyed=function(t,e){var i=this;if(i.collections.indexOf(e)<0)return!1;i.collections.splice(i.collections.indexOf(e),1)};var tF=new $z,eF=function(t){return tF.create(t)},iF=new Map,nF=new Map,rF=class{constructor(t,e,i,n){this.data=e;let{audio:r,volume:s,delay:a,loop:o}=e;if(!r)throw new Error("Missing property");let l="string"==typeof r?n.getAudio(r).src:r.data;this.audioPlayer=new ZT({src:l,volume:s,delay:a,loop:o}),nF.has(i.uuid)?nF.get(i.uuid).push(this):nF.set(i.uuid,[this]),iF.set(t,this)}playByToggle(){"stop"===this.data.toggle?"playing"===this.audioPlayer.status?this.audioPlayer.stop():(this.audioPlayer.stop(),this.audioPlayer.play()):"pause"===this.data.toggle?"playing"===this.audioPlayer.status?this.audioPlayer.pause():this.audioPlayer.play():(this.audioPlayer.stop(),this.audioPlayer.play())}dispose(){this.audioPlayer.stop()}},sF=class{constructor(t){this.data=t}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(t){let e=iF.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.audioPlayer[this.data.interaction](),this.disposeDelay()},this.data.delay)):e.audioPlayer[this.data.interaction]())}pauseAllAudiosFromObject(t){let e=nF.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>t.audioPlayer[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(t=>t.audioPlayer[this.data.interaction]()))}pauseAllAudios(){let t=[...nF.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(t=>{t.forEach(t=>{t.audioPlayer[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(t=>{t.forEach(t=>{t.audioPlayer[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},aF=class{constructor(t,e,i,n,r){if(this.data=e,this.shared=n,this.condition=r,"play"===e.interaction)this.interaction=new rF(t,e,i,n);else{if("pause"!==e.interaction&&"stop"!==e.interaction)throw new Error("Missing property");this.interaction=new sF(e)}}dispatchBasic(){if(!1===uU(this.shared,this.condition))return!1;this.interaction instanceof rF?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===uU(this.shared,this.condition))return!1;this.interaction instanceof rF?this.interaction.audioPlayer.play():this.interaction.dispatch()}dispatchGameControl(t){if(!1===uU(this.shared,this.condition))return!1;this.interaction instanceof rF&&("start"===t?this.interaction.audioPlayer.play():this.interaction.audioPlayer.stop())}dispose(){this.interaction.dispose()}},oF=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n,this.delay=0,this.emission=t.emission,void 0!==t.delay&&(this.delay=t.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(t=0){t?this.delayTimerId=window.setTimeout(()=>{this.start(0),this.clearDelay()},t):this.particleSystem.start()}stop(t=0){t?this.delayTimerId=window.setTimeout(()=>{this.stop(0),this.clearDelay()},t):this.particleSystem.stop()}freeze(t=0){t?this.delayTimerId=window.setTimeout(()=>{this.freeze(0),this.clearDelay()},t):this.particleSystem.froze()}unFreeze(t=0){t?this.delayTimerId=window.setTimeout(()=>{this.unFreeze(0),this.clearDelay()},t):this.particleSystem.unFroze()}reset(t=0){t?this.delayTimerId=window.setTimeout(()=>{this.reset(0),this.clearDelay()},t):this.particleSystem.reset()}reverseFromCurrent(){switch(this.emission){case"emitToggle":this.toggleEmitting();break;case"pauseToggle":this.toggleFroze()}}dispatchBasic(){if(!1===uU(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)}}
vendor: 4,419 bytes, line 2
2dispatchConditional(){if(!1===uU(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(t){if(!1===uU(this.shared,this.condition)||!this.particleSystem)return!1;"start"===t?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)}},lF=(t,e)=>e.some(e=>e instanceof RegExp?e.test(t):e===t);function hF(t,e){if(e={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,...e},t=t.trim(),/^data:/i.test(t))return((t,{stripHash:e})=>{let i=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(t);if(!i)throw new Error(`Invalid URL: ${t}`);let{type:n,data:r,hash:s}=i.groups,a=n.split(";");s=e?"":s;let o=!1;"base64"===a[a.length-1]&&(a.pop(),o=!0);let l=(a.shift()||"").toLowerCase(),h=[...a.map(t=>{let[e,i=""]=t.split("=").map(t=>t.trim());return"charset"===e&&(i=i.toLowerCase(),"us-ascii"===i)?"":`${e}${i?`=${i}`:""}`}).filter(Boolean)];return o&&h.push("base64"),(h.length>0||l&&"text/plain"!==l)&&h.unshift(l),`data:${h.join(";")},${o?r.trim():r}${s?`#${s}`:""}`})(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let i=t.startsWith("//");!i&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let n=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&"https:"===n.protocol&&(n.protocol="http:"),e.forceHttps&&"http:"===n.protocol&&(n.protocol="https:"),e.stripAuthentication&&(n.username="",n.password=""),e.stripHash?n.hash="":e.stripTextFragment&&(n.hash=n.hash.replace(/#?:~:text.*?$/i,"")),n.pathname){let t=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,e=0,i="";for(;;){let r=t.exec(n.pathname);if(!r)break;let s=r[0],a=r.index;i+=n.pathname.slice(e,a).replace(/\/{2,}/g,"/"),i+=s,e=a+s.length}i+=n.pathname.slice(e,n.pathname.length).replace(/\/{2,}/g,"/"),n.pathname=i}if(n.pathname)try{n.pathname=decodeURI(n.pathname)}catch{}if(!0===e.removeDirectoryIndex&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let t=n.pathname.split("/"),i=t[t.length-1];lF(i,e.removeDirectoryIndex)&&(t=t.slice(0,-1),n.pathname=t.slice(1).join("/")+"/")}if(n.hostname&&(n.hostname=n.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(n.hostname)&&(n.hostname=n.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let s of[...n.searchParams.keys()])lF(s,e.removeQueryParameters)&&n.searchParams.delete(s);if(!0===e.removeQueryParameters&&(n.search=""),e.sortQueryParameters){n.searchParams.sort();try{n.search=decodeURIComponent(n.search)}catch{}}e.removeTrailingSlash&&(n.pathname=n.pathname.replace(/\/$/,""));let r=t;return t=n.toString(),!e.removeSingleSlash&&"/"===n.pathname&&!r.endsWith("/")&&""===n.hash&&(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||"/"===n.pathname)&&""===n.hash&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),i&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}var cF=class{constructor({url:t,context:e},i,n,r){if(this.controlsManager=i,this.shared=n,this.condition=r,!t)throw new Error("Missing property");this.url=t.startsWith("mailto:")?t:hF(t,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=e??"tab"}dispatch(){if(!1===uU(this.shared,this.condition))return!1;Um?window.location.assign(this.url):("tab"===this.context||Fm&&"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(Xm[0]),Xm.splice(0,Xm.length))}},dF=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.controlsManager=i,this.shared=n,this.condition=r,this.timeoutIdQueue=[],this.dispatchInner=()=>
2{this.objects.forEach(this.destroyCallback)},this.destroyCallback=t=>{this.timeoutIdQueue.shift();let e=this.page.scene.find(t);if(void 0===e)return;let i=this.controlsManager.sharedGameControlGlobals.rapierWorld,n=!i||e.dataPatched.physics?.fusedBody;if(e.cloner){for(let t of e.cloner.children)n?(t.playModeVisible=!1,t.rigidBody&&"positioned"===e.dataPatched.physics?.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)):void 0===this.clone||this.clone===t?(t.playModeVisible=!1,t.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(t.rigidBody.collider(0).handle),i.removeRigidBody(t.rigidBody),t.rigidBody=void 0)):void 0===t.playModeVisible&&(t.playModeVisible=!0);(n||void 0===this.clone||!1===this.clone)&&(e.visible=!1,e.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),i.removeRigidBody(e.rigidBody),e.rigidBody=void 0),e.bvhGeometry&&(e.bvhGeometry=void 0))}else e.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(e.rigidBody.collider(0).handle),i.removeRigidBody(e.rigidBody),e.rigidBody=void 0),e.bvhGeometry&&(e.bvhGeometry=void 0),e.visible=!1;this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=void 0===i?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(t=>void 0!==t.bvhGeometry):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(t=>void 0!==t.rigidBody),e.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...t.objects]}dispatch(t){if(!1===uU(this.shared,this.condition))return!1;this.clone=t,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay)):this.dispatchInner()}dispatchFromStart(){if(!1===uU(this.shared,this.condition))return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))}dispose(){this.timeoutIdQueue.forEach(t=>window.clearTimeout(t))}},uF=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.shared=i,this.eventManager=n,this.condition=r,this.shared=i}dispatch(){if(!1===uU(this.shared,this.condition))return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),HN(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},1e3*(this.data.delay??0))}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},pF={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},fF={duration:1e3,delay:0,endDelay:0,startOnceDelay:0,pingPongDelayCorrection:0,pingPongEndDelayCorrection:0,easing:"easeOutElastic(1, .5)",round:0},mF=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],gF={CSS:{},springs:{}};function vF(t,e,i){return Math.min(Math.max(t,e),i)}function yF(t,e){return t.indexOf(e)>-1}function xF(t,e){return t.apply(null,e)}var bF={arr:function(t){return Array.isArray(t)},obj:function(t){return yF(Object.prototype.toString.call(t),"Object")},pth:function(t){return bF.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return!("isNode"in t)&&(t.nodeType||bF.svg(t))},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return typeof t>"u"},hex:function(t){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)},rgb:function(t){return/^rgb/.test(t)},hsl:function(t){return/^hsl/.test(t)},col:function(t){return bF.hex(t)||bF.rgb(t)||bF.hsl(t)},key:function(t){return!pF.hasOwnProperty(t)&&!fF.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}};function wF(t){var e=/\(([^)]+)\)/.exec(t);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function SF(t,e){var i=wF(t),n=vF(bF.und(i[0])?1:i[0],.1,100),r=vF(bF.und(i[1])?100:i[1],.1,100),s=vF(bF.und(i[2])?10:i[2],.1,100),a=vF(bF.und(i[3])?0:i[3],.1,100),o=Math.sqrt(r/n),l=s/(2*Math.sqrt(r*n)),h=l<1?o*Math.sqrt(1-l*l):0,c=l<1?(l*o-a)/h:-a+o;function d(t){var i=e?e*t/1e3:t;return i=l<1?Math.exp(-i*l*o)*(1*Math.cos(h*i)+c*Math.sin(h*i)):(1+c*i)*Math.exp(-i*o),0===t||1===t?t:1-i}return e?d:function(){var e=gF.springs[t];if(e)return e;for(var i=1/6,n=0,r=0;;)if(1===d(n+=i)){if(++r>=16)break}else r=0;var s=n*i*1e3;return gF.springs[t]=s,s}}function _F(t){return void 0===t&&(t=10),function(e){return Math.ceil(vF(e,1e-6,1)*t)*(1/t)}}var AF=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function i(t,e){return 3*e-6*t}function n(t){return 3*t}function r(t,r,s){return((e(r,s)*t+i(r,s))*t+n(r))*t}function s(t,r,s){return 3*e(r,s)*t*t+2*i(r,s)*t+n(r)}return function(e,i,n,a){if(0<=e&&e<=1&&0<=n&&n<=1){var o=new Float32Array(11);if(e!==i||n!==a)for(var l=0;l<11;++l)o[l]=r(l*t,e,n);return function(t){return e===i&&n===a||0===t||1===t?t:r(h(t),i,a)}}function h(i){for(var a=0,l=1;10!==l&&o[l]<=i;++l)a+=t;--l;var h=a+(i-o[l])/(o[l+1]-o[l])*t,c=s(h,e,n);return c>
vendor: 4,865 bytes, line 2
2=.001?function(t,e,i,n){for(var a=0;a<4;++a){var o=s(e,i,n);if(0===o)return e;e-=(r(e,i,n)-t)/o}return e}(i,h,e,n):0===c?h:function(t,e,i,n,s){var a,o,l=0;do{(a=r(o=e+(i-e)/2,n,s)-t)>0?i=o:e=o}while(Math.abs(a)>1e-7&&++l<10);return o}(i,a,a+t,e,n)}}}(),MF=function(){var t={linear:function(){return function(t){return t}}},e={Sine:function(){return function(t){return 1-Math.cos(t*Math.PI/2)}},Circ:function(){return function(t){return 1-Math.sqrt(1-t*t)}},Back:function(){return function(t){return t*t*(3*t-2)}},Bounce:function(){return function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}},Elastic:function(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var i=vF(t,1,10),n=vF(e,.1,2);return function(t){return 0===t||1===t?t:-i*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/i))*(2*Math.PI)/n)}}};return["Quad","Cubic","Quart","Quint","Expo"].forEach(function(t,i){e[t]=function(){return function(t){return Math.pow(t,i+2)}}}),Object.keys(e).forEach(function(i){var n=e[i];t["easeIn"+i]=n,t["easeOut"+i]=function(t,e){return function(i){return 1-n(t,e)(1-i)}},t["easeInOut"+i]=function(t,e){return function(i){return i<.5?n(t,e)(2*i)/2:1-n(t,e)(-2*i+2)/2}}}),t}();function CF(t,e){if(bF.fnc(t))return t;var i=t.split("(")[0],n=MF[i],r=wF(t);switch(i){case"spring":return SF(t,e);case"cubicBezier":return xF(AF,r);case"steps":return xF(_F,r);default:return xF(n,r)}}function EF(t){try{return document.querySelectorAll(t)}catch{return}}function PF(t,e){for(var i=t.length,n=arguments.length>=2?arguments[1]:void 0,r=[],s=0;s<i;s++)if(s in t){var a=t[s];e.call(n,a,s,t)&&r.push(a)}return r}function TF(t){return t.reduce(function(t,e){return t.concat(bF.arr(e)?TF(e):e)},[])}function DF(t){return bF.arr(t)?t:(bF.str(t)&&(t=EF(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function IF(t,e){return t.some(function(t){return t===e})}function OF(t){var e={};for(var i in t)e[i]=t[i];return e}function RF(t,e){var i=OF(t);for(var n in t)i[n]=e.hasOwnProperty(n)?e[n]:t[n];return i}function LF(t,e){var i=OF(t);for(var n in e)i[n]=bF.und(t[n])?e[n]:t[n];return i}function BF(t){return bF.rgb(t)?function(t){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t);return e?"rgba("+e[1]+",1)":t}(t):bF.hex(t)?function(t){var e=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(t,e,i,n){return e+e+i+i+n+n}),i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return"rgba("+parseInt(i[1],16)+","+parseInt(i[2],16)+","+parseInt(i[3],16)+",1)"}(t):bF.hsl(t)?function(t){var e,i,n,r=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(t),s=parseInt(r[1],10)/360,a=parseInt(r[2],10)/100,o=parseInt(r[3],10)/100,l=r[4]||1;function h(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(0==a)e=i=n=o;else{var c=o<.5?o*(1+a):o+a-o*a,d=2*o-c;e=h(d,c,s+1/3),i=h(d,c,s),n=h(d,c,s-1/3)}return"rgba("+255*e+","+255*i+","+255*n+","+l+")"}(t):void 0}function zF(t){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(t);if(e)return e[1]}function FF(t,e){return bF.fnc(t)?t(e.target,e.id,e.total):t}function NF(t,e){return t.getAttribute(e)}function UF(t,e,i){if(IF([i,"deg","rad","turn"],zF(e)))return e;var n=gF.CSS[e+i];if(!bF.und(n))return n;var r=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+i;var a=100/r.offsetWidth;s.removeChild(r);var o=a*parseFloat(e);return gF.CSS[e+i]=o,o}function kF(t,e,i){if(e in t.style){var n=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(n)||"0";return i?UF(t,r,i):r}}function VF(t,e){return bF.dom(t)&&!bF.inp(t)&&(NF(t,e)||bF.svg(t)&&t[e])?"attribute":bF.dom(t)&&IF(mF,e)?"transform":bF.dom(t)&&"transform"!==e&&kF(t,e)?"css":null!=t[e]?"object":void 0}function jF(t){if(bF.dom(t)){for(var e,i=t.style.transform||"",n=/(\w+)\(([^)]*)\)/g,r=new Map;e=n.exec(i);)r.set(e[1],e[2]);return r}}function GF(t,e,i,n){var r=yF(e,"scale")?1:0+function(t){return yF(t,"translate")||"perspective"===t?"px":yF(t,"rotate")||yF(t,"skew")?"deg":void 0}(e),s=jF(t).get(e)||r;return i&&(i.transforms.list.set(e,s),i.transforms.last=e),n?UF(t,s,n):s}function WF(t,e,i,n){switch(VF(t,e)){case"transform":return GF(t,e,n,i);case"css":return kF(t,e,i);case"attribute":return NF(t,e);default:return t[e]||0}}function HF(t,e){var i=/^(\*=|\+=|-=)/.exec(t);if(!i)return t;var n=zF(t)||0,r=parseFloat(e),s=parseFloat(t.replace(i[0],""));switch(i[0][0]){case"+":return r+s+n;case"-":return r-s+n;case"*":return r*s+n}}function qF(t,e){if(bF.col(t))return BF(t);if(/\s/g.test(t))return t;var i=zF(t),n=i?t.substr(0,t.length-i.length):t;
2return e?n+e:n}function XF(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function YF(t){for(var e,i=t.points,n=0,r=0;r<i.numberOfItems;r++){var s=i.getItem(r);r>0&&(n+=XF(e,s)),e=s}return n}function QF(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*NF(t,"r")}(t);case"rect":return function(t){return 2*NF(t,"width")+2*NF(t,"height")}(t);case"line":return function(t){return XF({x:NF(t,"x1"),y:NF(t,"y1")},{x:NF(t,"x2"),y:NF(t,"y2")})}(t);case"polyline":return YF(t);case"polygon":return function(t){var e=t.points;return YF(t)+XF(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function ZF(t,e){var i=e||{},n=i.el||function(t){for(var e=t.parentNode;bF.svg(e)&&bF.svg(e.parentNode);)e=e.parentNode;return e}(t),r=n.getBoundingClientRect(),s=NF(n,"viewBox"),a=r.width,o=r.height,l=i.viewBox||(s?s.split(" "):[0,0,a,o]);return{el:n,viewBox:l,x:l[0]/1,y:l[1]/1,w:a/l[2],h:o/l[3]}}function KF(t,e){function i(i){void 0===i&&(i=0);var n=e+i>=1?e+i:0;return t.el.getPointAtLength(n)}var n=ZF(t.el,t.svg),r=i(),s=i(-1),a=i(1);switch(t.property){case"x":return(r.x-n.x)*n.w;case"y":return(r.y-n.y)*n.h;case"angle":return 180*Math.atan2(a.y-s.y,a.x-s.x)/Math.PI}}function JF(t,e){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,n=qF(bF.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(i)?n.match(i).map(Number):[0],strings:bF.str(t)||e?n.split(i):[]}}function $F(t){return PF(t?TF(bF.arr(t)?t.map(DF):DF(t)):[],function(t,e,i){return i.indexOf(t)===e})}function tN(t){var e=$F(t);return e.map(function(t,i){return{target:t,id:i,total:e.length,transforms:{list:jF(t)}}})}function eN(t,e){var i=OF(e);if(/^spring/.test(i.easing)&&(i.duration=SF(i.easing)),bF.arr(t)){var n=t.length;2===n&&!bF.obj(t[0])?t={value:t}:bF.fnc(e.duration)||(i.duration=e.duration/n)}var r=bF.arr(t)?t:[t];return r.map(function(t,i){var n=bF.obj(t)&&!bF.pth(t)?t:{value:t};return bF.und(n.delay)&&(n.delay=i?0:e.delay),bF.und(n.endDelay)&&(n.endDelay=i===r.length-1?e.endDelay:0),n}).map(function(t){return LF(t,i)})}function iN(t,e){var i=[],n=e.keyframes;for(var r in n&&(e=LF(function(t){for(var e=PF(TF(t.map(function(t){return Object.keys(t)})),function(t){return bF.key(t)}).reduce(function(t,e){return t.indexOf(e)<0&&t.push(e),t},[]),i={},n=function(n){var r=e[n];i[r]=t.map(function(t){var e={};for(var i in t)bF.key(i)?i==r&&(e.value=t[i]):e[i]=t[i];return e})},r=0;r<e.length;r++)n(r);return i}(n),e)),e)bF.key(r)&&i.push({name:r,tweens:eN(e[r],t)});return i}function nN(t,e){var i;return t.tweens.map(function(n){var r=function(t,e){var i={};for(var n in t){var r=FF(t[n],e);bF.arr(r)&&(r=r.map(function(t){return FF(t,e)}),1===r.length&&(r=r[0])),i[n]=r}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}(n,e),s=r.value,a=bF.arr(s)?s[1]:s,o=zF(a),l=WF(e.target,t.name,o,e),h=i?i.to.original:l,c=bF.arr(s)?s[0]:h,d=zF(c)||zF(l),u=o||d;return bF.und(a)&&(a=h),r.from=JF(c,u),r.to=JF(HF(a,c),u),r.start=i?i.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=CF(r.easing,r.duration),r.isPath=bF.pth(s),r.isColor=bF.col(r.from.original),r.isColor&&(r.round=1),i=r,r})}var rN={css:function(t,e,i){return t.style[e]=i},attribute:function(t,e,i){return t.setAttribute(e,i)},object:function(t,e,i){return t[e]=i},transform:function(t,e,i,n,r){if(n.list.set(e,i),e===n.last||r){var s="";n.list.forEach(function(t,e){s+=e+"("+t+") "}),t.style.transform=s}}};function sN(t,e){tN(t).forEach(function(t){for(var i in e){var n=FF(e[i],t),r=t.target,s=zF(n),a=WF(r,i,s,t),o=HF(qF(n,s||zF(a)),a),l=VF(r,i);rN[l](r,i,o,t.transforms,!0)}})}function aN(t,e){return PF(TF(t.map(function(t){return e.map(function(e){return function(t,e){var i=VF(t.target,e.name);if(i){var n=nN(e,t),r=n[n.length-1];return{type:i,property:e.name,animatable:t,tweens:n,duration:r.end,delay:n[0].delay,endDelay:r.endDelay}}}(t,e)})})),function(t){return!bF.und(t)})}function oN(t,e){var i=t.length,n=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=i?Math.max.apply(Math,t.map(function(t){let e=t.startOnceDelay??0,i=t.pingPongDelayCorrection??0,r=t.pingPongEndDelayCorrection??0;return n(t)+e+i+r+t.duration*(t.loop??1)})):e.duration,r.delay=i?Math.min.apply(Math,t.map(function(t){let e=t.startOnceDelay??0,i=t.pingPongDelayCorrection??0;return n(t)+e+i+t.delay})):e.delay,r.endDelay=i?r.duration-Math.max.apply(Math,t.map(function(t){let e=t.startOnceDelay??0,i=t.pingPongDelayCorrection??0,r=t.pingPongEndDelayCorrection??0;return n(t)+e+i+t.duration*(t.loop??1)-t.endDelay-r})):e.endDelay,r}var lN=0;var hN,cN=[],dN=[],uN=function(){let t=0;function e(t){let i=cN.length;if(i){let n=0;for(;n<i;){let e=cN[n];e.paused?(cN.splice(n,1),i--):(e.tick(t),n++)}hN=requestAnimationFrame(e)}else hN&&(cancelAnimationFrame(hN),hN=null)}return{isUsingInternalRaf:!0,play:function(){t=performance.now(),hN=requestAnimationFrame(e)},update:function(i){t+=i,e(t)}}}();function pN(t){void 0===t&&(t={});var e,i,n=0,r=0,s=0,a=0,o=null;function l(t){var e=window.Promise&&new Promise(function(t){return o=t});return t.finished=e,e}var h=function(t){var e=RF(pF,t),i=RF(fF,t),n=iN(i,t),r=tN(t.targets),s=aN(r,n),a=oN(s,i),o=lN;return lN++,LF(e,{id:o,children:[],animatables:r,animations:s,duration:a.duration,delay:a.delay,endDelay:a.endDelay,startOnceDelay:i.startOnceDelay,pingPongDelayCorrection:i.pingPongDelayCorrection,pingPongEndDelayCorrection:i.pingPongEndDelayCorrection})}(t);function c(){var t=h.direction;"alternate"!==t&&(h.direction="normal"!==t?"normal":"reverse"),h.reversed=!h.reversed,i.forEac
2h(function(t){(1===t.loop||t.loop%2==0)&&(t.reversed=h.reversed)})}function d(t){return h.reversed?h.duration-t:t}function u(t,e,i=!1){e&&(h.reversed?e.seek(e.duration*e.loop-(t-e.timelineOffset-e.pingPongDelayCorrection),i):e.seek(t-e.timelineOffset-e.startOnceDelay-e.pingPongDelayCorrection,i))}function p(t){var e=0,i=h.animations,n=i.length;for("alternate"!==h.direction&&"alternate"===h.parent?.direction?!1===h.parent?.rewind&&!0===h.reversePlayback&&!1===h.rewind&&(t=h.parent?.reversed&&"alternate"===h.direction?h.duration-h.delay+h.endDelay-t:h.duration+h.delay-h.endDelay-t):g(!1,h.parent?.rewind,h.rewind,h.parent?.reversePlayback,h.reversePlayback)&&(t=h.parent?.reversed&&"alternate"===h.direction?h.duration-h.delay+h.endDelay-t:h.duration+h.delay-h.endDelay-t);e<n;){var r=i[e],s=r.animatable,a=r.tweens,o=a.length-1,l=a[o];let n;o&&(l=PF(a,function(e){return t<e.end})[0]||l),n=h.parent?.reversed&&"alternate"===h.direction?vF(t-l.start-l.endDelay,0,l.duration)/l.duration:vF(t-l.start-l.delay,0,l.duration)/l.duration;for(var c=isNaN(n)?1:l.easing(n),d=l.to.strings,u=l.round,p=[],f=l.to.numbers.length,m=void 0,v=0;v<f;v++){var y=void 0;let t,e;"alternate"!==h.direction?!1===h.parent?.rewind&&!0===h.reversePlayback&&!1===h.rewind?(t=l.to.numbers[v],e=l.from.numbers[v]||0):(e=l.to.numbers[v],t=l.from.numbers[v]||0):g(!0,h.parent?.rewind,h.rewind,h.parent?.reversePlayback,h.reversePlayback)?(t=l.to.numbers[v],e=l.from.numbers[v]||0):(e=l.to.numbers[v],t=l.from.numbers[v]||0),y=l.isPath?KF(l.value,c*e):t+c*(e-t),u&&(l.isColor&&v>2||(y=Math.round(y*u)/u)),p.push(y)}var x=d.length;if(x){m=d[0];for(var b=0;b<x;b++){d[b];var w=d[b+1],S=p[b];isNaN(S)||(m+=w?S+w:S+" ")}}else m=p[0];rN[r.type](s.target,r.property,m,s.transforms),r.currentValue=m,e++}}function f(t){h[t]&&!h.passThrough&&h[t](h)}l(h);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 g(t,e,i,n,r){return m[t<<4|e<<3|i<<2|n<<1|r]}function v(t,e=!1){var r=h.duration;let s=h.delay,m=r-h.endDelay;h.parent?.reversed&&"alternate"===h.direction&&(s=h.endDelay,m=r-h.delay);var g=d(t);if(h.progress=vF(g/r*100,0,100),e||(h.reversePlayback=g<h.currentTime),a&&function(t,e=!1){if(h.reversed)for(var n=a;n--;)u(t,i[n],e);else for(var r=0;r<a;r++)u(t,i[r],e)}(g,e),!h.began&&h.currentTime>=0&&(h.began=!0,f("begin")),!h.loopBegan&&h.currentTime>0&&(h.loopBegan=!0,f("loopBegin")),(h.reversed||g>=0)&&g<=s&&0!==h.currentTime&&(p(0),f("change")),(g>=m&&h.currentTime!==r+h.pingPongDelayCorrection||!r)&&(p(r),f("change")),g>s&&g<m?(h.changeBegan||(h.changeBegan=!0,h.changeCompleted=!1,f("changeBegin")),p(g),f("change")):h.changeBegan?(h.changeCompleted=!0,h.changeBegan=!1,f("change"),a&&f("timelineChangeComplete")):h.began&&g>m&&f("changeComplete"),h.currentTime=vF(g,0,r+h.pingPongDelayCorrection),h.began&&f("update"),t>=r)if(h.remaining&&!0!==h.remaining&&h.remaining--,h.remaining){n+=a?h.duration/pN.speed:h.duration;for(let t of i)t.setStartTime(0),t.remaining=t.loop;f("loopComplete"),h.loopBegan=!1,"alternate"===h.direction?c():a&&(h.direction="normal",h.reversed=!1,i.forEach(function(t){return t.reversed=!1}))}else h.paused=!0,h.completed||(h.completed=!0,f("loopComplete"),f("complete"),!h.passThrough&&"Promise"in window&&(o(),l(h)))}return h.reset=function(){var t=h.direction;h.passThrough=!1,h.currentTime=0,h.progress=0,h.paused=!0,h.began=!1,h.loopBegan=!1,h.changeBegan=!1,h.completed=!1,h.changeCompleted=!1,h.reversePlayback=!1,h.reversed="reverse"===t,h.remaining=h.loop,i=h.children;for(var e=a=i.length;e--;)h.children[e].reset();p(h.reversed?h.duration:0)},h.setStartTime=function(t){n=t},h.set=function(t,e){return sN(t,e),h},h.tick=function(t){s=t,n||(n=s),v((s+(r-n))*pN.speed)},h.seek=function(t,e=!1){v(t-n,e)},h.pause=function(t){h.paused=!0,a&&(e=t??performance.now())},h.play=function(t){!h.paused||(h.completed&&h.reset(),h.paused=!1,cN.push(h),a&&void 0!==e&&(n+=(t??performance.now())-e),!hN&&uN.isUsingInternalRaf&&uN.play())},h.reverse=function(){c(),h.completed=!h.reversed,n=0,r=d(h.currentTime)*(1/pN.speed)},h.restart=function(){h.reset(),h.play()},h.reset(),h.autoplay&&h.play(),h}function fN(t,e){for(var i=e.length;i--;)IF(t,e[i].animatable.target)&&e.splice(i,1)}typeof document<"u"&&document.addEventListener("visibilitychange",function(t){document.hidden?(cN.forEach(function(e){return e.pause(t.timeStamp)}),dN=cN.slice(0),pN.running=cN=[]):dN.forEach(function(e){return e.play(t.t
2imeStamp)})}),pN.version="3.2.0",pN.speed=1,pN.running=cN,pN.remove=function(t){for(var e=$F(t),i=cN.length;i--;){var n=cN[i],r=n.animations,s=n.children;fN(e,r);for(var a=s.length;a--;){var o=s[a],l=o.animations;fN(e,l),!l.length&&!o.children.length&&s.splice(a,1)}!r.length&&!s.length&&n.pause()}},pN.get=WF,pN.set=sN,pN.convertPx=UF,pN.path=function(t,e){var i=bF.str(t)?EF(t)[0]:t,n=e||100;return function(t){return{property:t,el:i,svg:ZF(i),totalLength:QF(i)*(n/100)}}},pN.setDashoffset=function(t){var e=QF(t);return t.setAttribute("stroke-dasharray",e),e},pN.stagger=function(t,e){void 0===e&&(e={});var i=e.direction||"normal",n=e.easing?CF(e.easing):null,r=e.grid,s=e.axis,a=e.from||0,o="first"===a,l="center"===a,h="last"===a,c=bF.arr(t),d=parseFloat(c?t[0]:t),u=c?parseFloat(t[1]):0,p=zF(c?t[1]:t)||0,f=e.start||0+(c?d:0),m=[],g=0;return function(t,e,v){if(o&&(a=0),l&&(a=(v-1)/2),h&&(a=v-1),!m.length){for(var y=0;y<v;y++){if(r){var x=l?(r[0]-1)/2:a%r[0],b=l?(r[1]-1)/2:Math.floor(a/r[0]),w=x-y%r[0],S=b-Math.floor(y/r[0]),_=Math.sqrt(w*w+S*S);"x"===s&&(_=-w),"y"===s&&(_=-S),m.push(_)}else m.push(Math.abs(a-y));g=Math.max.apply(Math,m)}n&&(m=m.map(function(t){return n(t/g)*g})),"reverse"===i&&(m=m.map(function(t){return s?t<0?-1*t:-t:Math.abs(g-t)}))}return f+(c?(u-d)/g:d)*(Math.round(100*m[e])/100)+p}},pN.timeline=function(t){void 0===t&&(t={});var e=pN(t);return e.duration=0,e.add=function(i,n){var r=cN.indexOf(e),s=e.children;function a(t){t.passThrough=!0}r>-1&&cN.splice(r,1);for(var o=0;o<s.length;o++)a(s[o]);var l=LF(i,RF(fF,t));l.targets=l.targets||t.targets;var h=e.duration;l.autoplay=!1,l.timelineOffset=bF.und(n)?h:HF(n,h),a(e);var c=pN(l);a(c),s.push(c),c.parent=e;var d=oN(s,t);return e.delay=d.delay,e.endDelay=d.endDelay,e.duration=d.duration,!0===c.loop&&(e.duration=1/0),e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},pN.easing=CF,pN.penner=MF,pN.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};var mN=pN,gN=new be,vN=new be,yN=new xe;function xN(t,e,i,n,r,s){let a=void 0!==i[t]?i[t]:void 0,o=n[t];if(null==o)return;let l=null!=a?"string"==typeof a?Number(r.getVariable(a)??0):a:e[t],h="string"==typeof o?Number(r.getVariable(o)??0):o;return l!==h?{update:i=>{let n=Wt.lerp(l,h,i);e[t]=s?Math.trunc(n):n},start:()=>{e[t]=l},end:()=>{e[t]=h}}:void 0}function bN(t,e,i,n,r,s){let a=i[t]?i[t]:void 0,o=n[t];if(!o)return;let l=e[t],h=[...a??l].map(t=>"string"==typeof t?Number(r.getVariable(t)??0):t),c=[...o].map(t=>"string"==typeof t?Number(r.getVariable(t)??0):t);return h.length!==c.length||bm(h,c)?void 0:{update:i=>{h.forEach((n,r)=>{let a=Wt.lerp(n,c[r],i);e[t][r]=s?Math.trunc(a):a})},start:()=>{Object.assign(e[t],h)},end:()=>{Object.assign(e[t],c)}}}function wN(t,e,i){return e.forEach((e,n)=>{t.setComponent(n,"string"==typeof e?Number(i.getVariable(e)??0):e)}),t}function SN(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=s?wN(new be,s,r):o.clone(),h=wN(new be,a,r);return l.equals(h)?void 0:{update:t=>{o.lerpVectors(l,h,t)},start:()=>{o.copy(l)},end:()=>{o.copy(h)}}}function _N(t,e,i){return e.forEach((e,n)=>{t.setComponent(n,"string"==typeof e?Number(i.getVariable(e)??0):e)}),t}function AN(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=!(o instanceof Ht),h=o instanceof Ht?o:(new Ht).fromArray(o),c=s?_N(new Ht,s,r):h.clone(),d=_N(new Ht,a,r);return c.equals(d)?void 0:{update:i=>{h.lerpVectors(c,d,i),l&&(e[t]=h.toArray())},start:()=>{h.copy(c),l&&(e[t]=h.toArray())},end:()=>{h.copy(d),l&&(e[t]=h.toArray())}}}function MN(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=new oE(o.r,o.g,o.b,o.a),h=s?"string"==typeof s?r.getColor(s).clone():new oE(s.r,s.g,s.b,s.a):l.clone(),c="string"==typeof a?r.getColor(a).clone():new oE(a.r,a.g,a.b,a.a);return h.equals(c)?void 0:{update:i=>{l.lerpColors(h,c,i);let n=Wt.lerp(h.a,c.a,i);l.a=n,e[t]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(h)},end:()=>{l.copy(c)}}}function CN(t,e,i,n,r){return"number"==typeof e[t]?xN(t,e,i??{},n,r):Array.isArray(e[t])?bN(t,e,i??{},n,r):void 0}function EN(t,e,i,n){let r=[];if(!("geometry"in i))return r;let s=t.geometry.userData.parameters,a="geometry"in e?e.geometry:{},o=i.geometry;
2if(t instanceof FD){let e=function(t,e,i,n){if(void 0===i.scaleBaked)return;let r=(e.scaleBaked??t.data.geometry.scaleBaked).map(t=>"string"==typeof t?Number(n.getVariable(t)??0):t),s=i.scaleBaked.map(t=>"string"==typeof t?Number(n.getVariable(t)??0):t);if(Yy.isEqual(r,s))return;let a=[];return a.push({update:e=>{t.updateGeometryInteractions({scaleBaked:[Wt.lerp(r[0],s[0],e),Wt.lerp(r[1],s[1],e),Wt.lerp(r[2],s[2],e)]},n),t.invalidateDownstreamBooleanData(),t.refreshAttachedClonersInteractions()},start:()=>{t.updateGeometryInteractions({scaleBaked:r},n),t.invalidateDownstreamBooleanData(),t.refreshAttachedClonersInteractions()},end:()=>{t.updateGeometryInteractions({scaleBaked:s},n),t.invalidateDownstreamBooleanData(),t.refreshAttachedClonersInteractions()}}),a}(t,a,o,n);e&&r.push(...e)}else{let e={};if(Object.assign(e,Im(s,Fb),Im(a,Fb)),Fb.forEach(t=>{let i=CN(t,e,a,o,n);i&&r.push(i)}),t instanceof yB){Object.assign(e,{extrusion:{...s.extrusion}});let t=function(t,e,i,n){if(!i.extrusion)return;let r=t.extrusion,s=e.extrusion??{},a=i.extrusion,o=[];return Yx.forEach(t=>{let e=CN(t,r,s,a,n);e&&o.push(e)}),o}(e,a,o,n);t&&r.push(...t)}r.length&&r.push({update:i=>{t.updateGeometryInteractions(e,n),t.updateGeometryGroupsIfNeeded(),t.refreshAttachedClonersInteractions()},start:i=>{t.updateGeometryInteractions(e,n),t.updateGeometryGroupsIfNeeded(),t.refreshAttachedClonersInteractions()},end:i=>{t.updateGeometryInteractions(e,n),t.updateGeometryGroupsIfNeeded(),t.refreshAttachedClonersInteractions()}})}return r}function PN(t,e,i,n){let r=[];if(void 0!==i.intensity){let s=xN("intensity",t,e,i,n);s&&r.push(s)}if(void 0!==i.color){let s=function(t,e,i,n,r){let s=i[t]?i[t]:void 0,a=n[t];if(!a)return;let o=e[t],l=s?"string"==typeof s?r.getColor(s).clone():(new le).setRGB(s.r,s.g,s.b):o.clone(),h="string"==typeof a?r.getColor(a).clone():(new le).setRGB(a.r,a.g,a.b);if(l.equals(h))return;let c=o.clone();return{update:i=>{c.lerpColors(l,h,i),e[t]?.copy?.(c)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}("color",t,e,i,n);s&&r.push(s)}return r}function TN(t,e,i,n){let r=[],s=RT(i,n)||!!e.layers&&RT(e,n);r.push(function(t,e){return{update:()=>{t.transparent=e}}}(t,s));for(let a of t.layers){let t=e.layers?.data(a.uuid),s=i.layers.data(a.uuid);if(!s||"light"!==a.type&&(!(a.visible??1)||!(s.visible??1)))continue;let o=a.getNames().filter(t=>!Ux.some(e=>t.includes(e)));for(let e of o)try{let i,o=a.getValue(e);if("colors"===e)i=zN(a,t,s,e);else if(Array.isArray(o))"steps"===e&&(i=BN(a,t,s,e));else if("number"==typeof o)i=DN(a,t,s,e,n);else{if("boolean"==typeof o)continue;o instanceof Ht?i=IN(a,t,s,e):o instanceof be?i=ON(a,t,s,e,n):o instanceof oE?i=LN(a,t,s,e,n):o instanceof le?i=RN(a,t,s,e,n):"isTexture"in o&&(i=FN(a,t,s,e))}i&&(Array.isArray(i)?r.push(...i):r.push(i))}catch(ex){}}return r}function DN(t,e,i,n,r){if(!t.hasValue(n)||!(n in i))return;let s=e?e[n]:t.getValue(n),a=i[n],o="string"==typeof s?Number(r.getVariable(s)??0):s,l="string"==typeof a?Number(r.getVariable(a)??0):a;return o!==l?{update:e=>{t.setValue(n,Wt.lerp(o,l,e))},start:()=>{t.setValue(n,o)},end:()=>{t.setValue(n,l)}}:void 0}function IN(t,e,i,n){if(!t.hasValue(n)||!(n in i))return;let r=t.getValue(n),s=e?(new Ht).fromArray(e[n]):r.clone(),a=(new Ht).fromArray(i[n]);return s.equals(a)?void 0:{update:t=>{r.lerpVectors(s,a,t)},start:()=>{r.copy(s)},end:()=>{r.copy(a)}}}function ON(t,e,i,n,r){if(!t.hasValue(n)||!(n in i))return;let s=t.getValue(n),a=e?e[n]:void 0,o=i[n],l=a?wN(new be,a,r):s.clone(),h=wN(new be,o,r);return l.equals(h)?void 0:{update:t=>{s.lerpVectors(l,h,t)},start:()=>{s.copy(l)},end:()=>{s.copy(h)}}}function RN(t,e,i,n,r){if(!t.hasValue(n)||!(n in i))return;let s=e?e[n]:void 0,a=i[n],o=t.getValue(n),l=s?"string"==typeof s?r.getColor(s).clone():(new le).setRGB(s.r,s.g,s.b):o.clone(),h="string"==typeof a?r.getColor(a).clone():(new le).setRGB(a.r,a.g,a.b);if(l.equals(h))return;let c=o.clone();return{update:e=>{t.getValue(n)!==c&&t.setValue(n,c),c.lerpColors(l,h,e)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function LN(t,e,i,n,r){if(!t.hasValue(n)||!(n in i))return;let s=e?e[n]:void 0,a=i[n],o=t.getValue(n),l=s?"string"==typeof s?r.getColor(s).clone():(new le).setRGB(s.r,s.g,s.b):o.clone(),h="string"==typeof a?r.getColor(a).clone():new oE(a.r,a.g,a.b,a.a);if(l.equals(h))return;let c=o.clone();return{update:e=>{t.getValue(n)!==c&&t.setValue(n,c),c.lerpColors(l,h,e)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function BN(t,e,i,n="steps"){if(!t.hasValue(n)||!(n in i))return;let r=[],s=t.getValue(n),a=e?e[n]:s,o=i[n];return bm(a,o)||r.push({update:e=>{let i=[...s];for(let t=0;t<s.length;++t){let n=a[t],r=o[t];i[t]=Wt.lerp(n,r,e)}t.setValue(n,i)},start:()=>{t.setValue(n,a)},end:()=>{t.setValue(n,o)}}),r.length?r:void 0}function zN(t,e,i,n="colors"){if(!t.hasValue(n)||!(n in i))return;let r=[],s=t.getValue(n),a=e?e[n]:s.map(t=>t.toArray()),o=i[n];for(let l=0;l<s.length;++l){let t=[...a[l]],e=[...o[l]];Zy.isEqual(t,e)||r.push({update:i=>
vendor: 4,134 bytes, line 2
2{s[l].fromArray(Zy.lerp(t,e,i))},start:()=>{s[l].fromArray(t)},end:()=>{s[l].fromArray(e)}})}return r.length?r:void 0}function FN(t,e,i,n="texture"){if(!t.hasValue(n)||!(n in i))return;let r=t.getNode("rotation"),s=e?.[n]?.rotation??0,a=i[n]?.rotation??0;if(r&&s!==a)return{update:t=>{r.value=Wt.lerp(s,a,t)*Wt.DEG2RAD},start:()=>{r.value=s*Wt.DEG2RAD},end:()=>{r.value=a*Wt.DEG2RAD}};let o=t.getNode("mat");if(!o)return;let l=e?e[n]:o,h=i[n],c=[...l.repeat],d=[...l.offset],u=[...h.repeat],p=[...h.offset],f=l.rotation??0,m=h.rotation??0;return Xy.isEqual(c,u)&&Xy.isEqual(d,p)&&f===m?void 0:{update:t=>{o.repeat=Xy.lerp(c,u,t),o.offset=Xy.lerp(d,p,t),o.rotation=Wt.lerp(f,m,t),o.updateMatrix()},start:()=>{o.repeat=[...c],o.offset=[...d],o.rotation=f,o.updateMatrix()},end:()=>{o.repeat=[...u],o.offset=[...p],o.rotation=m,o.updateMatrix()}}}var NN=new be,UN=new ai;function kN(t,e,i,n,r){let s,a,o,l,h,c,d,u,p=[];if(t instanceof bL?(s=AN("position",t,e,i,r),s&&p.push(s),o=xN("rotation",t,e,i,r),o&&p.push(o),l=AN("shear",t,e,i,r),l&&p.push(l)):(u={slide:e.pathSnapping?.slide??t.updatedPathSnapping?.slide??t.dataPatched.pathSnapping?.slide??0,offset:e.pathSnapping?.offset??t.updatedPathSnapping?.offset??t.dataPatched.pathSnapping?.offset??0},c=xN("slide",u,e.pathSnapping??t.updatedPathSnapping??t.dataPatched.pathSnapping,i.pathSnapping??t.dataPatched.pathSnapping,r),c&&p.push(c),d=xN("offset",u,e.pathSnapping??t.updatedPathSnapping??t.dataPatched.pathSnapping,i.pathSnapping??t.dataPatched.pathSnapping,r),d&&p.push(d),!c&&!d&&(s=SN("position",t,e,i,r),s&&p.push(s),a=SN("scale",t,e,i,r),a&&p.push(a),o=function(t,e,i,n,r){let s=e?.rotation?e.rotation.map(t=>("string"==typeof t?Number(r.getVariable(t)??0):t)*Wt.DEG2RAD):void 0,a=i.rotation?.map(t=>("string"==typeof t?Number(r.getVariable(t)??0):t)*Wt.DEG2RAD);if(!a)return;let o=s?(new be).fromArray(s):(new be).setFromEuler(t.rotation),l=(new be).fromArray(a);if(o.equals(l))return;let h=NN.subVectors(l,o);if(n&&h.toArray().every(t=>Math.abs(t)<2*Math.PI)){let e=(new xe).setFromEuler(UN.setFromVector3(o)),i=(new xe).setFromEuler(UN.setFromVector3(l));return{update:n=>{!function(t,e,i,n){if(0===n)return i.copy(t);if(1===n)return i.copy(e);let r=t.w*e.w+t.x*e.x+t.y*e.y+t.z*e.z;if(r>=1)return i.copy(t);let s=1-r*r;if(s<=Number.EPSILON){let r=1-n;return i.w=r*t.w+n*e.w,i.x=r*t.x+n*e.x,i.y=r*t.y+n*e.y,i.z=r*t.z+n*e.z,i.normalize(),i}let a=Math.sqrt(s),o=Math.atan2(a,r),l=Math.sin((1-n)*o)/a,h=Math.sin(n*o)/a;i.w=t.w*l+e.w*h,i.x=t.x*l+e.x*h,i.y=t.y*l+e.y*h,i.z=t.z*l+e.z*h}(e,i,t.quaternion,n)},start:()=>{t.rotation.setFromVector3(o)},end:()=>{t.rotation.setFromVector3(l)}}}return{update:e=>{NN.lerpVectors(o,l,e),t.rotation.setFromVector3(NN)},start:()=>{t.rotation.setFromVector3(o)},end:()=>{t.rotation.setFromVector3(l)}}}(t,e,i,n,r),o&&p.push(o),h=function(t,e,i,n){let r=i[t]?i[t]:void 0,s=n[t];if(!s)return;let a=e[t],o=r?(new Ze).fromArray(r):a.clone(),l=new be,h=new xe,c=new be;o.decompose(l,h,c);let d=(new Ze).fromArray(s),u=new be,p=new xe,f=new be;return d.decompose(u,p,f),o.equals(d)?void 0:{update:t=>{yN.slerpQuaternions(h,p,t),gN.lerpVectors(l,u,t),vN.lerpVectors(c,f,t),a.compose(gN,yN,vN)},start:()=>{a.compose(l,h,c)},end:()=>{a.compose(u,p,f)}}}("hiddenMatrix",t,e,i),h&&p.push(h))),s||a||o||h||c||d){let i=t instanceof bL?()=>{t.updateWorldMatrix(!0,!1,!0),t.resetBBoxNeedsUpdate()}:()=>{t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldSVD()),t.parent?.matrixWorldFusedFalse&&(t.matrixWorld.multiplyMatrices(t.parent.matrixWorldFusedFalse,t.matrix),t.matrixWorldNeedsUpdate=!1),qI(t)&&XI(t.parent)&&t.invalidateDownstreamBooleanData(!0),t.updatePathSnapping(Object.assign({},e.pathSnapping,u))};p.push({update:i,start:i,end:i})}return p}function VN(t,e,i,n){let r=[];if(!("cloner"in i)||!t.cloner)return r;let s=t.cloner,a="cloner"in e?e.cloner:{},o=i.cloner;Tx.forEach(t=>{let e;e="count"===t?xN("count",s.parameters,a,o,n,!0):CN(t,s.parameters,a??{},o,n),e&&r.push(e)});let l=function(t,e,i,n){if("radial"!==t.parameters.type)return;let r=e.radial,s=i.radial;if(!s)return;let a=t.parameters.radial,o=[];
2return Dx.forEach(t=>{let e=CN(t,a,r??{},s,n);e&&o.push(e)}),o}(s,a,o,n);l?.length&&r.push(...l);let h=function(t,e,i,n){if("linear"!==t.parameters.type)return;let r=e.linear,s=i.linear;if(!s)return;let a=[],o=t.parameters.linear;return Ix.forEach(t=>{let e=CN(t,o,r??{},s,n);e&&a.push(e)}),a}(s,a,o,n);h?.length&&r.push(...h);let c=function(t,e,i,n){if("grid"!==t.parameters.type)return;let r=e.grid,s=i.grid;if(!s)return;let a=[],o=t.parameters.grid;return Ox.forEach(t=>{let e;e="count"===t?bN(t,o,r??{},s,n,!0):CN(t,o,r??{},s,n),e&&a.push(e)}),a}(s,a,o,n);c?.length&&r.push(...c);let d=function(t,e,i,n){if("toObject"!==t.parameters.type)return;let r=e.toObject,s=i.toObject;if(!s)return;let a=[],o=t.parameters.toObject;return Rx.forEach(t=>{let e;e="count"===t?xN(t,o,r??{},s,n,!0):CN(t,o,r??{},s,n),e&&a.push(e)}),a}(s,a,o,n);d?.length&&r.push(...d);let u=function(t,e,i,n){if(!t.parameters.randomness)return;let r=e.randomnessObject,s=i.randomnessObject;if(!s)return;let a=[],o=t.parameters.randomnessObject;return Lx.forEach(t=>{let e=CN(t,o,r??{},s,n);e&&a.push(e)}),a}(s,a,o,n);return u?.length&&r.push(...u),r.length&&r.push({update:()=>{s.update()}}),r}function jN(t,e,i,n,r){let s,a,o,l,h,c,d,u,p,f,m,g,v,y,x,b=[];if("width"in t&&(s=xN("width",t,e,i,r),s&&b.push(s)),"height"in t&&(a=xN("height",t,e,i,r),a&&b.push(a)),t instanceof qL||t instanceof KL){let n={...e.fill},s={...i.fill};void 0!==n.enabled&&n.enabled!==s.enabled&&(b.push(function(t,e){return{update:()=>{t instanceof qL&&(t.fill.enabled=e)}}}(t,!0)),n.enabled||Object.assign(n,{enabled:!0,color:{...n.color,a:0}}),s.enabled||Object.assign(s,{enabled:!0,color:{...s.color,a:0}})),o=MN("color",t.fill,n,s,r),o&&b.push(o)}if(t instanceof qL){let n={...e.stroke},s={...i.stroke};(n.enabled||s.enabled)&&(b.push(function(t,e){return{update:()=>{t instanceof qL&&(t.stroke.enabled=e)}}}(t,!0)),n.enabled||Object.assign(n,{enabled:!0,color:{...n.color,a:0}}),s.enabled||Object.assign(s,{enabled:!0,color:{...s.color,a:0}})),l=MN("color",t.stroke,n,s,r),l&&b.push(l),h=xN("thickness",t.stroke,n,s,r),h&&b.push(h)}if(t instanceof qL){let n={...e.dropShadow},s={...i.dropShadow};(n.enabled||s.enabled)&&(b.push(function(t,e){return{update:()=>{t instanceof qL&&(t.dropShadow.enabled=e)}}}(t,!0)),n.enabled||Object.assign(n,{enabled:!0,color:{...n.color,a:0}}),s.enabled||Object.assign(s,{enabled:!0,color:{...s.color,a:0}})),c=MN("color",t.dropShadow,n,s,r),c&&b.push(c),d=xN("blurRadius",t.dropShadow,n,s,r),d&&b.push(d),p=xN("spread",t.dropShadow,n,s,r),p&&b.push(p),u=AN("offset",t.dropShadow,n,s,r),u&&b.push(u)}if(t instanceof qL){let n={...e.innerShadow},s={...i.innerShadow};(n.enabled||s.enabled)&&(b.push(function(t,e){return{update:()=>{t instanceof qL&&(t.innerShadow.enabled=e)}}}(t,!0)),n.enabled||Object.assign(n,{enabled:!0,color:{...n.color,a:0}}),s.enabled||Object.assign(s,{enabled:!0,color:{...s.color,a:0}})),f=MN("color",t.innerShadow,n,s,r),f&&b.push(f),m=xN("blurRadius",t.innerShadow,n,s,r),m&&b.push(m),v=xN("spread",t.innerShadow,n,s,r),v&&b.push(v),g=AN("offset",t.innerShadow,n,s,r),g&&b.push(g)}if(t instanceof qL||t instanceof KL){let n={...e.backgroundBlur},s={...i.backgroundBlur};(n.enabled||s.enabled)&&(b.push(function(t,e){return{update:()=>{t instanceof qL&&(t.backgroundBlur.enabled=e)}}}(t,!0)),n.enabled||Object.assign(n,{enabled:!0,radius:0}),s.enabled||Object.assign(s,{enabled:!0,radius:0})),y=xN("radius",t.backgroundBlur,n,s,r),y&&b.push(y)}if(t instanceof qL){let n={...e.layerBlur},s={...i.layerBlur};(n.enabled||s.enabled)&&(b.push(function(t,e){return{update:()=>{t instanceof qL&&(t.layerBlur.enabled=e)}}}(t,!0)),n.enabled||Object.assign(n,{enabled:!0,radius:0}),s.enabled||Object.assign(s,{enabled:!0,radius:0})),x=xN("radius",t.layerBlur,n,s,r),x&&b.push(x)}if(t instanceof KL||t instanceof YL){let n=bN("cornerRadius",t,e,i,r);n&&b.push(n)}return b}function GN(t,e,i,n,r){let s=[];return t.data.visible&&s.push(...kN(t,e,i,r,n)),t instanceof bL?s.push(...jN(t,e,i,0,n)):(t.data.visible&&s.push(...VN(t,e,i,n)),qI(t)?(t instanceof ID&&t.data.visible&&s.push(...EN(t,e,i,n)),t.data.visible&&s.push(...function(t,e,
2i,n){let r=[];if(Array.isArray(t.material)){if(!("materials"in i)||!i.materials)return r;let s="materials"in e&&e.materials?e.materials:[],a=i.materials;t.material.forEach((t,e)=>{if(!a[e])return;let i=s[e]??{},o=a[e];"string"==typeof i||"string"==typeof o||r.push(...TN(t,i,o,n))})}else{if(!("material"in i)||!i.material)return r;let s="material"in e&&e.material?e.material:{},a=i.material;if("string"==typeof s||"string"==typeof a)return r;r.push(...TN(t.material,s,a,n))}return r}(t,e,i,n))):(t=>GI.is(t))(t)?t.data.visible&&s.push(...PN(t,e,i,n)):(t=>t instanceof UI)(t)&&s.push(...function(t,e,i,n){let r=[],s="OrthographicCamera"===t.cameraType?e.orthographic?.zoom:e.perspective?.zoom,a="OrthographicCamera"===t.cameraType?i.orthographic?.zoom:i.perspective?.zoom;if(void 0!==a){let e=s??t.zoom,i=a;e!==i&&r.push({update:n=>{t.zoom=Wt.lerp(e,i,n),t.updateProjectionMatrix()},start:()=>{t.zoom=e,t.updateProjectionMatrix()},end:()=>{t.zoom=i,t.updateProjectionMatrix()}})}if(void 0!==i.targetOffset){let s=xN("targetOffset",t,e,i,n);s&&r.push(s)}return r}(t,e,i,n))),s.length?{update:t=>{s.forEach(e=>e.update(t))},start:t=>{s.forEach(e=>e.start?.(t))},end:t=>{s.forEach(e=>e.end?.(t))}}:void 0}var WN=new be;function HN(t,e,i=!1){let n=[],r=i=>{let n=i.data;delete i.states,i.currentState=null,i.reversibleToState=null,i.currentTransitionEvent=null;for(let t of n.states){let e={...t.data};i.states||(i.states={}),i.states[t.id]=lw.patch(n,e)}XN(t.scene,i,null,e,void 0!==n.events.find(t=>"Follow"===t.data.type||"LookAt"===t.data.type)),qN(t)};t.scene.traverse2D(r),t.traverseChildren(s=>
2{if(i&&(s.rigidBody?.setTranslation(s.position0,!0),s.rigidBody?.setRotation(s.rotation0,!0),s.rigidBody?.setLinvel(WN,!0),s.rigidBody?.setAngvel(WN,!0)),!r_.is(s))return;let a=s.uuid,o=s.data;if(delete s.states,s.uuid===sx)return;let l=!1;n.some(e=>t.scene.find(a)?.isDescendantOf(e))?l=!0:!0===o.physics?.fusedBody&&"dynamic"===o.physics.rigidBody&&n.push(a),s.data=o,s.currentState=null,s.reversibleToState=null,s.currentTransitionEvent=null;for(let e of o.states){let i={...e.data};!0===t.data.globalPhysics.usePhysics&&o.physics&&("dynamic"===o.physics.rigidBody||l)&&(void 0!==e.data.position&&delete i.position,void 0!==e.data.rotation&&delete i.rotation,void 0!==e.data.hiddenMatrix&&delete i.hiddenMatrix),s.states||(s.states={}),s.states[e.id]=yb.patch(o,i)}XN(t.scene,s,null,e,void 0!==o.events.find(t=>"Follow"===t.data.type||"LookAt"===t.data.type)),s instanceof MB&&s.frame&&(s.frame.traverse(t=>r(t)),s.uiCanvas?.applySize())}),qN(t),t.frame&&(t.frame.traverse(t=>r(t)),t.uiCanvas?.applySize())}function qN(t){t.traverseEntity(e=>{for(let i of e.data.events){let e=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":e.push(...i.data.actions);break;case"GameControl":for(let t of Object.values(i.data.gameActions))e.push(...t);break;case"DragDrop":e.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":e.push(...i.data.inActions,...i.data.outActions)}for(let i of e)if("Create"===i.data.type&&"Yes"===i.data.hideBase){let e=t.scene.find(i.data.object);e&&(e.visible=!1)}}})}function XN(t,e,i,n,r=!1){if(e instanceof ID&&!(e instanceof XB)&&e.removeInteractionGeometry(n),e instanceof bL?e.changeSelectedState(i,{shared:n},r):e.changeSelectedState(i,{scene:t,shared:n},r),e instanceof ID&&e.updateGeometryGroupsIfNeeded(),e instanceof UI&&e.updateCameraState(e.dataPatched,{scene:t,shared:n}),!(e instanceof bL)){if(e.cloner)for(let t of e.cloner.children)t.playModeVisible=void 0;e.updateVisible()}}function YN(t){let e;if(5===t.easing){let{control1:i,control2:n}=t;e=`cubicBezier(\n\t\t\t${i[0]}, ${i[1]}, ${n[0]}, ${n[1]}\n\t\t)`}else if(6===t.easing){let{mass:i,stiffness:n,damping:r,velocity:s}=t;e=`spring( ${i}, ${n}, ${r}, ${s} )`}else{let i;switch(t.easing){case 0:default:i=cx.linear;break;case 1:i=cx.ease;break;case 2:i=cx.easeIn;break;case 3:i=cx.easeOut;break;case 4:i=cx.easeInOut}let[n,r,s,a]=i;e=`cubicBezier( ${n}, ${r}, ${s}, ${a} )`}return{duration:Math.max(t.duration,1e-4),easing:e}}function QN(t){let e={delay:0,loop:-1===t.repeat||t.repeat+1};if(0===t.repeat)e.direction="normal",e.rewind=!1;else switch(t.direction){case"pingpong":e.direction="alternate",e.rewind=!1;break;case"pingpong-rewind":e.direction="alternate",e.rewind=!0;break;default:e.direction="normal",e.rewind=!1}switch(e.delay=0,e.endDelay=0,e.startOnceDelay=0,e.pingPongDelayCorrection=0,e.pingPongEndDelayCorrection=0,t.delayDirection){case"start-once":e.startOnceDelay=t.delay;break;case"start":e.delay=t.delay;break;case"end":e.endDelay=t.delay;break;case"start-end":case void 0:e.delay=t.delay,e.endDelay=t.delay}return"alternate"===e.direction&&(e.delay/=2,e.endDelay/=2,"start"===t.delayDirection?(e.pingPongDelayCorrection=e.delay,"number"==typeof e.loop&&e.loop%2==0&&(e.pingPongEndDelayCorrection=e.delay)):"end"===t.delayDirection?"number"==typeof e.loop&&e.loop%2!=0&&(e.pingPongEndDelayCorrection=e.endDelay):"start-end"===t.delayDirection&&(e.pingPongDelayCorrection=e.delay,e.pingPongEndDelayCorrection=e.endDelay)),e}var ZN={type:"beginState"},KN={type:"completeState",isfromEntity:!1},JN=class{constructor(t,e,i,n,r,s){if(this.object=t,this.data=n,this.sharedAssets=r,this.allowSlerp=s,this.targets={t:0},this.firstLoop=!0,this._changeBegan=!1,this._changeCompleted=!0,this.onChange=()=>{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 t=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=t,this.object.dispatchEvent({type:"beginState",state:t}),this.object instanceof bL||this.object.traverseEntity(t=>{t!==this.object&&t instanceof UI&&t.dispatchEvent(ZN)})},this.onChangeComplete=()=>{this.firstLoop&&(this.onFirstLoop(),this.firstLoop=!1),this.object.reversibleToState=this.to.id;let t=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=t,this.object.dispatchEvent({type:"completeState",state:t}),this.object instanceof bL||this.object.traverseEntity(t=>{t!==this.object&&t instanceof UI&&t.dispatchEvent(KN)})},this.onFirstLoop=()=>{this.useCurrentState&&(this.callback=GN(this.object,this.from.data,this.to.data,this.sharedAssets,this.allowSlerp))},void 0===e){let t=tU(this.object,this.object.currentState===i?this.object.prevState:this.object.currentState);if(!t)throw new Error("Missing property");this.from=t}else{let t=tU(this.object,e);if(!t)throw new Error("Missing property");this.from=t}if(void 0===i)throw new Error("Missing property");{let t=tU(this.object,i);if(!t)throw new Error("Missing property");this.to=t}this.useCurrentState=void 0===e||void 0===i,this.params={targets:this.targets,t:1,autoplay:!1,...QN(n),...YN(n),change:this.onChange},this.callback=GN(this.object,void 0===e?{}:this.from.data,void 0===i?{}:this.to.data,this.sharedAssets,this.allowSlerp)}get changeBegan(){return this._changeBegan}get changeCompleted(){return this._changeCompleted}},$N=class extends Dt{constructor(t,e,i,n,r){if(super(),this.eventType=t,this.data=e,this.page=i,this.shared=n,this.condition=r,this.toggleIsForward=!1,this.timelineNeedsRebuild=!1,this.hasPlayedOnce=!1,this.onTimelineChangeComplete=()=>{"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())},!e.object)throw new Error("Missing property");let s=this.page.scene.find(e.object)??this.page.uiCanvas?.find(e.object)??this.page.scene.find2DInUIObjects(e.object);if(!s)throw new Error("Missing property");if(!s.states)throw new Error("Missing property");if(this.object=s,e.tweens.length<2)throw new Error("Missing property");this.tweens=Array(this.data.tweens.length-1),this.startOnceDelay="start-once"===e.tweens[0].data.delayDirection?e.tweens[0].data.delay:0,this.init()}get playing(){return!1===this.timeline?.paused}get changeBegan(){return this.tweens.some(t=>t.changeBegan)??!1}init(){this.initialCurrentState=tU(this.object,this.object.currentState).id,this.toggleIsForward=!1}get currentState(){return"Toggle"===this.data.runMode&&My(this.eventType)?this.initialCurrentState:this.object.currentState}buildTimeline({isForward:t=!0,needsRebuild:e=!1,isRebuild:i=!1}={}){try{let n=QN(this.data.tweens[0].data);i&&"number"==typeof n.loop&&n.loop--,this.timeline?.pause(),this.timeline=mN.timeline({autoplay:!1,...n,...!0===n.loop||n.loop>1?{timelineChangeComplete:this.onTimelineChangeComplete}:{}});let r=this.tweens.findIndex(t=>t?.changeBegan);if(!0===e&&(this.timelineNeedsRebuild=!0),t){let t=-1===r?0:r;for(let e=t;e<this.data.tweens.length-1;e++){let i,s=this.data.tweens[e],a=this.data.tweens[e+1];e!==t||!0!==this.object.wasMovedByUser&&!0!==this.object.previousAction?.changeBegan?i=void 0===s.data.state?this.currentState:s.data.state:(i=void 0,this.object instanceof UI&&(this.object.wasMovedByUser=!1));let o=new JN(this.object,i,void 0===a.data.state?this.currentState:a.data.state,a.data,this.shared,this.data.allowSlerp??!1);-1!==r&&e===t&&Object.assign(o.params,{startOnceDelay:0}),this.tweens[e]=o,this.timeline.add(o.params,this.timeline.duration+(e===t?n.delay:0))}this.timeline.duration+=n.endDelay}else{let t=-1===r?this.data.tweens.length-1:r+1;for(let e=t;e>0;e--){let i,s=this.data.tweens[e],a=this.data.tweens[e-1];e!==t||!0!==this.object.wasMovedByUser&&!0!==this.object.previousAction?.changeBegan?i=void 0===s.data.state?this.currentState:s.data.state:(i=void 0,this.object instanceof UI&&(this.object.wasMovedByUser=!1));let o=new JN(this.object,i,void 0===a.data.state?this.currentState:a.data.state,s.data,this.shared,this.data.allowSlerp??!1);-1!==r&&e===t&&Object.assign(o.params,{startOnceDelay:0}),this.tweens[e-1]=o,this.timeline.add(o.params,this.timeline.duration+(e===t?n.endDelay:0))}this.timeline.duration+=n.delay}}catch(dx){Error}!0===this.object.previousAction?.playing&&this.object.previousAction.pause(),this.object.previousAction=this}play(){if(!1===uU(this.shared,this.condition)||My(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce||(this.hasPlayedOnce=!0,this.playing))return!1;clearTimeout(this.timeoutId);let t=QN(this.data.tweens[0].data).pingPongDelayCorrection;mN({targets:{},duration:this.startOnceDelay+t,easing:"linear",complete:()=>{try{this.buildTimeline(),this.timeline.play()}catch(Ag){Error}}})}pause(){this.timeline?.pause(),clearTimeout(this.timeoutId),this.tweens=Array(this.data.tweens.length-1),delete this.timeoutId}stop(){this.pause();let t=void 0===this.data.tweens[0].data.state?this.initialCurrentState:this.data.tweens[0].data.state;this.object instanceof bL?this.object.changeSelectedState(t,{shared:this.shared}):this.object.changeSelectedState(t,{scene:this.page.scene,shared:this.shared}),this.object.currentState=t}seek(t){if(!1===uU(this.shared,this.condition))return!1;void 0===this.timeline&&this.buildTimeline(),this.timeline?.seek(t*this.timeline.duration,!0)}toggle(t){if(!1===uU(this.shared,this.condition))return!1;clearTimeout(this.timeoutId),this.toggleIsForward=t??!this.toggleIsForward,this.playing?(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!0}),this.timeline.play()):mN({targets:{},duration:this.startOnceDelay,easing:"linear",complete:()=>{this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward}),this.timeline.play()}})}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function tU(t,e){let i,n;if("string"==typeof e?(i=e,n=t.states?.[i]):null===e&&(i=null,n=t.data),void 0!==i&&void 0!==n)return{id:i,data:n}}var eU={type:"beginState"},iU={type:"completeState",isfromEntity:!1},nU={type:"requestRender"},rU=class extends Dt{constructor(t,e,i,n){super(),this.data=t,this.page=e,this.shared=i,this.condition=n,this.toggleIsForward=!1,this.posStart=new be,this.posEnd=new be,this.qStart=new xe,this.qEnd=new xe,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.animation&&this.animation.began&&!this.animation.completed}buildAnimation(t=!1){if(!this.data.animate)return;let e=this.page.scene.find(this.data.targetCamera);if(!e||!e.visible)throw new 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=mN({targets:i,t:1,...YN(this.data),update:()=>{0===i.t&&("Toggle"!==this.data.runMode||this.toggleIsForward?(this.posEnd.copy(e.position),this.qEnd.copy(e.quaternion),this.zoomEnd=e.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(e.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(eU));let t=this.page.activeCamera;t.position.lerpVectors(this.posStart,this.posEnd,i.t),t.quaternion.slerp
2Quaternions(this.qStart,this.qEnd,i.t),t.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*i.t,t.wasMovedBySwitchCameraAction=!0,t.updateMatrix(),t.updateMatrixWorld(),t.updateProjectionMatrix(),t.dispatchEvent(nU),1===i.t&&t.dispatchEvent(iU)}})}switchCamera(t){let e=this.page.activeCamera,i=this.page.scene.find(t);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),e.dispatchEvent({type:"cameraChange",camera:i})}play(){if(!1===uU(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(t){if(!1===uU(this.shared,this.condition))return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,t!==this.toggleIsForward)try{this.playing?(this.animation?.pause(),this.toggleIsForward=t??!this.toggleIsForward,this.buildAnimation(!0),this.animation?.play()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=t??!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(iU),this.page.activeCamera.dispatchEvent(nU))},1e3*this.data.delay)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};function sU(t){let e=t?.tracks.filter(t=>"vector"===t.ValueTypeName||"quaternion"===t.ValueTypeName).map(t=>t.times.length);if(e?.length){let t=Sm(e);return t&&t>2?t:2}return 2}var aU=class extends Dt{constructor(t,e,i,n,r){super(),this.data=t,this.page=e,this.animationControls=i,this.shared=n,this.condition=r,this.startOnceDelay=0,this.toggleIsForward=!1;let s=t.object,a=e.scene.find(t.object);a&&Array.isArray(a.identity)&&(s=a.identity[0]),this.data={...t,object:s};let o=this.animationControls.clipIdToAction[t.clipId+"/"+s];if(this.duration=o?.getClip()?.duration??1,this.data.crop2){let t=sU(o?.getClip());this.leftFrameTime=this.data.crop2[0]/(t-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(t-1)*this.duration}else{let t=o?.getClip()?.tracks[0]?.times.length;t&&t>1?(this.leftFrameTime=this.data.crop[0]/t*this.duration,this.rightFrameTime=this.data.crop[1]/t*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=t.delay}get playing(){return this.threeAnimAction?.isRunning()??!1}play(t=!1){if(!1===uU(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 e=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([i,n])=>{let r=i.split("/")[1];this.threeAnimAction!==n&&r===e&&n.isRunning()&&(t?n.fadeOut(.2):n.stop())}),t&&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(t){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=Wt.clamp(this.threeAnimAction.time+1/60*t,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(t,e=!1){if(!1===uU(this.shared,this.condition))return!1;this.toggleIsForward=t??!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 t=this.data.clipId.split("/")[1];
vendor: 4,213 bytes, line 2
2Object.entries(this.animationControls.clipIdToAction).forEach(([i,n])=>{let r=i.split("/")[1];this.threeAnimAction!==n&&r===t&&n.isRunning()&&(e?n.fadeOut(.2):n.stop())}),e&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();t&&(t.duration=this.duration),this.pause()}},oU=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.eventManager=i,this.shared=n,this.condition=r,this.timeOutId=-1,this.scene=e.scene}dispatch(){if(!1===uU(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(t=>t.uuid!==this.data.target||t.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 t=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(t=>{"ParticleSystem"===t.type&&(t.sleep(),t.wakeUp(),t.data.autoPlay?t.start():t.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(t),HN(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}},lU=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n,this.evaluatedCondition=!1}checkConditions(){this.evaluatedCondition=uU(this.shared,this.condition)}dispatch(){if(!1===this.evaluatedCondition)return!1;let t=this.shared.getVariable(this.data.variableId),e=JM(this.data.expression,this.shared,Tb.typeOfVariable(t));void 0!==e&&this.shared.updateVariable(this.data.variableId,"string"==typeof e?{textValue:e}:e)}dispose(){}},hU=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n,this.timeoutId=null}dispatchInner(){if(!1===uU(this.shared,this.condition))return!1;let t=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"===t?"Paused":"Playing");else if("Play"===this.data.mode&&"Playing"!==t)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"!==t)this.shared.setDynamicVariablePlayState(this.data.variableId,"Stopped");else if("Pause"===this.data.mode&&"Paused"!==t)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 e=this.shared.getDynamicVariableToggleIsForward(this.data.variableId);"Playing"===t?this.shared.setDynamicVariableToggleIsForward(this.data.variableId,void 0!==e&&!e):(this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!e),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing"))}}dispatch(){let t=this.data.delay,e=this.shared.getDynamicVariablePlayState(this.data.variableId);"PlayPause"===this.data.mode&&"Playing"===e&&(t=this.data.pauseDelay),0!==t?(this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.dispatchInner()},t)):this.dispatchInner()}dispose(){this.timeoutId&&window.clearTimeout(this.timeoutId)}},cU=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n}dispatch(){if(!1===uU(this.shared,this.condition))return!1;("single"===this.data.target?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEac
2h(t=>{this.shared.getVariable(t);let e=this.shared.data.variables.data(t)?.value;void 0!==e&&this.shared.updateVariable(t,e),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(SD(t))})}dispose(){}},dU=class{constructor(t,e,i,n){this.data=t,this.page=e,this.shared=i,this.condition=n}dispatch(){if(!1===uU(this.shared,this.condition))return!1;this.data.userAPIId&&this.shared.getUserAPI(this.data.userAPIId)?.callUserAPI(this.shared)}dispose(){}};function uU(t,e){if(void 0===e)return!0;if(0===e.expression.length)return!1;let i=JM(e.expression,t,"boolean");return e.negate?!i:!!i}function pU(t,e,i,n,r,s){let a={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},o=e=>({id:l,data:h})=>{try{"Audio"===h.type?qy[t.type].includes("Audio")&&a.Audio.push(new aF(l,h,s,n,e)):"Video"!==h.type||s instanceof bL?"Particles"===h.type?qy[t.type].includes("Particles")&&a.Particles.push(new oF(h,i,n,e)):"Link"===h.type?qy[t.type].includes("Link")&&a.Link.push(new cF(h,r.controlsManager,n,e)):"Create"===h.type?qy[t.type].includes("Create")&&a.Create.push(new MU(h,i,r.controlsManager,n,e)):"Destroy"===h.type?qy[t.type].includes("Destroy")&&a.Destroy.push(new dF(h,i,r.controlsManager,n,e)):"Reset"===h.type?qy[t.type].includes("Reset")&&a.Reset.push(new uF(h,i,n,r,e)):"Transition"===h.type?qy[t.type].includes("Transition")&&a.Transition.push(new $N(t.type,h,i,n,e)):"SwitchCamera"===h.type?qy[t.type].includes("SwitchCamera")&&a.SwitchCamera.push(new rU(h,i,n,e)):"SceneTransition"===h.type?qy[t.type].includes("SceneTransition")&&a.SceneTransition.push(new oU(h,i,r,n,e)):"Animation"===h.type?qy[t.type].includes("Animation")&&a.Animation.push(new aU(h,i,r.animationControls,n,e)):"SetVariable"===h.type?qy[t.type].includes("SetVariable")&&a.SetVariable.push(new lU(h,i,n,e)):"DynamicVariablePlay"===h.type?qy[t.type].includes("DynamicVariablePlay")&&a.DynamicVariablePlay.push(new hU(h,i,n,e)):"Conditional"===h.type?qy[t.type].includes("Conditional")&&(h.ifActions.forEach(o({expression:h.condition,negate:!1})),h.elseActions.forEach(o({expression:h.condition,negate:!0}))):"ClearLocalStorage"===h.type?qy[t.type].includes("ClearLocalStorage")&&a.ClearLocalStorage.push(new cU(h,i,n,e)):"UserAPI"===h.type&&qy[t.type].includes("UserAPI")&&a.UserAPI.push(new dU(h,i,n,e)):qy[t.type].includes("Video")&&a.Video.push(new xU(l,h,s,n,e))}catch(ex){}};return e.forEach(o()),a}function fU(t){Object.values(t).forEach(t=>{t.forEach(t=>{(t instanceof aF||t instanceof xU||t instanceof oF||t instanceof aU||t instanceof $N||t instanceof MU||t instanceof dF||t instanceof rU||t instanceof oU||t instanceof uF||t instanceof lU||t instanceof hU)&&t.dispose()})})}var mU=new Map,gU=new Map,vU=class{constructor(t,e,i){this.data=e,this.delay=0,this.status="stopped";let{layerId:n,loop:r,volume:s,delay:a}=e;if(this.object=i,void 0===n)throw new Error("Missing property");let o=function(t,e){let i;if("material"in t){let n=t.material;i=Array.isArray(n)?t.material[0].layers.find(t=>t.uuid===e):t.material.layers.find(t=>t.uuid===e)}if(i)return i.color.texture.image.img instanceof HTMLVideoElement?i.color.texture.image.img:void 0}(i,n);o&&(this.videoElement=o,this.videoElement.loop=r===1/0,Um&&(this.videoElement.autoplay=!0),void 0!==s&&(this.videoElement.volume=s)),void 0!==a&&(this.delay=a),gU.has(i.uuid)?gU.get(i.uuid).push(this):gU.set(i.uuid,[this]),mU.set(t,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(t){if(!this.videoElement)return;let e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);t?(this.mute(),this.delay+=150):e?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let t=this.videoElement.play();void 0!==t&&t.then(t=>{}).catch(t=>{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(t){return new Promise((e,i)=>{if(!this.videoElement)return i();let n=this.videoElement.duration;if(n>0){let e=t%n;this.videoElement.currentTime=e}this.videoElement.addEventListener("seeked",()=>e(),{once:!0})})}
vendor: 5,713 bytes, line 2
2playByToggle(){"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)}},yU=class{constructor(t){this.data=t}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(t){let e=mU.get(t);!e||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e[this.data.interaction](),this.disposeDelay()},this.data.delay)):e[this.data.interaction]())}pauseAllVideosFromObject(t){let e=gU.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>t[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(t=>t[this.data.interaction]()))}pauseAllVideos(){let t=[...gU.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(t=>{t.forEach(t=>{t[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(t=>{t.forEach(t=>{t[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},xU=class{constructor(t,e,i,n,r){if(this.data=e,this.shared=n,this.condition=r,"play"===e.interaction)this.interaction=new vU(t,e,i);else{if("pause"!==e.interaction&&"stop"!==e.interaction)throw new Error("Missing property");this.interaction=new yU(e)}}dispatchBasic(){if(!1===uU(this.shared,this.condition))return!1;this.interaction instanceof vU?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(!1===uU(this.shared,this.condition))return!1;this.interaction instanceof vU?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}},bU=(()=>{let t,e,i,n;function r(i){!t&&!wU()&&e?.sharedGameControlGlobals.createdObjects.length>0&&(t=requestAnimationFrame(s)),i&&(e=i,n=i.requestRender)}function s(r){let a=i?r-i:0,o=e.sharedGameControlGlobals.createdObjects,l=e.sharedGameControlGlobals.nCreatedPerAction,h=o.length,c=0;for(;c<h;){let t=o[c];void 0===t.userData.createdTime&&(t.userData.createdTime=r),void 0===t.userData.lifetime&&void 0===t.userData.quantity||t.userData.lifetime&&r-t.userData.createdTime<t.userData.lifetime||t.userData.quantity&&l[t.userData.actionId]<=t.userData.quantity?(t.userData.velocity&&(t.position.addScaledVector(t.userData.velocity,a/1e3),t.updateMatrix(),n()),c++):(l[t.userData.actionId]>t.userData.quantity&&l[t.userData.actionId]--,o.splice(c,1),t.removeFromParent(),e.sharedGameControlGlobals.rapierWorld&&t.rigidBody?(e.sharedGameControlGlobals.colliderToEntity.delete(t.rigidBody.collider(0).handle),e.sharedGameControlGlobals.rapierWorld.removeRigidBody(t.rigidBody)):(t.bvhGeometry=void 0,e.sharedGameControlGlobals.entitiesWithTransformAnim=e.sharedGameControlGlobals.entitiesWithTransformAnim.filter(t=>void 0!==t.bvhGeometry)),h--,n())}t=c>0?requestAnimationFrame(s):void 0,i=c>0?r:void 0}return typeof document<"u"&&document.addEventListener("visibilitychange",function(){wU()?t&&(cancelAnimationFrame(t),t=void 0,i=void 0):r()}),r})();function wU(){return!!document&&document.hidden}var SU=new xe,_U=new be,AU=new be,MU=class{constructor(t,e,i,n,r){this.data=t,this.page=e,this.controlsManager=i,this.shared=n,this.condition=r,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=Wt.generateUUID(),this.dispatch=()=>{if(!1===uU(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===uU(this.shared,this.condition))return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,1e3*this.data.delay))},this.dispatchThrottled=Om(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 t=new o_(this.object);if(t.playModeVisible=!0,t.expand(),"world"!==this.data.coordinateSystem){let e=this.data.coordinateSystem,i=this.page.scene.find(e);i&&(i.updateMatrixWorldSVD(),t.hiddenMatrix.copy(i.matrixWorldRigid))}t.scale.copy(this.object.scale),t.position.fromArray(this.data.position),t.rotation.fromArray(this.data.rotation),t.updateMatrix(),this.page.add(t);let e=this.controlsManager.sharedGameControlGlobals;e.createdObjects.push(t),void 0===e.nCreatedPerAction[this.uniqueId]?e.nCreatedPerAction[this.uniqueId]=1:e.nCreatedPerAction[this.uniqueId]++,t.updateWorldMatrix(!0,!0),t.traverseObject(this.traverseObjectCB),bU(),this.controlsManager.requestRender()},this.traverseObjectCB=t=>{let e;if(t.hasNonUniformScale&&t.updateMatrixWorldSVD(),this.controlsManager.sharedGameControlGlobals.rapierWorld){if(t instanceof bI){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;e=t.object}else if(t instanceof o_)e=t.object;else if(e=t,e.dataPatched.cloner?.hideBase)return!0}else{if(t instanceof bI)return;e=t instanceof o_?t.object:t}"Time"===this.data.destroy?t.userData.lifetime=1e3*this.data.lifetime:"Quantity"===this.data.destroy&&(t.userData.quantity=this.data.destroyAfterQuantity,t.userData.actionId=this.uniqueId);let i=(new be).fromArray(this.data.velocity),n=e.dataPatched;
vendor: 6,004 bytes, line 2
2if(!("visibility"===n.physics.enabled?!n.visible:!n.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(t,e,{fromCreate:!0,dynamic:this.data.dynamic}),"Collision"===this.data.destroy&&(t.rigidBody?.collider(0).setActiveEvents(1),t.userData.hasCollisionDestroy=!0),t.matrixWorld.decompose(_U,SU,AU),i.applyQuaternion(SU),this.data.velocity.some(t=>0!==t)&&this.data.dynamic&&t.rigidBody?.setLinvel(i.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in t.object&&this.controlsManager.addBoundsTree(t),this.data.velocity.some(t=>0!==t)&&this.data.dynamic&&(t.userData.velocity=i)),!0===e.dataPatched.physics?.fusedBody))return!0};let s=this.page.scene.find(this.data.object);if(!s)throw new Error("Missing Property");if(this.object=s,"world"!==this.data.coordinateSystem&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");bU(i)}dispose(){null!==this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(t=>window.clearTimeout(t)),this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[]}},CU=.02;new be;var EU=new be,PU=new be,TU=new be,DU=new be,IU=new be,OU=new be,RU=new Ze,LU=new Ze,BU=new Ze;new Ze;var zU=new xe,FU=new xe,NU=new ai(0,0,0,"YXZ"),UU=new be(1,0,0),kU=new be(0,1,0),VU=new be(0,0,1),jU=new be(1,1,1);new Ve;var GU=new lh,WU=new _e,HU={type:"requestRender"},qU={type:"updateMatrix"},XU=Math.PI/6,YU=class extends Dt{constructor(t,e,i,n,r,s,a,o,l){super(),this.object=t,this.domElement=e,this.data=i,this.gloabalPhysics=n,this.controlsManager=r,this.cameraFollow=s,this.camera=a,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new Ze,this.target0=new be,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=200,this.euler0=new ai(0,0,0,"YXZ"),this.position0Cam=new be,this.quat0Cam=new xe,this.scale0Cam=new be,this.hiddenMatrix0Cam=new Ze,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new lh(new be(0,-40,0),new be(0,40,0)),matrix:new Ze,position:new be,rotation:new xe},this.euler=new ai(0,0,0,"YXZ"),this.eulerDelta=new be,this.lastPosition=new be,this.lastCameraQuaternion=new xe,this.lastCameraPosition=new be,this.PI_2=Math.PI/2,this.prevMouse=new Ht,this.velocityTarget=new be,this.velocity=new be,this.directionXZ=new be,this.rotVelocityStick=new be,this.rotVelocityTarget=new be,this.rotVelocity=new be,this.rotDirection=new be,this.nonColliderRotOffset=new Ze,this.nonColliderPosOffset=new Ze,this.firstPointerId=-1,this.rot=new be,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 Ze,this.objectToTarget=new be,this.objectToTarget0=new be,this.objectToCamXZ=new be,this.objectToCamXZ0=new be,this.targetToCamera=new be,this.targetToCamera0=new be,this.cameraPolarAxis0=new be,this.targetPos=new be,this.targetQuat=new xe,this.lerpFactorPos=(new be).setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new xe,this.objXZQuatInv=new xe,this.objXZRotMat=new Ze,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new be,this.pushedVelocity=new be,this.groundYRotation=0,this.objectRealQuat=new xe,this.colliderWorldQuat=new xe,this.groundNormal=new be,this.groundTilt=new xe,this.groundTiltInv=new xe,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new be,this.quaternion=new xe,this.scale=new be,this.initialAction=!0,this.onPointerDown=t=>{!(t.target===this.domElement||t.target instanceof HTMLElement&&"SPLINE-VIEWER"===t.target.tagName&&t.target.shadowRoot?.contains(this.domElement))||-1!==this.firstPointerId||(this.firstPointerId=t.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),"keys"!==this.rotBy&&!Vm&&!jm&&this.domElement.requestPointerLock(),this.prevMouse.set(t.clientX,t.clientY))},this.onPointerUp=t=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),"mouse"===t.pointerType&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=t=>{if(t.pointerId!==this.firstPointerId)return;let e=t.clientX-this.prevMouse.x,i=t.clientY-this.prevMouse.y;this.prevMouse.set(t.clientX,t.clientY),"mouse"===t.pointerType&&"keys"!==this.rotBy&&(jm&&Gm<15.5&&!Vm?(this.eulerDelta.y=-e*this.mouseOrbitSensitivity,this.eulerDelta.x=-i*this.mouseOrbitSensitivity):(this.eulerDelta.y=-t.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-t.movementY*this.mouseOrbitSensitivity)),"mouse"!==t.pointerType&&"drag"===this.rotByTouch&&(this.eulerDelta.y=-e*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-i*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=t=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?YU.isLocked=!0:YU.isLocked=!1},this.onPointerlockError=()=>{},this.handleVisibilityChange=()=>{if(document?.hidden)for(let t in this.movementState)this.movementState[t]=0},this.onKeyDown=t=>{!(t.target instanceof HTMLInputElement)&&("ArrowLeft"===t.code||"ArrowUp"===t.code||"ArrowRight"===t.code||"ArrowDown"===t.code||"
2Space"===t.code)&&t.preventDefault();for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]){this.movementState[e[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=t=>{for(let e of this.keyAssignments)if(t.key.toUpperCase()===e[1]||t.key===e[1]||t.code.slice(3,t.code.length).toUpperCase()===e[1]){this.movementState[e[0]]=0;break}},this.copyVRGamePadValues=(t,e)=>{for(let i=2;i<4;i++){let n=t.axes[i];0===e?2===i?this.movementState.movePosX=n:this.movementState.movePosZ=n:(t.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,2===i?(Math.abs(this.movementState.rotPosY)<.3&&Math.abs(n)>=.3&&(this.vrEulerYOffset+=n<0?1:-1),this.movementState.rotPosY=n):"fly"===this.moveMode&&(this.movementState.moveNegY=n))}},this.sharedGameControlGlobals=r.sharedGameControlGlobals,t===a&&(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 h=this.euler0.clone(),c=h.y;if(this.objectRealQuat.copy(this.quaternion),h.y=0,this.quaternion.setFromEuler(h),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),h.set(0,c,0),this.quaternion.setFromEuler(h),this.rot.setFromEuler(h),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||!0===this.cameraFollow)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),!0===this.cameraFollow){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 t,e,i=new be(0,0,-1).applyQuaternion(this.camera.quaternion),n=(new be).subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(n),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ),Math.abs(i.y)<1e-6?(n.y=0,i.y=0,e=n.projectOnVector(i)):e=n.y/i.y>0?i.multiplyScalar(n.y/i.y):i.multiplyScalar(n.length()),this.targetToCamera0.copy(e).negate(),t=this.camera.position.clone().add(e),this.objectToTarget0.subVectors(t,this.position);let r=(new ai).setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-r.x,r.x=0,r.z=0,r.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(r)}if(this.object instanceof UI&&(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=1*(i.speedTranslate??250),this.speedOrbit=.025*(i.speedRotate??100),this.mouseOrbitSensitivity=16e-6*(i.speedRotate??100),this.keyAssignments=i.keyAssignments.map(t=>{let e=[t[0],t[1]];return"▲"===e[1]?e[1]="ArrowUp":"◀"===e[1]?e[1]="ArrowLeft":"▼"===e[1]?e[1]="ArrowDown":"▶"===e[1]?e[1]="ArrowRight":"⇧"===e[1]?e[1]="Shift":"↵"===e[1]?e[1]="Enter":"Space"===e[1]?e[1]=" ":"⌘"===e[1]?e[1]="Meta":"Ctrl"===e[1]?e[1]="Control":"Esc"===e[1]&&(e[1]="Escape"),e}),"mouse"===i.rotBy){let t;t=this.keyAssignments.findIndex(t=>"rotNegX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosX"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotPosY"===t[0]),-1!==t&&(this.keyAssignments[t][1]=""),t=this.keyAssignments.findIndex(t=>"rotNegY"===t[0]),-1!==t&&(this.keyAssignments[t][1]="")}this.lerpFactorPosStart=1-.02**(1/(60*(i.delayPos[0]??.3))),this.lerpFactorPosEnd=1-.02**(1/(60*(i.delayPos[1]??.3))),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/(60*(i.delayRot[0]??.3))),this.lerpFactorRotEnd=1-.02**(1/(60*(i.delayRot[1]??.3))),this.lerpFactorPosCamera=1-.02**(1/(60*(i.delayPosCamera??.3))),this.lerpFactorRotCamera=1-.02**(1/(60*(i.delayRotCamera??.3))),this.gravity=12*(this.gloabalPhysics.gravity??tb.defaultData.gravity),this.usePhysics=this.gloabalPhysics.usePhysics??tb.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.autoOr
vendor: 4,620 bytes, line 2
2ientMove?i.orientMode:"none",this.orientWith=i.orientWith??zb.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=i.collider.height*CU/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*CU/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*.3/this.pixelsPerMeter,this.colliderHeight=2*i.collider.radius):(this.offset=i.collider.height*CU/this.pixelsPerMeter,this.stepThresh=.3*i.collider.height/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=(new be).fromArray(i.collider.position),u=(new xe).setFromEuler((new ai).fromArray([...i.collider.rotation,"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,jU),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 p=2*i.navmesh.destinationHelperRadius;if(p>0){let t=new wg;t.push({fi:0,data:{...Bx.defaultData("light","phong"),alpha:0},id:"layer1"}),t.push({fi:0,data:{...Bx.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let e=new zT({layers:t},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new cn(P_.create({parameters:{width:p,height:p/10,hollow:.7}}),e),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(t=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),t){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 t=(new ai).setFromQuaternion(this.quaternion,"YXZ"),e=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,e,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof UI?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 t=this.data,e=this.sharedAssets;void 0!==t.gameActions&&(this.actions={},Bb.list.forEach(i=>
vendor: 1,275 bytes, line 2
2{this.actions[i]=pU({...t,disabled:!1,type:"GameControl"},t.gameActions[i],this.page,e,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"),fU(this.actions.idle),fU(this.actions.move),fU(this.actions.run),fU(this.actions.jump)}dispatchStartEvent(t){void 0!==this.actions[t]&&(this.actionState[t]||(this.actionState[t]=!0,this.actions[t].Transition.forEach(t=>{t.play()}),this.actions[t].Animation.forEach(t=>{t.play(!1===this.initialAction)}),this.actions[t].Create.forEach(t=>{t.dispatchStart()}),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(t){void 0!==this.actions[t]&&(!this.actionState[t]||(this.actionState[t]=!1,this.actions[t].Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[t].Create.forEach(t=>{t.dispatchStop()}
vendor: 15,188 bytes, line 2
2),this.actions[t].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[t].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return DU.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(t,e,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 n=(this.isFirstFrame?16.6:t)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let r=60*n,s=!1;if(this.usePhysics&&this.collisionEnabled){let t=IU.set(0,(0===this.velocity.y?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/120,1)*(this.gravity>0?1:-1):this.velocity.y)*n,0).divideScalar(this.pixelsPerMeter),e=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,1,!1,16,void 0,void 0,this.object.rigidBody);if(e){this.onObject=!0,this.groundNormal.set(e.normal2.x,e.normal2.y,e.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(s=!0),0===e.collider.parent()?.bodyType()&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let t=e.collider.parent();this.groundYRotation=0,this.groundVelocity.set(0,0,0);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim)if(e.rigidBody===t&&e.userData.isFollowingObj!==this.object.uuid){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(DU,FU,IU),this.groundVelocity.subVectors(DU,e.prevT),this.object.getWorldPosition(IU).add(this.collider.position).sub(DU),this.groundYRotation=NU.setFromQuaternion(FU).y-e.prevR.y,OU.copy(IU).applyAxisAngle(kU,this.groundYRotation),this.groundVelocity.add(OU.sub(IU)).divideScalar(n);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*r),"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 t=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 e=DU.subVectors(this.path[1],this.position),i=IU.subVectors(this.path[1],this.path[0]);e.dot(i)<0?this.path.shift():(this.directionXZ.x=i.x,this.directionXZ.z=i.z),t.opacity=t.userData.opacity0}else t.opacity-=.05*t.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)**r),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**r),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**r)):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&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let a=TU.copy(this.velocity);if("none"!==this.orientMode&&!1===this.isFirstPerson){let t=IU.copy(a);t.y=0,a.set(0,a.y,t.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){let t=DU;this.camera.getWorldDirection(t);let e=OU.copy(kU).multiplyScalar(t.dot(kU));t.sub(e);let i=IU.copy(this.directionXZ);i.x*=-1,this.rot.y=t.angleTo(i)*(t.cross(i).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(NU.setFromVector3(this.rot),"walk"===this.moveMode&&(NU.x=0),a.applyEuler(NU),s&&(FU.setFromUnitVectors(kU,this.groundNormal),a.applyQuaternion(FU)),i){let t=NU.set(0,this.vrEulerYOffset*XU,0);i.applyEuler(t),a.x+=i.x,a.z+=i.z,this.nonColliderPosOffset.elements[13]+=i.y*n}if(!0===this.usePhysics){let t=IU;this.pushedVelocity.set(0,0,0);for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim){let i=OU.setFromMatrixPosition(e.matrixWorld).sub(e.prevT).divideScalar(n).divideScalar(this.pixelsPerMeter),r=e.rigidBody.collider(0).castCollider(i,this.object.rigidBody.collider(0),DU.copy(a).divideScalar(this.pixelsPerMeter),n,!1);i.multiplyScalar(this.pixelsPerMeter);let s=r_.is(e)?e:e.object;if(null!==r&&this.lastHitObj!==s){let t;e instanceof o_&&(t=e);let i=this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid];if(i)for(let e of i)"character"===e.data.target&&(e.dispatch(t),s.dispatchEvent(yj));this.lastHitObj=s}if(null!==r){this.pushedVelocity.copy(i),t.copy(r.normal1).applyQuaternion(e.quaternion);break}}if(0!==this.pushedVelocity.manhattanLength()){let e=t.dot(a);e<0&&a.addScaledVector(t,-e),a.add(this.pushedVelocity)}else a.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(n),this.rotVelocityStick),0===this.rotVelocityTarget.manhattanLength()?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**r):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**r),this.euler.x+=this.rotVelocity.x*n,this.euler.y+=this.rotVelocity.y*n+this.groundYRotation,0===this.rotVelocityTarget.y&&0===this.directionXZ.manhattanLength()?this.rotationAccumWhenOrientWithCamera=0:(!1===this.cameraFollow||"Locked"===this.cameraYAxis)&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*n),!1===this.isFirstPerson&&"none"!==this.orientMode&&this.directionXZ.manhattanLength()>0){if("radial"===this.orientMode){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(kU,this.euler.y-this.euler0.y);let t=IU.copy(this.objectToCamXZ).normalize(),e=OU.copy(a).multiplyScalar(n);e.y=0;let i=e.sub(DU.copy(t).multiplyScalar(e.dot(t))).cross(t).y;this.euler.y-=Math.atan2(i,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*n+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=Wt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Wt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):"Limit"===this.cameraXAxis&&(this.euler.x=Wt.clamp(this.euler.x,-this.PI_2,this.PI_2))),"fly"===this.moveMode?this.rot.x=this.euler.x:this.isFirstPerson&&(e?(NU.copy(e),NU.y=0):(NU.copy(this.euler),NU.y=0),this.nonColliderRotOffset.makeRotationFromEuler(NU)),e&&("walk"===this.moveMode?(this.rot.y=e.y,this.rot.x=0,this.rot.z=0):this.rot.setFromEuler(e),this.rot.y+=this.vrEulerYOffset*XU),zU.setFromAxisAngle(UU,this.rot.x),FU.setFromAxisAngle(kU,this.rot.y),FU.multiply(zU),zU.setFromAxisAngle(VU,this.rot.z),FU.multiply(zU),this.quaternion.copy(FU),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics){let t=IU.copy(a).multiplyScalar(n/this.pixelsPerMeter),e=null;this.didHit=!1;let i=new be;for(let n=0;n<5;n++){let r=t.length(),s=OU.copy(t).normalize();if(e=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(i),this.colliderWorldQuat,s,this.object.rigidBody?.collider(0).shape,r,!1,24,void 0,void 0,this.object.rigidBody),null===e){0===n&&0!==this.directionXZ.manhattanLength()&&(this.lastHitObj=null),i.add(t);break}{this.didHit=!0;let a=this.sharedGameControlGlobals.colliderToEntity.get(e.collider.handle);if(a!==this.lastHitObj&&0===n){this.lastHitObj=a;let t=this.sharedGameControlGlobals.entityToCollisionEvents[a?.uuid];if(t)for(let i of t)if("character"===i.data.target){let t,n=(this.sharedGameControlGlobals.rapierWorld?.getCollider(e.collider.handle))._parent;if(a.cloner)for(let e of a.cloner.children)if(e.rigidBody===n){t=e;break}i.dispatch(t),a.dispatchEvent(yj)}}let o=EU.set(e.normal2.x,e.normal2.y,e.normal2.z).applyQuaternion(this.colliderWorldQuat),l=PU.copy(s).multiplyScalar(e.toi).dot(o),h=e.toi;if(0===h&&(this.position.y+=this.offset*this.pixelsPerMeter),l>this.offset&&(h=e.toi*(l-this.offset)/l,i.addScaledVector(s,h)),t.copy(s).multiplyScalar(r-h),Math.acos(-o.y)>this.slopeThresh){let n=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(i),r=OU.copy(e.witness2).applyQuaternion(this.colliderWorldQuat);r.y=0;let s=n.add(r);s.y+=this.stepThresh;let a=this.sharedGameControlGlobals.rapierWorld.castShape(s,this.colliderWorldQuat,t,this.object.rigidBody?.collider(0).shape,1,!1,24,void 0,void 0,this.object.rigidBody);null!==a&&0===a.toi&&(o.y=0,o.normalize())}t.addScaledVector(o,-t.dot(o))}}this.position.addScaledVector(i,this.pixelsPerMeter),this.object.rigidBody?.setTranslation(DU.copy(this.position).divideScalar(this.pixelsPerMeter),!0),this.object.rigidBody?.setRotation(zU.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat),!0)}else{let t=this.onObject?1:5,e=a.multiplyScalar(n/t);for(let i=0;i<t;i++)this.position.add(e),this.collisionAdjustment(n/t)}else this.position.addScaledVector(a,n);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 t=this.objectToTarget.add(this.position),e=this.targetToCamera.add(t);RU.lookAt(e,t,kU).setPosition(e),RU.decompose(this.targetPos,this.targetQuat,DU),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**r),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**r),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),"Limit"===this.cameraYAxis&&"cartesian"===this.orientMode&&(this.euler.y=Wt.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Wt.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(qU),(!(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(HU),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let t,e=zU.setFromAxisAngle(kU,"Limit"===this.cameraYAxis&&"radial"!==this.orientMode?Wt.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(e),t="Limit"===this.cameraXAxis?Wt.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):Wt.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=DU.copy(this.cameraPolarAxis0);("Locked"!==this.cameraYAxis||"radial"===this.orientMode)&&i.applyQuaternion(e);let n=FU.setFromAxisAngle(i,t);"Locked"!==this.cameraYAxis&&this.targetToCamera.applyQuaternion(e),"Locked"!==this.cameraXAxis&&this.targetToCamera.applyQuaternion(n)}groundTiltAdjustment(t){180*kU.angleTo(t)/Math.PI<15||180*kU.angleTo(t)/Math.PI>85?zU.identity():zU.setFromUnitVectors(kU,t),this.groundTilt.slerp(zU,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(t){let e=PU.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);
vendor: 1,050 bytes, line 2
2let i=RU.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(DU,zU,IU).compose(DU,zU,jU);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(t=>{if(t===this.object||t.isDescendantOf(this.object))return;WU.makeEmpty(),t.updateMatrixWorldSVD();let n=t.matrixWorldRigid,r=LU.copy(n).invert(),s=BU.copy(LU).multiply(i);GU.copy(this.collider.segment),GU.start.applyMatrix4(s),GU.end.applyMatrix4(s);let a=EU.copy(this.position).applyMatrix4(r);WU.expandByPoint(GU.start),WU.expandByPoint(GU.end),WU.min.addScalar(-this.collider.radius),WU.max.addScalar(this.collider.radius),t.bvhGeometry.boundsTree.shapecast({traverseBoundsOrder:t=>t.distanceToPoint(GU.end),intersectsBounds:t=>t.intersectsBox(WU),intersectsTriangle:t=>{let i=DU,r=IU,s=t.closestPointToSegment(GU,i,r);if(s<this.collider.radius){let t=this.collider.radius-s,o=r.sub(i).normalize(),l=OU.copy(a);l.addScaledVector(o,t);let h=l.applyMatrix4(n).sub(this.position);e.add(h),GU.start.addScaledVector(o,t),GU.end.addScaledVector(o,t)}}})}
2),WU.makeEmpty(),GU.copy(this.collider.segment),GU.start.applyMatrix4(i),GU.end.applyMatrix4(i),WU.expandByPoint(GU.start),WU.expandByPoint(GU.end),WU.min.addScalar(-this.collider.radius),WU.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({traverseBoundsOrder:t=>t.distanceToPoint(GU.end),intersectsBounds:t=>t.intersectsBox(WU),intersectsTriangle:t=>{let i=DU,n=IU,r=t.closestPointToSegment(GU,i,n);if(r<this.collider.radius){let t=this.collider.radius-r,s=n.sub(i).normalize();this.alignToGround&&this.groundTiltAdjustment(s),e.addScaledVector(s,t),GU.start.addScaledVector(s,t),GU.end.addScaledVector(s,t)}}}),this.onObject=Math.abs(e.y)>Math.abs(t*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let n=Math.max(0,e.length()-1e-5);e.normalize().multiplyScalar(n),this.position.add(e)}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()}},QU=YU;QU.isLocked=!1;var ZU=h(u());function KU(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,n=e[4]**2+e[5]**2+e[6]**2,r=e[8]**2+e[9]**2+e[10]**2,s=e[0]**2+e[4]**2+e[8]**2,a=e[1]**2+e[5]**2+e[9]**2,o=e[2]**2+e[6]**2+e[10]**2,l=1e-8;return i<l||n<l||r<l||s<l||a<l||o<l}function JU(t,e){let i=new Qi;if(e&&KU(e))return i.setAttribute("position",new Vi([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new Vi([],3)),i.setIndex([]),i;let{positions:n,triIndices:r}=_C(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new Vi(n,3)),i.setIndex(r),e&&i.applyMatrix4(e),i}var $U=new Ze,tk=new Ze,ek=[[0,0,0],[0,0,0],[0,0,0]];function ik(t){let e=t.elements;ek[0][0]=e[0],ek[0][1]=e[4],ek[0][2]=e[8],ek[1][0]=e[1],ek[1][1]=e[5],ek[1][2]=e[9],ek[2][0]=e[2],ek[2][1]=e[6],ek[2][2]=e[10];let{u:i,v:n}=(0,ZU.SVD)(ek),r=$U.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),s=tk.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1);return r.multiply(s.transpose())}var nk=class extends th{constructor(){super(),this.layers.enable(3),this.layers.enable(8),this.layers.enable(9)}setFromCamera(t,e){e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):e.isPerspectiveCamera&&(this.ray.origin.set(t.x,t.y,-1).unproject(e),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e)}intersectVisibleObjects(t,e=!0,i=[]){return t.forEach(t=>{t.visible&&this.intersectObject(t,e,i)}),i}createRaycastLineHelper(){let t=new Ea({color:65280,linewidth:10}),e=new be(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new be(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,r=(new be).addVectors(e,i.multiplyScalar(n)),s=new Qi;return s.setFromPoints([e,r]),new Ra(s,t)}},rk=t=>t instanceof tO||t instanceof bB;function sk(t,e){return t.distance-e.distance}function ak(t,e,i){if(S_(e)&&e.visible){qI(e)&&e.raycast(t,i);for(let n of e.children)ak(t,n,i)}}function ok(t,e,i,n=!1){if(!n&&!i.some(e=>void 0!==ck(t,e)))return[];let r=[];return e.children.forEach(e=>ak(t,e,r)),r.sort(sk),r}function lk(t){let e=[];
vendor: 4,227 bytes, line 2
2if(t.length){let i=t[0].object;S_(i)&&e.push(i);let n=i.parent;for(;n;)rk(n)&&e.push(n),n=n.parent}return e}function hk(t,e,i,n){let r=t.frame;if(r){let t=e[0]*r.width,s=(1-e[1])*r.height;for(let e of i){let i=e===r.uuid?r:r.find(e);if(i?.intersects(t,s))return n(i),!0}}return!1}function ck(t,e){if(qI(e)){if(e.visible){let i=[];return e.raycast(t,i),i.length?i[0]:void 0}}else if(rk(e))return dk(t,e)}function dk(t,e){if(S_(e)&&e.visible){if(qI(e)){let i=[];if(e.raycast(t,i),i.length)return i[0]}for(let i of e.children){let e=dk(t,i);if(e)return e}}}var uk=class{constructor(t,e,i,n,r,s,a,o){this.renderer=t,this.publish=e,this.scene=i,this.getCamera=n,this.sharedAssets=r,this.requestRender=s,this.isExport=a,this.frame=o,this.raycaster=new nk,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents="window"===e.mouseEventTarget,this.domElement=t.domElement,this.eventElement=this._useWindowEvents?window:t.domElement,this._domRect=this.domElement.getBoundingClientRect()}get stopRaycast(){return this.publish.stopRaycast}get page(){return this.scene.activePage}set useWindowEvents(t){this._useWindowEvents=t,this.eventElement=t?window:this.renderer.domElement}get useWindowEvents(){return this._useWindowEvents}set domRect(t){this._domRect=t}get domRect(){return this._domRect}updateRaycaster(t){let{pageX:e,pageY:i}=t.touches?.length>0?t.touches[0]:t;this.pointerWorld=function(t,e,i){return{x:(t-(i.left+window.scrollX))/i.width*2-1,y:-(e-(i.top+window.scrollY))/i.height*2+1}}(e,i,this._domRect),this.pointerScreen=function(t,e,i){return{x:(t-(i.left+window.scrollX))/i.width,y:1-(e-(i.top+window.scrollY))/i.height}}(e,i,this._domRect),this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}},pk=class{constructor(t){this.eventContext=t,this.domEventsNeeded=new Set,this.hasVideoAction=!1}connect(){}disconnect(){}},fk=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],mk=t=>fk.find(([e,i])=>i===t)?.[0],gk=t=>fk.find(([e])=>e===t)?.[1],vk=(t,e)=>{let i=mk(t);if(i){let t=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(t,"target",{writable:!1,value:e}),t}},yk=class extends pk{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=t=>{if(!t.eventName||!t.target||"Scroll"===t.eventName)return;let e=this.splineEvents[mk(t.eventName)]?.[t.target.uuid];if(!e)return;"Scroll"===t.eventName&&void 0!==t.deltaY&&Object.assign(e,{deltaY:t.deltaY});let{domElement:i}=this.eventContext;i.dispatchEvent(e)}}connect(){let{page:t}=this.eventContext;t.traverseEntity(t=>{if(t.data?.events.length)for(let[e,i]of fk)if(t.data.events.some(t=>t.data.type===i&&!t.data.disabled)){this.objectsPerEvents.has(e)?this.objectsPerEvents.get(e)?.push(t):this.objectsPerEvents.set(e,[t]);let n={id:t.uuid,name:t.name},r=vk(i,n),s=this.splineEvents[e];s?s[t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}),this.objectsPerEvents.forEach(t=>{t.forEach(t=>{t.addEventListener("beginEvent",this.onBeginEvent)})})}disconnect(){this.objectsPerEvents.forEach(t=>{t.forEach(t=>{t.removeEventListener("beginEvent",this.onBeginEvent)})})}},xk=class{constructor(t,e,i,n,r,s){if(this.id=t,this.data=e,this.object=i,this.entered=!1,("KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type)&&!e.key)throw new Error("Missing property");this.actions=pU(e,e.actions,n,r,s,i)}disconnect(){fU(this.actions)}dispatchHeld(t){this.actions.Create.forEach(e=>{t&&e.dispatchThrottled.cancel(),e.dispatchThrottled()})}dispatch(t=!1){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatchStart())):(this.actions.Transition.some(t=>t.playing&&"Toggle"!==t.data.runMode)||this.actions.Transition.forEach(t=>
vendor: 2,041 bytes, line 2
2{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.SwitchCamera.some(t=>t.playing&&"Toggle"!==t.data.runMode)||this.actions.SwitchCamera.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()})),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),!1===t&&this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Particles.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent()),this.actions.Create.forEach(t=>t.dispatchStop()))}dispatchUserEvent(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),t?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}
vendor: 5,722 bytes, line 2
2),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},bk=class extends pk{constructor(t,e,i){super(t),this.eventManager=e,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=t=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(t);let{raycaster:e,page:i}=this.eventContext,n=ok(e,i,[],!0);this.sceneInterects=n,n.length&&(this.eventContext.sharedAssets.raycastProperty={x:n[0].point.x,y:n[0].point.y,z:n[0].point.z,objX:n[0].object.matrixWorld.elements[12],objY:n[0].object.matrixWorld.elements[13],objZ:n[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=t=>{(t.target===this.eventContext.domElement||"SPLINE-VIEWER"===t.target.tagName)&&this.canvasMouseEvents.forEach(e=>{("MouseDown"===e.data.type||"MousePress"===e.data.type)&&(this.onCanvasRaycast(t),e.dispatch())})},this.onCanvasMouseUp=t=>{(t.target===this.eventContext.domElement||"SPLINE-VIEWER"===t.target.tagName)&&this.canvasMouseEvents.forEach(e=>{"MouseUp"===e.data.type?(this.onCanvasRaycast(t),e.dispatch()):"MousePress"===e.data.type&&e.dispatchRelease()})},this.onMouseDown=t=>{Xm.length>1||(this.eventContext.updateRaycaster(t),this.handleMouseEvent("MouseDown"))},this.onMouseUp=t=>{Xm.length>1||(this.eventContext.updateRaycaster(t),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=t=>{Xm.length>1||(this.eventContext.updateRaycaster(t),this.handleMousePressEvent())},this.onMousePressRelease=t=>{Xm.length>1||(this.eventContext.updateRaycaster(t),this.handleMousePressEvent(!0))},this.onKeyDown=t=>{this.heldKeys[t.key]||(this.handleKeyEvent(t,"KeyDown"),this.handleKeyEventHeld(t,"KeyDown",!0)),this.heldKeys[t.key]=!0},this.onKeyUp=t=>{this.handleKeyEvent(t,"KeyUp"),this.handleKeyEventHeld(t,"KeyUp",!0)},this.onKeyPressDown=t=>{this.heldKeysPress[t.key]?this.handleKeyEventHeld(t,"KeyPress"):(this.handleKeyEvent(t,"KeyPress"),this.handleKeyEventHeld(t,"KeyPress",!0)),this.heldKeysPress[t.key]=!0},this.onKeyPressUp=t=>{this.handleKeyEvent(t,"KeyPress",!0)},this.releaseHeldKey=t=>{delete this.heldKeys[t.key]},this.releaseHeldKeyPress=t=>{delete this.heldKeysPress[t.key]},this._onUserEvent=({eventName:t,target:e,reverse:i})=>{if(!t||!e)return;let n=gk(t);n&&("MouseDown"===n||"MouseUp"===n||"MousePress"===n?(e.dispatchEvent({type:"beginEvent",eventName:n}),this.eventsPerObjects[n]?.[e.uuid]?.forEach(t=>{t.dispatchUserEvent(i)})):("KeyDown"===n||"KeyUp"===n||"KeyPress"===n)&&(e.dispatchEvent({type:"beginEvent",eventName:n}),this.eventsPerObjects[n]?.[e.uuid]?.forEach(t=>{t.dispatchUserEvent()})))}}connect(){let{page:t,sharedAssets:e,domElement:i}=this.eventContext,n=(i,n)=>{if(!i.data?.events.length)return;let r=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let s of r){let r=this.eventsPerObjects[s];if(i.data.events.filter(({data:t})=>t.type===s&&!0!==t.disabled).forEach(({id:n,data:s})=>{try{let a=new xk(n,s,i,t,e,this.eventManager);a.actions.Video.length&&(this.hasVideoAction=!0),"MouseDown"!==s.type&&"MouseUp"!==s.type&&"MousePress"!==s.type||"Canvas"!==s.mode&&"Window"!==s.mode?(r[i.uuid]?r[i.uuid].some(t=>t.id===a.id)||r[i.uuid].push(a):r[i.uuid]=[a],i instanceof XB&&i.traverseChildren(t=>{if(!t.visible)return!0;t instanceof ID&&2!==t.data.geometry.shapeBlendNode?.operation&&(r[t.uuid]?r[t.uuid].push(a):r[t.uuid]=[a])})):this.canvasMouseEvents.push(a)}catch(a){}}),r[i.uuid]?.length&&(this.objectsPerTypes[s].push(i instanceof bL&&("MouseDown"===s||"MouseUp"===s||"MousePress"===s)?n:i),i instanceof XB)){let t=this.objectsPerTypes[s];i.traverseChildren(e=>{if(!e.visible)return!0;e instanceof ID&&-1===t.indexOf(e)&&t.push(e)})}}};t.traverseEntity(t=>{(t instanceof MB||t instanceof mB)&&t.frame?.traverse(e=>{n(e,t)}),n(t)}),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).forEac
2h(([t,e])=>{e.forEach(t=>{t.addEventListener("userEvent",this._onUserEvent)})})}disconnect(){let{domElement:t}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},t.removeEventListener("pointerdown",this.onCanvasMouseDown),t.removeEventListener("pointerup",this.onCanvasMouseUp),t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("pointerdown",this.onMousePressDown),t.removeEventListener("pointerup",this.onMouseUp),t.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(t=>{Object.values(t).forEach(t=>{t.forEach(t=>{t.disconnect()})})}),this.canvasMouseEvents.forEach(t=>{t.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([t,e])=>{e.forEach(t=>{t.removeEventListener("userEvent",this._onUserEvent)})})}handleMouseEvent(t){let{stopRaycast:e,raycaster:i,page:n,pointerScreen:r}=this.eventContext,s=this.objectsPerTypes[t],a=s.filter(t=>!(t instanceof bL));if((s.length||this.useForRaycastProperty)&&(!n.uiCanvas||!hk(n,[r.x,r.y],Object.keys(this.eventsPerObjects[t]),e=>{this.handleObjectMouseEventDispatch(e,t)}))){if(e||this.useForRaycastProperty){let r;if(null===this.sceneInterects?r=ok(i,n,a,this.useForRaycastProperty):(r=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&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]}),e){let e=[r[0]?.uv?.x??0,r[0]?.uv?.y??0];lk(r).forEach(i=>{i instanceof MB&&hk(i,e,Object.keys(this.eventsPerObjects[t]),e=>{this.handleObjectMouseEventDispatch(e,t)}),this.eventsPerObjects[t][i.uuid]&&this.handleObjectMouseEventDispatch(i,t)})}}e||a.forEach(e=>{let n=ck(i,e);n&&(this.handleObjectMouseEventDispatch(e,t),e instanceof MB&&hk(e,[n?.uv?.x??0,n?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{this.handleObjectMouseEventDispatch(e,t)}))})}}handleMousePressEvent(t=!1){let e="MousePress",i=this.objectsPerTypes[e],n=i.filter(t=>!(t instanceof bL)),r=[];if(i.length){if(!t){let{stopRaycast:t,raycaster:i,page:s,pointerScreen:a}=this.eventContext,o=!1;if(s.uiCanvas&&(o=hk(s,[a.x,a.y],Object.keys(this.eventsPerObjects[e]),t=>{r.push(t)})),t&&!o){let t=ok(i,s,n);r=lk(t),t.forEach(t=>{t.object instanceof MB&&hk(t.object,[t?.uv?.x??0,t?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{r.push(t)})})}else n.forEach(t=>{let n=ck(i,t);n&&(r.push(t),t instanceof MB&&hk(t,[n?.uv?.x??0,n?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{r.push(t)}))})}this._prevObjects.length&&this._prevObjects.forEach(t=>{r.includes(t)||this.handleObjectMouseEventDispatchRelease(t,e)}),r.length&&r.forEach(t=>{this.handleObjectMouseEventDispatch(t,e)}),this._prevObjects=r}}handleObjectMouseEventDispatch(t,e){t.dispatchEvent({type:"beginEvent",eventName:e}),this.eventsPerObjects[e]?.[t.uuid]?.forEach(t=>{t.dispatch()})}handleObjectMouseEventDispatchRelease(t,e){t.dispatchEvent({type:"beginEvent",eventName:e}),this.eventsPerObjects[e]?.[t.uuid]?.forEach(t=>{t.dispatchRelease()})}handleKeyEvent(t,e,i=!1){this.objectsPerTypes[e].forEach(n=>{let r=this.eventsPerObjects[e][n.uuid];r.some(({data:e})=>"key"in e&&e.key===t.key)&&n.dispatchEvent({type:"beginEvent",eventName:e}),r.forEach(e=>{"key"in e.data&&e.data.key===t.key&&(i?e.dispatchRelease():e.dispatch(!0))})})}handleKeyEventHeld(t,e,i=!1){this.objectsPerTypes[e].forEach(n=>{this.eventsPerObjects[e][n.uuid].forEach(e=>{"key"in e.data&&e.data.key===t.key&&e.dispatchHeld(i)})})}},wk=new be,Sk=new be,_k=class{constructor(t,e,i,n,r){this.actionsIn=pU(t,t.inActions,i,n,r,e),this.actionsOut=pU(t,t.outActions,i,n,r,e)}disconnect(){fU(this.actionsIn),fU(this.actionsOut)}},Ak=class extends _k{constructor(t,e,i,n,r,s){super(e,i,n,r,s),this.id=t,this.data=e,this.object=i,this.stage="out",this.objects=[],this.onUpdateMatrixWorld=()=>{for(let n of this.objects)if(!n.visible)return;let t=wk.setFromMatrixPosition(this.objects[0].matrixWorld),e=Sk.setFromMatrixPosition(this.objects[1].matrixWorld),i=t.distanceTo(e)<=this.distance?"in":"out";if(this.stage!==i){this.stage=i;let t="in"===i?this.actionsIn:this.actionsOut;
vendor: 1,389 bytes, line 2
2t.Audio.forEach(t=>t.dispatchConditional()),t.Particles.forEach(t=>t.dispatchConditional()),t.Video.forEach(t=>t.dispatchConditional()),t.Link.forEach(t=>t.dispatch()),t.Create.forEach(t=>t.dispatch()),t.Destroy.forEach(t=>t.dispatch()),t.Reset.forEach(t=>t.dispatch()),t.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),t.Transition.forEach(t=>t.play()),t.Animation.forEach(t=>t.play()),t.SwitchCamera.forEach(t=>t.play()),t.SceneTransition.forEach(t=>t.dispatch()),t.SetVariable.forEach(t=>t.checkConditions()),t.SetVariable.forEach(t=>t.dispatch()),t.DynamicVariablePlay.forEach(t=>t.dispatch()),t.ClearLocalStorage.forEach(t=>t.dispatch()),t.UserAPI.forEach(t=>t.dispatch())}};let{distance:a,fromObject:o,toObject:l}=e.condition;this.distance=a;for(let h of[o,l]){if(!h)throw new Error("Missing property");let t=n.find(h);if(!t)throw new Error("Missing property");this.objects.push(t)}}connect(){window.setTimeout(()=>{this.objects.forEach(t=>{t.addEventListener("updateMatrixWorld",this.onUpdateMatrixWorld)}),this.onUpdateMatrixWorld()},0)}disconnect(){super.disconnect(),this.stage="out",this.objects.forEach(t=>{t.removeEventListener("updateMatrixWorld",this.onUpdateMatrixWorld)})}},Mk=class extends _k{constructor(t,e,i,n,r,s){super(e,i,n,r,s),this.id=t,this.data=e,this.object=i,this.onBegin=({target:t,state:e})=>
2{this.toState!==e&&(this.actionsOut.Audio.forEach(t=>t.dispatchConditional()),this.actionsOut.Particles.forEach(t=>t.dispatchConditional()),this.actionsOut.Video.forEach(t=>t.dispatchConditional()),this.actionsOut.Link.forEach(t=>t.dispatch()),this.actionsOut.Create.forEach(t=>t.dispatch()),this.actionsOut.Destroy.forEach(t=>t.dispatch()),this.actionsOut.Reset.forEach(t=>t.dispatch()),this.actionsIn.Transition.forEach(t=>t.pause()),this.object.currentTransitionEvent=this,this.actionsOut.Transition.forEach(t=>t.play()),this.actionsOut.Animation.forEach(t=>t.play()),this.actionsIn.SwitchCamera.forEach(t=>t.pause()),this.actionsOut.SwitchCamera.forEach(t=>t.play()),this.actionsOut.SceneTransition.forEach(t=>t.dispatch()),this.actionsOut.SetVariable.forEach(t=>t.checkConditions()),this.actionsOut.SetVariable.forEach(t=>t.dispatch()),this.actionsOut.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actionsOut.ClearLocalStorage.forEach(t=>t.dispatch()),this.actionsOut.UserAPI.forEach(t=>t.dispatch()))},this.onComplete=({target:t,state:e})=>
vendor: 8,712 bytes, line 2
2{this.toState===e&&(this.actionsIn.Audio.forEach(t=>t.dispatchConditional()),this.actionsIn.Particles.forEach(t=>t.dispatchConditional()),this.actionsIn.Video.forEach(t=>t.dispatchConditional()),this.actionsIn.Link.forEach(t=>t.dispatch()),this.actionsIn.Create.forEach(t=>t.dispatch()),this.actionsIn.Destroy.forEach(t=>t.dispatch()),this.actionsIn.Reset.forEach(t=>t.dispatch()),this.actionsOut.Transition.forEach(t=>t.pause()),this.actionsOut.Transition.forEach(t=>t.pause()),this.object.currentTransitionEvent=this,this.actionsIn.Transition.forEach(t=>t.play()),this.actionsIn.Animation.forEach(t=>t.play()),this.actionsOut.SwitchCamera.forEach(t=>t.pause()),this.actionsIn.SwitchCamera.forEach(t=>t.play()),this.actionsIn.SceneTransition.forEach(t=>t.dispatch()),this.actionsIn.SetVariable.forEach(t=>t.checkConditions()),this.actionsIn.SetVariable.forEach(t=>t.dispatch()),this.actionsIn.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actionsOut.ClearLocalStorage.forEach(t=>t.dispatch()),this.actionsOut.UserAPI.forEach(t=>t.dispatch()))};let{condition:a}=e;if(!a.object)throw new Error("Missing property");let o=n.find(a.object)??n.scene.find2D(a.object);if(!o)throw new Error("Missing property");if(this.toObject=o,a.state&&!this.toObject.states?.[a.state])throw new Error("Missing property");this.toState=a.state}connect(){lu(this.actionsOut).forEach(t=>{this.actionsOut[t]?.length&&this.toObject.addEventListener("beginState",this.onBegin)}),lu(this.actionsIn).forEach(t=>{this.actionsIn[t]?.length&&this.toObject.addEventListener("completeState",this.onComplete)})}disconnect(){super.disconnect(),lu(this.actionsOut).forEach(t=>{this.actionsIn[t]?.length&&this.toObject.removeEventListener("beginState",this.onBegin)}),lu(this.actionsIn).forEach(t=>{this.actionsIn[t]?.length&&this.toObject.removeEventListener("completeState",this.onComplete)})}},Ck=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.eventsPerConditions={Comparison:[],Distance:[],State:[]},this.hasVideoAction=!1}connect(){super.connect();let{page:t,sharedAssets:e}=this.eventContext;t.traverseEntity(i=>{if(i.data?.events.length)for(let{id:n,data:r}of i.data.events)if(!r.disabled&&"Conditional"===r.type)try{let s;"Comparison"===r.condition.type||("Distance"===r.condition.type?s=new Ak(n,r,i,t,e,this.eventManager):"State"===r.condition.type&&(s=new Mk(n,r,i,t,e,this.eventManager))),s&&(this.eventsPerConditions[r.condition.type].push(s),(s.actionsIn.Video.length||s.actionsOut.Video.length)&&(this.hasVideoAction=!0))}catch(Qy){}}),Object.values(this.eventsPerConditions).forEach(t=>t.forEach(t=>t.connect()))}disconnect(){super.disconnect(),Object.values(this.eventsPerConditions).forEach(t=>t.forEach(t=>t.disconnect()))}},Ek=new be,Pk=new be,Tk=new be,Dk=new En,Ik=new be,Ok=new be,Rk=new be,Lk=new xe,Bk=new ai,zk=new Ze,Fk=new qt,Nk=new be,Uk=new be,kk=.2;function Vk(t,e){!e||(e[0]<e[1]&&(t.x=Math.min(Math.max(t.x,e[0]),e[1])),e[2]<e[3]&&(t.y=Math.min(Math.max(t.y,e[2]),e[3])),e[4]<e[5]&&(t.z=Math.min(Math.max(t.z,e[4]),e[5])))}var jk=function(){let t=new Ze;return(e,i,n)=>{let r=e.obj;t.copy(r.hiddenMatrix),null!==r.parent&&t.premultiply(r.parent.matrixWorld),t.invert(),r.position.copy(i),"global"===e.reference&&Vk(r.position,e.limits),r.position.applyMatrix4(t),"parent"===e.reference?Vk(r.position,e.limits):"local"===e.reference&&(Lk.copy(e.quat0).invert(),r.position.sub(e.position0),r.position.applyQuaternion(Lk),Vk(r.position,e.limits),Lk.invert(),r.position.applyQuaternion(Lk),r.position.add(e.position0)),t.multiply(n??r.matrixWorld).decompose(Ik,r.quaternion,Ok),r.updateMatrix(),r.hasNonUniformScale&&(r.updateMatrixWorld(),r.updateMatrixWorldSVD()),r instanceof JC&&XI(r.parent)&&r.invalidateDownstreamBooleanData(!0)}}(),Gk=class{constructor(t,e,i,n,r,s,a){this.object=t,this.id=e,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=pU(i,i.dragDropActions.drag,n,r,s,this.object),this.actionsDrop=pU(i,i.dragDropActions.drop,n,r,s,this.object);let o=[];this.data.objects.forEach(t=>{let e=n.find(t);!e||!1!==e.data.visible&&(o.push(e),a[e.uuid]&&a[e.uuid].forEach(t=>{let e=n.find(t);!e||!1!==e.data.visible&&o.push(e)}))}),this.data.dropDestinations.forEach(t=>{let e=n.find(t);!e||!1!==e.data.visible&&(this.dropDestIds.push(e.uuid),a[e.uuid]&&a[e.uuid].forEach(t=>{let e=n.find(t);!e||!1!==e.data.visible&&this.dropDestIds.push(e.uuid)}))}),this.dragItems=o.map(t=>("locked"===this.data.planeMode&&(t.userData.lockedPlane=!0),t.userData.worldPosition0=(new be).setFromMatrixPosition(t.matrixWorld),{obj:t,fromPosition:(new be).setFromMatrixPosition(t.matrixWorld),pointStart:new be,pointEnd:new be,paused:!0,currentDampingFactor:this.data.dampingFactor,reset:!1,position0:(new be).copy(t.position),quat0:(new xe).copy(t.quaternion),snapped:!1,orientationMatrix:new Ze,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return null!==this.activeIdx?this.dragItems[this.activeIdx]:null}dispose(){fU(this.actionsDrag),fU(this.actionsDrop),this.dragItems.forEach(t=>{t.fromPosition.copy(t.obj.userData.worldPosition0),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart),t.obj.recursiveBBoxNeedsUpdate=!0,t.obj.userData.lockedPlane=void 0,t.obj.position.copy(t.position0),t.obj.quaternion.copy(t.quat0),t.obj.updateMatrix()})}},Wk=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.onPointerDown=t=>{if(Xm.length>1)return;this.eventContext.updateRaycaster(t);let{raycaster:e,page:i}=this.eventContext,n=i.raycastWithClones(e);if(this.lastDropDestination=null,0!==n.length){for(let t of this.events){let e=0;for(let{obj:i,pointEnd:r,pointStart:s}of t.dragItems){if(i===n[0].object||i===n[0].object.object||r_.is(i)&&i.isAncestorOf(n[0].object.uuid)){if(t.activeIdx=e,t.activeDragItem.reset=!1,t.activeDragItem.currentDampingFactor=t.data.dampingFactor,t.activeDragItem.snapped=!1,"hand"===t.data.cursor&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){t.activeDragItem.obj.rigidBody&&t.activeDragItem.obj.rigidBody.setBodyType(2,!0);let e=t.activeDragItem.obj;i.hasNonUniformScale&&i.updateMatrixWorldSVD(),(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(Ik,Lk,Ok),Bk.setFromQuaternion(Lk),void 0===e.prevR?(e.prevR=Bk.clone(),e.prevT=Ik.clone()):(e.prevR.copy(Bk),e.prevT.copy(Ik)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(t.activeDragItem.obj)}return this.calcPlaneIntersectPos(i,s,t.data.plane,t.data.referenceFrame),r.copy(s),(this.eventManager.controlsManager.usePhysics&&"dynamic"===i.data.physics?.rigidBody||!1===t.data.drop||!1===t.data.resetOnSnapFail)&&t.activeDragItem.fromPosition.setFromMatrixPosition(t.activeDragItem.obj.matrixWorld),this.activeEvent=t,void(this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1))}e++}}this.activeEvent=null}else this.activeEvent=null},this.onPointerMove=t=>{if(Xm.length>1)return;this.eventContext.updateRaycaster(t);let{raycaster:e,page:i}=this.eventContext,n=i.raycastWithClones(e);if(0===Xm.length){let t=!1;for(let e of this.events){for(let{obj:i}of e.dragItems)if(i===n[0]?.object||i===n[0]?.object?.object||r_.is(i)&&i.isAncestorOf(n[0]?.object.uuid)){switch(t=!0,e.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move")}break}if(t)break}return void(t||this.setCursor("default"))}if(this.activeEvent&&this.activeEvent.activeDragItem){let t,e=this.activeEvent.activeDragItem;if(e.snapped=!1,this.activeEvent.data.drop&&(t=n.filter(t=>e.obj!==t.object&&!e.obj.isAncestorOf(t.object.uuid)&&!(t.object instanceof tO)&&("all"===this.activeEvent.data.dropOn||this.activeEvent.dropDestIds.some(e=>e===t.object.uuid||i.scene.find(e).isAncestorOf(t.object.uuid))))[0]),t){let i=Rk.copy(t.face.normal).applyMatrix3(Fk.getNormalMatrix(t.object.matrixWorld));if("center"===this.activeEvent.data.snapTo)e.fromPosition.setFromMatrixPosition(t.object.matrixWorld);else if("surface"===this.activeEvent.data.snapTo){if(e.fromPosition.copy(t.point),"bbox"===this.activeEvent.data.snapSurfaceMode){Ik.copy(i).applyMatrix3(Fk.setFromMatrix4(e.obj.matrixWorld).transpose());let t=e.obj;Ik.x>kk?Ok.x=-t.recursiveBBox.min.x:Ik.x<-kk&&(Ok.x=-t.recursiveBBox.max.x),Ik.y>kk?Ok.y=-t.recursiveBBox.min.y:Ik.y<-kk&&(Ok.y=-t.recursiveBBox.max.y),Ik.z>kk?Ok.z=-t.recursiveBBox.min.z:Ik.z<-kk&&(Ok.z=-t.recursiveBBox.max.z),Ok.applyMatrix3(Fk.invert())}
vendor: 1,350 bytes, line 2
2else Ok.copy(i).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);e.fromPosition.add(Ok)}this.activeEvent.data.autoOrient&&(Ik.set(0,1,0).cross(i),Ik.length()<1e-4&&Ik.set(-1,0,0).cross(i),Ok.crossVectors(Rk,Ik),e.orientationMatrix.makeBasis(Ik,Ok,i)),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart),e.currentDampingFactor=this.activeEvent.snapDampingFactor,e.snapped=!0,this.lastDropDestination!==t.object&&(this.lastDropDestination=t.object,this.activeEvent.actionsDrop.Transition.forEach(t=>{t.play()}),this.activeEvent.actionsDrop.Animation.forEach(t=>{t.play()}),this.activeEvent.actionsDrop.Audio.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(t=>{t.dispatchThrottled()}))}else e.orientationMatrix.makeRotationFromQuaternion(e.quat0),this.lastDropDestination=null,e.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(e.obj,e.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),this.activeEvent.actionsDrop.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(t=>{t.stop()}
2),this.activeEvent.actionsDrop.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(t=>{t.dispatchGameControl("stop")});this.activeEvent.actionsDrag.Create.forEach(t=>{t.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(t=>t.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(t=>t.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(t=>t.dispatch()),!1===this.activeEvent.wasDragEventTriggered&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(t=>{t.play()}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.play()}),this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{!this.activeEvent||(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEac
vendor: 1,655 bytes, line 2
2h(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.stop()}))},500),this.updateDragItem(e),e.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=t=>{if(this.activeEvent&&this.activeEvent.activeDragItem){"hand"===this.activeEvent.data.cursor&&this.setCursor("grab");let t="dynamic"===this.activeEvent.activeDragItem.obj.data.physics?.rigidBody;!1===this.activeEvent.activeDragItem.snapped&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(!1===this.eventManager.controlsManager.usePhysics||!t)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&t&&(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(t=>{t.stop(),null!==t.object.currentState&&t.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(t=>{t.stop()}
vendor: 4,295 bytes, line 2
2),this.activeEvent.actionsDrag.Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(t=>{t.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(t=>t.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(t=>t.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(t=>t.dispatch())),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0)}}}connect(){let t={};if(this.eventContext.page.traverseEntity(e=>{e.component&&(t[e.component.uuid]?t[e.component.uuid].push(e.uuid):t[e.component.uuid]=[e.uuid])}),this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>"DragDrop"===t.data.type&&!t.data.disabled).forEach(i=>{this.events.push(new Gk(e,i.id,i.data,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager,t))})}),!this.events.length)return;this.domEventsNeeded.clear(),this.domEventsNeeded.add("pointerdown");let e=this.eventContext.domElement;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),this.domEventsNeeded.add("pointermove")}disconnect(){if(!this.events.length)return;this.domEventsNeeded.clear();let t=this.eventContext.domElement;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),this.events.forEach(t=>t.dispose())}setCursor(t){this.eventContext.domElement.style.cursor=t}onAnimationFrameDamping(){for(let t of this.events)for(let e of t.dragItems)e.paused||this.updateDragItem(e,!0)}calcPlaneIntersectPos(t,e,i,n){let{getCamera:r,raycaster:s}=this.eventContext;r().getWorldDirection(Pk),Pk.negate();let a=Lk.identity();switch("parent"===n?zk.multiplyMatrices(t.parent.matrixWorld,t.hiddenMatrix).decompose(Ik,a,Ok):"local"===n&&t.matrixWorld.decompose(Ik,a,Ok),i){case"x":Ik.set(1,0,0).applyQuaternion(a),Nk.copy(Pk).cross(Ik),Uk.copy(Ik).cross(Nk);break;case"y":Ik.set(0,1,0).applyQuaternion(a),Nk.copy(Pk).cross(Ik),Uk.copy(Ik).cross(Nk);break;case"z":Ik.set(0,0,1).applyQuaternion(a),Nk.copy(Pk).cross(Ik),Uk.copy(Ik).cross(Nk);break;case"xy":Uk.set(0,0,1).applyQuaternion(a);break;case"yz":Uk.set(1,0,0).applyQuaternion(a);break;case"xz":Uk.set(0,1,0).applyQuaternion(a);break;case"adaptive":Pk.angleTo(Ok.set(0,1,0))>Math.PI/6?(Ik.crossVectors(Ok.set(0,1,0),Pk),Uk.crossVectors(Ik,Ok)):Uk.set(0,1,0);break;default:Uk.copy(Pk)}Tk.setFromMatrixPosition(t.matrixWorld);let o=t.userData.lockedPlane?t.userData.worldPosition0:Tk;if(Dk.setFromNormalAndCoplanarPoint(Uk,o),s.ray.intersectPlane(Dk,e)&&("x"===i||"y"===i||"z"===i)){let t=Ok.subVectors(e,o).dot(Ik);e.copy(o).addScaledVector(Ik,t)}}updateDragItem(t,e=!1){Tk.setFromMatrixPosition(t.obj.matrixWorld),"current"===t.reset?Ek.subVectors(t.fromPosition,Tk).divideScalar(t.currentDampingFactor):"original"===t.reset?(Ek.subVectors(t.obj.userData.worldPosition0,Tk).divideScalar(t.currentDampingFactor),t.fromPosition.copy(t.obj.userData.worldPosition0),t.pointStart.copy(t.fromPosition),t.pointEnd.copy(t.pointStart)):Ek.subVectors(t.pointEnd,t.pointStart).add(t.fromPosition).sub(Tk).divideScalar(t.currentDampingFactor),t.paused=!(t.currentDampingFactor>1)||Ek.length()<.01,(this.activeEvent&&1===this.activeEvent.data.dampingFactor||e)&&jk(t,Ek.add(Tk),this.activeEvent?.data.drop&&this.activeEvent?.data.autoOrient?t.orientationMatrix:null),t.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}},Hk=new be,qk=new be,Xk=new be,Yk=new be,Qk=new En,Zk={type:"requestRender"},Kk=function(){let t=new be,e=new be;return(i,n,r)=>r>0?(t.subVectors(i,n),t.length()<=r?i:e.copy(n).add(t.normalize().multiplyScalar(r))):n}(),Jk=function(){let t=new Ze;return(e,i)=>{e.position.copy(i),null!==e.parent&&(t.copy(e.parent.matrixWorld).invert(),e.position.applyMatrix4(t)),t.copy(e.hiddenMatrix).invert(),e.position.applyMatrix4(t),e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),e instanceof JC&&XI(e.parent)&&e.invali
vendor: 9,710 bytes, line 2
2dateDownstreamBooleanData(!0)}}(),$k=class{constructor(t,e,i,n,r,s){this.data=t,this.id=e,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.snapComplete=!1,this.isReset=!1,this.worldPosition0=new be,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...Oy.defaultData,...t,...void 0===t.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===t.target||"cursor"===t.target||(this.target=n.find(t.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.resetDampingFactor=80/this.data.resetSpeed+1,this.object.getWorldPosition(this.worldPosition0),this.actions=pU(t,t.actions,n,r,s,i)}},tV=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=t=>{if(!(Xm.length>1)){this.eventContext.updateRaycaster(t);for(let t of this.events)void 0===t.target&&this.updateSingleEvent(t)}},this.onMouseEnter=t=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=t=>{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=t=>()=>{this.updateSingleEvent(t)}}connect(){let{page:t}=this.eventContext;if(t.traverseEntity(e=>{let i=e.data?.events.find(t=>"Follow"===t.data.type&&!t.data.disabled);i&&(!t.data.globalPhysics.usePhysics||"dynamic"!==e.dataPatched.physics?.rigidBody)&&this.events.push(new $k(i.data,i.id,e,t,this.eventContext.sharedAssets,this.eventManager))}),!this.events.length)return;let{domElement:e,eventElement:i}=this.eventContext;this.domEventsNeeded.clear(),Vm&&(this.domEventsNeeded.add("pointerdown"),e.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents||(e.addEventListener("pointerenter",this.onMouseEnter),e.addEventListener("pointerleave",this.onMouseLeave));for(let n of this.events)if(void 0!==n.target){let t=n.target,e=this.onTargetChange(n);this.pairOfEventListeners.push([t,e]),t.addEventListener("requestRender",e)}}disconnect(){if(!this.events.length)return;let{domElement:t,eventElement:e}=this.eventContext;this.domEventsNeeded.clear(),Vm&&t.removeEventListener("pointerdown",this.onMouseMove),e.removeEventListener("pointermove",this.onMouseMove),t.removeEventListener("pointerenter",this.onMouseEnter),t.removeEventListener("pointerleave",this.onMouseLeave);for(let[i,n]of this.pairOfEventListeners)i.removeEventListener("requestRender",n);for(let i of this.events)i.paused=!0,i.isReset=!1,fU(i.actions)}onAnimationFrameDamping(){for(let t of this.events)t.paused||this.updateSingleEvent(t,!0)}updateSingleEvent(t,e=!1){this.events.forEach(t=>{t.actions.Create.forEach(t=>{t.dispatchThrottled()})});let{plane:i,limitDistance:n,limitDistanceEnabled:r}=t.data;if(t.object.getWorldPosition(Xk),t.isReset)Yk.copy(t.worldPosition0);else if(t.target)t.target.getWorldPosition(Yk);else{let{getCamera:t,raycaster:e}=this.eventContext;if("custom"===i?(t().getWorldDirection(qk),qk.negate(),Hk.copy(qk)):"xy"===i?Hk.set(0,0,1):"xz"===i?Hk.set(0,1,0):"yz"===i&&Hk.set(1,0,0),Qk.setFromNormalAndCoplanarPoint(Hk,Xk),!e.ray.intersectPlane(Qk,Yk))return}if(!t.isReset)if(Yk.distanceTo(t.worldPosition0)>n&&r&&t.target){if(t.snapComplete=!1,t.data.snapDelay&&(t.delayFinished=!1,typeof window<"u"&&null!==t.timeoutId&&(window.clearTimeout(t.timeoutId),t.timeoutId=null)),t.wasOutside=!0,!t.data.resetAfterDistanceLimit)return;Yk.copy(t.worldPosition0),t.currentDampingFactor=t.resetDampingFactor}else if(t.wasOutside&&(t.data.snapDelay&&typeof window<"u"&&(t.timeoutId=window.setTimeout(()=>{t.delayFinished=!0,t.paused=!1,this.updateSingleEvent(t)},1e3*t.data.snapDelay)),t.currentDampingFactor=t.data.dampingFactor,t.wasOutside=!1),!1===t.delayFinished)return;!1===t.data.enabledTranslation[0]&&(Yk.x=Xk.x),!1===t.data.enabledTranslation[1]&&(Yk.y=Xk.y),!1===t.data.enabledTranslation[2]&&(Yk.z=Xk.z);let s=Kk(Xk,Yk,t.wasOutside?0:t.data.maxDelta);if(t.currentDampingFactor>1){let i=Hk.subVectors(s,Xk).divideScalar(t.currentDampingFactor);Xk.add(i),e&&Jk(t.object,Xk),t.paused=i.length()<.01}else Jk(t.object,s),t.paused=!0;t.object?.dispatchEvent({type:"beginEvent",eventName:"Follow"}),t.object.dispatchEvent(Zk)}},eV=new be,iV=new be,nV=new Ze,rV=new xe,sV=new xe,aV=new be,oV=new be,lV=new be,hV=new be,cV=new En,dV={type:"requestRender"},uV={type:"changeRotation"},pV=function(){let t=new Ze;return function(e,i){null!==e.parent?t.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix):t.copy(e.hiddenMatrix),i.premultiply(ik(t).invert()),e.rotation.setFromRotationMatrix(i),e.updateMatrix(),e instanceof JC&&XI(e.parent)&&e.invalidateDownstreamBooleanData(!0)}}(),fV=class{constructor(t,e,i,n){this.id=e,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new xe,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...Ry.defaultData,...t,...void 0===t.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===t.target||"cursor"===t.target||(this.target=n.find(t.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.object.getWorldQuaternion(this.worldQuaternion0),this.resetDampingFactor=80/this.data.resetSpeed+1}},mV=class extends pk{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=t=>{if(!(Xm.length>1)){this._lastMouseEvent=t,this.eventContext.updateRaycaster(t);for(let t of this.events)void 0===t.target&&this.updateSingleEvent(t)}},this.onMouseEnter=t=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=t=>{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=t=>{if(this._lastMouseEvent){let t=new PointerEvent("pointermove",{clientX:this._lastMouseEvent.clientX,clientY:this._lastMouseEvent.clientY,bubbles:!0,cancelable:!0,view:window});this.eventContext.eventElement.dispatchEvent(t)}},this.onTargetChange=t=>()=>{this.updateSingleEvent(t)},this.createUserEventListener=t=>({eventName:e,target:i})=>{if(!e||!i)return;let n=gk(e);n&&"LookAt"===n&&this.updateSingleEvent(t)}}connect(){let{page:t}=this.eventContext;if(t.traverseEntity(e=>{let i=e.data?.events.find(t=>"LookAt"===t.data.type&&!t.data.disabled);i&&(!t.data.globalPhysics.usePhysics||"dynamic"!==e.dataPatched.physics?.rigidBody)&&this.events.push(new fV(i.data,i.id,e,t))}),!this.events.length)return;let{domElement:e,eventElement:i}=this.eventContext;this.domEventsNeeded.clear(),Vm&&(this.domEventsNeeded.add("pointerdown"),e.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents?i.addEventListener("scroll",this.onScroll):(e.addEventListener("pointerenter",this.onMouseEnter),e.addEventListener("pointerleave",this.onMouseLeave));for(let n of this.events){if(void 0!==n.target){let t=this.onTargetChange(n),e=n.target;this.pairOfEventListeners.push([e,t]),e.addEventListener("requestRender",t)}let t=this.createUserEventListener(n),e=n.object;this.pairOfUserEventListeners.push([e,t]),e.addEventListener("userEvent",t)}}disconnect(){if(!this.events.length)return;let{domElement:t,eventElement:e}=this.eventContext;this.domEventsNeeded.clear(),Vm&&t.removeEventListener("pointerdown",this.onMouseMove),e.removeEventListener("pointermove",this.onMouseMove),t.removeEventListener("pointerenter",this.onMouseEnter),t.removeEventListener("pointerleave",this.onMouseLeave),e.removeEventListener("scroll",this.onScroll);for(let[i,n]of this.pairOfEventListeners)i.removeEventListener("requestRender",n);for(let[i,n]of this.pairOfUserEventListeners)i.removeEventListener("userEvent",n);for(let i of this.events)i.paused=!0,i.isReset=!1}onAnimationFrameDamping(){for(let t of this.events)t.paused||this.updateSingleEvent(t)}updateSingleEvent(t){let{tilt:e,axis:i,distance:n,plane:r,limitDistance:s,enabledRotation:a,limitDistanceEnabled:o}=t.data,{getCamera:l,raycaster:h}=this.eventContext,{object:c,target:d}=t;if(c.getWorldPosition(aV),!t.isReset)if(t.target)t.target.getWorldPosition(oV);else{if("custom"===r?(l().getWorldDirection(iV),iV.negate(),cV.setFromNormalAndCoplanarPoint(iV,aV)):("xy"===r?eV.set(0,0,1):"xz"===r?eV.set(0,1,0):"yz"===r&&eV.set(1,0,0),cV.setFromNormalAndCoplanarPoint(eV,aV)),!h.ray.intersectPlane(cV,oV))return;n>0&&("custom"===r||void 0===r)&&oV.addScaledVector(iV,n)}if(t.isReset||(d?"target"===e?lV.copy(d.up).applyMatrix4(nV.extractRotation(d.matrixWorld)).normalize():a.some(t=>!1===t)?("x"===i?(hV.set(0,0,1),!1===a[2]&&hV.set(0,1,0)):"y"===i?(hV.set(1,0,0),!1===a[0]&&hV.set(0,0,1)):(hV.set(0,1,0),!1===a[1]&&hV.set(1,0,0)),lV.copy(hV).applyQuaternion(t.worldQuaternion0).normalize()):lV.set(0,1,0):"custom"===r?lV.set(0,1,0):lV.copy(eV)),t.isReset)sV.copy(t.worldQuaternion0);else if(aV.distanceTo(oV)>s&&o&&d){if(t.data.snapDelay&&(t.delayFinished=!1,typeof window<"u"&&null!==t.timeoutId&&(window.clearTimeout(t.timeoutId),t.timeoutId=null)),t.wasOutside=!0,!t.data.resetAfterDistanceLimit)return;sV.copy(t.worldQuaternion0),t.currentDampingFactor=t.resetDampingFactor}else{if(t.wasOutside&&(t.data.snapDelay&&typeof window<"u"&&(t.timeoutId=window.setTimeout(()=>{t.delayFinished=!0,t.paused=!1,this.updateSingleEvent(t)},1e3*t.data.snapDelay)),t.currentDampingFactor=t.data.dampingFactor,t.wasOutside=!1),!1===t.delayFinished)return;
vendor: 14,942 bytes, line 2
2(function(t,e,i,n,r,s){let a=t.elements;yV.subVectors(e,i),0===yV.lengthSq()&&(yV.z=1),yV.normalize(),vV.crossVectors(n,yV),0===vV.lengthSq()&&(1===Math.abs(n.z)?yV.x+=1e-4:yV.z+=1e-4,yV.normalize(),vV.crossVectors(n,yV)),vV.normalize(),gV.crossVectors(yV,vV),"x"===r?1===s.z?[vV,gV,yV]=[yV,vV,gV]:(vV.negate(),[vV,yV]=[yV,vV]):"y"===r?1===s.x?[vV,gV,yV]=[gV,yV,vV]:(vV.negate(),[gV,yV]=[yV,gV]):1===s.x&&(vV.negate(),[vV,gV]=[gV,vV]),a[0]=vV.x,a[4]=gV.x,a[8]=yV.x,a[1]=vV.y,a[5]=gV.y,a[9]=yV.y,a[2]=vV.z,a[6]=gV.z,a[10]=yV.z})(nV,oV,aV,lV,i,hV),sV.setFromRotationMatrix(nV),rV.setFromUnitVectors(hV.applyQuaternion(sV),lV),a.some(t=>!1===t)&&"target"!==e&&sV.premultiply(rV).normalize()}t.currentDampingFactor>1?(c.updateWorldMatrix(!0,!1),rV.setFromRotationMatrix(ik(c.matrixWorld)),rV.slerp(sV,1/t.currentDampingFactor),pV(c,nV.makeRotationFromQuaternion(rV)),t.paused=8*(1-rV.dot(sV))<1e-6):(pV(c,nV.makeRotationFromQuaternion(sV)),t.paused=!0),t.object?.dispatchEvent({type:"beginEvent",eventName:"LookAt"}),c.dispatchEvent(dV),c.dispatchEvent(uV)}},gV=new be,vV=new be,yV=new be;var xV=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.entered=!1,this.actions=pU(e,e.actions,n,r,s,i)}disconnect(){fU(this.actions)}dispatchEnter(){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.entered||(this.entered=!0,this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.play()),this.actions.Create.forEach(t=>t.dispatchStart()),this.actions.Particles.forEach(t=>t.dispatchBasic()),this.actions.Destroy.forEach(t=>t.dispatch()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent()),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}dispatchLeave(){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.entered&&(this.entered=!1,this.actions.Create.forEach(t=>t.dispatchStop()),this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Particles.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent()))}dispatchUserEvent(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),t?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Particles.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatch()),this.actions.Particles.forEach(t=>t.dispatchBasic()),this.actions.Destroy.forEach(t=>t.dispatch()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},bV=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.eventsPerObjects={},this.objects=[],this.objects2D=[],this._prevObjects=[],this.onMouseDown=t=>{Xm.length>1||(this.eventContext.updateRaycaster(t),this.handleMouseHoverEvent())},this.onMouseUp=t=>{Xm.length>1||this.handleMouseHoverEvent(!0)},this.onMouseMove=t=>{Xm.length>1||(this.eventContext.updateRaycaster(t),this.handleMouseHoverEvent())},this.onUserEvent=({eventName:t,target:e,reverse:i})=>{if(!t||!e)return;let n=gk(t);n&&"MouseHover"===n&&(e.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[e.uuid]?.forEach(t=>t.dispatchUserEvent(i)))}}connect(){let{page:t,sharedAssets:e}=this.eventContext,i=(i,n)=>{if(i.visible&&i.data?.events.length){for(let{id:n,data:s}of i.data.events)if(!s.disabled&&"MouseHover"===s.type)try{let r=new xV(n,s,i,t,e,this.eventManager);this.eventsPerObjects[i.uuid]?this.eventsPerObjects[i.uuid].push(r):this.eventsPerObjects[i.uuid]=[r]}catch(r){}this.eventsPerObjects[i.uuid]?.length&&this.objects.push(i instanceof bL?n:i)}};if(t.traverseEntity(t=>{(t instanceof MB||t instanceof mB)&&t.frame?.traverse(e=>{i(e,t)}),i(t)}),!this.objects.length)return;let{domElement:n}=this.eventContext;this.domEventsNeeded.clear(),Vm&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMouseDown),this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMouseUp)),this.domEventsNeeded.add("pointermove"),n.addEventListener("pointermove",this.onMouseMove),this.objects.forEach(t=>{t.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if(!this.objects.length)return;let{domElement:t}=this.eventContext;this.domEventsNeeded.clear(),Vm&&(t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("pointerup",this.onMouseUp)),t.removeEventListener("pointermove",this.onMouseMove),Object.values(this.eventsPerObjects).forEach(t=>{t.forEach(t=>{t.disconnect()})}),this.objects.forEach(t=>{t.removeEventListener("userEvent",this.onUserEvent)})}handleMouseHoverEvent(t=!1){let e=[];if(!t){let{stopRaycast:t,raycaster:i,page:n,pointerScreen:r}=this.eventContext,s=!1;if(n.uiCanvas&&(s=hk(n,[r.x,r.y],Object.keys(this.eventsPerObjects),t=>{e.push(t)})),t&&!s){let t=ok(i,n,this.objects);e=lk(t),t.forEach(t=>{t.object instanceof MB&&hk(t.object,[t?.uv?.x??0,t?.uv?.y??0],Object.keys(this.eventsPerObjects),t=>{e.push(t)})})}else this.objects.forEach(t=>{let n=ck(i,t);n&&(e.push(t),t instanceof MB&&hk(t,[n?.uv?.x??0,n?.uv?.y??0],Object.keys(this.eventsPerObjects),t=>{e.push(t)}))})}this._prevObjects.length&&this._prevObjects.forEach(t=>{e.includes(t)||(t.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[t.uuid]?.forEach(t=>t.dispatchLeave()))}),e.length&&e.forEach(t=>{t.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[t.uuid]?.forEach(t=>t.dispatchEnter())}),this._prevObjects=e}},wV=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.scrollCounter=0,this.actions=pU(e,e.actions,n,r,s,i)}connect(){this.scrollCounter=0}disconnect(){fU(this.actions)}dispatch(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())});let e=t>0?1:-1;this.scrollCounter+=e,this.scrollCounter=Math.min(Math.max(this.scrollCounter,0),this.data.steps);let i=this.scrollCounter/this.data.steps;this.actions.Transition.forEach(t=>t.seek(i)),this.actions.Animation.forEach(t=>t.seek(e)),this.actions.Create.forEach(t=>t.dispatchThrottled()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatchUserEvent(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),t?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>{t.playFromCurrent()}),this.actions.Animation.forEach(t=>{t.playFromCurrent()})),this.actions.Create.forEach(t=>t.dispatchThrottled()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},SV=class{constructor(t,e,i,n,r,s,a){this.id=t,this.data=e,this.object=i,this.domElement=s,this.eventManager=a,this.scrollStart=0,this.scrollEnd=0,this.actions=pU(e,e.actions,n,r,a,i)}getStickyParentElement(){let t=this.domElement;for(;t;){if("sticky"===window.getComputedStyle(t).position)return t;t=t.parentElement}return null}computeScrollBounds(){let t=this.getStickyParentElement(),e=t?.parentElement,i=this.domElement.getBoundingClientRect(),n={top:i.top,bottom:i.bottom,left:i.left,right:i.right,width:i.width,height:i.height};if(e){let r=e.getBoundingClientRect(),s=window.getComputedStyle(t),a=parseFloat(s.marginTop)+parseFloat(s.marginBottom),o=parseFloat(s.top),l=parseFloat(s.bottom),h=r.height-a;if(isNaN(o)){if(!isNaN(l)){let t=document.body.clientHeight??window.innerHeight,e=window.innerWidth-(document.documentElement.clientWidth??window.innerWidth);i.bottom===t-l?(n.top+=r.top-i.height+l+e,n.bottom+=r.top-i.height+l+e):i.bottom<t-l&&(n.top-=h-i.height,n.bottom-=h-i.height)}}else i.top===o?(n.top+=r.top-o,n.bottom+=r.top-o):i.top<0&&(n.top-=h-i.height,n.bottom-=h-i.height)}let r=document.body,s=document.documentElement,a=window.pageYOffset||s.scrollTop||r.scrollTop,o=s.clientTop||r.clientTop||0,l=Math.round(n.top+a-o);if("enter"===this.data.startFrom){let t=window.innerHeight,e=n.height,i=this.data.enterAnchor,r="top"===i?t:"bottom"===i?t-e:t-.5*e;this.scrollStart=l-r}else this.scrollStart=0;this.scrollStart+=this.data.startOffset??0,this.scrollEnd=this.scrollStart+(this.data.endAfter??400),this.box=n,this.computeScroll({x:window.scrollX,y:window.scrollY})}connect(){this.computeScrollBounds()}disconnect(){fU(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:t,y:e}){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())});let i=this.scrollEnd-this.scrollStart,n=Math.min(1,Math.max(0,(e-this.scrollStart)/i));this.actions.Transition.forEach(t=>t.seek(n)),this.actions.Animation.forEach(t=>t.seek(n)),this.actions.Create.forEach(t=>t.dispatchThrottled()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatch(t){this.isInvalidBox&&this.computeScrollBounds(),this.computeScroll(t)}dispatchUserEvent(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),t?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>{t.playFromCurrent()}),this.actions.Animation.forEach(t=>{t.playFromCurrent()})),this.actions.Create.forEach(t=>t.dispatchThrottled()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},_V=class extends pk{constructor(t,e){super(t),this.managers=e,this.wheelEventsPerObject=new Map,this.scrollEventsPerObject=new Map,this.isInview=!0,this.handleResize=()=>{[...this.scrollEventsPerObject.entries()].forEach(([t,e])=>{e.forEach(t=>t.handleResize())})},this.onScroll=t=>{if(!this.isInview)return;let e={y:window.scrollY,x:window.scrollX};[...this.scrollEventsPerObject.entries()].forEach(([t,i])=>{t.dispatchEvent({type:"beginEvent",eventName:"Scroll",scroll:e}),i.forEach(t=>t.dispatch(e))})},this.onWheel=t=>{!this.isInview||t.ctrlKey||[...this.wheelEventsPerObject.entries()].forEach(([e,i])=>{e.dispatchEvent({type:"beginEvent",eventName:"Scroll",deltaY:t.deltaY}),i.forEach(e=>e.dispatch(t.deltaY))})},this.onUserEvent=({eventName:t,target:e,reverse:i})=>{if(!t||!e)return;let n=gk(t);n&&"Scroll"===n&&(e.dispatchEvent({type:"beginEvent",eventName:"Scroll"}),this.wheelEventsPerObject.get(e)?.forEach(t=>{t.dispatchUserEvent(i)}))}}connect(){let{page:t,sharedAssets:e,domElement:i,isExport:n}=this.eventContext,r=r=>{if(r.data?.events.length)for(let{id:s,data:a}of r.data.events)if(!a.disabled&&"Scroll"===a.type)if("load"!==a.trigger&&n){let n=new SV(s,a,r,t,e,i,this.managers);this.scrollEventsPerObject.has(r)?this.scrollEventsPerObject.get(r)?.push(n):this.scrollEventsPerObject.set(r,[n])}else{let i=new wV(s,a,r,t,e,this.managers);this.wheelEventsPerObject.has(r)?this.wheelEventsPerObject.get(r)?.push(i):this.wheelEventsPerObject.set(r,[i])}};t.traverseEntity(t=>{(t instanceof MB||t instanceof mB)&&t.frame?.traverse(t=>{r(t)}),r(t)}),this.intersectionObserver=new IntersectionObserver(t=>{let e=t[0];e&&(this.isInview=e.isIntersecting)},{root:null}),this.intersectionObserver.observe(this.eventContext.domElement),[...this.wheelEventsPerObject.entries()].forEach(([t,e])=>{e.forEach(t=>t.connect()),t.addEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([t,e])=>{e.forEach(t=>t.connect()),t.addEventListener("userEvent",this.onUserEvent)}),[...this.wheelEventsPerObject.values()].some(t=>t.length)&&(this.domEventsNeeded.add("wheel"),window.addEventListener("wheel",this.onWheel)),[...this.scrollEventsPerObject.values()].some(t=>t.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(([t,e])=>{e.forEach(t=>t.disconnect()),t.removeEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([t,e])=>{e.forEach(t=>t.disconnect()),t.removeEventListener("userEvent",this.onUserEvent)})}},AV=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=pU(e,e.actions,n,r,s,i)}disconnect(){fU(this.actions)}dispatch(){this.actions.Transition.forEach(t=>{t.play()}),this.actions.Animation.forEach(t=>{t.play()}),this.actions.SwitchCamera.forEach(t=>{t.play()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()),this.actions.Create.forEach(t=>{t.dispatchFromStart()}),this.actions.Destroy.forEach(t=>{t.dispatchFromStart()})}
2dispatchAfter(t){this.actions.Audio.forEach(e=>{(e.interaction.data.triggerAfter??"any")===t&&(e.interaction instanceof rF?e.interaction.audioPlayer.play():e.interaction instanceof sF&&e.interaction.dispatch())}),this.actions.Video.forEach(e=>{let i=e.interaction.data.triggerAfter??"autoplay";i===t&&(e.interaction instanceof vU?e.interaction.play("autoplay"===i):e.interaction instanceof yU&&e.interaction.dispatch())}),this.actions.Particles.forEach(e=>{(e.data.triggerAfter??"any")===t&&e.dispatchBasic()})}async seekVideos(t){let e=[];this.actions.Video.forEach(i=>{"autoplay"===(i.interaction.data.triggerAfter??"autoplay")&&i.interaction instanceof vU&&e.push(i.interaction.seek(t))}),await Promise.all(e)}pauseVideos(){this.actions.Video.forEach(t=>{t.interaction instanceof vU&&t.interaction.pause()})}dispatchUserEvent(t){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),t?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.Reset.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}
2),this.actions.Audio.forEach(t=>{t.interaction instanceof rF?t.interaction.audioPlayer.play():t.interaction instanceof sF&&t.interaction.dispatch()}),this.actions.Video.forEach(t=>{t.interaction instanceof vU?t.interaction.play():t.interaction instanceof yU&&t.interaction.dispatch()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()})}},MV=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([t,e])=>{t.dispatchEvent({type:"beginEvent",eventName:"Start"}),e.forEach(t=>{t.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([t,e])=>{t.dispatchEvent({type:"beginEvent",eventName:"Start"}),e.forEach(t=>{t.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:t,isExport:e}=this.eventContext,i=e?document:t;i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([t,e])=>{t.dispatchEvent({type:"beginEvent",eventName:"Start"}),e.forEach(t=>{t.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([t,e])=>{t.dispatchEvent({type:"beginEvent",eventName:"Start"}),e.forEach(t=>
vendor: 8,864 bytes, line 2
2{t.actions.Audio.forEach(t=>{t.interaction instanceof rF&&t.interaction.audioPlayer.play()}),t.actions.Video.forEach(t=>{let e=t.interaction.data.triggerAfter??"autoplay";t.interaction instanceof vU&&t.interaction.play("autoplay"===e)}),t.actions.Particles.forEach(t=>{t.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([t,e])=>{t.dispatchEvent({type:"beginEvent",eventName:"Start"}),e.forEach(t=>{t.dispatchAfter("autoplay")})})},this.seekVideos=async t=>{let e=[];[...this.eventsAfterPerObject.entries()].forEach(([i,n])=>{n.forEach(i=>{e.push(i.seekVideos(t))})}),await Promise.all(e)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([t,e])=>{e.forEach(t=>{t.pauseVideos()})})},this.onUserEvent=({eventName:t,target:e,reverse:i})=>{if(!t||!e)return;let n=gk(t);n&&"Start"===n&&(e instanceof bL||e.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(e)?.forEach(t=>{t.dispatchUserEvent(i)}),this.eventsAfterPerObject.get(e)?.forEach(t=>{t.dispatchUserEvent(i)}))}}connect(){let{sharedAssets:t,page:e}=this.eventContext,i=i=>{if(i.data?.events.length)for(let{id:n,data:r}of i.data.events){if(r.disabled||"Start"!==r.type)continue;let s=new AV(n,r,i,e,t,this.eventManager);(s.actions.Transition.length||s.actions.Animation.length||s.actions.SwitchCamera.length||s.actions.Create.length||s.actions.Destroy.length||s.actions.SceneTransition.length||s.actions.Reset.length||s.actions.SetVariable.length||s.actions.DynamicVariablePlay.length||s.actions.ClearLocalStorage.length||s.actions.UserAPI.length)&&(this.eventsPerObject.has(i)?this.eventsPerObject.get(i)?.push(s):this.eventsPerObject.set(i,[s])),s.actions.Audio.length&&(this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(s):this.eventsAfterPerObject.set(i,[s])),s.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(s):this.eventsAfterPerObject.set(i,[s])),s.actions.Particles.length&&(this.eventsAfterPerObject.has(i)?this.eventsAfterPerObject.get(i)?.push(s):this.eventsAfterPerObject.set(i,[s]))}};if(e.traverseEntity(t=>{(t instanceof MB||t instanceof mB)&&t.frame?.traverse(t=>{i(t)}),i(t)}),[...this.eventsAfterPerObject.values()].some(t=>t.length)){if(0===this.eventManager.activateCount){let{domElement:t,isExport:e}=this.eventContext,i=e?document:t;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(([t,e])=>{t.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([t,e])=>{t.dispatchEvent({type:"beginEvent",eventName:"Start"}),e.forEach(t=>t.dispatch()),t.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(t=>t.length)){let{domElement:t,isExport:e}=this.eventContext,i=e?document:t;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(([t,e])=>{t.removeEventListener("userEvent",this.onUserEvent),e.forEach(t=>t.disconnect())})}[...this.eventsPerObject.entries()].forEach(([t,e])=>{t.removeEventListener("userEvent",this.onUserEvent),e.forEach(t=>t.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},CV=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=pU(e,e.actions,n,r,s,i),this.target=e.target}disconnect(){fU(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},EV=class extends pk{constructor(t,e,i,n,r){super(t),this.sharedVariables=e,this.eventManager=i,this.needsMouse=n,this.needsRaycast=r,this.dynamicVars=[],this.variablesToWatch=[],this.prevMouseProperty=null,this.prevRaycastProperty=null,this.pauseTime=0,this.isOutOfFocus=!1,this.events=[],this.onFrame=t=>{let e=this.eventContext.sharedAssets;if(this.rafId=window.requestAnimationFrame(this.onFrame),this.isOutOfFocus)return;let i=new Date,n=[],r=[];for(let o=0;o<this.propertiesToWatch.length;o++){let{objectId:t,property:e,prevValue:i}=this.propertiesToWatch[o],n=this.eventContext.scene.find(t),s=Vy.propertyPaths[e];if("width"===s[0]||"height"===s[0]||"depth"===s[0])n=n.geometry.userData.parameters[s[0]];else for(let r=0;r<s.length;r++)n=n[s[r]];null===i?this.propertiesToWatch[o].prevValue=n instanceof be?n.clone():n:(n instanceof be?!n.equals(i):i!==n)&&(r.push({objId:t,property:e}),n instanceof be?this.propertiesToWatch[o].prevValue.copy(n):this.propertiesToWatch[o].prevValue=n)}for(let o=0;o<this.variablesToWatch.length;o++){let{id:t,prevValue:i}=this.variablesToWatch[o],r=e.getVariable(t);r!==i&&(n.push(t),this.variablesToWatch[o].prevValue=r)}for(let o=0;o<this.dynamicVars.length;o++){let{id:r,expectedTime:s,last:a,data:l,timerSeconds:h,startValue:c}=this.dynamicVars[o],d=1e3;if("timer"!==l.dynamicVariableType&&"stopwatch"!==l.dynamicVariableType||"number3decimal"!==l.format?"counter"===l.dynamicVariableType?d=l.updateInterval:"random"===l.dynamicVariableType&&(d=l.isStatic?1/0:l.updateInterval):d=1,-1!==s){if("Stopped"!==e.getDynamicVariablePlayState(r)&&"Restarted"!==e.getDynamicVariablePlayState(r)||(this.dynamicVars[o].last=t,this.dynamicVars[o].expectedTime=t+d,"counter"===l.dynamicVariableType&&e.getVariable(r)!==c&&(e.updateVariable(r,c),this.eventManager.requestRender()),("timer"===l.dynamicVariableType||"stopwatch"===l.dynamicVariableType)&&this.dynamicVars[o].timerSeconds!==c&&(this.dynamicVars[o].timerSeconds=c,e.updateVariable(r,Lb.getFormattedTimerTime(c,l)),this.eventManager.requestRender()),"Restarted"===e.getDynamicVariablePlayState(r)&&e.setDynamicVariablePlayState(r,"Playing"),"Stopped"!==e.getDynamicVariablePlayState(r))){if("Paused"===e.getDynamicVariablePlayState(r)){void 0===this.dynamicVars[o].deltaToExpectedTime&&(this.dynamicVars[o].deltaToExpectedTime=Math.max(this.dynamicVars[o].expectedTime-t,0)),this.dynamicVars[o].last=t-(d-this.dynamicVars[o].deltaToExpectedTime),this.dynamicVars[o].expectedTime=t+this.dynamicVars[o].deltaToExpectedTime;continue}if(this.dynamicVars[o].deltaToExpectedTime=void 0,t>=s)if(this.dynamicVars[o].last=t,this.dynamicVars[o].expectedTime+=d,"random"===l.dynamicVariableType){let t=l.min+Math.random()*(l.max-l.min),i=l.decimals;t=Math.round(t*Math.pow(10,i))/Math.pow(10,i),e.updateVariable(r,t),n.push(r),this.eventManager.requestRender()}else if("counter"===l.dynamicVariableType){let t=e.getVariable(r),i=e.getDynamicVariableToggleIsForward(r)??!0,s=e.getVariable(r)+l.increment*(i?1:-1);l.hasEnd&&(s=l.increment>0?Wt.clamp(s,c,l.endValue):Wt.clamp(s,l.endValue,c),s===c&&e.setDynamicVariableToggleIsForward(r,void 0),l.repeat?s===l.endValue&&(s=c):(s===c||s===l.endValue)&&e.setDynamicVariablePlayState(r,"Paused")),s!==t&&(n.push(r),e.updateVariable(r,s),this.eventManager.requestRender())}else if("time"===l.dynamicVariableType){let t=e.getVariable(r),s=vT(i,l);if("object"==typeof t&&"textValue"in t&&"object"==typeof s&&"textValue"in s){if(Array.isArray(t.textValue)&&Array.isArray(s.textValue)){if(t.textValue.every((t,e)=>t===s.textValue[e]))continue}else if(t.textValue===s.textValue)continue}else if(t===s)continue;e.updateVariable(r,s),n.push(r),this.eventManager.requestRender()}else{let i=Tb.isTextValue(l.endValue)?TV(l.endValue.textValue):l.endValue,
vendor: 3,227 bytes, line 2
2s=e.getDynamicVariableToggleIsForward(r)??!0,d=h+(t-a)/1e3*("timer"===l.dynamicVariableType?-1:1)*(s?1:-1);d=Math.max(d,0),l.hasEnd&&(d="stopwatch"===l.dynamicVariableType?Wt.clamp(d,c,i):Wt.clamp(d,i,c),d===c&&e.setDynamicVariableToggleIsForward(r,void 0),l.repeat?Math.abs(d-i)<("number3decimal"===l.format?1e-4:.1)&&(d=c):(Math.abs(d-c)<("number3decimal"===l.format?1e-4:.1)||Math.abs(d-i)<("number3decimal"===l.format?1e-4:.1))&&e.setDynamicVariablePlayState(r,"Paused")),d!==h&&(n.push(r),this.dynamicVars[o].timerSeconds=d,e.updateVariable(r,Lb.getFormattedTimerTime(d,l)),this.eventManager.requestRender())}}}else this.dynamicVars[o].last=t,this.dynamicVars[o].expectedTime=t+d}let s=!1;e.mouseProperty!==this.prevMouseProperty&&(this.prevMouseProperty=e.mouseProperty,s=!0);let a=!1;e.raycastProperty!==this.prevRaycastProperty&&(this.prevRaycastProperty=e.raycastProperty,a=!0),this.events.forEach(t=>{(n.includes(t.data.variableId)||r.find(e=>e.objId===t.data.objectId&&e.property===t.data.property)||"mouseProperty"===t.data.variableId&&s||"raycastProperty"===t.data.variableId&&a)&&(t.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 t=Date.now()-this.pauseTime;for(let e=0;e<this.dynamicVars.length;e++)this.dynamicVars[e].last+=t,this.dynamicVars[e].expectedTime+=t}connect(){this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(t=>"VariableChange"===t.data.type&&!t.data.disabled).forEach(e=>{this.events.push(new PV(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.propertiesToWatch=this.events.filter(t=>"objectProperty"===t.data.variableId&&null!==t.data.objectId).map(t=>({objectId:t.data.objectId,property:t.data.property,prevValue:null}));let t=this.eventContext.sharedAssets;this.sharedVariables.forEach(({id:e,data:i})=>{if(!("dynamicVariableType"in i))return void(this.events.find(t=>t.data.variableId===e)&&this.variablesToWatch.push({id:e,prevValue:t.getVariable(e)}));let n;if("timer"===i.dynamicVariableType||"stopwatch"===i.dynamicVariableType){let t;if(Tb.isTextValue(i.value)&&Array.isArray(i.value.textValue)){let e=i.value.textValue;t=3===e.length?e[2]+60*e[1]+3600*e[0]:e[1]+60*e[0]}else t=i.value;n=t,this.dynamicVars.push({id:e,last:-1,expectedTime:-1,data:i,timerSeconds:t,startValue:n})}else"time"===i.dynamicVariableType&&t.updateVariable(e,vT(new Date,i)),"counter"===i.dynamicVariableType&&(n=Tb.isTextValue(i.value)?TV(i.value.textValue):i.value),this.dynamicVars.push({id:e,last:-1,expectedTime:-1,data:i,startValue:n})}),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(t=>t.dispose())}},PV=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=pU(e,e.actions,n,r,s,i)}dispatch(){let t=this.actions;
vendor: 3,421 bytes, line 2
2t.Audio.forEach(t=>t.dispatchConditional()),t.Particles.forEach(t=>t.dispatchConditional()),t.Video.forEach(t=>t.dispatchConditional()),t.Create.forEach(t=>t.dispatch()),t.Destroy.forEach(t=>t.dispatch()),t.Reset.forEach(t=>t.dispatch()),t.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),t.Transition.forEach(t=>t.play()),t.Animation.forEach(t=>t.play()),t.SwitchCamera.forEach(t=>t.play()),t.SceneTransition.forEach(t=>t.dispatch()),t.SetVariable.forEach(t=>t.checkConditions()),t.SetVariable.forEach(t=>t.dispatch()),t.DynamicVariablePlay.forEach(t=>t.dispatch()),t.ClearLocalStorage.forEach(t=>t.dispatch()),t.UserAPI.forEach(t=>t.dispatch())}dispose(){fU(this.actions)}};function TV(t){return 3===t.length?t[2]+60*t[1]+3600*t[0]:t[1]+60*t[0]}var DV,IV,OV,RV={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};sg.then(t=>{DV=t,IV=new t.Vec3,OV=new t.Vec3});var LV=new be,BV=class{constructor(t=!1,e=!1){this.usePhysics=t,this.isExport=e,this.onPointerDown=t=>{if(1!==Xm.length)return;let{raycaster:e,page:i}=this.eventContext;this.eventContext.updateRaycaster(t);let n=i.raycastWithClones(e);if(0!==n.length){if(this.gameControl){let t=LV.copy(this.gameControl.colliderWorldPosition);t.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(t,n[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(t,e)=>i=>{let n;if(i instanceof bI){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;n=i.object}else if(i instanceof o_)n=i.object;else if(n=i,!1===n.dataPatched.cloner?.disabled&&n.dataPatched.cloner?.hideBase&&!0!==n.dataPatched.physics?.fusedBody)return!0;if(e&&!n.userData.navmesh)return;let r=n.dataPatched;if(!r.visible&&!0!==r.physics?.enabled)return!0;i.updateMatrixWorldSVD();let s=bj(r),a=n.userData.hasDestroy,o=n.userData.hasDrag,l=!1,h=!1;for(let t of r.events)!0!==t.data.disabled&&("GameControl"===t.data.type?l=!0:"Follow"===t.data.type&&(h=!0));if(l||s||h||a||o)return!0;if(this.usePhysics&&"dynamic"===r.physics?.rigidBody){if(this.usePhysics&&r.physics?.fusedBody)return!0}else if("geometry"in i&&i.geometry&&t.push(JU(i.geometry,i.matrixWorld)),this.usePhysics&&r.physics?.fusedBody)return i.traverseObject((e,i)=>{if(0===i)return;let n;if(e instanceof bI){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;n=e.object}else if(e instanceof o_)n=e.object;else if(n=e,e.dataPatched.cloner?.hideBase)return!0;let r=n.dataPatched;if(!r.visible&&!0!==r.physics?.enabled)return!0;"geometry"in e&&e.geometry&&t.push(JU(e.geometry,e.matrixWorld))}),!0},this.traverseNoPhysics=(t,e)=>i=>{let n;if(i instanceof bI)return;n=i instanceof o_?i.object:i;let r=n.dataPatched;if("visibility"===r.physics.enabled?!r.visible:!r.physics.enabled)return!0;if(e&&!n.userData.navmesh)return;let s=i.geometry,a=!0===n.userData.hasDestroy,o=!0===n.userData.hasDrag;if(bj(r)||a||o||n.dataPatched.events.some(t=>!0!==t.data.disabled&&"GameControl"===t.data.type))return!0;
vendor: 6,009 bytes, line 2
2s&&t.push(JU(s,i.matrixWorld))},this.navmeshWasm=DV,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(e?"\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport('https://unpkg.com/@splinetool/[email protected]/build/' + 'navmesh.js'),\n\t\tfetch('https://unpkg.com/@splinetool/[email protected]/build/' + 'navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n":"\n(async function() {\n\tconst [wasmImport, wasmBinary] = await Promise.all([\n\t\timport(self.location.origin + '/_libraries/navmesh.js'),\n\t\tfetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()),\n\t]);\n\tconst wasmModule = wasmImport.default;\n\tself.module = await wasmModule({ wasmBinary });\n\tpostMessage('ready');\n})();\n")+"\n\nonmessage = function(messageEvent) {\n\tconst meshData = messageEvent.data;\n\tconst positions = meshData[0];\n\tconst offset = meshData[1];\n\tconst indices = meshData[2];\n\tconst indicesLength = meshData[3];\n\tconst parameters = meshData[4];\n\n\tconst module = self.module;\n\tconst rc = new module.rcConfig();\n\trc.cs = parameters.cs;\n\trc.ch = parameters.ch;\n\trc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\n\trc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\n\trc.walkableSlopeAngle = parameters.walkableSlopeAngle;\n\trc.walkableHeight = parameters.walkableHeight;\n\trc.walkableClimb = parameters.walkableClimb;\n\trc.walkableRadius = parameters.walkableRadius;\n\trc.maxEdgeLen = parameters.maxEdgeLen;\n\trc.maxSimplificationError = parameters.maxSimplificationError;\n\trc.minRegionArea = parameters.minRegionArea;\n\trc.mergeRegionArea = parameters.mergeRegionArea;\n\trc.maxVertsPerPoly = parameters.maxVertsPerPoly;\n\trc.detailSampleDist = parameters.detailSampleDist;\n\trc.detailSampleMaxError = parameters.detailSampleMaxError;\n\n\tif (!self.navMesh) {\n\t\tself.navMesh = new module.NavMesh();\n\t}\n\tself.navMesh.build(positions, offset, indices, indicesLength, rc);\n\n\tconst navmeshData = navMesh.getNavmeshData();\n\tconst arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\n\tconst ret = new Uint8Array(navmeshData.size);\n\tret.set(arrView);\n\tnavMesh.freeNavmeshData(navmeshData);\n\n\tpostMessage(ret);\n}\n"])),this._worker=new Worker(this._workerURL)}init(t,e,i){this.gameControl=e,this.eventContext=i,this.setDefaultQueryExtent((new be).setScalar(t.ch*t.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,t,t=>{this.buildFromNavmeshData(t.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(t,e,i){e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=!0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=!0})});let n=[],r=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(n,"custom"===e.zones);if(t.traverseChildren(r),e.objects.forEach(e=>{let i=t.scene.find(e);i.traverseEntity(t=>{t.userData.navmesh=void 0}),i.cloner?.traverseObject(t=>{t.userData.navmesh=void 0})}),0===n.length)return!1;let s=Mw(n),{positions:a,triIndices:o}=_C(s.getAttribute("position"),s.getIndex());return this._worker.postMessage([a,a.length/3,o,o.length,{...RV,...e}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let t,e,i=this.navMesh.getDebugNavMesh(),n=i.getTriangleCount(),r=new Uint32Array(3*n),s=new Float32Array(3*n*3);for(t=0;t<3*n;t++)r[t]=t;for(t=0;t<n;t++)for(e=0;e<3;e++){let n=i.getTriangle(t).getPoint(e);s[9*t+3*e+0]=n.x,s[9*t+3*e+1]=n.y,s[9*t+3*e+2]=n.z}let a=new Qi;return a.setIndex(new Ni(r,1)),a.setAttribute("position",new Ni(s,3)),a}getClosestPoint(t){return IV.x=t.x,IV.y=t.y,IV.z=t.z,this.navMesh.getClosestPoint(IV)}getClosestPointToRef(t,e){IV.x=t.x,IV.y=t.y,IV.z=t.z;let i=this.navMesh.getClosestPoint(IV);e.set(i.x,i.y,i.z)}getRandomPointAround(t,e){return IV.x=t.x,IV.y=t.y,IV.z=t.z,this.navMesh.getRandomPointAround(IV,e)}getRandomPointAroundToRef(t,e,i){IV.x=t.x,IV.y=t.y,IV.z=t.z;let n=this.navMesh.getRandomPointAround(IV,e);i.set(n.x,n.y,n.z)}moveAlong(t,e){return IV.x=t.x,IV.y=t.y,IV.z=t.z,OV.x=e.x,OV.y=e.y,OV.z=e.z,this.navMesh.moveAlong(IV,OV)}moveAlongToRef(t,e,i){return IV.x=t.x,IV.y=t.y,IV.z=t.z,OV.x=e.x,OV.y=e.y,OV.z=e.z,this.navMesh.moveAlong(IV,OV)}computePath(t,e){let i=this.getClosestPoint(e);if(OV.x=i.x,OV.y=i.y,OV.z=i.z,Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)+Math.pow(e.z-i.z,2))>this.getDefaultQueryExtent().y)return[];this.getClosestPoint(t);let n=this.navMesh.computePath(IV,OV),r=n.getPointCount(),s=[];for(let a=0;a<r;a++){let t=n.getPoint(a);s.push(new be(t.x,t.y,t.z))}return s}createCrowd(t,e){return new zV(this,t,e)}setDefaultQueryExtent(t){IV.x=t.x,IV.y=t.y,IV.z=t.z,this.navMesh.setDefaultQueryExtent(IV)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(t){let e=t.length*t.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(e),n=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,e);n.set(t);let r=new this.navmeshWasm.NavmeshData;r.dataPointer=n.byteOffset,r.size=t.length,this.navMesh.buildFromNavmeshData(r),this.navmeshWasm._free(n.byteOffset)}getNavmeshData(){let t=this.navMesh.getNavmeshData(),e=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,t.dataPointer,t.size),i=new Uint8Array(t.size);return i.set(e),this.navMesh.freeNavmeshData(t),i}getDefaultQueryExtentToRef(t){let e=this.navMesh.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(t,e,i){return IV.x=t.x,IV.y=t.y,IV.z=t.z,this.navMesh.addCylinderObstacle(IV,e,i)}addBoxObstacle(t,e,i){return IV.x=t.x,IV.y=t.y,IV.z=t.z,OV.x=e.x,OV.y=e.y,OV.z=e.z,this.navMesh.addB
vendor: 23,733 bytes, line 2
2oxObstacle(IV,OV,i)}removeObstacle(t){this.navMesh.removeObstacle(t)}isSupported(){return void 0!==this.navmeshWasm}},zV=class{constructor(t,e,i){this.navmeshWasmWrapper=t,this.transforms=[],this.agents=new Array,this.reachRadii=new Array,this._agentDestinationArmed=new Array,this._agentDestination=new Array,this.crowd=new this.navmeshWasmWrapper.navmeshWasm.Crowd(e,i,this.navmeshWasmWrapper.navMesh.getNavMesh())}onReachTarget(t,e){}addAgent(t,e,i){let n=new this.navmeshWasmWrapper.navmeshWasm.dtCrowdAgentParams;n.radius=e.radius,n.height=e.height,n.maxAcceleration=e.maxAcceleration,n.maxSpeed=e.maxSpeed,n.collisionQueryRange=e.collisionQueryRange,n.pathOptimizationRange=e.pathOptimizationRange,n.separationWeight=e.separationWeight,n.updateFlags=7,n.obstacleAvoidanceType=0,n.queryFilterType=0,n.userData=0;let r=this.crowd.addAgent(new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z),n);return this.transforms.push(i),this.agents.push(r),this.reachRadii.push(e.reachRadius?e.reachRadius:e.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new be(0,0,0)),r}getAgentPosition(t){return this.crowd.getAgentPosition(t)}getAgentPositionToRef(t,e){let i=this.crowd.getAgentPosition(t);e.set(i.x,i.y,i.z)}getAgentVelocity(t){return this.crowd.getAgentVelocity(t)}getAgentVelocityToRef(t,e){let i=this.crowd.getAgentVelocity(t);e.set(i.x,i.y,i.z)}getAgentNextTargetPath(t){return this.crowd.getAgentNextTargetPath(t)}getAgentNextTargetPathToRef(t,e){let i=this.crowd.getAgentNextTargetPath(t);e.set(i.x,i.y,i.z)}getAgentState(t){return this.crowd.getAgentState(t)}overOffmeshConnection(t){return this.crowd.overOffmeshConnection(t)}agentGoto(t,e){this.crowd.agentGoto(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z));let i=this.agents.indexOf(t);i>-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(e.x,e.y,e.z))}agentTeleport(t,e){this.crowd.agentTeleport(t,new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z))}updateAgentParameters(t,e){let i=this.crowd.getAgentParameters(t);void 0!==e.radius&&(i.radius=e.radius),void 0!==e.height&&(i.height=e.height),void 0!==e.maxAcceleration&&(i.maxAcceleration=e.maxAcceleration),void 0!==e.maxSpeed&&(i.maxSpeed=e.maxSpeed),void 0!==e.collisionQueryRange&&(i.collisionQueryRange=e.collisionQueryRange),void 0!==e.pathOptimizationRange&&(i.pathOptimizationRange=e.pathOptimizationRange),void 0!==e.separationWeight&&(i.separationWeight=e.separationWeight),this.crowd.setAgentParameters(t,i)}removeAgent(t){this.crowd.removeAgent(t);let e=this.agents.indexOf(t);e>-1&&(this.agents.splice(e,1),this.transforms.splice(e,1),this.reachRadii.splice(e,1),this._agentDestinationArmed.splice(e,1),this._agentDestination.splice(e,1))}getAgents(){return this.agents}update(t){if(this.navmeshWasmWrapper.navMesh.update(),t<=.001)return;let e=1/60;{let i=Math.floor(t/e);i>10&&(i=10),i<1&&(i=1);let n=t/i;for(let t=0;t<i;t++)this.crowd.update(n)}for(let i=0;i<this.agents.length;i++){let t=this.agents[i],e=this.getAgentPosition(t);if(this.transforms[i].copy(e),this._agentDestinationArmed[i]){let n=e.x-this._agentDestination[i].x,r=e.z-this._agentDestination[i].z,s=this.reachRadii[i],a=this._agentDestination[i].y-this.reachRadii[i],o=this._agentDestination[i].y+this.reachRadii[i],l=n*n+r*r;e.y>a&&e.y<o&&l<s*s&&(this.onReachTarget(t,this._agentDestination[i]),this._agentDestinationArmed[i]=!1)}}}setDefaultQueryExtent(t){let e=new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z);this.crowd.setDefaultQueryExtent(e)}getDefaultQueryExtent(){return this.crowd.getDefaultQueryExtent()}getDefaultQueryExtentToRef(t){let e=this.crowd.getDefaultQueryExtent();t.set(e.x,e.y,e.z)}getCorners(t){let e,i=this.crowd.getCorners(t),n=i.getPointCount(),r=[];for(e=0;e<n;e++){let t=i.getPoint(e);r.push(new be(t.x,t.y,t.z))}return r}dispose(){this.crowd.destroy()}};function FV(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&Ab.traverseModuleInstances(t,i.id,(t,i,n)=>{for(let r of n)"GameControl"===r.data.type&&r.data.navmesh.enabled&&(e=!0)})}),e}var NV={type:"change"},UV={type:"changeZoom"},kV={type:"changePan"},VV={type:"start"},jV={type:"end",changed:!0},GV={type:"end",changed:!1},WV=new xe,HV=new Ht,qV=2*Math.PI,XV=new be,YV=new Ht,QV=new be,ZV=new xe,KV=new Ze,JV={type:"requestRender"},$V=class extends Dt{constructor(t,e,i={isPlayMode:!1,isExport:!1}){super(),this.object=t,this.domElement=e,this.options=i,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,S,b],this.offset=new be,this.eye=new be,this.lastPosition=new be,this.lastQuaternion=new xe,this.current=new Ht,this.overShoot=new Ht,this.overRatio=new Ht,this.spherical=new nh,this.sphericalDelta=new nh,this.panOffset=new be,this.panLeftV=new be,this.panUpV=new be,this.panV=new be,this.rotateStart=new Ht,this.rotateEnd=new Ht,this.rotateDelta=new Ht,this.panStart=new Ht,this.panEnd=new Ht,this.panDelta=new Ht,this.dollyStart=new Ht,this.dollyEnd=new Ht,this.dollyDelta=new Ht,this.rotationRangeFactor=new Ht,this.panRangeFactor=new Ht,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.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=t=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=t.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(QV,ZV,XV),this.offset.copy(QV).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(WV.copy(ZV).invert()),this.panOffset.applyQuaternion(WV),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(ZV),this.panOffset.applyQuaternion(ZV)),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),QV.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(KV.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(KV));let t=this.spherical.phi%qV;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(wi.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-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 t=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-t,this.sphericalDelta.phi*=1-t}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(NV),this.object.dispatchEvent(JV),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,void(this.isCurrentlyDamping=!0);this.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=t=>{!1!==this.enabled&&("touch"===t.pointerType||"pen"===t.pointerType&&Vm?this.onPointerDownTouch(t):this.onPointerDownMouse(t),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(VV),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&Vm||this.domElement.setPointerCapture(t.pointerId)))},this.onPointerLeave=t=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,XV.subVectors(this.position0,this.target0),this.spherical.setFromVector3(XV),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=t},this.onPointerEnter=t=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?YV.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):YV.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(YV).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(HV,-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(t.clientX,t.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(YV).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(t.clientX,t.clientY)),this.update()},this.onPointerMove=t=>{!1!==this.enabled&&(this.checkRaycastLock()||("touch"===t.pointerType||"pen"===t.pointerType&&Vm?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t),t.stopPropagation()))},this.onPointerUp=t=>{this.isPointerDown=!1,0===Xm.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),Xm.length>1&&t.preventDefault(),this.hasChange?this.dispatchEvent(jV):this.dispatchEvent(GV),this.state=-1,t&&(t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&Vm||this.domElement.releasePointerCapture(t.pointerId))},this.onPointerDownMouse=t=>{let e;switch(e=this.useKeyEvents?this.mouseButtons[t.button]:this.mouseButtonsPlay[t.button],e){case 0:if(!0!==t.altKey||t.shiftKey||qm(t)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(qm(t)||t.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(qm(t)||t.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(t);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(t);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(t)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=t=>{switch(Xm.length>1&&t.preventDefault(),this.touches[Xm.length-1]){case x:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case b:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case w:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case S:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=t=>{switch(Xm.length>1&&t.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(t),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=gm(()=>this.dispatchEvent(jV),33),this.onMouseWheel=t=>{!1===this.enabled||!1===this.enableZoom&&!1===this.enablePan||this.checkRaycastLock()||(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&t.preventDefault(),this.dispatchEvent(VV),this.handleMouseWheel(t),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0)},this.onGesture=t=>{if(t.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!Um)if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(VV),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(jV)},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(VV))},this.onKeyUp=t=>{!1!==this.enabled&&(this.key=void 0,-1!==this.state&&"Alt"===t.key&&this.onPointerUp(Xm[0])," "===t.key&&this.dispatchEvent(jV))},this.onPointerHover=t=>{"mouse"!==t.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverShoot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(t,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(t,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=t=>{t.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(t){"start"===t.type?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(t)}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(t){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=t,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 t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(t,e){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.thetaIsFree=t.rotationHorizontalOffset.min===t.rotationHorizontalOffset.max&&t.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=t.rotationVerticalOffset.min===t.rotationVerticalOffset.max&&t.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.hoverRotateDamping=t.hoverRotateDamping??this.dampingFactor,this.useWindowEvents="window"===e,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=t.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,this.autoRotateSpeed=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(WV.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=tj(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=tj(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=tj(tj(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=tj(tj(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=x),1===t.panTouches&&(this.touches[0]=b),2===t.orbitTouches&&(this.touches[1]=S),2===t.panTouches&&(this.touches[1]=w),3===t.orbitTouches&&(this.touches[2]=x),3===t.panTouches&&(this.touches[2]=b),this.isTouchZoom=t.isTouchZoom,this.resetHoverEffectOnPointerLeave=t.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 t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.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(t,e,i,n,r,s,a,o){let l,h,c;this.overShoot.set(0,0),t instanceof be?(l=t.x,h=t.y,this.current.set(this.target.x,this.target.y),c=!0):(l=t.theta,h=t.phi,this.current.set(tj(this.spherical.theta),tj(this.spherical.phi)),c=!1),0===i&&(this.current.x+=l,this.current.y+=h),(3===e||2===e)&&(!c&&this.isThetaFlipped?this.current.x>n&&this.current.x<0?this.overShoot.x=n-this.current.x:this.current.x<r&&this.current.x>0&&(this.overShoot.x=r-this.current.x):this.current.x>n?this.overShoot.x=n-this.current.x:this.current.x<r&&(this.overShoot.x=r-this.current.x)),(3===e||1===e)&&(this.current.y>s?this.overShoot.y=s-this.current.y:this.current.y<a&&(this.overShoot.y=a-this.current.y)),c||(this.overShoot.x=tj(this.overShoot.x),this.overShoot.y=tj(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(o),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=ej(Math.abs(this.overRatio.x)),this.overRatio.y=ej(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:(l*this.overShoot.x<0&&!this.thetaIsFree&&(l*=1-this.overRatio.x),h*this.overShoot.y<0&&!this.phiIsFree&&(h*=1-this.overRatio.y)):2===i&&(!c&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||c&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(l=.05*this.overShoot.x),this.phiIsFree||(h=.05*this.overShoot.y),c?this.isPanOverShoot=!0:this.isRotateOverSho
2ot=!0):c?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(l+=this.overShoot.x,h+=this.overShoot.y),t instanceof be?(t.x=l,t.y=h):(this.thetaIsFree||(t.theta=l),this.phiIsFree||(t.phi=h))}setEnableDampingSpeed(t){this.enableDamping=t,this.rotateSpeed=!0===t?.2:1}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(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,e){this.panLeftV.setFromMatrixColumn(e,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,e){this.panUpV.setFromMatrixColumn(e,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,e){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let n=this.object.position;this.panV.copy(n).sub(this.target);let r=this.panV.length();r*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*r/i.clientHeight,this.object.matrixWorld),this.panUp(2*e*r/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(kV)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(UV)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(UV)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(VV),this.dollyOut(t),this.dispatchEvent(jV)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(VV),this.dollyIn(t),this.dispatchEvent(jV)}setZoom(t){if(this.dispatchEvent(VV),this.object.isPerspectiveCamera){let e=this.initialSphericalRadius/t/this.spherical.radius;this.scale=e}else this.object.isOrthographicCamera&&(this.object.zoom=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(jV)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,e=1){void 0!==t.movementX?this.rotateDelta.set(t.movementX,t.movementY):(this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*e).rotateAround(HV,-this.object.angleOffsetFromUp);let i=this.domElement,n=this.useWindowEvents?window.innerHeight:i.clientHeight,r=2*Math.PI*this.rotateDelta.x/n,s=2*Math.PI*this.rotateDelta.y/n;this.rotateLeft(r),this.rotateUp(s),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.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(t,e=1){void 0!==t.movementX?this.panDelta.set(t.movementX,t.movementY):(this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*e),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(t){if(!1===km&&!1===qm(t)&&!0===function(t){return 0===t.wheelDeltaY||0===t.deltaY?!(Nm&&t.shiftKey&&Math.abs(t.wheelDeltaX)>=120)&&(t.wheelDeltaX?t.wheelDeltaX===-3*t.deltaX||t.wheelDeltaX===-3*window.devicePixelRatio*t.deltaX:0===t.deltaMode):t.wheelDeltaY?t.wheelDeltaY===-3*t.deltaY||t.wheelDeltaY===-3*window.devicePixelRatio*t.deltaY:0===t.deltaMode}(t)){if(!1===this.enablePan)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.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),t.altKey?this.pan(0,this.panDelta.y):t.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},30)}else{if(!1===this.enableZoom||this.gesture)return;0===t.deltaY?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(2===Xm.length){let t=.5*(Xm[0].pageX+Xm[1].pageX),e=.5*(Xm[0].pageY+Xm[1].pageY);this.rotateStart.set(t,e)}else this.rotateStart.set(Xm[0].pageX,Xm[0].pageY)}handleTouchStartPan(){if(2===Xm.length){let t=.5*(Xm[0].pageX+Xm[1].pageX),e=.5*(Xm[0].pageY+Xm[1].pageY);this.panStart.set(t,e)}else this.panStart.set(Xm[0].pageX,Xm[0].pageY)}handleTouchStartDolly(){let t=Xm[0].pageX-Xm[1].pageX,e=Xm[0].pageY-Xm[1].pageY,
vendor: 3,038 bytes, line 2
2i=Math.sqrt(t*t+e*e);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(t){if(2===Xm.length){let e=tg(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this.rotateEnd.set(i,n)}else{if(t.pointerId!==Xm[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let e=this.domElement;e&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/e.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/e.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(2===Xm.length){let e=tg(t),i=.5*(t.pageX+e.x),n=.5*(t.pageY+e.y);this.panEnd.set(i,n)}else{if(t.pointerId!==Xm[0].pointerId)return;this.panEnd.set(t.pageX,t.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(t){let e=tg(t),i=t.pageX-e.x,n=t.pageY-e.y,r=Math.sqrt(i*i+n*n);this.dollyEnd.set(0,r),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(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let t=this.options?.showCameraLock;return t&&t(),!0}}return!1}};function tj(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function ej(t){return 1-Math.pow(1-t,4)}var ij,nj=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.page=n,this.currentIntersectedObjects=[],this.actions=pU(e,e.actions,n,r,s,i),this.target=e.target,this.triggeringObjects=[];for(let a of e.triggeringObjects){let t=n.scene.find(a);t&&this.triggeringObjects.push(t)}}isValidTriggeringObject(t){return"all"===this.target||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){fU(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}
2),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};hg.then(t=>ij=t);var rj=new be,sj=new xe,aj=new be,oj=new ai(0,0,0,"YXZ"),lj=new ai(0,0,0,"XYZ"),hj=new be,cj=new be,dj=new be(1,1,1),uj=new xe,pj=new Ze,fj=new Ze,mj={type:"updateMatrix"},gj=new xe,vj=new Ve,yj={type:"beginEvent",eventName:"Collision"},xj={type:"beginEvent",eventName:"Trigger"};var bj=t=>t.states.some(t=>void 0!==t.data.position||void 0!==t.data.rotation||void 0!==t.data.hiddenMatrix||void 0!==t.data.cloner||void 0!==t.data.pathSnapping),wj=class{constructor(t){this.eventContext=t,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=t=>{if(t.bodyType()!==ij.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i,n]=this.rigidBodyToMesh.get(t.handle);if(rj.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),sj.copy(t.rotation()),e.matrixWorld.compose(rj,sj,i),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(mj),n){let t=e.cloner;if(t&&void 0===t.objectForSample){t.matrixWorld.copy(e.matrixWorld);for(let e of t.children)e.updateMatrixWorld(!0)}for(let i of e.children)i.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,e,i)=>{if(!1===i)return;let n,r;if(this.sensorToTriggerEvent[t]?(n=this.sensorToTriggerEvent[t],r=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(n=this.sensorToTriggerEvent[e],r=this.sharedGameControlGlobals.colliderToEntity.get(t)),n&&r&&n.isValidTriggeringObject(r))n.dispatch();else{for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let n=this.sharedGameControlGlobals.createdObjects[i];if(n.userData.hasCollisionDestroy&&(n.rigidBody?.collider(0).handle===t||n.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(i,1),n.removeFromParent(),requestAnimationFrame(()=>this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(n.rigidBody));break}}if(void 0!==this.gameControl?.object&&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 n of i)"character"===n.data.target&&this.dispatchCollisionEvent(n,t,e)}else if(void 0!==this.gameControl?.object&&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 n of i)"character"===n.data.target&&this.dispatchCollisionEvent(n,e,t)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(t),n=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==n)for(let e of n)"scene"===e.data.target&&this.dispatchCollisionEvent(e,i,t);let r=this.sharedGameControlGlobals.colliderToEntity.get(e),s=this.sharedGameControlGlobals.entityToCollisionEvents[r?.uuid];if(void 0!==s)for(let t of s)"scene"===t.data.target&&this.dispatchCollisionEvent(t,r,e)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}attachVRControllers(t){t.forEach(t=>{t.addEventListener("connected",t=>{"gamepad"in t.data&&"axes"in t.data.gamepad&&this.sharedGameControlGlobals.gamePads.push(t.data.gamepad)})})}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events){if(!0===i.data.disabled)continue;let t=i.data.actions?.find(t=>"Destroy"===t.data.type)?.data;if(t)for(let e of t.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let i of e.events)if(!0!==i.data.disabled&&"DragDrop"===i.data.type)for(let t of i.data.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDrag=!0)}})}initBVH(){let t=[];if(this.page.traverseChildren(e=>{let i;if(e instanceof bI||e instanceof eO||e instanceof NB)return;i=e instanceof o_?e.object:e;let n=i.dataPatched;
2if("visibility"===n.physics?.enabled?!n.visible:!n.physics?.enabled)return!0;let r=e.geometry,s=!0===i.userData.hasDestroy,a=!0===i.userData.hasDrag;if(bj(n)||s||a||i.dataPatched.events.some(t=>!0!==t.data.disabled&&("GameControl"===t.data.type||"Follow"===t.data.type)))return e.updateMatrixWorldSVD(),this.addBoundsTree(e),!0;r&&t.push(JU(r,e.matrixWorld))}),t.length>0){let e=Mw(t,!1);this.sharedGameControlGlobals.staticMeshBVH=new VS(e)}}addRigidBody(t,e,i){if(KU(t.matrixWorld))return;let n=[],r="geometry"in t?t.geometry:void 0,s=e.dataPatched;if(void 0!==r?.getAttribute("position")&&n.push(JU(r,t.shearScale)),s.physics.fusedBody){let e=this.gatherChildrenGeom(t,n);t.traverseObject(e),t.children.forEach(t=>t.updateMatrixWorld(!0));let i=t.cloner;i&&void 0===i.objectForSample&&"dynamic"===s.physics.rigidBody&&(i.traverseObject(e),i.children.forEach(t=>t.updateMatrixWorld(!0)))}if(n.length>0){let o,l=!i.fromCreate&&"dynamic"===s.physics.rigidBody||i.fromCreate&&i.dynamic;l?(o=ij.RigidBodyDesc.dynamic(),o.setLinearDamping(s.physics.damping).setAngularDamping(s.physics.damping).setAdditionalMass(1e-9).setGravityScale(s.physics.gravityScale).enabledRotations(...s.physics.enabledRotation).enabledTranslations(...s.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(o=ij.RigidBodyDesc.kinematicPositionBased(),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):o=ij.RigidBodyDesc.fixed();let h=Mw(n);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(rj,sj,aj),t.position0=rj.clone().divideScalar(this.pixelsPerMeter),t.rotation0=sj.clone(),rj.divideScalar(this.pixelsPerMeter),o.setTranslation(rj.x,rj.y,rj.z).setRotation(sj),r?h?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):h?.scale(aj.x/this.pixelsPerMeter,aj.y/this.pixelsPerMeter,aj.z/this.pixelsPerMeter);let c=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);l&&this.rigidBodyToMesh.set(c.handle,[t,aj.clone(),s.physics.fusedBody]);let d=!(void 0===s.geometry||"SubdivGeometry"===s.geometry.type||"NonParametricGeometry"===s.geometry.type||"BooleanGeometry"===s.geometry.type||"VectorGeometry"===s.geometry.type||"StarGeometry"===s.geometry.type||"RectangleGeometry"===s.geometry.type||"EllipseGeometry"===s.geometry.type||"TriangleGeometry"===s.geometry.type||"TorusGeometry"===s.geometry.type||"HelixGeometry"===s.geometry.type);try{this.addCollider(c,s.physics,h,e,d)}catch{try{this.addCollider(c,s.physics,h,e,!1)}catch(a){}}t.rigidBody=c}}addBoundsTree(t){let e=[];
2if(void 0!==t.geometry?.getAttribute("position")&&t.geometry?.getAttribute("position").count>0&&e.push(JU(t.geometry,t.shearScale)),t.traverseObject(this.gatherChildrenGeom(t,e)),t.children.forEach(t=>t.updateMatrixWorld(!0)),e.length>0){let i=Mw(e,!1);t.bvhGeometry=i,i.getAttribute("position").count>0&&(t.bvhGeometry.boundsTree=new VS(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t))}}addCollider(t,e,i,n,r=!0){if(0===i?.getAttribute("position").count||0===i?.getIndex()?.count)return;let s;i&&(s="trimesh"===e.colliderType?ij.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):ij.ColliderDesc.convexMesh(i.getAttribute("position").array,r?i.getIndex().array:void 0)),s.setFrictionCombineRule(ij.CoefficientCombineRule.Average).setRestitutionCombineRule(ij.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let a=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t);this.sharedGameControlGlobals.colliderToEntity.set(a.handle,n),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]?.some(t=>"scene"===t.target)&&a.setActiveEvents(ij.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){return(i,n)=>{if(0===n)return;let r;if(i instanceof bI){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 o_)r=i.object;else if(r=i,r.dataPatched.cloner?.hideBase)return!0;let s=r.dataPatched;if("visibility"===s.physics.enabled?!s.visible:!s.physics.enabled)return!0;1===n?t.hasNonUniformScale?i.matrixWorld.multiplyMatrices(t.shearScale,i.hiddenMatrix):i.matrixWorld.copy(i.hiddenMatrix):i.matrixWorld.multiplyMatrices(i.parent.matrixWorld,i.hiddenMatrix),i.matrixWorld.multiply(i.matrix);let a=i.geometry;void 0!==a?.getAttribute("position")&&e.push(JU(a,i.matrixWorld))}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1,n=5,r=8,s=9,a="drag",o=this.page.data.publish.gameControlObject,l=null!==o?this.page.find(o):null,h=null;if(l)for(let u of l.data.events){if(u.data.disabled||"GameControl"!==u.data.type)continue;let t=l;for(;this.usePhysics&&null!==(t=t.parent)?.parent;)t.data.physics;u.data.collisionEnabled&&(this.needsCollisionDetection=!0),null===h&&(h=u.data)}if(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(!1===e.data.disabled&&"Trigger"===e.data.type)return this.needsCollisionDetection=!0,!0}),l&&h&&(!0===l.data.visible||!0===l.data.physics.enabled)){i=i||h.camera===e.uuid||l.uuid===e.uuid;let t=new QU(l,this.renderer.domElement,h,this.eventContext.page.data.globalPhysics,this,l.uuid!==e.uuid&&h.camera===e.uuid,e,this.page,this.sharedAssets);this.gameControl=t,n=h.joystickPosLoc,r=h.joystickRotLoc,s=h.jumpTouchButtonLoc,a=h.rotByTouch,Vm&&h.touchControl&&(this.joystickToGameControls[n]="pos","walk"===h.moveMode&&(this.joystickToGameControls[s]="jmp"),"joystick"===a&&(this.joystickToGameControls[r]="rot"))}if(this.gameControl&&this.gameControl.data.navmesh.enabled){let t=this.gameControl.data;if(!this.navigationMeshWrapper){let e;this.navigationMeshWrapper=new BV(this.usePhysics,this.isExport),e="sphere"===t.collider.type?2*t.collider.radius:t.collider.height,e=Math.floor(e/t.navmesh.ch-1),this.navigationMeshWrapper.init({...t.navmesh,walkableHeight:e},this.gameControl,this.eventContext)}}if(!1===i){let{enableRotate:t,enablePan:i,enableZoom:n,autoRotate:r,hoverRotatePanMode:s}=this.eventManager.publish.orbitControls;(t||i||n||r||0!==s)&&(this.orbitControls=new $V(e,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 c=this.renderer.domElement.width/this.renderer.getPixelRatio(),d=this.renderer.domElement.height/this.renderer.getPixelRatio();
vendor: 4,325 bytes, line 2
2this.joystickToGameControls.forEach((t,e)=>{let i=document.body.appendChild(document.createElement("div")),[n,r,s]=this.eventManager.eventContext.publish.joystickSizeAndXYOffset[e],a=(c-5*n)/4+n,o={},l="jmp"===t,h=l?0:n;e<10?(e<5?o.top=h/2:o.bottom=h/2,o.left=h/2+e%5*a):10===e?(o.left=h/2,o.top=d/2):(o.right=h/2,o.top=d/2),o.top?o.top-=r[1]:o.bottom+=r[1],o.left?o.left+=r[0]:o.right-=r[0];for(let c in o)o[c]+="px";if(l){let t=i.appendChild(document.createElement("div"));Object.assign(t.style,o,{position:"absolute",width:n+"px",height:n+"px",backgroundColor:`rgba(255,255,255,${"show"===s?.4:0})`,zIndex:"9999",borderRadius:n+"px",border:"show"===s?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let r=n/16*16*.4;return"show"===s&&(t.innerHTML=`\n\t\t\t\t\t\t<svg width="${r}" height="${.4*n}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t\t\t<path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t`),t.addEventListener("pointerdown",()=>{this.gameControl.movementState.jump=1,this.requestRender()}),t.addEventListener("touchend",t=>t.preventDefault()),void(this.joysticks[e]=[void 0,i])}let u={zone:i,mode:"static",position:o,size:n};"hide"===s&&(u.restOpacity=0);let p=eF(u);p.on("move",(e,i)=>{let n=this.gameControl;"pos"===t?i.force<.2?n.moveForce=0:(n.movementState.movePosZ=Math.sin(-i.angle.radian),n.movementState.movePosX=Math.cos(-i.angle.radian),i.force>1.2?n.movementState.run=1:n.movementState.run=0,i.force<.3?n.moveForce=(i.force-.2)/.1:n.moveForce=1):"rot"===t&&(i.force<.2?n.rotForce=0:(n.movementState.rotPosX=i.vector.y,n.movementState.rotPosY=-i.vector.x,i.force<.3?n.rotForce=(i.force-.2)/.1:n.rotForce=1)),this.requestRender()}),p.on("end",(e,i)=>{let n=this.gameControl;"pos"===t?(n.movementState.movePosZ=0,n.movementState.movePosX=0,n.moveForce=1):"rot"===t&&(n.movementState.rotPosX=0,n.movementState.rotPosY=0,n.rotForce=1)}),this.joysticks[e]=[p,i]}),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(t=>t.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new ij.World(new ij.Vector3(0,this.gravity,0)),this.events=new ij.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let n;if(i instanceof bI){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;n=i.object}else if(i instanceof o_)n=i.object;else{if(i instanceof NB||i instanceof eO)return;if(n=i,!1===n.dataPatched.cloner?.disabled&&n.dataPatched.cloner?.hideBase&&!0!==n.dataPatched.physics?.fusedBody)return!0}let r,s=n.dataPatched;for(let t of s.events)!0!==t.data.disabled&&"GameControl"===t.data.type&&(r=t.data);if(!s.physics||("visibility"===s.physics.enabled?!s.visible:!s.physics.enabled))return!0;i.updateMatrixWorldSVD();let a=bj(s),o=!1,l=n.userData.hasDestroy,h=n.userData.hasDrag,c=!1;for(let t of s.events)if(!0!==t.data.disabled)if("Collision"===t.data.type){o=!0;let e=new CV(t.id,t.data,n,this.page,this.sharedAssets,this.eventManager);e.initialDisabled=!0,this.collisionEvents.push(e),this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid].every(e=>e.id!==t.id)?this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid].push(e):this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid]=[e]}else if("Follow"===t.data.type){c=!0;let e=t.data.target;i.traverseVisible(t=>{t.userData.isFollowingObj=e})}"dynamic"===s.physics.rigidBody&&!1===s.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let d=i.geometry;if(void 0!==r){let t=ij.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(rj,sj,aj),i.position0=rj.clone().divideScalar(this.pixelsPerMeter),i.rotation0=sj.clone(),rj.divideScalar(this.pixelsPerMeter),t.setTranslation(rj.x,rj.y,rj.z).setRotation(sj);let e,a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);
vendor: 7,222 bytes, line 2
2i.rigidBody=a,e="sphere"===r.collider.type?ij.ColliderDesc.ball(r.collider.radius/this.pixelsPerMeter):"capsule"===r.collider.type?ij.ColliderDesc.capsule((r.collider.height/2-r.collider.radius)/this.pixelsPerMeter,r.collider.radius/this.pixelsPerMeter):ij.ColliderDesc.cuboid(r.collider.width/this.pixelsPerMeter/2,r.collider.height/this.pixelsPerMeter/2,r.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(ij.CoefficientCombineRule.Average).setRestitutionCombineRule(ij.CoefficientCombineRule.Average).setDensity(s.physics.density).setFriction(s.physics.friction).setRestitution(s.physics.restitution);let o=this.sharedGameControlGlobals.rapierWorld.createCollider(e,a);this.sharedGameControlGlobals.colliderToEntity.set(o.handle,n),rj.fromArray(r.collider.position).multiply(aj.setFromMatrixScale(n.matrixWorld)).divideScalar(this.pixelsPerMeter),o.setTranslationWrtParent(rj);let l=(new xe).setFromEuler((new ai).setFromVector3((new be).fromArray(r.collider.rotation)));o.setRotationWrtParent(l),o.setActiveEvents(ij.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(n,!0)}else"dynamic"===s.physics.rigidBody||a||c||l||h||o?(this.addRigidBody(i,n,{hasFollow:c,hasTransformAnim:a,hasDrag:h}),this.generateSensorColliderDescs(n,s.physics.fusedBody)):(d&&t.push(JU(d,i.matrixWorld)),s.physics.fusedBody&&i.traverseObject((e,i)=>{if(0===i)return;let n;if(e instanceof bI){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;n=e.object}else{if(e instanceof NB||e instanceof eO)return;if(e instanceof o_)n=e.object;else if(n=e,n.dataPatched.cloner?.hideBase)return!0}let r=n.dataPatched;if("visibility"===r.physics.enabled?!r.visible:!r.physics.enabled)return!0;let s=e.geometry;void 0!==s?.getAttribute("position")&&t.push(JU(s,e.matrixWorld))}),this.generateSensorColliderDescs(n,s.physics.fusedBody,e));return!(!0!==s.physics?.fusedBody&&!r)||void 0}),0===t.length)return;let i=Mw(t);i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let n=ij.RigidBodyDesc.fixed(),r=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n),s=ij.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(ij.CoefficientCombineRule.Multiply).setRestitutionCombineRule(ij.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(s,r);for(let[a,o]of e){let t=this.sharedGameControlGlobals.rapierWorld.createCollider(a,r);this.sensorToTriggerEvent[t.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let i=new nj(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),n=(new Ze).compose(hj.fromArray(e.data.position),uj.setFromEuler(lj.fromArray(e.data.rotation)),dj);if("box"===e.data.triggerZone){let r=new _e;r.min.fromArray(e.data.size).multiplyScalar(-.5),r.max.fromArray(e.data.size).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([r,n,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,n,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;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(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t,e,i){if(!this.isEnabled)return!0;let n=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),n=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,n=!1):2===this.initializationCounter&&this.gameControl&&(n=!this.gameControl.update(t,e,i)&&n),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics){let e=.016666666666666666;if(0===t)n=this.stepPhysics()&&n;else{let i=t/1e3;i<e&&i>.55*e&&(i=e),this.accumulator+=i;let r=performance.now(),s=0,a=6;for(;this.accumulator>=e&&s<a&&(n=this.stepPhysics()&&n,this.accumulator-=e,s++,!(performance.now()-r>1e3*e)););this.accumulator=this.accumulator%e}}this.skipRender=n}stepPhysics(){for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(rj,sj,aj),oj.setFromQuaternion(sj);let e=t;void 0===e.prevR?(e.prevR=oj.clone(),e.prevT=rj.clone()):(e.prevR.copy(oj),e.prevT.copy(rj)),t.rigidBody&&(t.rigidBody.setNextKinematicTranslation(rj.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(sj))}return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let n,r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner)for(let s of e.cloner.children)if(s.rigidBody===r){n=s;break}t.dispatch(n),e.dispatchEvent(yj)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let n=fj.copy(t.matrixWorld).invert();t.traverseEntity((r,s)=>{if(!1===e&&1===s)return!0;for(let e of r.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let s,a=new nj(e.id,e.data,r,this.page,this.sharedAssets,this.eventManager);if(s="box"===e.data.triggerZone?ij.ColliderDesc.cuboid(...e.data.size.map(t=>t/(2*this.pixelsPerMeter))):ij.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),s.setDensity(0).setSensor(!0).setActiveEvents(ij.ActiveEvents.COLLISION_EVENTS),hj.fromArray(e.data.position),uj.setFromEuler(lj.fromArray(e.data.rotation)),pj.compose(hj,uj,dj).premultiply(r.matrixWorld),i?(pj.decompose(hj,uj,cj),s.setActiveCollisionTypes(ij.ActiveCollisionTypes.KINEMATIC_FIXED|ij.ActiveCollisionTypes.DYNAMIC_FIXED)):(pj.premultiply(n).decompose(hj,uj,cj),t.rigidBody.bodyType()===ij.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===ij.RigidBodyType.Fixed?s.setA
vendor: 6,724 bytes, line 2
2ctiveCollisionTypes(ij.ActiveCollisionTypes.KINEMATIC_FIXED|ij.ActiveCollisionTypes.DYNAMIC_FIXED):s.setActiveCollisionTypes(ij.ActiveCollisionTypes.KINEMATIC_KINEMATIC|ij.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),hj.divideScalar(this.pixelsPerMeter),s.setTranslation(hj.x,hj.y,hj.z),s.setRotation(uj),i)i.push([s,a]);else{let e=this.sharedGameControlGlobals.rapierWorld.createCollider(s,t.rigidBody);this.sensorToTriggerEvent[e.handle]=a}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,n,r,s]=this.sharedGameControlGlobals.triggers[e];for(let e=0;e<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;e++){let a=this.sharedGameControlGlobals.entitiesWithTransformAnim[e];if(r===a||!1===s.isValidTriggeringObject(r_.is(a)?a:a.object))continue;let o=fj.copy(r.matrixWorld).decompose(hj,gj,cj).compose(hj,gj,dj).multiply(n),l=pj.copy(a.matrixWorld).invert().multiply(o);i instanceof _e?t=a.bvhGeometry.boundsTree.intersectsBox(i,l):(vj.radius=i,vj.center.setFromMatrixPosition(l),t=a.bvhGeometry.boundsTree.intersectsSphere(vj)),t?-1===s.currentIntersectedObjects.indexOf(a)&&(s.currentIntersectedObjects.push(a),s.dispatch(),r.dispatchEvent(xj)):s.currentIntersectedObjects=s.currentIntersectedObjects.filter(t=>t!==a)}}}};function Sj(t){let e=this._clip.duration,i=this._clip.start??0,n=this.loop,r=this.time+t,s=this._loopCount,a=n===pt;if(0===t)return-1===s||!a||1&~s?r:e-(r-i);if(2200===n){-1===s&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===s&&(t>=0?(s=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=e||r<i){let n=Math.floor((r-i)/(e-i));r-=(e-i)*n,s+=Math.abs(n);let o=this.repetitions-s;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(r=t>0?e:i,1===this.repetitions&&(r=e)),this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){let e=t<0;this._setEndings(e,!e,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(a&&!(1&~s))return e-(r-i)}return r}var _j,Aj=!1,Mj=class{constructor(t,e,i,n){this.scene=t,this.requestRender=e,this.updateDisplayProgress=i,this.animationInspectorState=n,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=t=>{"Empty"===t.data.type&&t.data.animations&&t.data.animations.forEach((e,i)=>{let n=e[0]+"/";if(Array.isArray(t.identity)?n+=t.identity[0]:n+=t.uuid,this.clipIdToAction[n])return;let r=ll.parse(JSON.parse(e[2]));t.animations[i]=r;let s=this.mixer.clipAction(r,t);!1===Aj&&(Object.getPrototypeOf(s)._updateTime=Sj,Aj=!0),s.clampWhenFinished=!0,this.clipIdToAction[n]=s})},this.mixer=new Jl(t),this.scene.traverseEntity(this.addClip)}deleteClip(t,e){let i=this.scene.find(e);if(!i)return;let n=i.animations.find(e=>e.uuid===t);if(!n)return;let r=this.clipIdToAction[t];!r||(r.stop(),this.mixer.uncacheClip(n),delete this.clipIdToAction[t],i.animations=i.animations.filter(e=>e.uuid!==t))}get isPlaying(){return Object.values(this.clipIdToAction).some(t=>t.isRunning())}playFromInspector(t){this.mixer.stopAllAction();let e=this.clipIdToAction[t];!e||(e.play(),this.activeClip=e.getClip(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(t=>{t.repetitions=1/0,t.loop=2201}),this.mixer.stopAllAction(),this.requestRender()}play(t){let e=t.clipId+"/"+t.object,i=this.clipIdToAction[e];if(i)return t&&(t.repeat>=0&&(i.repetitions=t.repeat+1),"pingpong"===t.direction&&0!==t.repeat&&(i.loop=pt)),i.play(),i.paused=!1,this.requestRender(),i}resumeFromInspector(t){let e=this.clipIdToAction[t];!e||(e.play(),e.paused=!1,this.requestRender())}pauseFromInspector(t){let e=this.clipIdToAction[t];!e||(e.paused=!0)}stop(){this.mixer.stopAllAction(),this.requestRender()}update(t){if(this.needsUpdate)this.needsUpdate=!1;else if(!1===this.isPlaying||this.animationInspectorState?.isScrubbing)return;this.mixer.update(t/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return sU(this.activeClip??void 0)}setProgressFromInspector(t,e){if(!this.clipIdToAction[e])return;this.activeClip!==this.clipIdToAction[e].getClip()&&this.playFromInspector(e);let i=this.clipIdToAction[e].paused;this.clipIdToAction[e].paused=!1,this.mixer.setTime(Math.min(t/(this.maxFrames-1),.9999)*this.activeClip.duration),this.requestRender(),i&&(this.clipIdToAction[e].paused=!0)}},Cj=new WeakMap,Ej=class extends pl{constructor(t){super(t),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(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,n){let r=new gl(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,t=>{this.decodeDracoFile(t,e).catch(n)},i,n)}decodeDracoFile(t,e,i,n){let r={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i};return this.decodeGeometry(t,r).then(e)}decodeGeometry(t,e){let i=JSON.stringify(e);if(Cj.has(t)){let e=Cj.get(t);if(e.key===i)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n,r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then(i=>(n=i,new Promise((i,s)=>{n._callbacks[r]={resolve:i,reject:s},n.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))).then(t=>this._createGeometry(t.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),Cj.set(t,{key:i,promise:a}),a}_createGeometry(t){let e=new Qi;t.index&&e.setIndex(new Ni(t.index.array,1));for(let i=0;i<t.attributes.length;i++){let n=t.attributes[i],r=n.name,s=n.array,a=n.itemSize;e.setAttribute(r,new Ni(s,a))}return e}_loadLibrary(t,e){let i=new gl(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((e,n
2)=>{i.load(t,e,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(e=>{let i=e[0];t||(this.decoderConfig.wasmBinary=e[1]);let n=Pj.toString(),r=["/* draco decoder */",i,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){let i=e.data;switch(i.type){case"decode":t._callbacks[i.id].resolve(i);break;case"error":t._callbacks[i.id].reject(i)}},this.workerPool.push(t)}else this.workerPool.sort(function(t,e){return t._taskLoad>e._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};function Pj(){let t,e;function i(t,e,i,n,r,s){let a=s.num_components(),o=i.num_points()*a,l=o*r.BYTES_PER_ELEMENT,h=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),c=t._malloc(l);e.GetAttributeDataArrayForAllPoints(i,s,h,l,c);let d=new r(t.HEAPF32.buffer,c,o).slice();return t._free(c),{name:n,array:d,itemSize:a}}onmessage=function(n){let r=n.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise(function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)});break;case"decode":let n=r.buffer,s=r.taskConfig;e.then(t=>{let e=t.draco,a=new e.Decoder,o=new e.DecoderBuffer;o.Init(new Int8Array(n),n.byteLength);try{let t=function(t,e,n,r){let s,a,o=r.attributeIDs,l=r.attributeTypes,h=e.GetEncodedGeometryType(n);if(h===t.TRIANGULAR_MESH)s=new t.Mesh,a=e.DecodeBufferToMesh(n,s);else{if(h!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");s=new t.PointCloud,a=e.DecodeBufferToPointCloud(n,s)}if(!a.ok()||0===s.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());let c={index:null,attributes:[]};for(let d in o){let n,a,h=self[l[d]];if(r.useUniqueIDs)a=o[d],n=e.GetAttributeByUniqueId(s,a);else{if(a=e.GetAttributeId(s,t[o[d]]),-1===a)continue;n=e.GetAttribute(s,a)}c.attributes.push(i(t,e,s,d,h,n))}return h===t.TRIANGULAR_MESH&&(c.index=function(t,e,i){let n=3*i.num_faces(),r=4*n,s=t._malloc(r);e.GetTrianglesUInt32Array(i,r,s);let a=new Uint32Array(t.HEAPF32.buffer,s,n).slice();return t._free(s),{array:a,itemSize:1}}(t,e,s)),t.destroy(s),c}(e,a,o,s),n=t.attributes.map(t=>t.array.buffer);t.index&&n.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},n)}catch(l){self.postMessage({type:"error",id:r.id,error:l.message})}finally{e.destroy(o),e.destroy(a)}})}}}function Tj(t){return _j||(_j=new Ej).setDecoderPath(t?`${t}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),_j.decoderPending}async function Dj(t){if(_j){let e,i={attributeIDs:_j.defaultAttributeIDs,attributeTypes:_j.defaultAttributeTypes,useUniqueIDs:!1};try{e=await _j.decodeGeometry(new Int8Array(t).buffer,i)}catch(Ag){}if(e)return{index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([t,e])=>({name:t,itemSize:e.itemSize,array:e.array}))}}return null}var Ij=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=t=>{let e=[t.clientX,t.clientY],i=(new Date).getTime();if(this._clickCount>0){let t=e[0]-this._lastPosition[0],i=e[1]-this._lastPosition[1];Math.sqrt(t*t+i*i)>this._distance&&(this._clickCount=0)}this._lastPosition=e,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=t=>{}}start(t,e=500,i=2){this._target&&this.stop(),this.reset(),this._delay=e,this._distance=i,this._target=t,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]}},Oj=class{constructor(t,e,i,n,r,s,a,o){this.eventId=t,this.id=e,this.data=i,this.dataEvent=n,this.object=r,this.stage=!1,this.actions=pU(n,i.actions,s,a,o,r)}disconnect(){fU(this.actions)}
vendor: 3,204 bytes, line 2
2dispatchIn(){this.actions.Audio.forEach(t=>t.dispatchBasic()),this.actions.Particles.forEach(t=>t.dispatchBasic()),this.actions.Video.forEach(t=>t.dispatchBasic()),this.actions.Create.forEach(t=>t.dispatch()),this.actions.Destroy.forEach(t=>t.dispatch()),this.actions.Reset.forEach(t=>t.dispatch()),this.actions.Link.forEach(t=>t.dispatch()),this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.actions.Transition.forEach(t=>t.toggle()),this.actions.Animation.forEach(t=>t.play()),this.actions.SwitchCamera.forEach(t=>t.play()),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatchOut(){this.actions.Transition.forEach(t=>{t.toggle()})}},Rj=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.breakpoints=[],this.resize=(t,e)=>{this.breakpoints.forEach(i=>{let n,r=Uy.deviceToSize(i.data.size),s="horizontal"===i.dataEvent.orientation?t:e;switch(i.data.operator){case"<":n=s<r[0];break;case">":n=s>r[0];break;case"<>":n=s>r[0]&&s<r[1]}i.stage!==n&&(i.stage=n,i.stage?i.dispatchIn():i.dispatchOut())})},this.onResizeObserver=new ResizeObserver(t=>{for(let e of t){let{width:t,height:i}=e.contentRect;this.resize(t,i)}})}connect(){let{page:t,sharedAssets:e,domElement:i}=this.eventContext;this.onResizeObserver.observe(i);let n=i=>{if(i.visible&&i.data?.events.length)for(let{data:n,id:r}of i.data.events)n.disabled||"Resize"===n.type&&n.breakpoints.forEach(({data:s,id:a})=>{try{let o=new Oj(r,a,s,n,i,t,e,this.eventManager);this.breakpoints.push(o)}catch(ex){}})};t.traverseEntity(t=>{(t instanceof MB||t instanceof mB)&&t.frame?.traverse(t=>{n(t)}),n(t)})}disconnect(){this.onResizeObserver.disconnect(),this.breakpoints.forEach(t=>{t.disconnect()}),this.breakpoints=[]}},Lj=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.userAPIs={},this.events=[],this.onSuccess=({userAPIId:t})=>{this.events.forEach(e=>{e.data.userAPIId===t&&e.dispatchSuccess()})},this.onError=({userAPIId:t})=>{this.events.forEach(e=>{e.data.userAPIId===t&&e.dispatchError()})},this.userAPIs=t.sharedAssets.getUserAPIs()}connect(){this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(t=>"API"===t.data.type&&!t.data.disabled).forEach(e=>{this.events.push(new Bj(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userAPIs).forEach(([t,e])=>{e.on("success",this.onSuccess),e.on("error",this.onError),e.autostart&&e.callUserAPI(this.eventContext.sharedAssets)})}disconnect(){Object.entries(this.userAPIs).forEach(([t,e])=>{e.off("success",this.onSuccess),e.off("error",this.onError)})}},Bj=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.successActions=pU(e,e.successActions,n,r,s,i),this.errorActions=pU(e,e.errorActions,n,r,s,i)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}
vendor: 1,586 bytes, line 2
2dispatchActions(t){t.Audio.forEach(t=>t.dispatchConditional()),t.Particles.forEach(t=>t.dispatchConditional()),t.Video.forEach(t=>t.dispatchConditional()),t.Create.forEach(t=>t.dispatch()),t.Destroy.forEach(t=>t.dispatch()),t.Reset.forEach(t=>t.dispatch()),t.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),t.Transition.forEach(t=>t.play()),t.Animation.forEach(t=>t.play()),t.SwitchCamera.forEach(t=>t.play()),t.SceneTransition.forEach(t=>t.dispatch()),t.SetVariable.forEach(t=>t.checkConditions()),t.SetVariable.forEach(t=>t.dispatch()),t.DynamicVariablePlay.forEach(t=>t.dispatch()),t.ClearLocalStorage.forEach(t=>t.dispatch()),t.UserAPI.forEach(t=>t.dispatch())}},zj=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.userWebhooks={},this.events=[],this.onMessage=({userWebhookId:t})=>{this.events.forEach(e=>{e.data.userWebhookId===t&&e.dispatch()})},this.userWebhooks=t.sharedAssets.getUserWebhooks()}connect(){this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(t=>"WEBHOOK"===t.data.type&&!t.data.disabled).forEach(e=>{this.events.push(new Fj(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userWebhooks).forEach(([t,e])=>{e.connect(),e.on("message",this.onMessage)})}disconnect(){Object.entries(this.userWebhooks).forEach(([t,e])=>{e.off("message",this.onMessage),e.disconnect()})}},Fj=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=pU(e,e.actions,n,r,s,i)}dispatch(){let t=this.actions;
vendor: 7,620 bytes, line 2
2t.Audio.forEach(t=>t.dispatchConditional()),t.Particles.forEach(t=>t.dispatchConditional()),t.Video.forEach(t=>t.dispatchConditional()),t.Create.forEach(t=>t.dispatch()),t.Destroy.forEach(t=>t.dispatch()),t.Reset.forEach(t=>t.dispatch()),t.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),t.Transition.forEach(t=>t.play()),t.Animation.forEach(t=>t.play()),t.SwitchCamera.forEach(t=>t.play()),t.SceneTransition.forEach(t=>t.dispatch()),t.SetVariable.forEach(t=>t.checkConditions()),t.SetVariable.forEach(t=>t.dispatch()),t.DynamicVariablePlay.forEach(t=>t.dispatch()),t.ClearLocalStorage.forEach(t=>t.dispatch()),t.UserAPI.forEach(t=>t.dispatch())}};var Nj=new be(0,0,1),Uj=new be,kj=new be,Vj=new qt,jj=class{constructor(t,e,i,n,r){this.containerScene=t,this.raycaster=e,this.sharedAssets=i,this.requestRender=n,this.onExit=r,this.htmlInput=null,this.virtualInput=null,this.helper=new sL,this.doubleClickHandler=new Ij,this.isDragging=!1,this.plane=new En,this.caretInterval=0,this.planeIntersection=new be,this.projected=new Ht,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let t=this.virtualInput?.data;if(void 0!==this.virtualInput&&t){let e=t.material,i=function(t,e){let i=tx.fromHex(3223857),n=.8;for(let r of t.layers){if("light"===r.data.type||"displace"===r.data.type||"fresnel"===r.data.type||"matcap"===r.data.type||"texture"===r.data.type||"toon"===r.data.type||"outline"===r.data.type||"transmission"===r.data.type||"noise"===r.data.type)continue;let t="string"==typeof r.data.alpha?Number(e.getVariable(r.data.alpha)):r.data.alpha;if("color"===r.data.type&&t>.3){i=lL(r.data.color,e),n=t;break}if(("depth"===r.data.type||"gradient"===r.data.type)&&t>.3){let t=hL(r.data);i={r:t[0],g:t[1],b:t[2]},n="string"==typeof r.data.alpha?1:r.data.alpha;break}}return{...i,a:n}}("string"==typeof e?this.sharedAssets.data.materials[e]:e,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=t=>{if(!this.htmlInput||!this.virtualInput)return;let e=this.helper,i="ArrowLeft"===t?.key||"ArrowRight"===t?.key,n="ArrowUp"===t?.key||"ArrowDown"===t?.key;this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(e.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:i,verticalKeyMove:n}),this.startAnimateTextCursor()):e.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){return this.htmlInput=function(){let t=document.createElement("textarea");return t.style.position="fixed",t.style.top="200px",t.style.left="400px",t.style.zIndex="-1",t.style.border="1px solid rgba(255,0,0,0.5)",t.style.width="10px",t.style.height="500px",t.style.color="white",t.style.opacity="0.5",t.style.background="transparent",t.style.display="none",t.style.margin="0px",t.style.padding="0px",t.style.boxSizing="content-box",t.style.pointerEvents="none",t}(),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 t=this.doubleClickHandler.clickCount,{index:e,lineIndex:i,characterIndex:n}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,t>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0};this.virtualInput?.wrappedText?.length&&"\n"===this.virtualInput.wrappedText[i][Math.max(0,n-1)]&&(e--,n--),this._lastIndex=e,this._isFirstDragMove=!0;let r=this.checkClickedObject();if(1===t){if(null===r)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=e,this.isDragging=!0,this.setInputSelection(e)}else r===this.virtualInput&&(2===t?this.selectClosestWord(i,n):t>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(t){if(this.virtualInput=t,this.updateTextInputStyles(),this.htmlInput)if(t){let t=this.data?.geometry.text;this.htmlInput.value="string"==typeof t?"":t?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:t}=this;if(t)return t.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let t=this.selectionOnDragStart,{index:e,lineIndex:i,characterIndex:n}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0};void 0!==i&&void 0!==n&&"\n"===this.virtualInput?.wrappedText[i][n-1]&&e--,this.htmlInput.setSelectionRange(Math.min(t,e),Math.max(t,e))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof xB)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,n=i[t],r=e+1,s=e;" "!==n[e]&&(r=this.findNextCharOccurence(n,e,"forward"," "),s=this.findNextCharOccurence(n,e,"backward"," "),s>0&&s++,r>=n.length-1&&t===i.length-1&&r++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,t,s),l=a.getGlobalIndexFromLineAndCharIndexes(i,t,r);this.setInputSelection(o,l)}findNextCharOccurence(t,e,i,n=" "){let r=Math.max(0,t.length-1),s="forward"===i?r:0,a="forward"===i?1:-1,o=Math.max(Math.min(e,r),0);for(;o!==s;)if(o+=a,t.charAt(o)===n)return o;return s}getPointOnPlane(){let t=this.virtualInput?.data;if(this.virtualInput&&t&&this.raycaster.ray.intersectsPlane(this.plane)){null===this.planeIntersection&&(this.planeIntersection=new be);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let i="number"==typeof t.geometry.width?t.geometry.width:1,n="number"==typeof t.geometry.height?t.geometry.height:1;this.projected.set(e.x+.5*i,e.y-.5*n)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(Vj.getNormalMatrix(this.virtualInput.matrixWorld),Uj.copy(Nj).applyMatrix3(Vj).normalize(),this.virtualInput.localToWorld(kj.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(Uj,kj))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),Um&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){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=function(t){return 4===t?"justify":2===t?"right":3===t?"center":"left"}(t.geometry.horizontalAlign))}};var Gj=(t,e)=>{if("string"==typeof t){let i=e.data(t);
vendor: 2,534 bytes, line 2
2if(i)return Gj(i.value,e)}return Tb.getDisplayedValue(t)};function Wj(t,e){let i=t.text,n="";if("string"==typeof i){let t=e.variables.data(n);t&&(n=Gj(t.value,e.variables))}else n=i.textValue.toString();return n}var Hj=class extends pk{constructor(t,e){super(t),this.eventManager=e,this._textInputs=[],this.sceneHelpers=new da,this.helper=new sL,this._onMouseDownFocusIn=t=>{if(Xm.length>1)return;this.eventContext.updateRaycaster(t);let e=null;if(this.eventContext.raycaster)for(let i of this._textInputs)if(this.eventContext.raycaster.intersectObject(i,!0).length>0){e=i;break}this.focusOnTextInput(e),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(t),this._onMouseDown(t)},this.onExit=()=>{let{virtualInput:t}=this.textInputManager;if(null===t)return;let e=this.textInputManager.htmlInput;this.helper.hide(),e?.setSelectionRange(e.value.length,e.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=t=>{this.eventContext.updateRaycaster(t),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=t=>{this.eventContext.updateRaycaster(t),this.textInputManager.handleMouseMove()},this._onTextEdit=t=>{let{htmlInput:e,virtualInput:i,helper:n}=this.textInputManager;if(!e||!i)return;let r=e.value;i.textGeometry.setText(r,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let s=i.data;n.update();let a=s.geometry.text;if("string"==typeof a){let t=a;
vendor: 3,778 bytes, line 2
2this.eventContext.sharedAssets.updateVariable(t,{textValue:r})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=t=>{this.textInputManager.handleCaretUpdate(t)},this._onKeyPress=t=>{"Escape"===t.key&&this.onExit()},this.textInputManager=new jj(this.sceneHelpers,t.raycaster,t.sharedAssets,t.requestRender,this.onExit)}connect(){let t=[];if(this.eventContext.scene.traverseEntity(e=>{e instanceof xB&&t.push(e)}),this._textInputs=t,0===t.length)return;let{domElement:e}=this.eventContext;e.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 t=this.textInputManager.htmlInput,{domElement:e,sharedAssets:i}=this.eventContext;e.removeEventListener("pointerdown",this._onMouseDownFocusIn),t?.removeEventListener("keyup",this._onCaretUpdate),t?.removeEventListener("keydown",this._onCaretUpdate),t?.removeEventListener("beforeinput",this._onCaretUpdate),t?.removeEventListener("paste",this._onCaretUpdate),t?.removeEventListener("cut",this._onCaretUpdate),t?.removeEventListener("select",this._onCaretUpdate),t?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(t=>{let e=Wj(t.data.geometry,this.eventContext.sharedAssets.data);t.textGeometry.setText(e,i)}),e.removeEventListener("pointerdown",this._onMouseDown,!1),e.removeEventListener("pointerup",this._onMouseUp,!1),e.removeEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(t){this.textInputManager.focus(t),this.textInputManager.onTextMaterialChanged();let e=this.textInputManager.htmlInput;if(!e||null===t)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=Wj(t.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);e.value=i,e.setSelectionRange(0,0),this.textInputManager.helper.show(t),e.style.display="block",e.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:n}=this.eventContext;n.removeEventListener("pointerdown",this._onMouseDownFocusIn),n.addEventListener("pointerdown",this._onMouseDown,!1),n.addEventListener("pointerup",this._onMouseUp,!1),n.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}},qj=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.events=[],this.onVoice=({value:t,frequencies:e})=>{this.events.forEach(t=>{t.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(t=>"AIAssistantListener"===t.data.type&&!t.data.disabled).forEach(e=>{this.events.push(new Xj(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},Xj=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=pU(e,e.actions,n,r,s,i)}dispatch(){this.dispatchActions(this.actions)}
vendor: 1,591 bytes, line 2
2dispatchActions(t){t.Audio.forEach(t=>t.dispatchConditional()),t.Particles.forEach(t=>t.dispatchConditional()),t.Video.forEach(t=>t.dispatchConditional()),t.Create.forEach(t=>t.dispatch()),t.Destroy.forEach(t=>t.dispatch()),t.Reset.forEach(t=>t.dispatch()),t.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),t.Transition.forEach(t=>t.play()),t.Animation.forEach(t=>t.play()),t.SwitchCamera.forEach(t=>t.play()),t.SceneTransition.forEach(t=>t.dispatch()),t.SetVariable.forEach(t=>t.checkConditions()),t.SetVariable.forEach(t=>t.dispatch()),t.DynamicVariablePlay.forEach(t=>t.dispatch()),t.ClearLocalStorage.forEach(t=>t.dispatch()),t.UserAPI.forEach(t=>t.dispatch())}},Yj=class extends pk{constructor(t,e){super(t),this.eventManager=e,this.events=[],this.onTriggerEvent=({description:t,direction:e})=>{let i=this.events.find(e=>e.data.description===t);i&&("backward"===e?i.dispatchReverse():i.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(t=>"AIAssistantTrigger"===t.data.type&&!t.data.disabled).forEach(e=>{this.events.push(new Qj(e.id,e.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},Qj=class{constructor(t,e,i,n,r,s){this.id=t,this.data=e,this.object=i,this.actions=pU(e,e.actions,n,r,s,i)}dispatch(){let t=this.actions;
2t.Audio.forEach(t=>t.dispatchConditional()),t.Particles.forEach(t=>t.dispatchConditional()),t.Video.forEach(t=>t.dispatchConditional()),t.Create.forEach(t=>t.dispatch()),t.Destroy.forEach(t=>t.dispatch()),t.Reset.forEach(t=>t.dispatch()),t.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),t.Transition.forEach(t=>t.play()),t.Animation.forEach(t=>t.play()),t.SwitchCamera.forEach(t=>t.play()),t.SceneTransition.forEach(t=>t.dispatch()),t.SetVariable.forEach(t=>t.checkConditions()),t.SetVariable.forEach(t=>t.dispatch()),t.DynamicVariablePlay.forEach(t=>t.dispatch()),t.ClearLocalStorage.forEach(t=>t.dispatch()),t.UserAPI.forEach(t=>t.dispatch())}dispatchReverse(){let t=this.actions;t.Transition.forEach(t=>t.reverseFromCurrent()),t.Particles.forEach(t=>t.reverseFromCurrent()),t.Animation.forEach(t=>t.reverseFromCurrent()),t.SwitchCamera.forEach(t=>t.reverseFromCurrent()),t.Create.forEach(t=>t.dispatchStop())}},Zj=class{constructor(t,e,i,n,r){this.publish=t,this.controlsManager=e,this.animationControls=i,this.eventContext=n,this.sharedVariables=r,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=t=>{let e=window.parent!==window,i=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(t.touches.length>1||this.preventTouchScroll||!1===e&&!1===i)&&t.preventDefault()},this.onMouseWheelPreventScroll=t=>{this.preventScroll&&t.preventDefault()},this.onMouseMove=t=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(t),pressed:t.buttons>0}},this.onMouseDown=t=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(t),pressed:!0}},this.onMouseUp=t=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(t),pressed:!1}},this.getMousePosition=t=>{let{domRect:e}=this.eventContext,{pageX:i,pageY:n}=t.touches?.length>0?t.touches[0]:t;return{x:i-(e.left+window.scrollX),y:n-(e.top+window.scrollY)}},this.stopRaycast=t.stopRaycast,this.preventScroll=t.preventScroll,this.preventTouchScroll=t.preventTouchScroll,this.hideCursor=t.hideCursor,this.requestRender=n.requestRender}activate(t=!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 yk(this.eventContext),VariableChange:new EV(this.eventContext,this.sharedVariables,this,this.needsMouse,this.needsRaycast),API:new Lj(this.eventContext,this),WEBHOOK:new zj(this.eventContext,this),AIAssistantListener:new qj(this.eventContext,this),AIAssistantTrigger:new Yj(this.eventContext,this),Conditional:new Ck(this.eventContext,this),Start:new MV(this.eventContext,this),Basic:new bk(this.eventContext,this,this.needsRaycast),MouseHover:new bV(this.eventContext,this),Scroll:ne
2w _V(this.eventContext,this),Follow:new tV(this.eventContext,this),DragDrop:new Wk(this.eventContext,this),LookAt:new mV(this.eventContext),Resize:new Rj(this.eventContext,this),Textfields:new Hj(this.eventContext,this)};let{page:e,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),e.traverseEntity(t=>{t.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(t=>t.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,t||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(t=!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:e,domElement:i}=this.eventContext;i.style.cursor="",Object.values(this.handlers).forEach(t=>t.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),e.traverseEntity(t=>{t.removeEventListener("requestRender",this.requestRender),t.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),t||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}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(t){let e=this.isEnabled;e&&this.deactivate(),this.eventContext.useWindowEvents=t,e&&this.activate()}initializeActionsDependentStates(){let t=this.eventContext.sharedAssets;t.resetDynamicVariablePlayState();let e=i=>{if("Conditional"===i.data.type&&(i.data.ifActions.forEach(e),i.data.elseActions.forEach(e)),"Conditional"===i.data.type||"SetVariable"===i.data.type)for(let t of"Conditional"===i.data.type?i.data.condition:i.data.expression)"id"in t&&Array.isArray(t.id)&&("mouse"===t.id[0]&&(this.needsMouse=!0),"raycast"===t.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===i.data.type&&""!==i.data.variableId&&("Play"===i.data.mode||"PlayPause"===i.data.mode||"Toggle"===i.data.mode)&&t.setDynamicVariablePlayState(i.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(t=>{if(t.data?.events.length)for(let i of t.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 t of["inActions","outActions"])i.data[t].forEach(e);else if("DragDrop"===i.data.type)for(let t of["drag","drop"])i.data.dragDropActions[t].forEach(e);else if("GameControl"===i.data.type)for(let t of["idle","move","jump","run"])i.data.gameActions[t].forEach(e);else if("Resize"===i.data.type)for(let t of i.data.breakpoints)t.data.actions.forEach(e);else"LookAt"===i.data.type||"API"===i.data.type||i.data.actions.forEach(e)})}},Kj=class{constructor(t,e,i,n,r){this._aspect=1,this.enableResponsive=!1,this._renderer=t,this._camera=e,this._frameSize=(new Ht).copy(i),this._editorSize=(new Ht).copy(n),this._aspect=e.aspect,this._fov=r??e.fov}set frameSize(t){this._frameSize.copy(t)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||"PerspectiveCamera"!==this._camera.cameraType)return;let t=this._frameSize.x,e=this._frameSize.y,i=this._editorSize.y;this._aspect=t/e,e<=i&&(this._camera.zoom*=i/e),this._renderer.setViewport(0,0,t,e)}updateCamera(t=!0){if(this._camera)if("PerspectiveCamera"===this._camera.cameraType){let e=this._frameSize.y,i=this._editorSize.y,n=this._fov;if(t&&e>
2i){let t=function(t,e,i,n,r){return(t-e)/(i-e)*(r-n)+n}(e,1080,2160,1,15)/100;n*=e/i,n*=1-t}this._camera.aspect=this._aspect,this._camera.fov=n,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive)}setCamera(t){this._camera=t,this._aspect=t.aspect,this._fov=t.fov}revert(){let t=window.innerWidth,e=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,t,e),this._renderer.setSize(t,e)),this._camera&&(this._camera.aspect=t/e,this._camera.fov=this._fov,this._camera.setViewplaneSize(t,e,this.enableResponsive),this._camera.updateProjectionMatrix())}};var Jj=class{get sharedAssets(){return this.shared}constructor(t,e={},i=!0){this.shared=new AD(t.shared,e,!0,i),this.scene=new Cz(t.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(t,e){this.scene.clearScene(),this.sharedAssets.reset(t.shared),this.scene.resetAfterClear(t.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let t of this.scene.children)t instanceof mB&&!t.uiScene&&t.personalCamera.updateState(t.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(t=>{t instanceof ID&&t.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}},$j=class{constructor({x:t=10,y:e=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=`${t}px`,this.element.style.top=`${e}px`}dispose(){this.element.parentElement?.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function tG(t){let e;if(t.index)for(let i=0;i<t.index.array.length;i+=3)e=t.index.array[i],t.index.array[i]=t.index.array[i+2],t.index.array[i+2]=e}function eG(t){return t instanceof FD?"SubdivObject":"NonParametricGeometry"===t.geometry.type?"NonParametric":"Mesh"}function iG(t,e){let i=function(t,e){let i={};return t.traverseEntity(t=>{if(!t.visible||!(t instanceof JC)||"Mesh"!==t.type||Array.isArray(t.material)||t.states&&Object.keys(t.states).length)return;let n=t.parent;for(;n;){if(n instanceof JC&&t.states&&Object.keys(t.states).length)return;n=n.parent}let r=t.material.uuid,s=e.shared.materials[r];if(s){if(!zx.isMergable(s))return}else{let i=e.scene.objects.get(t.uuid)?.data;if(i&&"material"in i&&"string"!=typeof i.material){if(!zx.isMergable(i.material))return;r=zx.getHash(i.material)}}i[r]||(i[r]={});let a=i[r][eG(t)];if(a){if(a.push(t),t.cloner)for(let e of t.cloner.children)a.push(e)}else if(i[r][eG(t)]=[t],t.cloner)for(let e of t.cloner.children)i[r][eG(t)].push(e)}),i}(e,t),n=function(t){let e=0;return Object.values(t).forEach(t=>{Object.values(t).forEach(t=>{let i=t.length;i>e&&(e=i)})}),e}(i),r=new Array(n),s=0,a=new Array(n),o=0,l=new Array(n),h=0,c=new Array(n),d=0;for(let[u,p]of Object.entries(i))for(let t of Object.values(p)){if(o=0,h=0,t.forEach(t=>{t instanceof JC&&(a[o++]=t.geometry.clone(),l[h++]=t)}),h<2)continue;for(let t=0;t<h;t++)l[t].updateWorldMatrix(!0,!1),a[t].applyMatrix4(l[t].matrixWorld),l[t].matrixWorld.determinant()<0&&tG(a[t]);let n=Mw(a.slice(0,o),!1);if(n){let t;t=new cn(n,l[0].material),t.castShadow=l[0].castShadow,t.receiveShadow=l[0].receiveShadow,e.add(t);let a=t=>{d=0;for(let e of t)e.children&&a(e.children),e instanceof JC&&(Array.isArray(e.material)||i[e.material.uuid]&&i[e.material.uuid][eG(e)]&&i[e.material.uuid][eG(e)].length>1||(c[d++]=e));for(let i=0;i<d;i++)e.attach(c[i])};for(let e=0;e<h;e++){let t=l[e];a(t.children),r[s++]=t}}}for(let u=0;u<s;u++)r[u].removeFromParent()}var nG=h(v(),1),rG=new Ht;function sG(t){let e=new oE(0,0,0,1);try{e.setStyle(t)}catch(by){}finally{return e}}var aG=class{constructor(t,{renderOnDemand:e,renderMode:i="auto",wasmPath:n}={}){this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHe
2ight=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=t=>{if(this.time=t,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender)){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(t=>{"ParticleSystem"===t.type&&(t.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 t=1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration;this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=t,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=t=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=rG.set(this._viewportWidth,this._viewportHeight)),t){let t=this._viewportWidth,e=this._viewportHeight;this._renderer.setSize(t-1,e-1,!1),this._renderer.setSize(t,e,!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 t=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera("fullscreen"!==t),"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=gm(this._resize,10),this._onScroll=t=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=t,this.renderMode=e?"auto":i,n&&(this._wasmPath=Lm(n,"/")),this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&(this._perfs=new $j({x:10,y:10})),function(t){t.addEventListener("pointerdown",Km,!0),t.addEventListener("pointerdown",$m,!0),t.addEventListener("pointermove",$m,!0),t.addEventListener("pointerup",Jm,!0),t.addEventListener("pointercancel",Jm,!0),t.addEventListener("pointerleave",Jm,!0),window.addEventListener("keydown",eg,!0),window.addEventListener("keyup",ig,!0)}(t)}async load(t,e,i){(function(t){t.endsWith(".spline")||t.endsWith(".splinecode")})(t),this.disposed=!1;let n=await(await fetch(t,i)).arrayBuffer();await this.start(n,{variables:e})}async start(t,{interactive:e=!0,variables:i}={}){if(this.disposed)return;let n=await async function(t){let[e,i]=Jg(yy.deserialize(new Uint8Array(t)));return Aw(e),i.result().data}(t);this._data=n;let r=function(t){let e=[];return t.scene.objects.traverse((t,i)=>{"Mesh"===i.type&&"NonParametricGeometry"===i.geometry.type&&void 0!==i.geometry.data.draco&&e.push(i)}),e}(n);n.version&&(0,nG.default)(n.version,"1.10.42"),this._wasmPath&&this.setUIWasmUrl(`${this._wasmPath}/ui.wasm`),await Promise.all([r.length&&Tj(this._wasmPath),jI(n)&&BC(this._wasmPath),zD(n)&&cC(this._wasmPath),Ab.physicsEnabled(n.scene.objects)&&cg(),iI(n)&&eD(),mz(n)&&Sz(),XT(n)&&HT(),LL(n)&&RL(),FV(n)&&ag(this._wasmPath)].filter(
2Boolean)),r.length&&await async function(t){for(let e of t){let t=await Dj(e.geometry.data.draco);if(t){let i=e.geometry.data;t.index&&(i.index={array:t.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let n={};t.attributes.forEach(({name:t,array:e,itemSize:i})=>{n[t]={array:e,itemSize:i,type:"Float32Array",normalized:!1}}),i.attributes=n,i.draco=void 0}}}(r),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let s=new Jj(n);if(s.resetPersonalCameraFromDocumentData(),this._scene=s.scene,this._sharedAssetsManager=s.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){performance.now();iG(n,s.scene);performance.now()}jI(n)&&this._scene.traverse(t=>{XI(t)&&t.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(t=>{t instanceof bI&&t.pendingMediaLoad&&t.update()})}),this._scene?.traverse(t=>{"ParticleSystem"===t.type&&(t.wakeUp(),t.data.autoPlay?t.start():t.stop())});let a=Object.keys(n.shared.fonts).map(t=>this._sharedAssetsManager.getFont(t).loadingPromise);if(Promise.all(a).then(()=>{s.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode()}),iI(n)&&function(t){if(Ab.physicsEnabled(t.scene.objects))return!0;let e=!1;return t.scene.objects.traverse((t,i)=>{if(i.events)if(Array.isArray(i.events)){for(let n of i.events)if(!0!==n.data.disabled&&"GameControl"===n.data.type&&n.data.collisionEnabled){e=!0;break}}else for(let n of Object.values(i.events))if(!0!==n.disabled&&"GameControl"===n.type&&n.collisionEnabled){e=!0;break}}),e}(n)&&await Promise.all(a),LL(n)){let t=[];this._scene.traverseEntity(e=>{(e instanceof MB||e instanceof mB)&&e.uiCanvas&&t.push(e.uiCanvas)}),await Promise.all(t.map(t=>t.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),HN(this._scene.activePage,this._sharedAssetsManager),!this._renderer&&(this._renderer=new tL({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._renderer.hdTransmission=!0===n.scene.publish.hdTransmission,this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),n.shared.images.SplineWatermark)){let t=this._sharedAssetsManager.getImage("SplineWatermark");await t.loadPromise;let e=t.getTexture(1001);this._renderer.pipeline.setWatermark(e)}mz(n)&&this._scene.initializeSplatViewer(),void 0!==n.scene.blueNoiseTextureData&&this._renderer.pipeline.updateBlueNoiseTexture(n.scene.blueNoiseTextureData);let o=Object.values(n.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===o.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=o.size[0],this._viewportHeight=o.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 Kj(this._renderer,this._camera,new Ht(this._viewportWidth,this._viewportHeight),new Ht(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(o.allowResponsive??!1)&&"fullscreen"===o.preset),e){let t=new uk(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,o);this._scene.updateMatrixWorld(!0),this._controls=new wj(t),this._animationControls=new Mj(this._scene,this._requestRenderAutoMode),this._eventManager=new Zj(n.scene.publish,this._controls,this._animationControls,t,n.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._resize(!0)}),void 0!==i&&this.setVariables(i),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(()=>
2{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(t){if(void 0!==this._data){let e=Object.entries(t);for(let[t,i]of e)this.setVariable(t,i)}}setVariable(t,e){let i=this._getVariableByName(t);if(i&&!("dynamicVariableType"in i.data)){let t=e;"number"==typeof i.data.value?t="number"==typeof e?e:"boolean"==typeof e?!0===e?1:0:parseFloat(e):"boolean"==typeof i.data.value?t="number"==typeof e?!!e:"boolean"==typeof e?e:"false"!==e.toLocaleLowerCase()&&!!e:"string"!=typeof i.data.value&&void 0!==i.data.value.textValue&&(t=e.toString());let n="string"==typeof t?{textValue:t}:t;this._sharedAssetsManager?.updateVariable(i.id,n),this.requestRender(),this._requestRenderAutoMode()}else void 0===i||i.data}getVariables(){let t={};return this._data&&this._data.shared.variables.forEach(e=>{void 0===t[e.data.name]&&(t[e.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(e.id)))}),t}getVariable(t){let e=this._getVariableByName(t);if(e){let t=this._sharedAssetsManager.getVariable(e.id);return this._getVariableValue(t)}}_getVariableValue(t){return"string"!=typeof t&&Tb.isTextValue(t)?Tb.getDisplayedValue(t):t}_getVariableByName(t){if(this._data){if(this._variablesCache.has(t))return this._variablesCache.get(t);let e=this._data.shared.variables.find(e=>e.data.name===t);return e&&this._variablesCache.set(t,e),e}}findObjectById(t){let e=this._scene?.getObjectByProperty("uuid",t);return this._createProxyObject(e)}findObjectByName(t){let e=this._scene?.getObjectByName(t);return this._createProxyObject(e)}getAllObjects(){let t=[];return this._scene?.traverseEntity(e=>{if(!(e.uuid===sx||this._scene.isInvisibleObjects(e)||e instanceof mB)){let i=this._createProxyObject(e);i&&t.push(i)}}),t}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEvent(t)}emitEventReverse(t,e){(this.findObjectById(e)||this.findObjectByName(e))?.emitEventReverse(t)}addEventListener(t,e){this.canvas.addEventListener(t,e)}removeEventListener(t,e){this.canvas.removeEventListener(t,e)}setZoom(t){this._controls?.orbitControls instanceof $V&&this._controls?.orbitControls.setZoom(t)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(t,e){this._viewportWidth=t,this._viewportHeight=e,this._viewportMode=2,this._resize()}setBackgroundColor(t){let e=sG(t);this._scene?.activePage.setBackgroundColor(e),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._eventManager?.deactivate(),this._scene?.dispose(),this._sharedAssetsManager?.dispose(),this._proxyObjectCache.forEach(t=>{ac.unsubscribe(t)}),this._variablesCache.clear(),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._sharedAssetsManager?.dispose(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&clearTimeout(this._resizeObserverTimeout),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView&&(this._frameView=void 0),this._controls?.deactivate(),this.dt=0,function(t){t.removeEventListener("pointerdown",Km,!0),t.removeEventListener("pointerdown",$m,!0),t.removeEventListener("pointermove",$m,!0),t.removeEventListener("pointerup",Jm,!0),t.removeEventListener("pointercancel",Jm,!0),t.removeEventListener("pointerleave",Jm,!0),window.removeEventListener("keydown",eg,!0),window.removeEventListener("keyup",ig,!0)}(this.canvas),document.removeEventListener("scroll",this._onScroll)}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(t){this._eventManager?.updateUseWindowEvents(t)}get data(){return this._data}_createProxyObject(t){if(!this._scene||null==t)return;if(this._proxyObjectCache.has(t.uuid))return this._proxyObjectCache.get(t.uuid);let e;t.traverseAncestors(t=>{t instanceof mB&&(e=t.name)});let i=this._sharedAssetsManager,n={shared:i,scene:this._scene},r=e=>{if(null===e||"Base State"===e)return null;if(e&&t.data.states){let i=t.data.states.find(t=>t.data.name===e);return i?i.id:void 0}},s={name:t.name,uuid:t.uuid,visible:t.visible,intensity:t.intensity,position:t.position,rotation:t.rotation,scale:t.scale,type:t.data.type,page:e,parentUuid:t.parent instanceof mB||t instanceof Cz?void 0:t.parent?.uuid,emitEvent(e){t.dispatchEvent({type:"userEvent",eventName:e})},emitEventReverse(e){t.dispatchEvent({type:"userEvent",eventName:e,reverse:!0})},hide(){t.visible&&(t.visible=!1,n.shared.requestRender())},show(){t.visible||(t.visible=!0,n.shared.requestRender())},get state(){let e=t.stateSelection;if(null!==e)return t.data.states.find(({id:t})=>t===e)?.data.name},set state(e){let i;if(void 0!==e){let n="string"==typeof e?t.data.states.find(({id:t})=>t===e):t.data.states[e];if(n)i=n.id;else{let t="string"==typeof e?r(e):void 0;t&&(i=t)}}t.changeSelectedState(i??null,n),t.currentState=i??null,t.dispatchEvent({type:"completeState",state:i??null}),n.shared.requestRender()},transition(e){let n,s=this,a=mN.timeline({autoplay:e.autoPlay??!0}),o={transition({from:e,to:o,duration:l,delay:h,...c}){let d=r(e);void 0===d&&(d=n);let u=r(o);n=u;let p=new JN(t,d,u,{state:u,repeat:0,delay:h??0,delayDirection:"start-once",direction:"normal",duration:l??1e3,...c,...6===c.easing?lx.defaultData:5===c.easing?hx.defaultData:{}},i,!1);return a.add({...p.params,begin:()=>{(e&&d||"Base State"===e&&!d)&&(s.state=d??void 0)},complete:()=>{s.state=u??void 0}},a.duration),this},play(){return a.play(),this},pause(){return a.pause(),this},reset(){return a.reset(),this},seek(t){return a.seek(t),this}};return o.transition(e),o},set color(e){let i=sG(e);if(GI.is(t))return void(t.color=i);if(!("Mesh"===t.type&&"material"in t&&t instanceof MD))return;let r={r:i.r,g:i.g,b:i.b,a:i.a},s=Array.isArray(t.material)?t.material[0]:t.material,a=s.data.layers.find(t=>"color"===t.data.type)?.id;a&&s.updateByOp({type:0,path:["layers",a],props:{color:{...r}}},s.data,n)}},a=ac(s,(e,i)=>{"object"!=typeof t[e]&&Object.getOwnPropertyDescriptor(t,e)?.writable&&(t[e]=i),this._requestRenderAutoMode(),t.updateMatrix()});return this._proxyObjectCache.set(t.uuid,a),a}setUIWasmUrl(t){LP.skiaWasmUrl=t}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}};export{aG as Z,e as _};
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.