(globalThis.webpackChunk_N_E=globalThis.webpackChunk_N_E||[]).push([[49710],{64467:function(e,t,n){"use strict";n.d(t,{Mx:function(){return WH}});var i=n(62157),r=n(51487),a=n(88255),o=n(19015),s=n(28285),l=n(48834),u=n(40886),c=n(55650),h=n(47982),d=n(42199),f=n(63675),v=n(44954),p=n(88180),m=n(30598),g=n(2356),y=n(684),x=n.n(y),b=n(37720),w=n(39202);e=n.hmd(e);var S,_,A=n(43954),M=n(27784).Buffer;function E(){E=function(e,t){return new n(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function n(e,r,a){var o=RegExp(e,r);return t.set(o,a||t.get(e)),(0,i.Z)(o,n.prototype)}function r(e,n){var i=t.get(n);return Object.keys(i).reduce((function(t,n){var r=i[n];if("number"==typeof r)t[n]=e[r];else{for(var a=0;void 0===e[r[a]]&&a+1]+)(>|$)/g,(function(e,t,n){if(""===n)return e;var i=a[t];return Array.isArray(i)?"$"+i.join("$"):"number"==typeof i?"$"+i:""})))}if("function"==typeof i){var o=this;return e[Symbol.replace].call(this,n,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(r(e,o)),i.apply(this,e)}))}return e[Symbol.replace].call(this,n,i)},E.apply(this,arguments)}function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function k(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)};return t.version="Mash 0.9",t}}))})),j=N((function(e,t){!function(i,r){"object"==typeof e&&typeof t<"u"?r(e):"function"==typeof define&&n.amdO?define(["exports"],r):r((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})}(e,(function(e){e.SVD=function(e,t,n,i,r){if(t=void 0===t||t,n=void 0===n||n,r=1e-64/(i=i||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var a,o,s,l,u,c,h,d,f,v,p,m,g=e[0].length,y=e.length;if(y0){for(t=1,n=1;tH&&(H=j,W=[]),W.push(e))}function J(e,t,i){return new n(n.buildMessage(e,t),e,t,i)}function $(){var e,t,n,i,a;for(e=j,t=[],n=ye();n!==r;)t.push(n),n=ye();if(t!==r)if((n=function(){var e,t,n,i,a,o;if(e=j,(t=ee())!==r){for(n=[],i=j,a=[],o=ye();o!==r;)a.push(o),o=ye();for(a!==r?(o=ee())!==r?i=a=[a,o]:(j=i,i=r):(j=i,i=r);i!==r;){for(n.push(i),i=j,a=[],o=ye();o!==r;)a.push(o),o=ye();a!==r?(o=ee())!==r?i=a=[a,o]:(j=i,i=r):(j=i,i=r)}n!==r?(e,e=t=s(t,n)):(j=e,e=r)}else j=e,e=r;return e}())===r&&(n=null),n!==r){for(i=[],a=ye();a!==r;)i.push(a),a=ye();i!==r?(e,e=t=function(e){if(!e)return[];for(var t=[],n=0;no)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!isNaN(o))return-1}return 0}})),Y="149",Q=0,K=1,J=2,$=3,ee=100,te=301,ne=302,ie=306,re=1e3,ae=1001,oe=1002,se=1003,le=1005,ue=1006,ce=1008,he=1009,de=1012,fe=1014,ve=1015,pe=1016,me=1020,ge=1023,ye=1026,xe=1027,be=1028,we=1030,Se=1033,_e=33776,Ae=33777,Me=33778,Ee=33779,Ce=35840,ke=35841,Te=35842,Pe=35843,De=37492,Oe=37496,Ie=37808,Re=37809,Le=37810,Be=37811,ze=37812,Fe=37813,Ne=37814,Ue=37815,Ze=37816,Ve=37817,je=37818,Ge=37819,He=37820,We=37821,qe=36492,Xe=36284,Ye=36285,Qe=36286,Ke=2201,Je=2202,$e=2300,et=2301,tt=2302,nt=2400,it=2401,rt=2402,at=2500,ot=3e3,st=3001,lt=3200,ut=3201,ct="srgb",ht="srgb-linear",dt=7680,ft=35044,vt="300 es",pt=1035,mt=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,[{key:"addEventListener",value:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}}},{key:"dispatchEvent",value:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i>8&255]+gt[e>>16&255]+gt[e>>24&255]+"-"+gt[255&t]+gt[t>>8&255]+"-"+gt[t>>16&15|64]+gt[t>>24&255]+"-"+gt[63&n|128]+gt[n>>8&255]+"-"+gt[n>>16&255]+gt[n>>24&255]+gt[255&i]+gt[i>>8&255]+gt[i>>16&255]+gt[i>>24&255]).toLowerCase()}function St(e,t,n){return Math.max(t,Math.min(n,e))}function _t(e,t){return(e%t+t)%t}function At(e,t,n){return(1-n)*e+n*t}function Mt(e){return 0===(e&e-1)&&0!==e}function Et(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Ct(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Tt(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}var Pt=Object.freeze({__proto__:null,DEG2RAD:xt,RAD2DEG:bt,ceilPowerOfTwo:Et,clamp:St,damp:function(e,t,n,i){return At(e,t,1-Math.exp(-n*i))},degToRad:function(e){return e*xt},denormalize:kt,euclideanModulo:_t,floorPowerOfTwo:Ct,generateUUID:wt,inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},isPowerOfTwo:Mt,lerp:At,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},normalize:Tt,pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(_t(e,2*t)-t)},radToDeg:function(e){return e*bt},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},seededRandom:function(e){void 0!==e&&(yt=e);var t=yt+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+i)/2),c=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),f=a((i-t)/2),v=o((i-t)/2);switch(r){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*v,l*f,s*u);break;case"YXY":e.set(l*f,s*c,l*v,s*u);break;case"ZYZ":e.set(l*v,l*f,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)}}),Dt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,b.Z)(this,e),e.prototype.isVector2=!0,this.x=t,this.y=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value:function(){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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){return Math.atan2(-this.y,-this.x)+Math.PI}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}},{key:"rotateAround",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))},{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}}]),e}(),Ot=function(){function e(){(0,b.Z)(this,e),e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}return(0,w.Z)(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=t,u[4]=r,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],f=n[8],v=i[0],p=i[3],m=i[6],g=i[1],y=i[4],x=i[7],b=i[2],w=i[5],S=i[8];return r[0]=a*v+o*g+s*b,r[3]=a*p+o*y+s*w,r[6]=a*m+o*x+s*S,r[1]=l*v+u*g+c*b,r[4]=l*p+u*y+c*w,r[7]=l*m+u*x+c*S,r[2]=h*v+d*g+f*b,r[5]=h*p+d*y+f*w,r[8]=h*m+d*x+f*S,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8];return t*a*u-t*o*l-n*r*u+n*o*s+i*r*l-i*a*s}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*r,d=l*r-a*s,f=t*c+n*h+i*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var v=1/f;return e[0]=c*v,e[1]=(i*l-u*n)*v,e[2]=(o*n-i*a)*v,e[3]=h*v,e[4]=(u*t-i*s)*v,e[5]=(i*r-o*t)*v,e[6]=d*v,e[7]=(n*s-l*t)*v,e[8]=(a*t-n*r)*v,this}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}},{key:"setUvTransform",value:function(e,t,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1),this}},{key:"scale",value:function(e,t){return this.premultiply(It.makeScale(e,t)),this}},{key:"rotate",value:function(e){return this.premultiply(It.makeRotation(-e)),this}},{key:"translate",value:function(e,t){return this.premultiply(It.makeTranslation(e,t)),this}},{key:"makeTranslation",value:function(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}},{key:"makeRotation",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}},{key:"makeScale",value:function(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}(),It=new Ot;function Rt(e){for(var t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var Lt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Bt(e,t){return new Lt[e](t)}function zt(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Ft(e,t,n){return new Promise((function(i,r){setTimeout((function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:i()}}),n)}))}function Nt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Ut(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Zt=(S={},(0,g.Z)(S,ct,(0,g.Z)({},ht,Nt)),(0,g.Z)(S,ht,(0,g.Z)({},ct,Ut)),S),Vt={legacyMode:!0,get workingColorSpace(){return ht},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Zt[t]&&void 0!==Zt[t][n]){var i=Zt[t][n];return e.r=i(e.r),e.g=i(e.g),e.b=i(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},jt={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:3139294,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:3139294,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},Gt={r:0,g:0,b:0},Ht={h:0,s:0,l:0},Wt={h:0,s:0,l:0};function qt(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Xt(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var Yt=function(){function e(t,n,i){return(0,b.Z)(this,e),this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===n&&void 0===i?this.set(t):this.setRGB(t,n,i)}return(0,w.Z)(e,[{key:"set",value:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Vt.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Vt.workingColorSpace;return this.r=e,this.g=t,this.b=n,Vt.toWorkingColorSpace(this,i),this}},{key:"setHSL",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Vt.workingColorSpace;if(e=_t(e,1),t=St(t,0,1),n=St(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=qt(a,r,e+1/3),this.g=qt(a,r,e),this.b=qt(a,r,e-1/3)}return Vt.toWorkingColorSpace(this,i),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct;function i(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var r,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,Vt.toWorkingColorSpace(this,n),i(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,Vt.toWorkingColorSpace(this,n),i(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(r[1])/360,l=parseFloat(r[2])/100,u=parseFloat(r[3])/100;return i(r[4]),this.setHSL(s,l,u,n)}}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=t[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,Vt.toWorkingColorSpace(this,n),this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,Vt.toWorkingColorSpace(this,n),this}return e&&e.length>0?this.setColorName(e,n):this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct,n=jt[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=Nt(e.r),this.g=Nt(e.g),this.b=Nt(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=Ut(e.r),this.g=Ut(e.g),this.b=Ut(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return Vt.fromWorkingColorSpace(Xt(this,Gt),e),St(255*Gt.r,0,255)<<16^St(255*Gt.g,0,255)<<8^St(255*Gt.b,0,255)<<0}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Vt.workingColorSpace;Vt.fromWorkingColorSpace(Xt(this,Gt),t);var n,i,r=Gt.r,a=Gt.g,o=Gt.b,s=Math.max(r,a,o),l=Math.min(r,a,o),u=(l+s)/2;if(l===s)n=0,i=0;else{var c=s-l;switch(i=u<=.5?c/(s+l):c/(2-s-l),s){case r:n=(a-o)/c+(a1&&void 0!==arguments[1]?arguments[1]:Vt.workingColorSpace;return Vt.fromWorkingColorSpace(Xt(this,Gt),t),e.r=Gt.r,e.g=Gt.g,e.b=Gt.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct;return Vt.fromWorkingColorSpace(Xt(this,Gt),e),e!==ct?"color(".concat(e," ").concat(Gt.r," ").concat(Gt.g," ").concat(Gt.b,")"):"rgb(".concat(255*Gt.r|0,",").concat(255*Gt.g|0,",").concat(255*Gt.b|0,")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Ht),Ht.h+=e,Ht.s+=t,Ht.l+=n,this.setHSL(Ht.h,Ht.s,Ht.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Ht),e.getHSL(Wt);var n=At(Ht.h,Wt.h,t),i=At(Ht.s,Wt.s,t),r=At(Ht.l,Wt.l,t);return this.setHSL(n,i,r),this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}},{key:"toJSON",value:function(){return this.getHex()}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.r;case 2:return e.next=4,this.g;case 4:return e.next=6,this.b;case 6:case"end":return e.stop()}}),e,this)}))}]),e}();Yt.NAMES=jt;var Qt,Kt=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Qt&&(Qt=zt("canvas")),Qt.width=e.width,Qt.height=e.height;var n=Qt.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Qt}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){var t=zt("canvas");t.width=e.width,t.height=e.height;var n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);for(var i=n.getImageData(0,0,e.width,e.height),r=i.data,a=0;a0&&void 0!==arguments[0]?arguments[0]:null;(0,b.Z)(this,e),this.isSource=!0,this.uuid=wt(),this.data=t,this.version=0}return(0,w.Z)(e,[{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},i=this.data;if(null!==i){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ae,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ae,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ue,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:ce,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:ge,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:he,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:n.DEFAULT_ANISOTROPY,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:ot;return(0,b.Z)(this,n),(e=t.call(this)).isTexture=!0,Object.defineProperty((0,f.Z)(e),"id",{value:en++}),e.uuid=wt(),e.name="",e.source=new Jt(i),e.mipmaps=[],e.mapping=r,e.wrapS=a,e.wrapT=o,e.magFilter=s,e.minFilter=l,e.anisotropy=h,e.format=u,e.internalFormat=null,e.type=c,e.offset=new Dt(0,0),e.repeat=new Dt(1,1),e.center=new Dt(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new Ot,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.encoding=d,e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return(0,w.Z)(n,[{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case re:e.x=e.x-Math.floor(e.x);break;case ae:e.x=e.x<0?0:1;break;case oe:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case re:e.y=e.y-Math.floor(e.y);break;case ae:e.y=e.y<0?0:1;break;case oe:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}},{key:"image",get:function(){return this.source.data},set:function(e){this.source.data=e}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}]),n}(mt);tn.DEFAULT_IMAGE=null,tn.DEFAULT_MAPPING=300,tn.DEFAULT_ANISOTROPY=1;var nn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,b.Z)(this,e),e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=i,this.w=r}return(0,w.Z)(e,[{key:"set",value:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],u=a[1],c=a[5],h=a[9],d=a[2],f=a[6],v=a[10];if(Math.abs(s-u)<.01&&Math.abs(l-d)<.01&&Math.abs(h-f)<.01){if(Math.abs(s+u)<.1&&Math.abs(l+d)<.1&&Math.abs(h+f)<.1&&Math.abs(o+c+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var p=(o+1)/2,m=(c+1)/2,g=(v+1)/2,y=(s+u)/4,x=(l+d)/4,b=(h+f)/4;return p>m&&p>g?p<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(p)),r=x/n):m>g?m<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(m)),r=b/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(g)),i=b/r),this.set(n,i,r,t),this}var w=Math.sqrt((f-h)*(f-h)+(l-d)*(l-d)+(u-s)*(u-s));return Math.abs(w)<.001&&(w=1),this.x=(f-h)/w,this.y=(l-d)/w,this.z=(u-s)/w,this.w=Math.acos((o+c+v-1)/2),this}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){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}},{key:"ceil",value:function(){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}},{key:"round",value:function(){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}},{key:"roundToZero",value:function(){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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))},{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}}]),e}(),rn=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,b.Z)(this,n),(e=t.call(this)).isWebGLRenderTarget=!0,e.width=i,e.height=r,e.depth=1,e.scissor=new nn(0,0,i,r),e.scissorTest=!1,e.viewport=new nn(0,0,i,r);var o={width:i,height:r,depth:1};return e.texture=new tn(o,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),e.texture.isRenderTargetTexture=!0,e.texture.flipY=!1,e.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,e.texture.internalFormat=void 0!==a.internalFormat?a.internalFormat:null,e.texture.minFilter=void 0!==a.minFilter?a.minFilter:ue,e.depthBuffer=void 0===a.depthBuffer||a.depthBuffer,e.stencilBuffer=void 0!==a.stencilBuffer&&a.stencilBuffer,e.depthTexture=void 0!==a.depthTexture?a.depthTexture:null,e.samples=void 0!==a.samples?a.samples:0,e}return(0,w.Z)(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;var t=Object.assign({},e.texture.image);return this.texture.source=new Jt(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(mt),an=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return(0,b.Z)(this,n),(e=t.call(this,null)).isDataArrayTexture=!0,e.image={data:i,width:r,height:a,depth:o},e.magFilter=se,e.minFilter=se,e.wrapR=ae,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return n}(tn),on=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return(0,b.Z)(this,n),(e=t.call(this,null)).isData3DTexture=!0,e.image={data:i,width:r,height:a,depth:o},e.magFilter=se,e.minFilter=se,e.wrapR=ae,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return n}(tn),sn=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};(0,b.Z)(this,n),(e=t.call(this,i,r,o)).isWebGLMultipleRenderTargets=!0;var s=e.texture;e.texture=[];for(var l=0;l2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(var i=0,r=this.texture.length;i0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,b.Z)(this,e),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=r}return(0,w.Z)(e,[{key:"set",value:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(i/2),c=o(r/2),h=s(n/2),d=s(i/2),f=s(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"YXZ":this._x=h*u*c+l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"ZXY":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c-h*d*f;break;case"ZYX":this._x=h*u*c-l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c+h*d*f;break;case"YZX":this._x=h*u*c+l*d*f,this._y=l*d*c+h*u*f,this._z=l*u*f-h*d*c,this._w=l*u*c-h*d*f;break;case"XZY":this._x=h*u*c-l*d*f,this._y=l*d*c-h*u*f,this._z=l*u*f+h*d*c,this._w=l*u*c+h*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(r-l)*d,this._z=(a-i)*d}else if(n>o&&n>c){var f=2*Math.sqrt(1+n-o-c);this._w=(u-s)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(r+l)/f}else if(o>c){var v=2*Math.sqrt(1+o-n-c);this._w=(r-l)/v,this._x=(i+a)/v,this._y=.25*v,this._z=(s+u)/v}else{var p=2*Math.sqrt(1+c-n-o);this._w=(a-i)/p,this._x=(r+l)/p,this._y=(s+u)/p,this._z=.25*p}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(St(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e){return this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+i*l-r*s,this._y=i*u+a*s+r*o-n*l,this._z=r*u+a*l+n*s-i*o,this._w=a*u-n*o-i*s-r*l,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._w;case 8:case"end":return e.stop()}}),e,this)}))},{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}],[{key:"slerpFlat",value:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],f=r[a+2],v=r[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=f,void(e[t+3]=v);if(c!==v||s!==h||l!==d||u!==f){var p=1-o,m=s*h+l*d+u*f+c*v,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,m*g);p=Math.sin(p*b)/x,o=Math.sin(o*b)/x}var w=o*g;if(s=s*p+h*w,l=l*p+d*w,u=u*p+f*w,c=c*p+v*w,p===1-o){var S=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=S,l*=S,u*=S,c*=S}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],f=r[a+3];return e[t]=o*f+u*c+s*d-l*h,e[t+1]=s*f+u*h+l*c-o*d,e[t+2]=l*f+u*d+o*h-s*c,e[t+3]=u*f-o*c-s*h-l*d,e}}]),e}(),un=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;(0,b.Z)(this,e),e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=i}return(0,w.Z)(e,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value:function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return this.applyQuaternion(hn.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(hn.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,u=s*n+o*t-r*i,c=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+u*-o-c*-a,this.y=u*s+h*-a+c*-r-l*-o,this.z=c*s+h*-o+l*-a-u*-r,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}},{key:"clamp",value:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value:function(){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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value:function(e){return this.crossVectors(this,e)}},{key:"crossVectors",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return cn.copy(this).projectOnVector(e),this.sub(cn)}},{key:"reflect",value:function(e){return this.sub(cn.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(St(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value:function(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),e}(),cn=new un,hn=new ln,dn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un(-1/0,-1/0,-1/0);(0,b.Z)(this,e),this.isBox3=!0,this.min=t,this.max=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;sr&&(r=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this}},{key:"setFromBufferAttribute",value:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;sr&&(r=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);var n=e.geometry;if(void 0!==n)if(t&&null!=n.attributes&&void 0!==n.attributes.position)for(var i=n.attributes.position,r=0,a=i.count;rthis.max.x||e.ythis.max.y||e.zthis.max.z)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,vn),vn.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(Sn),_n.subVectors(this.max,Sn),mn.subVectors(e.a,Sn),gn.subVectors(e.b,Sn),yn.subVectors(e.c,Sn),xn.subVectors(gn,mn),bn.subVectors(yn,gn),wn.subVectors(mn,yn);var t=[0,-xn.z,xn.y,0,-bn.z,bn.y,0,-wn.z,wn.y,xn.z,0,-xn.x,bn.z,0,-bn.x,wn.z,0,-wn.x,-xn.y,xn.x,0,-bn.y,bn.x,0,-wn.y,wn.x,0];return!(!En(t,mn,gn,yn,_n)||(t=[1,0,0,0,1,0,0,0,1],!En(t,mn,gn,yn,_n)))&&(An.crossVectors(xn,bn),En(t=[An.x,An.y,An.z],mn,gn,yn,_n))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return vn.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return this.getCenter(e.center),e.radius=.5*this.getSize(vn).length(),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fn)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),fn=[new un,new un,new un,new un,new un,new un,new un,new un],vn=new un,pn=new dn,mn=new un,gn=new un,yn=new un,xn=new un,bn=new un,wn=new un,Sn=new un,_n=new un,An=new un,Mn=new un;function En(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){Mn.fromArray(e,a);var s=r.x*Math.abs(Mn.x)+r.y*Math.abs(Mn.y)+r.z*Math.abs(Mn.z),l=t.dot(Mn),u=n.dot(Mn),c=i.dot(Mn);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var Cn=new dn,kn=new un,Tn=new un,Pn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;(0,b.Z)(this,e),this.center=t,this.radius=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Cn.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;kn.subVectors(e,this.center);var t=kn.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),i=.5*(n-this.radius);this.center.addScaledVector(kn,i/n),this.radius+=i}return this}},{key:"union",value:function(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Tn.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(kn.copy(e.center).add(Tn)),this.expandByPoint(kn.copy(e.center).sub(Tn))),this)}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Dn=new un,On=new un,In=new un,Rn=new un,Ln=new un,Bn=new un,zn=new un,Fn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un(0,0,-1);(0,b.Z)(this,e),this.origin=t,this.direction=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Dn)),this}},{key:"closestPointToPoint",value:function(e,t){t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Dn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Dn.copy(this.direction).multiplyScalar(t).add(this.origin),Dn.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,i){On.copy(e).add(t).multiplyScalar(.5),In.copy(t).sub(e).normalize(),Rn.copy(this.origin).sub(On);var r,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(In),c=Rn.dot(this.direction),h=-Rn.dot(In),d=Rn.lengthSq(),f=Math.abs(1-u*u);if(f>0)if(a=u*c-h,s=l*f,(r=u*h-c)>=0)if(a>=-s)if(a<=s){var v=1/f;o=(r*=v)*(r+u*(a*=v)+2*c)+a*(u*r+a+2*h)+d}else a=l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a=-l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-u*l+c)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(r=Math.max(0,-(u*l+c)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(r=Math.max(0,-(u*a+c)))*r+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(In).multiplyScalar(a).add(On),o}},{key:"intersectSphere",value:function(e,t){Dn.subVectors(e.center,this.origin);var n=Dn.dot(this.direction),i=Dn.dot(Dn)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i||((r>n||isNaN(n))&&(n=r),(a=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),n>s||o>i)||((o>n||n!==n)&&(n=o),(s=0?n:i,t)}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,Dn)}},{key:"intersectTriangle",value:function(e,t,n,i,r){Ln.subVectors(t,e),Bn.subVectors(n,e),zn.crossVectors(Ln,Bn);var a,o=this.direction.dot(zn);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Rn.subVectors(this.origin,e);var s=a*this.direction.dot(Bn.crossVectors(Rn,Bn));if(s<0)return null;var l=a*this.direction.dot(Ln.cross(Rn));if(l<0||s+l>o)return null;var u=-a*Rn.dot(zn);return u<0?null:this.at(u/o,r)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Nn=function(){function e(){(0,b.Z)(this,e),e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}return(0,w.Z)(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l,u,c,h,d,f,v,p){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=f,m[11]=v,m[15]=p,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,i=1/Un.setFromMatrixColumn(e,0).length(),r=1/Un.setFromMatrixColumn(e,1).length(),a=1/Un.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromEuler",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){var h=a*u,d=a*c,f=o*u,v=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+f*l,t[5]=h-v*l,t[9]=-o*s,t[2]=v-h*l,t[6]=f+d*l,t[10]=a*s}else if("YXZ"===e.order){var p=s*u,m=s*c,g=l*u,y=l*c;t[0]=p+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+p*o,t[10]=a*s}else if("ZXY"===e.order){var x=s*u,b=s*c,w=l*u,S=l*c;t[0]=x-S*o,t[4]=-a*c,t[8]=w+b*o,t[1]=b+w*o,t[5]=a*u,t[9]=S-x*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var _=a*u,A=a*c,M=o*u,E=o*c;t[0]=s*u,t[4]=M*l-A,t[8]=_*l+E,t[1]=s*c,t[5]=E*l+_,t[9]=A*l-M,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var C=a*s,k=a*l,T=o*s,P=o*l;t[0]=s*u,t[4]=P-C*c,t[8]=T*c+k,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=k*c+T,t[10]=C-P*c}else if("XZY"===e.order){var D=a*s,O=a*l,I=o*s,R=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=D*c+R,t[5]=a*u,t[9]=O*c-I,t[2]=I*c-O,t[6]=o*u,t[10]=R*c+D}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Vn,e,jn)}},{key:"lookAt",value:function(e,t,n){var i=this.elements;return Wn.subVectors(e,t),0===Wn.lengthSq()&&(Wn.z=1),Wn.normalize(),Gn.crossVectors(n,Wn),0===Gn.lengthSq()&&(1===Math.abs(n.z)?Wn.x+=1e-4:Wn.z+=1e-4,Wn.normalize(),Gn.crossVectors(n,Wn)),Gn.normalize(),Hn.crossVectors(Wn,Gn),i[0]=Gn.x,i[4]=Hn.x,i[8]=Wn.x,i[1]=Gn.y,i[5]=Hn.y,i[9]=Wn.y,i[2]=Gn.z,i[6]=Hn.z,i[10]=Wn.z,this}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],f=n[2],v=n[6],p=n[10],m=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=i[0],S=i[4],_=i[8],A=i[12],M=i[1],E=i[5],C=i[9],k=i[13],T=i[2],P=i[6],D=i[10],O=i[14],I=i[3],R=i[7],L=i[11],B=i[15];return r[0]=a*w+o*M+s*T+l*I,r[4]=a*S+o*E+s*P+l*R,r[8]=a*_+o*C+s*D+l*L,r[12]=a*A+o*k+s*O+l*B,r[1]=u*w+c*M+h*T+d*I,r[5]=u*S+c*E+h*P+d*R,r[9]=u*_+c*C+h*D+d*L,r[13]=u*A+c*k+h*O+d*B,r[2]=f*w+v*M+p*T+m*I,r[6]=f*S+v*E+p*P+m*R,r[10]=f*_+v*C+p*D+m*L,r[14]=f*A+v*k+p*O+m*B,r[3]=g*w+y*M+x*T+b*I,r[7]=g*S+y*E+x*P+b*R,r[11]=g*_+y*C+x*D+b*L,r[15]=g*A+y*k+x*O+b*B,this}},{key:"multiplyScalar",value:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}},{key:"determinant",value:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+r*s*c-i*l*c-r*o*h+n*l*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+r*a*h-i*a*d+i*l*u-r*s*u)+e[11]*(+t*l*c-t*o*d-r*a*c+n*a*d+r*o*u-n*l*u)+e[15]*(-i*o*u-t*s*c+t*o*h+i*a*c-n*a*h+n*s*u)}},{key:"transpose",value:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}},{key:"setPosition",value:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}},{key:"invert",value:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],f=e[12],v=e[13],p=e[14],m=e[15],g=c*p*l-v*h*l+v*s*d-o*p*d-c*s*m+o*h*m,y=f*h*l-u*p*l-f*s*d+a*p*d+u*s*m-a*h*m,x=u*v*l-f*c*l+f*o*d-a*v*d-u*o*m+a*c*m,b=f*c*s-u*v*s-f*o*h+a*v*h+u*o*p-a*c*p,w=t*g+n*y+i*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);var S=1/w;return e[0]=g*S,e[1]=(v*h*r-c*p*r-v*i*d+n*p*d+c*i*m-n*h*m)*S,e[2]=(o*p*r-v*s*r+v*i*l-n*p*l-o*i*m+n*s*m)*S,e[3]=(c*s*r-o*h*r-c*i*l+n*h*l+o*i*d-n*s*d)*S,e[4]=y*S,e[5]=(u*p*r-f*h*r+f*i*d-t*p*d-u*i*m+t*h*m)*S,e[6]=(f*s*r-a*p*r-f*i*l+t*p*l+a*i*m-t*s*m)*S,e[7]=(a*h*r-u*s*r+u*i*l-t*h*l-a*i*d+t*s*d)*S,e[8]=x*S,e[9]=(f*c*r-u*v*r-f*n*d+t*v*d+u*n*m-t*c*m)*S,e[10]=(a*v*r-f*o*r+f*n*l-t*v*l-a*n*m+t*o*m)*S,e[11]=(u*o*r-a*c*r-u*n*l+t*c*l+a*n*d-t*o*d)*S,e[12]=b*S,e[13]=(u*v*i-f*c*i+f*n*h-t*v*h-u*n*p+t*c*p)*S,e[14]=(f*o*i-a*v*i-f*n*s+t*v*s+a*n*p-t*o*p)*S,e[15]=(a*c*i-u*o*i+u*n*s-t*c*s-a*n*h+t*o*h)*S,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}},{key:"getMaxScaleOnAxis",value:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}},{key:"makeTranslation",value:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}},{key:"makeRotationY",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,u=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,u*o+n,u*s-i*a,0,l*s-i*o,u*s+i*a,r*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,u=a+a,c=o+o,h=r*l,d=r*u,f=r*c,v=a*u,p=a*c,m=o*c,g=s*l,y=s*u,x=s*c,b=n.x,w=n.y,S=n.z;return i[0]=(1-(v+m))*b,i[1]=(d+x)*b,i[2]=(f-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(h+m))*w,i[6]=(p+g)*w,i[7]=0,i[8]=(f+y)*S,i[9]=(p-g)*S,i[10]=(1-(h+v))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}},{key:"decompose",value:function(e,t,n){var i=this.elements,r=Un.set(i[0],i[1],i[2]).length(),a=Un.set(i[4],i[5],i[6]).length(),o=Un.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Zn.copy(this);var s=1/r,l=1/a,u=1/o;return Zn.elements[0]*=s,Zn.elements[1]*=s,Zn.elements[2]*=s,Zn.elements[4]*=l,Zn.elements[5]*=l,Zn.elements[6]*=l,Zn.elements[8]*=u,Zn.elements[9]*=u,Zn.elements[10]*=u,t.setFromRotationMatrix(Zn),n.x=r,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,i,r,a){var o=this.elements,s=2*r/(t-e),l=2*r/(n-i),u=(t+e)/(t-e),c=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),l=1/(n-i),u=1/(a-r),c=(t+e)*s,h=(n+i)*l,d=(a+r)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}(),Un=new un,Zn=new Nn,Vn=new un(0,0,0),jn=new un(1,1,1),Gn=new un,Hn=new un,Wn=new un,qn=new Nn,Xn=new ln,Yn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.DEFAULT_ORDER;(0,b.Z)(this,e),this.isEuler=!0,this._x=t,this._y=n,this._z=i,this._order=r}return(0,w.Z)(e,[{key:"set",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=e.elements,r=i[0],a=i[4],o=i[8],s=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(St(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-St(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(St(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,r));break;case"ZYX":this._y=Math.asin(-St(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(St(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-St(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return qn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(qn,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return Xn.setFromEuler(this),this.setFromQuaternion(Xn,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._x;case 2:return e.next=4,this._y;case 4:return e.next=6,this._z;case 6:return e.next=8,this._order;case 8:case"end":return e.stop()}}),e,this)}))},{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}]),e}();Yn.DEFAULT_ORDER="XYZ";var Qn=function(){function e(){(0,b.Z)(this,e),this.mask=1}return(0,w.Z)(e,[{key:"set",value:function(e){this.mask=(1<>>0}},{key:"enable",value:function(e){this.mask|=1<1){for(var t=0;t1){for(var t=0;t0&&(n=n.concat(a))}return n}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ni,e,ii),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ni,ri,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,i=t.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s0){i.children=[];for(var f=0;f0){i.animations=[];for(var v=0;v0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),b.length>0&&(n.shapes=b),w.length>0&&(n.skeletons=w),S.length>0&&(n.animations=S),_.length>0&&(n.nodes=_)}return n.object=i,n;function A(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:new un,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new un;(0,b.Z)(this,e),this.a=t,this.b=n,this.c=i}return(0,w.Z)(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return hi.subVectors(this.c,this.b),di.subVectors(this.a,this.b),.5*hi.cross(di).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,i,r,a){return e.getUV(t,this.a,this.b,this.c,n,i,r,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,i,r=this.a,a=this.b,o=this.c;pi.subVectors(a,r),mi.subVectors(o,r),yi.subVectors(e,r);var s=pi.dot(yi),l=mi.dot(yi);if(s<=0&&l<=0)return t.copy(r);xi.subVectors(e,a);var u=pi.dot(xi),c=mi.dot(xi);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(r).addScaledVector(pi,n);bi.subVectors(e,o);var d=pi.dot(bi),f=mi.dot(bi);if(f>=0&&d<=f)return t.copy(o);var v=d*l-s*f;if(v<=0&&l>=0&&f<=0)return i=l/(l-f),t.copy(r).addScaledVector(mi,i);var p=u*f-d*c;if(p<=0&&c-u>=0&&d-f>=0)return gi.subVectors(o,a),i=(c-u)/(c-u+(d-f)),t.copy(a).addScaledVector(gi,i);var m=1/(p+v+h);return n=v*m,i=h*m,t.copy(r).addScaledVector(pi,n).addScaledVector(mi,i)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,i){i.subVectors(n,t),hi.subVectors(e,t),i.cross(hi);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,i,r){hi.subVectors(i,t),di.subVectors(n,t),fi.subVectors(e,t);var a=hi.dot(hi),o=hi.dot(di),s=hi.dot(fi),l=di.dot(di),u=di.dot(fi),c=a*l-o*o;if(0===c)return r.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,f=(a*u-o*s)*h;return r.set(1-d-f,f,d)}},{key:"containsPoint",value:function(e,t,n,i){return this.getBarycoord(e,t,n,i,vi),vi.x>=0&&vi.y>=0&&vi.x+vi.y<=1}},{key:"getUV",value:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,vi),s.set(0,0),s.addScaledVector(r,vi.x),s.addScaledVector(a,vi.y),s.addScaledVector(o,vi.z),s}},{key:"isFrontFacing",value:function(e,t,n,i){return hi.subVectors(n,t),di.subVectors(e,t),hi.cross(di).dot(i)<0}}]),e}(),Si=0,_i=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).isMaterial=!0,Object.defineProperty((0,f.Z)(e),"id",{value:Si++}),e.uuid=wt(),e.name="",e.type="Material",e.blending=1,e.side=0,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=204,e.blendDst=205,e.blendEquation=ee,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=3,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=519,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=dt,e.stencilZFail=dt,e.stencilZPass=dt,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.forceSinglePass=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return(0,w.Z)(n,[{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(n.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(mt),Ai=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).isMeshBasicMaterial=!0,i.type="MeshBasicMaterial",i.color=new Yt(16777215),i.map=null,i.lightMap=null,i.lightMapIntensity=1,i.aoMap=null,i.aoMapIntensity=1,i.specularMap=null,i.alphaMap=null,i.envMap=null,i.combine=0,i.reflectivity=1,i.refractionRatio=.98,i.wireframe=!1,i.wireframeLinewidth=1,i.wireframeLinecap="round",i.wireframeLinejoin="round",i.fog=!0,i.setValues(e),i}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}]),n}(_i),Mi=new un,Ei=new Dt,Ci=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if((0,b.Z)(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=i,this.usage=ft,this.updateRange={offset:0,count:-1},this.version=0}return(0,w.Z)(e,[{key:"onUploadCallback",value:function(){}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getX",value:function(e){var t=this.array[e*this.itemSize];return this.normalized&&(t=kt(t,this.array)),t}},{key:"setX",value:function(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){var t=this.array[e*this.itemSize+1];return this.normalized&&(t=kt(t,this.array)),t}},{key:"setY",value:function(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){var t=this.array[e*this.itemSize+2];return this.normalized&&(t=kt(t,this.array)),t}},{key:"setZ",value:function(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){var t=this.array[e*this.itemSize+3];return this.normalized&&(t=kt(t,this.array)),t}},{key:"setW",value:function(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),n=Tt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value:function(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),n=Tt(n,this.array),i=Tt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}},{key:"setXYZW",value:function(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),n=Tt(n,this.array),i=Tt(i,this.array),r=Tt(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ft&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}},{key:"copyColorsArray",value:function(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}},{key:"copyVector2sArray",value:function(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}},{key:"copyVector3sArray",value:function(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}},{key:"copyVector4sArray",value:function(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),e}(),ki=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){return(0,b.Z)(this,n),t.call(this,new Uint16Array(e),i,r)}return n}(Ci),Ti=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){return(0,b.Z)(this,n),t.call(this,new Uint32Array(e),i,r)}return n}(Ci),Pi=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){return(0,b.Z)(this,n),t.call(this,new Float32Array(e),i,r)}return n}(Ci),Di=0,Oi=new Nn,Ii=new ci,Ri=new un,Li=new dn,Bi=new dn,zi=new un,Fi=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).isBufferGeometry=!0,Object.defineProperty((0,f.Z)(e),"id",{value:Di++}),e.uuid=wt(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return(0,w.Z)(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(Rt(e)?Ti:ki)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new Ot).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Oi.makeRotationFromQuaternion(e),this.applyMatrix4(Oi),this}},{key:"rotateX",value:function(e){return Oi.makeRotationX(e),this.applyMatrix4(Oi),this}},{key:"rotateY",value:function(e){return Oi.makeRotationY(e),this.applyMatrix4(Oi),this}},{key:"rotateZ",value:function(e){return Oi.makeRotationZ(e),this.applyMatrix4(Oi),this}},{key:"translate",value:function(e,t,n){return Oi.makeTranslation(e,t,n),this.applyMatrix4(Oi),this}},{key:"scale",value:function(e,t,n){return Oi.makeScale(e,t,n),this.applyMatrix4(Oi),this}},{key:"lookAt",value:function(e){return Ii.lookAt(e),Ii.updateMatrix(),this.applyMatrix4(Ii.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ri).negate(),this.translate(Ri.x,Ri.y,Ri.z),this}},{key:"setFromPoints",value:function(e){for(var t=[],n=0,i=e.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var a in r){var o=r[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,f=c.length;d0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var i=e.attributes;for(var r in i){var a=i[r];this.setAttribute(r,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c0&&void 0!==arguments[0]?arguments[0]:new Fi,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ai;return(0,b.Z)(this,n),(e=t.call(this)).isMesh=!0,e.type="Mesh",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;in.far?null:{distance:l,point:Ki.clone(),object:e}}(e,t,n,i,Vi,ji,Gi,Qi);if(u){r&&(qi.fromBufferAttribute(r,o),Xi.fromBufferAttribute(r,s),Yi.fromBufferAttribute(r,l),u.uv=wi.getUV(Qi,Vi,ji,Gi,qi,Xi,Yi,new Dt)),a&&(qi.fromBufferAttribute(a,o),Xi.fromBufferAttribute(a,s),Yi.fromBufferAttribute(a,l),u.uv2=wi.getUV(Qi,Vi,ji,Gi,qi,Xi,Yi,new Dt));var c={a:o,b:s,c:l,normal:new un,materialIndex:0};wi.getNormal(Vi,ji,Gi,c.normal),u.face=c}return u}var er=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;(0,b.Z)(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:i,height:r,depth:a,widthSegments:o,heightSegments:s,depthSegments:l};var u=(0,f.Z)(e);o=Math.floor(o),s=Math.floor(s),l=Math.floor(l);var c=[],h=[],d=[],v=[],p=0,m=0;function g(e,t,n,i,r,a,o,s,l,f,g){for(var y=a/l,x=o/f,b=a/2,w=o/2,S=s/2,_=l+1,A=f+1,M=0,E=0,C=new un,k=0;k0?1:-1,d.push(C.x,C.y,C.z),v.push(P/l),v.push(1-k/f),M+=1}for(var O=0;O0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(_i),or=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).isCamera=!0,e.type="Camera",e.matrixWorldInverse=new Nn,e.projectionMatrix=new Nn,e.projectionMatrixInverse=new Nn,e}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(ci),sr=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return(0,b.Z)(this,n),(e=t.call(this)).isPerspectiveCamera=!0,e.type="PerspectiveCamera",e.fov=i,e.zoom=1,e.near=a,e.far=o,e.focus=10,e.aspect=r,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*bt*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*xt*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*bt*Math.atan(Math.tan(.5*xt*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*xt*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}]),n}(or),lr=-90,ur=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;(0,b.Z)(this,n),(a=t.call(this)).type="CubeCamera",a.renderTarget=r;var o=new sr(lr,1,e,i);o.layers=a.layers,o.up.set(0,1,0),o.lookAt(1,0,0),a.add(o);var s=new sr(lr,1,e,i);s.layers=a.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),a.add(s);var l=new sr(lr,1,e,i);l.layers=a.layers,l.up.set(0,0,-1),l.lookAt(0,1,0),a.add(l);var u=new sr(lr,1,e,i);u.layers=a.layers,u.up.set(0,0,1),u.lookAt(0,-1,0),a.add(u);var c=new sr(lr,1,e,i);c.layers=a.layers,c.up.set(0,1,0),c.lookAt(0,0,1),a.add(c);var h=new sr(lr,1,e,i);return h.layers=a.layers,h.up.set(0,1,0),h.lookAt(0,0,-1),a.add(h),a}return(0,w.Z)(n,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,i=(0,h.Z)(this.children,6),r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],c=e.getRenderTarget(),d=e.toneMapping,f=e.xr.enabled;e.toneMapping=0,e.xr.enabled=!1;var v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,s),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=v,e.setRenderTarget(n,5),e.render(t,u),e.setRenderTarget(c),e.toneMapping=d,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}]),n}(ci),cr=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h){var d;return(0,b.Z)(this,n),e=void 0!==e?e:[],i=void 0!==i?i:te,(d=t.call(this,e,i,r,a,o,s,l,u,c,h)).isCubeTexture=!0,d.flipY=!1,d}return(0,w.Z)(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(tn),hr=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,b.Z)(this,n),(e=t.call(this,i,i,r)).isWebGLCubeRenderTarget=!0;var a={width:i,height:i,depth:1},o=[a,a,a,a,a,a];return e.texture=new cr(o,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),e.texture.isRenderTargetTexture=!0,e.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,e.texture.minFilter=void 0!==r.minFilter?r.minFilter:ue,e}return(0,w.Z)(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},i="\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 \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \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",a=new er(5,5,5),o=new ar({name:"CubemapFromEquirect",uniforms:tr(n),vertexShader:i,fragmentShader:r,side:1,blending:0});o.uniforms.tEquirect.value=t;var s=new Ji(a,o),l=t.minFilter;return t.minFilter===ce&&(t.minFilter=ue),new ur(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,i){for(var r=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}]),n}(rn),dr=new un,fr=new un,vr=new Ot,pr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,b.Z)(this,e),this.isPlane=!0,this.normal=t,this.constant=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var i=dr.subVectors(n,t).cross(fr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}},{key:"intersectLine",value:function(e,t){var n=e.delta(dr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||vr.getNormalMatrix(e),i=this.coplanarPoint(dr).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),mr=new Pn,gr=new un,yr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new pr,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new pr,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new pr,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new pr,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new pr,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new pr;(0,b.Z)(this,e),this.planes=[t,n,i,r,a,o]}return(0,w.Z)(e,[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],f=n[10],v=n[11],p=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,c-s,v-h,y-p).normalize(),t[1].setComponents(o+i,c+s,v+h,y+p).normalize(),t[2].setComponents(o+r,c+l,v+d,y+m).normalize(),t[3].setComponents(o-r,c-l,v-d,y-m).normalize(),t[4].setComponents(o-a,c-u,v-f,y-g).normalize(),t[5].setComponents(o+a,c+u,v+f,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),mr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(mr)}},{key:"intersectsSprite",value:function(e){return mr.center.set(0,0,0),mr.radius=.7071067811865476,mr.applyMatrix4(e.matrixWorld),this.intersectsSphere(mr)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,gr.y=i.normal.y>0?e.max.y:e.min.y,gr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(gr)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();function xr(){var e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function br(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){var a=i.get(t);(!a||a.version0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;(0,b.Z)(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:i,height:r,widthSegments:a,heightSegments:o};for(var s=i/2,l=r/2,u=Math.floor(a),c=Math.floor(o),h=u+1,d=c+1,f=i/u,v=r/c,p=[],m=[],g=[],y=[],x=0;x 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 );\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 + displacementBias );\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} 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}\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",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 *= ( 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 );\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;\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 uniform 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 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;\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_LIGHT_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 \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \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 \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 \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \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 = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \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 \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \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 \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \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 \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},_r={common:{diffuse:{value:new Yt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ot},uv2Transform:{value:new Ot},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 Dt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Yt(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 Yt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ot}},sprite:{diffuse:{value:new Yt(16777215)},opacity:{value:1},center:{value:new Dt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ot}}},Ar={basic:{uniforms:nr([_r.common,_r.specularmap,_r.envmap,_r.aomap,_r.lightmap,_r.fog]),vertexShader:Sr.meshbasic_vert,fragmentShader:Sr.meshbasic_frag},lambert:{uniforms:nr([_r.common,_r.specularmap,_r.envmap,_r.aomap,_r.lightmap,_r.emissivemap,_r.bumpmap,_r.normalmap,_r.displacementmap,_r.fog,_r.lights,{emissive:{value:new Yt(0)}}]),vertexShader:Sr.meshlambert_vert,fragmentShader:Sr.meshlambert_frag},phong:{uniforms:nr([_r.common,_r.specularmap,_r.envmap,_r.aomap,_r.lightmap,_r.emissivemap,_r.bumpmap,_r.normalmap,_r.displacementmap,_r.fog,_r.lights,{emissive:{value:new Yt(0)},specular:{value:new Yt(1118481)},shininess:{value:30}}]),vertexShader:Sr.meshphong_vert,fragmentShader:Sr.meshphong_frag},standard:{uniforms:nr([_r.common,_r.envmap,_r.aomap,_r.lightmap,_r.emissivemap,_r.bumpmap,_r.normalmap,_r.displacementmap,_r.roughnessmap,_r.metalnessmap,_r.fog,_r.lights,{emissive:{value:new Yt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Sr.meshphysical_vert,fragmentShader:Sr.meshphysical_frag},toon:{uniforms:nr([_r.common,_r.aomap,_r.lightmap,_r.emissivemap,_r.bumpmap,_r.normalmap,_r.displacementmap,_r.gradientmap,_r.fog,_r.lights,{emissive:{value:new Yt(0)}}]),vertexShader:Sr.meshtoon_vert,fragmentShader:Sr.meshtoon_frag},matcap:{uniforms:nr([_r.common,_r.bumpmap,_r.normalmap,_r.displacementmap,_r.fog,{matcap:{value:null}}]),vertexShader:Sr.meshmatcap_vert,fragmentShader:Sr.meshmatcap_frag},points:{uniforms:nr([_r.points,_r.fog]),vertexShader:Sr.points_vert,fragmentShader:Sr.points_frag},dashed:{uniforms:nr([_r.common,_r.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Sr.linedashed_vert,fragmentShader:Sr.linedashed_frag},depth:{uniforms:nr([_r.common,_r.displacementmap]),vertexShader:Sr.depth_vert,fragmentShader:Sr.depth_frag},normal:{uniforms:nr([_r.common,_r.bumpmap,_r.normalmap,_r.displacementmap,{opacity:{value:1}}]),vertexShader:Sr.meshnormal_vert,fragmentShader:Sr.meshnormal_frag},sprite:{uniforms:nr([_r.sprite,_r.fog]),vertexShader:Sr.sprite_vert,fragmentShader:Sr.sprite_frag},background:{uniforms:{uvTransform:{value:new Ot},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Sr.background_vert,fragmentShader:Sr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Sr.backgroundCube_vert,fragmentShader:Sr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Sr.cube_vert,fragmentShader:Sr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Sr.equirect_vert,fragmentShader:Sr.equirect_frag},distanceRGBA:{uniforms:nr([_r.common,_r.displacementmap,{referencePosition:{value:new un},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Sr.distanceRGBA_vert,fragmentShader:Sr.distanceRGBA_frag},shadow:{uniforms:nr([_r.lights,_r.fog,{color:{value:new Yt(0)},opacity:{value:1}}]),vertexShader:Sr.shadow_vert,fragmentShader:Sr.shadow_frag}};Ar.physical={uniforms:nr([Ar.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Dt(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 Yt(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Dt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Yt(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Yt(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Sr.meshphysical_vert,fragmentShader:Sr.meshphysical_frag};var Mr={r:0,b:0,g:0};function Er(e,t,n,i,r,a,o){var s,l,u=new Yt(0),c=!0===a?0:1,h=null,d=0,f=null;function v(t,n){t.getRGB(Mr,ir(e)),i.buffers.color.setClear(Mr.r,Mr.g,Mr.b,n,o)}return{getClearColor:function(){return u},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(e),v(u,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){v(u,c=e)},render:function(i,a){var o=!1,p=!0===a.isScene?a.background:null;p&&p.isTexture&&(p=(a.backgroundBlurriness>0?n:t).get(p));var m=e.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(p=null),null===p?v(u,c):p&&p.isColor&&(v(p,1),o=!0),(e.autoClear||o)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),p&&(p.isCubeTexture||p.mapping===ie)?(void 0===l&&((l=new Ji(new er(1,1,1),new ar({name:"BackgroundCubeMaterial",uniforms:tr(Ar.backgroundCube.uniforms),vertexShader:Ar.backgroundCube.vertexShader,fragmentShader:Ar.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=p,l.material.uniforms.flipEnvMap.value=p.isCubeTexture&&!1===p.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=a.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,l.material.toneMapped=p.encoding!==st,(h!==p||d!==p.version||f!==e.toneMapping)&&(l.material.needsUpdate=!0,h=p,d=p.version,f=e.toneMapping),l.layers.enableAll(),i.unshift(l,l.geometry,l.material,0,0,null)):p&&p.isTexture&&(void 0===s&&((s=new Ji(new wr(2,2),new ar({name:"BackgroundMaterial",uniforms:tr(Ar.background.uniforms),vertexShader:Ar.background.vertexShader,fragmentShader:Ar.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=p,s.material.uniforms.backgroundIntensity.value=a.backgroundIntensity,s.material.toneMapped=p.encoding!==st,!0===p.matrixAutoUpdate&&p.updateMatrix(),s.material.uniforms.uvTransform.value.copy(p.matrix),(h!==p||d!==p.version||f!==e.toneMapping)&&(s.material.needsUpdate=!0,h=p,d=p.version,f=e.toneMapping),s.layers.enableAll(),i.unshift(s,s.geometry,s.material,0,0,null))}}}function Cr(e,t,n,i){var r=e.getParameter(34921),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==a,s={},l=f(null),u=l,c=!1;function h(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function f(e){for(var t=[],n=[],i=[],a=0;a=0){var c=r[l],h=a[l];if(void 0===h&&("instanceMatrix"===l&&e.instanceMatrix&&(h=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(h=e.instanceColor)),void 0===c||c.attribute!==h||h&&c.data!==h.data)return!0;o++}return u.attributesNum!==o||u.index!==i}(r,x,d,b))&&function(e,t,n,i){var r={},a=t.attributes,o=0,s=n.getAttributes();for(var l in s)if(s[l].location>=0){var c=a[l];void 0===c&&("instanceMatrix"===l&&e.instanceMatrix&&(c=e.instanceMatrix),"instanceColor"===l&&e.instanceColor&&(c=e.instanceColor));var h={};h.attribute=c,c&&c.data&&(h.data=c.data),r[l]=h,o++}u.attributes=r,u.attributesNum=o,u.index=i}(r,x,d,b)}else{var _=!0===l.wireframe;(u.geometry!==x.id||u.program!==d.id||u.wireframe!==_)&&(u.geometry=x.id,u.program=d.id,u.wireframe=_,w=!0)}null!==b&&n.update(b,34963),(w||c)&&(c=!1,function(r,a,o,s){if(!1===i.isWebGL2&&(r.isInstancedMesh||s.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;v();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var f=l[h];if(void 0===f&&("instanceMatrix"===h&&r.instanceMatrix&&(f=r.instanceMatrix),"instanceColor"===h&&r.instanceColor&&(f=r.instanceColor)),void 0!==f){var x=f.normalized,b=f.itemSize,w=n.get(f);if(void 0===w)continue;var S=w.buffer,_=w.type,A=w.bytesPerElement;if(f.isInterleavedBufferAttribute){var M=f.data,E=M.stride,C=f.offset;if(M.isInstancedInterleavedBuffer){for(var k=0;k0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a=typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),f=e.getParameter(34076),v=e.getParameter(34921),p=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:v,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function Pr(e){var t=this,n=null,i=0,r=!1,a=!1,o=new pr,s=new Ot,l={value:null,needsUpdate:!1};function u(e,n,i,r){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==r||null===u){var c=i+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length0),t.numPlanes=i,t.numIntersection=0);else{var p=a?0:i,m=4*p,g=v.clippingState||null;l.value=g,g=u(h,s,m,c);for(var y=0;y!==m;++y)g[y]=n[y];v.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=p}}}function Dr(e){var t=new WeakMap;function n(e,t){return 303===t?e.mapping=te:304===t&&(e.mapping=ne),e}function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){var a=r.mapping;if(303===a||304===a){if(t.has(r))return n(t.get(r).texture,r.mapping);var o=r.image;if(o&&o.height>0){var s=new hr(o.height/2);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}return r},dispose:function(){t=new WeakMap}}}var Or=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return(0,b.Z)(this,n),(e=t.call(this)).isOrthographicCamera=!0,e.type="OrthographicCamera",e.zoom=1,e.view=null,e.left=i,e.right=r,e.top=a,e.bottom=o,e.near=s,e.far=l,e.updateProjectionMatrix(),e}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}},{key:"setViewOffset",value:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}]),n}(or),Ir=[.125,.215,.35,.446,.526,.582],Rr=20,Lr=new Or,Br=new Yt,zr=null,Fr=(1+Math.sqrt(5))/2,Nr=1/Fr,Ur=[new un(1,1,1),new un(-1,1,1),new un(1,1,-1),new un(-1,1,-1),new un(0,Fr,Nr),new un(0,Fr,-Nr),new un(Nr,0,Fr),new un(-Nr,0,Fr),new un(Fr,Nr,0),new un(-Fr,Nr,0)],Zr=function(){function e(t){(0,b.Z)(this,e),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)}return(0,w.Z)(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;zr=this._renderer.getRenderTarget(),this._setSize(256);var r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=Hr(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=Gr(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;ee-4?l=Ir[o-e+4-1]:0===o&&(l=0),i.push(l);for(var u=1/(s-2),c=-u,h=1+u,d=[c,c,h,c,h,h,c,c,h,h,c,h],f=6,v=6,p=3,m=2,g=1,y=new Float32Array(p*v*f),x=new Float32Array(m*v*f),b=new Float32Array(g*v*f),w=0;w2?0:-1,A=[S,_,0,S+2/3,_,0,S+2/3,_+1,0,S,_,0,S+2/3,_+1,0,S,_+1,0];y.set(A,p*v*w),x.set(d,m*v*w);var M=[w,w,w,w,w,w];b.set(M,g*v*w)}var E=new Fi;E.setAttribute("position",new Ci(y,p)),E.setAttribute("uv",new Ci(x,m)),E.setAttribute("faceIndex",new Ci(b,g)),t.push(E),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(a),this._sizeLods=r.sizeLods,this._lodPlanes=r.lodPlanes,this._sigmas=r.sigmas,this._blurMaterial=function(e,t,n){var i=new Float32Array(Rr),r=new un(0,1,0);return new ar({name:"SphericalGaussianBlur",defines:{n:Rr,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\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",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 \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})}(a,e,t)}return i}},{key:"_compileMaterial",value:function(e){var t=new Ji(this._lodPlanes[0],e);this._renderer.compile(t,Lr)}},{key:"_sceneToCubeUV",value:function(e,t,n,i){var r=new sr(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.toneMapping;s.getClearColor(Br),s.toneMapping=0,s.autoClear=!1;var c=new Ai({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),h=new Ji(new er,c),d=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,d=!0):(c.color.copy(Br),d=!0);for(var v=0;v<6;v++){var p=v%3;0===p?(r.up.set(0,a[v],0),r.lookAt(o[v],0,0)):1===p?(r.up.set(0,0,a[v]),r.lookAt(0,o[v],0)):(r.up.set(0,a[v],0),r.lookAt(0,0,o[v]));var m=this._cubeSize;jr(i,p*m,v>2?m:0,m,m),s.setRenderTarget(i),d&&s.render(h,r),s.render(e,r)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=f}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,i=e.mapping===te||e.mapping===ne;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Hr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Gr());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new Ji(this._lodPlanes[0],r);r.uniforms.envMap.value=e;var o=this._cubeSize;jr(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,Lr)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;iRr&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(v," samples when the maximum is set to ").concat(Rr));for(var p=[],m=0,g=0;gw-4?i-w+4:0),4*(this._cubeSize-S),3*S,2*S),s.setRenderTarget(t),s.render(u,Lr)}}]),e}();function Vr(e,t,n){var i=new rn(e,t,n);return i.texture.mapping=ie,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function jr(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Gr(){return new ar({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\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",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 \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 Hr(){return new ar({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\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",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 Wr(e){var t=new WeakMap,n=null;function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){var a=r.mapping,o=303===a||304===a,s=a===te||a===ne;if(o||s){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;var l=t.get(r);return null===n&&(n=new Zr(e)),l=o?n.fromEquirectangular(r,l):n.fromCubemap(r,l),t.set(r,l),l.texture}if(t.has(r))return t.get(r).texture;var u=r.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=6,i=0;it.maxTextureSize&&(A=Math.ceil(_/t.maxTextureSize),_=t.maxTextureSize);var M=new Float32Array(_*A*4*v),E=new an(M,_,A,v);E.type=ve,E.needsUpdate=!0;for(var C=4*S,k=0;k0)return e;var r=t*n,a=aa[r];if(void 0===a&&(a=new Float32Array(r),aa[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function ha(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n":" "," ").concat(s,": ").concat(n[o]))}return i.join("\n")}(e.getShaderSource(t),o)}return r}function lo(e,t){var n=function(e){switch(e){case ot:return["Linear","( value )"];case st:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function uo(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function co(e){return""!==e}function ho(e,t){var n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function fo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var vo=/^[ \t]*#include +<([\w\d./]+)>/gm;function po(e){return e.replace(vo,mo)}function mo(e,t){var n=Sr[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return po(n)}var go=/#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 yo(e){return e.replace(go,xo)}function xo(e,t,n,i){for(var r="",a=parseInt(t);a0&&(r+="\n"),(a=[p,m].filter(co).join("\n")).length>0&&(a+="\n")):(r=[bo(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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(co).join("\n"),a=[p,bo(n),"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Sr.tonemapping_pars_fragment:"",0!==n.toneMapping?uo("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Sr.encodings_pars_fragment,lo("linearToOutputTexel",n.outputEncoding),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(co).join("\n")),l=fo(l=ho(l=po(l),n),n),u=fo(u=ho(u=po(u),n),n),l=yo(l),u=yo(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",r=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",n.glslVersion===vt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===vt?"":"#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"+a);var x,b,w=y+a+u,S=ao(o,35633,y+r+l),_=ao(o,35632,w);if(o.attachShader(g,S),o.attachShader(g,_),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var A=o.getProgramInfoLog(g).trim(),M=o.getShaderInfoLog(S).trim(),E=o.getShaderInfoLog(_).trim(),C=!0,k=!0;if(!1===o.getProgramParameter(g,35714)){C=!1;var T=so(o,S,"vertex"),P=so(o,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+A+"\n"+T+"\n"+P)}else""!==A?console.warn("THREE.WebGLProgram: Program Info Log:",A):(""===M||""===E)&&(k=!1);k&&(this.diagnostics={runnable:C,programLog:A,vertexShader:{log:M,prefix:r},fragmentShader:{log:E,prefix:a}})}return o.deleteShader(S),o.deleteShader(_),this.getUniforms=function(){return void 0===x&&(x=new ro(o,g)),x},this.getAttributes=function(){return void 0===b&&(b=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r0,I=a.clearcoat>0,R=a.iridescence>0;return{isWebGL2:c,shaderID:S,shaderName:a.type,vertexShader:_,fragmentShader:A,defines:a.defines,customVertexShaderID:M,customFragmentShaderID:E,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,instancing:!0===m.isInstancedMesh,instancingColor:!0===m.isInstancedMesh&&null!==m.instanceColor,supportsVertexTextures:d,outputEncoding:null===D?e.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:ot,map:!!a.map,matcap:!!a.matcap,envMap:!!b,envMapMode:b&&b.mapping,envMapCubeUVHeight:w,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===st,clearcoat:I,clearcoatMap:I&&!!a.clearcoatMap,clearcoatRoughnessMap:I&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!a.clearcoatNormalMap,iridescence:R,iridescenceMap:R&&!!a.iridescenceMap,iridescenceThicknessMap:R&&!!a.iridescenceThicknessMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:O,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,vertexUvs:!!a.map||!!a.bumpMap||!!a.normalMap||!!a.specularMap||!!a.alphaMap||!!a.emissiveMap||!!a.roughnessMap||!!a.metalnessMap||!!a.clearcoatMap||!!a.clearcoatRoughnessMap||!!a.clearcoatNormalMap||!!a.iridescenceMap||!!a.iridescenceThicknessMap||!!a.displacementMap||!!a.transmissionMap||!!a.thicknessMap||!!a.specularIntensityMap||!!a.specularColorMap||!!a.sheenColorMap||!!a.sheenRoughnessMap,uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.iridescenceMap||a.iridescenceThicknessMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap)&&!!a.displacementMap,fog:!!g,useFog:!0===a.fog,fogExp2:g&&g.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:k,morphTextureStride:T,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:!!a.depthPacking,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0),t.supportsVertexTextures&&s.enable(1),t.instancing&&s.enable(2),t.instancingColor&&s.enable(3),t.map&&s.enable(4),t.matcap&&s.enable(5),t.envMap&&s.enable(6),t.lightMap&&s.enable(7),t.aoMap&&s.enable(8),t.emissiveMap&&s.enable(9),t.bumpMap&&s.enable(10),t.normalMap&&s.enable(11),t.objectSpaceNormalMap&&s.enable(12),t.tangentSpaceNormalMap&&s.enable(13),t.clearcoat&&s.enable(14),t.clearcoatMap&&s.enable(15),t.clearcoatRoughnessMap&&s.enable(16),t.clearcoatNormalMap&&s.enable(17),t.iridescence&&s.enable(18),t.iridescenceMap&&s.enable(19),t.iridescenceThicknessMap&&s.enable(20),t.displacementMap&&s.enable(21),t.specularMap&&s.enable(22),t.roughnessMap&&s.enable(23),t.metalnessMap&&s.enable(24),t.gradientMap&&s.enable(25),t.alphaMap&&s.enable(26),t.alphaTest&&s.enable(27),t.vertexColors&&s.enable(28),t.vertexAlphas&&s.enable(29),t.vertexUvs&&s.enable(30),t.vertexTangents&&s.enable(31),t.uvsVertexOnly&&s.enable(32),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.skinning&&s.enable(4),t.morphTargets&&s.enable(5),t.morphNormals&&s.enable(6),t.morphColors&&s.enable(7),t.premultipliedAlpha&&s.enable(8),t.shadowMapEnabled&&s.enable(9),t.physicallyCorrectLights&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.specularIntensityMap&&s.enable(15),t.specularColorMap&&s.enable(16),t.transmission&&s.enable(17),t.transmissionMap&&s.enable(18),t.thicknessMap&&s.enable(19),t.sheen&&s.enable(20),t.sheenColorMap&&s.enable(21),t.sheenRoughnessMap&&s.enable(22),t.decodeVideoTexture&&s.enable(23),t.opaque&&s.enable(24),e.push(s.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=v[e.type];if(n){var i=Ar[n];t=rr.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var i,r=0,o=u.length;r0?i.push(c):!0===o.transparent?r.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?i.unshift(c):!0===o.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(var n=t,i=e.length;n1&&n.sort(e||Co),i.length>1&&i.sort(t||ko),r.length>1&&r.sort(t||ko)}}}function Po(){var e=new WeakMap;return{get:function(t,n){var i,r=e.get(t);return void 0===r?(i=new To,e.set(t,[i])):n>=r.length?(i=new To,r.push(i)):i=r[n],i},dispose:function(){e=new WeakMap}}}function Do(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new un,color:new Yt};break;case"SpotLight":n={position:new un,direction:new un,color:new Yt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new un,color:new Yt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new un,skyColor:new Yt,groundColor:new Yt};break;case"RectAreaLight":n={color:new Yt,position:new un,halfWidth:new un,halfHeight:new un}}return e[t.id]=n,n}}}var Oo=0;function Io(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Ro(e,t){for(var n=new Do,i=function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Dt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Dt,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),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},a=0;a<9;a++)r.probe.push(new un);var o=new un,s=new Nn,l=new Nn;return{setup:function(a,o){for(var s=0,l=0,u=0,c=0;c<9;c++)r.probe[c].set(0,0,0);var h=0,d=0,f=0,v=0,p=0,m=0,g=0,y=0,x=0,b=0;a.sort(Io);for(var w=!0!==o?Math.PI:1,S=0,_=a.length;S<_;S++){var A=a[S],M=A.color,E=A.intensity,C=A.distance,k=A.shadow&&A.shadow.map?A.shadow.map.texture:null;if(A.isAmbientLight)s+=M.r*E*w,l+=M.g*E*w,u+=M.b*E*w;else if(A.isLightProbe)for(var T=0;T<9;T++)r.probe[T].addScaledVector(A.sh.coefficients[T],E);else if(A.isDirectionalLight){var P=n.get(A);if(P.color.copy(A.color).multiplyScalar(A.intensity*w),A.castShadow){var D=A.shadow,O=i.get(A);O.shadowBias=D.bias,O.shadowNormalBias=D.normalBias,O.shadowRadius=D.radius,O.shadowMapSize=D.mapSize,r.directionalShadow[h]=O,r.directionalShadowMap[h]=k,r.directionalShadowMatrix[h]=A.shadow.matrix,m++}r.directional[h]=P,h++}else if(A.isSpotLight){var I=n.get(A);I.position.setFromMatrixPosition(A.matrixWorld),I.color.copy(M).multiplyScalar(E*w),I.distance=C,I.coneCos=Math.cos(A.angle),I.penumbraCos=Math.cos(A.angle*(1-A.penumbra)),I.decay=A.decay,r.spot[f]=I;var R=A.shadow;if(A.map&&(r.spotLightMap[x]=A.map,x++,R.updateMatrices(A),A.castShadow&&b++),r.spotLightMatrix[f]=R.matrix,A.castShadow){var L=i.get(A);L.shadowBias=R.bias,L.shadowNormalBias=R.normalBias,L.shadowRadius=R.radius,L.shadowMapSize=R.mapSize,r.spotShadow[f]=L,r.spotShadowMap[f]=k,y++}f++}else if(A.isRectAreaLight){var B=n.get(A);B.color.copy(M).multiplyScalar(E),B.halfWidth.set(.5*A.width,0,0),B.halfHeight.set(0,.5*A.height,0),r.rectArea[v]=B,v++}else if(A.isPointLight){var z=n.get(A);if(z.color.copy(A.color).multiplyScalar(A.intensity*w),z.distance=A.distance,z.decay=A.decay,A.castShadow){var F=A.shadow,N=i.get(A);N.shadowBias=F.bias,N.shadowNormalBias=F.normalBias,N.shadowRadius=F.radius,N.shadowMapSize=F.mapSize,N.shadowCameraNear=F.camera.near,N.shadowCameraFar=F.camera.far,r.pointShadow[d]=N,r.pointShadowMap[d]=k,r.pointShadowMatrix[d]=A.shadow.matrix,g++}r.point[d]=z,d++}else if(A.isHemisphereLight){var U=n.get(A);U.skyColor.copy(A.color).multiplyScalar(E*w),U.groundColor.copy(A.groundColor).multiplyScalar(E*w),r.hemi[p]=U,p++}}v>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=_r.LTC_FLOAT_1,r.rectAreaLTC2=_r.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=_r.LTC_HALF_1,r.rectAreaLTC2=_r.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=s,r.ambient[1]=l,r.ambient[2]=u;var Z=r.hash;(Z.directionalLength!==h||Z.pointLength!==d||Z.spotLength!==f||Z.rectAreaLength!==v||Z.hemiLength!==p||Z.numDirectionalShadows!==m||Z.numPointShadows!==g||Z.numSpotShadows!==y||Z.numSpotMaps!==x)&&(r.directional.length=h,r.spot.length=f,r.rectArea.length=v,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=y+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,Z.directionalLength=h,Z.pointLength=d,Z.spotLength=f,Z.rectAreaLength=v,Z.hemiLength=p,Z.numDirectionalShadows=m,Z.numPointShadows=g,Z.numSpotShadows=y,Z.numSpotMaps=x,r.version=Oo++)},setupView:function(e,t){for(var n=0,i=0,a=0,u=0,c=0,h=t.matrixWorldInverse,d=0,f=e.length;d1&&void 0!==arguments[1]?arguments[1]:0,o=n.get(i);return void 0===o?(r=new Lo(e,t),n.set(i,[r])):a>=o.length?(r=new Lo(e,t),o.push(r)):r=o[a],r},dispose:function(){n=new WeakMap}}}var zo=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).isMeshDepthMaterial=!0,i.type="MeshDepthMaterial",i.depthPacking=lt,i.map=null,i.alphaMap=null,i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.wireframe=!1,i.wireframeLinewidth=1,i.setValues(e),i}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}]),n}(_i),Fo=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).isMeshDistanceMaterial=!0,i.type="MeshDistanceMaterial",i.referencePosition=new un,i.nearDistance=1,i.farDistance=1e3,i.map=null,i.alphaMap=null,i.displacementMap=null,i.displacementScale=1,i.displacementBias=0,i.setValues(e),i}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(_i);function No(e,t,n){var i,r=new yr,a=new Dt,o=new Dt,s=new nn,l=new zo({depthPacking:ut}),u=new Fo,c={},h=n.maxTextureSize,d=(i={},(0,g.Z)(i,0,1),(0,g.Z)(i,1,0),(0,g.Z)(i,2,2),i),f=new ar({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Dt},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 \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}"}),v=f.clone();v.defines.HORIZONTAL_PASS=1;var p=new Fi;p.setAttribute("position",new Ci(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new Ji(p,f),y=this;function x(n,i){var r=t.update(m);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,v.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,v.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new rn(a.x,a.y)),f.uniforms.shadow_pass.value=n.map.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,f,m,null),v.uniforms.shadow_pass.value=n.mapPass.texture,v.uniforms.resolution.value=n.mapSize,v.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,v,m,null)}function b(t,n,i,r,a,o){var s=null,h=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==h)s=h;else if(s=!0===i.isPointLight?u:l,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){var f=s.uuid,v=n.uuid,p=c[f];void 0===p&&(p={},c[f]=p);var m=p[v];void 0===m&&(m=s.clone(),p[v]=m),s=m}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(s.referencePosition.setFromMatrixPosition(i.matrixWorld),s.nearDistance=r,s.farDistance=a),s}function w(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;hh||a.y>h)&&(a.x>h&&(o.x=Math.floor(h/g.x),a.x=o.x*g.x,m.mapSize.x=o.x),a.y>h&&(o.y=Math.floor(h/g.y),a.y=o.y*g.y,m.mapSize.y=o.y)),null===m.map){var b=3!==this.type?{minFilter:se,magFilter:se}:{};m.map=new rn(a.x,a.y,b),m.map.texture.name=p.name+".shadowMap",m.camera.updateProjectionMatrix()}e.setRenderTarget(m.map),e.clear();for(var S=m.getViewportCount(),_=0;_=1):-1!==R.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),O=I>=2);var L=null,B={},z=e.getParameter(3088),F=e.getParameter(2978),N=(new nn).fromArray(z),U=(new nn).fromArray(F);function Z(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o"u")&&/OculusBrowser/g.test(navigator.userAgent),y=new WeakMap,x=new WeakMap,b=!1;try{b=typeof OffscreenCanvas<"u"&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(H){}function w(e,t){return b?new OffscreenCanvas(e,t):zt("canvas")}function S(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){var a=t?Ct:Math.floor,o=a(r*e.width),s=a(r*e.height);void 0===u&&(u=w(o,s));var l=n?w(o,s):u;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function _(e){return Mt(e.width)&&Mt(e.height)}function A(e,t){return e.generateMipmaps&&t&&e.minFilter!==se&&e.minFilter!==ue}function M(t){e.generateMipmap(t)}function E(n,i,r,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===c)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;return 6403===i&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),33319===i&&(5126===r&&(s=33328),5131===r&&(s=33327),5121===r&&(s=33323)),6408===i&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=a===st&&!1===o?35907:32856),32819===r&&(s=32854),32820===r&&(s=32855)),(33325===s||33326===s||33327===s||33328===s||34842===s||34836===s)&&t.get("EXT_color_buffer_float"),s}function C(e,t,n){return!0===A(e,n)||e.isFramebufferTexture&&e.minFilter!==se&&e.minFilter!==ue?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function k(e){return e===se||1004===e||e===le?9728:9729}function T(e){var t=e.target;t.removeEventListener("dispose",T),function(e){var t=i.get(e);if(void 0===t.__webglInit)return;var n=e.source,r=x.get(n);if(r){var a=r[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&D(e),0===Object.keys(r).length&&x.delete(n)}i.remove(e)}(t),t.isVideoTexture&&y.delete(t)}function P(t){var n=t.target;n.removeEventListener("dispose",P),function(t){var n=t.texture,r=i.get(t),a=i.get(n);if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(r.__webglFramebuffer[s]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[s]);else{if(e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(var l=0;l0&&r.__version!==e.version){var a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void F(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(3553,r.__webglTexture,33984+t)}var R=(s={},(0,g.Z)(s,re,10497),(0,g.Z)(s,ae,33071),(0,g.Z)(s,oe,33648),s),L=(l={},(0,g.Z)(l,se,9728),(0,g.Z)(l,1004,9984),(0,g.Z)(l,le,9986),(0,g.Z)(l,ue,9729),(0,g.Z)(l,1007,9985),(0,g.Z)(l,ce,9987),l);function B(n,a,o){if(o?(e.texParameteri(n,10242,R[a.wrapS]),e.texParameteri(n,10243,R[a.wrapT]),(32879===n||35866===n)&&e.texParameteri(n,32882,R[a.wrapR]),e.texParameteri(n,10240,L[a.magFilter]),e.texParameteri(n,10241,L[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),(32879===n||35866===n)&&e.texParameteri(n,32882,33071),(a.wrapS!==ae||a.wrapT!==ae)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,k(a.magFilter)),e.texParameteri(n,10241,k(a.minFilter)),a.minFilter!==se&&a.minFilter!==ue&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.magFilter===se||a.minFilter!==le&&a.minFilter!==ce||a.type===ve&&!1===t.has("OES_texture_float_linear")||!1===c&&a.type===pe&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function z(t,n){var i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));var r=n.source,a=x.get(r);void 0===a&&(a={},x.set(r,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&D(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return i}function F(t,r,o){var s=3553;(r.isDataArrayTexture||r.isCompressedArrayTexture)&&(s=35866),r.isData3DTexture&&(s=32879);var l=z(t,r),u=r.source;n.bindTexture(s,t.__webglTexture,33984+o);var h=i.get(u);if(u.version!==h.__version||!0===l){n.activeTexture(33984+o),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);var d=function(e){return!c&&(e.wrapS!==ae||e.wrapT!==ae||e.minFilter!==se&&e.minFilter!==ue)}(r)&&!1===_(r.image),v=S(r.image,d,!1,f),p=_(v=G(r,v))||c,m=a.convert(r.format,r.encoding),g=a.convert(r.type),y=E(r.internalFormat,m,g,r.encoding,r.isVideoTexture);B(s,r,p);var x,b=r.mipmaps,w=c&&!0!==r.isVideoTexture,k=void 0===h.__version||!0===l,T=C(r,v,p);if(r.isDepthTexture)y=6402,c?y=r.type===ve?36012:r.type===fe?33190:r.type===me?35056:33189:r.type===ve&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===ye&&6402===y&&r.type!==de&&r.type!==fe&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=fe,g=a.convert(r.type)),r.format===xe&&6402===y&&(y=34041,r.type!==me&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=me,g=a.convert(r.type))),k&&(w?n.texStorage2D(3553,1,y,v.width,v.height):n.texImage2D(3553,0,y,v.width,v.height,0,m,g,null));else if(r.isDataTexture)if(b.length>0&&p){w&&k&&n.texStorage2D(3553,T,y,b[0].width,b[0].height);for(var P=0,D=b.length;P>=1,N>>=1}else if(b.length>0&&p){w&&k&&n.texStorage2D(3553,T,y,b[0].width,b[0].height);for(var Z=0,V=b.length;Z=34069&&l<=34074)&&e.framebufferTexture2D(36160,s,l,i.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function U(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i||j(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===ve?r=36012:o.type===fe&&(r=33190));var s=V(n);j(n)?p.renderbufferStorageMultisampleEXT(36161,s,r,n.width,n.height):e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){var l=V(n);i&&!1===j(n)?e.renderbufferStorageMultisample(36161,l,35056,n.width,n.height):j(n)?p.renderbufferStorageMultisampleEXT(36161,l,35056,n.width,n.height):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else for(var u=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture],c=0;c0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function G(e,n){var i=e.encoding,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===pt||i!==ot&&(i===st?!1===c?!0===t.has("EXT_sRGB")&&r===ge?(e.format=pt,e.minFilter=ue,e.generateMipmaps=!1):n=Kt.sRGBToLinear(n):(r!==ge||a!==he)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){var e=O;return e>=h&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+h),O+=1,e},this.resetTextureUnits=function(){O=0},this.setTexture2D=I,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?F(r,e,t):n.bindTexture(35866,r.__webglTexture,33984+t)},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?F(r,e,t):n.bindTexture(32879,r.__webglTexture,33984+t)},this.setTextureCube=function(t,r){var o=i.get(t);t.version>0&&o.__version!==t.version?function(t,r,o){if(6!==r.image.length)return;var s=z(t,r),l=r.source;n.bindTexture(34067,t.__webglTexture,33984+o);var u=i.get(l);if(l.version!==u.__version||!0===s){n.activeTexture(33984+o),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var h=r.isCompressedTexture||r.image[0].isCompressedTexture,f=r.image[0]&&r.image[0].isDataTexture,v=[],p=0;p<6;p++)v[p]=h||f?f?r.image[p].image:r.image[p]:S(r.image[p],!1,!0,d),v[p]=G(r,v[p]);var m,g=v[0],y=_(g)||c,x=a.convert(r.format,r.encoding),b=a.convert(r.type),w=E(r.internalFormat,x,b,r.encoding),k=c&&!0!==r.isVideoTexture,T=void 0===u.__version||!0===s,P=C(r,g,y);if(B(34067,r,y),h){k&&T&&n.texStorage2D(34067,P,w,g.width,g.height);for(var D=0;D<6;D++){m=v[D].mipmaps;for(var O=0;O0&&P++,n.texStorage2D(34067,P,w,v[0].width,v[0].height));for(var R=0;R<6;R++)if(f){k?n.texSubImage2D(34069+R,0,0,0,v[R].width,v[R].height,x,b,v[R].data):n.texImage2D(34069+R,0,w,v[R].width,v[R].height,0,x,b,v[R].data);for(var L=0;L0&&!1===j(t)){var x=d?s:[s];l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer);for(var b=0;b0&&!1===j(t)){var r=t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=t.width,o=t.height,s=16384,l=[],u=t.stencilBuffer?33306:36096,h=i.get(t),d=!0===t.isWebGLMultipleRenderTargets;if(d)for(var f=0;f1&&void 0!==arguments[1]?arguments[1]:null;if(n===he)return 5121;if(1017===n)return 32819;if(1018===n)return 32820;if(1010===n)return 5120;if(1011===n)return 5122;if(n===de)return 5123;if(1013===n)return 5124;if(n===fe)return 5125;if(n===ve)return 5126;if(n===pe)return i?5131:null!==(r=t.get("OES_texture_half_float"))?r.HALF_FLOAT_OES:null;if(1021===n)return 6406;if(n===ge)return 6408;if(1024===n)return 6409;if(1025===n)return 6410;if(n===ye)return 6402;if(n===xe)return 34041;if(n===pt)return null!==(r=t.get("EXT_sRGB"))?r.SRGB_ALPHA_EXT:null;if(n===be)return 6403;if(1029===n)return 36244;if(n===we)return 33319;if(1031===n)return 33320;if(n===Se)return 36249;if(n===_e||n===Ae||n===Me||n===Ee)if(a===st){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===_e)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ae)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Me)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ee)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===_e)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ae)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Me)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ee)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Ce||n===ke||n===Te||n===Pe){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===Ce)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ke)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Te)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Pe)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return null!==(r=t.get("WEBGL_compressed_texture_etc1"))?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===De||n===Oe){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(n===De)return a===st?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Oe)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Ie||n===Re||n===Le||n===Be||n===ze||n===Fe||n===Ne||n===Ue||n===Ze||n===Ve||n===je||n===Ge||n===He||n===We){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(n===Ie)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Re)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Le)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Be)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ze)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Fe)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ne)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ue)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Ze)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ve)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===je)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ge)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===He)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===We)return a===st?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===qe){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(n===qe)return a===st?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===n||n===Xe||n===Ye||n===Qe){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(n===qe)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Xe)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ye)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Qe)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===me?i?34042:null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var jo=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(0,b.Z)(this,n),(e=t.call(this)).isArrayCamera=!0,e.cameras=i,e}return n}(sr),Go=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).isGroup=!0,e.type="Group",e}return n}(ci),Ho={type:"move"},Wo=function(){function e(){(0,b.Z)(this,e),this._targetRay=null,this._grip=null,this._hand=null}return(0,w.Z)(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new Go,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new Go,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new un,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new un),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new Go,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new un,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new un),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"connect",value:function(e){if(e&&e.hand){var t=this._hand;if(t){var n,i=D(e.hand.values());try{for(i.s();!(n=i.n()).done;){var r=n.value;this._getHandJoint(t,r)}}catch(a){i.e(a)}finally{i.f()}}}return this.dispatchEvent({type:"connected",data:e}),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var i=null,r=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){a=!0;var u,c=D(e.hand.values());try{for(c.s();!(u=c.n()).done;){var h=u.value,d=t.getJointPose(h,n),f=this._getHandJoint(l,h);null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=d.radius),f.visible=null!==d}}catch(g){c.e(g)}finally{c.f()}var v=l.joints["index-finger-tip"],p=l.joints["thumb-tip"],m=v.position.distanceTo(p.position);l.inputState.pinching&&m>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&m<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==s&&e.gripSpace&&(null!==(r=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1));null!==o&&(null===(i=t.getPose(e.targetRaySpace,n))&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ho)))}return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}},{key:"_getHandJoint",value:function(e,t){if(void 0===e.joints[t.jointName]){var n=new Go;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}]),e}(),qo=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h){var d;if((0,b.Z)(this,n),(h=void 0!==h?h:ye)!==ye&&h!==xe)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&h===ye&&(r=fe),void 0===r&&h===xe&&(r=me),(d=t.call(this,null,a,o,s,l,u,h,r,c)).isDepthTexture=!0,d.image={width:e,height:i},d.magFilter=void 0!==l?l:se,d.minFilter=void 0!==u?u:se,d.flipY=!1,d.generateMipmaps=!1,d}return n}(tn),Xo=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;(0,b.Z)(this,n),r=t.call(this);var a=(0,f.Z)(r),o=null,s=1,l=null,u="local-floor",h=1,d=null,v=null,p=null,m=null,g=null,y=null,w=i.getContextAttributes(),S=null,_=null,A=[],M=[],E=new Set,C=new Map,k=new sr;k.layers.enable(1),k.viewport=new nn;var T=new sr;T.layers.enable(2),T.viewport=new nn;var P=[k,T],O=new jo;O.layers.enable(1),O.layers.enable(2);var I=null,R=null;function L(e){var t=M.indexOf(e.inputSource);if(-1!==t){var n=A[t];void 0!==n&&n.dispatchEvent({type:e.type,data:e.inputSource})}}function B(){o.removeEventListener("select",L),o.removeEventListener("selectstart",L),o.removeEventListener("selectend",L),o.removeEventListener("squeeze",L),o.removeEventListener("squeezestart",L),o.removeEventListener("squeezeend",L),o.removeEventListener("end",B),o.removeEventListener("inputsourceschange",z);for(var t=0;t=0&&(M[i]=null,A[i].disconnect(n))}for(var r=0;r=M.length){M.push(a),o=s;break}if(null===M[s]){M[s]=a,o=s;break}}if(-1===o)break}var l=A[o];l&&l.connect(a)}}r.cameraAutoUpdate=!0,r.enabled=!1,r.isPresenting=!1,r.getController=function(e){var t=A[e];return void 0===t&&(t=new Wo,A[e]=t),t.getTargetRaySpace()},r.getControllerGrip=function(e){var t=A[e];return void 0===t&&(t=new Wo,A[e]=t),t.getGripSpace()},r.getHand=function(e){var t=A[e];return void 0===t&&(t=new Wo,A[e]=t),t.getHandSpace()},r.setFramebufferScaleFactor=function(e){s=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},r.setReferenceSpaceType=function(e){u=e,!0===a.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},r.getReferenceSpace=function(){return d||l},r.setReferenceSpace=function(e){d=e},r.getBaseLayer=function(){return null!==m?m:g},r.getBinding=function(){return p},r.getFrame=function(){return y},r.getSession=function(){return o},r.setSession=function(){var t=(0,c.Z)(x().mark((function t(n){var r,c,f,v,y;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(o=n)){t.next=35;break}if(S=e.getRenderTarget(),o.addEventListener("select",L),o.addEventListener("selectstart",L),o.addEventListener("selectend",L),o.addEventListener("squeeze",L),o.addEventListener("squeezestart",L),o.addEventListener("squeezeend",L),o.addEventListener("end",B),o.addEventListener("inputsourceschange",z),t.t0=!0!==w.xrCompatible,!t.t0){t.next=14;break}return t.next=14,i.makeXRCompatible();case 14:if(void 0!==o.renderState.layers&&!1!==e.capabilities.isWebGL2){t.next=19;break}r={antialias:void 0!==o.renderState.layers||w.antialias,alpha:w.alpha,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s},g=new XRWebGLLayer(o,i,r),o.updateRenderState({baseLayer:g}),_=new rn(g.framebufferWidth,g.framebufferHeight,{format:ge,type:he,encoding:e.outputEncoding,stencilBuffer:w.stencil}),t.next=25;break;case 19:c=null,f=null,v=null,w.depth&&(v=w.stencil?35056:33190,c=w.stencil?xe:ye,f=w.stencil?me:fe),y={colorFormat:32856,depthFormat:v,scaleFactor:s},p=new XRWebGLBinding(o,i),m=p.createProjectionLayer(y),o.updateRenderState({layers:[m]}),_=new rn(m.textureWidth,m.textureHeight,{format:ge,type:he,depthTexture:new qo(m.textureWidth,m.textureHeight,f,void 0,void 0,void 0,void 0,void 0,void 0,c),stencilBuffer:w.stencil,encoding:e.outputEncoding,samples:w.antialias?4:0}),e.properties.get(_).__ignoreDepthValues=m.ignoreDepthValues;case 25:return _.isXRRenderTarget=!0,this.setFoveation(h),d=null,t.next=30,o.requestReferenceSpace(u);case 30:l=t.sent,V.setContext(o),V.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"});case 35:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}();var F=new un,N=new un;function U(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}r.updateCamera=function(e){if(null!==o){O.near=T.near=k.near=e.near,O.far=T.far=k.far=e.far,(I!==O.near||R!==O.far)&&(o.updateRenderState({depthNear:O.near,depthFar:O.far}),I=O.near,R=O.far);var t=e.parent,n=O.cameras;U(O,t);for(var i=0;iN&&(C.set(F,F.lastChangedTime),a.dispatchEvent({type:"planechanged",data:F}))}else E.add(F),C.set(F,n.lastChangedTime),a.dispatchEvent({type:"planeadded",data:F})}}catch(U){z.e(U)}finally{z.f()}}y=null})),r.setAnimationLoop=function(e){Z=e},r.dispose=function(){},r}return n}(mt);function Yo(e,t){function n(n,i){n.opacity.value=i.opacity,i.color&&n.diffuse.value.copy(i.color),i.emissive&&n.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(n.map.value=i.map),i.alphaMap&&(n.alphaMap.value=i.alphaMap),i.bumpMap&&(n.bumpMap.value=i.bumpMap,n.bumpScale.value=i.bumpScale,1===i.side&&(n.bumpScale.value*=-1)),i.displacementMap&&(n.displacementMap.value=i.displacementMap,n.displacementScale.value=i.displacementScale,n.displacementBias.value=i.displacementBias),i.emissiveMap&&(n.emissiveMap.value=i.emissiveMap),i.normalMap&&(n.normalMap.value=i.normalMap,n.normalScale.value.copy(i.normalScale),1===i.side&&n.normalScale.value.negate()),i.specularMap&&(n.specularMap.value=i.specularMap),i.alphaTest>0&&(n.alphaTest.value=i.alphaTest);var r,a,o=t.get(i).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;var s=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*s}i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap?r=i.clearcoatRoughnessMap:i.iridescenceMap?r=i.iridescenceMap:i.iridescenceThicknessMap?r=i.iridescenceThicknessMap:i.specularIntensityMap?r=i.specularIntensityMap:i.specularColorMap?r=i.specularColorMap:i.transmissionMap?r=i.transmissionMap:i.thicknessMap?r=i.thicknessMap:i.sheenColorMap?r=i.sheenColorMap:i.sheenRoughnessMap&&(r=i.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),n.uvTransform.value.copy(r.matrix)),i.aoMap?a=i.aoMap:i.lightMap&&(a=i.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,ir(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,i,r,a,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(e,i):i.isMeshToonMaterial?(n(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,i)):i.isMeshPhongMaterial?(n(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,i)):i.isMeshStandardMaterial?(n(e,i),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,i),i.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate())),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap)),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,o)):i.isMeshMatcapMaterial?(n(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,i)):i.isMeshDepthMaterial?n(e,i):i.isMeshDistanceMaterial?(n(e,i),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?n(e,i):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){var r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,a):i.isSpriteMaterial?function(e,t){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function Qo(e,t,n,i){var r={},a={},o=[],s=n.isWebGL2?e.getParameter(35375):0;function l(e,t,n){var i=e.value;if(void 0===n[t]){if("number"==typeof i)n[t]=i;else{for(var r=Array.isArray(i)?i:[i],a=[],o=0;o0)0!==(r=n%i)&&i-r-l.boundary<0&&(n+=i-r,s.__offset=n);n+=l.storage}(r=n%i)>0&&(n+=i-r),e.__size=n,e.__cache={}}(n),d=function(t){var n=function(){for(var e=0;e0&&void 0!==arguments[0]?arguments[0]:{};this.isWebGLRenderer=!0;var t,n=void 0!==e.canvas?e.canvas:Ko(),i=void 0!==e.context?e.context:null,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;t=null!==i?i.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;var d=null,f=null,v=[],p=[];this.domElement=n,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=ot,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;var m=this,g=!1,y=0,b=0,w=null,S=-1,_=null,A=new nn,M=new nn,E=null,C=n.width,k=n.height,T=1,P=null,D=null,O=new nn(0,0,C,k),I=new nn(0,0,C,k),R=!1,L=new yr,B=!1,z=!1,F=null,N=new Nn,U=new Dt,Z=new un,V={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===w?T:1}var G,H,W,q,X,Q,K,J,$,ee,te,ne,ie,re,ae,oe,se,le,ue,de,fe,me,ye,xe,be=i;function we(e,t){for(var i=0;i0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;e&&(i|=16384),t&&(i|=256),n&&(i|=1024),be.clear(i)},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(){n.removeEventListener("webglcontextlost",Ee,!1),n.removeEventListener("webglcontextrestored",Ce,!1),n.removeEventListener("webglcontextcreationerror",ke,!1),re.dispose(),ae.dispose(),X.dispose(),K.dispose(),J.dispose(),te.dispose(),ye.dispose(),xe.dispose(),ne.dispose(),Me.dispose(),Me.removeEventListener("sessionstart",Re),Me.removeEventListener("sessionend",Le),F&&(F.dispose(),F=null),Be.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=V);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=Ge(e,t,n,i,r);W.setMaterial(i,o);var l=n.index,u=1;!0===i.wireframe&&(l=ee.getWireframeAttribute(n),u=2);var c=n.drawRange,h=n.attributes.position,d=c.start*u,f=(c.start+c.count)*u;null!==a&&(d=Math.max(d,a.start*u),f=Math.min(f,(a.start+a.count)*u)),null!==l?(d=Math.max(d,0),f=Math.min(f,l.count)):null!=h&&(d=Math.max(d,0),f=Math.min(f,h.count));var v=f-d;if(!(v<0||v===1/0)){ye.setup(r,i,s,n,l);var p,m=de;if(null!==l&&(p=$.get(l),(m=fe).setIndex(p)),r.isMesh)!0===i.wireframe?(W.setLineWidth(i.wireframeLinewidth*j()),m.setMode(1)):m.setMode(4);else if(r.isLine){var g=i.linewidth;void 0===g&&(g=1),W.setLineWidth(g*j()),r.isLineSegments?m.setMode(1):r.isLineLoop?m.setMode(2):m.setMode(3)}else r.isPoints?m.setMode(0):r.isSprite&&m.setMode(4);if(r.isInstancedMesh)m.renderInstances(d,v,r.count);else if(n.isInstancedBufferGeometry){var y=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,x=Math.min(n.instanceCount,y);m.renderInstances(d,v,x)}else m.render(d,v)}},this.compile=function(e,t){function n(e,t,n){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,Ve(e,t,n),e.side=0,e.needsUpdate=!0,Ve(e,t,n),e.side=2):Ve(e,t,n)}(f=ae.get(e)).init(),p.push(f),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(f.pushLight(e),e.castShadow&&f.pushShadow(e))})),f.setupLights(m.physicallyCorrectLights),e.traverse((function(t){var i=t.material;if(i)if(Array.isArray(i))for(var r=0;r0&&Ne(r,t,n),i&&W.viewport(A.copy(i)),r.length>0&&Ue(r,t,n),a.length>0&&Ue(a,t,n),o.length>0&&Ue(o,t,n),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1)}function Ne(e,t,n){var i=H.isWebGL2;null===F&&(F=new rn(1,1,{generateMipmaps:!0,type:G.has("EXT_color_buffer_half_float")?pe:he,minFilter:ce,samples:i&&!0===o?4:0})),m.getDrawingBufferSize(U),i?F.setSize(U.x,U.y):F.setSize(Ct(U.x),Ct(U.y));var r=m.getRenderTarget();m.setRenderTarget(F),m.clear();var a=m.toneMapping;m.toneMapping=0,Ue(e,t,n),m.toneMapping=a,Q.updateMultisampleRenderTarget(F),Q.updateRenderTargetMipmap(F),m.setRenderTarget(r)}function Ue(e,t,n){for(var i=!0===t.isScene?t.overrideMaterial:null,r=0,a=e.length;r0?p[p.length-1]:null,v.pop(),d=v.length>0?v[v.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(e,t,n){X.get(e.texture).__webglTexture=t,X.get(e.depthTexture).__webglTexture=n;var i=X.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===G.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=X.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;w=e,y=t,b=n;var i=!0,r=null,a=!1,o=!1;if(e){var s=X.get(e);void 0!==s.__useDefaultFramebuffer?(W.bindFramebuffer(36160,null),i=!1):void 0===s.__webglFramebuffer?Q.setupRenderTarget(e):s.__hasExternalTextures&&Q.rebindTextures(e,X.get(e.texture).__webglTexture,X.get(e.depthTexture).__webglTexture);var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);var u=X.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=u[t],a=!0):r=H.isWebGL2&&e.samples>0&&!1===Q.useMultisampledRTT(e)?X.get(e).__webglMultisampledFramebuffer:u,A.copy(e.viewport),M.copy(e.scissor),E=e.scissorTest}else A.copy(O).multiplyScalar(T).floor(),M.copy(I).multiplyScalar(T).floor(),E=R;if(W.bindFramebuffer(36160,r)&&H.drawBuffers&&i&&W.drawBuffers(e,r),W.viewport(A),W.scissor(M),W.setScissorTest(E),a){var c=X.get(e.texture);be.framebufferTexture2D(36160,36064,34069+t,c.__webglTexture,n)}else if(o){var h=X.get(e.texture),d=t||0;be.framebufferTextureLayer(36160,36064,h.__webglTexture,n||0,d)}S=-1},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=X.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){W.bindFramebuffer(36160,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==ge&&me.convert(u)!==be.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===pe&&(G.has("EXT_color_buffer_half_float")||H.isWebGL2&&G.has("EXT_color_buffer_float"));if(c!==he&&me.convert(c)!==be.getParameter(35738)&&(c!==ve||!(H.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float")))&&!h)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&be.readPixels(t,n,i,r,me.convert(u),me.convert(c),a)}finally{var d=null!==w?X.get(w).__webglFramebuffer:null;W.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.readRenderTargetPixelsAsync=function(){var e=(0,c.Z)(x().mark((function e(t,n,i,r,a,o,s){var l,u,c,h,d,f,v;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&t.isWebGLRenderTarget){e.next=2;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");case 2:if(l=X.get(t).__webglFramebuffer,t.isWebGLCubeRenderTarget&&void 0!==s&&(l=l[s]),!l){e.next=23;break}if(u=t.texture,c=u.format,h=u.type,!(n>=0&&n<=t.width-r&&i>=0&&i<=t.height-a)){e.next=22;break}return W.bindFramebuffer(be.FRAMEBUFFER,l),d=be.createBuffer(),be.bindBuffer(be.PIXEL_PACK_BUFFER,d),be.bufferData(be.PIXEL_PACK_BUFFER,o.byteLength,be.STREAM_READ),be.readPixels(n,i,r,a,me.convert(c),me.convert(h),0),f=null!==w?X.get(w).__webglFramebuffer:null,W.bindFramebuffer(be.FRAMEBUFFER,f),v=be.fenceSync(be.SYNC_GPU_COMMANDS_COMPLETE,0),be.flush(),e.next=15,Ft(be,v,4);case 15:return be.bindBuffer(be.PIXEL_PACK_BUFFER,d),be.getBufferSubData(be.PIXEL_PACK_BUFFER,0,o),be.deleteBuffer(d),be.deleteSync(v),e.abrupt("return",o);case 22:throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");case 23:case"end":return e.stop()}}),e)})));return function(t,n,i,r,a,o,s){return e.apply(this,arguments)}}(),this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i);Q.setTexture2D(t,0),be.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,a),W.unbindTexture()},this.copyTextureToTexture=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=t.image.width,a=t.image.height,o=me.convert(n.format),s=me.convert(n.type);Q.setTexture2D(n,0),be.pixelStorei(37440,n.flipY),be.pixelStorei(37441,n.premultiplyAlpha),be.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?be.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?be.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):be.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&be.generateMipmap(3553),W.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(m.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=me.convert(i.format),c=me.convert(i.type);if(i.isData3DTexture)Q.setTexture3D(i,0),a=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Q.setTexture2DArray(i,0),a=35866}be.pixelStorei(37440,i.flipY),be.pixelStorei(37441,i.premultiplyAlpha),be.pixelStorei(3317,i.unpackAlignment);var h=be.getParameter(3314),d=be.getParameter(32878),f=be.getParameter(3316),v=be.getParameter(3315),p=be.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;be.pixelStorei(3314,g.width),be.pixelStorei(32878,g.height),be.pixelStorei(3316,e.min.x),be.pixelStorei(3315,e.min.y),be.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?be.texSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,c,g.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),be.compressedTexSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,g.data)):be.texSubImage3D(a,r,t.x,t.y,t.z,o,s,l,u,c,g),be.pixelStorei(3314,h),be.pixelStorei(32878,d),be.pixelStorei(3316,f),be.pixelStorei(3315,v),be.pixelStorei(32877,p),0===r&&i.generateMipmaps&&be.generateMipmap(a),W.unbindTexture()}},this.initRenderTarget=function(e){void 0===X.get(e).__webglFramebuffer&&Q.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Q.setTextureCube(e,0):e.isData3DTexture?Q.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Q.setTexture2DArray(e,0):Q.setTexture2D(e,0),W.unbindTexture()},this.resetState=function(){y=0,b=0,w=null,W.reset(),ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n})(Jo).prototype.isWebGL1Renderer=!0;var $o=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;(0,b.Z)(this,e),this.isFog=!0,this.name="",this.color=new Yt(t),this.near=n,this.far=i}return(0,w.Z)(e,[{key:"clone",value:function(){return new e(this.color,this.near,this.far)}},{key:"toJSON",value:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}]),e}(),es=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).isScene=!0,e.type="Scene",e.background=null,e.environment=null,e.fog=null,e.backgroundBlurriness=0,e.backgroundIntensity=1,e.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:(0,f.Z)(e)})),e}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}},{key:"autoUpdate",get:function(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate},set:function(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}]),n}(ci),ts=function(){function e(t,n){(0,b.Z)(this,e),this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=ft,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=wt()}return(0,w.Z)(e,[{key:"onUploadCallback",value:function(){}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=wt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=wt()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),e}(),ns=new un,is=function(){function e(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(0,b.Z)(this,e),this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=i,this.normalized=r}return(0,w.Z)(e,[{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:se,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:se,f=arguments.length>10?arguments[10]:void 0,v=arguments.length>11?arguments[11]:void 0;return(0,b.Z)(this,n),(e=t.call(this,null,l,u,c,h,d,o,s,f,v)).isDataTexture=!0,e.image={data:i,width:r,height:a},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return n}(tn),os=new Nn,ss=new Nn,ls=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];(0,b.Z)(this,e),this.uuid=wt(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return(0,w.Z)(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,i=this.bones.length;n3&&void 0!==arguments[3]?arguments[3]:1;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).isInstancedBufferAttribute=!0,a.meshPerAttribute=o,a}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}]),n}(Ci),cs=new Nn,hs=new Nn,ds=[],fs=new Nn,vs=new Ji,ps=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;(0,b.Z)(this,n),(a=t.call(this,e,i)).isInstancedMesh=!0,a.instanceMatrix=new us(new Float32Array(16*r),16),a.instanceColor=null,a.count=r,a.frustumCulled=!1;for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:new Fi,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ms;return(0,b.Z)(this,n),(e=t.call(this)).isLine=!0,e.type="Line",e.geometry=i,e.material=r,e.updateMorphTargets(),e}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value:function(){var e=this.geometry;if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;is)){h.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(h);xe.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}}else for(var b=Math.max(0,a.start),w=Math.min(v.count,a.start+a.count)-1;bs)){h.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(h);Se.far||t.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}},{key:"updateMorphTargets",value:function(){var e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){var n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,r=n.length;i=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}]),n}(tn),Cs=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c){var h;return(0,b.Z)(this,n),(h=t.call(this,e,i,r,a,o,s,l,u,c)).isCanvasTexture=!0,h.needsUpdate=!0,h}return n}(tn),ks=function(){function e(){(0,b.Z)(this,e),this.type="Curve",this.arcLengthDivisions=200}return(0,w.Z)(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],i=this.getPoint(0),r=0;n.push(0);for(var a=1;a<=e;a++)r+=(t=this.getPoint(a/e)).distanceTo(i),n.push(r),i=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new Dt:new un);return o.copy(a).sub(r).normalize(),o}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new un,i=[],r=[],a=[],o=new un,s=new Nn,l=0;l<=e;l++){var u=l/e;i[l]=this.getTangentAt(u,new un)}r[0]=new un,a[0]=new un;var c=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),f=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),f<=c&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(var v=1;v<=e;v++){if(r[v]=r[v-1].clone(),a[v]=a[v-1].clone(),o.crossVectors(i[v-1],i[v]),o.length()>Number.EPSILON){o.normalize();var p=Math.acos(St(i[v-1].dot(i[v]),-1,1));r[v].applyMatrix4(s.makeRotationAxis(o,p))}a[v].crossVectors(i[v],r[v])}if(!0===t){var m=Math.acos(St(r[0].dot(r[e]),-1,1));m/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(m=-m);for(var g=1;g<=e;g++)r[g].applyMatrix4(s.makeRotationAxis(i[g],m*g)),a[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),Ts=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return(0,b.Z)(this,n),(e=t.call(this)).isEllipseCurve=!0,e.type="EllipseCurve",e.aX=i,e.aY=r,e.xRadius=a,e.yRadius=o,e.aStartAngle=s,e.aEndAngle=l,e.aClockwise=u,e.aRotation=c,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e,t){for(var n=t||new Dt,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;r0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return(0,b.Z)(this,n),(e=t.call(this)).isCatmullRomCurve3=!0,e.type="CatmullRomCurve3",e.points=i,e.closed=r,e.curveType=a,e.tension=o,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,r=i,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?t=a[(l-1)%o]:(Os.subVectors(a[0],a[1]).add(a[0]),t=Os);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+20&&void 0!==arguments[0]?arguments[0]:new Dt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Dt,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Dt;return(0,b.Z)(this,n),(e=t.call(this)).isCubicBezierCurve=!0,e.type="CubicBezierCurve",e.v0=i,e.v1=r,e.v2=a,e.v3=o,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Ns(e,i.x,r.x,a.x,o.x),Ns(e,i.y,r.y,a.y,o.y)),n}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(ks),Zs=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new un,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new un;return(0,b.Z)(this,n),(e=t.call(this)).isCubicBezierCurve3=!0,e.type="CubicBezierCurve3",e.v0=i,e.v1=r,e.v2=a,e.v3=o,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,n=t,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Ns(e,i.x,r.x,a.x,o.x),Ns(e,i.y,r.y,a.y,o.y),Ns(e,i.z,r.z,a.z,o.z)),n}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(ks),Vs=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt;return(0,b.Z)(this,n),(e=t.call(this)).isLineCurve=!0,e.type="LineCurve",e.v1=i,e.v2=r,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e,t){var n=t||new Dt;return n.copy(this.v2).sub(this.v1).normalize(),n}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(ks),js=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un;return(0,b.Z)(this,n),(e=t.call(this)).isLineCurve3=!0,e.type="LineCurve3",e.v1=i,e.v2=r,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(ks),Gs=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Dt;return(0,b.Z)(this,n),(e=t.call(this)).isQuadraticBezierCurve=!0,e.type="QuadraticBezierCurve",e.v0=i,e.v1=r,e.v2=a,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Fs(e,i.x,r.x,a.x),Fs(e,i.y,r.y,a.y)),n}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(ks),Hs=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new un;return(0,b.Z)(this,n),(e=t.call(this)).isQuadraticBezierCurve3=!0,e.type="QuadraticBezierCurve3",e.v0=i,e.v1=r,e.v2=a,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un,n=t,i=this.v0,r=this.v1,a=this.v2;return n.set(Fs(e,i.x,r.x,a.x),Fs(e,i.y,r.y,a.y),Fs(e,i.z,r.z,a.z)),n}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(ks),Ws=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(0,b.Z)(this,n),(e=t.call(this)).isSplineCurve=!0,e.type="SplineCurve",e.points=i,e}return(0,w.Z)(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],u=i[a>i.length-2?i.length-1:a+1],c=i[a>i.length-3?i.length-1:a+2];return n.set(zs(o,s.x,l.x,u.x,c.x),zs(o,s.y,l.y,u.y,c.y)),n}},{key:"copy",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,i=e.points.length;t=n){var a=i[r]-n,o=this.curves[r],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}r++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],i=0,r=this.curves;i1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(Xs),Qs=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new Dt(0,-.5),new Dt(.5,0),new Dt(0,.5)],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;(0,b.Z)(this,n),(e=t.call(this)).type="LatheGeometry",e.parameters={points:i,segments:r,phiStart:a,phiLength:o},r=Math.floor(r),o=St(o,0,2*Math.PI);for(var s=[],l=[],u=[],c=[],h=[],d=1/r,f=new un,v=new Dt,p=new un,m=new un,g=new un,y=0,x=0,w=0;w<=i.length-1;w++)switch(w){case 0:y=i[w+1].x-i[w].x,x=i[w+1].y-i[w].y,p.x=1*x,p.y=-y,p.z=0*x,g.copy(p),p.normalize(),c.push(p.x,p.y,p.z);break;case i.length-1:c.push(g.x,g.y,g.z);break;default:y=i[w+1].x-i[w].x,x=i[w+1].y-i[w].y,p.x=1*x,p.y=-y,p.z=0*x,m.copy(p),p.x+=g.x,p.y+=g.y,p.z+=g.z,p.normalize(),c.push(p.x,p.y,p.z),g.copy(m)}for(var S=0;S<=r;S++)for(var _=a+S*d*o,A=Math.sin(_),M=Math.cos(_),E=0;E<=i.length-1;E++){f.x=i[E].x*A,f.y=i[E].y,f.z=i[E].x*M,l.push(f.x,f.y,f.z),v.x=S/r,v.y=E/(i.length-1),u.push(v.x,v.y);var C=c[3*E+0]*A,k=c[3*E+1],T=c[3*E+0]*M;h.push(C,k,T)}for(var P=0;P0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;(0,b.Z)(this,n),(e=t.call(this)).type="CylinderGeometry",e.parameters={radiusTop:i,radiusBottom:r,height:a,radialSegments:o,heightSegments:s,openEnded:l,thetaStart:u,thetaLength:c};var h=(0,f.Z)(e);o=Math.floor(o),s=Math.floor(s);var d=[],v=[],p=[],m=[],g=0,y=[],x=a/2,w=0;function S(){for(var e=new un,t=new un,n=0,l=(r-i)/a,f=0;f<=s;f++){for(var b=[],S=f/s,_=S*(r-i)+i,A=0;A<=o;A++){var M=A/o,E=M*c+u,C=Math.sin(E),k=Math.cos(E);t.x=_*C,t.y=-S*a+x,t.z=_*k,v.push(t.x,t.y,t.z),e.set(C,l,k).normalize(),p.push(e.x,e.y,e.z),m.push(M,1-S),b.push(g++)}y.push(b)}for(var T=0;T0&&_(!0),r>0&&_(!1)),e.setIndex(d),e.setAttribute("position",new Pi(v,3)),e.setAttribute("normal",new Pi(p,3)),e.setAttribute("uv",new Pi(m,2)),e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(Fi),Js=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;return(0,b.Z)(this,n),(e=t.call(this,0,i,r,a,o,s,l,u)).type="ConeGeometry",e.parameters={radius:i,height:r,radialSegments:a,heightSegments:o,openEnded:s,thetaStart:l,thetaLength:u},e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}]),n}(Ks),$s=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,b.Z)(this,n),(e=t.call(this)).type="PolyhedronGeometry",e.parameters={vertices:i,indices:r,radius:a,detail:o};var s=[],l=[];function u(e){for(var t=new un,n=new un,i=new un,a=0;a.9&&a<.1&&(t<.2&&(l[e+0]+=1),n<.2&&(l[e+2]+=1),i<.2&&(l[e+4]+=1))}}function v(e){s.push(e.x,e.y,e.z)}function p(e,t){var n=3*e;t.x=i[n+0],t.y=i[n+1],t.z=i[n+2]}function m(){for(var e=new un,t=new un,n=new un,i=new un,r=new Dt,a=new Dt,o=new Dt,u=0,c=0;u0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,b.Z)(this,n);var a=(1+Math.sqrt(5))/2,o=1/a,s=[-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,-o,-a,0,-o,a,0,o,-a,0,o,a,-o,-a,0,-o,a,0,o,-a,0,o,a,0,-a,0,-o,a,0,-o,-a,0,o,a,0,o],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];return(e=t.call(this,s,l,i,r)).type="DodecahedronGeometry",e.parameters={radius:i,detail:r},e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}($s),tl=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,e)).uuid=wt(),i.type="Shape",i.holes=[],i}return(0,w.Z)(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,i=this.holes.length;n2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=il(e,0,h,u,!0),f=[];if(!d||d.next===d.prev)return f;if(c&&(d=cl(e,t,d,u)),e.length>80*u){n=r=e[0],i=a=e[1];for(var v=u;vr&&(r=o),s>a&&(a=s);l=0!==(l=Math.max(r-n,a-i))?32767/l:0}return al(d,f,u,n,i,l,0),f};function il(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a0)for(a=t;a=t;a-=i)o=Ml(a,e[a],e[a+1],o);return o&&xl(o,o.next)&&(El(o),o=o.next),o}function rl(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!xl(i,i.next)&&0!==yl(i.prev,i,i.next))i=i.next;else{if(El(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function al(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{0===r.z&&(r.z=vl(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,u*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?sl(e,i,r,a):ol(e))t.push(s.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),El(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?al(e=ll(rl(e),t,n),t,n,i,r,a,2):2===o&&ul(e,t,n,i,r,a):al(rl(e),t,n,i,r,a,1);break}}}function ol(e){var t=e.prev,n=e,i=e.next;if(yl(t,n,i)>=0)return!1;for(var r=t.x,a=n.x,o=i.x,s=t.y,l=n.y,u=i.y,c=ra?r>o?r:o:a>o?a:o,f=s>l?s>u?s:u:l>u?l:u,v=i.next;v!==t;){if(v.x>=c&&v.x<=d&&v.y>=h&&v.y<=f&&ml(r,s,a,l,o,u,v.x,v.y)&&yl(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function sl(e,t,n,i){var r=e.prev,a=e,o=e.next;if(yl(r,a,o)>=0)return!1;for(var s=r.x,l=a.x,u=o.x,c=r.y,h=a.y,d=o.y,f=sl?s>u?s:u:l>u?l:u,m=c>h?c>d?c:d:h>d?h:d,g=vl(f,v,t,n,i),y=vl(p,m,t,n,i),x=e.prevZ,b=e.nextZ;x&&x.z>=g&&b&&b.z<=y;){if(x.x>=f&&x.x<=p&&x.y>=v&&x.y<=m&&x!==r&&x!==o&&ml(s,c,l,h,u,d,x.x,x.y)&&yl(x.prev,x,x.next)>=0||(x=x.prevZ,b.x>=f&&b.x<=p&&b.y>=v&&b.y<=m&&b!==r&&b!==o&&ml(s,c,l,h,u,d,b.x,b.y)&&yl(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;x&&x.z>=g;){if(x.x>=f&&x.x<=p&&x.y>=v&&x.y<=m&&x!==r&&x!==o&&ml(s,c,l,h,u,d,x.x,x.y)&&yl(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;b&&b.z<=y;){if(b.x>=f&&b.x<=p&&b.y>=v&&b.y<=m&&b!==r&&b!==o&&ml(s,c,l,h,u,d,b.x,b.y)&&yl(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function ll(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!xl(r,a)&&bl(r,i,i.next,a)&&_l(r,a)&&_l(a,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(a.i/n|0),El(i),El(i.next),i=e=a),i=i.next}while(i!==e);return rl(i)}function ul(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&gl(o,s)){var l=Al(o,s);return o=rl(o,o.next),l=rl(l,l.next),al(o,t,n,i,r,a,0),void al(l,t,n,i,r,a,0)}s=s.next}o=o.next}while(o!==e)}function cl(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=a&&s>r&&(r=s,n=i.x=i.x&&i.x>=c&&a!==i.x&&ml(on.x||i.x===n.x&&fl(n,i)))&&(n=i,d=l)),i=i.next}while(i!==u);return n}(e,t);if(!n)return t;var i=Al(n,e);return rl(i,i.next),rl(n,n.next)}function fl(e,t){return yl(e.prev,e,t.prev)<0&&yl(t.next,e,e.next)<0}function vl(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function pl(e){var t=e,n=e;do{(t.x=(e-o)*(a-s)&&(e-o)*(i-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(r-o)*(i-s)}function gl(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&bl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(_l(e,t)&&_l(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(yl(e.prev,e,t.prev)||yl(e,t.prev,t))||xl(e,t)&&yl(e.prev,e,e.next)>0&&yl(t.prev,t,t.next)>0)}function yl(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function xl(e,t){return e.x===t.x&&e.y===t.y}function bl(e,t,n,i){var r=Sl(yl(e,t,n)),a=Sl(yl(e,t,i)),o=Sl(yl(n,i,e)),s=Sl(yl(n,i,t));return!!(r!==a&&o!==s||0===r&&wl(e,n,t)||0===a&&wl(e,i,t)||0===o&&wl(n,e,i)||0===s&&wl(n,t,i))}function wl(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Sl(e){return e>0?1:e<0?-1:0}function _l(e,t){return yl(e.prev,e,e.next)<0?yl(e,t,e.next)>=0&&yl(e,e.prev,t)>=0:yl(e,t,e.prev)<0||yl(e,e.next,t)<0}function Al(e,t){var n=new Cl(e.i,e.x,e.y),i=new Cl(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Ml(e,t,n,i){var r=new Cl(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function El(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Cl(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}var kl=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"area",value:function(e){for(var t=e.length,n=0,i=t-1,r=0;r2&&e[t-1].equals(e[0])&&e.pop()}function Pl(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,b.Z)(this,n);var a=(1+Math.sqrt(5))/2,o=[-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1],s=[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];return(e=t.call(this,o,s,i,r)).type="IcosahedronGeometry",e.parameters={radius:i,detail:r},e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.detail)}}]),n}($s),Ol=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;(0,b.Z)(this,n),(e=t.call(this)).type="SphereGeometry",e.parameters={radius:i,widthSegments:r,heightSegments:a,phiStart:o,phiLength:s,thetaStart:l,thetaLength:u},r=Math.max(3,Math.floor(r)),a=Math.max(2,Math.floor(a));for(var c=Math.min(l+u,Math.PI),h=0,d=[],f=new un,v=new un,p=[],m=[],g=[],y=[],x=0;x<=a;x++){var w=[],S=x/a,_=0;0==x&&0==l?_=.5/r:x==a&&c==Math.PI&&(_=-.5/r);for(var A=0;A<=r;A++){var M=A/r;f.x=-i*Math.cos(o+M*s)*Math.sin(l+S*u),f.y=i*Math.cos(l+S*u),f.z=i*Math.sin(o+M*s)*Math.sin(l+S*u),m.push(f.x,f.y,f.z),v.copy(f).normalize(),g.push(v.x,v.y,v.z),y.push(M+_,1-S),w.push(h++)}d.push(w)}for(var E=0;E0)&&p.push(k,T,D),(E!==a-1||c0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:48,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI;(0,b.Z)(this,n),(e=t.call(this)).type="TorusGeometry",e.parameters={radius:i,tube:r,radialSegments:a,tubularSegments:o,arc:s},a=Math.floor(a),o=Math.floor(o);for(var l=[],u=[],c=[],h=[],d=new un,f=new un,v=new un,p=0;p<=a;p++)for(var m=0;m<=o;m++){var g=m/o*s,y=p/a*Math.PI*2;f.x=(i+r*Math.cos(y))*Math.cos(g),f.y=(i+r*Math.cos(y))*Math.sin(g),f.z=r*Math.sin(y),u.push(f.x,f.y,f.z),d.x=i*Math.cos(g),d.y=i*Math.sin(g),v.subVectors(f,d).normalize(),c.push(v.x,v.y,v.z),h.push(m/o),h.push(p/a)}for(var x=1;x<=a;x++)for(var w=1;w<=o;w++){var S=(o+1)*x+w-1,_=(o+1)*(x-1)+w-1,A=(o+1)*(x-1)+w,M=(o+1)*x+w;l.push(S,_,M),l.push(_,A,M)}return e.setIndex(l),e.setAttribute("position",new Pi(u,3)),e.setAttribute("normal",new Pi(c,3)),e.setAttribute("uv",new Pi(h,2)),e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}]),n}(Fi),Rl=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;(0,b.Z)(this,n),(e=t.call(this)).type="TorusKnotGeometry",e.parameters={radius:i,tube:r,tubularSegments:a,radialSegments:o,p:s,q:l},a=Math.floor(a),o=Math.floor(o);for(var u=[],c=[],h=[],d=[],f=new un,v=new un,p=new un,m=new un,g=new un,y=new un,x=new un,w=0;w<=a;++w){var S=w/a*s*Math.PI*2;I(S,s,l,i,p),I(S+.01,s,l,i,m),y.subVectors(m,p),x.addVectors(m,p),g.crossVectors(y,x),x.crossVectors(g,y),g.normalize(),x.normalize();for(var _=0;_<=o;++_){var A=_/o*Math.PI*2,M=-r*Math.cos(A),E=r*Math.sin(A);f.x=p.x+(M*x.x+E*g.x),f.y=p.y+(M*x.y+E*g.y),f.z=p.z+(M*x.z+E*g.z),c.push(f.x,f.y,f.z),v.subVectors(f,p).normalize(),h.push(v.x,v.y,v.z),d.push(w/a),d.push(_/o)}}for(var C=1;C<=a;C++)for(var k=1;k<=o;k++){var T=(o+1)*(C-1)+(k-1),P=(o+1)*C+(k-1),D=(o+1)*C+k,O=(o+1)*(C-1)+k;u.push(T,P,O),u.push(P,D,O)}function I(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(s)*.5}return e.setIndex(u),e.setAttribute("position",new Pi(c,3)),e.setAttribute("normal",new Pi(h,3)),e.setAttribute("uv",new Pi(d,2)),e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}]),n}(Fi),Ll=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,e)).isRawShaderMaterial=!0,i.type="RawShaderMaterial",i}return n}(ar);function Bl(e,t,n){return Fl(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)}function zl(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Fl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Nl(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n}function Ul(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r}function Zl(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}}var Vl=function(){function e(t,n,i,r){(0,b.Z)(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new n.constructor(i),this.sampleValues=n,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}return(0,w.Z)(e,[{key:"evaluate",value:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e=r)break e;var s=t[1];e=(r=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Bl(n,r,a),this.values=Bl(this.values,r*o,a*o)}return this}},{key:"validate",value:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&Fl(i))for(var l=0,u=i.length;l!==u;++l){var c=i[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=Bl(this.times),t=Bl(this.values),n=this.getValueSize(),i=this.getInterpolation()===tt,r=e.length-1,a=1,o=1;o0){e[a]=e[r];for(var g=r*n,y=a*n,x=0;x!==n;++x)t[y+x]=t[g+x];++a}return a!==e.length?(this.times=Bl(e,0,a),this.values=Bl(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=Bl(this.times,0),t=Bl(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:zl(e.times,Array),values:zl(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}]),e}();Wl.prototype.TimeBufferType=Float32Array,Wl.prototype.ValueBufferType=Float32Array,Wl.prototype.DefaultInterpolation=et;var ql=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(Wl);ql.prototype.ValueTypeName="bool",ql.prototype.ValueBufferType=Array,ql.prototype.DefaultInterpolation=$e,ql.prototype.InterpolantFactoryMethodLinear=void 0,ql.prototype.InterpolantFactoryMethodSmooth=void 0;var Xl=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(Wl);Xl.prototype.ValueTypeName="color";var Yl=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(Wl);Yl.prototype.ValueTypeName="number";var Ql=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a){return(0,b.Z)(this,n),t.call(this,e,i,r,a)}return(0,w.Z)(n,[{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t),l=e*o,u=l+o;l!==u;l+=4)ln.slerpFlat(r,0,a,l-o,a,l,s);return r}}]),n}(Vl),Kl=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return(0,w.Z)(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new Ql(this.times,this.values,this.getValueSize(),e)}}]),n}(Wl);Kl.prototype.ValueTypeName="quaternion",Kl.prototype.DefaultInterpolation=et,Kl.prototype.InterpolantFactoryMethodSmooth=void 0;var Jl=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(Wl);Jl.prototype.ValueTypeName="string",Jl.prototype.ValueBufferType=Array,Jl.prototype.DefaultInterpolation=$e,Jl.prototype.InterpolantFactoryMethodLinear=void 0,Jl.prototype.InterpolantFactoryMethodSmooth=void 0;var $l=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(Wl);$l.prototype.ValueTypeName="vector";var eu=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:at;(0,b.Z)(this,e),this.name=t,this.tracks=i,this.duration=n,this.blendMode=r,this.uuid=wt(),this.duration<0&&this.resetDuration()}return(0,w.Z)(e,[{key:"resetDuration",value:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this}},{key:"trim",value:function(){for(var e=0;e1){var u=l[1],c=i[u];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var d in i)h.push(this.CreateFromMorphTargetSequence(d,i[d],t,n));return h}},{key:"parseAnimation",value:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Zl(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u"u"||void 0===t.body||void 0===t.body.getReader)return t;var n=ou[e],i=t.body.getReader(),r=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=r?parseInt(r):0,o=0!==a,s=0,l=new ReadableStream({start:function(e){!function t(){i.read().then((function(i){var r=i.done,l=i.value;if(r)e.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c1&&void 0!==arguments[1]?arguments[1]:1;return(0,b.Z)(this,n),(i=t.call(this)).isLight=!0,i.type="Light",i.color=new Yt(e),i.intensity=r,i}return(0,w.Z)(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}]),n}(ci),du=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,r)).isHemisphereLight=!0,a.type="HemisphereLight",a.position.copy(ci.DEFAULT_UP),a.updateMatrix(),a.groundColor=new Yt(i),a}return(0,w.Z)(n,[{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.groundColor.copy(e.groundColor),this}}]),n}(hu),fu=new Nn,vu=new un,pu=new un,mu=function(){function e(t){(0,b.Z)(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Dt(512,512),this.map=null,this.mapPass=null,this.matrix=new Nn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new yr,this._frameExtents=new Dt(1,1),this._viewportCount=1,this._viewports=[new nn(0,0,1,1)]}return(0,w.Z)(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;vu.setFromMatrixPosition(e.matrixWorld),t.position.copy(vu),pu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(pu),t.updateMatrixWorld(),fu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(fu)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}]),e}(),gu=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,new sr(50,1,.5,500))).isSpotLightShadow=!0,e.focus=1,e}return(0,w.Z)(n,[{key:"updateMatrices",value:function(e){var t=this.camera,i=2*bt*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;(i!==t.fov||r!==t.aspect||a!==t.far)&&(t.fov=i,t.aspect=r,t.far=a,t.updateProjectionMatrix()),(0,d.Z)((0,m.Z)(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(mu),yu=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;return(0,b.Z)(this,n),(r=t.call(this,e,i)).isSpotLight=!0,r.type="SpotLight",r.position.copy(ci.DEFAULT_UP),r.updateMatrix(),r.target=new ci,r.distance=a,r.angle=o,r.penumbra=s,r.decay=l,r.map=null,r.shadow=new gu,r}return(0,w.Z)(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}]),n}(hu),xu=new Nn,bu=new un,wu=new un,Su=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,new sr(90,1,.5,500))).isPointLightShadow=!0,e._frameExtents=new Dt(4,2),e._viewportCount=6,e._viewports=[new nn(2,1,1,1),new nn(0,1,1,1),new nn(3,1,1,1),new nn(1,1,1,1),new nn(3,0,1,1),new nn(1,0,1,1)],e._cubeDirections=[new un(1,0,0),new un(-1,0,0),new un(0,0,1),new un(0,0,-1),new un(0,1,0),new un(0,-1,0)],e._cubeUps=[new un(0,1,0),new un(0,1,0),new un(0,1,0),new un(0,1,0),new un(0,0,1),new un(0,0,-1)],e}return(0,w.Z)(n,[{key:"updateMatrices",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),bu.setFromMatrixPosition(e.matrixWorld),n.position.copy(bu),wu.copy(n.position),wu.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wu),n.updateMatrixWorld(),i.makeTranslation(-bu.x,-bu.y,-bu.z),xu.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xu)}}]),n}(mu),_u=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return(0,b.Z)(this,n),(r=t.call(this,e,i)).isPointLight=!0,r.type="PointLight",r.distance=a,r.decay=o,r.shadow=new Su,r}return(0,w.Z)(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},{key:"power",get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}]),n}(hu),Au=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,new Or(-5,5,5,-5,.5,500))).isDirectionalLightShadow=!0,e}return n}(mu),Mu=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,e,i)).isDirectionalLight=!0,r.type="DirectionalLight",r.position.copy(ci.DEFAULT_UP),r.updateMatrix(),r.target=new ci,r.shadow=new Au,r}return(0,w.Z)(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(hu),Eu=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).isInstancedBufferGeometry=!0,e.type="InstancedBufferGeometry",e.instanceCount=1/0,e}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.instanceCount=e.instanceCount,this}},{key:"toJSON",value:function(){var e=(0,d.Z)((0,m.Z)(n.prototype),"toJSON",this).call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}]),n}(Fi),Cu=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){return(0,b.Z)(this,n),t.call(this,e)}return(0,w.Z)(n,[{key:"load",value:function(e,t,n,i){var r=this,a=new lu(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(_b){i?i(_b):console.error(_b),r.manager.itemError(e)}}),n,i)}},{key:"parse",value:function(e){var t={},n={};function i(e,i){if(void 0!==t[i])return t[i];var r=e.interleavedBuffers[i],a=function(e,t){if(void 0!==n[t])return n[t];var i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),o=Bt(r.type,a),s=new ts(o,r.stride);return s.uuid=r.uuid,t[i]=s,s}var r=e.isInstancedBufferGeometry?new Eu:new Fi,a=e.data.index;if(void 0!==a){var o=Bt(a.type,a.array);r.setIndex(new Ci(o,1))}var s=e.data.attributes;for(var l in s){var u=s[l],c=void 0;if(u.isInterleavedBufferAttribute){var h=i(e.data,u.data);c=new is(h,u.itemSize,u.offset,u.normalized)}else{var d=Bt(u.type,u.array);c=new(u.isInstancedBufferAttribute?us:Ci)(d,u.itemSize,u.normalized)}void 0!==u.name&&(c.name=u.name),void 0!==u.usage&&c.setUsage(u.usage),void 0!==u.updateRange&&(c.updateRange.offset=u.updateRange.offset,c.updateRange.count=u.updateRange.count),r.setAttribute(l,c)}var f=e.data.morphAttributes;if(f)for(var v in f){for(var p=f[v],m=[],g=0,y=p.length;g0&&void 0!==arguments[0])||arguments[0];(0,b.Z)(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return(0,w.Z)(e,[{key:"start",value:function(){this.startTime=Tu(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=Tu();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function Tu(){return(typeof performance>"u"?Date:performance).now()}var Pu=function(){function e(t,n,i){var r,a,o;switch((0,b.Z)(this,e),this.binding=t,this.valueSize=i,n){case"quaternion":r=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":r=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:r=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return(0,w.Z)(e,[{key:"accumulate",value:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(n,i,s,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,i){ln.slerpFlat(e,t,e,t,e,n,i)}},{key:"_slerpAdditive",value:function(e,t,n,i,r){var a=this._workIndex*r;ln.multiplyQuaternionsFlat(e,a,e,t,e,n),ln.slerpFlat(e,t,e,t,e,a,i)}},{key:"_lerp",value:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}},{key:"_lerpAdditive",value:function(e,t,n,i,r){for(var a=0;a!==r;++a){var o=t+a;e[o]=e[o]+e[n+a]*i}}}]),e}(),Du="\\[\\]\\.:\\/",Ou=new RegExp("["+Du+"]","g"),Iu="[^"+Du+"]",Ru="[^"+Du.replace("\\.","")+"]",Lu=/((?:WC+[\/:])*)/.source.replace("WC",Iu),Bu=/(WCOD+)?/.source.replace("WCOD",Ru),zu=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Iu),Fu=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Iu),Nu=new RegExp("^"+Lu+Bu+zu+Fu+"$"),Uu=["material","materials","bones","map"],Zu=function(){function e(t,n,i){(0,b.Z)(this,e);var r=i||Vu.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,r)}return(0,w.Z)(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Vu=function(){function e(t,n,i){(0,b.Z)(this,e),this.path=n,this.parsedPath=i||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return(0,w.Z)(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,i=n.objectName,r=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(i){var o=n.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;(0,b.Z)(this,e),this._mixer=t,this._clip=n,this._localRoot=i,this.blendMode=r;for(var a=n.tracks,o=a.length,s=new Array(o),l={endingStart:nt,endingEnd:nt},u=0;u!==o;++u){var c=a[u].createInterpolant(null);s[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ke,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}return(0,w.Z)(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=r,s[1]=r+n,l[0]=e/a,l[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;a<0||0===n?t=0:(this._startTime=null,t=n*a)}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case 2501:for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);break;case at:default:for(var d=0,f=l.length;d!==f;++d)l[d].evaluate(o),u[d].accumulate(i,s)}}}else this._updateWeight(e)}},{key:"_updateWeight",value:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}},{key:"_updateTimeScale",value:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,i=this.time+e,r=this._loopCount,a=n===Je;if(0===e)return-1===r?i:a&&1===(1&r)?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){var o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&1===(1&r))return t-i}return i}},{key:"_setEndings",value:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=it,i.endingEnd=it):(i.endingStart=e?this.zeroSlopeAtStart?it:nt:rt,i.endingEnd=t?this.zeroSlopeAtEnd?it:nt:rt)}},{key:"_scheduleFading",value:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}]),e}(),Gu=new Float32Array(1),Hu=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this))._root=e,i._initMemoryManager(),i._accuIndex=0,i.time=0,i.timeScale=1,i}return(0,w.Z)(n,[{key:"_bindAction",value:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==r;++c){var h=i[c],d=h.name,f=u[d];if(void 0!==f)++f.referenceCount,a[c]=f;else{if(void 0!==(f=a[c])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var v=t&&t._propertyBindings[c].binding.parsedPath;++(f=new Pu(Vu.create(n,d,v),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),a[c]=f}o[c].resultBuffer=f.buffer}}},{key:"_activateAction",value:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0===s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}},{key:"_deactivateAction",value:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0===--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}},{key:"update",value:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(i,e,r,a);for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;(0,b.Z)(this,e),this.ray=new Fn(t,n),this.near=i,this.far=r,this.camera=null,this.layers=new Qn,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}return(0,w.Z)(e,[{key:"set",value:function(e,t){this.ray.set(e,t)}},{key:"setFromCamera",value:function(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}},{key:"intersectObject",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Yu(e,this,n,t),n.sort(Xu),n}},{key:"intersectObjects",value:function(e){for(var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=0,r=e.length;i0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,b.Z)(this,e),this.radius=t,this.phi=n,this.theta=i,this}return(0,w.Z)(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(St(t/this.radius,-1,1))),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Ku=new Dt,Ju=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt(-1/0,-1/0);(0,b.Z)(this,e),this.isBox2=!0,this.min=t,this.max=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return Ku.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}(),$u=new un,ec=new un,tc=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new un;(0,b.Z)(this,e),this.start=t,this.end=n}return(0,w.Z)(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){$u.subVectors(e,this.start),ec.subVectors(this.end,this.start);var n=ec.dot(ec),i=ec.dot($u)/n;return t&&(i=St(i,0,1)),i}},{key:"closestPointToPoint",value:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),nc=new un,ic=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;(0,b.Z)(this,n),(r=t.call(this)).light=e,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.color=i,r.type="SpotLightHelper";for(var a=new Fi,o=[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],s=0,l=1;s<32;s++,l++){var u=s/32*Math.PI*2,c=l/32*Math.PI*2;o.push(Math.cos(u),Math.sin(u),1,Math.cos(c),Math.sin(c),1)}a.setAttribute("position",new Pi(o,3));var h=new ms({fog:!1,toneMapped:!1});return r.cone=new Ms(a,h),r.add(r.cone),r.update(),r}return(0,w.Z)(n,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),nc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(nc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),n}(ci),rc=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;(0,b.Z)(this,n);var o=new Ol(i,4,2),s=new Ai({wireframe:!0,fog:!1,toneMapped:!1});return(a=t.call(this,o,s)).light=e,a.color=r,a.type="PointLightHelper",a.matrix=a.light.matrixWorld,a.matrixAutoUpdate=!1,a.update(),a}return(0,w.Z)(n,[{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}]),n}(Ji),ac=new un,oc=new un,sc=new un,lc=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;(0,b.Z)(this,n),(a=t.call(this)).light=e,a.matrix=e.matrixWorld,a.matrixAutoUpdate=!1,a.color=r,a.type="DirectionalLightHelper",void 0===i&&(i=1);var o=new Fi;o.setAttribute("position",new Pi([-i,i,0,i,i,0,i,-i,0,-i,-i,0,-i,i,0],3));var s=new ms({fog:!1,toneMapped:!1});return a.lightPlane=new Ss(o,s),a.add(a.lightPlane),(o=new Fi).setAttribute("position",new Pi([0,0,0,0,0,1],3)),a.targetLine=new Ss(o,s),a.add(a.targetLine),a.update(),a}return(0,w.Z)(n,[{key:"dispose",value:function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}},{key:"update",value:function(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),ac.setFromMatrixPosition(this.light.matrixWorld),oc.setFromMatrixPosition(this.light.target.matrixWorld),sc.subVectors(oc,ac),this.lightPlane.lookAt(oc),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(oc),this.targetLine.scale.z=sc.length()}}]),n}(ci),uc=new un,cc=new or,hc=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;(0,b.Z)(this,n);var r=new Fi,a=new ms({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],s=[],l={};function u(e,t){c(e),c(t)}function c(e){o.push(0,0,0),s.push(0,0,0),void 0===l[e]&&(l[e]=[]),l[e].push(o.length/3-1)}u("n1","n2"),u("n2","n4"),u("n4","n3"),u("n3","n1"),u("f1","f2"),u("f2","f4"),u("f4","f3"),u("f3","f1"),u("n1","f1"),u("n2","f2"),u("n3","f3"),u("n4","f4"),u("p","n1"),u("p","n2"),u("p","n3"),u("p","n4"),u("u1","u2"),u("u2","u3"),u("u3","u1"),u("c","t"),u("p","c"),u("cn1","cn2"),u("cn3","cn4"),u("cf1","cf2"),u("cf3","cf4"),r.setAttribute("position",new Pi(o,3)),r.setAttribute("color",new Pi(s,3)),(i=t.call(this,r,a)).type="CameraHelper",i.camera=e,i.camera.updateProjectionMatrix&&i.camera.updateProjectionMatrix(),i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i.pointMap=l,i.update();var h=new Yt(16755200),d=new Yt(16711680),f=new Yt(43775),v=new Yt(16777215),p=new Yt(3355443);return i.setColors(h,d,f,v,p),i}return(0,w.Z)(n,[{key:"setColors",value:function(e,t,n,i,r){var a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,n.r,n.g,n.b),a.setXYZ(33,n.r,n.g,n.b),a.setXYZ(34,n.r,n.g,n.b),a.setXYZ(35,n.r,n.g,n.b),a.setXYZ(36,n.r,n.g,n.b),a.setXYZ(37,n.r,n.g,n.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,r.r,r.g,r.b),a.setXYZ(41,r.r,r.g,r.b),a.setXYZ(42,r.r,r.g,r.b),a.setXYZ(43,r.r,r.g,r.b),a.setXYZ(44,r.r,r.g,r.b),a.setXYZ(45,r.r,r.g,r.b),a.setXYZ(46,r.r,r.g,r.b),a.setXYZ(47,r.r,r.g,r.b),a.setXYZ(48,r.r,r.g,r.b),a.setXYZ(49,r.r,r.g,r.b),a.needsUpdate=!0}},{key:"update",value:function(){var e=this.geometry,t=this.pointMap;cc.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),dc("c",t,e,cc,0,0,-1),dc("t",t,e,cc,0,0,1),dc("n1",t,e,cc,-1,-1,-1),dc("n2",t,e,cc,1,-1,-1),dc("n3",t,e,cc,-1,1,-1),dc("n4",t,e,cc,1,1,-1),dc("f1",t,e,cc,-1,-1,1),dc("f2",t,e,cc,1,-1,1),dc("f3",t,e,cc,-1,1,1),dc("f4",t,e,cc,1,1,1),dc("u1",t,e,cc,.7,1.1,-1),dc("u2",t,e,cc,-.7,1.1,-1),dc("u3",t,e,cc,0,2,-1),dc("cf1",t,e,cc,-1,0,1),dc("cf2",t,e,cc,1,0,1),dc("cf3",t,e,cc,0,-1,1),dc("cf4",t,e,cc,0,1,1),dc("cn1",t,e,cc,-1,0,-1),dc("cn2",t,e,cc,1,0,-1),dc("cn3",t,e,cc,0,-1,-1),dc("cn4",t,e,cc,0,1,-1),e.getAttribute("position").needsUpdate=!0}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(Ms);function dc(e,t,n,i,r,a,o){uc.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u1&&void 0!==arguments[1]?arguments[1]:16776960;(0,b.Z)(this,n);var a=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]),o=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Fi;return s.setIndex(new Ci(a,1)),s.setAttribute("position",new Pi(o,3)),(i=t.call(this,s,new ms({color:r,toneMapped:!1}))).box=e,i.type="Box3Helper",i.geometry.computeBoundingSphere(),i}return(0,w.Z)(n,[{key:"updateMatrixWorld",value:function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),(0,d.Z)((0,m.Z)(n.prototype),"updateMatrixWorld",this).call(this,e))}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(Ms),vc=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;(0,b.Z)(this,n);var r=[0,0,0,i,0,0,0,0,0,0,i,0,0,0,0,0,0,i],a=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],o=new Fi;o.setAttribute("position",new Pi(r,3)),o.setAttribute("color",new Pi(a,3));var s=new ms({vertexColors:!0,toneMapped:!1});return(e=t.call(this,o,s)).type="AxesHelper",e}return(0,w.Z)(n,[{key:"setColors",value:function(e,t,n){var i=new Yt,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose()}}]),n}(Ms),pc=function(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512),a=0;a<256;++a){var o=a-127;o<-27?(i[a]=0,i[256|a]=32768,r[a]=24,r[256|a]=24):o<-14?(i[a]=1024>>-o-14,i[256|a]=1024>>-o-14|32768,r[a]=-o-1,r[256|a]=-o-1):o<=15?(i[a]=o+15<<10,i[256|a]=o+15<<10|32768,r[a]=13,r[256|a]=13):o<128?(i[a]=31744,i[256|a]=64512,r[a]=24,r[256|a]=24):(i[a]=31744,i[256|a]=64512,r[a]=13,r[256|a]=13)}for(var s=new Uint32Array(2048),l=new Uint32Array(64),u=new Uint32Array(64),c=1;c<1024;++c){for(var h=c<<13,d=0;0===(8388608&h);)h<<=1,d-=8388608;h&=-8388609,d+=947912704,s[c]=h|d}for(var f=1024;f<2048;++f)s[f]=939524096+(f-1024<<13);for(var v=1;v<31;++v)l[v]=v<<23;l[31]=1199570944,l[32]=2147483648;for(var p=33;p<63;++p)l[p]=2147483648+(p-32<<23);l[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(u[m]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:l,offsetTable:u}}();var mc=Object.freeze({__proto__:null,fromHalfFloat:function(e){var t=e>>10;return pc.uint32View[0]=pc.mantissaTable[pc.offsetTable[t]+(1023&e)]+pc.exponentTable[t],pc.floatView[0]},toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=St(e,-65504,65504),pc.floatView[0]=e;var t=pc.uint32View[0],n=t>>23&511;return pc.baseTable[n]+((8388607&t)>>pc.shiftTable[n])}});typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Y}})),window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Y;var gc=".",yc=Symbol("target"),xc=Symbol("unsubscribe");function bc(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}function wc(e){return("object"==typeof e?null===e:"function"!=typeof e)||e instanceof RegExp}var Sc=Array.isArray;function _c(e){return"symbol"==typeof e}var Ac={after:function(e,t){return Sc(e)?e.slice(t.length):""===t?e:e.slice(t.length+1)},concat:function(e,t){return Sc(e)?(e=(0,l.Z)(e),t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+=gc),_c(t)?e+t.toString():e+t):e},initial:function(e){if(Sc(e))return e.slice(0,-1);if(""===e)return e;var t=e.lastIndexOf(gc);return-1===t?"":e.slice(0,t)},last:function(e){if(Sc(e))return e[e.length-1]||"";if(""===e)return e;var t=e.lastIndexOf(gc);return-1===t?e:e.slice(t+1)},walk:function(e,t){if(Sc(e)){var n,i=D(e);try{for(i.s();!(n=i.n()).done;){t(n.value)}}catch(o){i.e(o)}finally{i.f()}}else if(""!==e){var r=0,a=e.indexOf(gc);if(-1===a)t(e);else for(;r0}}],[{key:"isHandledType",value:function(e){return Tc(e)||Sc(e)||bc(e)}},{key:"isHandledMethod",value:function(e,t){return Tc(e)?Hc.isHandledMethod(t):Sc(e)?Wc.isHandledMethod(t):e instanceof Set?Xc.isHandledMethod(t):e instanceof Map?Yc.isHandledMethod(t):bc(e)}}]),e}(),$c={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},eh=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=k(k({},$c),n);var i=Symbol("ProxyTarget"),r=n,a=r.equals,o=r.isShallow,s=r.ignoreDetached,l=r.details,u=new kc(a),c="function"==typeof n.onValidate,h=new Jc(c),d=function(e,t,i,r,a){return!c||h.isCloning||!0===n.onValidate(Ac.concat(u.getPath(e),t),i,r,a)},f=function(t,i,r,a){!Cc(u,n,i)&&(!s||!u.isDetached(t,e))&&v(u.getPath(t),i,r,a)},v=function(e,n,i,r,a){h.isCloning?h.update(e,n,r):t(Ac.concat(e,n),i,r,a)},p=function(e){return e&&(e[i]||e)},m=function(t,r,a,l){return wc(t)||"constructor"===a||o&&!Jc.isHandledMethod(r,a)||Cc(u,n,a)||u.isGetInvariant(r,a)||s&&u.isDetached(r,e)?t:(void 0===l&&(l=u.getPath(r)),u.getProxy(t,Ac.concat(l,a),g,i))},g={get:function(e,t,n){if(_c(t)){if(t===i||t===yc)return e;if(t===xc&&!u.isUnsubscribed&&0===u.getPath(e).length)return u.unsubscribe(),e}var r=bc(e)?Reflect.get(e,t):Reflect.get(e,t,n);return m(r,e,t)},set:function(e,t,n,r){n=p(n);var o=e[i]||e,s=o[t];if(a(s,n)&&t in e)return!0;var l=d(e,t,n,s);return l&&u.setProperty(o,t,n,r,s)?(f(e,t,e[t],s),!0):!l},defineProperty:function(e,t,n){if(!u.isSameDescriptor(n,e,t)){var i=e[t];d(e,t,n.value,i)&&u.defineProperty(e,t,n,i)&&f(e,t,n.value,i)}return!0},deleteProperty:function(e,t){if(!Reflect.has(e,t))return!0;var n=Reflect.get(e,t),i=d(e,t,void 0,n);return i&&u.deleteProperty(e,t,n)?(f(e,t,void 0,n),!0):!i},apply:function(t,n,r){var o=n[i]||n;if(u.isUnsubscribed)return Reflect.apply(t,o,r);if((!1===l||!0!==l&&!l.includes(t.name))&&Jc.isHandledType(o)){var s=Ac.initial(u.getPath(t)),c=Jc.isHandledMethod(o,t.name);h.start(o,s,r);var f=Reflect.apply(t,h.preferredThisArg(t,n,o),c?r.map((function(e){return p(e)})):r),y=h.isChanged(o,a),x=h.stop();if(Jc.isHandledType(f)&&c&&(n instanceof Map&&"get"===t.name&&(s=Ac.concat(s,r[0])),f=u.getProxy(f,s,g)),y){var b={name:t.name,args:r,result:f},w=h.isCloning?Ac.initial(s):s,S=h.isCloning?Ac.last(s):"";d(Ac.get(e,w),S,o,x,b)?v(w,S,o,x,b):h.undo(o)}return(n instanceof Map||n instanceof Set)&&Mc(f)?Ec(f,t,n,s,m):f}return Reflect.apply(t,n,r)}},y=u.getProxy(e,n.pathAsArray?[]:"",g);return t=t.bind(y),c&&(n.onValidate=n.onValidate.bind(y)),y};eh.target=function(e){return e&&e[yc]||e},eh.unsubscribe=function(e){return e[xc]||e};var th=eh,nh="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ih="object"==typeof self&&self&&self.Object===Object&&self,rh=nh||ih||Function("return this")(),ah=rh.Symbol,oh=Object.prototype,sh=oh.hasOwnProperty,lh=oh.toString,uh=ah?ah.toStringTag:void 0;var ch=function(e){var t=sh.call(e,uh),n=e[uh];try{e[uh]=void 0;var i=!0}catch(a){}var r=lh.call(e);return i&&(t?e[uh]=n:delete e[uh]),r},hh=Object.prototype.toString;var dh=function(e){return hh.call(e)},fh=ah?ah.toStringTag:void 0;var vh=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":fh&&fh in Object(e)?ch(e):dh(e)};var ph=function(e){return null!=e&&"object"==typeof e};var mh=function(e){return"symbol"==typeof e||ph(e)&&"[object Symbol]"==vh(e)};var gh=function(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}};var td=function(e){return function(){return e}},nd=function(){try{var e=qh(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),id=ed(nd?function(e,t){return nd(e,"toString",{configurable:!0,enumerable:!1,value:td(t),writable:!0})}:Oh);var rd=function(e,t){for(var n=-1,i=null==e?0:e.length;++n-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991};var xd=function(e){return null!=e&&yd(e.length)&&!Ih(e)},bd=Object.prototype;var wd=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bd)};var Sd=function(e,t){for(var n=-1,i=Array(e);++n-1};var xf=function(e,t){var n=this.__data__,i=vf(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};function bf(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t0&&i(l)?n>1?e(l,n-1,i,r,a):Zf(a,l):r||(a[a.length]=l)}return a};var Hf=function(e){return(null==e?0:e.length)?Gf(e,1):[]};var Wf=function(e){return id(gd(e,void 0,Hf),e+"")},qf=Gd(Object.getPrototypeOf,Object),Xf=Function.prototype,Yf=Object.prototype,Qf=Xf.toString,Kf=Yf.hasOwnProperty,Jf=Qf.call(Object);var $f=function(e){if(!ph(e)||"[object Object]"!=vh(e))return!1;var t=qf(e);if(null===t)return!0;var n=Kf.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Qf.call(n)==Jf};var ev=function(e,t,n){var i=-1,r=e.length;t<0&&(t=-t>r?0:r+t),(n=n>r?r:n)<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(r);++i=i?e:ev(e,t,n)},nv=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var iv=function(e){return nv.test(e)};var rv=function(e){return e.split("")},av="\\ud800-\\udfff",ov="["+av+"]",sv="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",lv="\\ud83c[\\udffb-\\udfff]",uv="[^"+av+"]",cv="(?:\\ud83c[\\udde6-\\uddff]){2}",hv="[\\ud800-\\udbff][\\udc00-\\udfff]",dv="(?:"+sv+"|"+lv+")"+"?",fv="[\\ufe0e\\ufe0f]?",vv=fv+dv+("(?:\\u200d(?:"+[uv,cv,hv].join("|")+")"+fv+dv+")*"),pv="(?:"+[uv+sv+"?",sv,cv,hv,ov].join("|")+")",mv=RegExp(lv+"(?="+lv+")|"+pv+vv,"g");var gv=function(e){return e.match(mv)||[]};var yv=function(e){return iv(e)?gv(e):rv(e)};var xv=function(){this.__data__=new wf,this.size=0};var bv=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n};var wv=function(e){return this.__data__.get(e)};var Sv=function(e){return this.__data__.has(e)};var _v=function(e,t){var n=this.__data__;if(n instanceof wf){var i=n.__data__;if(!Sf||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Df(i)}return n.set(e,t),this.size=n.size,this};function Av(e){var t=this.__data__=new wf(e);this.size=t.size}Av.prototype.clear=xv,Av.prototype.delete=bv,Av.prototype.get=wv,Av.prototype.has=Sv,Av.prototype.set=_v;var Mv=Av;var Ev=function(e,t){return e&&pd(t,Xd(t),e)};var Cv=function(e,t){return e&&pd(t,Jd(t),e)},kv="object"==typeof exports&&exports&&!exports.nodeType&&exports,Tv=kv&&e&&!e.nodeType&&e,Pv=Tv&&Tv.exports===kv?rh.Buffer:void 0,Dv=Pv?Pv.allocUnsafe:void 0;var Ov=function(e,t){if(t)return e.slice();var n=e.length,i=Dv?Dv(n):new e.constructor(n);return e.copy(i),i};var Iv=function(e,t){for(var n=-1,i=null==e?0:e.length,r=0,a=[];++ns))return!1;var u=a.get(e),c=a.get(t);if(u&&c)return u==t&&c==e;var h=-1,d=!0,f=2&n?new Ip:void 0;for(a.set(e,t),a.set(t,e);++h=t||n<0||h&&e-u>=a}function m(){var e=$p();if(p(e))return g(e);s=setTimeout(m,function(e){var n=t-(e-l);return h?tm(n,a-(e-u)):n}(e))}function g(e){return s=void 0,d&&i?f(e):(i=r=void 0,o)}function y(){var e=$p(),n=p(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return v(l);if(h)return clearTimeout(s),s=setTimeout(m,t),f(l)}return void 0===s&&(s=setTimeout(m,t)),o}return t=Dh(t)||0,Eh(n)&&(c=!!n.leading,a=(h="maxWait"in n)?em(Dh(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,i=l=r=s=void 0},y.flush=function(){return void 0===s?o:g($p())},y};var im=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0};var rm=function(e,t){return e>t};var am=function(e,t){return t.length<2?e:Uf(e,ev(t,0,-1))};var om=function(e,t){return Yp(e,t)};var sm=function(e,t,n){for(var i=-1,r=e.length;++i1),t})),pd(e,jv(e),n),i&&(n=kp(n,7,cm));for(var r=t.length;r--;)um(n,t[r]);return n}));var dm=function(e,t,n,i){if(!Eh(e))return e;for(var r=-1,a=(t=Ff(t,e)).length,o=a-1,s=e;null!=s&&++r-1;);return n};var ym=function(e,t,n){if((e=zf(e))&&(n||void 0===t))return e.slice(0,_h(e)+1);if(!e||!(t=wh(t)))return e;var i=yv(e),r=gm(i,yv(t))+1;return tv(i,0,r).join("")},xm=window.navigator.userAgent.toLowerCase().includes(" electron/"),bm=(xm&&function(){var e;var t=new URLSearchParams(window.location.search).get("desktop-app-version");t?window.localStorage.setItem("desktop-app-version",t):e=window.localStorage.getItem("desktop-app-version")}(),window.navigator.platform.toUpperCase().includes("MAC")),wm=/iPad|iPhone|iPod/.test(window.navigator.userAgent)||bm&&"ontouchend"in document,Sm=window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,_m="ontouchstart"in window||navigator.maxTouchPoints>0,Am=function(){var e=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(e)&&/Apple Computer/.test(t)}(),Mm=Number(function(){var e=navigator.userAgent.match(/Version\/(\d+\.\d)/);return e&&e[1]}());function Em(e){return bm?e.metaKey:e.ctrlKey}var Cm=[],km={},Tm={},Pm={};function Dm(e){Cm.includes(e)||Cm.push(e)}function Om(e){delete km[e.pointerId];for(var t=0;tt){var i=e;e=t,t=i}for(var r=[],a=1/(n+1),o=0;o0?t[0].id:this.traverseSortNext(e)}},{key:"traverseSortPrevious",value:function(e){var t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}},{key:"sortPrevious",value:function(e){var t=this.parent(e);if(void 0!==t){var n=this.childrenArray(t),i=n.findIndex((function(t){return t.id===e}))-1;return i>=0?this.traverseSortPrevious(n[i].id):t}}},{key:"getAllSorted",value:function(e){var t,n=[],i=D(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,a=this.getWithSortKey(r.id);void 0!==a&&n.push(k(k({},r),a))}}catch(l){i.e(l)}finally{i.f()}n.sort((function(e,t){return function(e,t){for(var n=0;nt[n])return 1;n+=1}return n!==t.length?-1:n!==e.length?1:0}(e.sortKey,t.sortKey)}));for(var o=0,s=n;oa.fi}));if(void 0===o){var s=i[i.length-1].fi;return Qm(s,s+n,n)}return Qm(a.fi,o.fi,n)}}]),n}((0,u.Z)(Array));!function(e){e.runOp=function(e,t){if(0!==t.type)return null;if(Array.isArray(e)){var n=t.props,i={},r=(0,l.Z)(e),a=!1;if(n)for(var o=0,s=Object.keys(n);or.fi}));if(void 0===a){var o=n[n.length-1].fi;return Qm(o,o+t,t)}return Qm(r.fi,a.fi,t)}}]),n}((0,u.Z)(Array));function ig(e){return e&&"object"==typeof e&&e instanceof ug}var rg,ag,og,sg,lg,ug=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,[{key:"unusedFunOverridesTable",value:function(e){}},{key:"runOp",value:function(t){for(var n=[],i=this,r=0,a={};r0;){if(0===Object.keys(i).length){var f=n[r-1];f&&delete(i=Ym(f))[t.path[r-1]]}else{var v=n[r-1];if(v){var p=Ym(v);p[t.path[r-1]]=i,i=p}else{var m=new e;m[t.path[r-1]]=i,i=m}}r-=1}return{data:Object.setPrototypeOf(i,e.prototype),actual:t,reverse:k(k({},t),{},{props:a})}}}]),e}();function cg(e,t){if(void 0!==t){var n=!1,i=e.map((function(e){var i=e.id,r=hg(e.data,t[i]);if(n=n||void 0!==r,void 0===r&&(r=e.data),e.children){var a=cg(e.children,t);return void 0!==a?n=!0:a=e.children,k(k({},e),{},{id:i,data:r,children:a})}return k(k({},e),{},{id:i,data:r})}));return n?i:void 0}}function hg(e,t){if(!ig(t))return t;if(e instanceof tg){var n=cg(e,t);return void 0!==n&&Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n}if(e instanceof ng)return function(e,t){if(void 0!==t){var n=!1,i=e.map((function(e){var i=e.id,r=hg(e.data,t[i]);return n=n||void 0!==r,void 0===r&&(r=e.data),k(k({},e),{},{id:i,data:r})}));return n?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}(e,t);if(Array.isArray(e)){var i=!1,r=e.map((function(e,n){var r=hg(e,t[n]);return i=i||void 0!==r,void 0===r&&(r=e),r}));return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}if(e instanceof ug)return dg(e,t);if(e&&"object"==typeof e){for(var a={},o=!1,s=0,l=Object.entries(e);s=0;o--){var s=n[o],u=i[o];if(u instanceof tg){if("number"==typeof s)throw new Error("illegal arg");a=u.modifyById(s,a)}else if(u instanceof ng){if("number"==typeof s)throw new Error("illegal arg");a=u.modifyById(s,a)}else if(u instanceof Wm){if("number"==typeof s)throw new Error("illegal arg");a=u.modifyById(s,a)}else if(u instanceof ug){var c=k(k({},u),{},(0,g.Z)({},s,a));a=Object.setPrototypeOf(c,ug.prototype)}else{if("object"!=typeof u)return null;if(Array.isArray(u)){if("string"==typeof s&&(s=parseInt(s),isNaN(s)))throw new Error("Invalid path");var h=a;(a=(0,l.Z)(u))[s]=h}else a=k(k({},u),{},(0,g.Z)({},s,a))}}return{data:a,actual:k(k({},r.actual),{},{path:n}),reverse:k(k({},r.reverse),{},{path:n})}}return null}var d=n[i.length],f=void 0;if(e instanceof tg){var v;if("number"==typeof d)throw new Error("");f=null===(v=e.get(d))||void 0===v?void 0:v.data}else if(e instanceof ng){var p;if("number"==typeof d)throw new Error("");f=null===(p=e.get(d))||void 0===p?void 0:p.data}else null!==e&&(f=e[d]);if(void 0===f)return null;i.push(e),e=f}}function n(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:[],i=this;if(null!==t){i._current=t.data;for(var r=n;!(i instanceof Pg);){var a=i._path,o=i._current;if(""!==a&&r.splice(0,0,a),null===(i=i._parent))return;i.update(a,o)}i.push(r,e,t.actual,t.reverse)}}},{key:"deleteChildren",value:function(e){if(this._children){var t=this._children[e];if(t){var n=t[xg];n&&n(),delete this._children[e]}}}}]),e}(),wg=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this))._parent=e,a._path=i,a._current=r,a}return(0,w.Z)(n,[{key:"update",value:function(e,t){if(Array.isArray(this._current)){if("string"==typeof e&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=(0,l.Z)(this._current),this._current[e]=t}else if(this._current instanceof ug){var n=k(k({},this._current),{},(0,g.Z)({},e,t));this._current=Object.setPrototypeOf(n,ug.prototype)}else this._current=k(k({},this._current),{},(0,g.Z)({},e,t))}},{key:"runOp",value:function(e){this.reportOp(e,eg.runOp(this._current,e),e.path)}}]),n}(bg),Sg=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this))._parent=e,a._path=i,a._current=r,a}return(0,w.Z)(n,[{key:"update",value:function(e,t){this._current=k(k({},this._current),{},(0,g.Z)({},e,t)),Object.setPrototypeOf(this._current,Wm.prototype)}},{key:"runOp",value:function(e){this.reportOp(e,this._current.runOp(e))}}]),n}(bg),_g={get:function(e,t){if(t===xg)return function(){e._parent=null};if(t===gg)return e._current;if(t===yg)return e;var n=e._current,i=e._children;if("push"===t&&Array.isArray(n))throw new Error("not supported to expand array");var r=void 0===i?void 0:i[t];if(void 0!==r)return r;var a=n[t],o=Dg(e,t,a);return o!==a?(void 0===i&&(i={},e._children=i),i[t]=o,o):a},has:function(e,t){return t in e._current},ownKeys:function(e){return Reflect.ownKeys(e._current)},defineProperty:function(){throw Error("not supported")},getPrototypeOf:function(e){return Object.getPrototypeOf(e._current)},setPrototypeOf:function(){throw Error("not supported")},getOwnPropertyDescriptor:function(e,t){var n=e._current,i=Reflect.getOwnPropertyDescriptor(n,t);return i&&{writable:!0,configurable:!0,enumerable:i.enumerable,value:n[t]}}},Ag=k(k({},_g),{},{set:function(e,t,n){var i,r={type:0,props:(0,g.Z)({},t,null!==(i=Rg(n))&&void 0!==i?i:n)};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty:function(e,t){var n={type:0,props:(0,g.Z)({},t,void 0)};return e.deleteChildren(t),e.runOp(n),!0}}),Mg=k(k({},_g),{},{set:function(e,t,n){return void 0===n?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:n})),!0},deleteProperty:function(e,t){return e.runOp({type:2,id:t}),!0}}),Eg=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this))._children={},a._parent=e,a._path=i,a._current=r,a[xg]=function(){a._parent=null},a}return(0,w.Z)(n,[{key:"unproxy",value:function(){return this._current}},{key:"update",value:function(e,t){this._current=this._current.modifyById(e,t)}},{key:"runOp",value:function(e){this.reportOp(e,this._current.runOp(e))}},{key:"randomId",value:function(){return this._current.randomId()}},{key:"isDescendantOf",value:function(e,t){return this._current.isDescendantOf(e,t)}},{key:"childrenOf",value:function(e){return this._current.childrenOf(e)}},{key:"traverse",value:function(e){return this._current.traverse(e)}},{key:"get",value:function(e){return this._current.get(e)}},{key:"parent",value:function(e){return this._current.parent(e)}},{key:"traverse",value:function(e){var t=this;this._current.traverse((function(n,i){e(n,t.data(n))}))}},{key:"data",value:function(e){var t,n=this._current,i=this._children,r=void 0===i?void 0:i[e];if(void 0!==r)return r;var a=null===(t=n.get(e))||void 0===t?void 0:t.data,o=Dg(this,e,a);return o!==a?(void 0===i&&(i={},this._children=i),i[e]=o,o):a}},{key:"add",value:function(e,t,n,i,r){this.runOp({type:7,parent:e,fi:t,id:n,data:i,children:r})}},{key:"move",value:function(e,t,n){this.runOp({type:9,parent:e,fi:t,id:n})}},{key:"insertAfter",value:function(e,t,n){for(var i=this._current.insertAfterHelper(e,t,n.length),r=0;r0){var i=e[e.length-1];if(0===i.type&&0===t.type&&Tg.equal(i.path,n))return void Object.assign(i.props,t.props)}e.push(k(k({},t),{},{path:n}))}var Tg,Pg=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).ts=[],i.actual=[],i.reverse=[],i._current=e,i}return(0,w.Z)(n,[{key:"update",value:function(e,t){if(""!==e)throw new Error("");this._current=t}},{key:"push",value:function(e,t,n,i){kg(this.ts,t,e),kg(this.actual,n,e),kg(this.reverse,i,e)}},{key:"result",value:function(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}}]),n}(bg);function Dg(e,t,n){return n instanceof tg?new Eg(e,t,n):n instanceof ng?new Cg(e,t,n):n instanceof Wm?new Proxy(new Sg(e,t,n),Mg):null!==n&&"object"==typeof n?Km(n)?n:new Proxy(new wg(e,t,n),Ag):n}function Og(e){var t=new Pg(e);return[Dg(t,"",e),t]}function Ig(e,t){var n=Og(e),i=(0,h.Z)(n,2),r=i[0],a=i[1];return t(r),a.result()}function Rg(e){return e instanceof Eg||e instanceof Cg?e._current:null!==e&&"object"==typeof e?e[gg]:e}function Lg(e,t){var n=[];if(!(t.length<=e.length))return null;for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:0;i-1?n:t.length,qg=0,Qg=0,$g=0,jg=null,Yg=Xg,Gg=null,Ug=t;try{Wg=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(ag){throw Ug=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 e){if(Kg=this,this.structures)return Vg=this.structures,sy();(!Vg||Vg.length>0)&&(Vg=[])}else Kg=ty,(!Vg||Vg.length>0)&&(Vg=[]);return sy()}},{key:"unpackMultiple",value:function(e,t){var n,i=0;try{ry=!0;var r=e.length,a=this?this.unpack(e,r):By.unpack(e,r);if(!t){for(n=[a];qg=32&&(r.highByte=n-32>>5))}for(var a in e.sharedLength=e.length,t||[])if(a>=0){var o=e[a],s=t[a];s&&(o&&((e.restoreStructures||(e.restoreStructures=[]))[a]=o),e[a]=s)}return this.structures=e}},{key:"decode",value:function(e,t){return this.unpack(e,t)}}]),e}();function sy(){try{if(!Kg.trusted&&!ry){var e=Vg.sharedLength||0;eZg){var n=new Error("Unexpected end of MessagePack data");throw n.incomplete=!0,n}if(!ry)throw new Error("Data read, but end of buffer not reached")}return t}catch(t){throw Vg.restoreStructures&&ly(),Oy(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer"))&&(t.incomplete=!0),t}}function ly(){for(var e in Vg.restoreStructures)Vg[e]=Vg.restoreStructures[e];Vg.restoreStructures=null}function uy(){var e,t=Ug[qg++];if(t<160){if(t<128){if(t<64)return t;var n=Vg[63&t]||Kg.getStructures&&fy()[63&t];return n?(n.read||(n.read=hy(n,63&t)),n.read()):t}if(t<144){if(t-=128,Kg.mapsAsObjects){for(var i={},r=0;r=qg)return jg.slice(qg-Jg,(qg+=u)-Jg);if(0==$g&&Zg<140){var c=u<16?_y(u):Sy(u);if(null!=c)return c}return vy(u)}switch(t){case 192:return null;case 193:return Gg?(e=uy())>0?Gg[1].slice(Gg.position1,Gg.position1+=e):Gg[0].slice(Gg.position0,Gg.position0-=e):iy;case 194:return!1;case 195:return!0;case 196:return Ay(Ug[qg++]);case 197:return e=Wg.getUint16(qg),qg+=2,Ay(e);case 198:return e=Wg.getUint32(qg),qg+=4,Ay(e);case 199:return My(Ug[qg++]);case 200:return e=Wg.getUint16(qg),qg+=2,My(e);case 201:return e=Wg.getUint32(qg),qg+=4,My(e);case 202:if(e=Wg.getFloat32(qg),Kg.useFloat32>2){var h=Iy[(127&Ug[qg])<<1|Ug[qg+1]>>7];return qg+=4,(h*e+(e>0?.5:-.5)>>0)/h}return qg+=4,e;case 203:return e=Wg.getFloat64(qg),qg+=8,e;case 204:return Ug[qg++];case 205:return e=Wg.getUint16(qg),qg+=2,e;case 206:return e=Wg.getUint32(qg),qg+=4,e;case 207:return Kg.int64AsNumber?(e=4294967296*Wg.getUint32(qg),e+=Wg.getUint32(qg+4)):e=Wg.getBigUint64(qg),qg+=8,e;case 208:return Wg.getInt8(qg++);case 209:return e=Wg.getInt16(qg),qg+=2,e;case 210:return e=Wg.getInt32(qg),qg+=4,e;case 211:return Kg.int64AsNumber?(e=4294967296*Wg.getInt32(qg),e+=Wg.getUint32(qg+4)):e=Wg.getBigInt64(qg),qg+=8,e;case 212:if(114==(e=Ug[qg++]))return ky(63&Ug[qg++]);var d=ey[e];if(d)return d.read?(qg++,d.read(uy())):d.noBuffer?(qg++,d()):d(Ug.subarray(qg,++qg));throw new Error("Unknown extension "+e);case 213:return 114==(e=Ug[qg])?(qg++,ky(63&Ug[qg++],Ug[qg++])):My(2);case 214:return My(4);case 215:return My(8);case 216:return My(16);case 217:return e=Ug[qg++],$g>=qg?jg.slice(qg-Jg,(qg+=e)-Jg):py(e);case 218:return e=Wg.getUint16(qg),$g>=(qg+=2)?jg.slice(qg-Jg,(qg+=e)-Jg):my(e);case 219:return e=Wg.getUint32(qg),$g>=(qg+=4)?jg.slice(qg-Jg,(qg+=e)-Jg):gy(e);case 220:return e=Wg.getUint16(qg),qg+=2,xy(e);case 221:return e=Wg.getUint32(qg),qg+=4,xy(e);case 222:return e=Wg.getUint16(qg),qg+=2,by(e);case 223:return e=Wg.getUint32(qg),qg+=4,by(e);default:if(t>=224)return t-256;if(void 0===t){var f=new Error("Unexpected end of MessagePack data");throw f.incomplete=!0,f}throw new Error("Unknown MessagePack token "+t)}}var cy=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function hy(e,t){function n(){if(n.count++>ay){var i=e.read=new Function("r","return function(){return {"+e.map((function(e){return cy.test(e)?e+":r()":"["+JSON.stringify(e)+"]:r()"})).join(",")+"}}")(uy);return 0===e.highByte&&(e.read=dy(t,e.read)),i()}for(var r={},a=0,o=e.length;a64&&Bg)return Bg.decode(Ug.subarray(qg,qg+=e));var n=qg+e,i=[];for(t="";qg65535&&(l-=65536,i.push(l>>>10&1023|55296),l=56320|1023&l),i.push(l)}else i.push(r);i.length>=4096&&(t+=wy.apply(String,i),i.length=0)}return i.length>0&&(t+=wy.apply(String,i)),t}function xy(e){for(var t=new Array(e),n=0;n0)return void(qg=t);n[i]=r}return wy.apply(String,n)}function _y(e){if(e<4){if(e<2){if(0===e)return"";var t=Ug[qg++];return(128&t)>1?void(qg-=1):wy(t)}var n=Ug[qg++],i=Ug[qg++];if((128&n)>0||(128&i)>0)return void(qg-=2);if(e<3)return wy(n,i);var r=Ug[qg++];return(128&r)>0?void(qg-=3):wy(n,i,r)}var a=Ug[qg++],o=Ug[qg++],s=Ug[qg++],l=Ug[qg++];if((128&a)>0||(128&o)>0||(128&s)>0||(128&l)>0)qg-=4;else{if(e<6){if(4===e)return wy(a,o,s,l);var u=Ug[qg++];return(128&u)>0?void(qg-=5):wy(a,o,s,l,u)}if(e<8){var c=Ug[qg++],h=Ug[qg++];if((128&c)>0||(128&h)>0)return void(qg-=6);if(e<7)return wy(a,o,s,l,c,h);var d=Ug[qg++];return(128&d)>0?void(qg-=7):wy(a,o,s,l,c,h,d)}var f=Ug[qg++],v=Ug[qg++],p=Ug[qg++],m=Ug[qg++];if((128&f)>0||(128&v)>0||(128&p)>0||(128&m)>0)qg-=8;else{if(e<10){if(8===e)return wy(a,o,s,l,f,v,p,m);var g=Ug[qg++];return(128&g)>0?void(qg-=9):wy(a,o,s,l,f,v,p,m,g)}if(e<12){var y=Ug[qg++],x=Ug[qg++];if((128&y)>0||(128&x)>0)return void(qg-=10);if(e<11)return wy(a,o,s,l,f,v,p,m,y,x);var b=Ug[qg++];return(128&b)>0?void(qg-=11):wy(a,o,s,l,f,v,p,m,y,x,b)}var w=Ug[qg++],S=Ug[qg++],_=Ug[qg++],A=Ug[qg++];if((128&w)>0||(128&S)>0||(128&_)>0||(128&A)>0)qg-=12;else{if(e<14){if(12===e)return wy(a,o,s,l,f,v,p,m,w,S,_,A);var M=Ug[qg++];return(128&M)>0?void(qg-=13):wy(a,o,s,l,f,v,p,m,w,S,_,A,M)}var E=Ug[qg++],C=Ug[qg++];if(!((128&E)>0||(128&C)>0)){if(e<15)return wy(a,o,s,l,f,v,p,m,w,S,_,A,E,C);var k=Ug[qg++];return(128&k)>0?void(qg-=15):wy(a,o,s,l,f,v,p,m,w,S,_,A,E,C,k)}qg-=14}}}}function Ay(e){return Kg.copyBuffers?Uint8Array.prototype.slice.call(Ug,qg,qg+=e):Ug.subarray(qg,qg+=e)}function My(e){var t=Ug[qg++];if(ey[t])return ey[t](Ug.subarray(qg,qg+=e));throw new Error("Unknown extension type "+t)}var Ey=new Array(4096);function Cy(){var e=Ug[qg++];if(!(e>=160&&e<192))return qg--,uy();if(e-=160,$g>=qg)return jg.slice(qg-Jg,(qg+=e)-Jg);if(!(0==$g&&Zg<180))return vy(e);var t,n=4095&(e<<5^(e>1?Wg.getUint16(qg):e>0?Ug[qg]:0)),i=Ey[n],r=qg,a=qg+e-3,o=0;if(i&&i.bytes==e){for(;r=144&&i<160||220==i||221==i?[]:{}};Hg.set(t,r);var a=uy();return r.used?Object.assign(n,a):(r.target=a,a)},ey[112]=function(e){var t=Wg.getUint32(qg-4),n=Hg.get(t);return n.used=!0,n.target},ey[115]=function(){return new Set(uy())};var Py=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map((function(e){return e+"Array"}));function Dy(e){var t,n=Zg,i=qg,r=Qg,a=Jg,o=$g,s=jg,u=Yg,c=Hg,h=Gg,d=new Uint8Array(Ug.slice(0,Zg)),f=Vg,v=Vg.slice(0,Vg.length),p=Kg,m=ry,g=e();return Zg=n,qg=i,Qg=r,Jg=a,$g=o,jg=s,Yg=u,Hg=c,Gg=h,Ug=d,ry=m,(t=Vg=f).splice.apply(t,[0,Vg.length].concat((0,l.Z)(v))),Kg=p,Wg=new DataView(Ug.buffer,Ug.byteOffset,Ug.byteLength),g}function Oy(){Ug=null,Hg=null,Vg=null}ey[116]=function(e){var t=e[0],n=Py[t];if(!n)throw new Error("Could not find typed array for code "+t);return new Ty[n](Uint8Array.prototype.slice.call(e,1).buffer)},ey[120]=function(){var e=uy();return new RegExp(e[0],e[1])},ey[98]=function(e){var t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=qg;qg+=t-4,(Gg=[uy(),uy()]).position0=0,Gg.position1=0;var i=qg;qg=n;try{return uy()}finally{qg=i}},ey[255]=function(e){return 4==e.length?new Date(1e3*(16777216*e[0]+(e[1]<<16)+(e[2]<<8)+e[3])):8==e.length?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+1e3*(4294967296*(3&e[3])+16777216*e[4]+(e[5]<<16)+(e[6]<<8)+e[7])):12==e.length?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+1e3*((128&e[4]?-281474976710656:0)+1099511627776*e[6]+4294967296*e[7]+16777216*e[8]+(e[9]<<16)+(e[10]<<8)+e[11])):new Date("invalid")};for(var Iy=new Array(147),Ry=0;Ry<256;Ry++)Iy[Ry]=+("1e"+Math.floor(45.15-.30103*Ry));var Ly,By=new oy({useRecords:!1}),zy=(By.unpack,By.unpackMultiple,By.unpack,new Float32Array(1));new Uint8Array(zy.buffer,0,4);try{Ly=new TextEncoder}catch(YH){}var Fy,Ny,Uy,Zy,Vy,jy=typeof M<"u",Gy=jy?M.allocUnsafeSlow:Uint8Array,Hy=jy?M:Uint8Array,Wy=jy?4294967296:2144337920,qy=0,Xy=null,Yy=/[\u0080-\uFFFF]/,Qy=Symbol("record-id"),Ky=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;(0,b.Z)(this,n),(i=t.call(this,e)).offset=0;var r,a,o,s,l,u=0,c=Hy.prototype.utf8Write?function(e,t,n){return Uy.utf8Write(e,t,n)}:!(!Ly||!Ly.encodeInto)&&function(e,t){return Ly.encodeInto(e,Uy.subarray(t)).written},d=(0,f.Z)(i);e||(e={});var v=e&&e.sequential,p=e.structures||e.saveStructures,m=e.maxSharedStructures;if(null==m&&(m=p?32:0),m>8160)throw new Error("Maximum maxSharedStructure is 8160");var g=e.maxOwnStructures;null==g&&(g=p?32:64),v&&!e.saveStructures&&(i.structures=[]);var y=m>32||g+m>64,x=m+64,w=m+g+64;if(w>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");var S=[],_=0,A=0;i.pack=i.encode=function(e,t){if(Uy||(Uy=new Gy(8192),Zy=new DataView(Uy.buffer,0,8192),qy=0),(Vy=Uy.length-10)-qy<2048?(Uy=new Gy(Uy.length),Zy=new DataView(Uy.buffer,0,Uy.length),Vy=Uy.length-10,qy=0):qy=qy+7&2147483640,r=qy,l=d.structuredClone?new Map:null,d.bundleStrings?(Xy=["",""],Uy[qy++]=214,Uy[qy++]=98,Xy.position=qy-r,qy+=4):Xy=null,a=d.structures){a.uninitialized&&(a=d._mergeStructures(d.getStructures()));var n=a.sharedLength||0;if(n>m)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+a.sharedLength);if(!a.transitions){a.transitions=Object.create(null);for(var i=0;iVy&&C(qy),d.offset=qy;var b=function(e,t){var n,i=6*t.length,r=e.length-i;for(t.sort((function(e,t){return e.offset>t.offset?1:-1}));n=t.pop();){var a=n.offset,o=n.id;e.copyWithin(a+i,a,r);var s=a+(i-=6);e[s++]=214,e[s++]=105,e[s++]=o>>24,e[s++]=o>>16&255,e[s++]=o>>8&255,e[s++]=255&o,r=a}return e}(Uy.subarray(r,qy),l.idsToInsert);return l=null,b}return t&ax?(Uy.start=r,Uy.end=qy,Uy):Uy.subarray(r,qy)}finally{if(a){if(A<10&&A++,_>1e4)a.transitions=null,A=0,_=0,S.length>0&&(S=[]);else if(S.length>0&&!v){for(var w=0,E=S.length;wk&&(a=a.slice(0,k));var T=Uy.subarray(r,qy);return!1===d.saveStructures(a,u)?(d._mergeStructures(d.getStructures()),d.pack(e)):(u=k,T)}}t&ox&&(qy=r)}};var M=function e(t){qy>Vy&&(Uy=C(qy));var n,a=typeof t;if("string"===a){var o,s=t.length;if(Xy&&s>=8&&s<4096){var u=Yy.test(t);return Xy[u?0:1]+=t,Uy[qy++]=193,void e(u?-s:s)}o=s<32?1:s<256?2:s<65536?3:5;var d=3*s;if(qy+d>Vy&&(Uy=C(qy+d)),s<64||!c){var v,p,m,g=qy+o;for(v=0;v>6|192,Uy[g++]=63&p|128):55296===(64512&p)&&56320===(64512&(m=t.charCodeAt(v+1)))?(p=65536+((1023&p)<<10)+(1023&m),v++,Uy[g++]=p>>18|240,Uy[g++]=p>>12&63|128,Uy[g++]=p>>6&63|128,Uy[g++]=63&p|128):(Uy[g++]=p>>12|224,Uy[g++]=p>>6&63|128,Uy[g++]=63&p|128);n=g-qy-o}else n=c(t,qy+o,d);n<32?Uy[qy++]=160|n:n<256?(o<2&&Uy.copyWithin(qy+2,qy+1,qy+1+n),Uy[qy++]=217,Uy[qy++]=n):n<65536?(o<3&&Uy.copyWithin(qy+3,qy+2,qy+2+n),Uy[qy++]=218,Uy[qy++]=n>>8,Uy[qy++]=255&n):(o<5&&Uy.copyWithin(qy+5,qy+3,qy+3+n),Uy[qy++]=219,Zy.setUint32(qy,n),qy+=4),qy+=n}else if("number"===a)if(t>>>0===t)t<64?Uy[qy++]=t:t<256?(Uy[qy++]=204,Uy[qy++]=t):t<65536?(Uy[qy++]=205,Uy[qy++]=t>>8,Uy[qy++]=255&t):(Uy[qy++]=206,Zy.setUint32(qy,t),qy+=4);else if(t>>0===t)t>=-32?Uy[qy++]=256+t:t>=-128?(Uy[qy++]=208,Uy[qy++]=t+256):t>=-32768?(Uy[qy++]=209,Zy.setInt16(qy,t),qy+=2):(Uy[qy++]=210,Zy.setInt32(qy,t),qy+=4);else{var y;if((y=i.useFloat32)>0&&t<4294967296&&t>=-2147483648){var x;if(Uy[qy++]=202,Zy.setFloat32(qy,t),y<4||(x=t*Iy[(127&Uy[qy])<<1|Uy[qy+1]>>7])>>0===x)return void(qy+=4);qy--}Uy[qy++]=203,Zy.setFloat64(qy,t),qy+=8}else if("object"===a)if(t){if(l){var b=l.get(t);if(b){if(!b.id){var w=l.idsToInsert||(l.idsToInsert=[]);b.id=w.push(b)}return Uy[qy++]=214,Uy[qy++]=112,Zy.setUint32(qy,b.id),void(qy+=4)}l.set(t,{offset:qy-r})}var S=t.constructor;if(S===Object)E(t,!0);else if(S===Array){(n=t.length)<16?Uy[qy++]=144|n:n<65536?(Uy[qy++]=220,Uy[qy++]=n>>8,Uy[qy++]=255&n):(Uy[qy++]=221,Zy.setUint32(qy,n),qy+=4);for(var _=0;_>8,Uy[qy++]=255&n):(Uy[qy++]=223,Zy.setUint32(qy,n),qy+=4);var A,M=D(t);try{for(M.s();!(A=M.n()).done;){var k=(0,h.Z)(A.value,2),T=k[0],P=k[1];e(T),e(P)}}catch(B){M.e(B)}finally{M.f()}}else{for(var O=0,I=Fy.length;OVy&&C(qy),{target:Uy,targetView:Zy,position:qy-e}}),e)}finally{r&&(Zy=a,qy=o,Vy=(Uy=r).length-10)}return s&&(s.length+qy>Vy&&C(s.length+qy),qy=ex(s,Uy,qy,n.type)),{v:void 0}}();if("object"===typeof L)return L.v}}E(t,!t.hasOwnProperty)}}else Uy[qy++]=192;else if("boolean"===a)Uy[qy++]=t?195:194;else if("bigint"===a){if(t=-(BigInt(1)<0)Uy[qy++]=207,Zy.setBigUint64(qy,t);else{if(!i.largeBigIntToFloat)throw new RangeError(t+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");Uy[qy++]=203,Zy.setFloat64(qy,Number(t))}qy+=8}else if("undefined"===a)i.encodeUndefinedAsNil?Uy[qy++]=192:(Uy[qy++]=212,Uy[qy++]=0,Uy[qy++]=0);else{if("function"!==a)throw new Error("Unknown type: "+a);e(i.writeFunction&&i.writeFunction())}},E=!1===i.useRecords?i.variableMapSize?function(e){var t,n=Object.keys(e),i=n.length;i<16?Uy[qy++]=128|i:i<65536?(Uy[qy++]=222,Uy[qy++]=i>>8,Uy[qy++]=255&i):(Uy[qy++]=223,Zy.setUint32(qy,i),qy+=4);for(var r=0;r>8,Uy[n+r]=255&i}:function(e){for(var t,n=Object.keys(e),r=s.transitions||(s.transitions=Object.create(null)),a=0,l=0,u=n.length;l=96&&y?(Uy[qy++]=96+(31&(h-=96)),Uy[qy++]=h>>5):Uy[qy++]=h;else{(h=s.nextId)||(h=64),h=w&&(h=x),s.nextId=h+1);var d=n.highByte=h>=96&&y?h-96>>5:-1;r[Qy]=h,s[h-64]=n,h=0?(Uy[qy++]=96+(31&h),Uy[qy++]=d):Uy[qy++]=h):(d>=0?(Uy[qy++]=213,Uy[qy++]=114,Uy[qy++]=96+(31&h),Uy[qy++]=d):(Uy[qy++]=212,Uy[qy++]=114,Uy[qy++]=h),a&&(_+=A*a),S.length>=g&&(S.shift()[Qy]=0),S.push(r),M(n))}for(var f=0,v=n.length;f16777216){if(e-r>Wy)throw new Error("Packed buffer would be larger than maximum buffer size");t=Math.min(Wy,4096*Math.round(Math.max((e-r)*(e>67108864?1.25:2),4194304)/4096))}else t=1+(Math.max(e-r<<2,Uy.length-1)>>12)<<12;var n=new Gy(t);return Zy=new DataView(n.buffer,0,t),Uy.copy?Uy.copy(n,0,r,e):n.set(Uy.slice(r,e)),qy-=r,r=0,Vy=n.length-10,Uy=n};return i}return(0,w.Z)(n,[{key:"useBuffer",value:function(e){Uy=e,Zy=new DataView(Uy.buffer,Uy.byteOffset,Uy.byteLength),qy=0}}]),n}(oy);function Jy(e,t,n,i){var r=e.byteLength;if(r+1<256){var a=n(4+r),o=a.target,s=a.position;o[s++]=199,o[s++]=r+1}else if(r+1<65536){var l=n(5+r);o=l.target,s=l.position;o[s++]=200,o[s++]=r+1>>8,o[s++]=r+1&255}else{var u=n(7+r),c=(o=u.target,s=u.position,u.targetView);o[s++]=201,c.setUint32(s,r+1),s+=4}o[s++]=116,o[s++]=t,o.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s)}function $y(e,t){var n=e.byteLength;if(n<256){var i=t(n+2),r=i.target,a=i.position;r[a++]=196,r[a++]=n}else if(n<65536){var o=t(n+3);r=o.target,a=o.position;r[a++]=197,r[a++]=n>>8,r[a++]=255&n}else{var s=t(n+5),l=(r=s.target,a=s.position,s.targetView);r[a++]=198,l.setUint32(a,n),a+=4}r.set(e,a)}function ex(e,t,n,i){var r=e.length;switch(r){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:r<256?(t[n++]=199,t[n++]=r):r<65536?(t[n++]=200,t[n++]=r>>8,t[n++]=255&r):(t[n++]=201,t[n++]=r>>24,t[n++]=r>>16&255,t[n++]=r>>8&255,t[n++]=255&r)}return t[n++]=i,t.set(e,n),n+=r}function tx(e){if(e.Class){if(!e.pack&&!e.write)throw new Error("Extension has no pack or write function");if(e.pack&&!e.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ny.unshift(e.Class),Fy.unshift(e)}!function(e){e.unpack?ey[e.type]=e.unpack:ey[e.type]=e}(e)}Ny=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,ny],Fy=[{pack:function(e,t,n){var i=e.getTime()/1e3;if((this.useTimestamp32||0===e.getMilliseconds())&&i>=0&&i<4294967296){var r=t(6),a=r.target,o=r.targetView,s=r.position;a[s++]=214,a[s++]=255,o.setUint32(s,i)}else if(i>0&&i<17179869184){var l=t(10),u=l.target,c=l.targetView,h=l.position;u[h++]=215,u[h++]=255,c.setUint32(h,4e6*e.getMilliseconds()+(i/1e3/4294967296>>0)),c.setUint32(h+4,i)}else if(isNaN(i)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());var d=t(3),f=d.target,v=(d.targetView,d.position);f[v++]=212,f[v++]=255,f[v++]=255}else{var p=t(15),m=p.target,g=p.targetView,y=p.position;m[y++]=199,m[y++]=12,m[y++]=255,g.setUint32(y,1e6*e.getMilliseconds()),g.setBigInt64(y+4,BigInt(Math.floor(i)))}}},{pack:function(e,t,n){var i=Array.from(e),r=t(this.structuredClone?3:0),a=r.target,o=r.position;this.structuredClone&&(a[o++]=212,a[o++]=115,a[o++]=0),n(i)}},{pack:function(e,t,n){var i=t(this.structuredClone?3:0),r=i.target,a=i.position;this.structuredClone&&(r[a++]=212,r[a++]=101,r[a++]=0),n([e.name,e.message])}},{pack:function(e,t,n){var i=t(this.structuredClone?3:0),r=i.target,a=i.position;this.structuredClone&&(r[a++]=212,r[a++]=120,r[a++]=0),n([e.source,e.flags])}},{pack:function(e,t){this.structuredClone?Jy(e,16,t):$y(jy?M.from(e):new Uint8Array(e),t)}},{pack:function(e,t){var n=e.constructor;n!==Hy&&this.structuredClone?Jy(e,Py.indexOf(n.name),t):$y(e,t)}},{pack:function(e,t){var n=t(1);n.target[n.position]=193}}];var nx,ix,rx=new Ky({useRecords:!1}),ax=(rx.pack,rx.pack,512),ox=1024,sx=new Ky({structuredClone:!0});function lx(e){if(Km(e))return e;if(Array.isArray(e))return e.map(lx);if("object"==typeof e&&null!==e){var t,n={},i=D(Object.keys(e).sort());try{for(i.s();!(t=i.n()).done;){var r=t.value;n[r]=lx(e[r])}}catch(a){i.e(a)}finally{i.f()}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),n}return e}function ux(e){return"MouseDown"===e||"MouseUp"===e||"KeyDown"===e||"KeyUp"===e||"Collision"===e||"Trigger"===e}tx({Class:Wm.prototype.constructor,type:1,write:function(e){return k({},e)},read:function(e){return Object.setPrototypeOf(e,Wm.prototype),e}}),tx({Class:ng.prototype.constructor,type:2,write:function(e){return(0,l.Z)(e)},read:function(e){return Object.setPrototypeOf(e,ng.prototype),e}}),tx({Class:tg.prototype.constructor,type:3,write:function(e){return(0,l.Z)(e)},read:function(e){return Object.setPrototypeOf(e,tg.prototype),e}}),tx({Class:Fg.prototype.constructor,type:4,write:function(e){return e.id},read:function(e){return new Fg(e)}}),tx({Class:Ng.prototype.constructor,type:5,write:function(e){return e.data},read:function(e){return new Ng(e)}}),tx({Class:ug.prototype.constructor,type:6,write:function(e){return k({},e)},read:function(e){return Object.setPrototypeOf(e,ug.prototype),e}}),function(e){function t(e){return sx.pack(e)}e.serialize=t,e.deserialize=function(e){return sx.unpack(e)},e.checksum=function(e){return function(e){var t=0;if(0===e.length)return t;for(var n=0;n",actions:new ng},i=new ng;return i.push({id:Pt.generateUUID(),fi:0,data:e},{id:Pt.generateUUID(),fi:1,data:t},{id:Pt.generateUUID(),fi:2,data:n}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:i}},Ax.defaultBreakpointData=function(){return{size:(0,l.Z)(Ax.defaultSizes.custom),operator:"<>",actions:new ng}},function(e){e.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"]},e.is=function(e){return"VariableChange"===e.type},e.defaultData=function(){return{disabled:!1,type:"VariableChange",name:"",actions:new ng,variableId:"",objectId:null,property:"Position X"}}}(Mx||(Mx={})),function(e){e.is=function(e){return"API"===e.type},e.defaultData=function(){return{disabled:!1,type:"API",name:"",successActions:new ng,errorActions:new ng,userAPIId:""}}}(Ex||(Ex={})),function(e){e.is=function(e){return"WEBHOOK"===e.type},e.defaultData=function(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new ng,userWebhookId:""}}}(Cx||(Cx={})),function(e){e.is=function(e){return"AIAssistantListener"===e.type},e.defaultData=function(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new ng,analysis:"average",analysisRange:[0,71],analysisSingle:0}}}(kx||(kx={})),function(e){e.is=function(e){return"AIAssistantTrigger"===e.type},e.defaultData=function(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new ng}}}(Tx||(Tx={}));var Dx,Ox,Ix,Rx,Lx,Bx,zx,Fx,Nx,Ux,Zx,Vx,jx="personal camera",Gx="a218fcc3-276b-49b9-b485-49037fd14f5f",Hx=5526619,Wx=function(e){return e.x="x",e.y="y",e.z="z",e}(Wx||{});!function(e){function t(e,t){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function n(e,n){return Math.sqrt(t(e,n))}function i(t,n,i){var r=e.sub(n,t),a=e.sub(i,t),o=e.dot(r,a)/e.dot(r,r),s=e.scalarMultiply(r,o);return e.add(t,s)}e.isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e.lerp=function(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]},e.add=function(e,t){return[e[0]+t[0],e[1]+t[1]]},e.sub=function(e,t){return[e[0]-t[0],e[1]-t[1]]},e.multiply=function(e,t){return[e[0]*t[0],e[1]*t[1]]},e.divide=function(e,t){return[e[0]/t[0],e[1]/t[1]]},e.distanceSquared=t,e.distance=n,e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},e.scalarMultiply=function(e,t){return[e[0]*t,e[1]*t]},e.projectionOnto=i,e.projectionOntoDistance=function(e,t,r){return n(e,i(e,t,r))},e.center=function(e,t){return[.5*(e[0]+t[0]),.5*(e[1]+t[1])]}}(Dx||(Dx={})),(Ix=Ox||(Ox={})).isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},Ix.add=function(e,t){return[e[0]+t[0],e[1]+t[1],e[2]+t[2]]},Ix.sub=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},Ix.div=function(e,t){return[e[0]/t[0],e[1]/t[1],e[2]/t[2]]},Ix.mul=function(e,t){return[e[0]*t[0],e[1]*t[1],e[2]*t[2]]},Ix.dist=function(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])},Ix.lerp=function(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]},function(e){e.isEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.lerp=function(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n,e[3]+(t[3]-e[3])*n]}}(Rx||(Rx={})),function(e){var t=180/Math.PI,n=Math.PI/180;function i(e){return"number"==typeof e?e*t:e}function r(e){return"number"==typeof e?e*n:e}e.radToDeg=function(e){return[i(e[0]),i(e[1]),i(e[2])]},e.degToRad=function(e){return[r(e[0]),r(e[1]),r(e[2])]}}(Lx||(Lx={})),(zx=Bx||(Bx={})).identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],zx.isEqual=function(e,t){for(var n=0;n<16;n++)if(e[n]!==t[n])return!1;return!0},zx.simplify=function(e){return null!==e&&void 0!==e?e:zx.identity},zx.applyMatrix4=function(e,t){for(var n=t.slice(0),i=0,r=t.length;i>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}},Nx.toHex=function(e){return 65536*Math.round(255*e.r)+256*Math.round(255*e.g)+Math.round(255*e.b)},Nx.equals=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b},Nx.equalsFixed=function(e,t){return e.r.toFixed(2)===t.r.toFixed(2)&&e.g.toFixed(2)===t.g.toFixed(2)&&e.b.toFixed(2)===t.b.toFixed(2)},Nx.lerp=function(e,t,n){return{r:e.r+(t.r-e.r)*n,g:e.g+(t.g-e.g)*n,b:e.b+(t.b-e.b)*n}},Nx.is=function(e){return!!Eh(e)&&"r"in e&&"g"in e&&"b"in e&&!("a"in e)},(Zx=Ux||(Ux={})).white=k(k({},Fx.white),{},{a:1}),Zx.is=function(e){return!!Eh(e)&&"r"in e&&"g"in e&&"b"in e&&"a"in e},Zx.transparent=k(k({},Fx.white),{},{a:0}),Zx.from0to1=function(e){return{r:e[0],g:e[1],b:e[2],a:e[3]}},Zx.fromHexAndA=function(e,t){return k(k({},Fx.fromHex(e)),{},{a:t})},Zx.toRgb255a1=function(e){return{r:Math.round(255*e.r),g:Math.round(255*e.g),b:Math.round(255*e.b),a:e.a}},Zx.equals=function(e,t){return Fx.equals(e,t)&&e.a===t.a},Zx.equalsFixed=function(e,t){return Fx.equalsFixed(e,t)&&e.a.toFixed(2)===t.a.toFixed(2)},Zx.lerp=function(e,t,n){return{r:e.r+(t.r-e.r)*n,g:e.g+(t.g-e.g)*n,b:e.b+(t.b-e.b)*n,a:e.a+(t.a-e.a)*n}},Zx.toStyle=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Zx.white,t=e.r,n=e.g,i=e.b,r=e.a;return"rgba(".concat(255*t,", ").concat(255*n,", ").concat(255*i,", ").concat(r,")")},function(e){e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]}}(Vx||(Vx={}));var qx,Xx,Yx,Qx,Kx,Jx,$x,eb,tb,nb=((Xx=nb||{})[Xx.LINEAR=0]="LINEAR",Xx[Xx.EASE=1]="EASE",Xx[Xx.EASE_IN=2]="EASE_IN",Xx[Xx.EASE_OUT=3]="EASE_OUT",Xx[Xx.EASE_IN_OUT=4]="EASE_IN_OUT",Xx[Xx.CUBIC=5]="CUBIC",Xx[Xx.SPRING=6]="SPRING",Xx[Xx.ARC=7]="ARC",Xx[Xx.NONE=8]="NONE",Xx);function ib(e){return"string"==typeof e&&36===e.length&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)}!function(e){e.defaultData={mass:1,stiffness:80,damping:10,velocity:0}}(qx||(qx={})),function(e){e.defaultData={control1:[.5,0],control2:[.5,1]}}(Yx||(Yx={})),(Kx=Qx||(Qx={})).linear=[0,0,1,1],Kx.ease=[.25,.1,.25,1],Kx.easeIn=[.42,0,1,1],Kx.easeOut=[0,0,.58,1],Kx.easeInOut=[.42,0,.58,1],function(e){e.all=["PerspectiveCamera","OrthographicCamera"],e.is=function(t){return e.all.includes(t)}}(Jx||(Jx={})),function(e){e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset},e.getZoom=function(e){var t,n,i,r;return"PerspectiveCamera"===e.type?null!==(t=null===(n=e.perspective)||void 0===n?void 0:n.zoom)&&void 0!==t?t:1:null!==(i=null===(r=e.orthographic)||void 0===r?void 0:r.zoom)&&void 0!==i?i:1}}($x||($x={})),function(e){e.defaultData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.1;return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:2*Math.max("number"==typeof e[0]?e[0]:1,"number"==typeof e[1]?e[1]:1),start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[("number"==typeof e[0]?e[0]+e[0]:1)*t,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:e.map((function(e){return("number"==typeof e?e:1)*(1+t)})),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}},e.merge=function(e,t){var n=k({},e);if(lb.forEach((function(i){var r;Object.assign(n,(0,g.Z)({},i,null!==(r=t[i])&&void 0!==r?r:e[i]))})),n.radial=k({},e.radial),t.radial){var i=e.radial,r=t.radial;ub.forEach((function(e){var t;Object.assign(n.radial,(0,g.Z)({},e,null!==(t=r[e])&&void 0!==t?t:i[e]))}))}if(n.linear=k({},e.linear),t.linear){var a=e.linear,o=t.linear;cb.forEach((function(e){var t;Object.assign(n.linear,(0,g.Z)({},e,null!==(t=o[e])&&void 0!==t?t:a[e]))}))}if(n.grid=k({},e.grid),t.grid){var s=e.grid,l=t.grid;hb.forEach((function(e){var t;Object.assign(n.grid,(0,g.Z)({},e,null!==(t=l[e])&&void 0!==t?t:s[e]))}))}if(n.toObject=k({},e.toObject),t.toObject){var u=e.toObject,c=t.toObject;db.forEach((function(e){var t;Object.assign(n.toObject,(0,g.Z)({},e,null!==(t=c[e])&&void 0!==t?t:u[e]))}))}if(n.randomnessObject=k({},e.randomnessObject),t.randomnessObject){var h=e.randomnessObject,d=t.randomnessObject;fb.forEach((function(e){var t;Object.assign(n.randomnessObject,(0,g.Z)({},e,null!==(t=d[e])&&void 0!==t?t:h[e]))}))}return n},e.isPartial=function(e){return!(!e.randomnessObject&&!e.toObject)}}(eb||(eb={})),function(e){e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};var t=["radial","linear","grid","toObject","randomnessObject"];e.toOps=function(e,n){var i=[];void 0!==e.count&&i.push({type:0,path:n,props:{count:e.count}});var r,a=D(t);try{for(a.s();!(r=a.n()).done;){var o=r.value,s=e[o];s&&Object.keys(s).length>0&&i.push({type:0,path:[].concat((0,l.Z)(n),[o]),props:s})}}catch(u){a.e(u)}finally{a.f()}return i}}(tb||(tb={}));var rb,ab,ob,sb,lb=["count"],ub=["radius","start","end","position","scale","rotation"],cb=["position","scale","rotation"],hb=["count","size"],db=["count","position","scale","rotation"],fb=["strength","scale","rotation","position","movement","seed","freqScale"];!function(e){e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"],e.is=function(t){return e.all.includes(t)}}(rb||(rb={})),function(e){e.defaultData=function(e){return function(e){if("PointLight"===e)return{type:e,color:Ux.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if("SpotLight"===e)return{type:e,color:Ux.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if("DirectionalLight"===e)return{type:e,color:Ux.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}(e)}}(ab||(ab={})),function(e){e.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},e.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},e.defaultData=k({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:e.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1},e.defaultCollisionData)}(ob||(ob={})),function(e){e.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]}}(sb||(sb={}));var vb,pb,mb,gb,yb,xb,bb,wb=function(e){return e[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",e}(wb||{});!function(e){e.defaultData={castShadow:!0,receiveShadow:!0},e.equals=function(e,t){return e.castShadow===t.castShadow&&e.receiveShadow===t.receiveShadow}}(vb||(vb={})),function(e){e.defaultData={flatShading:!1,wireframe:!1,side:0},e.equals=function(e,t){return e.flatShading===t.flatShading&&e.side===t.side&&e.wireframe===t.wireframe}}(pb||(pb={})),function(e){e.defaultData=k(k({},pb.defaultData),vb.defaultData)}(mb||(mb={})),function(e){e.getMaterialData=function(e,t){var n=[];if("material"in e){var i,r,a="string"==typeof e.material?null!==(i=t.materials[e.material])&&void 0!==i?i:null===(r=t.lib.materials[e.material])||void 0===r?void 0:r.asset:e.material;a&&n.push(a)}else if("materials"in e){var o,s=D(e.materials);try{for(s.s();!(o=s.n()).done;){var l,u,c=o.value,h="string"==typeof c?null!==(l=t.materials[c])&&void 0!==l?l:null===(u=t.lib.materials[c])||void 0===u?void 0:u.asset:c;h&&n.push(h)}}catch(d){s.e(d)}finally{s.f()}}return n}}(gb||(gb={})),function(e){e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7}(yb||(yb={})),function(e){e.is=function(e){return"texture"===e||"video"===e||"color"===e||"depth"===e||"normal"===e||"gradient"===e||"noise"===e||"fresnel"===e||"rainbow"===e||"toon"===e||"outline"===e||"particle"===e||"transmission"===e||"matcap"===e||"displace"===e||"pattern"===e||"light"===e}}(xb||(xb={})),function(e){e.is=function(e){return"phong"===e||"toon"===e||"lambert"===e||"physical"===e}}(bb||(bb={}));var Sb,_b,Ab,Mb,Eb,Cb=function(e){return e[e.Linear=0]="Linear",e[e.Radial=1]="Radial",e[e.Polar=2]="Polar",e}(Cb||{}),kb=function(e){return e[e.RepeatWrapping=1e3]="RepeatWrapping",e[e.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",e[e.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",e}(kb||{}),Tb=function(e){return e[e.NearestFilter=1003]="NearestFilter",e[e.LinearFilter=1006]="LinearFilter",e[e.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",e}(Tb||{}),Pb=function(e){return e[e.UV=0]="UV",e[e.Planar=1]="Planar",e[e.Spherical=2]="Spherical",e[e.Cylindrical=3]="Cylindrical",e[e.Triplanar=4]="Triplanar",e}(Pb||{}),Db=function(e){return e[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",e}(Db||{}),Ob=((_b=Ob||{})[_b.F1=0]="F1",_b[_b.F2=1]="F2",_b[_b.F2MinusF1=2]="F2MinusF1",_b[_b.SmoothBlend=3]="SmoothBlend",_b[_b.Edge=4]="Edge",_b[_b.Power=5]="Power",_b[_b.Lines=6]="Lines",_b[_b.Cells=7]="Cells",_b),Ib=function(e){return e[e.Lights=0]="Lights",e[e.Static=1]="Static",e[e.Camera=2]="Camera",e}(Ib||{}),Rb=function(e){return e[e.Circle=0]="Circle",e[e.Ring=1]="Ring",e[e.Polygon=2]="Polygon",e[e.Cross=3]="Cross",e[e.Diamond=4]="Diamond",e[e.Checkerboard=5]="Checkerboard",e[e.Line=6]="Line",e[e.Wave=7]="Wave",e}(Rb||{}),Lb=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],Bb=["wrapping","image","video","name","minFilter","magFilter"];!function(e){e.patch=function(e,t){var n=t.texture,i=(0,o.Z)(t,["texture"]);if(Object.assign(e,i),n){var r=e.texture;r&&Object.assign(r,n)}},e.defaultColorLayer=function(t){return k(k({},e.defaultData("color")),{},{color:t})},e.defaultData=function(e,t){return"light"===e&&t?function(e){var t={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(e){case"phong":return k(k({},t),{},{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6});case"toon":return k(k({},t),{},{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1});case"lambert":return k(k({},t),{},{category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0});case"physical":return k(k({},t),{},{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0})}}(t):function(e){var t={alpha:1,mode:0,isMask:!1,visible:!0};switch(e){case"texture":return k(k({},t),{},{type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1});case"video":return k(k({},t),{},{type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:yb.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1});case"color":return k(k({},t),{},{type:"color",color:Fx.fromHex(Hx)});case"depth":return k(k({},t),{},{type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200});case"normal":return k(k({},t),{},{type:"normal",cnormal:[1,1,1]});case"gradient":return k(k({},t),{},{type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]});case"noise":return k(k({},t),{},{type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:k(k({},Fx.fromHex(6710886)),{},{a:1}),colorB:k(k({},Fx.fromHex(6710886)),{},{a:1}),colorC:k(k({},Fx.fromHex(16777215)),{},{a:1}),colorD:k(k({},Fx.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 k(k({},t),{},{type:"fresnel",color:Ux.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1});case"rainbow":return k(k({},t),{},{type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]});case"toon":return k(k({},t),{},{type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Ux.fromHexAndA(0,0),offset:[0,0,0]});case"outline":return k(k({},t),{},{type:"outline",outlineColor:Ux.fromHexAndA(0,1),contourColor:Ux.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 k(k({},t),{},{type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}});case"transmission":return k(k({},t),{},{type:"transmission",thickness:10,ior:1.5,roughness:1});case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return k(k({},t),{},{type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:k(k({},Fx.fromHex(0)),{},{a:1}),colorB:k(k({},Fx.fromHex(16777215)),{},{a:1}),frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6})}}(e)}}(Sb||(Sb={})),function(e){function t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"layer1",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"layer2",i=(arguments.length>3&&void 0!==arguments[3]||Fx.fromHex(16777215),new ng);return i.push({fi:0,data:Sb.defaultData("light",e),id:t}),i.push({fi:1,data:Sb.defaultData("color"),id:n}),{layers:i}}e.isMergable=function(e){return!e.layers.some((function(e){return"texture"===e.data.type&&0!==e.data.projection||"depth"===e.data.type&&!e.data.isWorldSpace||"noise"===e.data.type||"displace"===e.data.type}))},e.getHash=function(e){var t="";return e.layers.forEach((function(e){Object.entries(e.data).forEach((function(e){var n=(0,h.Z)(e,2),i=n[0],r=n[1];t+="".concat(i).concat(r),Array.isArray(r)?r.forEach((function(e){return t+="".concat(e)})):"object"==typeof r?Object.values(r).forEach((function(e){t+="".concat("number"==typeof e?e.toFixed(4):e)})):t+="".concat(r)}))})),t},e.defaultEmptyData=function(){return{layers:new ng}},e.defaultData=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"layer1",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"layer2";return t("phong",e,n)},e.withName=function(e,t){return k(k({},e),{},{name:t})},e.defaultTwoLayerData=t,e.defaultColorMaterial=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"layer1",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"layer2",r=new ng;return r.push({fi:0,data:Sb.defaultData("light",t),id:n}),r.push({fi:1,data:Sb.defaultColorLayer(e),id:i}),{layers:r}},e.defaultUIObjectMaterial=function(e){var t=Sb.defaultData("texture");e&&Object.assign(t.texture,{image:e});var n=new ng;return n.push({fi:0,data:t,id:"layer1"}),n.push({fi:1,data:k(k({},Sb.defaultData("transmission")),{},{alpha:1}),id:"layer2"}),n.push({fi:2,data:k(k({},Sb.defaultData("light","lambert")),{},{alpha:0}),id:"layer3"}),{layers:n}},e.defaultTwoLayerTextureData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"phong",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"layer1",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"layer2",r=Sb.defaultData("texture");Object.assign(r.texture,{image:e});var a=new ng;return a.push({fi:0,data:r,id:n}),a.push({fi:1,data:Sb.defaultData("light",t),id:i}),{layers:a}},e.defaultTwoLayerVideoTextureData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"phong",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"layer1",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"layer2",r=Sb.defaultData("video");Object.assign(r.texture,{video:e});var a=new ng;return a.push({fi:0,data:r,id:n}),a.push({fi:1,data:Sb.defaultData("light",t),id:i}),{layers:a}}}(Ab||(Ab={})),function(e){e.defaultData=function(){return{points:new ng,roundness:0,shapeHoles:[],isClosed:!1}}}(Mb||(Mb={})),function(e){e.defaultData=function(){return{points:new ng,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}}(Eb||(Eb={}));var zb,Fb={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0};!function(e){e.merge=function(e,t){var n=k({},e);return jb.forEach((function(i){var r;Object.assign(n,(0,g.Z)({},i,null!==(r=t[i])&&void 0!==r?r:e[i]))})),n}}(zb||(zb={}));var Nb,Ub,Zb,Vb={shape:Fb,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},jb=["depth","offset","angle","twist","startScale","endScale"];!function(e){e.is2DParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"UIGeometry"===e},e.isParametricMesh=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"BooleanGeometry"===e||"TextGeometry"===e||"InputGeometry"===e},e.isSwappableGeometry=function(e){return"PolygonGeometry"===e||"RectangleGeometry"===e||"StarGeometry"===e||"TriangleGeometry"===e||"EllipseGeometry"===e||"PathGeometry"===e||"VectorGeometry"===e||"ConeGeometry"===e||"CubeGeometry"===e||"CylinderGeometry"===e||"DodecahedronGeometry"===e||"HelixGeometry"===e||"IcosahedronGeometry"===e||"LatheGeometry"===e||"PyramidGeometry"===e||"SphereGeometry"===e||"PlaneGeometry"===e||"BackdropGeometry"===e||"TorusGeometry"===e||"TorusKnotGeometry"===e||"TextGeometry"===e||"SubdivGeometry"===e||"NonParametricGeometry"===e}}(Nb||(Nb={})),function(e){e.merge=function(e,t){var n=k({},e);return Object.assign(n,t),"PathGeometry"===n.type&&"extrusion"in t&&t.extrusion&&(n.extrusion=k({},e.extrusion),Object.assign(n.extrusion,zb.merge(n.extrusion,t.extrusion))),n}}(Ub||(Ub={})),function(e){e.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:Eb.defaultData(),extrusion:Vb};if("VectorGeometry"===t)return{width:1,height:1,type:t,subdivisions:12,shape:Mb.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 k(k({},e.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")}}(Zb||(Zb={}));var Gb,Hb,Wb,qb,Xb,Yb,Qb,Kb,Jb,$b,ew,tw=["width","height","depth"];function nw(e){for(var t=0,n=Object.keys(e);tt[n])return 1;n+=1}return n!==t.length?-1:n!==e.length?1:0}!function(e){e.defaultData={enabled:!1,useBackgroundColor:!1,color:Fx.white,near:.1,far:2e3}}(Gb||(Gb={})),function(e){var t={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:k(k({},t),{},{blendFunction:16,granularity:15}),bloom:k(k({},t),{},{blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3}),chromaticAberration:k(k({},t),{},{offset:[2,2]}),vignette:k(k({},t),{},{darkness:1,offset:0}),hueSaturation:k(k({},t),{},{hue:3,saturation:0}),brightnessContrast:k(k({},t),{},{brightness:.25,contrast:0}),depthOfField:k(k({},t),{},{focusDistance:100,focalLength:20,bokehScale:5}),noise:k(k({},t),{},{blendFunction:16})}}(Hb||(Hb={})),function(e){e.defaultData={softShadowQuality:"low"}}(Wb||(Wb={})),function(e){e.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75}}(qb||(qb={})),function(e){e.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}}}(Xb||(Xb={})),function(e){e.defaultData={usePhysics:!1,gravity:-10}}(Yb||(Yb={})),function(e){e.defaultData={playCamera:jx,gameControlObject:null}}(Qb||(Qb={})),function(e){e.defaultData={backgroundColor:Ux.fromHexAndA(2960946,1),postprocessing:Hb.defaultData,fog:Gb.defaultData,globalPhysics:Yb.defaultData,ambient:qb.defaultData,ao:Xb.defaultData,shadow:Wb.defaultData,publish:Qb.defaultData}}(Kb||(Kb={})),function(e){e.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95}}(Jb||(Jb={})),function(e){e.isComponentRelated=function(e){return"Component"===e||"Instance"===e},e.isEmptyOrComponent=function(e){return"Empty"===e||"Instance"===e}}($b||($b={})),function(e){e.identity=k(k({},Vx.identity),{},{hiddenMatrix:Bx.identity}),e.fromObject=function(e){return{position:e.position,rotation:e.rotation,scale:e.scale,pivot:e.pivot,pivotRotation:e.pivotRotation,hiddenMatrix:e.hiddenMatrix}},e.merge=function(e,t){return{position:(null===t||void 0===t?void 0:t.position)||e.position,rotation:(null===t||void 0===t?void 0:t.rotation)||e.rotation,pivot:(null===t||void 0===t?void 0:t.pivot)||e.pivot,pivotRotation:(null===t||void 0===t?void 0:t.pivotRotation)||e.pivotRotation,scale:(null===t||void 0===t?void 0:t.scale)||e.scale,hiddenMatrix:(null===t||void 0===t?void 0:t.hiddenMatrix)||e.hiddenMatrix}},e.diff=function(e,t){return nw({position:Ox.isEqual(e.position,t.position)?void 0:t.position,rotation:Ox.isEqual(e.rotation,t.rotation)?void 0:t.rotation,scale:Ox.isEqual(e.scale,t.scale)?null:t.scale,hiddenMatrix:Bx.isEqual(e.hiddenMatrix,t.hiddenMatrix)?void 0:t.hiddenMatrix})}}(ew||(ew={}));var ow,sw,lw,uw,cw,hw,dw,fw,vw,pw,mw,gw,yw,xw,bw,ww,Sw,_w,Aw,Mw,Ew,Cw,kw,Tw,Pw,Dw,Ow,Iw,Rw,Lw,Bw,zw=["slide","offset"];function Fw(e){e.layers.forEach((function(e){if("depth"===e.type&&void 0!==e.colorA){for(var t=e.colorA,n=e.colorB,i=[[t.r,t.g,t.b,t.a],[n.r,n.g,n.b,n.a]],r=[0,1],a=2;a<10;a++)i.push(i[1]),r.push(1);var o=k(k({},pm(Rg(e),"type","visible","isVector","isWorldSpace","origin","alpha","mode")),{},{near:Math.max(0,e.near),far:Math.max(0,e.far),colors:i,steps:r,num:2,direction:[1,0,0],smooth:!1,gradientType:1});Object.assign(e,o)}else if("depth"===e.type&&1===e.gradientType&&(e.near<0||e.far<0)){var s=k(k({},Rg(e)),{},{near:Math.max(e.near,0),far:Math.max(e.far,0)});Object.assign(e,s)}}))}function Nw(e,t){Object.values(e.shared.materials).forEach((function(e){return t(e)}))}function Uw(e,t){e.scene.objects.traverse((function(e,n){"materials"in n?n.materials.forEach((function(e,i){void 0===e&&(n.materials[i]=Ab.defaultData(),e=n.materials[i]),"string"!=typeof e&&t(e)})):"material"in n?"string"!=typeof n.material&&(void 0===n.material&&(n.material=Ab.defaultData()),t(n.material)):"Mesh"===n.type&&(void 0===n.material&&(n.material=Ab.defaultData()),t(n.material)),"overrides"in n&&Object.values(n.overrides).forEach((function(e){e.material&&"string"!=typeof e.material&&Object.getPrototypeOf(e.material)!==ug.prototype&&t(e.material)}))}))}function Zw(e){void 0===e.layers&&Object.assign(e,Ab.defaultTwoLayerData("lambert"))}function Vw(e){!e.layers||e.layers.forEach((function(e){if("depth"===e.type&&10===e.colors.length){var t=(0,l.Z)(e.colors);t.push(e.colors[9]);var n=(0,l.Z)(e.steps);n.push(e.steps[9]);var i=k(k({},Rg(e)),{},{colors:t,steps:n});Object.assign(e,i)}}))}function jw(e){e.scene.objects.traverse((function(e,t){"materials"in t?t.materials.forEach((function(e){"string"!=typeof e&&Vw(e)})):"material"in t&&"string"!=typeof t.material&&Vw(t.material)})),Object.values(e.shared.materials).forEach((function(e){return Vw(e)}))}function Gw(e){e.layers&&e.layers.forEach((function(e){"depth"===e.type&&void 0!==e.num&&(e.colors=e.colors.slice(0,e.num),e.steps=e.steps.slice(0,e.num),delete e.num)}))}function Hw(e){e.layers&&e.layers.forEach((function(e){(function(e){return"displace"!==e.type})(e)&&void 0===e.isMask&&(e.isMask=!1),("texture"===e.type||"video"===e.type)&&void 0===e.blending&&(e.blending=0),("noise"===e.type||"displace"===e.type&&"noise"===e.displacementType)&&(void 0===e.voronoiStyle&&(e.voronoiStyle=0),void 0===e.highCut&&(e.highCut=1),void 0===e.lowCut&&(e.lowCut=0),void 0===e.smoothness&&(e.smoothness=.3),void 0===e.seed&&(e.seed=0),void 0===e.quality&&(e.quality=1))}))}function Ww(e){var t,n=null===(t=e.layers.find((function(e){return"light"===e.type})))||void 0===t?void 0:t.data;if("basic"===(null===n||void 0===n?void 0:n.category)){var i=Sb.defaultData("light","phong"),r=n;Object.assign(r,i),r.visible=!1}}function qw(e){Nw(e,Ww),Uw(e,Ww)}function Xw(e){e.layers.forEach((function(e){"light"===e.type&&"toon"!==e.category&&void 0===e.occlusion&&(e.occlusion=!0)}))}function Yw(e){e.layers&&e.layers.forEach((function(e){"light"===e.type&&void 0===e.bumpMapIntensity&&(e.bumpMapIntensity=5)}))}function Qw(e,t){if(t<1&&(Uw(e,Fw),Nw(e,Fw),e.schema=1),t<2&&(function(e){Object.assign(e.scene.publish,{orbitControls:k(k({},xw.defaultData),Rg(e.scene.publish.orbitControls))})}(e),e.schema=2),t<3&&(function(e){function t(e){if(e.layers)for(var t=0,n=Object.values(e.layers);t48&&(t.fps=15)}(e),e.schema=35),t<36&&(function(e){e.scene.objects.traverse((function(e,t){t.events.forEach((function(e){"GameControl"===e.type&&(e.resetYPosition=Math.abs(e.resetYPosition-t.position[1]))}))}))}(e),e.schema=36),t<37&&(function(e){var t=e.scene.environment.usePhysics;e.scene.objects.traverse((function(e,n){t&&null===n.physics?n.collision=!1:n.collision="visibility"}))}(e),e.schema=37),t<38&&(Uw(e,Hw),Nw(e,Hw),e.schema=38),t<39&&(function(e){e.scene.objects.traverse((function(e,t){t.events.forEach((function(e){"GameControl"===e.type&&(e.navmesh=Bw.defaultDataThirdPerson.navmesh)}))}))}(e),e.schema=39),t<40&&(function(e){e.scene.styles||(e.scene.styles=_w.defaultData())}(e),e.schema=40),t<41&&(function(e){void 0===e.scene.environment.ambientLight.occlusion&&(e.scene.environment.ambientLight.occlusion=!1),void 0===e.scene.environment.ambientLight.aoFullRes&&(e.scene.environment.ambientLight.aoFullRes=!1),void 0===e.scene.environment.ambientLight.radius&&(e.scene.environment.ambientLight.radius=256),void 0===e.scene.environment.ambientLight.bias&&(e.scene.environment.ambientLight.bias=.5),void 0===e.scene.environment.ambientLight.aoColor&&(e.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Uw(e,Xw),Nw(e,Xw)}(e),e.schema=41),t<42&&(function(e){e.scene.objects.traverse((function(e,t){t.events.forEach((function(e){"GameControl"===e.type&&Object.assign(e.gameActions,{run:new ng})}))}))}(e),e.schema=42),t<43&&(function(e){e.scene.objects.traverse((function(e,t){t.events.forEach((function(e){"GameControl"===e.type&&(e.keyAssignments=[].concat((0,l.Z)(e.keyAssignments),[["run","\u21e7"],["none","Ctrl"]]))}))}))}(e),e.schema=43),t<99){var n;Uw(e,Yw),Nw(e,Yw),null===e.scene.publish.playCamera&&(e.scene.publish.playCamera=jx);var i=Rg(e.scene.objects),r=e.scene.objects;e.scene.publish.playPage=Gx,r.insertBefore(null,null,[{id:Gx,data:k(k({},mw.defaultData),{},{backgroundColor:e.scene.backgroundColor,fog:e.scene.fog,postprocessing:e.scene.postprocessing,ao:pm(e.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:e.scene.publish.playCamera,gameControlObject:e.scene.publish.gameControlObject},shadow:pm(e.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:k(k({},Yb.defaultData),pm(e.scene.environment,"usePhysics","gravity")),camera:null!==(n=Rg(e.scene.ownerCamera))&&void 0!==n?n:mw.defaultData.camera,name:"Scene"}),children:[]}]);var a,o=D(i);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.id!==Mw.TRASH_CAN_ID&&r.move(Gx,s.fi,s.id)}}catch(d){o.e(d)}finally{o.f()}var u=0,c=0;e.shared.penumbraSize&&e.scene.objects.traverse((function(t,n){var i;"DirectionalLight"===n.type?(n.penumbraSize=e.shared.penumbraSize[Math.min(u,2)],u+=1):"SpotLight"===n.type&&(n.penumbraSize=e.shared.penumbraSize[3+Math.min(c,1)],c+=1),(void 0===n.physics||null===n.physics)&&"Instance"!==n.type&&(n.physics={},Object.assign(n.physics,sb.defaultData)),void 0!==n.physics&&null!==n.physics&&(n.physics.enabled=null!==(i=n.collision)&&void 0!==i?i:"visibility",delete n.collision)})),e.schema=99}}function Kw(e){e.layers&&e.layers.forEach((function(e){"light"===e.type&&void 0===e.alphaOverride&&(e.alphaOverride=1)}))}!function(e){e.defaultData=k(k({states:new ng,events:new ng,timelineAnimations:new Wm,visible:!0,raycastLock:!1,physics:sb.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"}},ew.identity),{},{cloner:null})}(ow||(ow={})),function(e){e.defaultData=k({type:"Empty"},ow.defaultData)}(sw||(sw={})),function(e){e.defaultData=k(k({type:"ParticleCollider"},Jb.defaultData),ow.defaultData)}(lw||(lw={})),function(e){e.defaultData=k({type:"Component"},ow.defaultData)}(uw||(uw={})),function(e){e.defaultData=k(k({type:"Particle"},ow.defaultData),ob.defaultData)}(cw||(cw={})),function(e){e.defaultData=k(k({type:"Mesh"},ow.defaultData),mb.defaultData)}(hw||(hw={})),function(e){e.defaultData=k(k(k({},ow.defaultData),ew.identity),{},{position:[0,0,$x.DefaultTargetOffset]},$x.defaultData)}(dw||(dw={})),function(e){e.defaultData=function(e){return k(k({},ow.defaultData),ab.defaultData(e))},e.defaultDirectionalLightData=k(k({},e.defaultData("DirectionalLight")),{},{position:[200,300,300],name:"Directional Light",intensity:.7})}(fw||(fw={})),function(e){function t(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;n2&&void 0!==arguments[2]?arguments[2]:0,r=t(e,n,i);if(r){var a=Object.keys(r);if(1===a.length&&"descendants"===a[0])return}return r}}(vw||(vw={})),function(e){function t(e,t){return k(k(k({},ow.defaultData),t),{},{component:e,overrides:new ug,physics:void 0,events:void 0,type:"Instance"})}e.rootOverrideProps=["physics","events"],e.compositeNonOptionalOverrideProps=["geometry"],e.compositeEntireOverrideOverrideProps=["material"],e.ofComponent=t,e.fromComponentData=function(e){var n=ew.fromObject(e.data);return t(e.id,n)}}(pw||(pw={})),function(e){e.defaultData=k(k(k({type:"Page"},ow.defaultData),{},{physics:k(k({},sb.defaultData),{},{fusedBody:!1})},Kb.defaultData),{},{camera:dw.defaultData}),e.isUIPage=function(e){return void 0!==e.uiScene}}(mw||(mw={})),function(e){e.defaultCamera=k({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Bx.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:sb.defaultData,states:new ng,events:new ng,timelineAnimations:new Wm,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0}},$x.defaultData),e.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"]},e.defaultMeshObject=k(k(k({name:"Rectangle"},ow.defaultData),hw.defaultData),{},{geometry:Zb.defaultData("RectangleGeometry"),material:Ab.defaultTwoLayerData("phong","layer1","layer2")}),e.defaultBooleanObject=k(k(k({name:"Boolean"},ow.defaultData),hw.defaultData),{},{geometry:Zb.defaultData("BooleanGeometry"),material:Ab.defaultTwoLayerData("phong","layer1","layer2")}),e.defaultShapeBlendObject=k(k(k({name:"Shape Blend"},ow.defaultData),hw.defaultData),{},{geometry:Zb.defaultData("ShapeBlendGeometry"),material:Ab.defaultTwoLayerData("phong","layer1","layer2")}),e.defaultTextObject=k(k(k({name:"Text"},ow.defaultData),hw.defaultData),{},{geometry:Zb.defaultData("TextGeometry"),material:Ab.defaultTwoLayerData("phong","layer1","layer2")}),e.defaultInputObject=k(k(k({name:"Input"},ow.defaultData),hw.defaultData),{},{geometry:Zb.defaultData("InputGeometry"),material:Ab.defaultTwoLayerData("phong","layer1","layer2")})}(gw||(gw={})),function(e){e.newEmpty=function(e,t){var n={name:t};return"Mesh"===e.type?(n.geometry={},"material"in e&&(n.material={layers:new ug}),"materials"in e&&(n.materials=e.materials.map((function(e){return{layers:new ug}})))):Jx.is(e.type)&&(n.perspective={},n.orthographic={}),n},e.toOps=function(e,t){var n,i=[],r={orthographic:0,perspective:0,geometry:0};function a(e,t){for(var n=0,r=Object.entries(t.layers);n0){var f={path:[].concat((0,l.Z)(e),["layers",s,"texture"]),props:c,type:0};i.push(f)}if(Object.keys(d).length>0){var v={path:[].concat((0,l.Z)(e),["layers",s]),props:d,type:0};i.push(v)}}}for(var s=0,u=Object.entries(t);s0){var y={path:[d],props:f,type:0};i.push(y)}}else void 0===n&&(n={path:[],props:{},type:0},i.push(n)),n.props[d]=f}return i},e.patch=function(e,t){var n,i,r,a,o,s,l,u;if(void 0===t)return e;var c=k({},e);if(Object.assign(c,ew.merge(c,t)),Object.assign(c,{pathSnapping:Object.assign({},c.pathSnapping,{slide:null!==(n=null!==(i=null===(r=t.pathSnapping)||void 0===r?void 0:r.slide)&&void 0!==i?i:null===(a=c.pathSnapping)||void 0===a?void 0:a.slide)&&void 0!==n?n:0,offset:null!==(o=null!==(s=null===(l=t.pathSnapping)||void 0===l?void 0:l.offset)&&void 0!==s?s:null===(u=c.pathSnapping)||void 0===u?void 0:u.offset)&&void 0!==o?o:0})}),Jx.is(e.type)){var d,f;c.orthographic=k({},c.orthographic),c.perspective=k({},c.perspective);var v=t;void 0!==(null===(d=v.orthographic)||void 0===d?void 0:d.zoom)&&(c.orthographic.zoom=v.orthographic.zoom),void 0!==(null===(f=v.perspective)||void 0===f?void 0:f.zoom)&&(c.perspective.zoom=v.perspective.zoom),void 0!==v.isUpVectorFlipped&&(c.isUpVectorFlipped=v.isUpVectorFlipped),void 0!==v.targetOffset&&(c.targetOffset=v.targetOffset)}else if("Mesh"===e.type)"geometry"in t&&Object.assign(c,{geometry:Ub.merge(c.geometry,t.geometry)}),(t.material||t.materials)&&(c=function(e,t){if(void 0===t)return e;var n=k({},e);return"material"in n&&"material"in t&&t.material&&(n.material=Ig(n.material,(function(e){if("string"!=typeof e)for(var n=0,i=Object.entries(t.material.layers);n0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=[],r=gw.defaultMeshObject;t&&(i.push(k({},e.defaultLight)),i.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:r,children:[]})),i.push.apply(i,(0,l.Z)(n));var a=new tg;return a.push({fi:1,id:Gx,data:k(k({},mw.defaultData),{},{name:"Scene 1"}),children:i}),a}function n(t){return k(k({},e.defaultData),{},{objects:iw(t,tg.prototype)})}e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:fw.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]},e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:bw.defaultData,styles:_w.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new tg,publish:bw.defaultData,styles:_w.defaultData()}},e.emptyDataWithPage=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{objects:t(e),publish:bw.defaultData,styles:_w.defaultData()}},e.emptyData=function(){return{objects:new tg,publish:k({},bw.defaultData),styles:_w.defaultData()}},e.withObjs=n,e.withObj=function(e,t){return n([{id:e,data:t,children:[],fi:0}])}}(Mw||(Mw={})),function(e){e.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}}}(Ew||(Ew={})),function(e){e.defaultData=function(e){return{url:e,name:"New Webhook",parametersSchemas:new ng}},e.defaultParameterValueByType=function(e){return"number"===e?0:"boolean"!==e&&""}}(Cw||(Cw={})),function(e){e.defaultData=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET";return{url:e,method:t,name:"New API",headers:new ng,queries:new ng,autoStart:!0}}}(kw||(kw={})),function(e){function t(e){return void 0!==e.textValue}function n(e){return"boolean"==typeof e}e.isTextValue=t,e.isNumber=function(e){return"number"==typeof e},e.isBoolean=n,e.typeOfVariable=function(e){return t(e)?"string":n(e)?"boolean":"number"},e.getDisplayedValue=function(t){var n;return e.isTextValue(t)?Array.isArray(t.textValue)?t.textValue.map((function(e){var n;return e.toString().padStart(null!==(n=t.padding)&&void 0!==n?n:2,"0")})).join(null!==(n=t.deliminator)&&void 0!==n?n:":")+(void 0!==t.suffix?" "+t.suffix:""):t.textValue.toString():e.isBoolean(t)?t?"True":"False":e.isNumber(t)?parseFloat(t.toFixed(3)).toString():t.toString()}}(Tw||(Tw={})),function(e){e.all=["images","videos","colors","audios","particles","fonts","materials","variables"]}(Pw||(Pw={})),function(e){e.all=[].concat((0,l.Z)(Pw.all),["components"])}(Dw||(Dw={})),function(e){e.defaultData=function(){return{images:new Wm,videos:new Wm,colors:new Wm,audios:new Wm,particles:new Wm,fonts:new Wm,materials:new Wm,components:new Wm,variables:new Wm,userAPIs:new Wm,userWebhooks:new Wm,timelineAnimations:new Wm}}}(Ow||(Ow={})),function(e){e.defaultData=function(){return{images:new Wm,videos:new Wm,colors:new Wm,audios:new Wm,particles:new Wm,fonts:new Wm,materials:new Wm,components:new Wm,variables:new Wm,userAPIs:new Wm,userWebhooks:new Wm,timelineAnimations:new Wm}}}(Iw||(Iw={})),function(e){e.defaultColors=function(){var e={"89b10010-844c-11ec-a8a3-0242ac120002":{r:.5,g:.5,b:.5,a:1,name:"Default Color"}};return iw(e,Wm.prototype)},e.defaultImages=function(){return iw({},Wm.prototype)},e.emptyData=function(){return{catelogs:new Wm,materials:new Wm,images:new Wm,videos:new Wm,colors:new Wm,timelineAnimations:new Wm,audios:new Wm,particles:new Wm,fonts:new Wm,variables:new ng,userAPIs:new Wm,userWebhooks:new Wm,lib:Iw.defaultData()}},e.defaultVariables=function(e){switch(e){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":var t=[0,0,0];return{name:"Time",value:{textValue:t,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:t,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1};case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",e)}},e.getFormattedTimerTime=function(e,t){if("HH:mm:ss"===t.format){var n=Math.floor(e/3600),i=Math.floor((e-3600*n)/60);return{textValue:[n,i,Math.round(e-3600*n-60*i)]}}if("mm:ss"===t.format){var r=Math.floor(e/60);return{textValue:[r,Math.round(e-60*r)]}}return e="number"===t.format?Math.round(e):Math.round(1e3*e)/1e3}}(Rw||(Rw={})),function(e){e.list=["idle","move","jump","run"]}(Lw||(Lw={})),function(e){e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.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","\u25b2"],["rotPosY","\u25c0"],["rotNegX","\u25bc"],["rotNegY","\u25b6"],["jump","Space"],["run","\u21e7"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.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 ng,move:new ng,jump:new ng,run:new ng},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Ux.fromHexAndA(3728051,1)}}}(Bw||(Bw={}));var Jw=180/Math.PI;function $w(e){e.rotation=e.rotation.slice(0,3).map((function(e){return e*Jw}))}function eS(e){var t,n,i;$w(e),"Page"===e.type&&$w(e.camera),null===(t=e.states)||void 0===t||t.forEach((function(e){void 0===e.rotation||null===e.rotation||(e.rotation=e.rotation.slice(0,3).map((function(e){return e*Jw})))}));var r=e.geometry;r&&"SphereGeometry"===r.type&&(r.thetaLength=(null!==(n=r.thetaLength)&&void 0!==n?n:180)*Jw),r&&"TorusGeometry"===r.type&&(r.arc=r.arc*Jw),r&&"PathGeometry"===r.type&&(r.extrusion.angle*=Jw,r.extrusion.twist*=Jw),"Mesh"===e.type&&"TextGeometry"===e.geometry.type&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(Rg(e.events))&&(null===(i=e.events)||void 0===i||i.forEach((function(e){("MouseDown"===e.type||"MouseUp"===e.type||"MousePress"===e.type||"KeyDown"===e.type||"KeyUp"===e.type||"KeyPress"===e.type||"Collision"===e.type||"Trigger"===e.type)&&(e.runMode=e.toggle?"Toggle":"Repeat")})))}var tS,nS,iS,rS,aS,oS,sS,lS,uS,cS,hS,dS,fS,vS,pS,mS,gS,yS,xS,bS,wS=122;function SS(e,t){t(e.data);var n,i=D(e.children);try{for(i.s();!(n=i.n()).done;){SS(n.value,t)}}catch(r){i.e(r)}finally{i.f()}}function _S(e){var t,n=null!==(t=e.schema)&&void 0!==t?t:104;n!==wS&&(n<105&&(SS(e.asset,eS),e.schema=105),n<118&&(SS(e.asset,AS),e.schema=118),n<121&&(SS(e.asset,MS),e.schema=121))}function AS(e){e.timelineAnimations=iw({},Wm.prototype)}function MS(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function ES(e){var t,n=null!==(t=e.schema)&&void 0!==t?t:0;if(n!==wS){console.warn("updating from ",n,"to ",wS),Qw(e,n),n<100&&(void 0===e.scene.publish.joystickSizeAndXYOffset&&(e.scene.publish.joystickSizeAndXYOffset=bw.defaultData.joystickSizeAndXYOffset),e.schema=100),n<101&&(Uw(e,Kw),Nw(e,Kw),e.schema=101),n<102&&(function(e){e.scene.objects.traverse((function(e,t){var n=t.geometry;n&&"PathGeometry"===n.type&&(n.extrusion.capType="flat",n.extrusion.bevel=50,n.extrusion.bevelSides=6,"Custom"===n.extrusion.shape.type&&(n.extrusion.shape.shapeQuality="low"))}))}(e),e.schema=102),n<104&&(e.shared.catelogs=new Wm,e.shared.lib=Iw.defaultData(),e.schema=104),n<105&&(function(e){e.shared.variables=iw({},Wm.prototype)}(e),e.scene.objects.traverse((function(e,t){eS(t)})),e.schema=105);for(var i=0,r=Object.values(e.shared.lib.components);i1&&void 0!==arguments[1]&&arguments[1],n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,l=new Fi,u=0,c=0;c-1}function LS(e,t){return e.apply(null,t)}var BS={arr:function(e){return Array.isArray(e)},obj:function(e){return RS(Object.prototype.toString.call(e),"Object")},pth:function(e){return BS.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return!("isNode"in e)&&(e.nodeType||BS.svg(e))},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return typeof e>"u"},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return BS.hex(e)||BS.rgb(e)||BS.hsl(e)},key:function(e){return!TS.hasOwnProperty(e)&&!PS.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function zS(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function FS(e,t){var n=zS(e),i=IS(BS.und(n[0])?1:n[0],.1,100),r=IS(BS.und(n[1])?100:n[1],.1,100),a=IS(BS.und(n[2])?10:n[2],.1,100),o=IS(BS.und(n[3])?0:n[3],.1,100),s=Math.sqrt(r/i),l=a/(2*Math.sqrt(r*i)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-o)/u:-o+s;function h(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?h:function(){var t=OS.springs[e];if(t)return t;for(var n=1/6,i=0,r=0;;)if(1===h(i+=n)){if(++r>=16)break}else r=0;var a=i*n*1e3;return OS.springs[e]=a,a}}function NS(e){return void 0===e&&(e=10),function(t){return Math.ceil(IS(t,1e-6,1)*e)*(1/e)}}var US=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function i(e){return 3*e}function r(e,r,a){return((t(r,a)*e+n(r,a))*e+i(r))*e}function a(e,r,a){return 3*t(r,a)*e*e+2*n(r,a)*e+i(r)}return function(t,n,i,o){if(0<=t&&t<=1&&0<=i&&i<=1){var s=new Float32Array(11);if(t!==n||i!==o)for(var l=0;l<11;++l)s[l]=r(l*e,t,i);return function(e){return t===n&&i===o||0===e||1===e?e:r(u(e),n,o)}}function u(n){for(var o=0,l=1;10!==l&&s[l]<=n;++l)o+=e;--l;var u=o+(n-s[l])/(s[l+1]-s[l])*e,c=a(u,t,i);return c>=.001?function(e,t,n,i){for(var o=0;o<4;++o){var s=a(t,n,i);if(0===s)return t;t-=(r(t,n,i)-e)/s}return t}(n,u,t,i):0===c?u:function(e,t,n,i,a){var o,s,l=0;do{(o=r(s=t+(n-t)/2,i,a)-e)>0?n=s:t=s}while(Math.abs(o)>1e-7&&++l<10);return s}(n,o,o+e,t,i)}}}(),ZS=function(){var e={linear:function(){return function(e){return e}}},t={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,n=4;e<((t=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=IS(e,1,10),i=IS(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}};return["Quad","Cubic","Quart","Quint","Expo"].forEach((function(e,n){t[e]=function(){return function(e){return Math.pow(e,n+2)}}})),Object.keys(t).forEach((function(n){var i=t[n];e["easeIn"+n]=i,e["easeOut"+n]=function(e,t){return function(n){return 1-i(e,t)(1-n)}},e["easeInOut"+n]=function(e,t){return function(n){return n<.5?i(e,t)(2*n)/2:1-i(e,t)(-2*n+2)/2}}})),e}();function VS(e,t){if(BS.fnc(e))return e;var n=e.split("(")[0],i=ZS[n],r=zS(e);switch(n){case"spring":return FS(e,t);case"cubicBezier":return LS(US,r);case"steps":return LS(NS,r);default:return LS(i,r)}}function jS(e){try{return document.querySelectorAll(e)}catch(t){return}}function GS(e,t){for(var n=e.length,i=arguments.length>=2?arguments[1]:void 0,r=[],a=0;a1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==o)t=n=i=s;else{var c=s<.5?s*(1+o):s+o-s*o,h=2*s-c;t=u(h,c,a+1/3),n=u(h,c,a),i=u(h,c,a-1/3)}return"rgba("+255*t+","+255*n+","+255*i+","+l+")"}(e):void 0}function JS(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function $S(e,t){return BS.fnc(e)?e(t.target,t.id,t.total):e}function e_(e,t){return e.getAttribute(t)}function t_(e,t,n){if(qS([n,"deg","rad","turn"],JS(t)))return t;var i=OS.CSS[t+n];if(!BS.und(i))return i;var r=document.createElement(e.tagName),a=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;a.appendChild(r),r.style.position="absolute",r.style.width=100+n;var o=100/r.offsetWidth;a.removeChild(r);var s=o*parseFloat(t);return OS.CSS[t+n]=s,s}function n_(e,t,n){if(t in e.style){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=e.style[t]||getComputedStyle(e).getPropertyValue(i)||"0";return n?t_(e,r,n):r}}function i_(e,t){return BS.dom(e)&&!BS.inp(e)&&(e_(e,t)||BS.svg(e)&&e[t])?"attribute":BS.dom(e)&&qS(DS,t)?"transform":BS.dom(e)&&"transform"!==t&&n_(e,t)?"css":null!=e[t]?"object":void 0}function r_(e){if(BS.dom(e)){for(var t,n=e.style.transform||"",i=/(\w+)\(([^)]*)\)/g,r=new Map;t=i.exec(n);)r.set(t[1],t[2]);return r}}function a_(e,t,n,i){var r=RS(t,"scale")?1:0+function(e){return RS(e,"translate")||"perspective"===e?"px":RS(e,"rotate")||RS(e,"skew")?"deg":void 0}(t),a=r_(e).get(t)||r;return n&&(n.transforms.list.set(t,a),n.transforms.last=t),i?t_(e,a,i):a}function o_(e,t,n,i){switch(i_(e,t)){case"transform":return a_(e,t,i,n);case"css":return n_(e,t,n);case"attribute":return e_(e,t);default:return e[t]||0}}function s_(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var i=JS(e)||0,r=parseFloat(t),a=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return r+a+i;case"-":return r-a+i;case"*":return r*a+i}}function l_(e,t){if(BS.col(e))return KS(e);if(/\s/g.test(e))return e;var n=JS(e),i=n?e.substr(0,e.length-n.length):e;return t?i+t:i}function u_(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function c_(e){for(var t,n=e.points,i=0,r=0;r0&&(i+=u_(t,a)),t=a}return i}function h_(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*e_(e,"r")}(e);case"rect":return function(e){return 2*e_(e,"width")+2*e_(e,"height")}(e);case"line":return function(e){return u_({x:e_(e,"x1"),y:e_(e,"y1")},{x:e_(e,"x2"),y:e_(e,"y2")})}(e);case"polyline":return c_(e);case"polygon":return function(e){var t=e.points;return c_(e)+u_(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function d_(e,t){var n=t||{},i=n.el||function(e){for(var t=e.parentNode;BS.svg(t)&&BS.svg(t.parentNode);)t=t.parentNode;return t}(e),r=i.getBoundingClientRect(),a=e_(i,"viewBox"),o=r.width,s=r.height,l=n.viewBox||(a?a.split(" "):[0,0,o,s]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:s/l[3]}}function f_(e,t){function n(n){void 0===n&&(n=0);var i=t+n>=1?t+n:0;return e.el.getPointAtLength(i)}var i=d_(e.el,e.svg),r=n(),a=n(-1),o=n(1);switch(e.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-a.y,o.x-a.x)/Math.PI}}function v_(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,i=l_(BS.pth(e)?e.totalLength:e,t)+"";return{original:i,numbers:i.match(n)?i.match(n).map(Number):[0],strings:BS.str(e)||t?i.split(n):[]}}function p_(e){return GS(e?HS(BS.arr(e)?e.map(WS):WS(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function m_(e){var t=p_(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:r_(e)}}}))}function g_(e,t){var n=XS(t);if(/^spring/.test(n.easing)&&(n.duration=FS(n.easing)),BS.arr(e)){var i=e.length;2===i&&!BS.obj(e[0])?e={value:e}:BS.fnc(t.duration)||(n.duration=t.duration/i)}var r=BS.arr(e)?e:[e];return r.map((function(e,n){var i=BS.obj(e)&&!BS.pth(e)?e:{value:e};return BS.und(i.delay)&&(i.delay=n?0:t.delay),BS.und(i.endDelay)&&(i.endDelay=n===r.length-1?t.endDelay:0),i})).map((function(e){return QS(e,n)}))}function y_(e,t){var n=[],i=t.keyframes;for(var r in i&&(t=QS(function(e){for(var t=GS(HS(e.map((function(e){return Object.keys(e)}))),(function(e){return BS.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},i=function(i){var r=t[i];n[r]=e.map((function(e){var t={};for(var n in e)BS.key(n)?n==r&&(t.value=e[n]):t[n]=e[n];return t}))},r=0;r2&&void 0!==arguments[2]&&arguments[2];t&&(u.reversed?t.seek(t.duration*t.loop-(e-t.timelineOffset-t.pingPongDelayCorrection),n):t.seek(e-t.timelineOffset-t.startOnceDelay-t.pingPongDelayCorrection,n))}function v(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(u.reversed)for(var i=o;i--;)f(e,n[i],t);else for(var r=0;r2||(T=Math.round(T*w)/w)),S.push(T)}var O=b.length;if(O){A=b[0];for(var I=0;I1&&void 0!==arguments[1]&&arguments[1],a=u.duration,f=u.delay,y=a-u.endDelay;(null===(t=u.parent)||void 0===t?void 0:t.reversed)&&"alternate"===u.direction&&(f=u.endDelay,y=a-u.delay);var x=d(e);if(u.progress=IS(x/a*100,0,100),r||(u.reversePlayback=x=f&&(u.began=!0),!u.loopBegan&&u.currentTime>0&&(u.loopBegan=!0,m("loopBegin")),(u.reversed||x>=0)&&x<=f&&0!==u.currentTime&&(p(0),m("change")),(x>=y&&u.currentTime!==a+u.pingPongDelayCorrection||!a)&&(p(a),m("change")),x>f&&xy&&m("changeComplete"),u.currentTime=IS(x,0,a+u.pingPongDelayCorrection),u.began&&m("update"),e>=a)if(g(),u.remaining){i+=o?u.duration/P_.speed:u.duration;var b,w=D(n);try{for(w.s();!(b=w.n()).done;){var S=b.value;S.setStartTime(0),S.remaining=S.loop}}catch(_){w.e(_)}finally{w.f()}m("loopComplete"),u.loopBegan=!1,"alternate"===u.direction?c():o&&h()}else u.paused=!0,u.completed||(u.completed=!0,m("loopComplete"),m("complete"),!u.passThrough&&"Promise"in window&&(s(),l(u)))}return u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.loopBegan=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversed="reverse"===e,u.remaining=u.loop,n=u.children;for(var t=o=n.length;t--;)u.children[t].reset();p(u.reversed?u.duration:0)},u.setStartTime=function(e){i=e},u.set=function(e,t){return w_(e,t),u},u.tick=function(e){a=e,i||(i=a),b((a+(r-i))*P_.speed)},u.seek=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];b(e-i,t)},u.pause=function(e){u.paused=!0,o&&(t=null!==e&&void 0!==e?e:performance.now())},u.play=function(e){!u.paused||(u.completed&&u.reset(),u.paused=!1,E_.push(u),o&&void 0!==t&&(i+=(null!==e&&void 0!==e?e:performance.now())-t),!M_&&k_.isUsingInternalRaf&&k_.play())},u.reverse=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;c(),u.completed=!u.reversed,i=void 0,r=e},u.restart=function(){u.reset(),i=void 0,r=0,u.play()},u.destroy=function(){u.paused=!0;var e=E_.indexOf(u);e>-1&&E_.splice(e,1),(e=C_.indexOf(u))>-1&&C_.splice(e,1),u.children&&u.children.forEach((function(e){e.destroy&&e.destroy()})),u.animations=[],u.animatables=[],u.children=[],u.update=null,u.begin=null,u.complete=null,u.loopBegin=null,u.loopComplete=null,u.change=null,u.changeBegin=null,u.changeComplete=null,u.timelineChangeComplete=null,u.parent=null,s=null,n=[],o=0},u.reset(),u.autoplay&&u.play(),u}function D_(e,t){for(var n=t.length;n--;)qS(e,t[n].animatable.target)&&t.splice(n,1)}P_.version="3.2.0",P_.speed=1,P_.running=E_,P_.remove=function(e){for(var t=p_(e),n=E_.length;n--;){var i=E_[n],r=i.animations,a=i.children;D_(t,r);for(var o=a.length;o--;){var s=a[o],l=s.animations;D_(t,l),!l.length&&!s.children.length&&a.splice(o,1)}!r.length&&!a.length&&i.pause()}},P_.get=o_,P_.set=w_,P_.convertPx=t_,P_.path=function(e,t){var n=BS.str(e)?jS(e)[0]:e,i=t||100;return function(e){return{property:e,el:n,svg:d_(n),totalLength:h_(n)*(i/100)}}},P_.setDashoffset=function(e){var t=h_(e);return e.setAttribute("stroke-dasharray",t),t},P_.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",i=t.easing?VS(t.easing):null,r=t.grid,a=t.axis,o=t.from||0,s="first"===o,l="center"===o,u="last"===o,c=BS.arr(e),h=parseFloat(c?e[0]:e),d=c?parseFloat(e[1]):0,f=JS(c?e[1]:e)||0,v=t.start||0+(c?h:0),p=[],m=0;return function(e,t,g){if(s&&(o=0),l&&(o=(g-1)/2),u&&(o=g-1),!p.length){for(var y=0;y-1&&E_.splice(r,1);for(var s=0;s1&&void 0!==arguments[1]?arguments[1]:"srgb";if("transparent"===e)return this.setRGBA(0,0,0,0),this;if(t=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){var r,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a="rgba"===a?parseFloat(r[4]):1,(0,d.Z)((0,m.Z)(n.prototype),"setStyle",this).call(this,e,i);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.a="hsla"===a?parseFloat(r[4]):1,(0,d.Z)((0,m.Z)(n.prototype),"setStyle",this).call(this,e,i)}}return(0,d.Z)((0,m.Z)(n.prototype),"setStyle",this).call(this,e,i)}},{key:"x",get:function(){return this.r},set:function(e){this.r=e}},{key:"y",get:function(){return this.g},set:function(e){this.g=e}},{key:"z",get:function(){return this.b},set:function(e){this.b=e}},{key:"w",get:function(){return this.a},set:function(e){this.a=e}}]),n}(Yt),R_=(Pt.degToRad,Pt.radToDeg,new un),L_=new un,B_=new ln;function z_(e,t,n,i,r,a){var o,s,l=void 0!==n[e]?n[e]:void 0,u=i[e];if(null!=u){var c=null!=l?"string"==typeof l?Number(null!==(o=r.getVariable(l))&&void 0!==o?o:0):l:t[e],h="string"==typeof u?Number(null!==(s=r.getVariable(u))&&void 0!==s?s:0):u;return c!==h?{update:function(n){var i=Pt.lerp(c,h,n);t[e]=a?Math.trunc(i):i},start:function(){t[e]=c},end:function(){t[e]=h}}:void 0}}function F_(e,t,n,i,r,a){var o=n[e]?n[e]:void 0,s=i[e];if(s){var u=t[e],c=(0,l.Z)(null!==o&&void 0!==o?o:u).map((function(e){var t;return"string"==typeof e?Number(null!==(t=r.getVariable(e))&&void 0!==t?t:0):e})),h=(0,l.Z)(s).map((function(e){var t;return"string"==typeof e?Number(null!==(t=r.getVariable(e))&&void 0!==t?t:0):e}));return c.length!==h.length||om(c,h)?void 0:{update:function(n){c.forEach((function(i,r){var o=Pt.lerp(i,h[r],n);t[e][r]=a?Math.trunc(o):o}))},start:function(){Object.assign(t[e],c)},end:function(){Object.assign(t[e],h)}}}}function N_(e,t,n){return t.forEach((function(t,i){var r;e.setComponent(i,"string"==typeof t?Number(null!==(r=n.getVariable(t))&&void 0!==r?r:0):t)})),e}function U_(e,t,n,i,r){var a=n[e]?n[e]:void 0,o=i[e];if(o){var s=t[e],l=a?N_(new un,a,r):s.clone(),u=N_(new un,o,r);return l.equals(u)?void 0:{update:function(e){s.lerpVectors(l,u,e)},start:function(){s.copy(l)},end:function(){s.copy(u)}}}}function Z_(e,t,n){return t.forEach((function(t,i){var r;e.setComponent(i,"string"==typeof t?Number(null!==(r=n.getVariable(t))&&void 0!==r?r:0):t)})),e}function V_(e,t,n,i,r){var a=n[e]?n[e]:void 0,o=i[e];if(o){var s=t[e],l=!(s instanceof Dt),u=s instanceof Dt?s:(new Dt).fromArray(s),c=a?Z_(new Dt,a,r):u.clone(),h=Z_(new Dt,o,r);return c.equals(h)?void 0:{update:function(n){u.lerpVectors(c,h,n),l&&(t[e]=u.toArray())},start:function(){u.copy(c),l&&(t[e]=u.toArray())},end:function(){u.copy(h),l&&(t[e]=u.toArray())}}}}function j_(e,t,n,i,r){var a=n[e]?n[e]:void 0,o=i[e];if(o){var s=t[e],l=new I_(s.r,s.g,s.b,s.a),u=a?"string"==typeof a?r.getColor(a).clone():new I_(a.r,a.g,a.b,a.a):l.clone(),c="string"==typeof o?r.getColor(o).clone():new I_(o.r,o.g,o.b,o.a);return u.equals(c)?void 0:{update:function(n){l.lerpColors(u,c,n);var i=Pt.lerp(u.a,c.a,n);l.a=i,t[e]={r:l.r,g:l.g,b:l.b,a:l.a}},start:function(){l.copy(u)},end:function(){l.copy(c)}}}}function G_(e,t,n,i,r){return"number"==typeof t[e]?z_(e,t,null!==n&&void 0!==n?n:{},i,r):Array.isArray(t[e])?F_(e,t,null!==n&&void 0!==n?n:{},i,r):void 0}var H_,W_;new Yn;function q_(e,t,n,i,r){var a=n[e],o=i[e];if("number"==typeof t[e])Math.abs(a-o)>1e-4&&(t[e]=Pt.lerp(a,o,r));else if(Array.isArray(t[e]))for(var s=0,l=a.length;s1&&void 0!==arguments[1]?arguments[1]:[0,0],n=e&&!isNaN(e[0])?e[0]:t[0],i=e&&!isNaN(e[1])?e[1]:t[1];return[n,i]}function Q_(e,t,n){switch(e){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:var i=null!==t&&void 0!==t?t:k({},Yx.defaultData),r=i.control1,a=i.control2;return"cubicBezier( ".concat(r[0],", ").concat(r[1],", ").concat(a[0],", ").concat(a[1]," )");case 6:var o=null!==n&&void 0!==n?n:k({},qx.defaultData),s=o.mass,l=o.stiffness,u=o.damping,c=o.velocity,h=new tA(s,l,u,c),d=h.solve(1);return function(){return function(e){return h.solve(e)/d}};case 8:return function(){return function(e){return Math.floor(e)}}}}function K_(e,t,n){return{id:t,fi:n,data:{id:t,path:e,keyframes:new ng}}}!function(e){e.is=function(e){return e&&"number"==typeof e.x&&"number"==typeof e.y&&"number"==typeof e.z}}(H_||(H_={})),function(e){function t(e,t,n,i){var r=[];return t.properties.forEach((function(t,a){var o,s=null===(o=t.data.path)||void 0===o?void 0:o[0];if(s&&["position","rotation","scale"].includes(s)){var u=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},i=[],r=D(J_);try{var a=function(){var r,a=t.value,o=(0,l.Z)(null!==(r=e.keyframes)&&void 0!==r?r:[]).filter((function(e){return void 0!==e.data.value[a]})).sort((function(e,t){return e.data.time-t.data.time})),s=o[0];s&&(null===n||void 0===n||n(s.data.value));for(var u={index:[],t:[]},c=0;c1){var x={t:0,index:0};i.push(k(k({targets:x},u),{},{update:function(e){var t,i=Math.ceil(x.index),r=i%2===0?x.t:1-x.t,s=null===o||void 0===o?void 0:o[i].data.value,l=null===o||void 0===o||null===(t=o[i+1])||void 0===t?void 0:t.data.value;if(void 0!==s&&void 0!==l){var u=(0,g.Z)({},a,s[a]+(l[a]-s[a])*r);null===n||void 0===n||n(u)}}}))}};for(r.s();!(t=r.n()).done;)a()}catch(o){r.e(o)}finally{r.f()}return i}(t.data,null===n||void 0===n?void 0:n[s]);u&&r.push.apply(r,(0,l.Z)(u))}if(s&&"shape size"===s&&"geometry"in e){var c=function(e,t,n){var i,r=[],a=D(J_);try{var o=function(){var e,a=i.value,o={},s=(0,l.Z)(null!==(e=t.keyframes)&&void 0!==e?e:[]).filter((function(e){return void 0!==e.data.value[a]})).sort((function(e,t){return e.data.time-t.data.time})),u=s[0];u&&null!==n&&void 0!==n&&n(u.data.value),o={index:[],t:[]};for(var c=0;c1){var x={t:0,index:0};r.push(k(k({targets:x},o),{},{update:function(e){var t,i=Math.ceil(x.index),r=i%2===0?x.t:1-x.t,o=null===s||void 0===s?void 0:s[i].data.value,l=null===s||void 0===s||null===(t=s[i+1])||void 0===t?void 0:t.data.value;if(void 0!==o&&void 0!==l){var u=(0,g.Z)({},a,o[a]+(l[a]-o[a])*r);null===n||void 0===n||n(u)}}}))}};for(a.s();!(i=a.n()).done;)o()}catch(s){a.e(s)}finally{a.f()}return r}(0,t.data,null===n||void 0===n?void 0:n.shapeSize);c&&r.push.apply(r,(0,l.Z)(c))}if(s&&"path extrusion"===s&&e instanceof XF){var h=function(e,t,n){var i,r={},a=(0,l.Z)(null!==(i=t.keyframes)&&void 0!==i?i:[]).sort((function(e,t){return e.data.time-t.data.time})),o=a[0];o&&null!==n&&void 0!==n&&n(e,o.data.value),r={index:[],t:[]};for(var s=0;s1){var m={t:0,index:0};return k(k({targets:m},r),{},{update:function(t){var i,r=Math.ceil(m.index),o=r%2===0?m.t:1-m.t,s=null===a||void 0===a?void 0:a[Math.min(r,a.length-1)].data.value,l=null===a||void 0===a||null===(i=a[Math.min(r,a.length-1)+1])||void 0===i?void 0:i.data.value;null===n||void 0===n||n(e,function(e,t,n,i){var r=e.geometry.userData.parameters.extrusion;if(r)return jb.forEach((function(e){q_(e,r,t,n,i)})),r}(e,s,l,o))}})}}(e,t.data,null===n||void 0===n?void 0:n.pathExtrusion);h&&r.push(h)}if(s&&"path snapping"===s&&e.data.pathSnapping){var d=function(e,t,n){var i,r={},a=(0,l.Z)(null!==(i=t.keyframes)&&void 0!==i?i:[]).sort((function(e,t){return e.data.time-t.data.time})),o=a[0];o&&null!==n&&void 0!==n&&n(o.data.value),r={index:[],t:[]};for(var s=0;s1){var m={t:0,index:0};return k(k({targets:m},r),{},{update:function(t){var i,r=Math.ceil(m.index),o=r%2===0?m.t:1-m.t,s=null===a||void 0===a?void 0:a[Math.min(r,a.length-1)].data.value,l=null===a||void 0===a||null===(i=a[Math.min(r,a.length-1)+1])||void 0===i?void 0:i.data.value;null===n||void 0===n||n(function(e,t,n,i){var r=e.updatedPathSnapping;if(r)return zw.forEach((function(e){q_(e,r,t,n,i)})),r}(e,s,l,o))}})}}(e,t.data,null===n||void 0===n?void 0:n.pathSnapping);d&&r.push(d)}if(s&&"material"===s&&"Mesh"===e.type&&"material"in e&&e.material instanceof CO){var f=t.data.id;if(f){var v=e.material.getLayerByUuid(f);if(v){var p=$_(v,t.data,null===n||void 0===n?void 0:n.material,i);p&&r.push(p)}else{var m=e.material.getLayersOfType(t.data.type);if(m){var y,x=D(m);try{for(x.s();!(y=x.n()).done;){var b=$_(y.value,t.data,null===n||void 0===n?void 0:n.material,i);b&&r.push(b)}}catch(M){x.e(M)}finally{x.f()}}}}}if(s&&"opacity"===s&&"Mesh"===e.type&&"material"in e){var w=function(e,t){if(e){var n,i={},r=(0,l.Z)(null!==(n=e.keyframes)&&void 0!==n?n:[]).sort((function(e,t){return e.data.time-t.data.time})),a=r[0];a&&null!==t&&void 0!==t&&t(a.data.value),i={index:[],t:[]};for(var o=0;o1){var p={t:0,index:0};return k(k({targets:p},i),{},{update:function(e){var n,i=Math.ceil(p.index),a=i%2===0?p.t:1-p.t,o=null===r||void 0===r?void 0:r[Math.min(i,r.length-1)].data.value,s=null===r||void 0===r||null===(n=r[Math.min(i,r.length-1)+1])||void 0===n?void 0:n.data.value,l=Pt.lerp(o,s,a);null===t||void 0===t||t(l)}})}}}(t.data,null===n||void 0===n?void 0:n.opacity);w&&r.push(w)}if(s&&"cloner"===s){var S=function(e,t,n){var i,r={},a=(0,l.Z)(null!==(i=t.keyframes)&&void 0!==i?i:[]).sort((function(e,t){return e.data.time-t.data.time})),o=a[0];o&&null!==n&&void 0!==n&&n(e,o.data.value,o.data.value),r={index:[],t:[]};for(var s=0;s1){var m={t:0,index:0};return k(k({targets:m},r),{},{update:function(t){var i,r=Math.ceil(m.index),o=r%2===0?m.t:1-m.t,s=null===a||void 0===a?void 0:a[Math.min(r,a.length-1)].data.value,l=null===a||void 0===a||null===(i=a[Math.min(r,a.length-1)+1])||void 0===i?void 0:i.data.value;null===n||void 0===n||n(e,s.randomnessObject?void 0:function(e,t,n,i){var r,a=null===(r=i.cloner)||void 0===r?void 0:r.parameters;if(a){q_("count",a,e,t,n),a.count=Math.trunc(a.count);var o,s=D(ub);try{for(s.s();!(o=s.n()).done;)q_(o.value,a.radial,e.radial,t.radial,n)}catch(M){s.e(M)}finally{s.f()}var l,u=D(cb);try{for(u.s();!(l=u.n()).done;)q_(l.value,a.linear,e.linear,t.linear,n)}catch(M){u.e(M)}finally{u.f()}var c,h=D(hb);try{for(h.s();!(c=h.n()).done;)q_(c.value,a.grid,e.grid,t.grid,n)}catch(M){h.e(M)}finally{h.f()}var d,f=D(db);try{for(f.s();!(d=f.n()).done;)q_(d.value,a.toObject,e.toObject,t.toObject,n)}catch(M){f.e(M)}finally{f.f()}return a}}(s,l,o,e),s.randomnessObject?function(e,t,n,i){var r,a=null===(r=i.cloner)||void 0===r?void 0:r.parameters;if(a){var o,s=D(fb);try{for(s.s();!(o=s.n()).done;)q_(o.value,a.randomnessObject,e.randomnessObject,t.randomnessObject,n)}catch(M){s.e(M)}finally{s.f()}return a}}(s,l,o,e):void 0)}})}}(e,t.data,null===n||void 0===n?void 0:n.cloner);S&&r.push(S)}if(s&&"camera"===s&&e instanceof ZR){var _=function(e,t,n,i){if(t){var r,a=(0,g.Z)({},i,[]),o=(0,l.Z)(null!==(r=t.keyframes)&&void 0!==r?r:[]).sort((function(e,t){return e.data.time-t.data.time})),s=o[0];s&&(e[i]=s.data.value,s&&(null===n||void 0===n||n(i,s.data.value)));for(var u=0;u1)return k(k({targets:e},a),{},{update:function(){null===n||void 0===n||n(i,e[i])}})}}(e,t.data,null===n||void 0===n?void 0:n.camera,"zoom");_&&r.push(_)}if(s&&"light"===s&&(e instanceof Bz||e instanceof WF||e instanceof Uz)){var A=function(e,t,n,i,r){if(t){var a,o={},s=(0,l.Z)(null!==(a=t.keyframes)&&void 0!==a?a:[]).sort((function(e,t){return e.data.time-t.data.time})),u=s[0];if(u){var c=u.data.value;e[i]=c,null===n||void 0===n||n(i,c)}o={index:[],t:[]};for(var h=0;h1){var x={t:0,index:0};return k(k({targets:x},o),{},{update:function(){var e,t=Math.ceil(x.index),a=t%2===0?x.t:1-x.t,o=eA(null===s||void 0===s?void 0:s[Math.min(t,s.length-1)].data.value,null===s||void 0===s||null===(e=s[Math.min(t,s.length-1)+1])||void 0===e?void 0:e.data.value,a,r);null===n||void 0===n||n(i,o)}})}}}(e,t.data,null===n||void 0===n?void 0:n.light,t.data.path[1],i);A&&r.push(A)}})),r}e.getControlsWithDefault=function(e,t){var n=[0,0],i=[1,1];if(null!==e&&void 0!==e&&e.cubicControls)n=Y_(e.cubicControls.control1,n);else switch(null===e||void 0===e?void 0:e.type){case 2:n=[.42,0];break;case 3:n=[0,0];break;case 4:n=[.42,0];break;case 1:n=[.25,.1];break;case 0:n=[0,0];break;case 7:n=[.25,1]}if(null!==t&&void 0!==t&&t.cubicControls)i=Y_(t.cubicControls.control2,i);else switch(null===t||void 0===t?void 0:t.type){case 2:i=[1,1];break;case 3:case 4:i=[.58,1];break;case 1:i=[.25,1];break;case 0:i=[1,1];break;case 7:i=[.5,1]}return{control1:n,control2:i}},e.defaultData=function(e,t){return{id:e,name:t,to:5,properties:new ng}},e.createMaterialGroup=function(e){var t=new ng;return e.forEach((function(e){var n=e.data,i=e.id,r=e.fi;if("light"===n.type){var a=K_(["material","".concat(n.category," lighting")],i,r);t.push(a)}else{var o=K_(["material",n.type],i,r);t.push(o)}})),t},e.createName=function(e){return Object.entries(e).reduce((function(e,t){var n=(0,h.Z)(t,2),i=(n[0],n[1]);return"string"!=typeof i&&e.push({name:i.name}),e}),[])},e.createTimeline=function(e,n,i){var r=O_.timeline({easing:Q_(0),begin:function(){e.resetBBoxNeedsUpdate()},change:function(){e.resetBBoxNeedsUpdate()},direction:n.direction,autoplay:!1});return t(e,n,i).forEach((function(e){return r.add(e,0)})),r.duration=1e3*n.to,r},e.addKeyframesToTimeline=t,e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Q_(3),duration:1e3},opacity:{value:[0,1],easing:Q_(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Q_(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Q_(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Q_(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]}(W_||(W_={}));var J_=["x","y","z"];function $_(e,t,n,i){if(t){var r,a={},o=(0,l.Z)(null!==(r=t.keyframes)&&void 0!==r?r:[]).sort((function(e,t){return e.data.time-t.data.time}));if("data"in e){var s=o[0];s&&null!==n&&void 0!==n&&n(s.data.value,e),a={index:[],t:[]};for(var u=0;u1){var g={t:0,index:0};return k(k({targets:g},a),{},{update:function(t){var r,a=Math.ceil(g.index),s=a%2===0?g.t:1-g.t,l=null===o||void 0===o?void 0:o[Math.min(a,o.length-1)].data.value,u=null===o||void 0===o||null===(r=o[Math.min(a,o.length-1)+1])||void 0===r?void 0:r.data.value,c={},h={};if(Object.keys(l).length>0&&Object.keys(u).length>0)for(var d in e.data)if(d in l&&d in u){var f=eA(l[d],u[d],s,i);void 0!==f&&(c[d]=f,h[d]={start:l,end:u,t:s})}null===n||void 0===n||n(k({},c),e,h)}})}}}}function eA(e,t,n,i){if("string"==typeof e&&i&&(e=i.color(e)),"string"==typeof t&&i&&(e=i.color(t)),"number"==typeof e)return e===t?void 0:Pt.lerp(e,t,n);if(Ux.is(e))return Ux.lerp(e,t,n);if(Fx.is(e))return Fx.lerp(e,t,n);if(Array.isArray(e))return(e.length>t.length?t:e).map((function(i,r,a){if(Array.isArray(i)){var o=e[r].length>t[r].length?t[r].length:e[r].length;return(4===o?Rx:3===o?Ox:Dx).lerp(e[r],t[r],n)}return Pt.lerp(e[r],t[r],n)}));if("object"==typeof e&&null!==e){var r={};for(var a in e){var o=eA(e[a],t[a],n,i);void 0!==o&&(r[a]=o)}return r}}var tA=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,b.Z)(this,e),this.mass=t,this.stiffness=n,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(n/t),this.m_zeta=i/(2*Math.sqrt(n*t)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}return(0,w.Z)(e,[{key:"solve",value:function(e){return 1-(e=this.m_zeta<1?Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0))}},{key:"getDuration",value:function(){for(var e=.16666666666666666,t=0,n=0;;)if(t+=e,1===this.solve(t)){if(++n>=16)break}else n=0;return t*e*1e3}}]),e}(),nA=Math.pow(2,-24),iA=function e(){(0,b.Z)(this,e)};function rA(e,t,n){return n.min.x=t[e],n.min.y=t[e+1],n.min.z=t[e+2],n.max.x=t[e+3],n.max.y=t[e+4],n.max.z=t[e+5],n}function aA(e){for(var t=-1,n=-1/0,i=0;i<3;i++){var r=e[i+3]-e[i];r>n&&(n=r,t=i)}return t}function oA(e,t){t.set(e)}function sA(e,t,n){for(var i,r,a=0;a<3;a++){var o=a+3;i=e[a],r=t[a],n[a]=ir?i:r}}function lA(e,t,n){for(var i=0;i<3;i++){var r=t[e+2*i],a=t[e+2*i+1],o=r-a,s=r+a;on[i+3]&&(n[i+3]=s)}}function uA(e){var t=e[3]-e[0],n=e[4]-e[1],i=e[5]-e[2];return 2*(t*n+n*i+i*t)}function cA(e,t,n,i){for(var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=1/0,o=1/0,s=1/0,l=-1/0,u=-1/0,c=-1/0,h=1/0,d=1/0,f=1/0,v=-1/0,p=-1/0,m=-1/0,g=null!==r,y=6*t,x=6*(t+n);yl&&(l=_),g&&bv&&(v=b);var A=e[y+2],M=e[y+3],E=A-M,C=A+M;Eu&&(u=C),g&&Ap&&(p=A);var k=e[y+4],T=e[y+5],P=k-T,D=k+T;Pc&&(c=D),g&&km&&(m=k)}i[0]=a,i[1]=o,i[2]=s,i[3]=l,i[4]=u,i[5]=c,g&&(r[0]=h,r[1]=d,r[2]=f,r[3]=v,r[4]=p,r[5]=m)}function hA(e,t,n,i,r){for(var a=n,o=n+i-1,s=r.pos,l=2*r.axis;;){for(;a<=o&&t[6*a+l]=s;)o--;if(!(a=P.candidate?lA(C,n,P.rightCacheBounds):(lA(C,n,P.leftCacheBounds),P.count++)}for(var D=0;D=dA&&(H=31);var W=vA[H];W.count++,lA(G,n,W.bounds)}var q=vA[31];oA(q.bounds,q.rightCacheBounds);for(var X=30;X>=0;X--){var Y=vA[X],Q=vA[X+1];sA(Y.bounds,Q.rightCacheBounds,Y.rightCacheBounds)}for(var K=0,J=0;J<31;J++){var $=vA[J],ee=$.count,te=$.bounds,ne=vA[J+1].rightCacheBounds;0!==ee&&(0===K?oA(te,pA):sA(te,pA,pA));var ie=0,re=0;0!==(K+=ee)&&(ie=uA(pA)/u);var ae=r-K;0!==ae&&(re=uA(ne)/u);var oe=1+1.25*(ie*K+re*ae);oe3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!v&&p>=l&&(v=!0,u&&(console.warn("MeshBVH: Max depth of ".concat(l," reached when generating BVH. Consider increasing maxDepth.")),console.warn(e))),d<=c||p>=l)return n(r+d),t.offset=r,t.count=d,t;var m=mA(t.boundingData,f,o,r,d,h);if(-1===m.axis)return n(r+d),t.offset=r,t.count=d,t;var g=hA(s,o,r,d,m);if(g===r||g===r+d)n(r+d),t.offset=r,t.count=d;else{t.splitAxis=m.axis;var y=new iA,x=r,b=g-r;t.left=y,y.boundingData=new Float32Array(6),cA(o,x,b,y.boundingData,a),i(y,x,b,a,p+1);var w=new iA,S=g,_=d-b;t.right=w,w.boundingData=new Float32Array(6),cA(o,S,_,w.boundingData,a),i(w,S,_,a,p+1)}return t}!function(e,t){if(!e.index){var n,i=e.attributes.position.count,r=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;n=i>65535?new Uint32Array(new r(4*i)):new Uint16Array(new r(2*i)),e.setIndex(new Ci(n,1));for(var a=0;aS&&(S=x),b>S&&(S=b);var _=(S-w)/2,A=2*g;a[f+A+0]=w+_,a[f+A+1]=_+(Math.abs(w)+_)*nA,wt[g+3]&&(t[g+3]=S)}}return a}(e,r),s=e.index.array,l=t.maxDepth,u=t.verbose,c=t.maxLeafTris,h=t.strategy,d=t.onProgress,f=e.index.count/3,v=!1,p=[],m=function(e){if(!e.groups||!e.groups.length)return[{offset:0,count:e.index.count/3}];var t,n=[],i=new Set,r=D(e.groups);try{for(r.s();!(t=r.n()).done;){var a=t.value;i.add(a.start),i.add(a.start+a.count)}}catch(c){r.e(c)}finally{r.f()}for(var o=Array.from(i.values()).sort((function(e,t){return e-t})),s=0;ss&&(s=d);var f=e[c+2];fl&&(l=f);var v=e[c+4];vu&&(u=v)}i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u}(o,g.offset,g.count,a),i(y,g.offset,g.count,a),p.push(y)}else{var x,b=D(m);try{for(b.s();!(x=b.n()).done;){var w=x.value,S=new iA;S.boundingData=new Float32Array(6),cA(o,w.offset,w.count,S.boundingData,a),i(S,w.offset,w.count,a),p.push(S)}}catch(_){b.e(_)}finally{b.f()}}return p}function yA(e,t){for(var n,i,r,a=gA(e,t),o=[],s=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,l=0;lMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[a+6]=f/4,f=d(f,p),i[a+7]=m,f}}var xA=function(){function e(){(0,b.Z)(this,e),this.min=1/0,this.max=-1/0}return(0,w.Z)(e,[{key:"setFromPointsField",value:function(e,t){for(var n=1/0,i=-1/0,r=0,a=e.length;ri?o:i}this.min=n,this.max=i}},{key:"setFromPoints",value:function(e,t){for(var n=1/0,i=-1/0,r=0,a=t.length;ri?s:i}this.min=n,this.max=i}},{key:"isSeparated",value:function(e){return this.min>e.max||e.min>this.max}}]),e}();xA.prototype.setFromBox=function(){var e=new un;return function(t,n){for(var i=n.min,r=n.max,a=1/0,o=-1/0,s=0;s<=1;s++)for(var l=0;l<=1;l++)for(var u=0;u<=1;u++){e.x=i.x*s+r.x*(1-s),e.y=i.y*l+r.y*(1-l),e.z=i.z*u+r.z*(1-u);var c=t.dot(e);a=Math.min(c,a),o=Math.max(c,o)}this.min=a,this.max=o}}();!function(){var e=new xA}();var bA=function(){var e=new un,t=new un,n=new un;return function(i,r,a){var o=i.start,s=e,l=r.start,u=t;n.subVectors(o,l),e.subVectors(i.end,i.start),t.subVectors(r.end,r.start);var c,h,d=n.dot(u),f=u.dot(s),v=u.dot(u),p=n.dot(s),m=s.dot(s)*v-f*f;h=(d+(c=0!==m?(d*f-p*v)/m:0)*f)/v,a.x=c,a.y=h}}(),wA=function(){var e=new Dt,t=new un,n=new un;return function(i,r,a,o){bA(i,r,e);var s,l,u=e.x,c=e.y;if(u>=0&&u<=1&&c>=0&&c<=1)return i.at(u,a),void r.at(c,o);if(u>=0&&u<=1)return c<0?r.at(0,o):r.at(1,o),void i.closestPointToPoint(o,!0,a);if(c>=0&&c<=1)return u<0?i.at(0,a):i.at(1,a),void r.closestPointToPoint(a,!0,o);s=u<0?i.start:i.end,l=c<0?r.start:r.end;var h=t,d=n;return i.closestPointToPoint(l,!0,t),r.closestPointToPoint(s,!0,n),h.distanceToSquared(l)<=d.distanceToSquared(s)?(a.copy(h),void o.copy(l)):(a.copy(s),void o.copy(d))}}(),SA=function(){var e=new un,t=new un,n=new pr,i=new tc;return function(r,a){var o=r.radius,s=r.center,l=a.a,u=a.b,c=a.c;if(i.start=l,i.end=u,i.closestPointToPoint(s,!0,e).distanceTo(s)<=o||(i.start=l,i.end=c,i.closestPointToPoint(s,!0,e).distanceTo(s)<=o)||(i.start=u,i.end=c,i.closestPointToPoint(s,!0,e).distanceTo(s)<=o))return!0;var h=a.getPlane(n);if(Math.abs(h.distanceToPoint(s))<=o){var d=h.projectPoint(s,t);if(a.containsPoint(d))return!0}return!1}}();function _A(e){return Math.abs(e)<1e-15}var AA=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;(0,b.Z)(this,n);for(var i=arguments.length,r=new Array(i),a=0;a1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=i.start,l=i.end,u=this.points,c=1/0,h=0;h<3;h++){var d=(h+1)%3;n.start.copy(u[h]),n.end.copy(u[d]),wA(n,i,e,t),(r=e.distanceToSquared(t))1&&void 0!==arguments[1]?arguments[1]:null,v=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.needsUpdate&&this.update(),d.isExtendedTriangle?d.needsUpdate&&d.update():(e.copy(d),e.update(),d=e);var p=this.plane,m=d.plane;if(Math.abs(p.normal.dot(m.normal))>1-1e-10){var g=this.satBounds,y=this.satAxes;n[0]=d.a,n[1]=d.b,n[2]=d.c;for(var x=0;x<4;x++){var b=g[x],w=y[x];if(i.setFromPoints(w,n),b.isSeparated(i))return!1}var S=d.satBounds,_=d.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(var A=0;A<4;A++){var M=S[A],E=_[A];if(i.setFromPoints(E,t),M.isSeparated(i))return!1}for(var C=0;C<4;C++)for(var k=y[C],T=0;T<4;T++){var P=_[T];if(a.crossVectors(k,P),i.setFromPoints(a,t),r.setFromPoints(a,n),i.isSeparated(r))return!1}return f&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),f.start.set(0,0,0),f.end.set(0,0,0)),!0}for(var D=this.points,O=!1,I=0,R=0;R<3;R++){var L=D[R],B=D[(R+1)%3];u.start.copy(L),u.end.copy(B),u.delta(o);var z=O?c.start:c.end,F=_A(m.distanceToPoint(L));if(_A(m.normal.dot(o))&&F){c.copy(u),I=2;break}if((m.intersectLine(u,z)||F)&&!_A(z.distanceTo(B))){if(I++,O)break;O=!0}}if(1===I&&d.containsPoint(c.end))return f&&(f.start.copy(c.end),f.end.copy(c.end)),!0;if(2!==I)return!1;for(var N=d.points,U=!1,Z=0,V=0;V<3;V++){var j=N[V],G=N[(V+1)%3];u.start.copy(j),u.end.copy(G),u.delta(s);var H=U?h.start:h.end,W=_A(p.distanceToPoint(j));if(_A(p.normal.dot(s))&&W){h.copy(u),Z=2;break}if((p.intersectLine(u,H)||W)&&!_A(H.distanceTo(G))){if(Z++,U)break;U=!0}}if(1===Z&&this.containsPoint(h.end))return f&&(f.start.copy(h.end),f.end.copy(h.end)),!0;if(2!==Z)return!1;if(c.delta(o),h.delta(s),o.dot(s)<0){var q=h.start;h.start=h.end,h.end=q}var X=c.start.dot(o),Y=c.end.dot(o),Q=h.start.dot(o),K=h.end.dot(o),J=Y0?f.start.copy(c.start):f.start.copy(h.start),l.subVectors(c.end,h.end),l.dot(o)<0?f.end.copy(c.end):f.end.copy(h.end)),!0)}}(),AA.prototype.distanceToPoint=function(){var e=new un;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}(),AA.prototype.distanceToTriangle=function(){var e=new un,t=new un,n=["a","b","c"],i=new tc,r=new tc;return function(a){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=o||s?i:null;if(this.intersectsTriangle(a,l))return(o||s)&&(o&&l.getCenter(o),s&&l.getCenter(s)),0;for(var u=1/0,c=0;c<3;c++){var h=void 0,d=n[c],f=a[d];this.closestPointToPoint(f,e),(h=f.distanceToSquared(e))1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(this.needsUpdate&&this.update(),this.intersectsBox(a))return(s||l)&&(a.getCenter(r),this.closestPointToPoint(r,i),a.closestPointToPoint(i,r),s&&s.copy(i),l&&l.copy(r)),0;for(var u=o*o,c=a.min,h=a.max,d=this.points,f=1/0,v=0;v<8;v++){var p=d[v];r.copy(p).clamp(c,h);var m=p.distanceToSquared(r);if(m0&&u.normal.multiplyScalar(-1));var c={a:a,b:o,c:s,normal:new un,materialIndex:0};wi.getNormal(EA,CA,kA,c.normal),u.face=c,u.faceIndex=a}return u}(n,u.position,u.normal,u.uv,u.uv1,o,s,l,t);return c?(c.faceIndex=i,r&&r.push(c),c):null}function zA(e,t,n,i){var r=e.a,a=e.b,o=e.c,s=t,l=t+1,u=t+2;n&&(s=n.getX(t),l=n.getX(t+1),u=n.getX(t+2)),r.x=i.getX(s),r.y=i.getY(s),r.z=i.getZ(s),a.x=i.getX(l),a.y=i.getY(l),a.z=i.getZ(l),o.x=i.getX(u),o.y=i.getY(u),o.z=i.getZ(u)}function FA(e,t,n,i,r,a,o){for(var s=n.index,l=n.attributes.position,u=e,c=t+e;u=0;d?(l=jA(e),u=GA(e,s)):(l=GA(e,s),u=jA(e));var f=JA(l,a,i,WA)?YA(l,t,n,i):null;if(f){var v=f.point[h];if(d?v<=a[u+c]:v>=a[u+c+3])return f}var p=JA(u,a,i,WA)?YA(u,t,n,i):null;return f&&p?f.distance<=p.distance?f:p:f||p||null}var QA=function(){var e,t,n=[],i=new NA((function(){return new dn}));return function(){e=i.getPrimitive(),t=i.getPrimitive(),n.push(e,t);var a=r.apply(void 0,arguments);i.releasePrimitive(e),i.releasePrimitive(t),n.pop(),n.pop();var o=n.length;return o>0&&(t=n[o-1],e=n[o-2]),a};function r(n,i,a,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;function c(e){for(var t=2*e,n=tM,i=nM;!UA(t,n);)t=2*(e=jA(e));return ZA(e,i)}function h(e){for(var t=2*e,n=tM,i=nM;!UA(t,n);)t=2*(e=GA(e,i));return ZA(e,i)+VA(t,n)}var d=2*n,f=eM,v=tM,p=nM;if(UA(d,v)){var m=ZA(n,p),g=VA(d,v);return rA(n,f,e),o(m,g,!1,u,l+n,e)}var y,x,b,w,S=jA(n),_=GA(n,p),A=S,M=_;if(s&&(w=t,rA(A,f,b=e),rA(M,f,w),y=s(b),(x=s(w))4&&void 0!==arguments[4]?arguments[4]:null,h=2*o,d=eM,f=tM,v=nM;if(null===c&&(l.boundingBox||l.computeBoundingBox(),i.set(l.boundingBox.min,l.boundingBox.max,u),c=i),!UA(h,f)){var p=o+8,m=v[o+6];return rA(p,d,HA),!!(c.intersectsBox(HA)&&a(p,s,l,u,c)||(rA(m,d,HA),c.intersectsBox(HA)&&a(m,s,l,u,c)))}var g=s,y=g.index,x=g.attributes.position,b=l.index,w=l.attributes.position,S=ZA(o,v),_=VA(h,f);if(n.copy(u).invert(),l.boundsTree)return rA(o,d,r),r.matrix.copy(n),r.needsUpdate=!0,l.boundsTree.shapecast({intersectsBounds:function(e){return r.intersectsBox(e)},intersectsTriangle:function(e){e.a.applyMatrix4(u),e.b.applyMatrix4(u),e.c.applyMatrix4(u),e.needsUpdate=!0;for(var n=3*S,i=3*(_+S);n1&&void 0!==arguments[1]?arguments[1]:{};if((0,b.Z)(this,e),!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((n=Object.assign((0,g.Z)({strategy:0,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null},oM,!1),n)).useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,n[oM]||(this._roots=yA(t,n),!t.boundingBox&&n.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new dn))),this.geometry=t}return(0,w.Z)(e,null,[{key:"serialize",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),e.serialize(arguments[0],{cloneBuffers:void 0===arguments[2]||arguments[2]});n=k({cloneBuffers:!0},n);var i=t.geometry,r=t._roots,a=i.getIndex();return n.cloneBuffers?{roots:r.map((function(e){return e.slice()})),index:a.array.slice()}:{roots:r,index:a.array}}},{key:"deserialize",value:function(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("boolean"==typeof i)return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),e.deserialize(arguments[0],arguments[1],{setIndex:void 0===arguments[2]||arguments[2]});i=k({setIndex:!0},i);var r=t.index,a=t.roots,o=new e(n,k(k({},i),{},(0,g.Z)({},oM,!0)));if(o._roots=a,i.setIndex){var s=n.getIndex();if(null===s){var l=new Ci(t.index,1,!1);n.setIndex(l)}else s.array!==r&&(s.array.set(r),s.needsUpdate=!0)}return o}}]),(0,w.Z)(e,[{key:"refit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e&&Array.isArray(e)&&(e=new Set(e));for(var t,n,i,r,a=this.geometry,o=a.index.array,s=a.attributes.position,l=0,u=this._roots,c=0,h=u.length;c2&&void 0!==arguments[2]&&arguments[2],u=2*t;if(65535===i[u+15]){for(var c=n[t+6],h=i[u+14],f=1/0,v=1/0,p=1/0,m=-1/0,g=-1/0,y=-1/0,x=3*c,b=3*(c+h);xm&&(m=S),_g&&(g=_),Ay&&(y=A)}return(r[t+0]!==f||r[t+1]!==v||r[t+2]!==p||r[t+3]!==m||r[t+4]!==g||r[t+5]!==y)&&(r[t+0]=f,r[t+1]=v,r[t+2]=p,r[t+3]=m,r[t+4]=g,r[t+5]=y,!0)}var M=t+8,E=n[t+6],C=M+a,k=E+a,T=l,P=!1,D=!1;e?T||(P=e.has(C),D=e.has(k),T=!P&&!D):(P=!0,D=!0);var O=T||P,I=T||D,R=!1;O&&(R=d(M,a,T));var L=!1;I&&(L=d(E,a,T));var B=R||L;if(B)for(var z=0;z<3;z++){var F=M+z,N=E+z,U=r[F],Z=r[F+3],V=r[N],j=r[N+3];r[t+z]=Uj?Z:j}return B}}},{key:"traverse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots[t],i=new Uint32Array(n),r=new Uint16Array(n);function a(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=2*t,l=65535===r[s+15];if(l){var u=i[t+6],c=r[s+14];e(o,l,new Float32Array(n,4*t,6),u,c)}else{var h=t+8,d=i[t+6],f=i[t+7];e(o,l,new Float32Array(n,4*t,6),f)||(a(h,o+1),a(d,o+1))}}a(0)}},{key:"raycast",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots,i=this.geometry,r=[],a=t.isMaterial,o=Array.isArray(t),s=i.groups,l=a?t.side:t,u=0,c=n.length;u1&&void 0!==arguments[1]?arguments[1]:0,n=this._roots,i=this.geometry,r=t.isMaterial,a=Array.isArray(t),o=null,s=i.groups,l=r?t.side:t,u=0,c=n.length;u2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1/0;e.boundingBox||e.computeBoundingBox(),cM.set(e.boundingBox.min,e.boundingBox.max,t),cM.needsUpdate=!0;var o=this.geometry,s=o.attributes.position,l=o.index,u=e.attributes.position,c=e.index,h=yM.getPrimitive(),d=yM.getPrimitive(),f=fM,v=vM,p=null,m=null;i&&(p=pM,m=mM);var g=1/0,y=null,x=null;return uM.copy(t).invert(),hM.matrix.copy(uM),this.shapecast({boundsTraverseOrder:function(e){return cM.distanceToBox(e)},intersectsBounds:function(e,t,n){return n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0,r=n*n,a=i*i,o=1/0,s=null;if(this.shapecast({boundsTraverseOrder:function(t){return dM.copy(e).clamp(t.min,t.max),dM.distanceToSquared(e)},intersectsBounds:function(e,t,n){return ne){r=a;break}e1&&(i=1-i,r=1-r),PM.a.fromBufferAttribute(this.positionAttribute,3*e),PM.b.fromBufferAttribute(this.positionAttribute,3*e+1),PM.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(PM.a,i).addScaledVector(PM.b,r).addScaledVector(PM.c,1-(i+r)),PM.getNormal(n),this}}]),e}(),OM=U(j()),IM=new Nn,RM=new Nn,LM=new Nn;!function(e){e.is=function(e){return e&&e.__isSPEObject}}(TM||(TM={}));var BM,zM=function(e){return function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.apply(this,arguments)).previousModelViewMatrix=new Nn,e.copyPreviousMatrix=!0,e.hiddenMatrix=new Nn,e.pivotMatrix=new Nn,e.matrixWorldRigid=new Nn,e.shearScale=new Nn,e.shearScaleInv=new Nn,e}return(0,w.Z)(n,[{key:"isDescendantOf",value:function(e){e instanceof ci&&(e=e.uuid);for(var t=this;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}},{key:"updateMatrixWorld",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,e=!0);var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){t.value.updateMatrixWorld(e)}}catch(i){n.e(i)}finally{n.f()}}},{key:"updateWorldMatrix",value:function(e,t){var n=this.parent;if(e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),t){var i,r=D(this.children);try{for(r.s();!(i=r.n()).done;){i.value.updateWorldMatrix(!1,!0)}}catch(a){r.e(a)}finally{r.f()}}}},{key:"traverseChildren",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=D(this.children);try{for(i.s();!(t=i.n()).done;){var r=t.value;TM.is(r)&&r.traverseObject(e,n+1)}}catch(a){i.e(a)}finally{i.f()}}},{key:"traverseObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!0!==e(this,t)){var n,i=D(this.children);try{for(i.s();!(n=i.n()).done;){var r=n.value;TM.is(r)&&r.traverseObject(e,t+1)}}catch(a){i.e(a)}finally{i.f()}}}},{key:"updateMatrixWorldSVD",value:function(){var e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],n=(0,OM.SVD)(t),i=n.u,r=n.v,a=n.q,o=IM.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=RM.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),l=LM.copy(s).transpose();this.shearScale.makeScale(a[0],a[1],a[2]).multiply(l).premultiply(s),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(o,l).copyPosition(this.matrixWorld),a.every((function(e){return Math.abs(a[0]-e)<.01}))?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}},{key:"attach",value:function(e,t){this.updateWorldMatrix(!0,!1);var n=(new Nn).copy(this.matrixWorld).invert();return null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),n.multiply(e.parent.matrixWorld)),"hiddenMatrix"in e&&e.hiddenMatrix instanceof Nn?e.hiddenMatrix.premultiply(n):e.applyMatrix4(n),e.updateWorldMatrix(!1,!1),this.add(e),void 0!==t&&(this.children.pop(),this.children.splice(t,0,e)),this}},{key:"copy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.hasNonUniformScale=e.hasNonUniformScale,this}},{key:"onAfterRender",value:function(e,t,n,i,r,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},{key:"__isSPEObject",get:function(){return!0}}]),n}(e)},FM=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(zM(ci)),NM=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).object=e,i.matrixAutoUpdate=!1,i.hasNonUniformScale=e.hasNonUniformScale,i}return(0,w.Z)(n,[{key:"raycast",value:function(e,t){}},{key:"expand",value:function(){for(var e=0,t=this.object.entityChildren(e);t;){var i,r=this.children[e];(null===(i=r)||void 0===i?void 0:i.object)!==t&&(r&&this.remove(r),r=new n(t),this.add(r),this.children.splice(e,0,this.children.pop()),r.matrixWorldNeedsUpdate=!0,r.matrixAutoUpdate=!1,r.matrix=t.matrix,r.hiddenMatrix=t.hiddenMatrix,r.pivotMatrix=t.pivotMatrix),r.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}},{key:"visible",get:function(){var e;return void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&!0===(null===(e=this.object.dataPatched.cloner)||void 0===e?void 0:e.hideBase)},set:function(e){}},{key:"castShadow",get:function(){return this.object.castShadow},set:function(e){}},{key:"receiveShadow",get:function(){return this.object.receiveShadow},set:function(e){}},{key:"isMesh",get:function(){return function(e){return"Mesh"===e.type}(this.object)}},{key:"isLight",get:function(){return this.object.isLight}},{key:"layers",get:function(){return this.object.layers},set:function(e){}},{key:"isCamera",get:function(){return!1}},{key:"geometry",get:function(){if(this.object.geometry)return this.object.geometry}},{key:"material",get:function(){if(this.object.material)return this.object.material}},{key:"morphTargetInfluences",get:function(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences},set:function(e){}}]),n}(FM),UM=new un,ZM=new un,VM=new Nn,jM=[new un(-1,1,1),new un(-1,-1,1),new un(1,-1,1),new un(1,1,1),new un(-1,1,-1),new un(-1,-1,-1),new un(1,-1,-1),new un(1,1,-1)],GM=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],HM=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],WM=function(e,t,n){e.updateEntityBoxSize(UM,ZM),VM.copy(t).multiply(e.matrixWorld),0===ZM.x&&0===ZM.y&&0===ZM.z?n.push(new un(UM.x,UM.y,UM.z).applyMatrix4(VM)):jM.forEach((function(e){n.push(e.clone().multiply(ZM).add(UM).applyMatrix4(VM))}))},qM=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.apply(this,arguments)).matrix=new Nn,e.vertices=[],e.faces=[],e.edges=[],e.centerEdges=[],e}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map((function(e){return e.clone()})),this.faces=e.faces.map((function(e){return e.clone()})),this.edges=e.edges.map((function(e){return e.clone()})),this.centerEdges=e.centerEdges.map((function(e){return e.clone()})),this}},{key:"setFromObjectSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);var n=(new Nn).copy(e.matrixWorld).invert();return this.expandByObjectSize(e,n,t)}},{key:"expandByObjectSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[];return!0===n?e.traverseEntity((function(e){if(e.visible||e.cloner&&e.data.visible){if(!("geometry"in e))return void i.push(new un);WM(e,t,i)}})):WM(e,t,i),this.setFromPoints(i)}},{key:"getCenter",value:function(e){return(e=(0,d.Z)((0,m.Z)(n.prototype),"getCenter",this).call(this,e)).applyMatrix4(this.matrix),e}},{key:"getPositionToCenter",value:function(e){return(e=(0,d.Z)((0,m.Z)(n.prototype),"getCenter",this).call(this,e)).applyMatrix4(VM.copy(this.matrix).setPosition(0,0,0)),e}},{key:"computeVertices",value:function(){this.getSize(ZM).multiplyScalar(.5),this.getCenter(UM),VM.copy(this.matrix).setPosition(UM),this.vertices=jM.map((function(e){return e.clone().multiply(ZM).applyMatrix4(VM)}))}},{key:"computeEdges",value:function(){var e=this;this.vertices.length>0&&this.computeVertices(),this.edges=GM.map((function(t){var n=(0,h.Z)(t,2),i=n[0],r=n[1];return new tc(e.vertices[i],e.vertices[r])})),this.centerEdges=this.edges.map((function(e){return e.getCenter(new un)}))}},{key:"computeFaces",value:function(){var e=this;this.vertices.length>0&&this.computeVertices(),this.faces=HM.map((function(t){var n=(0,h.Z)(t,2),i=n[0],r=n[1];return e.vertices[i].clone().add(e.vertices[r]).multiplyScalar(.5)}))}}]),n}(dn),XM={Cloner:function(){},changeEntityProptotype:function(){},createEntity:function(){}},YM=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this)}return(0,w.Z)(n,[{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],i=this.getCurveLengths(),r=i[i.length-1]/i.length,a=0,o=this.curves;a1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}}]),n}(Xs),QM=.001;function KM(e,t,n){return t.clone().sub(e).cross(t.clone().sub(n)).length()<=QM}function JM(e,t){var n=(0,a.Z)(un,(0,l.Z)(e.position)),i=(0,a.Z)(un,(0,l.Z)(e.controlNext.position)),r=(0,a.Z)(un,(0,l.Z)(t.controlPrevious.position)),o=(0,a.Z)(un,(0,l.Z)(t.position));return KM(n,i,o)&&KM(n,r,o)}function $M(e){for(var t=e.points.map((function(e){return(0,a.Z)(un,(0,l.Z)(e.data.position))})),n=[e.points[0]],i=(0,a.Z)(un,(0,l.Z)(n[0].data.position)),r=0;rQM&&(U=new Zs(Z,Z.clone().lerp(V,.3),V.clone().lerp(Z,.3),V))}else F.position.distanceTo(N.position)>QM&&(U=new Zs(F.position,F.controlNext,N.controlPrevious,N.position));R[2*L+1]=U}for(var j=0;j2&&void 0!==arguments[2]&&arguments[2];if(0!==this.data.states.length||i){var r,a=D(this.data.states);try{for(a.s();!(r=a.n()).done;){var o=r.value;yw.toOps(this.data,o.data).forEach((function(e){var i=og.replaceProps(e,n.data);n.dataPatched=n.data,n.updateByPatchedOp(i,n.data,t)}))}}catch(l){a.e(l)}finally{a.f()}if(null!==e){var s=this.data.states.data(e);s&&(this.dataPatched=yw.patch(this.data,s),yw.toOps(this.data,s).forEach((function(e){n.updateByPatchedOp(e,n.dataPatched,t)})))}i&&this.updateTransformState(this.dataPatched,t),this.stateSelection=e,this.updatePathSnapping(this.dataPatched.pathSnapping)}}},{key:"updateEntityBoxSize",value:function(e,t){e.setScalar(0),t.setScalar(0)}},{key:"resetBBoxNeedsUpdateSelf",value:function(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}},{key:"resetBBoxNeedsUpdate",value:function(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors((function(e){eE(e)&&e.resetBBoxNeedsUpdateSelf()})),this.traverseEntity((function(e){e.resetBBoxNeedsUpdateSelf()}))}},{key:"find",value:function(e){var t;return this.traverseEntity((function(n){n.uuid===e&&(t=n)})),t}},{key:"traverseSortNextHelper",value:function(){var e=this.parent;if(e){var t=e.children,n=t.indexOf(this)+1;if(BM.is(t[n]))return t[n];if(BM.is(e))return e.traverseSortNextHelper()}}},{key:"sortNext",value:function(){var e=this.children;return this.children.length>0&&BM.is(this.children[0])?e[0]:this.traverseSortNextHelper()}},{key:"goUp",value:function(e){for(var t=this;e>0&&null!==t;)t=t.parent,e-=1;return t}},{key:"hasAnccestorOrSelf",value:function(e){return this===e||this.hasAnccestor(e)}},{key:"hasAnccestor",value:function(e){for(var t=this.parent;t;){if(e===t)return!0;t=t.parent}return!1}},{key:"countToAccestor",value:function(e){for(var t=0,n=this;n!==e;){if(null===n)return-1;n=n.parent,t+=1}return t}},{key:"forEachEntity",value:function(e){var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;eE(i)&&e(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"traverseEntityAncestors",value:function(e){this.traverseAncestors((function(t){BM.is(t)&&e(t)}))}},{key:"traverseConcreteEntity",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!0!==e(this,t)){var n,i=D(this.children);try{for(i.s();!(n=i.n()).done;){var r=n.value;eE(r)&&r.isConcreteEntity&&r.traverseEntity(e,t+1)}}catch(a){i.e(a)}finally{i.f()}}}},{key:"traverseEntity",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!0!==e(this,t)){var n,i=D(this.children);try{for(i.s();!(n=i.n()).done;){var r=n.value;eE(r)&&r.traverseEntity(e,t+1)}}catch(a){i.e(a)}finally{i.f()}}}},{key:"traverseVisibleEntity",value:function(e){e(this);var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;eE(i)&&i.visible&&i.traverseVisibleEntity(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"updateMatrix",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"updateMatrix",this).call(this),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}},{key:"updateMatrixWorld",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"updateMatrixWorld",this).call(this,e),this.dispatchEvent({type:"updateMatrixWorld"})}},{key:"copy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.dataPatched=e.dataPatched,this.raycastLock=e.raycastLock,this.scaleLock=e.scaleLock,this.hiddenMatrix.copy(e.hiddenMatrix),this}},{key:"hasEntityChild",value:function(){return this.children.some((function(e){return eE(e)}))}},{key:"isAncestorOf",value:function(e){if(this.uuid===e)return!1;var t=!1;return this.traverseEntity((function(n){n.uuid===e&&(t=!0)})),t}},{key:"toObjectTransformState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.updateWorldMatrix(!0,!1);var t={position:this.position.toArray(),rotation:[this.rotation.x*Pt.RAD2DEG,this.rotation.y*Pt.RAD2DEG,this.rotation.z*Pt.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return hm(t,e)}},{key:"getTransformValues",value:function(e,t,n){var i=this;return t[e].map((function(t,r){var a;return null!==(a=null===n||void 0===n?void 0:n.shared.getVariable(t,[i.uuid,e,nE[r]]))&&void 0!==a?a:t}))}},{key:"updateTransformState",value:function(e,t){var n,i=this,r=!1;if(e.position&&(this.position.fromArray(this.getTransformValues("position",e,t)),r=!0),e.rotation&&(iE.fromArray(this.getTransformValues("rotation",e,t)).multiplyScalar(Pt.DEG2RAD),this.rotation.setFromVector3(iE),r=!0),e.scale&&(this.scale.fromArray(this.getTransformValues("scale",e,t)),r=!0),void 0!==e.hiddenMatrix&&(r=!0,this.hiddenMatrix.fromArray(null!==(n=e.hiddenMatrix)&&void 0!==n?n:Bx.identity)),void 0!==e.pivot||void 0!==e.pivotRotation)if(r=!0,void 0!==e.pivot&&void 0!==e.pivotRotation)this.pivotMatrix.compose(iE.fromArray(e.pivot).negate(),aE.setFromEuler(oE.fromArray(e.pivotRotation.map((function(e){return e*Pt.DEG2RAD})))).invert(),rE);else if(void 0!==e.pivot)this.pivotMatrix.setPosition(-e.pivot[0],-e.pivot[1],-e.pivot[2]);else if(void 0!==e.pivotRotation){var a=iE.setFromMatrixPosition(this.pivotMatrix);aE.setFromEuler(oE.fromArray(e.pivotRotation.map((function(e){return e*Pt.DEG2RAD})))).invert(),this.pivotMatrix.compose(a,aE,rE)}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors((function(e){e.invalidateClonerTransform(i)}))),e.position&&e.rotation&&e.scale&&void 0!==e.hiddenMatrix&&this.updateWorldMatrix(!1,!0),r}},{key:"onVariableUpdate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors((function(t){t.invalidateClonerTransform(e)})),this.requestRender())}},{key:"dispose",value:function(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}},{key:"disposeChildrenRecursively",value:function(){var e,t=D(this.children);try{for(t.s();!(e=t.n()).done;){var n=e.value;BM.is(n)&&n.disposeRecursively()}}catch(i){t.e(i)}finally{t.f()}}},{key:"disposeRecursively",value:function(){this.dispose(),this.children.forEach((function(e){BM.is(e)&&e.disposeRecursively()}))}},{key:"toState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=k({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(e));return hm(t,e)}},{key:"updateByObjUpdateOp",value:function(e,t){void 0!==e&&this.updateByOp({type:0,props:e,path:[]},k(k({},this.data),e),t,!1)}},{key:"updateByOp",value:function(e,t,n,i){var r=this.data;this.data=t;var a=e,s=Lg(e.path,["states","*"]);if(null!==s){if(0===e.type){var u=(0,h.Z)(s,1)[0];if((null===this||void 0===this?void 0:this.stateSelection)===u){var c=k({},e.props);if(delete c.name,Object.values(e.props).some((function(e){return void 0===e}))){var d=this.data;if(void 0!==d){var f=Tg.zoom(d,e.path.slice(2));if(f)for(var v in e.props)void 0===e.props[v]&&v in f&&(c[v]=f[v])}}a=k(k({},e),{},{props:c,path:e.path.slice(2)})}}}else if(0===e.type){var p=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==p){if(void 0!==e.props.name&&p.name){var m=p;m.name;p=(0,o.Z)(m,["name"])}if(void 0!==e.props.material&&"material"in p){var g=p;g.material;p=(0,o.Z)(g,["material"])}var y=Tg.removeOverridden(e.path,e.props,p);a=k(k({},e),{},{props:y})}}if(this.updateByPatchedOpBase(a,yw.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n),Lg(e.path,["overrides"])){var x=[],b=(0,l.Z)(e.path);for(x.push(b[1]),b.splice(0,2);b.length>0&&"descendants"===b[0];)x.push(b[1]),b.splice(0,2);if(void 0===x[x.length-1]){if(0===e.type)for(var w=0,S=Object.keys(e.props);w0){var R;if(0===e.path.length&&0===e.type){var L,B,z=D(pw.rootOverrideProps);try{for(z.s();!(B=z.n()).done;){var F=B.value;F in e.props&&(void 0===L&&(L={}),L[F]=e.props[F])}}catch(V){z.e(V)}finally{z.f()}L&&(R=k(k({},e),{},{props:L}))}else{var N,U=D(pw.rootOverrideProps);try{for(U.s();!(N=U.n()).done;){var Z=N.value;if(Lg(e.path,[Z])){R=e;break}}}catch(V){U.e(V)}finally{U.f()}}void 0!==R&&this.instances.forEach((function(e){if(e.isInstanceRoot){var t=rg.filterOp(e.overrideData,R);t&&e.updateByOp(t,sg.applySimple(e.data,t),n,!0)}})),this.instances.forEach((function(i){if(!i.isInstanceRoot){var a,o=rg.filterOp(i.overrideData,e);if(o)a=r===i.data&&e===o?t:sg.applySimple(i.data,o),i.updateByOp(o,a,n,!0)}}))}}},{key:"updateByPatchedOpBase",value:function(e,t,n){if(this.dataPatched=t,0===e.path.length&&0===e.type)void 0!==e.props.type&&!Jx.is(e.props.type)&&XM.changeEntityProptotype(this,t,n);else if(1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&"type"in e.props){XM.changeEntityProptotype(this,t,n);var i,r=D(this.children);try{for(r.s();!(i=r.n()).done;){var a=i.value;BM.is(a)&&a.updateVisible(n.scene)}}catch(o){r.e(o)}finally{r.f()}}this.updateByPatchedOp(e,t,n)}},{key:"updateByPatchedOp",value:function(e,t,n){if(0===e.path.length&&0===e.type?this.updateState(e.props,n):0===e.type&&("resolutionLevel"in e.props||"useChildrenColors"in e.props)&&this.updateState(t,n),"morphTargetInfluences"===e.path[0]&&0===e.type){var i,r=null===(i=t.morphTargetInfluences.get(e.path[1]))||void 0===i?void 0:i.data.name;r&&this.updateMorphInfluences(r,n.shared.getVariable(e.props.value,[this.uuid,"morphTargetInfluences",r]))}if(null!==Lg(e.path,["pathSnapping"])&&this.updatePathSnapping(t.pathSnapping),null!==Lg(e.path,["cloner"])){var a=sg.drop(e,1);0===a.path.length&&0===a.type&&!0===a.props.disabled?this.setFromClonerState(null,n):this.cloner?this.cloner.updateState(t.cloner,n):(this.setFromClonerState(t.cloner,n),this.expandCloner(n)),this.updateVisible(n.scene)}}},{key:"updatePathSnapping",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dataPatched.pathSnapping;this._updatedPathSnapping=e,this._needApplyPathSnapping=!0}},{key:"applyPathSnapping",value:function(e){var t,n,i,r,a,o,s,l,u,c,h,d=null!==(t=null===(n=this._updatedPathSnapping)||void 0===n?void 0:n.pathId)&&void 0!==t?t:this.dataPatched.pathSnapping.pathId,f=null!==(i=null!==(r=null===(a=this._updatedPathSnapping)||void 0===a?void 0:a.slide)&&void 0!==r?r:this.dataPatched.pathSnapping.slide)&&void 0!==i?i:0,v=null!==(o=null!==(s=null===(l=this._updatedPathSnapping)||void 0===l?void 0:l.offset)&&void 0!==s?s:this.dataPatched.pathSnapping.offset)&&void 0!==o?o:0,p=null!==(u=null===(c=this._updatedPathSnapping)||void 0===c?void 0:c.orientation)&&void 0!==u?u:this.dataPatched.pathSnapping.orientation;if(null!==d){var m=e.find(d);if(m&&!1!==this._needApplyPathSnapping){this._needApplyPathSnapping=!1;var g=m.data;if(!(g.geometry.path.points.length<=1)){var y=$M(g.geometry.path),x=(f+v)%1;f+v===1&&0===x&&(x=1);var b=null;try{b=y.curves.length?y.getPointAt(x):null}catch(A){}if(null!==b){var w=this.parent?null===(h=this.parent)||void 0===h?void 0:h.matrixWorld:new Nn;m.updateMatrixWorld();var S=(new Nn).multiplyMatrices(w.clone().invert(),m.matrixWorld);b.applyMatrix4(S);var _={position:b.toArray(),rotation:g.rotation};if("tangential"===p){var A=(new Nn).extractRotation(m.matrixWorld),M=y.getTangentAt(x).applyMatrix4(A).add(b),E=(new Nn).lookAt(b,M,sE),C=iE.setFromEuler((new Yn).setFromRotationMatrix(E)).multiplyScalar(Pt.RAD2DEG);_=k(k({},_),{},{rotation:C.toArray()})}this.updateTransformState(_),this.traverseEntity((function(e){e._cameraType&&e.dispatchEvent(tE)}))}}}}}},{key:"updateVisible",value:function(e){var t,n;if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||null!==(t=this.dataPatched.cloner.disabled)&&void 0!==t&&t||!0!==(null===(n=this.dataPatched.cloner)||void 0===n?void 0:n.hideBase)),e){var i=!1;this.traverseEntity((function(e){if("Splat"===e.data.type)return i=!0,!0})),i&&e.reloadSplats()}}},{key:"updateState_Entity",value:function(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.raycastLock&&(this.raycastLock=e.raycastLock),void 0!==e.visible&&(this.updateVisible(null===t||void 0===t?void 0:t.scene),this.resetBBoxNeedsUpdate()),t&&"cloner"in e&&void 0!==e.cloner&&(this.setFromClonerState(e.cloner,t),this.updateVisible(t.scene)),this.updateTransformState(e,t)}},{key:"setFromClonerState",value:function(e,t){this.disposed||(null===e||e.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):void 0===this.cloner?(this.cloner=new XM.Cloner(this,e),t.scene.addPendingExpandCloner(this)):this.cloner.updateState(e,t))}},{key:"expandCloner",value:function(e){!this.disposed&&this.cloner&&this.cloner.expandClones(e)}},{key:"invalidateClonerTransform",value:function(e){this.cloner&&this.cloner.invalidateTransform(e)}},{key:"requestRender",value:function(){this.dispatchEvent({type:"requestRender"})}},{key:"__isEntity",get:function(){return!0}},{key:"isConcreteEntity",get:function(){return"string"==typeof this.identity}},{key:"isVirtualEntity",get:function(){return"string"!=typeof this.identity}},{key:"isInstanceRoot",get:function(){return this.isConcreteEntity&&"Instance"===this.data.type}},{key:"singleBBox",get:function(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}},{key:"recursiveBBox",get:function(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}},{key:"updatedPathSnapping",get:function(){return this._updatedPathSnapping}},{key:"attachedSurfaceCloners",get:function(){return this.children.filter((function(e){return e instanceof XM.Cloner&&"toObject"===e.parameters.type}))}}]),n}(zM(e))},uE=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a,o,s,l,u=null===(n=e.parameters)||void 0===n?void 0:n.radiusTop,c=null===(i=e.parameters)||void 0===i?void 0:i.radiusBottom,h=Object.assign({},null!==(r=null===t||void 0===t?void 0:t.parameters)&&void 0!==r?r:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);h.thetaLength=Pt.clamp(h.thetaLength,0,360);var d=h.width/2,f=null!==(a=h.radiusTop)&&void 0!==a?a:d,v=null!==(o=h.radiusBottom)&&void 0!==o?o:d;if(f===v?(f=d,v=d):f>v?v=v*d/(f=d):(f=f*d/v,v=d),h.shapeBlendNode){f=null!==u&&void 0!==u?u:d,v=null!==c&&void 0!==c?c:d;var p=2*Math.max(f,v);h.width=p,h.depth=p}return{parameters:Object.assign(h,{width:Math.abs(h.width),height:Math.abs(null!==(s=h.height)&&void 0!==s?s:h.width),depth:Math.abs(null!==(l=h.depth)&&void 0!==l?l:h.width),radiusTop:f,radiusBottom:v})}}},{key:"build",value:function(e){var t,n=e.parameters,i=n.width,r=n.depth,a=n.height,o=n.radialSegments,s=n.heightSegments,l=n.openEnded,u=n.thetaStart,c=n.thetaLength,h=n.radiusTop,d=n.radiusBottom,f=n.cornerRadius,v=n.cornerSegments,p=n.hollow;return 0===c?(t=new Fi).setAttribute("position",new Pi([],3)):t=f||p?new dE(h,d,a,o,s,l,u,c*Math.PI/180,f,f,v,p):new Ks(h,d,a,o,s,l,u,c*Math.PI/180),t.scale(1,1,r/i),Object.assign(t,{userData:k(k({},e),{},{type:"CylinderGeometry"})})}}]),e}();function cE(e,t,n){n.x=e.x*t.x,n.y=e.y,n.z=e.x*t.y}function hE(e){return new Dt(e.y,-e.x)}var dE=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,u,c,h,d,f,v){var p,m=arguments.length>12&&void 0!==arguments[12]&&arguments[12];(0,b.Z)(this,n),(p=t.call(this)).type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,i=void 0!==i?i:1,r=r||1,a=Math.floor(a)||8,o=Math.floor(o)||1,s=void 0!==s&&s,u=void 0!==u?u:0,c=void 0!==c?c:2*Math.PI,s&&(h=0,d=0);var g=[],y=[],x=[],w=[],S=0,_=r/2,A=new un,M=new un;m&&0==e&&(e=h),m&&0==i&&(i=d);var E=new Dt(e,_),C=new Dt(i,-_),k=null,T=null,P=null,O=null,I=E.clone().sub(C),R=0,L=0,B=0;v>0&&(R=Math.min(e,i)*(1-v),L=e-R,B=i-R);var z=E.clone();z.x-=R;var F=Math.PI-I.angle(),N=I.angle(),U=Math.tan(N/2),Z=Math.tan(F/2),V=U+Z,j=v?V:Z,G=v?V:U;if(h=Math.min(h,(e-L)/j,I.length()/V),d=Math.min(d,(i-B)/G,I.length()/V),h>0){var H=h/U;k=E.clone().sub(new Dt(H,h)),v&&((P=k.clone()).x-=R-V*h),E.sub(I.clone().setLength(H))}if(d>0){var W=d/Z;T=C.clone().sub(new Dt(W,-d)),C.add(I.clone().setLength(W)),v&&((O=T.clone()).x-=R-V*d,z.sub(I.clone().setLength(W)))}for(var q=(I=E.clone().sub(C)).length()<.5,X=[],Y=0;Y<=a;Y++){var Q=[],K=Y/a,J=K*c+u,$=new Dt(Math.sin(J),Math.cos(J));O&&T?(me(Q,K,$,F,d,O,-1,!0),me(Q,K,$,N,d,T,-1,!1)):T?(ge(Q,$,T.x,0,-1),me(Q,K,$,N,d,T,-1,!1)):s||ge(Q,$,i,B,-1);var ee=hE(I).normalize();if(cE(ee,$,A),!q)for(var te=0;te<=o;te++){var ne=te/o,ie=I.clone().multiplyScalar(ne).add(C);cE(ie,$,M),y.push(M.x,M.y,M.z),x.push(A.x,A.y,A.z),w.push(K,.5+M.y/r),Q.push(S++)}if(P&&k?(me(Q,K,$,F,h,k,1,!1),me(Q,K,$,N,h,P,1,!0)):k?(me(Q,K,$,F,h,k,1,!1),ge(Q,$,k.x,0,1)):s||ge(Q,$,e,L,1),v&&!q){var re=hE(I).multiplyScalar(-1).normalize();cE(re,$,A);for(var ae=0;ae<=o;ae++){var oe=ae/o,se=I.clone().multiplyScalar(-oe).add(z);cE(se,$,M),y.push(M.x,M.y,M.z),x.push(A.x,A.y,A.z),w.push(K,.5+M.y/r),Q.push(S++)}}v&&!s&&Q.push(Q[0]),X.push(Q)}for(var le=0;le0||d>0||c<360?new dE(0,i/2,a,o,s,l,u,c*Math.PI/180,h,d,f,0,!0):new Js(i/2,a,o,s,l),t.scale(1,1,r/i),Object.assign(t,{userData:k(k({},e),{},{type:"ConeGeometry"})})}}]),e}(),vE=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(i=a.height)&&void 0!==i?i:a.width),depth:Math.abs(null!==(r=a.depth)&&void 0!==r?r:a.width)})}}},{key:"build",value:function(e){var t,n=e.parameters,i=n.width,r=n.height,a=n.depth,o=n.widthSegments,s=n.heightSegments,l=n.depthSegments,u=n.cornerRadius,c=n.cornerSegments;return t=0===u?new er(i,r,a,o,s,l):new mE(i,r,a,o,s,l,u,c),Object.assign(t,{userData:k(k({},e),{},{type:"CubeGeometry"})})}}]),e}(),pE=Math.PI/2,mE=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:4;(0,b.Z)(this,n),(e=t.call(this)).type="BoxGeometry",o=Math.floor(o),s=Math.floor(s),l=Math.floor(l),c=Math.floor(c),u=Math.min(u,i/2,r/2,a/2);var h=[],d=[],f=[],v=[],p=0;function m(e,t,n,i,r,a,o,s,l,c){for(var m=(a-2*u)/l,g=(o-2*u)/c,y=a/2-u,x=o/2-u,b=s/2,w=l+1,S=c+1,_=0,A=new un,M=0;M0?1:-1,f.push(A.x,A.y,A.z),v.push(C/l),v.push(1-M/c),_+=1}for(var T=0;T0?function(e,t,n){return h.push(e,t,n)}:function(e,t,n){return h.push(e,n,t)},g=0;g<=c;g++){for(var y=[],x=pE*(1-g/c),b=Math.cos(x),w=Math.sin(x),S=0,_=0;_<=g;_++){var A=Math.cos(S),M=Math.sin(S);o.x=b*A,o.y=w,o.z=b*M;var E=s.clone().addScaledVector(o,u);d.push(e*E.x,t*E.y,n*E.z),f.push(e*o.x,t*o.y,n*o.z),v.push(0,0),y.push(p++),S+=pE/g}l.push(y)}for(var C=l.length-1,k=0;k0&&(g("z","y","x",-1,-1,1,a,r,i,l),g("z","y","x",1,-1,-1,a,r,i,l),g("z","y","x",-1,1,-1,a,r,i,l),g("z","y","x",1,1,1,a,r,i,l),g("x","y","z",-1,-1,-1,i,r,a,o),g("x","y","z",1,-1,1,i,r,a,o),g("x","y","z",-1,1,1,i,r,a,o),g("x","y","z",1,1,-1,i,r,a,o),g("y","x","z",-1,-1,1,r,i,a,s),g("y","x","z",1,-1,-1,r,i,a,s),g("y","x","z",1,1,1,r,i,a,s),g("y","x","z",-1,1,-1,r,i,a,s),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),e.setIndex(h),e.setAttribute("position",new Pi(d,3)),e.setAttribute("normal",new Pi(f,3)),e.setAttribute("uv",new Pi(v,2)),e}return n}(Fi),gE=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:4;(0,b.Z)(this,n),(e=t.call(this)).type="PolyhedronGeometryRound";var c=[],d=[],f=[];return v(),m(),e.setAttribute("position",new Pi(c,3)),e.setAttribute("normal",new Pi(f,3)),e.setAttribute("uv",new Pi(d,2)),(0,p.Z)(e);function v(){0==(s=Math.min(.99999,s))&&(u=0);for(var e={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[a],t=new un,n=t.clone(),d=new wi,v=s*o,p=o-v,m=u+1,g=new un,y=function(e,t){return g.subVectors(e,t).normalize()},x=function(e,t){return Array(e).fill(void 0).map(t)},b=x(i.length/3,(function(e,t){return(new un).fromArray(i,3*t).setLength(o)})),w=[],S=1e6,_=function(e){for(var t=b[e],n=[],i=void 0,a=void 0,o=void 0,s=1e10,l=-1;-1!=(l=r.indexOf(e,l+1));){var u=l-l%3;i=r[u+(l+1)%3],a=r[u+(l+2)%3],o=t.distanceToSquared(b[i]),s=Math.min(s,o),n.push([i,a,o])}s+=1e-6;for(var c=[],d=0,f=n.length,v=0;v.9&&S<.1&&(y<.2&&(d[g+0]+=1),x<.2&&(d[g+2]+=1),b<.2&&(d[g+4]+=1))}function _(e){return Math.atan2(e.z,-e.x)}function A(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}}]),n}(Fi),yE=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(i=a.height)&&void 0!==i?i:a.width),depth:Math.abs(null!==(r=a.depth)&&void 0!==r?r:a.width)})}}},{key:"build",value:function(e){var t=e.parameters,n=t.width,i=t.height,r=t.depth,a=t.detail,o=t.corner,s=t.cornerSides,l=0===a&&0!==o?new xE(.5*n,o,s):new el(.5*n,a);return l.scale(1,i/n,r/n),Object.assign(l,{userData:k(k({},e),{},{type:"DodecahedronGeometry"})})}}]),e}(),xE=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;(0,b.Z)(this,n);var o=(1+Math.sqrt(5))/2,s=1/o,l=[-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,-s,-o,0,-s,o,0,s,-o,0,s,o,-s,-o,0,-s,o,0,s,-o,0,s,o,0,-o,0,-s,o,0,-s,-o,0,s,o,0,s],u=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],c="DodecahedronGeometry";return(e=t.call(this,l,u,c,i,r,a)).type=c,e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.corner,e.cornerSides)}}]),n}(gE),bE=1e-12,wE=function(){function e(t){(0,b.Z)(this,e),this.position=new Dt,this.startPosition=new Dt,this.uuid=Pt.generateUUID(),this.position=t.clone()}return(0,w.Z)(e,[{key:"start",value:function(){this.reset()}},{key:"reset",value:function(){this.startPosition.copy(this.position)}},{key:"applyOffset",value:function(e){this.position.copy(this.startPosition).add(e)}},{key:"copy",value:function(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}},{key:"clone",value:function(){return new e(this.position).copy(this)}},{key:"toJSON",value:function(){return[this.position.x,this.position.y]}}]),e}(),SE=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,e.position)).parent=e,i}return(0,w.Z)(n,[{key:"copy",value:function(e){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e),this}},{key:"clone",value:function(){return new n(this.parent).copy(this)}}]),n}(wE),_E=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,i)).controls=[],r.roundness=0,r.areControlsDirectionsMirrored=!0,r.uuid=e,r.controls.push(new SE((0,f.Z)(r)),new SE((0,f.Z)(r))),r}return(0,w.Z)(n,[{key:"getOppositeControl",value:function(e){var t=this.controls.indexOf(e);return 0===t?this.controls[1]:1===t?this.controls[0]:null}},{key:"applyOffsetToControls",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=0,i=this.controls.length;n0&&void 0!==arguments[0]?arguments[0]:new Dt,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,n=this.computeTangents(),i=(0,h.Z)(n,2),r=i[0],a=i[1];return r&&a&&(AE(r,e),AE(a,t)),[e,t]}},{key:"computeTangent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt,t=this.computeTangents(),n=(0,h.Z)(t,2),i=n[0],r=n[1];return i&&r&&e.copy(i).add(r).normalize(),e}},{key:"computeNormal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt,t=this.computeNormals(),n=(0,h.Z)(t,2),i=n[0],r=n[1];return e.copy(i).add(r).normalize(),e}}],[{key:"create",value:function(e,t){var i,r,o=new n(e,(0,a.Z)(Dt,(0,l.Z)(t.position)));return(i=o.controls[0].position).set.apply(i,(0,l.Z)(t.controlPrevious.position)),(r=o.controls[1].position).set.apply(r,(0,l.Z)(t.controlNext.position)),o.roundness=t.roundness,o.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,o}}]),n}(wE);function AE(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt,n=e.length();return t.set(-e.y/n,e.x/n)}var ME=new Dt,EE=new Dt,CE=new Dt,kE=new Dt,TE=new Dt,PE=new Dt,DE=new un,OE=new un;function IE(e){var t=new Dt;t.addVectors(e.v0,ME.subVectors(e.v1,e.v0).multiplyScalar(2/3));var n=new Dt;return n.addVectors(e.v2,EE.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new Us(e.v0,t,n,e.v2)}function RE(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.EPSILON;return Math.abs(e-t)2&&void 0!==arguments[2]?arguments[2]:Number.EPSILON;return e.distanceTo(t)2&&void 0!==arguments[2]?arguments[2]:Number.EPSILON;return e.distanceTo(t)Math.PI&&(h*=-1),o=RE(c,l)?(l+c)*(i/h-.5)*8/3/(s-u):(s+u)*(i/h-.5)*8/3/(c-l),r.set(t.x-o*l,t.y+o*s),a.set(n.x+o*c,n.y-o*u),[r,a]}function jE(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function GE(e,t){return NE(e.position,e.controls[1].position,t.position)&&NE(e.position,t.controls[0].position,t.position)}function HE(e,t){for(var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=OE.set(0,0,0),o=0,s=[],l=0;l1&&!(e.getX(o-1)===e.getX(0)&&e.getY(o-1)===e.getY(0)&&e.getZ(o-1)===e.getZ(0))&&(e.setXYZ(o,e.getX(0),e.getY(0),e.getZ(0)),o++),e}function WE(e,t,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=OE.set(0,0,0),o=0,s=[],l=0;l1&&!(e.getX(o-1)===e.getX(0)&&e.getY(o-1)===e.getY(0)&&e.getZ(o-1)===e.getZ(0))&&(e.setXYZ(o,e.getX(0),e.getY(0),e.getZ(0)),o++),s}function qE(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],r=0,a=e.length;r0&&(i[r-1]+=l),s+=l}void 0!==o.curveAfter&&(s+=XE(o.curveAfter,t)),i.push(s)}return e.length>0&&n&&void 0!==e[0].roundedCurveCorner&&(i[e.length-1]+=.5*XE(e[0].roundedCurveCorner,t)),i}function XE(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;return e&&e instanceof Ts?2*t:e&&(e instanceof Vs||e instanceof js)?1:e&&e instanceof Ws?t*e.points.length:t}function YE(e,t){for(var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=0,o=0;o1&&!(RE(e[a-1],e[1],bE)&&RE(e[a-2],e[0],bE))&&(e.push(e[0],e[1]),a++),e}var QE,KE,JE=new Dt,$E=new Dt,eC=new Dt,tC=new Dt,nC=new Dt,iC=new Dt,rC=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return(0,b.Z)(this,n),(e=t.call(this)).points=[],e.shapeHoles=[],e.plane=new pr(new un(0,0,-1)),e.subdivision=0,e.controlSnapDistance=4,e.pointIDs=0,e.isMesh2D=!1,e.isText=!1,e._roundness=0,e.isClosed=!1,e.useCubicForRoundedCorners=!0,e.uuid=Pt.generateUUID(),e.needsUpdate=!1,e.roundedCurves=[],e._width=i,e._height=r,e}return(0,w.Z)(n,[{key:"getPointsIndexesByIds",value:function(e){var t=this;return e.map((function(e){return t.getPointIndexById(e)})).filter((function(e){return e>=0}))}},{key:"getPointIndexById",value:function(e){var t=this.points.length,n=this.points.findIndex((function(t){return t.uuid===e}));if(n<0)for(var i=t,r=0,a=this.shapeHoles.length;r0)for(var t=this.points.length,n=0,i=this.shapeHoles.length;n=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(var n=0,i=this.shapeHoles.length;n=0)return t+a;t+=r.points.length}return-1}},{key:"getAllPoints",value:function(){var e,t=(e=[]).concat.apply(e,(0,l.Z)(this.shapeHoles.map((function(e){return e.points}))));return[].concat((0,l.Z)(this.points),(0,l.Z)(t))}},{key:"applySize",value:function(e,t){0===e&&(e=.001),0===t&&(t=.001),this._width=e,this._height=t}},{key:"applyScale",value:function(e,t){for(var n=JE.set(e,t),i=0,r=this.points.length;i1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Pt.generateUUID();t=e instanceof Dt?e:new Dt(e,n);var r=new _E(i,t);return r.roundness=this.roundness,r}},{key:"addPoint",value:function(e){this.points.push(e),this.needsUpdate=!0}},{key:"addPointAt",value:function(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}},{key:"getPointByUuid",value:function(e){for(var t=0,n=this.points.length;t=0&&this.points.splice(t,1),this.needsUpdate=!0}},{key:"removePointById",value:function(e){var t=this.points.find((function(t){return t.uuid===e}));t&&this.removePoint(t)}},{key:"update",value:function(){for(var e=0,t=this.shapeHoles.length;e1&&void 0!==arguments[1]?arguments[1]:12,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t);var i=n?this.roundedCurveDivisions:this.curveDivisions;return HE(e,n?this.roundedCurves:this.curves,t,this.autoClose),i.reduce((function(e,t){return e+t}),0)+1}},{key:"computeCurveDivisions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12;return this.curveDivisions=qE(this.points,e,!1),this.roundedCurveDivisions=qE(this.points,e,!0),this.curveDivisions}},{key:"extractFilteredShapePointsToBuffer",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12;return 2*WE(e,this.curves,t,n,this.autoClose).reduce((function(e,t){return e+t}),0)}},{key:"extractShapePointsToFlatArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;return this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t),YE(e,this.roundedCurves,t,this.autoClose)}},{key:"getCurveIndexFromVertexId",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);var i=t?this.roundedCurveDivisions:this.curveDivisions,r=0;t&&void 0!==this.points[0].roundedCurveCorner&&(r=.5*XE(this.points[0].roundedCurveCorner,this.subdivision));var a=e-r;a<0&&(a+=i.reduce((function(e,t){return e+t}),0));for(var o=0,s=i.length;o=this.points.length-1?0:e+1],a=this.curveDivisions,o=a[e];if(jE(i,r)){var s=i.position.distanceTo(r.position);return i.position.distanceTo(JE.set(n.x,n.y))/s}for(var l=0,u=0;u2)for(var s=0,l=0,u=this.points.length;l0&&!g){var y=f.curveBefore,x=f.curveAfter;if(void 0===y||void 0===x)continue;var b=f.roundedCurveBefore,w=f.roundedCurveAfter,S=y.getLength(),_=x.getLength(),A=Math.min(m,.499*S),M=Math.min(m,.499*_),E=Math.min(A,M),C=1-E/S,k=E/_,T=y.getPointAt(C,JE),P=x.getPointAt(k,$E);this._subSplitCurve(y,b,C,T,void 0),this._subSplitCurve(x,w,k,void 0,P);var D=void 0;if(this.useCubicForRoundedCorners){var O=zE(T,f.position,P)/2,I=Math.tan(O)*T.distanceTo(f.position),R=UE(T,P,I,eC,tC),L=(0,h.Z)(R,2),B=VE(ZE(L[0],L[1],f.position),T,P,I,nC,iC),z=(0,h.Z)(B,2),F=z[0],N=z[1];D=new Us(T.clone(),F.clone(),N.clone(),P.clone())}else D=new Gs(T.clone(),f.position.clone(),P.clone());f.roundedCurveCorner=D,this.roundedCurves.splice(l+s,0,D),s++}}}}},{key:"_subSplitCurve",value:function(e,t,n,i,r){if(!(e instanceof Vs)){var a=e,o=t,s=a.getUtoTmapping(n,0),l=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5,a=ME.subVectors(t,e).multiplyScalar(r).add(e),o=EE.subVectors(n,t).multiplyScalar(r).add(t),s=CE.subVectors(i,n).multiplyScalar(r).add(n),l=a,u=kE.subVectors(o,a).multiplyScalar(r).add(a),c=TE.subVectors(s,o).multiplyScalar(r).add(o),h=s,d=PE.subVectors(c,u).multiplyScalar(r).add(u);return[e.x,e.y,l.x,l.y,u.x,u.y,d.x,d.y,c.x,c.y,h.x,h.y,i.x,i.y]}(a.v0,a.v1,a.v2,a.v3,s);return void 0!==i&&(o.v0.set(l[0],l[1]),o.v1.set(l[2],l[3]),o.v2.set(l[4],l[5]),o.v3.set(l[6],l[7])),void 0!==r&&(o.v0.set(l[6],l[7]),o.v1.set(l[8],l[9]),o.v2.set(l[10],l[11]),o.v3.set(l[12],l[13])),o}return void 0!==i&&t.v2.copy(i),void 0!==r&&t.v1.copy(r),t}},{key:"clone",value:function(){var e=new n(this._width,this._height);return e.points=this.points.map((function(e){return e.clone()})),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map((function(e){return e.clone()})),e}},{key:"toJSON",value:function(){return{points:this.points.reduce((function(e,t){return e.concat(t.toJSON())}),[]),shapeHoles:this.shapeHoles.map((function(e){return e.toJSON()})),isClosed:this.isClosed,roundness:this.roundness}}},{key:"fromJSON",value:function(e){var t;this.points=[],this.pointIDs=0;for(var i=e.points.length/7,r=0;r1&&void 0!==arguments[1]&&arguments[1];this.isText=i;var r=function(e,t){t instanceof Us&&t.v3.equals(e.position)&&e.controls[0].position.copy(t.v2)},a=function(e){var n,i,a=[];for(n=0,i=e.length;n0?e[n-1]:null,l=void 0;o instanceof Us?(l=t.createPoint(o.v0)).controls[1].position.copy(o.v1):o instanceof Vs&&(l=t.createPoint(o.v1)),void 0!==l&&(null!==s&&r(l,s),a.push(l))}var u=e[e.length-1],c=!1;return u instanceof Us?u.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(u.v2),c=!0):u instanceof Vs&&u.v2.equals(a[0].position)&&(c=!0),t.isClosed=c,a};return this.points=a(e.curves),e instanceof tl&&(this.shapeHoles=e.holes.map((function(e){var t=new n;return t.fromShape(e),t}))),this.update(),this}},{key:"updatePoint",value:function(e,t){var n=this.getPointByUuid(e);n&&(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.roundness&&(n.roundness=t.roundness),void 0!==t.areControlsDirectionsMirrored&&(n.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}},{key:"updatePreviousControl",value:function(e,t){var n,i=null===(n=this.getPointByUuid(e))||void 0===n?void 0:n.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},{key:"updateNextControl",value:function(e,t){var n,i=null===(n=this.getPointByUuid(e))||void 0===n?void 0:n.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"roundness",get:function(){return this._roundness},set:function(e){if(this._roundness!==e){this._roundness=e;for(var t=0,n=this.points.length;t1&&(a*=Math.sqrt(d),o*=Math.sqrt(d));var f=function(e,t,n,i,r,a,o,s,l,u){var c=Math.pow(r,2),h=Math.pow(a,2),d=Math.pow(o,2),f=Math.pow(s,2),v=c*h-c*f-h*d;v<0&&(v=0),v/=c*f+h*d;var p=(v=Math.sqrt(v)*(l===u?-1:1))*r/a*s,m=v*-a/r*o,g=p+(e+n)/2,y=m+(t+i)/2,x=(o-p)/r,b=(s-m)/a,w=(-o-p)/r,S=(-s-m)/a,_=lC(1,0,x,b),A=lC(x,b,w,S);return!u&&A>0&&(A-=aC),u&&A<0&&(A+=aC),{centerx:g,centery:y,ang1:_,ang2:A}}(t,n,i,r,a,o,c,h,s,l),v=f.ang1,p=f.ang2,m=f.centerx,g=f.centery,y=Math.abs(p)/(aC/4);Math.abs(1-y)<1e-7&&(y=1);var x=Math.max(Math.ceil(y),1);p/=x;for(var b=0;b0?r0?(n.t-i.t)*r+(n.t-t.t)*a:0},e.transEval=function(t,n,i){cC(e.transLeq(t,n)&&e.transLeq(n,i));var r=n.t-t.t,a=i.t-n.t;return r+a>0?r0?(n.s-i.s)*r+(n.s-t.s)*a:0},e.vertCCW=function(e,t,n){return e.s*(t.t-n.t)+t.s*(n.t-e.t)+n.s*(e.t-t.t)>=0},e.interpolate=function(e,t,n,i){return(e=e<0?0:e)<=(n=n<0?0:n)?0===n?(t+i)/2:t+e/(e+n)*(i-t):i+n/(e+n)*(t-i)},e.intersect=function(t,n,i,r,a){var o,s,l;e.vertLeq(t,n)||(l=t,t=n,n=l),e.vertLeq(i,r)||(l=i,i=r,r=l),e.vertLeq(t,i)||(l=t,t=i,i=l,l=n,n=r,r=l),e.vertLeq(i,n)?e.vertLeq(n,r)?((o=e.edgeEval(t,i,n))+(s=e.edgeEval(i,n,r))<0&&(o=-o,s=-s),a.s=e.interpolate(o,i.s,s,n.s)):((o=e.edgeSign(t,i,n))+(s=-e.edgeSign(t,r,n))<0&&(o=-o,s=-s),a.s=e.interpolate(o,i.s,s,r.s)):a.s=(i.s+n.s)/2,e.transLeq(t,n)||(l=t,t=n,n=l),e.transLeq(i,r)||(l=i,i=r,r=l),e.transLeq(t,i)||(l=t,t=i,i=l,l=n,n=r,r=l),e.transLeq(i,n)?e.transLeq(n,r)?((o=e.transEval(t,i,n))+(s=e.transEval(i,n,r))<0&&(o=-o,s=-s),a.t=e.interpolate(o,i.t,s,n.t)):((o=e.transSign(t,i,n))+(s=-e.transSign(t,r,n))<0&&(o=-o,s=-s),a.t=e.interpolate(o,i.t,s,r.t)):a.t=(i.t+n.t)/2},e}(),dC=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},fC=function(){function e(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),vC=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},pC=function(){function e(){var e=new vC,t=new dC,n=new fC(0),i=new fC(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,n.next=n,n.Sym=i,i.next=i,i.Sym=n,this.vHead=e,this.fHead=t,this.eHead=n,this.eHeadSym=i}return e.prototype.makeEdge_=function(e){var t=new fC(0),n=new fC(1);e.Sym.sidethis.size||this.leq(a[t].key,a[n].key)){r[e].handle=t,a[t].node=e;break}r[e].handle=n,a[n].node=e,e=i}},e.prototype.floatUp_=function(e){var t,n,i,r=this.nodes,a=this.handles;for(t=r[e].handle;;){if(n=r[i=e>>1].handle,0===i||this.leq(a[n].key,a[t].key)){r[e].handle=t,a[t].node=e;break}r[e].handle=n,a[n].node=e,e=i}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,n;if(2*(t=++this.size)>this.max){var i,r;for(this.max*=2,r=this.nodes.length,this.nodes.length=this.max+1,i=r;i0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[n].key=null,t[n].node=this.freeList,this.freeList=n,--this.size,this.size>0&&this.floatDown_(1)),i},e.prototype.delete=function(e){var t,n=this.nodes,i=this.handles;cC(e>=1&&e<=this.max&&null!==i[e].key),n[t=i[e].node].handle=n[this.size].handle,i[n[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(i[n[t>>1].handle].key,i[n[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),i[e].key=null,i[e].node=this.freeList,this.freeList=e},e}(),xC=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},bC=function(){this.key=null,this.next=null,this.prev=null},wC=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new bC,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do{t=t.next}while(null!==t.key&&!this.leq(this.frame,e,t.key));return t},e.prototype.insertBefore=function(e,t){do{e=e.prev}while(null!==e.key&&!this.leq(this.frame,e.key,t));var n=new bC;return n.key=t,n.next=e.next,e.next.prev=n,n.prev=e,e.next=n,n},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),SC=function(){function e(){}return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,n){var i=e.event,r=t.eUp,a=n.eUp;return r.Dst===i?a.Dst===i?hC.vertLeq(r.Org,a.Org)?hC.edgeSign(a.Dst,r.Org,a.Org)<=0:hC.edgeSign(r.Dst,a.Org,r.Org)>=0:hC.edgeSign(a.Dst,i,a.Org)<=0:a.Dst===i?hC.edgeSign(r.Dst,i,r.Org)>=0:hC.edgeEval(r.Dst,i,r.Org)>=hC.edgeEval(a.Dst,i,a.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&cC(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,n){cC(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=n,n.activeRegion=t},e.topLeftRegion=function(t,n){var i,r=n.eUp.Org;do{n=e.regionAbove(n)}while(n.eUp.Org===r);if(n.fixUpperEdge){if(null===(i=t.mesh.connect(e.regionBelow(n).eUp.Sym,n.eUp.Lnext)))return null;e.fixUpperEdge(t,n,i),n=e.regionAbove(n)}return n},e.topRightRegion=function(t){var n=t.eUp.Dst;do{t=e.regionAbove(t)}while(t.eUp.Dst===n);return t},e.addRegionBelow=function(e,t,n){var i=new xC;return i.eUp=n,i.nodeUp=e.dict.insertBefore(t.nodeUp,i),i.fixUpperEdge=!1,i.sentinel=!1,i.dirty=!1,n.activeRegion=i,i},e.isWindingInside=function(e,t){switch(e.windingRule){case QE.ODD:return 0!==(1&t);case QE.NONZERO:return 0!==t;case QE.POSITIVE:return t>0;case QE.NEGATIVE:return t<0;case QE.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(t,n){n.windingNumber=e.regionAbove(n).windingNumber+n.eUp.winding,n.inside=e.isWindingInside(t,n.windingNumber)},e.finishRegion=function(t,n){var i=n.eUp,r=i.Lface;r.inside=n.inside,r.anEdge=i,e.deleteRegion(t,n)},e.finishLeftRegions=function(t,n,i){for(var r,a=null,o=n,s=n.eUp;o!==i;){if(o.fixUpperEdge=!1,(r=(a=e.regionBelow(o)).eUp).Org!=s.Org){if(!a.fixUpperEdge){e.finishRegion(t,o);break}r=t.mesh.connect(s.Lprev,r.Sym),e.fixUpperEdge(t,a,r)}s.Onext!==r&&(t.mesh.splice(r.Oprev,r),t.mesh.splice(s,r)),e.finishRegion(t,o),s=a.eUp,o=a}return s},e.addRightEdges=function(t,n,i,r,a,o){var s,l,u,c,h=!0;u=i;do{cC(hC.vertLeq(u.Org,u.Dst)),e.addRegionBelow(t,n,u.Sym),u=u.Onext}while(u!==r);for(null===a&&(a=e.regionBelow(n).eUp.Rprev),l=n,c=a;(u=(s=e.regionBelow(l)).eUp.Sym).Org===c.Org;)u.Onext!==c&&(t.mesh.splice(u.Oprev,u),t.mesh.splice(c.Oprev,u)),s.windingNumber=l.windingNumber-u.winding,s.inside=e.isWindingInside(t,s.windingNumber),l.dirty=!0,!h&&e.checkForRightSplice(t,l)&&(e.addWinding(u,c),e.deleteRegion(t,l),t.mesh.delete(c)),h=!1,l=s,c=u;l.dirty=!0,cC(l.windingNumber-u.winding===s.windingNumber),o&&e.walkDirtyRegions(t,l)},e.spliceMergeVertices=function(e,t,n){e.mesh.splice(t,n)},e.vertexWeights=function(e,t,n){var i=hC.vertL1dist(t,e),r=hC.vertL1dist(n,e),a=.5*r/(i+r),o=.5*i/(i+r);e.coords[0]+=a*t.coords[0]+o*n.coords[0],e.coords[1]+=a*t.coords[1]+o*n.coords[1],e.coords[2]+=a*t.coords[2]+o*n.coords[2]},e.getIntersectData=function(t,n,i,r,a,o){n.coords[0]=n.coords[1]=n.coords[2]=0,n.idx=-1,e.vertexWeights(n,i,r),e.vertexWeights(n,a,o)},e.checkForRightSplice=function(t,n){var i=e.regionBelow(n),r=n.eUp,a=i.eUp;if(hC.vertLeq(r.Org,a.Org)){if(hC.edgeSign(a.Dst,r.Org,a.Org)>0)return!1;hC.vertEq(r.Org,a.Org)?r.Org!==a.Org&&(t.pq.delete(r.Org.pqHandle),e.spliceMergeVertices(t,a.Oprev,r)):(t.mesh.splitEdge(a.Sym),t.mesh.splice(r,a.Oprev),n.dirty=i.dirty=!0)}else{if(hC.edgeSign(r.Dst,a.Org,r.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,t.mesh.splitEdge(r.Sym),t.mesh.splice(a.Oprev,r)}return!0},e.checkForLeftSplice=function(t,n){var i,r=e.regionBelow(n),a=n.eUp,o=r.eUp;if(cC(!hC.vertEq(a.Dst,o.Dst)),hC.vertLeq(a.Dst,o.Dst)){if(hC.edgeSign(a.Dst,o.Dst,a.Org)<0)return!1;e.regionAbove(n).dirty=n.dirty=!0,i=t.mesh.splitEdge(a),t.mesh.splice(o.Sym,i),i.Lface.inside=n.inside}else{if(hC.edgeSign(o.Dst,a.Dst,o.Org)>0)return!1;n.dirty=r.dirty=!0,i=t.mesh.splitEdge(o),t.mesh.splice(a.Lnext,o.Sym),i.Rface.inside=n.inside}return!0},e.checkForIntersect=function(t,n){var i,r,a=e.regionBelow(n),o=n.eUp,s=a.eUp,l=o.Org,u=s.Org,c=o.Dst,h=s.Dst,d=new vC;if(cC(!hC.vertEq(h,c)),cC(hC.edgeSign(c,t.event,l)<=0),cC(hC.edgeSign(h,t.event,u)>=0),cC(l!==t.event&&u!==t.event),cC(!n.fixUpperEdge&&!a.fixUpperEdge),l===u||Math.min(l.t,c.t)>Math.max(u.t,h.t))return!1;if(hC.vertLeq(l,u)){if(hC.edgeSign(h,l,u)>0)return!1}else if(hC.edgeSign(c,u,l)<0)return!1;return e.debugEvent(t),hC.intersect(c,l,h,u,d),cC(Math.min(l.t,c.t)<=d.t),cC(d.t<=Math.max(u.t,h.t)),cC(Math.min(h.s,c.s)<=d.s),cC(d.s<=Math.max(u.s,l.s)),hC.vertLeq(d,t.event)&&(d.s=t.event.s,d.t=t.event.t),i=hC.vertLeq(l,u)?l:u,hC.vertLeq(i,d)&&(d.s=i.s,d.t=i.t),hC.vertEq(d,l)||hC.vertEq(d,u)?(e.checkForRightSplice(t,n),!1):!hC.vertEq(c,t.event)&&hC.edgeSign(c,t.event,d)>=0||!hC.vertEq(h,t.event)&&hC.edgeSign(h,t.event,d)<=0?h===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(s.Sym,o),n=e.topLeftRegion(t,n),o=e.regionBelow(n).eUp,e.finishLeftRegions(t,e.regionBelow(n),a),e.addRightEdges(t,n,o.Oprev,o,o,!0),!0):c===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(o.Lnext,s.Oprev),a=n,n=e.topRightRegion(n),r=e.regionBelow(n).eUp.Rprev,a.eUp=s.Oprev,s=e.finishLeftRegions(t,a,null),e.addRightEdges(t,n,s.Onext,o.Rprev,r,!0),!0):(hC.edgeSign(c,t.event,d)>=0&&(e.regionAbove(n).dirty=n.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),hC.edgeSign(h,t.event,d)<=0&&(n.dirty=a.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),!1):(t.mesh.splitEdge(o.Sym),t.mesh.splitEdge(s.Sym),t.mesh.splice(s.Oprev,o),o.Org.s=d.s,o.Org.t=d.t,o.Org.pqHandle=t.pq.insert(o.Org),e.getIntersectData(t,o.Org,l,c,u,h),e.regionAbove(n).dirty=n.dirty=a.dirty=!0,!1)},e.walkDirtyRegions=function(t,n){for(var i,r,a=e.regionBelow(n);;){for(;a.dirty;)n=a,a=e.regionBelow(a);if(!n.dirty&&(a=n,null===(n=e.regionAbove(n))||!n.dirty))return;if(n.dirty=!1,i=n.eUp,r=a.eUp,i.Dst!==r.Dst&&e.checkForLeftSplice(t,n)&&(a.fixUpperEdge?(e.deleteRegion(t,a),t.mesh.delete(r),r=(a=e.regionBelow(n)).eUp):n.fixUpperEdge&&(e.deleteRegion(t,n),t.mesh.delete(i),i=(n=e.regionAbove(a)).eUp)),i.Org!==r.Org)if(i.Dst===r.Dst||n.fixUpperEdge||a.fixUpperEdge||i.Dst!==t.event&&r.Dst!==t.event)e.checkForRightSplice(t,n);else if(e.checkForIntersect(t,n))return;i.Org===r.Org&&i.Dst===r.Dst&&(e.addWinding(r,i),e.deleteRegion(t,n),t.mesh.delete(i),n=e.regionAbove(a))}},e.connectRightVertex=function(t,n,i){var r,a=i.Onext,o=e.regionBelow(n),s=n.eUp,l=o.eUp,u=!1;s.Dst!==l.Dst&&e.checkForIntersect(t,n),hC.vertEq(s.Org,t.event)&&(t.mesh.splice(a.Oprev,s),n=e.topLeftRegion(t,n),a=e.regionBelow(n).eUp,e.finishLeftRegions(t,e.regionBelow(n),o),u=!0),hC.vertEq(l.Org,t.event)&&(t.mesh.splice(i,l.Oprev),i=e.finishLeftRegions(t,o,null),u=!0),u?e.addRightEdges(t,n,i.Onext,a,a,!0):(r=hC.vertLeq(l.Org,s.Org)?l.Oprev:s,r=t.mesh.connect(i.Lprev,r),e.addRightEdges(t,n,r,r.Onext,r.Onext,!1),r.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,n))},e.connectLeftDegenerate=function(t,n,i){var r,a,o,s,l;return r=n.eUp,hC.vertEq(r.Org,i)?(cC(!1),void e.spliceMergeVertices(t,r,i.anEdge)):hC.vertEq(r.Dst,i)?(cC(!1),n=e.topRightRegion(n),a=s=(o=(l=e.regionBelow(n)).eUp.Sym).Onext,l.fixUpperEdge&&(cC(a!==o),e.deleteRegion(t,l),t.mesh.delete(o),o=a.Oprev),t.mesh.splice(i.anEdge,o),hC.edgeGoesLeft(a)||(a=null),void e.addRightEdges(t,n,o.Onext,s,a,!0)):(t.mesh.splitEdge(r.Sym),n.fixUpperEdge&&(t.mesh.delete(r.Onext),n.fixUpperEdge=!1),t.mesh.splice(i.anEdge,r),void e.sweepEvent(t,i))},e.connectLeftVertex=function(t,n){var i,r,a,o,s,l,u=new xC;if(u.eUp=n.anEdge.Sym,i=t.dict.search(u).key,r=e.regionBelow(i)){if(o=i.eUp,s=r.eUp,0===hC.edgeSign(o.Dst,n,o.Org))return void e.connectLeftDegenerate(t,i,n);if(a=hC.vertLeq(s.Dst,o.Dst)?i:r,i.inside||a.fixUpperEdge){if(a===i)l=t.mesh.connect(n.anEdge.Sym,o.Lnext);else l=t.mesh.connect(s.Dnext,n.anEdge).Sym;a.fixUpperEdge?e.fixUpperEdge(t,a,l):e.computeWinding(t,e.addRegionBelow(t,i,l)),e.sweepEvent(t,n)}else e.addRightEdges(t,i,n.anEdge,n.anEdge,null,!0)}},e.sweepEvent=function(t,n){t.event=n,e.debugEvent(t);for(var i=n.anEdge;null===i.activeRegion;)if((i=i.Onext)===n.anEdge)return void e.connectLeftVertex(t,n);var r=e.topLeftRegion(t,i.activeRegion);cC(null!==r);var a=e.regionBelow(r),o=a.eUp,s=e.finishLeftRegions(t,a,null);s.Onext===o?e.connectRightVertex(t,r,s):e.addRightEdges(t,r,s.Onext,o,o,!0)},e.addSentinel=function(e,t,n,i){var r=new xC,a=e.mesh.makeEdge();a.Org.s=n,a.Org.t=i,a.Dst.s=t,a.Dst.t=i,e.event=a.Dst,r.eUp=a,r.windingNumber=0,r.inside=!1,r.fixUpperEdge=!1,r.sentinel=!0,r.dirty=!1,r.nodeUp=e.dict.insert(r)},e.initEdgeDict=function(t){t.dict=new wC(t,e.edgeLeq);var n=t.bmax[0]-t.bmin[0],i=t.bmax[1]-t.bmin[1],r=t.bmin[0]-n,a=t.bmax[0]+n,o=t.bmin[1]-i,s=t.bmax[1]+i;e.addSentinel(t,r,a,o),e.addSentinel(t,r,a,s)},e.doneEdgeDict=function(t){for(var n,i=0;null!==(n=t.dict.min().key);)n.sentinel||(cC(n.fixUpperEdge),cC(1===++i)),cC(0===n.windingNumber),e.deleteRegion(t,n)},e.removeDegenerateEdges=function(t){var n,i,r,a=t.mesh.eHead;for(n=a.next;n!==a;n=i)i=n.next,r=n.Lnext,hC.vertEq(n.Org,n.Dst)&&n.Lnext.Lnext!==n&&(e.spliceMergeVertices(t,r,n),t.mesh.delete(n),r=(n=r).Lnext),r.Lnext===n&&(r!==n&&((r===i||r===i.Sym)&&(i=i.next),t.mesh.delete(r)),(n===i||n===i.Sym)&&(i=i.next),t.mesh.delete(n))},e.initPriorityQ=function(e){var t,n,i,r=0;for(n=(i=e.mesh.vHead).next;n!==i;n=n.next)r++;for(r+=8,t=e.pq=new yC(r,hC.vertLeq),n=(i=e.mesh.vHead).next;n!==i;n=n.next)n.pqHandle=t.insert(n);return n===i&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,n){var i,r,a;for(i=n.fHead.next;i!==n.fHead;i=r)r=i.next,cC((a=i.anEdge).Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),t.mesh.delete(a));return!0},e.computeInterior=function(t,n){var i,r;if(void 0===n&&(n=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(i=t.pq.extractMin());){for(;null!==(r=t.pq.min())&&hC.vertEq(r,i);)r=t.pq.extractMin(),e.spliceMergeVertices(t,i.anEdge,r.anEdge);e.sweepEvent(t,i)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),!!e.removeDegenerateFaces(t,t.mesh)&&(n&&t.mesh.check(),!0)},e}(),_C=function(){function e(){this.mesh=new pC,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=QE.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,n,i,r,a,o,s=[0,0,0],l=[0,0,0],u=[0,0,0],c=[0,0,0],h=[0,0,0],d=[null,null,null],f=[null,null,null],v=this.mesh.vHead;t=v.next;for(var p=0;p<3;++p)r=t.coords[p],l[p]=r,f[p]=t,s[p]=r,d[p]=t;for(t=v.next;t!==v;t=t.next)for(var m=0;m<3;++m)(r=t.coords[m])s[m]&&(s[m]=r,d[m]=t);var g=0;if(s[1]-l[1]>s[0]-l[0]&&(g=1),s[2]-l[2]>s[g]-l[g]&&(g=2),l[g]>=s[g])return e[0]=0,e[1]=0,void(e[2]=1);for(o=0,n=f[g],i=d[g],u[0]=n.coords[0]-i.coords[0],u[1]=n.coords[1]-i.coords[1],u[2]=n.coords[2]-i.coords[2],t=v.next;t!==v;t=t.next)c[0]=t.coords[0]-i.coords[0],c[1]=t.coords[1]-i.coords[1],c[2]=t.coords[2]-i.coords[2],h[0]=u[1]*c[2]-u[2]*c[1],h[1]=u[2]*c[0]-u[0]*c[2],h[2]=u[0]*c[1]-u[1]*c[0],(a=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])>o&&(o=a,e[0]=h[0],e[1]=h[1],e[2]=h[2]);o<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(u)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,n=this.mesh.fHead,i=this.mesh.vHead,r=0,a=n.next;a!==n;a=a.next)if(!((t=a.anEdge).winding<=0))do{r+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext}while(t!==a.anEdge);if(r<0){for(e=i.next;e!==i;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var e,t,n=this.mesh.vHead,i=[0,0,0],r=!1;i[0]=this.normal[0],i[1]=this.normal[1],i[2]=this.normal[2],!i[0]&&!i[1]&&!i[2]&&(this.computeNormal_(i),r=!0),e=this.sUnit,t=this.tUnit;var a=this.longAxis_(i);e[a]=0,e[(a+1)%3]=1,e[(a+2)%3]=0,t[a]=0,t[(a+1)%3]=0,t[(a+2)%3]=i[a]>0?1:-1;for(var o=n.next;o!==n;o=o.next)o.s=this.dot_(o.coords,e),o.t=this.dot_(o.coords,t);r&&this.checkOrientation_();for(var s=!0,l=n.next;l!==n;l=l.next)s?(this.bmin[0]=this.bmax[0]=l.s,this.bmin[1]=this.bmax[1]=l.t,s=!1):(l.sthis.bmax[0]&&(this.bmax[0]=l.s),l.tthis.bmax[1]&&(this.bmax[1]=l.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var n,i;if((n=t.anEdge).Lnext===n||n.Lnext.Lnext===n)throw"Mono region invalid";for(;hC.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;hC.vertLeq(n.Org,n.Dst);n=n.Lnext);i=n.Lprev;for(;n.Lnext!==i;)if(hC.vertLeq(n.Dst,i.Org)){for(;i.Lnext!==n&&(hC.edgeGoesLeft(i.Lnext)||hC.edgeSign(i.Org,i.Dst,i.Lnext.Dst)<=0);)i=e.connect(i.Lnext,i).Sym;i=i.Lprev}else{for(;i.Lnext!==n&&(hC.edgeGoesRight(n.Lprev)||hC.edgeSign(n.Dst,n.Org,n.Lprev.Org)>=0);)n=e.connect(n,n.Lprev).Sym;n=n.Lnext}if(i.Lnext===n)throw"Mono region invalid";for(;i.Lnext.Lnext!==n;)i=e.connect(i.Lnext,i).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,n=e.fHead.next;n!==e.fHead;n=t)if(t=n.next,n.inside&&!this.tessellateMonoRegion_(e,n))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,n=e.fHead.next;n!==e.fHead;n=t)t=n.next,n.inside||e.zapFace(n)},e.prototype.setWindingNumber_=function(e,t,n){for(var i,r=e.eHead.next;r!==e.eHead;r=i)i=r.next,r.Rface.inside!==r.Lface.inside?r.winding=r.Lface.inside?t:-t:n?e.delete(r):r.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,n,i){var r,a,o=0,s=0;n>3&&e.mergeConvexFaces(n);for(var l=e.vHead.next;l!==e.vHead;l=l.next)l.n=-1;for(var u=e.fHead.next;u!==e.fHead;u=u.next)if(u.n=-1,u.inside){r=u.anEdge,a=0;do{-1===(l=r.Org).n&&(l.n=s,s++),a++,r=r.Lnext}while(r!==u.anEdge);if(a>n)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,t===KE.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*n,this.vertexCount=s,this.vertices=[],this.vertices.length=s*i,this.vertexIndices=[],this.vertexIndices.length=s;for(l=e.vHead.next;l!==e.vHead;l=l.next)if(-1!==l.n){var c=l.n*i;this.vertices[c+0]=l.coords[0],this.vertices[c+1]=l.coords[1],i>2&&(this.vertices[c+2]=l.coords[2]),this.vertexIndices[l.n]=l.idx}var h=0;for(u=e.fHead.next;u!==e.fHead;u=u.next)if(u.inside){r=u.anEdge,a=0;do{l=r.Org;this.elements[h++]=l.n,a++,r=r.Lnext}while(r!==u.anEdge);for(var d=a;d2&&(this.vertices[s++]=n.Org.coords[2]),this.vertexIndices[l++]=this.vertexIdCallback?this.vertexIdCallback(n):n.Org.idx,a++,n=n.Lnext}while(n!==i);this.elements[u++]=r,this.elements[u++]=a,r+=a}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new pC),e<2&&(e=2),e>3&&(e=3);for(var n=null,i=0;i2?t[i+2]:0,n.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(n),n.winding=1,n.Sym.winding=-1},e.prototype.tesselate=function(e,t,n,i,r,a){if(void 0===e&&(e=QE.ODD),void 0===t&&(t=KE.POLYGONS),void 0===a&&(a=!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=e,i<2&&(i=2),i>3&&(i=3),!this.mesh)return!1;this.projectPolygon_(),SC.computeInterior(this,a);var o=this.mesh;return t===KE.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),a&&o.check(),t===KE.BOUNDARY_CONTOURS?this.outputContours_(o,i):this.outputPolymesh_(o,t,n,i),!0},e}();function AC(e){var t=e.windingRule,n=void 0===t?QE.ODD:t,i=e.elementType,r=void 0===i?KE.POLYGONS:i,a=e.polySize,o=void 0===a?3:a,s=e.vertexSize,l=void 0===s?2:s,u=e.normal,c=void 0===u?[0,0,1]:u,h=e.contours,d=void 0===h?[]:h,f=e.strict,v=void 0===f||f,p=e.debug,m=void 0!==p&&p;if(!d&&v)throw new Error("Contours can't be empty");if(d){var g=new _C;e.edgeCreateCallback&&(g.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(g.vertexIdCallback=e.vertexIdCallback);for(var y=0;y0&&void 0!==arguments[0]?arguments[0]:256,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(0,b.Z)(this,e),this.capacity=t,this.size=0,this.debug=n,this.debug&&console.log("allocating with cap ".concat(t));var i=t*e.eSize;this.buffer=new ArrayBuffer(i);var r=Float32Array.BYTES_PER_ELEMENT,a=0;this.positions=new Float32Array(this.buffer,a*r,3*t),a+=3*t,this.normals=new Float32Array(this.buffer,a*r,3*t),a+=3*t,this.uvs=new Float32Array(this.buffer,a*r,2*t)}return(0,w.Z)(e,[{key:"realloc",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t0&&void 0!==arguments[0]?arguments[0]:1,t=this.size+e;if(t>this.capacity){for(var n=this.capacity;t>n;)n*=2;this.realloc(n)}var i=this.size;return this.size=t,i}},{key:"reserve",value:function(e){var t=this.size+e;t>this.capacity&&this.realloc(t)}},{key:"shrink",value:function(){this.debug&&console.log("shrinking ".concat(this.capacity," \u2192 ").concat(this.size)),this.realloc(this.size,!0)}}]),e}();MC.eSize=8*Float32Array.BYTES_PER_ELEMENT;var EC=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e,t){return et?1:0};if((0,b.Z)(this,e),this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return(0,w.Z)(e,[{key:"push",value:function(e){this.data.push(e),this._up(this.length++)}},{key:"pop",value:function(){if(0!==this.length){var e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(e){for(var t=this.data,n=this.compare,i=t[e];e>0;){var r=e-1>>1,a=t[r];if(n(i,a)>=0)break;t[e]=a,e=r}t[e]=i}},{key:"_down",value:function(e){for(var t=this.data,n=this.compare,i=this.length>>1,r=t[e];e=0)break;t[e]=t[a],e=a}t[e]=r}}]),e}();function CC(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=1/0,o=1/0,s=-1/0,l=-1/0,u=D(e[0]);try{for(u.s();!(n=u.n()).done;){var c=(0,h.Z)(n.value,2),d=c[0],f=c[1];ds&&(s=d),f>l&&(l=f)}}catch(I){u.e(I)}finally{u.f()}var v=s-a,p=l-o,m=Math.max(i,Math.min(v,p));if(m===i){var g=[a,o];return g.distance=0,g.distance}var y=new EC([],(function(e,t){return t.max-e.max})),x=TC(e),b=new kC(a+v/2,o+p/2,0,e);b.d>x.d&&(x=b);var w=2;function S(n,a,o){var s=new kC(n,a,o,e);if(w++,s.max>x.d+i&&y.push(s),s.d>x.d&&(x=s,r&&console.log("found best ".concat(Math.round(1e4*s.d)/1e4," after ").concat(w," probes")),x.d>t))return t}for(var _=m/2,A=a;At!=d[1]>t&&e<(d[0]-h[0])*(t-h[1])/(d[1]-h[1])+h[0]&&(r=!r),a=Math.min(a,PC(e,t,h,d))}}catch(f){o.e(f)}finally{o.f()}return 0===a?0:(r?1:-1)*Math.sqrt(a)}(e,t,i),this.max=this.d+this.h*Math.SQRT2}function TC(e){for(var t=0,n=0,i=0,r=e[0],a=0,o=r.length,s=o-1;a1?(r=i[0],a=i[1]):l>0&&(r+=o*l,a+=s*l)}return(o=e-r)*o+(s=t-a)*s}var DC={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},OC={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},IC={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},RC=function(e,t){return function(n){var i=(0,h.Z)(n,2),r=i[0],a=i[1];return a=r?e:e+t)<=a}},LC=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:QE.ODD,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];(0,b.Z)(this,n),(r=t.call(this)).forPathBevel=c,r.type="ShapeGeometry",r.vertexCache={},r._shape=e,r._depth=i,r._curveSegments=o,r._bevelSegmentsInput=s;for(var d,v,p,m=r._shape.extractShapePointsToFlatArray([],o),g=r._shape.shapeHoles.map((function(e){for(var t=e.extractShapePointsToFlatArray([],o),n=[],i=t.length-1;i>=1;i-=2){var r=t[i-1],a=t[i-0];n.push(r,a)}return n})),y=[],x=[],w=0;w0?CC(y,a):1e-5,a<=0?(r._bevel=0,r._bevelSegments=0):(r._bevel=Math.min(a,d,i/2),r._bevelSegments=Math.floor(s));try{v=AC({windingRule:u,elementType:KE.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[m]})}catch(Tt){v=DC}try{p=AC({windingRule:QE.ODD,elementType:KE.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:(0,l.Z)(g)})}catch(Pt){p=OC}if(!v)throw new Error("error generating geometry");var E=v.elementCount;if(p){v.elementCount+=p.elementCount;for(var C=0;CB&&(B=V),jF&&(F=j)}r._minX=L,r._minY=z,r._width=B-L,r._height=F-z,r._buffer=new MC(r._computeBufferEstimatedSize(v));for(var G=[],H=[],W=v.elementCount-1;W>=0;W--){var q=W>=E,X=2*W,Y=v.elements[X+0],Q=v.elements[X+1],K=Y+Q,J={start:Y,count:Q,normals:[],continuous:[],concave:[]},$=Y,ee=K-1,te=Y+1,ne=r._shape.roundedCurves.length;do{var ie,re=$-Y,ae=v.vertices[2*ee+0],oe=v.vertices[2*ee+1],se=v.vertices[2*$+0],le=v.vertices[2*$+1],ue=v.vertices[2*te+0],ce=v.vertices[2*te+1],he=se-ae,de=le-oe,fe=Math.sqrt(he*he+de*de);he/=fe,de/=fe;var ve=se-ue,pe=le-ce,me=Math.sqrt(ve*ve+pe*pe);ve/=me,pe/=me,J.normals[2*re+0]=-pe,J.normals[2*re+1]=ve,J.concave[re]=he*pe-de*ve>0;var ge=v.vertexIndices[$];if(Array.isArray(ge))J.continuous[re]=!1;else{var ye=r._shape.getCurveIndexFromVertexId(ge-1,!0),xe=(0,h.Z)(ye,2),be=xe[0],we=xe[1];if(we>0&&we<1)J.continuous[re]=!0;else{var Se=1===we?be+1:be-1;Se=(Se+ne)%ne;var _e=1===we?0:1,Ae=r._shape.roundedCurves[be].getTangent(we),Me=r._shape.roundedCurves[Se].getTangent(_e);J.continuous[re]=Ae.dot(Me)>.95}}q&&(J.normals[2*re+0]*=-1,J.normals[2*re+1]*=-1),ee=(ie=[$,te,te+1])[0],$=ie[1],(te=ie[2])>=K&&(te-=Q)}while(te!==Y+1);var Ee=[];Ee.push({bevelI:0,angle:0,size:0,boundary:{vertices:v.vertices.slice(2*Y,2*K),vertexCount:Q,vertexIndices:new Array(Q).fill(!0).map((function(e,t){return[t,t]})),elements:[0,Q],elementCount:1,mesh:null},reverseMap:[],insetPoints:v.vertices.slice(2*Y,2*K)});for(var Ce=0,ke=function(e){for(var t=e/r._bevelSegments*Math.PI/2,n=(1-Math.cos(t))*r._bevel,i=[],a=[],s=[],l=[],u=0,c=0;cw&&(S-=2*Math.PI);var _=S-w;if(J.continuous[c]||q){var A=w+_/2,M=Math.cos(A)*n,E=Math.sin(A)*n;i[2*u+0]=p+M*(q?-1:1),i[2*u+1]=m+E*(q?-1:1),l[u]=c,u++}else for(var C=Math.max(1,Math.floor(o/4*Math.abs(_)/Math.PI)),k=0;k<=C;k++){var T=w+_*(k/C),P=Math.cos(T)*n,D=Math.sin(T)*n;i[2*u+0]=p+P,i[2*u+1]=m+D,l[u]=c,u++}}else i[2*u+0]=p+g,i[2*u+1]=m+y,l[u]=c,a[c]=u,i[2*++u+0]=p,i[2*u+1]=m,l[u]=c,i[2*++u+0]=p+x,i[2*u+1]=m+b,l[u]=c,s[c]=u,u++}var O=AC({windingRule:QE.POSITIVE,elementType:KE.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[i],edgeCreateCallback:function(e){var t=e.Org.idx,n=l[t],i=l[(t+1)%l.length];e.idx=[n,i],e.Sym.idx=[i,n]},vertexIdCallback:function(e){var t=e.Lprev.idx;return[t?t[1]:0,e.idx?e.idx[0]:0]}});if(!O)throw console.log("Error"),new Error("error generating bevel geometry for ".concat(e,"'th loop"));if(!O.vertexCount){var I=(e-1)/r._bevelSegments*Math.PI/2;return Ce=(1-Math.sin(I))*r._bevel,"break"}for(var R=0;R$e)for(var rt=Je/$e,at=0,ot=1;ot(at+1)*rt&&(at++,Qe=r._buildBevelVert(J,Le,(Ve+at)%ze,at/($e-1),Ge),G.push(Xe.topN,Ye.topP,Qe.topP),!1===c&&G.push(Ye.bottomP,Xe.bottomN,Qe.bottomP),Xe=Qe);else for(var st=$e/Je,lt=0,ut=1;ut<$e;ut++)Qe=r._buildBevelVert(J,Le,(Ve+ut)%ze,ut/($e-1),Ge),G.push(Xe.topN,Ye.topP,Qe.topP),!1===c&&G.push(Ye.bottomP,Xe.bottomN,Qe.bottomP),Xe=Qe,ut>(lt+1)*st&&(lt++,Ye=r._buildBevelVert(J,Re,(Ze+lt)%Be,lt/(Je-1),Ge),G.push(qe.topN,Ye.topP,Xe.topN),!1===c&&G.push(Ye.bottomP,qe.bottomN,Xe.bottomN),qe=Ye);Ze=(Ze+Je)%Be,Ve=(Ve+$e)%ze,Ne=(Ne+1)%Fe}while(Ne!==je)}if(!1===c&&r._depth>2*r._bevel&&r._buildWall(Ee,J,G),q){for(var ct=[],ht=G.length-1;ht>=Oe+2;ht-=3){var dt=G[ht-2],ft=G[ht-1],vt=G[ht-0];ct.push(vt,ft,dt)}G.splice.apply(G,[Oe,G.length-Oe].concat(ct))}if(q){for(var pt=[],mt=Ee[Ee.length-1].boundary.vertices.length-1;mt>=1;mt-=2){var gt=Ee[Ee.length-1].boundary.vertices[mt-1],yt=Ee[Ee.length-1].boundary.vertices[mt-0];pt.push(gt,yt)}H.push(pt)}if(!q){var xt=Ee[Ee.length-1],bt=void 0;try{bt=AC({windingRule:Ee.length>1?QE.POSITIVE:QE.ODD,elementType:KE.POLYGONS,vertexSize:2,strict:!0,contours:[xt.insetPoints].concat(H)})}catch(Ot){bt=IC}if(!bt)throw new Error("Error generating geometry for surface");0===g.length&&r._bevel3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4?arguments[4]:void 0,a="".concat(t.bevelI,":").concat(n);if(a in this.vertexCache&&0!==r&&1!==r&&(!r||r===this.vertexCache[a].pathBevelUCoord))return this.vertexCache[a];var o,s,l,u,c=(0,h.Z)(t.boundary.vertexIndices[n],2),d=c[0],f=c[1];d!==f?(s=d,o=f,u=!1,l=e.continuous[s]&&e.continuous[o]):(s=((o=d)-1+e.count)%e.count,u=e.concave[o]&&t.bevelI>0,l=e.continuous[o]||u);var v=Math.cos(t.angle),p=Math.sin(t.angle),m=2*n,g=2*o,y=2*s,x=t.boundary.vertices[m+0],b=t.boundary.vertices[m+1],w=(1-p)*this._bevel,S=(x-this._minX)/this._width,_=(b-this._minY)/this._height;this.forPathBevel&&(void 0!==r&&(S=r),_=1);var A=e.normals[g+0],M=e.normals[g+1],E=e.normals[y+0],C=e.normals[y+1];if(u){var k=E-A,T=C-M;A+=k*(1-i),M+=T*(1-i);var P=Math.sqrt(A*A+M*M);A/=P,M/=P}var D=this.forPathBevel?this._buffer.get(l?1:2):this._buffer.get(l?2:4),O=3*D,I=2*D,R={i:n,fi:o,topP:D+0,topN:D+0,bottomP:D+1,bottomN:D+1,pathBevelUCoord:r};return this._buffer.positions[O+0]=x,this._buffer.positions[O+1]=b,this._buffer.positions[O+2]=(this.forPathBevel?this._bevel:this._depth)-w,this._buffer.normals[O+0]=A*v,this._buffer.normals[O+1]=M*v,this._buffer.normals[O+2]=p,this._buffer.uvs[I+0]=S,this._buffer.uvs[I+1]=_,!1===this.forPathBevel&&(this._buffer.positions[O+3]=x,this._buffer.positions[O+4]=b,this._buffer.positions[O+5]=w,this._buffer.normals[O+3]=A*v,this._buffer.normals[O+4]=M*v,this._buffer.normals[O+5]=-p,this._buffer.uvs[I+2]=_,this._buffer.uvs[I+3]=S),l||(this.forPathBevel?(D+=1,O+=3,I+=2):(D+=2,O+=6,I+=4),R.topP=D+0,R.bottomP=D+1,this._buffer.positions[O+0]=x,this._buffer.positions[O+1]=b,this._buffer.positions[O+2]=(this.forPathBevel?this._bevel:this._depth)-w,this._buffer.normals[O+0]=E*v,this._buffer.normals[O+1]=C*v,this._buffer.normals[O+2]=p,this._buffer.uvs[I+0]=S,this._buffer.uvs[I+1]=_,!1===this.forPathBevel&&(this._buffer.positions[O+3]=x,this._buffer.positions[O+4]=b,this._buffer.positions[O+5]=w,this._buffer.normals[O+3]=E*v,this._buffer.normals[O+4]=C*v,this._buffer.normals[O+5]=-p,this._buffer.uvs[I+2]=_,this._buffer.uvs[I+3]=S)),this.vertexCache[a]=R,R}},{key:"clone",value:function(){var e=new n(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=Tp(this.userData),e}}]),n}(Fi),BC=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r,a,o,s,u,c,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,b.Z)(this,n),(c=t.call(this)).type="ShapeGeometry",c.windingRule=QE.ODD,c.elementType=KE.POLYGONS,c.polySize=3,c.vertexSize=2,c.strict=!0,c._shape=e,c._curveSegments=h,c._triangulationOptions=Object.assign({windingRule:QE.ODD,elementType:KE.POLYGONS,polySize:3,vertexSize:2,strict:!0},d);for(var f,v,p,m=c._shape.extractShapePointsToFlatArray([],c._curveSegments),g=c._shape.shapeHoles.map((function(e){return e.extractShapePointsToFlatArray([],c._curveSegments)})),y=!0,x=!0,w=0,S=m.length/2;wT&&(T=L),BD&&(D=B)}for(var z=T-k,F=D-P,N=0,U=E;N2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:12,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:3,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:QE.ODD;return(0,b.Z)(this,n),(r=t.call(this,e,i,a,o,s,l)).type="ShapeGeometry",r}return(0,w.Z)(n,[{key:"_computeBufferEstimatedSize",value:function(e){return 2*e.vertexCount*(2+this._bevelSegments)}},{key:"_buildWall",value:function(e,t,n){for(var i=e[0],r=0,a=i.boundary.vertexCount;r0&&p.update());var g=null!==(c=p)&&void 0!==c?c:new rC(d,f);return{parameters:Object.assign(h,{width:d,height:f,depth:v,roundness:m}),shape:g}}},{key:"build",value:function(e){var t,n=e.parameters,i=n.depth,r=n.extrudeBevelSize,a=n.extrudeBevelSegments,o=n.subdivisions,s=n.roundness,l=n.windingRule;return e.shape.roundness=s,t=i<=0?new BC(e.shape,o,{windingRule:l}):new zC(e.shape,i,r,o,a,l),Object.assign(t,{userData:k(k({},e),{},{type:"VectorGeometry"})})}}]),e}(),NC=2*Math.PI,UC=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return a.angle=Pt.clamp(a.angle,0,360),{shape:e.shape&&e.shape instanceof rC?e.shape:new rC,parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(i=a.height)&&void 0!==i?i:a.width),depth:Math.abs(null!==(r=a.depth)&&void 0!==r?r:0)})}}},{key:"build",value:function(e){var t,n=e.parameters,i=n.width,r=n.height,a=n.spikes,o=n.angle,s=n.innerRadius,l=n.depth,u=n.extrudeBevelSize,c=n.extrudeBevelSegments,h=e.shape,d=function(e,t,n,i,r,a){if(i>=NC)return r>30||r%4===0?(function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=.5522847498,s=t*o,l=n*o;e.addPoint(jC(r-t,a,r-t,a-l,r-t,a+l)),e.addPoint(jC(r,a+n,r-s,a+n,r+s,a+n)),e.addPoint(jC(r+t,a,r+t,a+l,r+t,a-l)),e.addPoint(jC(r,a-n,r+s,a-n,r-s,a-n)),i>0&&HC(e,t,n,i)}(e,t,n,a),Math.round(r/4)):ZC(e,i,r,t,n,a);i=Math.max(i,.001);var o={x:0,y:n},s=i+.5*Math.PI,l={x:Math.cos(s)*t,y:Math.sin(s)*n},u=uC({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:t,ry:n,largeArcFlag:i>Math.PI,sweepFlag:!0});return r>30||r%u.length===0?function(e,t,n,i,r,a,o,s){var l=Math.round(r/i.length);e.addPoint(VC(t,n));for(var u=0,c=i.length;u0?GC(e,a,o,s):e.addPoint(VC(0,0)),l}(e,o.x,o.y,u,r,t,n,a):ZC(e,i,r,t,n,a)}(h,.5*i,.5*r,o*Math.PI/180,a,s);return h.isClosed=!0,h.update(),0===o?(t=new Fi).setAttribute("position",new Pi([],3)):t=FC.create({shape:h,parameters:{subdivisions:d,depth:l,extrudeBevelSize:u,extrudeBevelSegments:c}}),Object.assign(t,{userData:k(k({},e),{},{type:"EllipseGeometry"})})}}]),e}();function ZC(e,t,n,i,r,a){for(var o=-t/n,s=0;s<=n;s++){var l=o*s,u=Math.sin(l)*i,c=Math.cos(l)*r;e.addPoint(VC(u,c))}return t0?GC(e,i,r,a):e.addPoint(VC(0,0)):(e.removePoint(e.points[e.points.length-1]),a>0&&HC(e,i,r,a)),1}function VC(e,t){return new _E(Pt.generateUUID(),new Dt(e,t))}function jC(e,t,n,i,r,a){var o=VC(e,t);return o.controls[0].position.set(n,i),o.controls[1].position.set(r,a),o}function GC(e,t,n,i){WC(e,t,n,i).forEach((function(t){return e.addPoint(t)}))}function HC(e,t,n,i){var r=WC(e,t,n,i),a=new rC;r.forEach((function(e){return a.addPoint(e)})),a.isClosed=!0,e.shapeHoles.push(a)}function WC(e,t,n,i){var r=i*t/100,a=r*(Math.abs(n)/Math.abs(t)),o=new Dt(r/t,a/n),s=e.points.map((function(e){var t=e.clone();return t.uuid=Pt.generateUUID(),t})).reverse();return s.forEach((function(e){e.position.multiply(o);var t=e.controls[0].position.clone().multiply(o),n=e.controls[1].position.clone().multiply(o);e.controls[0].position.copy(n),e.controls[1].position.copy(t)})),s}var qC=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),o=Math.abs(a.width),s=Math.abs(null!==(i=a.height)&&void 0!==i?i:o),l=Math.abs(null!==(r=a.depth)&&void 0!==r?r:o),u=Math.abs(Math.min(o,l))/2;return{parameters:Object.assign(a,{width:o,height:s,depth:l,radius:u,segments:Math.round(a.segments),pathSegments:Math.round(a.pathSegments),cornerSegments:Math.round(a.cornerSegments)})}}},{key:"build",value:function(e){var t=e.parameters,n=t.width,i=t.height,r=t.depth,a=t.radius,o=t.revolutions,s=t.segments,l=t.pathRadius,u=t.pathType,c=t.pathSegments,h=t.cornerRadius,d=t.cornerSegments,f=new YC(!1,n,i,r,a,o,s,l,u,c,h,d);return Object.assign(f,{userData:k(k({},e),{},{type:"HelixGeometry"})})}}]),e}(),XC=new Ti([0,0,0],1),YC=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1,u=arguments.length>9&&void 0!==arguments[9]?arguments[9]:1,c=arguments.length>10&&void 0!==arguments[10]?arguments[10]:1,d=arguments.length>11&&void 0!==arguments[11]?arguments[11]:1;if((0,b.Z)(this,n),e=t.call(this),0===o)return(0,p.Z)(e);var f=i&&1===o;f&&(d=0),c>100&&(c=100),0===c&&(d=0);var v,m,g,y,x,w,S,_,A=function(){return new un},M=new un,E=A(),C=A(),k=A(),T=A(),P=A(),D=A(),O=A(),I=A(),R=A(),L=A(),B=A(),z=r-2*l+.001,F=z/o,N=Math.ceil(s*o),U=N+1,Z=z/N,V=-z/2,j=u+1,G=2*Math.PI/u,H=Math.PI/2/d,W=.01,q=Math.min((1-c/100)*l,l-W),X=l-q,Y=0,Q=2,K=d*Q+Q,J=j*K/Q,$=J+j*U,ee=Math.max(0,j*(U+K)),te=[3,3,2].map((function(e){return Array(ee*e).fill(0)})),ne=(0,h.Z)(te,3),ie=ne[0],re=ne[1],ae=ne[2],oe=[],se=a-l;function le(e,t){var n=Math.PI/2;w=t*Z,_=2*Math.PI*(w%F)/F+n,w+=V,S=Math.sin(_)*se,x=Math.cos(_)*se,i?e.set(x,S,w):e.set(x,w,S)}le(M,-1e-10),le(E,0),T.copy(M),le(M,1);for(var ue=M.distanceTo(E),ce=f?0:X+q,he=ue*N+2*ce,de=q,fe=he-ce,ve=function(e){le(C,e),B.subVectors(C,T).normalize(),T.copy(C),R.copy(C).setComponent(+i+1,0).normalize(),L.crossVectors(B,R).normalize();for(var t=0===e,n=e===N,r=t?3*Math.PI/2:H,a=t?de:fe,o=t?j:$,s=t?0:ee-j,c=B.clone().multiplyScalar(t?-X:X).add(C),h=B.clone().multiplyScalar(t?-1:1).normalize(),v=0;v0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4;(0,b.Z)(this,n);var o=(1+Math.sqrt(5))/2,s=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],l=[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],u="IcosahedronGeometry";return(e=t.call(this,s,l,u,i,r,a)).type=u,e}return(0,w.Z)(n,null,[{key:"fromJSON",value:function(e){return new n(e.radius,e.corner,e.cornerSides)}}]),n}(gE),JC=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a,o;(null!==(n=null===(i=e.parameters)||void 0===i?void 0:i.points)&&void 0!==n?n:[]).forEach((function(e){Array.isArray(e)&&(e.x=e[0],e.y=e[1])}));var s=Object.assign({},null!==(r=null===t||void 0===t?void 0:t.parameters)&&void 0!==r?r:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(null!==(a=s.height)&&void 0!==a?a:s.width),depth:Math.abs(null!==(o=s.depth)&&void 0!==o?o:s.width)})}}},{key:"build",value:function(e){var t=e.parameters,n=t.points,i=t.segments,r=t.verticalSegments,a=new tl;a.moveTo(n[0].x,n[0].y),a.bezierCurveTo(n[1].x,n[1].y,n[2].x,n[2].y,n[3].x,n[3].y);var o=new Qs(a.extractPoints(r).shape,i);return o.rotateZ(Math.PI),Object.assign(o,{userData:k(k({},e),{},{type:"LatheGeometry"})})}}]),e}(),$C=new Nn,ek=new ci,tk=new un,nk=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).uuid=Pt.generateUUID(),e.name="",e.type="Geometry",e.vertices=[],e.colors=[],e.faces=[],e.faceVertexUvs=[[]],e.morphTargets=[],e.morphNormals=[],e.skinWeights=[],e.skinIndices=[],e.lineDistances=[],e.boundingBox=null,e.boundingSphere=null,e.elementsNeedUpdate=!1,e.verticesNeedUpdate=!1,e.uvsNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.lineDistancesNeedUpdate=!1,e.groupsNeedUpdate=!1,e}return(0,w.Z)(n,[{key:"applyMatrix4",value:function(e){for(var t=(new Ot).getNormalMatrix(e),n=0,i=this.vertices.length;n0)for(var d=0;d0&&void 0!==arguments[0])||arguments[0],t=new Array(this.vertices.length),n=0,i=this.vertices.length;n0&&(this.normalsNeedUpdate=!0)}},{key:"computeFlatVertexNormals",value:function(){this.computeFaceNormals();for(var e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)}},{key:"computeMorphNormals",value:function(){for(var e=0,t=this.faces.length;e2&&void 0!==arguments[2]?arguments[2]:0;if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,u=this.colors,c=e.colors;void 0!==t&&(i=(new Ot).getNormalMatrix(t));for(var h=0,d=o.length;h0&&void 0!==arguments[0]?arguments[0]:4,t={},n=[],i=[],r=Math.pow(10,e),a=0,o=this.vertices.length;a=0;p--){var m=u[p];this.faces.splice(m,1);for(var g=0,y=this.faceVertexUvs.length;g0,g=v.vertexNormals.length>0,y=1!==v.color.r||1!==v.color.g||1!==v.color.b,x=v.vertexColors.length>0,b=0;if(b=A(b,0,0),b=A(b,1,!0),b=A(b,2,!1),b=A(b,3,p),b=A(b,4,m),b=A(b,5,g),b=A(b,6,y),b=A(b,7,x),o.push(b),o.push(v.a,v.b,v.c),o.push(v.materialIndex),p){var w=this.faceVertexUvs[0][f];o.push(C(w[0]),C(w[1]),C(w[2]))}if(m&&o.push(M(v.normal)),g){var S=v.vertexNormals;o.push(M(S[0]),M(S[1]),M(S[2]))}if(y&&o.push(E(v.color)),x){var _=v.vertexColors;o.push(E(_[0]),E(_[1]),E(_[2]))}}function A(e,t,n){return n?e|1<0&&(e.data.colors=u),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e}},{key:"clone",value:function(){return(new n).copy(this)}},{key:"copy",value:function(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;for(var t=e.vertices,n=0,i=t.length;n0){var i=new Float32Array(3*e.normals.length);t.setAttribute("normal",lk.call(new Ci(i,3),e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);t.setAttribute("color",ok.call(new Ci(r,3),e.colors))}if(e.uvs.length>0){var a=new Float32Array(2*e.uvs.length);t.setAttribute("uv",sk.call(new Ci(a,2),e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);t.setAttribute("uv2",sk.call(new Ci(o,2),e.uvs2))}for(var s in t.groups=e.groups,e.morphTargets){for(var l=[],u=e.morphTargets[s],c=0,h=u.length;c0){var v=new Pi(4*e.skinIndices.length,4);t.setAttribute("skinIndex",uk.call(v,e.skinIndices))}if(e.skinWeights.length>0){var p=new Pi(4*e.skinWeights.length,4);t.setAttribute("skinWeight",uk.call(p,e.skinWeights))}return null!==e.boundingSphere&&(t.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(t.boundingBox=e.boundingBox.clone()),t}},{key:"computeTangents",value:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")}},{key:"computeLineDistances",value:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}},{key:"applyMatrix",value:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}],[{key:"createBufferGeometryFromObject",value:function(e){var t=new Fi,n=e.geometry;if(e.isPoints||e.isLine){var i=new Pi(3*n.vertices.length,3),r=new Pi(3*n.colors.length,3);if(t.setAttribute("position",lk.call(i,n.vertices)),t.setAttribute("color",ok.call(r,n.colors)),n.lineDistances&&n.lineDistances.length===n.vertices.length){var a=new Pi(n.lineDistances.length,1);t.setAttribute("lineDistance",ak.call(a,n.lineDistances))}null!==n.boundingSphere&&(t.boundingSphere=n.boundingSphere.clone()),null!==n.boundingBox&&(t.boundingBox=n.boundingBox.clone())}else e.isMesh&&(t=n.toBufferGeometry());return t}}]),n}(mt);nk.prototype.isGeometry=!0;var ik=function(){function e(){(0,b.Z)(this,e),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}return(0,w.Z)(e,[{key:"computeGroups",value:function(e){var t,n,i,r=[],a=e.faces;for(n=0;n0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var u=0;u0){c=[];for(var f=0;f0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var y=0;y5&&void 0!==arguments[5]?arguments[5]:0;(0,b.Z)(this,e),this.a=t,this.b=n,this.c=i,this.normal=r&&r.isVector3?r:new un,this.vertexNormals=Array.isArray(r)?r:[],this.color=a&&a.isColor?a:new Yt,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=o}return(0,w.Z)(e,[{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t0&&void 0!==arguments[0]?arguments[0]:1;(0,b.Z)(this,e),this.subdivisions=t}return(0,w.Z)(e,[{key:"modify",value:function(e){(e=e instanceof Fi?(new nk).fromBufferGeometry(e):e.clone()).mergeVertices();for(var t=this.subdivisions;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}},{key:"_smooth",value:function(e){var t,n,i,r,a,o=new un,s=e.vertices,l=e.faces,u=e.faceVertexUvs[0],c=void 0!==u&&u.length>0,h=[],d=new Map;!function(e,t,n,i){var r,a,o;for(r=0,a=e.length;r3&&(A=3/(8*t)),M=1-t*Number(A),E=A,t<=2&&(2==t&&(M=3/4,E=1/8)),P=T.clone().multiplyScalar(M),o.set(0,0,0),r=0;r0?(void 0===u||(null===l||void 0===l?void 0:l.subdivisions)!==o)&&(void 0===u&&(u=s),s=new gk(o).modify(u).toBufferGeometry()):(void 0!==u&&(s=u),u=void 0,void 0===s.getAttribute("normal")&&s.computeVertexNormals())}catch(c){void 0!==u&&(s=u),u=void 0,void 0===s.getAttribute("normal")&&s.computeVertexNormals()}return void 0!==u&&Object.assign(s,{originalGeometry:u}),delete e.geometry,Object.assign(s,{userData:k(k({},e),{},{type:"NonParametricGeometry"})})}},{key:"loadFromUrl",value:function(e,t,n){var i=this;new Cu(n).load(e,(function(e){var n=i.normalizeInputs({geometry:e});e.boundingBox.getSize(yk);var r=100/yk.x;Object.assign(n.parameters,{width:100,height:yk.y*r,depth:yk.z*r}),t(i.build(n))}))}}]),e}();var bk=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof rC?e.shape:new rC,parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(i=a.height)&&void 0!==i?i:a.width),depth:Math.abs(null!==(r=a.depth)&&void 0!==r?r:0)})}}},{key:"build",value:function(e){for(var t=e.parameters,n=t.width,i=t.height,r=t.spikes,a=t.cornerRadius,o=t.depth,s=t.extrudeBevelSize,l=t.extrudeBevelSegments,u=e.shape,c=.5*n,h=.5*i,d=2*Math.PI/r,f=0;f0&&void 0!==arguments[0]?arguments[0]:.5,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:4;(0,b.Z)(this,n),e=t.call(this),a=Math.floor(Math.max(3,a)),o=Math.floor(o),u=Math.floor(u);var c,d=[],f=[],v=[],p=[],m=0,g=r/2,y=Math.PI/a,x=i*Math.cos(Math.PI/a),w=2*Math.PI/a,S=(a-2)*Math.PI/a,_=Math.PI-S,A=new un(0,-g,0),M=new un(0,g,0),E=new Dt(i,-g),C=new Dt(x,-g),k=new Dt(0,M.y).sub(C),T=new Dt(0,M.y).sub(E),P=new Dt(k.y,-k.x).normalize(),D=new Dt(T.y,-T.x).normalize(),O=i*Math.cos(Math.PI/a)*Math.tan((Math.PI-k.angle())/2)-1e-8;l=Math.min(l,O);var I=new un(P.x,P.y,0),R=new un(Math.cos(w)*I.x,I.y,Math.sin(w)*I.x);c=I.angleTo(R);var L=l/Math.tan((Math.PI-k.angle())/2),B=l/Math.tan((Math.PI-c)/2),z=new un;if(!s){f.push(A.x,A.y,A.z),v.push(0,-1,0),p.push(0,0);var F=m++,N=[],U=E.clone(),Z=L/Math.cos(Math.PI/a);U.x-=Z;for(var V=0;V0){var ue=X.clone().add(Y).multiplyScalar(.5),ce=M.clone().sub(ue).normalize(),he=A.clone().sub(ue).normalize().add(ce).normalize().multiplyScalar(-1),de=J.clone().sub(K);Ge(ue,de,he,k.angle());var fe=void 0,ve=void 0,pe=new un;Sk(D,ae,pe);var me=J.clone().add(Q).multiplyScalar(.5);me=Ak(me,Y,M);var ge=J.clone().sub(Q),ye=Ge(me,ge,pe,c,Q.y),xe=(0,h.Z)(ye,2);fe=xe[0],ve=xe[1];var be=fe,we=be.clone().setY(0).normalize(),Se=new un(0,-1,0),_e=we.clone().cross(Se);He(be,we,Se,_e),W.concat(ve);var Ae=k.angle(),Me=Math.PI-Ae,Ee=M.clone();Ee.y-=l/Math.sin(Ae-Math.PI/2);for(var Ce=new un,ke=[],Te=0;Tei&&n>r?Math.min(e*i/t,e*r/n):t>i?e*i/t:n>r?e*r/n:e}var v=[];v[0]=0===a[0]?0:f(a[0],a[0]+a[3],a[0]+a[1]),v[1]=0===a[1]?0:f(a[1],a[1]+a[2],a[1]+a[0]),v[2]=0===a[2]?0:f(a[2],a[2]+a[1],a[2]+a[3]),v[3]=0===a[3]?0:f(a[3],a[3]+a[0],a[3]+a[2]);var p=h.x,m=d.x,g=d.y,y=h.y;t.addPoint(t.createPoint(p,g)),t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(p,y)),t.isClosed=!0;for(var x=!0,b=0,w=t.points.length;b0&&v[b]!==v[b-1]&&(x=!1);x&&(t.roundness=v[0]),t.useCubicForRoundedCorners=1!==o,t.update();var S=FC.create({shape:t,parameters:{depth:s,extrudeBevelSize:l,extrudeBevelSegments:u}});return Object.assign(S,{userData:k(k({},e),{},{type:"RectangleGeometry"})})}}]),e}(),Ck=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return a.thetaLength=Pt.clamp(a.thetaLength,0,180),{parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(i=a.height)&&void 0!==i?i:a.width),depth:Math.abs(null!==(r=a.depth)&&void 0!==r?r:a.width)})}}},{key:"build",value:function(e){var t,n=e.parameters,i=n.width,r=void 0===i?100:i,a=n.height,o=void 0===a?r:a,s=n.depth,l=void 0===s?r:s,u=n.widthSegments,c=void 0===u?64:u,h=n.heightSegments,d=void 0===h?64:h,f=n.phiStart,v=n.phiLength,p=n.thetaStart,m=n.thetaLength;return 0===m?(t=new Fi).setAttribute("position",new Pi([],3)):t=new Ol(.5*r,c,d,f,v,p,m*Pt.DEG2RAD),t.scale(1,o/r,l/r),Object.assign(t,{userData:k(k({},e),{},{type:"SphereGeometry"})})}}]),e}(),kk=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(r,{width:Math.abs(r.width),height:Math.abs(null!==(i=r.height)&&void 0!==i?i:r.width),depth:0})}}},{key:"build",value:function(e){var t=e.parameters,n=t.width,i=void 0===n?100:n,r=t.height,a=void 0===r?i:r,o=t.widthSegments,s=void 0===o?8:o,l=t.heightSegments,u=new wr(i,a,s,void 0===l?8:l);return u.scale(1,1,1),Object.assign(u,{userData:k(k({},e),{},{type:"PlaneGeometry"})})}}]),e}(),Tk=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(a,{width:Math.abs(a.width),height:Math.abs(null!==(i=a.height)&&void 0!==i?i:a.width),depth:Math.abs(null!==(r=a.depth)&&void 0!==r?r:a.width)})}}},{key:"build",value:function(e){var t=e.parameters,n=t.width,i=t.height,r=t.depth,a=t.angle,o=t.cornerRadius,s=t.cornerSegments,l=new Pk(n,i,r,a,o,s);return Object.assign(l,{userData:k(k({},e),{},{type:"BackdropGeometry"})})}}]),e}(),Pk=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:90,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:24;(0,b.Z)(this,n),(e=t.call(this)).type="BackdropGeometry";var u=[],c=[],d=[],f=.001;0==s&&(l=1),l=Math.max(1,Math.floor(l)),s=Math.min(s,100),o=Math.min(180-f,o),o*=Math.PI/180;var v=[],p=Math.PI/2,m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new un(e,t,n)},g=m(),y=m(),x=r/2,w=i/2,S=a/2,_=-w,A=+w,M=[m(_,-x,+S),m(_,-x,-S),m(_,+x,-S)],E=M[0],C=M[1],k=M[2],T=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Math.sin(e-Math.PI/(+t+1))},P=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Math.cos(e-Math.PI/(+t+1))};k.y=Math.sin(o)*r-x;var D=Math.cos(o)*r-S,O=E.z-f;o<=p?(k.z=Math.min(D,O),k.z==O&&(k.y-=(D-O)/Math.tan(p-o))):C.z=Math.min(C.z-D-S,E.z-f),g.subVectors(E,C),y.subVectors(k,C);var I=Math.min(g.length(),y.length())*s/100,R=I*Math.tan(o/2),L=I/Math.cos(o/2),B=g.clone().normalize().add(y.normalize()).setLength(L).add(C);g.set(0,T(o,!0),P(o,!0)),v.push([k,g.clone()]);for(var z=(Math.PI-o)/l,F=0;F<=l;F++){var N=p+o+F*z;g.set(0,Math.sin(N)*R,Math.cos(N)*R),g.add(B),y.set(0,T(N),P(N)),v.push([g.clone(),y.clone()])}v.push([E,m(0,1,0)]);var U=Math.sin(z/2)*R*2,Z=v.length-1,V=v[0][0].distanceTo(v[1][0]),j=v[Z-1][0].distanceTo(v[Z][0]),G=V+U*l+j;v[0].push(1);for(var H=0;H<=l;H++)v[H+1].push(1-(V+H*U)/G);v[Z].push(0);for(var W,q,X,Y=(0,h.Z)(v[0],3),Q=Y[0],K=Y[1],J=Y[2],$=1;$>16&255,g:e>>8&255,b:255&e}},rgbToHex:function(e,t,n){return(e<<16)+(t<<8)+n},rgbToHexString:function(e,t,n){return"#"+[e=Math.round(e),t=Math.round(t),n=Math.round(n)].map((function(e){return e.toString(16).padStart(2,"0")})).join("").toUpperCase()},hexStringToRgb:function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,i){return String(t+t+n+n+i+i)}));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}},zk=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,[{key:"add",value:function(e,t,n){if("string"!=typeof arguments[0])for(var i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][n?"unshift":"push"](t)}),this)}},{key:"run",value:function(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}}]),e}(),Fk=function(){function e(t){(0,b.Z)(this,e),this.jsep=t,this.registered={}}return(0,w.Z)(e,[{key:"register",value:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length2&&(c=r[r.length-2],a.right_a&&c.right_a?i>c.prec:i<=c.prec);)s=r.pop(),n=r.pop().value,o=r.pop(),t={type:e.BINARY_EXP,operator:n,left:o,right:s},r.push(t);(t=this.gobbleToken())||this.throwError("Expected expression after "+u),r.push(a,t)}for(t=r[l=r.length-1];l>1;)t={type:e.BINARY_EXP,operator:r[l-1].value,left:r[l-2],right:t},l-=2;return t}},{key:"gobbleToken",value:function(){var t,n,i,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"))return this.runHook("after-token",r);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)r=this.gobbleArray();else{for(i=(n=this.expr.substr(this.index,e.max_unop_len)).length;i>0;){if(e.unary_ops.hasOwnProperty(n)&&(!e.isIdentifierStart(this.code)||this.index+n.length=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}if(a===e.COMMA_CODE){if(this.index++,++r!==n.length)if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(var o=n.length;o=48&&e<=57}},{key:"binaryPrecedence",value:function(t){return e.binary_ops[t]||0}},{key:"isIdentifierStart",value:function(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}},{key:"isIdentifierPart",value:function(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}}]),e}(),Uk=new zk;Object.assign(Nk,{hooks:Uk,plugins:new Fk(Nk),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"}),Nk.max_unop_len=Nk.getMaxKeyLen(Nk.unary_ops),Nk.max_binop_len=Nk.getMaxKeyLen(Nk.binary_ops);var Zk=function(e){return new Nk(e).parse()};Object.getOwnPropertyNames(Nk).forEach((function(e){void 0===Zk[e]&&"prototype"!==e&&(Zk[e]=Nk[e])})),Zk.Jsep=Nk;var Vk={name:"ternary",init:function(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;var n=t.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;var r=this.gobbleExpression();if(r||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:n,consequent:i,alternate:r},n.operator&&e.binary_ops[n.operator]<=.9){for(var a=n;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=n}}else this.throwError("Expected :")}}))}};function jk(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}}}Zk.plugins.register(Vk);var Gk=function(){function e(t,n,i){var r,a=this;(0,b.Z)(this,e),this.id=t,this.userAPI=n,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise((function(e){return e()})),this.emitter=jk(),this._innerCallUserAPI=function(){var e=(0,c.Z)(x().mark((function e(t){var n,i,r,o,s;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.emitter.emit("start",{userAPIId:a.id}),a.isLoading=!0,a.isLoading=!1,e.prev=1,e.next=4,Wk(a.userAPI,t);case 4:a.result=e.sent,a.error="null",a.emitter.emit("success",{userAPIId:a.id}),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),s=null!==(n=null===(i=e.t0.message)||void 0===i||null===(r=i.split("_:_"))||void 0===r||null===(o=r[0])||void 0===o?void 0:o.replace("status:",""))&&void 0!==n?n:"null",a.error=s,a.result=null,a.emitter.emit("error",{userAPIId:a.id});case 13:a.isLoading=!1,a.isPrefetched=!0,a.isLoaded=!0;case 14:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}(),"OpenAI"===(null===n||void 0===n||null===(r=n.integration)||void 0===r?void 0:r.type)?this.result={content:""}:"GET"===n.method&&""!==n.url&&(this.prefetchPromise=this.prefetch(i)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=nm(this.prefetch,1e3,{trailing:!0})}return(0,w.Z)(e,[{key:"_updateDebouncedCallUserAPI",value:function(){this._debouncedCallUserAPI=void 0!==this.userAPI.debounce&&this.userAPI.debounce>0?nm(this._innerCallUserAPI,this.userAPI.debounce,{leading:!0,trailing:!0}):this._innerCallUserAPI}},{key:"prefetch",value:function(){var e=(0,c.Z)(x().mark((function e(t){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.callUserAPI(t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"callUserAPI",value:function(){var e=(0,c.Z)(x().mark((function e(t){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._debouncedCallUserAPI(t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"update",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.userAPI=e,this._updateDebouncedCallUserAPI(),""!==this.userAPI.url&&"GET"===this.userAPI.method&&n&&this._debouncedPrefetch(t)}},{key:"retrieveValue",value:function(e){if(this.result)try{return Tg.zoom(this.result,e)}catch(pI){console.error(pI)}}},{key:"retrieveZoomedKeyValues",value:function(e){if(this.result){var t=e&&e.length?Tg.zoom(this.result,e):this.result;if(function(e){return"object"==typeof e&&null!==e}(t))return Object.entries(t);if(function(e){return Array.isArray(e)}(t))return t.map((function(e,t){return[t.toString(),e]}));throw function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null===e}(t)?new Error("This path points to a value, use retrieveValue() instead. "+(null===e||void 0===e?void 0:e.join("."))):new Error("Path error"+(null===e||void 0===e?void 0:e.join(".")))}}},{key:"dispose",value:function(){}},{key:"on",value:function(e,t){this.emitter.on(e,t)}},{key:"off",value:function(e,t){this.emitter.off(e,t)}},{key:"autostart",get:function(){return this.userAPI.autoStart}}]),e}();function Hk(e){var t=new Headers;return e.headers.forEach((function(e){""!==e.data.key&&t.append(e.data.key,e.data.value)})),t}function Wk(e,t){return qk.apply(this,arguments)}function qk(){return(qk=(0,c.Z)(x().mark((function e(t,n){var i,r,a,o,s,l,u,c,h,d,f,v,p,m,g,y,b=arguments;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=b.length>2&&void 0!==b[2]?b[2]:new AbortController,c=t.url,h=null!==(i=null===(r=t.proxy)||void 0===r?void 0:r.enabled)&&void 0!==i&&i,"OpenAI"===(null===(a=t.integration)||void 0===a?void 0:a.type)&&(f=Yk(""===t.integration.prompt?[]:JSON.parse(t.integration.prompt),n),v=""===t.integration.behavior?[]:Yk(JSON.parse(t.integration.behavior),n),d='{\n\t\t"model": "'.concat(t.integration.model,'",\n\t\t"messages": [').concat(t.integration.useBehavior?'\n\t\t{\n\t\t\t"role": "system",\n\t\t\t"content": "'.concat(v,'"\n\t\t},'):"",'\n\t\t{\n\t\t\t"role": "user",\n\t\t\t"content": "').concat(f,'"\n\t\t}\n\t\t]\n\t}')),h?(c="".concat("https://apis.spline.design/","file/").concat(t.proxy.fileId,"/external-api/request?uuidexternalapi=").concat(t.proxy.proxyId),void 0!==d?p=d:"POST"===t.method&&t.body&&(p=Yk(JSON.parse(t.body),n)),void 0!==p&&(c+="&data=".concat(encodeURIComponent(p.replace(/(\r\n|\n|\r|\t)/gm,""))))):"OpenAI"===(null===(o=t.integration)||void 0===o?void 0:o.type)?u=d:"POST"===t.method&&t.body&&(u=Yk(JSON.parse(t.body),n)),e.next=6,fetch(c,{method:h?"GET":t.method,headers:h?void 0:Hk(t),signal:l.signal,body:u});case 6:if((m=e.sent).ok){e.next=9;break}throw new Error("status:"+m.status+"_:_"+m.statusText);case 9:if("OpenAI"!==(null===(s=t.integration)||void 0===s?void 0:s.type)){e.next=16;break}return e.next=12,m.json();case 12:return g=e.sent,e.abrupt("return",(h&&(g=g.response),{content:g.choices[0].message.content}));case 16:return e.next=18,m.json();case 18:return y=e.sent,e.abrupt("return",(h&&(y=y.response),y));case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Xk=function e(t,n){if("string"==typeof t){var i=n.getVariable(t);if(i)return e(i,n)}return Tw.isBoolean(t)?Tw.getDisplayedValue(t).toLowerCase():Tw.getDisplayedValue(t)},Yk=function e(t,n){return t.map((function(t,i){if("text"in t)return t.text;if("type"in t){if("paragraph"===t.type)return(i>0?"\n":"")+e(t.children,n);if("variable"===t.type){var r=n.getVariable(t.variableId);if(void 0!==r)return Xk(r,n)}}return""})).join("")},Qk=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],Kk=["0","1","2","3","4","5","6","7","8","9","."],Jk=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function $k(e){return"string"==typeof e&&(!isNaN(e)&&!isNaN(parseFloat(e)))}function eT(e,t){for(var n,i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number",a="",o=function(n){var i=e[n];if("objType"in i&&"api"===i.objType){var o=JSON.parse(i.id),s=o[0],l=t.getUserAPI(s);if(void 0!==l&&l instanceof Gk){var u=l.retrieveValue(o.slice(1));void 0!==u&&(a+=u)}return"continue"}if("objType"in i&&"webhook"===i.objType){var c=JSON.parse(i.id),d=(0,h.Z)(c,2),f=d[0],v=d[1],p=t.getUserWebhook(f);if(void 0!==p){var m=p.getParameterValue(v);void 0!==m&&(a+=m)}return"continue"}if("objType"in i&&"aiAssistant"===i.objType){var g,y,x=t.openAIRealtime;if("objId"in i&&void 0!==i.objId)if(t.scene.data.objects.traverse((function(e,t){var n,r=null===(n=t.events)||void 0===n?void 0:n.find((function(e){return e.id===i.objId}));r&&(y=r)})),void 0!==y&&"AIAssistantListener"===y.data.type){var b=null===x||void 0===x?void 0:x.computeAnalysisForListenerEvent(y.data);if(void 0!==b)return a+=b,"continue"}return a+=null!==(g=null===x||void 0===x?void 0:x.voice)&&void 0!==g?g:0,"continue"}if("id"in i){var w=e[n-1];if(n>0&&"id"in w)return console.error("Two variables in a row",e),{v:void 0};var S=t.getVariable(i.id),_=Tw.getDisplayedValue(S);return"number"===r&&Tw.isTextValue(S)&&Array.isArray(S.textValue)&&1===S.textValue.length?_=parseFloat(_).toString():"boolean"===r&&Tw.isBoolean(S)?_=S?"true":"false":"boolean"===r&&Tw.isTextValue(S)&&!Array.isArray(S.textValue)&&(_='"'+_+'"'),a+=_,"continue"}return"string"===r?('"'!==i.name&&("+"!==i.name||i.escaped)&&(a+=i.name),"+"===i.name&&!i.escaped&&"\\"===a[a.length-1]&&(a=a.slice(0,-1)+i.name),"continue"):"and"===i.name?(a+="&&","continue"):"or"===i.name?(a+="||","continue"):"True"===i.name?(a+="true","continue"):"False"===i.name?(a+="false","continue"):"boolean"!==r||$k(i.name)||Kk.includes(i.name)||Qk.includes(i.name)||Jk.includes(i.name.replace(/\($/g,""))?void(a+=i.name):(a+='"'+i.name+'"',"continue")},s=0;s":return Number(tT(e.left)>tT(e.right));case">=":return Number(tT(e.left)>=tT(e.right));case"<":return Number(tT(e.left)=1)try{t=tT(e.arguments[0])}catch(ag){console.warn(ag)}if(e.arguments.length>=2)try{n=tT(e.arguments[1])}catch(ag){console.warn(ag)}return t=Math.min(n,t),n=Math.max(n,t),t+Math.random()*(n-t)}return Math[e.callee.name].apply(null,e.arguments.map(tT))}throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}Zk.addBinaryOp("^",11,!0);var nT=new Nn,iT=new Nn;var rT=function(){function e(){(0,b.Z)(this,e)}return(0,w.Z)(e,null,[{key:"create",value:function(e){return this.build(this.normalizeInputs(e))}},{key:"normalizeInputs",value:function(e,t){var n,i,r,a,o,s=Object.assign({},null!==(n=null===t||void 0===t?void 0:t.parameters)&&void 0!==n?n:{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters),l=Math.abs(s.width),u=Math.abs(null!==(i=s.height)&&void 0!==i?i:s.width),c=Math.abs(null!==(r=s.depth)&&void 0!==r?r:0),h=null!==(a=null===t||void 0===t?void 0:t.shapeData)&&void 0!==a?a:UC.create({parameters:k(k({},Fb),{},{width:"number"==typeof Fb.width?Fb.width:100,height:"number"==typeof Fb.height?Fb.height:100})}).userData.shape;return{path:null!==(o=e.path)&&void 0!==o?o:Eb.defaultData(),parameters:Object.assign(s,{width:l,height:u,depth:c,extrusion:k(k({},Vb),s.extrusion)}),shapeData:h}}},{key:"build",value:function(e){if(e.path.points.length>=2){var t=new aT(e);return Object.assign(t,{userData:k(k({},e),{},{type:"PathGeometry"})})}return Object.assign(new Fi,{userData:k(k({},e),{},{type:"PathGeometry"})})}}]),e}(),aT=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).type="PathExtrusionGeometry",i.inputs=e,i.build(),i}return(0,w.Z)(n,[{key:"_isGeometryClosed",value:function(){return this.inputs.path.isClosed&&1===this.inputs.parameters.extrusion.depth}},{key:"_isOpenEnded",value:function(){var e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&1===e.depth)||!function(e,t){var n=2*Math.PI;return(e%n+n)%n===(t%n+n)%n}(e.twist,0)||e.startScale!==e.endScale}},{key:"build",value:function(){var e=this,t=this._extractPathPoints();if(!(t.length<2)){var n=this._computeBasisMatrices(t),i=this.inputs.parameters.extrusion,r=i.depth,a=i.offset;r=Math.max(0,Math.min(r,1)),a=Math.max(0,Math.min(a,1));for(var o=this.inputs.path.isClosed?t.length:t.length-1,s=Math.floor(a*o),u=this.inputs.path.isClosed?Math.ceil((r+a)*o):Math.ceil(Math.min(1,r+a)*o),c=Math.min(Math.max(2,u-s+1),o+2),h=[],d=[],f=0;f0?this.inputs.parameters.extrusion.capType:"flat",M=5;"Custom"===this.inputs.parameters.extrusion.shape.type&&(M="low"===this.inputs.parameters.extrusion.shape.shapeQuality?5:12);var E,C=this._computeShapePoints(M),k=C.regions,T=C.infos,P=C.vertices,D=0;"round"===A&&(D=(E=new LC(this.inputs.shapeData,2*S,S,M,_,void 0,!0)).getAttribute("position").count);var O=0,I=0;T.sort((function(e,t){return e.start-t.start})),T.forEach((function(e){e.verticesStart=O,e.verticesCount=e.continuous.reduce((function(e,t,n){return e+(0!==n&&t?1:2)}),0),I+=e.verticesCount,O=I}));var R,L=I*c,B=0;if(this._isOpenEnded()&&"flat"===A){try{R=AC({windingRule:QE.ODD,elementType:KE.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:k})}catch(H){R=IC}B=R.vertexCount}var z=L+2*B+2*D,F=L+2*B,N={positions:new Float32Array(3*z),normals:new Float32Array(3*z),uvs:new Float32Array(2*z)},U=[];if(T.forEach((function(t){e._extrudeRegion(t,P,d,h,N,U,e._isGeometryClosed()&&!e._isOpenEnded())})),R&&(this._closeEnd(R,L,U,N,d[0],h[0],!1),this._closeEnd(R,L+B,U,N,d[d.length-1],h[h.length-1],!0)),E){N.positions.set(E.getAttribute("position").array,3*F),N.normals.set(E.getAttribute("normal").array,3*F),N.uvs.set(E.getAttribute("uv").array,2*F);for(var Z=F;Z.001&&i.push(e)})),this.inputs.path.isClosed&&i[i.length-1].distanceTo(i[0])<.001&&i.pop(),i}},{key:"_computeBasisMatrices",value:function(e){for(var t=[],n=e.length,i=this.inputs.path.isClosed,r=new un,a=new un,o=new un,s=new un,l=new un(0,1,0),u=0;u0&&(S*=-1);for(var A=1;A0&&void 0!==arguments[0]?arguments[0]:12,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:QE.ODD,r=this.inputs.shapeData,a=r.extractShapePointsToFlatArray([],n),o=r.shapeHoles.map((function(e){for(var t=e.extractShapePointsToFlatArray([],n),i=[],r=t.length-1;r>=1;r-=2){var a=t[r-1],o=t[r-0];i.push(a,o)}return i}));try{e=AC({windingRule:i,elementType:KE.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]})}catch(le){e=DC}try{t=AC({windingRule:QE.ODD,elementType:KE.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:(0,l.Z)(o)})}catch(ue){t=OC}if(!e)throw new Error("error generating geometry");var s=e.elementCount;if(t){e.elementCount+=t.elementCount;for(var u=0;ux&&(x=M),Ew&&(w=E)}for(var C=[],k=e.elementCount-1;k>=0;k--){var T=k>=s,P=2*k,D=e.elements[P+0],O=e.elements[P+1],I=D+O,R={start:D,count:O,normals:[],isHole:T,continuous:[],verticesStart:0,verticesCount:0};C.push(R);var L=D,B=I-1,z=D+1,F=r.roundedCurves.length;do{var N,U=L-D,Z=e.vertices[2*B+0],V=e.vertices[2*B+1],j=e.vertices[2*L+0],G=e.vertices[2*L+1],H=e.vertices[2*z+0],W=e.vertices[2*z+1],q=j-Z,X=G-V,Y=Math.sqrt(q*q+X*X);q/=Y,X/=Y;var Q=j-H,K=G-W,J=Math.sqrt(Q*Q+K*K);Q/=J,K/=J,R.normals[2*U+0]=-K,R.normals[2*U+1]=Q;var $=e.vertexIndices[L];if(Array.isArray($))R.continuous[U]=!1;else{var ee=r.getCurveIndexFromVertexId($-1,!0),te=(0,h.Z)(ee,2),ne=te[0],ie=te[1];if(ie>0&&ie<1)R.continuous[U]=!0;else{var re=1===ie?ne+1:ne-1;re=(re+F)%F;var ae=1===ie?0:1,oe=r.roundedCurves[ne].getTangent(ie),se=r.roundedCurves[re].getTangent(ae);R.continuous[U]=oe.dot(se)>.95}}T&&(R.normals[2*U+0]*=-1,R.normals[2*U+1]*=-1),B=(N=[L,z,z+1])[0],L=N[1],(z=N[2])>=I&&(z-=O)}while(z!==D+1)}return{regions:[a].concat((0,l.Z)(o)),infos:C,vertices:e.vertices}}},{key:"_insertVertex",value:function(e,t,n,i,r){var a=2*t,o=3*t;e.positions[o+0]=n.x,e.positions[o+1]=n.y,e.positions[o+2]=n.z,e.normals[o+0]=i.x,e.normals[o+1]=i.y,e.normals[o+2]=i.z,e.uvs[a+0]=r.x,e.uvs[a+1]=r.y}},{key:"_extrudeRegion",value:function(e,t,n,i,r,a,o){var s=this,l=new un,u=new un,c=new un,h=new un,d=new Dt;n.forEach((function(a,o){for(var f=i[o],v=e.verticesStart*n.length+e.verticesCount*o,p=0;pa&&(o[o.length-1].length&&o.push(""),t.getTextWidth(o[o.length-1]+s,e)>a&&(1===s.length?(o[o.length-1]+=s,s=""):(o[o.length-1]+=s.slice(0,-1),s=s[s.length-1],o.push(""))))}}catch(c){l.e(c)}finally{l.f()}return o[o.length-1]+=s,o}(e,i,2===c?d.toUpperCase():3===c?d.toLowerCase():d,t),v=i.generateShapes(f,e,t),p=v.shapes,m=v.charWidths,g=v.charCoords,y=.5*("number"==typeof r?r:Number(t.getVariable(r))),x=.5*("number"==typeof a?a:Number(t.getVariable(a))),b=p.map((function(e){return(new rC).fromShape(e,!0)}));this.vectorShapes=b;var w=b.map((function(e){return FC.create({shape:e,parameters:{depth:o,extrudeBevelSegments:l,extrudeBevelSize:s,windingRule:o<=0?QE.NONZERO:QE.ODD,subdivisions:n.isLowResolution&&o>0?1:12}})})),S=w.length?CS(w):oT();S.translate(-y,x,0),this.dispose(),this.wrappedText=f,this.charCoords=g,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(S.attributes).forEach((function(e){var t=(0,h.Z)(e,2),i=t[0],r=t[1];n.setAttribute(i,r)})),this.setIndex(S.index),this.computeBoundingSphere()}else console.warn("Cannot update text because its font is not loaded")}},{key:"clone",value:function(){var e=iw(new Fi,n.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}},{key:"copy",value:function(e){var t=this;return Object.entries(e.attributes).forEach((function(e){var n=(0,h.Z)(e,2),i=n[0],r=n[1];t.setAttribute(i,r)})),this.setIndex(e.index),this.userData={parameters:k({},e.userData.parameters),type:"TextGeometry"},this}},{key:"setText",value:function(){var e=(0,c.Z)(x().mark((function e(t,n){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.font,!e.t0){e.next=4;break}return e.next=4,this.font.loadingPromise;case 4:return e.next=6,this.update(k(k({},this.userData.parameters),{},{text:{textValue:t}}),n);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"text",get:function(){var e;return null!==(e=this.userData.parameters.text)&&void 0!==e?e:""}}]),n}(Fi);var uT,cT,hT=new Promise((function(e){uT=e})),dT=!1;function fT(e){if(!dT)return cT||(cT=function(){return t.apply(this,arguments)}());function t(){return(t=(0,c.Z)(x().mark((function t(){var i,r,a,o,s,l,u,c;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=null!==e&&void 0!==e?e:"https://unpkg.com/@splinetool/modelling-wasm@1.12.81/build",r=n.e(99694).then(n.bind(n,13787)),t.next=4,Promise.all([r,fetch("".concat(i,"/process.wasm")).then((function(e){return e.arrayBuffer()}))]);case 4:return a=t.sent,o=(0,h.Z)(a,2),s=o[0],l=o[1],u=s.default,t.next=11,u({wasmBinary:l});case 11:c=t.sent,uT(c),dT=!0;case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}}var vT=["font"];function pT(e,t,n,i){var r,a,o;"PathGeometry"===e.type?(a=JSON.parse(JSON.stringify(e)),o=[[],["extrusion"]]):(a=k({},e),o=[[]]);var s,u=D(o);try{for(u.s();!(s=u.n()).done;){var c,h=s.value,d=a,f=D(h);try{for(f.s();!(c=f.n()).done;){d=d[c.value]}}catch(A){f.e(A)}finally{f.f()}for(r in d){var v=d[r];ib(v)&&!vT.includes(r)&&(d[r]=t.getVariable(v,[i.uuid,"geometry"].concat((0,l.Z)(h),[r])),ib(d[r])&&(d[r]=1))}}}catch(A){u.e(A)}finally{u.f()}var p,m={parameters:a,type:a.type};if("PathGeometry"===a.type)m.path=a.path;else if("VectorGeometry"===a.type){var g=rC.createFromState(a.shape,a.width,a.height);m.shape=g}else if("NonParametricGeometry"===a.type){var y;if(a.data.groups&&null!==(y=a.data.groups)&&void 0!==y&&y.forEach((function(e){var t;return e.materialIndex=Math.max(null!==(t=e.materialIndex)&&void 0!==t?t:0,0)})),m.geometry=(new Cu).parse(a),0===m.geometry.groups.length){var x,b,w=m.geometry;w.addGroup(0,Math.max(null!==(x=null===(b=w.getIndex())||void 0===b?void 0:b.count)&&void 0!==x?x:0,w.getAttribute("position").count),0)}}else{if("SubdivGeometry"===a.type){var S=new AT(a,n);return S.data=e,S}if("TextGeometry"===a.type)return new lT(a,t);if("InputGeometry"===a.type)return new lT(a,t);if("UIGeometry"===a.type)return Ek.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}try{p=qT(m)}catch(g){console.error(g),console.error("Error generating geometry with inputs: ".concat(m));var _=rC.createFromState(Mb.defaultData(),100,100);m.shape=_,m.type="VectorGeometry",p=qT(m)}return p}var mT=new Nn;function gT(e,t,n,i){for(var r,a,o,s=e.position.array,l=e.normal.array,u=mT.makeScale(t,n,i).invert().elements,c=0,h=s.length;c0)try{yT.set_destination_refinement_level(o,e.subdivisions),l=n.buildLevel(o,!1,u)}catch(c){try{yT.set_destination_refinement_level(o,e.subdivisions-1),l=n.buildLevel(o,!1,u)}catch(h){l=null}}else l=null;return{subdivPointer:o,originalGeometry:s,subdividedGeometry:l}}},{key:"primitiveToQuads",value:function(e,t,n){var i;e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),"DodecahedronGeometry"===e.type&&(e.detail=0);var r,a,o,s=void 0!==e.shape||void 0!==e.path?t.geometry:pT(e,n,!1,t);r="TorusGeometry"===e.type&&e.arc===2*Math.PI?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();var l,u=ET(s.getAttribute("position"),r);if(a=u.positions,o=u.triIndices,"CylinderGeometry"===e.type&&0===e.cornerRadius&&0===e.hollow&&!1===e.openEnded){var c=e.radialSegments*e.heightSegments*3*2;l=[c,c+3*e.radialSegments]}return{positions:a,indices:(i=DT(a,o,s,l)).indices,verticesPerFace:i.verticesPerFace}}},{key:"allocate",value:function(e,t){var n,i,r,a,o,s=[],u=[];e.positionWASM&&e.positionWASM.length>0?(r=e.positionWASM,a=e.indexWASM,o=e.verticesPerFaceWASM):(r=wT,a=ST,o=_T);var c,h=r.length,d=a.length,f=o.length,v=r.length+s.length+u.length,p=a.length+o.length,m=v*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,g=v*Float32Array.BYTES_PER_ELEMENT,y=yT._malloc(m),x=new Float32Array(yT.HEAPF32.buffer,y,v),b=new Uint32Array(yT.HEAPU32.buffer,y+g,p);x.set(r,0),x.set(s,r.length),x.set(u,r.length+s.length),b.set(a,0),b.set(o,a.length),null!==e&&void 0!==e&&null!==(n=e.scaleBaked)&&void 0!==n&&n.some((function(e){return 1!==e}))&&(c=(i=new Nn).makeScale.apply(i,(0,l.Z)(e.scaleBaked.map((function(e){return"number"==typeof e?e:1}))))),t&&(c?c.premultiply(t):c=t);var w=c?yT.alloc_subdivision_surface2(y,h,y+g,d,y+g+a.length*Uint32Array.BYTES_PER_ELEMENT,f,c.elements):yT.alloc_subdivision_surface(y,h,y+g,d,y+g+a.length*Uint32Array.BYTES_PER_ELEMENT,f);return yT._free(y),w}},{key:"buildLevel",value:function(e,t,n,i,r){var a=r?yT.get_mesh_data2(e,t?yT.Level.CONTROL:yT.Level.REFINED,n,r.elements):yT.get_mesh_data(e,t?yT.Level.CONTROL:yT.Level.REFINED,n),o=yT.HEAPU32.subarray(a>>2,8+(a>>2)),s=o.subarray(4,8),l=0,u=yT.HEAPU32[o[l]>>2],c=yT.HEAPF32.subarray(u>>2,(u>>2)+s[l]);l++;var h=yT.HEAPU32[o[l]>>2],d=yT.HEAPF32.subarray(h>>2,(h>>2)+s[l]);l++;var f=yT.HEAPU32[o[l]>>2],v=yT.HEAPU32.subarray(f>>2,(f>>2)+s[l]);l++;var p=yT.HEAPU32[o[l]>>2],m=yT.HEAPU32.subarray(p>>2,(p>>2)+s[l]);if(l++,void 0===i){var g=new Fi;if(g.setIndex(new Ti(m,1)),g.setAttribute("position",new Pi(c,3)),g.setAttribute("normal",new Pi(d,3)),t){g.setAttribute("faceMap",new Ti(v,1));var y=new Float32Array(d.length/3*4).fill(0);g.setAttribute("color",new Ci(y,4))}return yT.free_mesh_data(a),g.userData.type="SubdivGeometry",g}i.getAttribute("position").copyArray(c),i.getAttribute("normal").copyArray(d),i.attributes.position.needsUpdate=!0,i.attributes.normal.needsUpdate=!0,yT.free_mesh_data(a)}},{key:"freeSubdivPointer",value:function(e){yT.free_bvh(e),yT.free_subdivision_surface(e)}},{key:"buildControlCageWireframe",value:function(e,t,n){var i=yT.get_wireframe_data_for_base_level(e),r=yT.HEAPU32.subarray(i>>2,4+(i>>2)),a=r.subarray(2,4),o=0,s=yT.HEAPU32[r[o]>>2],l=yT.HEAPF32.subarray(s>>2,(s>>2)+a[o]);o++;var u=yT.HEAPU32[r[o]>>2],c=yT.HEAPU32.subarray(u>>2,(u>>2)+a[o]);if(void 0===t){var h=new Fi;h.setAttribute("position",new Pi(l,3));for(var d=new Float32Array(l.length),f=0,v=l.length;f>2,6+(r>>2)),o=a.subarray(3,6),s=0,l=yT.HEAPU32[a[s]>>2],u=new Float32Array(yT.HEAPF32.subarray(l>>2,(l>>2)+o[s]));s++;var c=yT.HEAPU32[a[s]>>2],h=new Uint32Array(yT.HEAPU32.subarray(c>>2,(c>>2)+o[s]));s++;var d=yT.HEAPU32[a[s]>>2],f=new Uint8Array(yT.HEAPU32.subarray(d>>2,(d>>2)+o[s]));return yT.free_topological_data(r),{positions:u,indices:h,verticesPerFace:f}}}]),n}(Fi),MT=["getX","getY","getZ"];function ET(e,t){for(var n={},i=t?t.count:e.count,r=0,a=[],o=[],s=0;s=360){var l=o.length/2/s;o=o.filter((function(e,t){return Math.floor(t/2)%l===0}))}for(var u=0,c=0;c=0;f-=2)e.push(o[f],o[f+1],0),r.push(h++);return a.push(h),{indices:r,verticesPerFace:a}}for(var v=new Float32Array([n.userData.parameters.depth])[0],p=0;p.005||i&&i.some((function(e,t){return t%2!==1&&(o>=i[t]&&o>2,6+(i>>2)),a=r.subarray(3,6),o=0,s=RT.HEAPU32[r[o]>>2],l=new Float32Array(RT.HEAPF32.subarray(s>>2,(s>>2)+a[o]));o++;var u=RT.HEAPU32[r[o]>>2],c=new Uint32Array(RT.HEAPU32.subarray(u>>2,(u>>2)+a[o]));o++;var h=RT.HEAPU32[r[o]>>2],d=new Uint8Array(RT.HEAPU32.subarray(h>>2,(h>>2)+a[o]));return RT.free_mesh_data(i),{positions:l,indices:c,verticesPerFace:d}}function ZT(e,t,n,i){void 0===LT&&(LT=RT.init_csg());var r=FT(e),a=RT.csg_calc(LT,r,e.length,i,NT(t));RT._free(r);var o=RT.HEAPU32.subarray(a>>2,5+(a>>2)),s=o.subarray(2,5),l=0,u=RT.HEAPU32[o[l]>>2],c=RT.HEAPF32.subarray(u>>2,(u>>2)+s[l]);l++;var h=RT.HEAPU32[o[l]>>2],d=RT.HEAPF32.subarray(h>>2,(h>>2)+s[l]),f=s[++l];n.setAttribute("position",new Pi(c,3)),n.setAttribute("normal",new Pi(d,3));var v=RT.HEAPF32.subarray(5+(a>>2),5+(a>>2)+6);return null===n.boundingSphere&&(n.boundingSphere=new Pn),n.boundingSphere.center.set(v[0],v[1],v[2]),n.boundingSphere.radius=Math.pow(Math.pow(v[3],2)+Math.pow(v[4],2)+Math.pow(v[5],2),.5),n.userData.parameters={width:2*v[3],height:2*v[4],depth:2*v[5]},RT.free_mesh_data(a),f}function VT(e,t,n){if(void 0===RT)return-1;var i,r,a;if(t&&void 0!==e.userData.positions){var o=e.userData;a=o.verticesPerFace.length,i=o.positions,r=Array(o.verticesPerFace.reduce((function(e,t){return e+t}),0)+a);for(var s=0,l=0,u=0;s0&&void 0!==arguments[0]&&arguments[0];return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),XT(this.parent)?this.parent.invalidateDownstreamBooleanData():this}},{key:"invalidateUpstreamBooleanData",value:function(){this.freeBooleanPointer();var e,t=D(this.children);try{for(t.s();!(e=t.n()).done;){var i=e.value;i instanceof n&&(i.freeBooleanPointer(),XT(i)&&i.invalidateUpstreamBooleanData())}}catch(r){t.e(r)}finally{t.f()}}},{key:"updateTransformState",value:function(e,t){var i=(0,d.Z)((0,m.Z)(n.prototype),"updateTransformState",this).call(this,e,t);return i&&XT(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}},{key:"onVariableUpdate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,d.Z)((0,m.Z)(n.prototype),"onVariableUpdate",this).call(this,e),XT(this.parent)&&this.invalidateDownstreamBooleanData(!0)}}]),n}(lE(Ji)),QT=new dn;function KT(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.count,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,a=1/0,o=1/0,s=1/0,l=-1/0,u=-1/0,c=-1/0,h=t;hl&&(l=d),f>u&&(u=f),v>c&&(c=v)}QT.min.set(a,o,s),QT.max.set(l,u,c),QT.getCenter(i),QT.getSize(r).multiplyScalar(.5)}var JT=new Fi,$T=new Ai,eP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,JT,$T)).super_Entity(e,i),r}return(0,w.Z)(n,[{key:"updateState",value:function(e,t){this.updateState_Entity(e,t)}},{key:"updateEntityBoxSize",value:function(e,t){var i=this.geometry.getAttribute("position");void 0!==i?KT(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):(0,d.Z)((0,m.Z)(n.prototype),"updateEntityBoxSize",this).call(this,e,t)}}]),n}(YT),tP=function(){function e(t){if((0,b.Z)(this,e),this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},null===e.uuidContext)throw new Error("plz startContext");e.uuidContext===e.globalContext?this.uuid="_gid"+e.uuidContext.nodeContextUuid++:this.uuid="_uid"+e.uuidContext.nodeContextUuid++,this.type=t,this.name=""}return(0,w.Z)(e,[{key:"analyze",value:function(e,t){var n;t=null!==(n=t)&&void 0!==n?n:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}},{key:"analyzeAndFlow",value:function(e,t,n){var i;return n=null!==(i=n)&&void 0!==i?i:{},this.analyze(e,n),this.flow(e,t,n)}},{key:"flow",value:function(e,t,n){var i;n=null!==(i=n)&&void 0!==i?i:{},e.addFlow(n.slot,n.cache,n.context);var r={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),r}},{key:"build",value:function(e,t,n){var i;t=null!==(i=t)&&void 0!==i?i:this.getType(e,t);var r=e.getNodeData(null!==n&&void 0!==n?n:this);return e.analyzing&&this.appendDepsNode(e,r,t),-1===e.nodes.indexOf(this)&&e.nodes.push(this),void 0!==this.updateFrame&&-1===e.updaters.indexOf(this)&&e.updaters.push(this),this.generate(e,t,n)}},{key:"updateFrame",value:function(e){}},{key:"generateReadonly",value:function(e,t,n,i,r,a){return""}},{key:"generate",value:function(e,t,n,i,r){return""}},{key:"parse",value:function(e,t,n,i){}},{key:"appendDepsNode",value:function(e,t,n){t.deps=(t.deps||0)+1;var i=e.getTypeLength(n);(i>(t.outputMax||0)||this.getType(e,n))&&(t.outputMax=i,t.output=n)}},{key:"setName",value:function(e){this.name=e}},{key:"getName",value:function(){return this.name}},{key:"getType",value:function(e,t){return"sampler2D"===t||"samplerCube"===t?t:this.type}}],[{key:"startContext",value:function(t){null===this.uuidContext||this.uuidContext===e.globalContext?this.uuidContext=t:console.error("Can't start context twice")}},{key:"endContext",value:function(e){this.uuidContext!==e&&console.error("Can't end context twice"),this.uuidContext=null}}]),e}(),nP=tP;nP.globalContext={nodeContextUuid:0},nP.uuidContext=tP.globalContext;var iP=function(){function e(t){var n;(0,b.Z)(this,e),t=null!==(n=t)&&void 0!==n?n:{},this.name=t.name,this.type=t.type,this.node=t.node,this.size=t.size,this.needsUpdate=t.needsUpdate}return(0,w.Z)(e,[{key:"value",get:function(){return this.node.value},set:function(e){this.node.value=e}}]),e}(),rP=new(function(){function e(){(0,b.Z)(this,e),this.nodes={},this.keywords={}}return(0,w.Z)(e,[{key:"add",value:function(e){this.nodes[e.name]=e}},{key:"addKeyword",value:function(e,t,n){n=void 0===n||n,this.keywords[e]={callback:t,cache:n}}},{key:"remove",value:function(e){delete this.nodes[e.name]}},{key:"removeKeyword",value:function(e){delete this.keywords[e]}},{key:"get",value:function(e){return this.nodes[e]}},{key:"getKeyword",value:function(e,t){return this.keywords[e].callback(t)}},{key:"getKeywordData",value:function(e){return this.keywords[e]}},{key:"contains",value:function(e){return void 0!==this.nodes[e]}},{key:"containsKeyword",value:function(e){return void 0!==this.keywords[e]}}]),e}()),aP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a;return(0,b.Z)(this,n),(a=t.call(this,e)).scope="",i=null!==(r=i)&&void 0!==r?r:{},a.shared=void 0===i.shared||i.shared,a.unique=void 0!==i.unique&&i.unique,a}return(0,w.Z)(n,[{key:"build",value:function(e,t,i,r){var a;if(t=null!==(a=t)&&void 0!==a?a:this.getType(e),this.getShared(e,t)){var o,s=this.getUnique(e,t);s&&void 0===this.uuid&&(this.uuid=Pt.generateUUID()),i=e.getUUID(null!==(o=i)&&void 0!==o?o:this.getUUID(),!s);var l=e.getNodeData(i),u=l.output||this.getType(e);if(e.analyzing)return(l.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,l,t),this.generate(e,t,i)):(0,d.Z)((0,m.Z)(n.prototype),"build",this).call(this,e,t,i);if(s)return l.name=l.name||(0,d.Z)((0,m.Z)(n.prototype),"build",this).call(this,e,t,i),l.name;if(!this.getLabel()&&(!this.getShared(e,u)||e.context.ignoreCache||1===l.deps))return(0,d.Z)((0,m.Z)(n.prototype),"build",this).call(this,e,t,i);i=this.getUUID(!1);var c=this.getTemp(e,i);if(c)return e.format(c,u,t);c=(0,d.Z)((0,m.Z)(n.prototype),"generate",this).call(this,e,t,i,l.output,r);var h=this.generate(e,u,i);return e.addNodeCode(c+" = "+h+";"),e.format(c,u,t)}return(0,d.Z)((0,m.Z)(n.prototype),"build",this).call(this,e,t,i)}},{key:"getShared",value:function(e,t){return"sampler2D"!==t&&"samplerCube"!==t&&this.shared}},{key:"getUnique",value:function(e,t){return this.unique}},{key:"setLabel",value:function(e){return this.label=e,this}},{key:"getLabel",value:function(){return this.label}},{key:"getUUID",value:function(e){var t=this.uuid;return"string"==typeof this.scope&&(t=this.scope+"-"+t),t}},{key:"getTemp",value:function(e,t){t=t||this.uuid;var n=e.getVars()[t];return n?n.name:void 0}},{key:"generate",value:function(e,t,n,i,r){var a;return this.getShared(e,t)||console.error("TempNode is not shared"),n=null!==(a=n)&&void 0!==a?a:this.uuid,e.getTempVar(n,null!==i&&void 0!==i?i:this.getType(e),r,this.getLabel()).name}}]),n}(nP),oP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a;return(0,b.Z)(this,n),(i=null!==(r=i)&&void 0!==r?r:{}).shared=void 0!==i.shared&&i.shared,(a=t.call(this,e,i)).readonly=!1,a}return(0,w.Z)(n,[{key:"setReadonly",value:function(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}},{key:"getReadonly",value:function(){return this.readonly}},{key:"generate",value:function(e,t,n,i,r,a){var o,s;n=e.getUUID(null!==(o=n)&&void 0!==o?o:this.getUUID()),i=null!==(s=i)&&void 0!==s?s:this.getType(e);var l=e.getNodeData(n);return this.getReadonly()&&void 0!==this.generateReadonly?this.generateReadonly(e,t,n,i,r,a):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(i,this,r,a,this.getLabel())),e.format(l.vertex.name,i,t)):(l.fragment||(l.fragment=e.createFragmentUniform(i,this,r,a,this.getLabel())),e.format(l.fragment.name,i,t))}}]),n}(aP),sP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1?arguments[1]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"v2")).nodeType="Vector2",e.value=i instanceof Dt?i:new Dt(i,r),e}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format("vec2("+this.value.x+", "+this.value.y+")",i,t)}},{key:"x",get:function(){return this.value.x},set:function(e){this.value.x=e}},{key:"y",get:function(){return this.value.y},set:function(e){this.value.y=e}}]),n}(oP),lP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"v3")).nodeType="Vector3",e.value=i instanceof un?i:new un(i,r,a),e}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",i,t)}},{key:"x",get:function(){return this.value.x},set:function(e){this.value.x=e}},{key:"y",get:function(){return this.value.y},set:function(e){this.value.y=e}},{key:"z",get:function(){return this.value.z},set:function(e){this.value.z=e}}]),n}(oP),uP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"v4")).nodeType="Vector4",i.value=e instanceof I_?e:new I_(e.r,e.g,e.b,e.a),i}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",i,t)}}]),n}(oP),cP=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,hP=/[a-z_0-9]+/gi,dP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o){var s;return(0,b.Z)(this,n),(s=t.call(this,o)).src="",s.nodeType="Function",s.useKeywords=!0,s.includes=[],s.extensions={},s.keywords={},s.isMethod=void 0===o,s.isInterface=!1,s.parse(e,i,r,a),s}return(0,w.Z)(n,[{key:"getShared",value:function(e,t){return!this.isMethod}},{key:"getType",value:function(e){return e.getTypeByFormat(this.type)}},{key:"getInputByName",value:function(e){if(this.inputs)for(var t=this.inputs.length;t--;)if(this.inputs[t].name===e)return this.inputs[t]}},{key:"getIncludeByName",value:function(e){if(this.includes)for(var t=this.includes.length;t--;)if(this.includes[t].name===e)return this.includes[t]}},{key:"generate",value:function(e,t,n,i,r){var a,o=0,s=this.src;if(this.includes)for(var l=0;l0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;return(0,b.Z)(this,n),(e=t.call(this)).src="",e.useDefine=!1,e.nodeType="Const",e.parse(i||n.PI,void 0,void 0,void 0,r),e}return(0,w.Z)(n,[{key:"getType",value:function(e){return e.getTypeByFormat(this.type)}},{key:"parse",value:function(e,t,n,i,r){this.src=e||"";var a,o,s="",l=fP.exec(e);this.useDefine=null!==r&&void 0!==r?r:"#"===this.src.charAt(0),l&&l.length>1?(o=l[1],a=l[2],s=l[3]):(a=this.src,o="f"),this.name=a,this.type=o,this.value=s}},{key:"build",value:function(e,t){if("source"===t){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}},{key:"generate",value:function(e,t,n,i,r){return e.format(this.name,this.getType(e),t)}}]),n}(aP);vP.PI="PI",vP.PI2="PI2",vP.RECIPROCAL_PI="RECIPROCAL_PI",vP.RECIPROCAL_PI2="RECIPROCAL_PI2",vP.LOG2="LOG2",vP.EPSILON="EPSILON";var pP=new RegExp("^structs*([a-z_0-9]+)s*{s*((.|\n)*?)}","gim"),mP=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),gP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return(0,b.Z)(this,n),(e=t.call(this)).inputs=[],e.src="",e.nodeType="Struct",e.parse(i),e}return(0,w.Z)(n,[{key:"getType",value:function(e){return e.getTypeByFormat(this.name)}},{key:"getInputByName",value:function(e){for(var t=this.inputs.length;t--;)if(this.inputs[t].name===e)return this.inputs[t]}},{key:"generate",value:function(e,t,n,i,r){return"source"===t?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}},{key:"parse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.src=e,this.inputs=[];var t=pP.exec(e);if(t){for(var n,i=t[2];n=mP.exec(i);)this.inputs.push({type:n[1],name:n[2]});this.name=t[1]}else this.name="";this.type=this.name}}]),n}(aP),yP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"v2",{shared:!1})).nodeType="UV",i.index=null!==e&&void 0!==e?e:0,i}return(0,w.Z)(n,[{key:"generate",value:function(e,t){e.requires.uv[this.index]=!0;var n=this.index>0?this.index+1:"",i=e.isShader("vertex")?"uv"+n:"vUv"+n;return e.format(i,this.getType(e),t)}}]),n}(aP);rP.addKeyword("uv",(function(){return new yP})),rP.addKeyword("uv2",(function(){return new yP(1)}));var xP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,"v4")).nodeType="ColorSpace",r.input=e,r.method=null!==i&&void 0!==i?i:n.LINEAR_TO_LINEAR,r.hashProperties=["method"],r}return(0,w.Z)(n,[{key:"generate",value:function(e,t){var i,r=this.input.build(e,"v4"),a=this.getType(e),o=n.Nodes[this.method],s=e.include(o);if(s===n.LINEAR_TO_LINEAR)return e.format(r,a,t);if(2===(null===(i=o.inputs)||void 0===i?void 0:i.length)){var l=this.factor.build(e,"f");return e.format(s+"( "+r+", "+l+" )",a,t)}return e.format(s+"( "+r+" )",a,t)}},{key:"fromEncoding",value:function(e){var t=n.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}},{key:"fromDecoding",value:function(e){var t=n.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}}],[{key:"getEncodingComponents",value:function(e){switch(e){case ot:return["Linear"];case st:return["sRGB"];default:return[]}}}]),n}(aP);xP.Nodes={LinearToLinear:new dP(["vec4 LinearToLinear( in vec4 value ) {","\treturn value;","}"].join("\n")),sRGBToLinear:new dP(["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 dP(["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"))},xP.LINEAR_TO_LINEAR="LinearToLinear",xP.SRGB_TO_LINEAR="sRGBToLinear",xP.LINEAR_TO_SRGB="LinearTosRGB";var bP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return(0,b.Z)(this,n),(e=t.call(this,i,s,o,a,r)).nodeType="Expression",e}return n}(dP),wP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tn,r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"v4",{shared:!0})).nodeType="Texture",e.value=i,e.uv=null!==r&&void 0!==r?r:new yP,e.bias=a,e.project=void 0!==o&&o,e}return(0,w.Z)(n,[{key:"getTexture",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"generate",this).call(this,e,t,this.value.uuid,"t")}},{key:"generate",value:function(e,t){var n;if("sampler2D"===t)return this.getTexture(e,t);var i,r,a=this.getTexture(e,t),o=this.uv.build(e,this.project?"v4":"v2"),s=this.bias?this.bias.build(e,"f"):void 0;void 0===s&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f")),i=this.project?"texture2DProj":s?"tex2DBias":"tex2D",r=s?i+"( "+a+", "+o+", "+s+" )":i+"( "+a+", "+o+" )";var l={include:e.isShader("vertex"),ignoreCache:!0},u=this.getType(e);return e.addContext(l),this.colorSpace=null!==(n=this.colorSpace)&&void 0!==n?n:new xP(new bP("",u)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(r),r=this.colorSpace.build(e,u),e.removeContext(),e.format(r,u,t)}}]),n}(oP),SP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"f")).nodeType="Float",i.value=null!==e&&void 0!==e?e:0,i}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format(this.value+(this.value%1?"":".0"),i,t)}}]),n}(oP),_P=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this)).inputs=[],r.nodeType="FunctionCall",r.value=e,r.inputs=null!==i&&void 0!==i?i:[],r}return(0,w.Z)(n,[{key:"getFunction",value:function(){return this.value}},{key:"getType",value:function(e){return this.value.getType(e)}},{key:"generate",value:function(e,t,n,i,r){i=this.getType(e);var a=this.value,o=a.build(e,t)+"( ",s=[];if(a.inputs){for(var l=0;l2&&void 0!==arguments[2]?arguments[2]:n.ADD;return(0,b.Z)(this,n),(r=t.call(this)).nodeType="Operator",r.type=e.type,r.a=e,r.b=i,r.op=a,r}return(0,w.Z)(n,[{key:"getType",value:function(e){var t=this.a.getType(e),n=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(n)>e.getTypeLength(t)?n:t}},{key:"generate",value:function(e,t){var n=this.getType(e);this.type=n;var i=this.a.build(e,n),r=this.b.build(e,n);return e.format("( "+i+" "+this.op+" "+r+" )",n,t)}}]),n}(aP);AP.ADD="+",AP.SUB="-",AP.MUL="*",AP.DIV="/";var MP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.ABS,a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;return(0,b.Z)(this,n),(i=t.call(this)).nodeType="Math",i.a=e,"string"!=typeof r?i.b=r:o=r,"string"!=typeof a?i.c=a:o=a,i.method=o,i.hashProperties=["method"],i}return(0,w.Z)(n,[{key:"getNumInputs",value:function(e){switch(this.method){case n.MIX:case n.CLAMP:case n.REFRACT:case n.SMOOTHSTEP:case n.FACEFORWARD:return 3;case n.MIN:case n.MAX:case n.MOD:case n.STEP:case n.REFLECT:case n.DISTANCE:case n.DOT:case n.CROSS:case n.POW:return 2;default:return 1}}},{key:"getInputType",value:function(e){var t=e.getTypeLength(this.a.getType(e)),n=this.b?e.getTypeLength(this.b.getType(e)):0,i=this.c?e.getTypeLength(this.c.getType(e)):0;return t>n&&t>i?this.a.getType(e):n>i?this.b.getType(e):this.c.getType(e)}},{key:"getType",value:function(e){switch(this.method){case n.LENGTH:case n.DISTANCE:case n.DOT:return"f";case n.CROSS:return"v3"}return this.getInputType(e)}},{key:"generate",value:function(e,t){var i,r,a,o=this.a?e.getTypeLength(this.a.getType(e)):0,s=this.b?e.getTypeLength(this.b.getType(e)):0,l=this.c?e.getTypeLength(this.c.getType(e)):0,u=this.getInputType(e),c=this.getType(e);switch(this.type=c,this.method){case n.NEGATE:return e.format("( -"+this.a.build(e,u)+" )",u,t);case n.INVERT:return e.format("( 1.0 - "+this.a.build(e,u)+" )",u,t);case n.CROSS:i=this.a.build(e,"v3"),r=this.b.build(e,"v3");break;case n.STEP:i=this.a.build(e,1===o?"f":u),r=this.b.build(e,u);break;case n.MIN:case n.MAX:case n.MOD:i=this.a.build(e,u),r=this.b.build(e,1===s?"f":u);break;case n.REFRACT:i=this.a.build(e,u),r=this.b.build(e,u),a=this.c.build(e,"f");break;case n.MIX:i=this.a.build(e,u),r=this.b.build(e,u),a=this.c.build(e,1===l?"f":u);break;default:i=this.a.build(e,u),this.b&&(r=this.b.build(e,u)),this.c&&(a=this.c.build(e,u))}var h=[];h.push(i),r&&h.push(r),a&&h.push(a);var d=this.getNumInputs(e);if(h.length!==d)throw Error('Arguments not match used in "'.concat(this.method,'". Require ').concat(d,", currently ").concat(h.length,"."));return e.format(this.method+"( "+h.join(", ")+" )",c,t)}}]),n}(aP);MP.RAD="radians",MP.DEG="degrees",MP.EXP="exp",MP.EXP2="exp2",MP.LOG="log",MP.LOG2="log2",MP.SQRT="sqrt",MP.INV_SQRT="inversesqrt",MP.FLOOR="floor",MP.CEIL="ceil",MP.NORMALIZE="normalize",MP.FRACT="fract",MP.SATURATE="saturate",MP.SIN="sin",MP.COS="cos",MP.TAN="tan",MP.ASIN="asin",MP.ACOS="acos",MP.ARCTAN="atan",MP.ABS="abs",MP.SIGN="sign",MP.LENGTH="length",MP.NEGATE="negate",MP.INVERT="invert",MP.MIN="min",MP.MAX="max",MP.MOD="mod",MP.STEP="step",MP.REFLECT="reflect",MP.DISTANCE="distance",MP.DOT="dot",MP.CROSS="cross",MP.POW="pow",MP.MIX="mix",MP.CLAMP="clamp",MP.REFRACT="refract",MP.SMOOTHSTEP="smoothstep",MP.FACEFORWARD="faceforward";var EP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,"v4")).nodeType="TextureCubeUV",a.value=e,a.uv=i,a.bias=r,a}return(0,w.Z)(n,[{key:"bilinearCubeUV",value:function(e,t,i,r){var a,o,s,l,u=new _P(n.Nodes.bilinearCubeUV,[t,i,r]);this.colorSpaceTL=null!==(a=this.colorSpaceTL)&&void 0!==a?a:new xP(new bP("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(u.build(e)+".tl"),this.colorSpaceTR=null!==(o=this.colorSpaceTR)&&void 0!==o?o:new xP(new bP("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(u.build(e)+".tr"),this.colorSpaceBL=null!==(s=this.colorSpaceBL)&&void 0!==s?s:new xP(new bP("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(u.build(e)+".bl"),this.colorSpaceBR=null!==(l=this.colorSpaceBR)&&void 0!==l?l:new xP(new bP("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(u.build(e)+".br");var c={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(c),this.colorSpaceTLExp=new bP(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new bP(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new bP(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new bP(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();var h=new bP("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return h.keywords.cubeUV_TL=this.colorSpaceTLExp,h.keywords.cubeUV_TR=this.colorSpaceTRExp,h.keywords.cubeUV_BL=this.colorSpaceBLExp,h.keywords.cubeUV_BR=this.colorSpaceBRExp,h.keywords.cubeUV=u,h}},{key:"generate",value:function(e,t){if(e.isShader("fragment")){var i=this.uv,r=this.bias||e.context.roughness,a=new _P(n.Nodes.roughnessToMip,[r]),o=new MP(a,n.Nodes.m0,n.Nodes.cubeUV_maxMipLevel,MP.CLAMP),s=new MP(o,MP.FLOOR),l=new MP(o,MP.FRACT),u=this.bilinearCubeUV(e,this.value,i,s),c=this.bilinearCubeUV(e,this.value,i,new AP(s,new SP(1).setReadonly(!0),AP.ADD)),h=new MP(u,c,l,MP.MIX);return e.format(h.build(e),"v4",t)}return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}}]),n}(aP);EP.Nodes=function(){var e=new gP("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}"),t=new vP("float cubeUV_maxMipLevel 8.0",!0),n=new vP("float cubeUV_minMipLevel 4.0",!0),i=new vP("float cubeUV_maxTileSize 256.0",!0),r=new vP("float cubeUV_minTileSize 16.0",!0),a=new dP("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}");a.useKeywords=!1;var o=new dP("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}");o.useKeywords=!1;var s=new dP("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}",[e,a,o,t,n,i,r]);s.useKeywords=!1;var l=new vP("float r0 1.0",!0),u=new vP("float v0 0.339",!0),c=new vP("float m0 -2.0",!0),h=new vP("float r1 0.8",!0),d=new vP("float v1 0.276",!0),f=new vP("float m1 -1.0",!0),v=new vP("float r4 0.4",!0),p=new vP("float v4 0.046",!0),m=new vP("float m4 2.0",!0),g=new vP("float r5 0.305",!0),y=new vP("float v5 0.016",!0),x=new vP("float m5 3.0",!0),b=new vP("float r6 0.21",!0),w=new vP("float v6 0.0038",!0),S=new vP("float m6 4.0",!0);return{bilinearCubeUV:s,roughnessToMip:new dP("float roughnessToMip(float roughness) {\n\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,u,c,h,d,f,v,p,m,g,y,x,b,w,S]),m0:c,cubeUV_maxMipLevel:t}}();var CP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"v3")).nodeType="Normal",i.scope=null!==e&&void 0!==e?e:n.VIEW,i}return(0,w.Z)(n,[{key:"getShared",value:function(){return this.scope===n.WORLD}},{key:"build",value:function(e,t,i,r){var a=e.context[this.scope+"Normal"];return a?a.build(e,t,i,r):(0,d.Z)((0,m.Z)(n.prototype),"build",this).call(this,e,t,i)}},{key:"generate",value:function(e,t,i,r,a){var o;switch(this.scope){case n.VIEW:o=e.isShader("vertex")?"transformedNormal":"geometryNormal";break;case n.LOCAL:e.isShader("vertex")?o="objectNormal":(e.requires.normal=!0,o="vObjectNormal");break;case n.WORLD:e.isShader("vertex")?o="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,o="vWNormal")}return e.format(o,this.getType(e),t)}}]),n}(aP);CP.LOCAL="local",CP.WORLD="world",CP.VIEW="view",CP.NORMAL="normal",rP.addKeyword("viewNormal",(function(){return new CP(CP.VIEW)})),rP.addKeyword("localNormal",(function(){return new CP(CP.NORMAL)})),rP.addKeyword("worldNormal",(function(){return new CP(CP.WORLD)}));var kP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"v3")).nodeType="Position",i.scope=null!==e&&void 0!==e?e:n.LOCAL,i}return(0,w.Z)(n,[{key:"getType",value:function(){switch(this.scope){case n.PROJECTION:return"v4"}return this.type}},{key:"getShader",value:function(){switch(this.scope){case n.LOCAL:case n.WORLD:return!1}return!0}},{key:"generate",value:function(e,t,i,r,a){var o;switch(this.scope){case n.LOCAL:e.isShader("vertex")?o="transformed":(e.requires.position=!0,o="vPosition");break;case n.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,o="vWPosition";break;case n.VIEW:o=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case n.PROJECTION:o=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )"}return e.format(o,this.getType(),t)}}]),n}(aP);kP.LOCAL="local",kP.WORLD="world",kP.VIEW="view",kP.PROJECTION="projection",rP.addKeyword("position",(function(){return new kP})),rP.addKeyword("worldPosition",(function(){return new kP(kP.WORLD)})),rP.addKeyword("viewPosition",(function(){return new kP(kP.VIEW)}));var TP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"v3")).nodeType="Reflect",i.scope=null!==e&&void 0!==e?e:n.CUBE,i}return(0,w.Z)(n,[{key:"getUnique",value:function(e){return!e.context.viewNormal}},{key:"getType",value:function(){switch(this.scope){case n.SPHERE:return"v2"}return this.type}},{key:"generate",value:function(e,t){var i=this.getUnique(e);if(e.isShader("fragment")){var r;switch(this.scope){case n.VECTOR:var a=new CP(CP.VIEW),o=e.context.roughness,s=a.build(e,"v3"),l=new kP(kP.VIEW).build(e,"v3"),u=o?o.build(e,"f"):void 0,c="reflect( -normalize( ".concat(l," ), ").concat(s," )");u&&(c="normalize( mix( ".concat(c,", ").concat(s,", ").concat(u," * ").concat(u," ) )"));var h="inverseTransformDirection( ".concat(c,", viewMatrix )");i?(e.addNodeCode("vec3 reflectVec = ".concat(h,";")),r="reflectVec"):r=h;break;case n.CUBE:var d=new n(n.VECTOR).build(e,"v3"),f="vec3( -"+d+".x, "+d+".yz )";i?(e.addNodeCode("vec3 reflectCubeVec = ".concat(f,";")),r="reflectCubeVec"):r=f;break;case n.SPHERE:var v="normalize( ( viewMatrix * vec4( "+new n(n.VECTOR).build(e,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(e.addNodeCode("vec2 reflectSphereVec = ".concat(v,";")),r="reflectSphereVec"):r=v}return e.format(r,this.getType(),t)}return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t)}}]),n}(aP);TP.CUBE="cube",TP.SPHERE="sphere",TP.VECTOR="vector";var PP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new wP,r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"v4")).nodeType="TextureCube",e.value=i,e.radianceNode=new EP(e.value,null!==r&&void 0!==r?r:new TP(TP.VECTOR),a),e.irradianceNode=new EP(e.value,new CP(CP.WORLD),new SP(1).setReadonly(!0)),e}return(0,w.Z)(n,[{key:"generate",value:function(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),("irradiance"===e.slot?this.irradianceNode:this.radianceNode).build(e,t)):(console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t))}}]),n}(aP),DP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new cr,r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"v4",{shared:!0})).nodeType="CubeTexture",e.value=i,e.uv=null!==r&&void 0!==r?r:new TP,e.bias=a,e}return(0,w.Z)(n,[{key:"getTexture",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"generate",this).call(this,e,t,this.value.uuid,"tc")}},{key:"generate",value:function(e,t){var n,i;if("samplerCube"===t)return this.getTexture(e,t);var r,a=this.getTexture(e,t),o=null===(n=this.uv)||void 0===n?void 0:n.build(e,"v3"),s=this.bias?this.bias.build(e,"f"):void 0;void 0===s&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f")),r=s?"texCubeBias( "+a+", "+o+", "+s+" )":"texCube( "+a+", "+o+" )";var l={include:e.isShader("vertex"),ignoreCache:!0},u=this.getType(e);return e.addContext(l),this.colorSpace=null!==(i=this.colorSpace)&&void 0!==i?i:new xP(new bP("",u)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(r),r=this.colorSpace.build(e,u),e.removeContext(),e.format(r,u,t)}}]),n}(oP),OP=["x","y","z","w"],IP=["float","vec2","vec3","vec4"],RP={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},LP={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[]"},BP=function(){function e(){(0,b.Z)(this,e),this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.needsJitter=!0,this.getIncludesCode=function(){function e(e,t){return e.deps.length-t.deps.length}return function(t,n){var i=this.getIncludes(t,n);if(!i)return"";var r="";i=i.sort(e);for(var a=0;a","#include "].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}return(0,w.Z)(e,[{key:"build",value:function(e,t){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",e),this.buildShader("fragment",t);for(var n=0;n0?n+1:"";this.addVaryCode("varying vec2 vUv"+i+";"),n>0&&this.addVertexParsCode("attribute vec2 uv"+i+";"),this.addVertexFinalCode("vUv"+i+" = uv"+i+";")}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)).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}},{key:"buildShader",value:function(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}},{key:"setMaterial",value:function(e,t){return this.defines={},this}},{key:"addFlow",value:function(e,t,n){return this.addSlot(e).addCache(t).addContext(n)}},{key:"removeFlow",value:function(){return this.removeSlot().removeCache().removeContext()}},{key:"addCache",value:function(e){return this.cache=null!==e&&void 0!==e?e:"",this.caches.push(this.cache),this}},{key:"removeCache",value:function(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}},{key:"addContext",value:function(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}},{key:"removeContext",value:function(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}},{key:"addSlot",value:function(e){return this.slot=e||"",this.slots.push(this.slot),this}},{key:"removeSlot",value:function(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}},{key:"addFragmentVariable",value:function(e,t){void 0===this.fragmentVariables[e]&&(this.addFragmentCode("".concat(t," ").concat(e,";")),this.fragmentVariables[e]="")}},{key:"addFragmentParsVariable",value:function(e,t){void 0===this.fragmentParsVariables[e]&&(this.addFragmentParsCode("".concat(t," ").concat(e,";")),this.fragmentParsVariables[e]="")}},{key:"addVertexParsVariable",value:function(e,t){void 0===this.vertexParsVariables[e]&&(this.addVertexParsCode("".concat(t," ").concat(e,";")),this.vertexParsVariables[e]="")}},{key:"addVertexCode",value:function(e){this.addCode(e,"vertex")}},{key:"addFragmentCode",value:function(e){this.addCode(e,"fragment")}},{key:"addCode",value:function(e,t){this.code[null!==t&&void 0!==t?t:this.shader]+=e+"\n"}},{key:"addVertexNodeCode",value:function(e){this.addNodeCode(e,"vertex")}},{key:"addFragmentNodeCode",value:function(e){this.addNodeCode(e,"fragment")}},{key:"addNodeCode",value:function(e,t){this.nodeCode[null!==t&&void 0!==t?t:this.shader]+=e+"\n"}},{key:"clearNodeCode",value:function(e){var t;e=null!==(t=e)&&void 0!==t?t:this.shader;var n=this.nodeCode[e];return this.nodeCode[e]="",n}},{key:"clearVertexNodeCode",value:function(){return this.clearNodeCode("vertex")}},{key:"clearFragmentNodeCode",value:function(){return this.clearNodeCode("fragment")}},{key:"addVertexFinalCode",value:function(e){this.addFinalCode(e,"vertex")}},{key:"addFragmentFinalCode",value:function(e){this.addFinalCode(e,"fragment")}},{key:"addFinalCode",value:function(e,t){this.finalCode[null!==t&&void 0!==t?t:this.shader]+=e+"\n"}},{key:"addVertexParsCode",value:function(e){this.addParsCode(e,"vertex")}},{key:"addFragmentParsCode",value:function(e){this.addParsCode(e,"fragment")}},{key:"addParsCode",value:function(e,t){this.parsCode[null!==t&&void 0!==t?t:this.shader]+=e+"\n"}},{key:"addVaryCode",value:function(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}},{key:"isCache",value:function(e){return-1!==this.caches.indexOf(e)}},{key:"isSlot",value:function(e){return-1!==this.slots.indexOf(e)}},{key:"define",value:function(e,t){this.defines[e]=void 0===t?1:t}},{key:"require",value:function(e){this.requires[e]=!0}},{key:"isDefined",value:function(e){return void 0!==this.defines[e]}},{key:"getVar",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"varying",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"V",a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",o=this.getVars(i),s=o[e];if(!s){var l=o.length;s={name:n||"node"+r+l+(a?"_"+a:""),type:t},o.push(s),o[e]=s}return s}},{key:"getTempVar",value:function(e,t,n,i){return this.getVar(e,t,n,this.shader,"T",i)}},{key:"getAttribute",value:function(e,t){if(!this.attributes[e]){var n=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(n.name+" = "+e+";"),this.attributes[e]={varying:n,name:e,type:t}}return this.attributes[e]}},{key:"getCode",value:function(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join("\n")}},{key:"getVarListCode",value:function(e,t){var n;t=null!==(n=t)&&void 0!==n?n:"";for(var i="",r=0,a=e.length;r0&&void 0!==arguments[0]?arguments[0]:0,r=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"c")).nodeType="Color",e.value=i instanceof I_?i:new I_(i||0,r,a,o),e}return(0,w.Z)(n,[{key:"setRGBA",value:function(e){this.value.setRGBA(e.r,e.g,e.b,e.a)}},{key:"generate",value:function(e,t,n,i,r,a){var o,s;n=e.getUUID(null!==(o=n)&&void 0!==o?o:this.getUUID()),i=null!==(s=i)&&void 0!==s?s:this.getType(e);var l=e.getNodeData(n),u=this.getReadonly()&&void 0!==this.generateReadonly;if(this.alpha){var c=this.alpha.build(e,"f");e.addFragmentNodeCode("accumAlpha += ( 1.0 - accumAlpha ) * ".concat(c,";"))}return u?this.generateReadonly(e,t,n,i,r,a):e.isShader("vertex")?(l.vertex||(l.vertex=e.createVertexUniform(i,this,r,a,this.getLabel())),e.format(l.vertex.name,i,t)):(l.fragment||(l.fragment=e.createFragmentUniform(i,this,r,a,this.getLabel())),e.format(l.fragment.name,i,t))}},{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",i,t)}}]),n}(oP),FP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"i")).nodeType="Int",i.value=Math.floor(null!==e&&void 0!==e?e:0),i}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format(this.value.toString(),i,t)}}]),n}(oP),NP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"b")).nodeType="Bool",i.value=null!==e&&void 0!==e&&e,i}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i){return e.format(this.value?"true":"false",i,t)}}]),n}(oP),UP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1?arguments[1]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"f[]")).nodeType="FloatArray",e.size=i,e.value=Array.isArray(r)?r:"number"==typeof r?new Array(i).fill(r):new Array(i).fill(0),e}return n}(oP),ZP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(oP),VP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"v3")).image=e,i._value=new un,i}return(0,w.Z)(n,[{key:"value",get:function(){var e,t;return this._value.x=this.image.isVideo?null!==(e=this.image.img.videoWidth)&&void 0!==e?e:0:this.image.img.width,this._value.y=this.image.isVideo?null!==(t=this.image.img.videoHeight)&&void 0!==t?t:0:this.image.img.height,this._value}}]),n}(ZP),jP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1008,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1006;return(0,b.Z)(this,n),(r=t.call(this,"t")).image=e,r.wrap=i,r.minFilter=a,r.magFilter=o,r}return(0,w.Z)(n,[{key:"value",get:function(){return this.image.getTexture(this.wrap,this.minFilter,this.magFilter)}}]),n}(ZP),GP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"m3")).nodeType="Matrix3",i.value=null!==e&&void 0!==e?e:new Ot,i}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format("mat3("+this.value.elements.join(", ")+")",i,t)}},{key:"elements",get:function(){return this.value.elements},set:function(e){this.value.fromArray(e)}}]),n}(oP),HP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,"m4")).nodeType="Matrix4",i.value=null!==e&&void 0!==e?e:new Nn,i}return(0,w.Z)(n,[{key:"generateReadonly",value:function(e,t,n,i,r,a){return e.format("mat4("+this.value.elements.join(", ")+")",i,t)}},{key:"elements",get:function(){return this.value.elements},set:function(e){this.value.fromArray(e)}}]),n}(oP);function WP(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;e.setUvTransform(n[0],n[1],t[0],t[1],0,0,0).premultiply((new Ot).makeRotation(i*Pt.DEG2RAD))}var qP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return(0,b.Z)(this,n),(r=t.call(this,new Ot)).repeat=e,r.offset=i,r.rotation=a,WP(r.value,e,i,a),r}return(0,w.Z)(n,[{key:"updateMatrix",value:function(){WP(this.value,this.repeat,this.offset,this.rotation)}}]),n}(GP),XP=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1?arguments[1]:void 0;return(0,b.Z)(this,n),(e=t.call(this,"v4[]")).nodeType="Vector4Array",e.size=i,e.value=Array.isArray(r)?r:r instanceof nn?new Array(i).fill(r):new Array(i).fill(new nn(0)),e}return n}(oP),YP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a){var o;return(0,b.Z)(this,n),(o=t.call(this,"v3")).nodeType="Blend",o.a=e,o.b=i,o.alpha=r,o.mode=a,o}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("fragment")){var n=[];return n.push(this.a.build(e,"c")),n.push(this.b.build(e,"c")),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),e.format("spe_blend("+n.join(",")+")",this.getType(e),t)}return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP),QP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,"v3")).nodeType="CustomColor",r.color=e,r.alpha=i,r.calpha="g".concat(r.uuid.toString().replace(/-/g,""),"_calpha"),r}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("fragment")){var i=e.include(n.Nodes.customColor);e.addFragmentVariable(this.calpha,"float");var r=[];return r.push(this.color.build(e,"v3")),r.push(this.mask?"luminance(".concat(this.mask.build(e,"v3"),")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("CustomColorNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);QP.Nodes={customColor:new dP("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 KP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,"v3")).nodeType="CustomNormal",r.cnormal=e,r.alpha=i,r.calpha="g".concat(r.uuid.toString().replace(/-/g,""),"_calpha"),r}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("fragment")){var i=e.include(n.Nodes.customNormal);e.addFragmentVariable(this.calpha,"float");var r=[];return r.push(this.cnormal.build(e,"v3")),r.push("normal"),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);KP.Nodes={customNormal:new dP("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 JP=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h,d,f){var v;return(0,b.Z)(this,n),(v=t.call(this,"v3")).nodeType="CustomTexture",v.texture=e,v.textureSize=i,v.crop=r,v.projection=a,v.axis=o,v.side=s,v.size=l,v.blending=u,v.mat=c,v.isMask=f,v.alpha=h,v.mode=d,v.calpha="g".concat(v.uuid.toString().replace(/-/g,""),"_calpha"),v}return(0,w.Z)(n,[{key:"generate",value:function(e,t){e.require("position"),e.require("normal"),e.require("uv"),e.requires.uv=[!0],e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0;var i,r="g".concat(this.uuid.toString().replace(/-/g,""));switch(this.projection.value){case 3:i=e.include(n.Nodes.cylindrical);break;case 2:i=e.include(n.Nodes.spherical);break;case 1:var a=["vec3(1.0, 0.0, 0.0)","vec3(0.0, 1.0, 0.0)","vec3(0.0, 0.0, 1.0)"][this.axis.value],o=["zy","xz","xy"][this.axis.value],s=new dP("\n\t\tvec3 ".concat(r,"_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.").concat(o,")) / 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").concat(2===this.side.value?"":"lalpha *= step(0.0, ".concat(1===this.side.value?"-1.0 * ":"","dot(vObjectNormal, ").concat(a,"));"),"\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=e.include(s);break;case 4:i=e.include(n.Nodes.triplanar);break;default:i=e.include(n.Nodes.uv)}e.addFragmentVariable(this.calpha,"float");var l=[];if(l.push("normal"),l.push(this.texture.generate(e,"t")),l.push(this.textureSize.build(e,"v2")),l.push(this.crop.build(e,"f")),l.push(this.mat.build(e,"mat3")),l.push(this.size.build(e,"v2")),l.push(this.blending.build(e,"f")),l.push(this.isMask.build(e,"b")),l.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),l.push(this.alpha.build(e,"f")),l.push(this.mode.build(e,"i")),l.push(this.calpha),4===this.projection.value){var u="".concat(r,"_writeUvs"),c=u+"0",h=u+"1",d=u+"2",f="".concat(r,"_triplanarWeights");e.addFragmentVariable(c,"vec2"),e.addFragmentVariable(h,"vec2"),e.addFragmentVariable(d,"vec2"),e.addFragmentVariable(f,"vec3"),l.push(c),l.push(h),l.push(d),l.push(f)}else{var v="".concat(r,"_writeUvs");e.addFragmentVariable(v,"vec2"),l.push(v)}return e.format(i+"("+l.join(",")+")",this.getType(e),t)}}]),n}(aP);JP.Nodes={cylindrical:new dP("\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 dP("\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 dP("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 dP("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;\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 $P=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h,d,f){var v;return(0,b.Z)(this,n),(v=t.call(this,"v3")).nodeType="Depth",v.gradientType=e,v.smooth=i,v.near=r,v.far=a,v.isVector=o,v.isWorldSpace=s,v.origin=l,v.direction=u,v.colors=c,v.steps=h,v.isMask=f,v.alpha=d,v.calpha="g".concat(v.uuid.toString().replace(/-/g,""),"_calpha"),v}return(0,w.Z)(n,[{key:"generate",value:function(e,t){var i="g".concat(this.uuid.toString().replace(/-/g,"")),r=new dP("vec3 ".concat(i,"_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[").concat(i,"_MAX_COLORS], float steps[").concat(i,"_MAX_COLORS], bool isMask, float mask, float alpha, out float calpha) {\n vec4 color = colors[0];\n #ifdef ").concat(i,"_IS_VECTOR\n #ifdef ").concat(i,"_LINEAR\n #ifdef ").concat(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 ").concat(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 ").concat(i,"_SMOOTH\n\t\t\t\tfor ( int i = 1; i < ").concat(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 < ").concat(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}"),[n.Nodes.vectorLinearWorldSpaceDepth,n.Nodes.vectorLinearObjectSpaceDepth,n.Nodes.vectorSphericalObjectSpaceDepth,n.Nodes.vectorSphericalWorldSpaceDepth]);if(e.isShader("fragment")){e.define("".concat(i,"_MAX_COLORS"),this.colors.value.length),this.smooth.value&&e.define("".concat(i,"_SMOOTH")),this.isVector.value>.5&&e.define("".concat(i,"_IS_VECTOR")),0===this.gradientType.value&&e.define("".concat(i,"_LINEAR")),this.isWorldSpace.value>.5&&e.define("".concat(i,"_WORLDSPACE")),e.require("worldPosition"),e.addFragmentVariable(this.calpha,"float");var a=e.include(r),o=[];return o.push(this.near.build(e,"f")),o.push(this.far.build(e,"f")),o.push(this.origin.build(e,"v3")),o.push(this.direction.build(e,"v3")),o.push(this.colors.build(e,"v4[]")),o.push(this.steps.build(e,"f[]")),o.push(this.isMask.build(e,"b")),o.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),o.push(this.alpha.build(e,"f")),o.push(this.calpha),e.format(a+"("+o.join(",")+")",this.getType(e),t)}return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);$P.Nodes={vectorLinearWorldSpaceDepth:new dP("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 dP("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 dP("float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {\n float dist = length(vWPosition - origin);\n return ( dist - near ) / ( far - near );\n }"),vectorSphericalObjectSpaceDepth:new dP("float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {\n float dist = length(position - origin);\n return ( dist - near ) / ( far - near );\n }")};var eD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u){var c;return(0,b.Z)(this,n),(c=t.call(this,"v3")).nodeType="Fresnel",c.color=e,c.bias=i,c.scale=r,c.intensity=a,c.factor=o,c.isMask=u,c.alpha=s,c.mode=l,c.calpha="g".concat(c.uuid.toString().replace(/-/g,""),"_calpha"),c}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");var n=new dP("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}"),i=e.include(n),r=[];return r.push(this.color.build(e,"c")),r.push(this.bias.build(e,"f")),r.push(this.scale.build(e,"f")),r.push(this.intensity.build(e,"f")),r.push(this.factor.build(e,"f")),r.push(this.isMask.build(e,"b")),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP),tD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c){var h;return(0,b.Z)(this,n),(h=t.call(this,"v3")).nodeType="Gradient",h.gradientType=e,h.smooth=i,h.colors=r,h.steps=a,h.offset=o,h.morph=s,h.angle=l,h.isMask=c,h.alpha=u,h.calpha="g".concat(h.uuid.toString().replace(/-/g,""),"_calpha"),h}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("fragment")){e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");var i=e.include(n.Nodes.gradient),r=[];return r.push(this.gradientType.build(e,"i")),r.push(this.smooth.build(e,"b")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.offset.build(e,"v2")),r.push(this.morph.build(e,"v2")),r.push(this.angle.build(e,"f")),r.push(this.isMask.build(e,"b")),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);tD.Nodes={gradient:new dP("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}\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 nD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o){var s;return(0,b.Z)(this,n),(s=t.call(this,"v3")).nodeType="Matcap",s.texture=e,s.isMask=a,s.alpha=i,s.mode=r,s.calpha="g".concat(s.uuid.toString().replace(/-/g,""),"_calpha"),s.rotation=o,s}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");var i=e.include(n.Nodes.matcap);e.require("normal"),e.requires.normal=!0;var r=[];return r.push(this.texture.generate(e,"t")),r.push("normal"),r.push(this.isMask.build(e,"b")),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),r.push(this.calpha),r.push(this.rotation.build(e,"f")),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);nD.Nodes={matcap:new dP("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}")};var iD=function(){var e=new dP("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}"),t=new dP("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}",[e]);t.keywords.F3=new vP("float F3 0.3333333"),t.keywords.G3=new vP("float G3 0.1666667");var n=new dP("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}",[e]);n.keywords.F3=new vP("float F3 0.3333333"),n.keywords.G3=new vP("float G3 0.1666667");var i=new dP("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}",[t]),r=new dP("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),a=new dP("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),o=new dP("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;\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,a]),s=new dP("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),l=new dP("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[s]),u=new dP("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 dP("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;\n\t\t}",[u]);c.keywords.NUM_OCTAVES=new vP("int NUM_OCTAVES ".concat(5));var h=new dP("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),d=new dP("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,a,h]),f=new dP("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}"),v=new dP("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}"),p=new dP("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}"),m=new dP("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}"),g=new dP("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 dP("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}");return{simplexFast:t,simplexPrecise:n,simplexFractal:i,simplexAshima:o,fbm:c,perlin:d,voronoi:new dP('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',[f,v,p,m,g,y])}}(),rD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h,d,f,v,p,m,g,y,x,w){var S;return(0,b.Z)(this,n),(S=t.call(this,"v3")).nodeType="Noise",S.scale=e,S.size=i,S.move=r,S.fA=a,S.fB=o,S.distortion=s,S.colorA=l,S.colorB=u,S.colorC=c,S.colorD=h,S.noiseType=f,S.voronoiStyle=p,S.highCut=m,S.lowCut=g,S.smoothness=y,S.seed=x,S.quality=w,S.isMask=v,S.alpha=d,S.calpha="g".concat(S.uuid.toString().replace(/-/g,""),"_calpha"),S}return(0,w.Z)(n,[{key:"generate",value:function(e,t,n,i,r){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");var a=["simplexFast","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseType.value],o="voronoi"==a?"\n\t\tfloat v = ".concat(a,'(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(".concat(a,"(st),\n\t\t\t\t\t ").concat(a,"(st + vec3(1.0)),\n\t\t\t\t\t ").concat(a,"(st + vec3(1.0)));\n\t\tvec3 r = vec3(").concat(a,"(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),\n\t\t\t\t\t ").concat(a,"(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), \n\t\t\t\t\t ").concat(a,"(st * q));\n\t\tfloat f = ").concat(a,"(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"),s=new dP("vec3 ".concat(a,"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").concat(o,"\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}"),[iD.simplexFast,iD.simplexFractal,iD.simplexAshima,iD.fbm,iD.perlin,iD.voronoi]),l=e.include(s),u=[];return u.push(this.scale.build(e,"f")),u.push(this.size.build(e,"v3")),u.push(this.move.build(e,"f")),u.push(this.fA.build(e,"v2")),u.push(this.fB.build(e,"v2")),u.push(this.distortion.build(e,"v2")),u.push(this.colorA.build(e,"v4")),u.push(this.colorB.build(e,"v4")),u.push(this.colorC.build(e,"v4")),u.push(this.colorD.build(e,"v4")),u.push(this.voronoiStyle.build(e,"i")),u.push(this.highCut.build(e,"f")),u.push(this.lowCut.build(e,"f")),u.push(this.smoothness.build(e,"f")),u.push(this.seed.build(e,"f")),u.push(this.quality.build(e,"i")),u.push(this.isMask.build(e,"b")),u.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),u.push(this.alpha.build(e,"f")),u.push(this.calpha),e.format(l+"("+u.join(",")+")",this.getType(e),t)}}]),n}(aP);rD.numOctaves=5;var aD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h,d,f,v,p,m,g){var y;return(0,b.Z)(this,n),(y=t.call(this,"v3")).nodeType="Outline",y.firstTime=!0,y.outlineColor=e,y.contourColor=i,y.outlineWidth=r,y.contourWidth=a,y.contourThreshold=o,y.outlineThreshold=s,y.contourFrequency=l,y.outlineSmoothing=u,y.contourDirection=c,y.positionalLines=h,y.compensation=d,y.resolution=f,y.normalMap=v,y.depthMap=p,y.pixelRatio=m,y.alpha=g,y.calpha="g".concat(y.uuid.toString().replace(/-/g,""),"_calpha"),y}return(0,w.Z)(n,[{key:"generate",value:function(e,t){var i="g".concat(this.uuid.toString().replace(/-/g,""));if(e.require("vWorldViewDir"),e.require("worldNormal"),e.extensions.derivatives=!0,this.compensation.value&&e.define("OUTLINE_COMPENSATION","".concat(i,"_offset")),this.firstTime){var r=this.outlineWidth.build(e,"f"),a=this.resolution.build(e,"v2"),o=this.compensation.build(e,"b"),s=this.pixelRatio.build(e,"f");e.addVertexParsVariable("randomColor","attribute vec3"),e.addVertexParsVariable("extrudeNormal","attribute vec3"),e.addVertexParsVariable(r,"uniform float"),e.addVertexParsVariable(a,"uniform vec2"),e.addVertexParsVariable(o,"uniform bool"),e.addVertexParsVariable(s,"uniform float"),e.addVertexParsVariable("vID","flat out float"),e.addFragmentParsVariable("vID","flat in float"),e.addVertexFinalCode("\n vID = randomColor.r;\n vec2 ".concat(i,"_offset = vec2(0.0);\n if (").concat(o,") {\n vec4 ").concat(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 ").concat(i,"_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001;\n ").concat(i,"_offset = normalize(").concat(i,"_clipNormal.xy) / ").concat(a," * (").concat(r," / 2.0) * ").concat(i,"_clipPosition.w * 2.0 * ").concat(s,";\n ").concat(i,"_clipPosition.xy += ").concat(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 = ").concat(i,"_clipPosition;\n }\n "))}if(e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");var l=e.include(n.Nodes.outline),u=[];return u.push(this.outlineColor.build(e,"c")),u.push(this.contourColor.build(e,"c")),u.push(this.outlineWidth.build(e,"f")),u.push(this.contourWidth.build(e,"f")),u.push(this.contourThreshold.build(e,"f")),u.push(this.outlineThreshold.build(e,"f")),u.push(this.contourFrequency.build(e,"f")),u.push(this.outlineSmoothing.build(e,"f")),u.push(this.contourDirection.build(e,"v3")),u.push(this.positionalLines.build(e,"b")),u.push(this.resolution.build(e,"v2")),u.push(this.normalMap.getTexture(e,"t")),u.push(this.depthMap.getTexture(e,"t")),u.push(this.pixelRatio.build(e,"f")),u.push(this.compensation.build(e,"b")),u.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),u.push(this.alpha.build(e,"f")),u.push(this.calpha),this.firstTime=!this.firstTime,e.format(l+"("+u.join(",")+")",this.getType(e),t)}return console.warn("OutlineNode is not compatible with "+e.shader+" shader."),""}}]),n}(aP);aD.Nodes=function(){var e=new dP("\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);\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 dP("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 }\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 }",[e])}}();var oD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h,d,f,v,p,m,g,y,x){var w;return(0,b.Z)(this,n),(w=t.call(this,"v3")).nodeType="Pattern",w.style=e,w.projection=i,w.axis=r,w.blending=a,w.offset=o,w.colorA=s,w.colorB=l,w.frequency=u,w.size=c,w.variation=h,w.smoothness=d,w.zigzag=f,w.rotation=v,w.vertical=p,w.horizontal=m,w.sides=g,w.isMask=x,w.alpha=y,w.calpha="g".concat(w.uuid.toString().replace(/-/g,""),"_calpha"),w}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("fragment")){var i;switch(e.require("position"),e.require("uv"),e.requires.uv=[!0],e.require("normal"),e.requires.normal=!0,e.addFragmentVariable(this.calpha,"float"),this.style.value){case 0: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";break;default:i="circle"}var r="g".concat(this.uuid.toString().replace(/-/g,"")),a=new dP("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}"),o=new dP("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}"),s="";if(4===this.projection.value){var l=2===this.style.value?"".concat(i,"(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)"):"".concat(i,"(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation)"),u=2===this.style.value?"".concat(i,"(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)"):"".concat(i,"(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)"),c=2===this.style.value?"".concat(i,"(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)"):"".concat(i,"(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)");s="\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 = ".concat(l,";\n\t\t\t\tfloat d1 = ").concat(u,";\n\t\t\t\tfloat d2 = ").concat(c,";\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{var h=2===this.style.value?"".concat(i,"(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)"):"".concat(i,"(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation)"),d="";0===this.axis.value?d="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?d="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,d="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);");var f="";switch(this.projection.value){case 0:f="custom_uv = vUv.st;";break;case 1:break;case 2:f="\n\t\t\t\t\t\t\tvec3 p = position;\n\t\t\t\t\t\t\t".concat(d,"\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")}s="\n\t\t\t\tvec2 custom_uv;\n\t\t\t\t".concat(f,"\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 = ").concat(h,";\n\t\t\t\t")}var v=new dP("vec3 ".concat(r,"_pattern(vec3 normal, float blending, int style, vec2 offset, vec4 colorA, vec4 colorB, vec2 frequency, float size, float variation, float smoothness, float zigzag, float rotation, vec2 vertical, vec2 horizontal, int sides, bool isMask, float mask, float alpha, out float calpha) {\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").concat(s,"\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);\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}"),[o,a,n.DrawFunctions.circle,n.DrawFunctions.ring,n.DrawFunctions.polygon,n.DrawFunctions.cross,n.DrawFunctions.diamond,n.DrawFunctions.checkerboard,n.DrawFunctions.line,n.DrawFunctions.wave]),p=e.include(v),m=[];return m.push("normal"),m.push(this.blending.build(e,"f")),m.push(this.style.build(e,"i")),m.push(this.offset.build(e,"v2")),m.push(this.colorA.build(e,"v4")),m.push(this.colorB.build(e,"v4")),m.push(this.frequency.build(e,"v2")),m.push(this.size.build(e,"f")),m.push(this.variation.build(e,"f")),m.push(this.smoothness.build(e,"f")),m.push(this.zigzag.build(e,"f")),m.push(this.rotation.build(e,"f")),m.push(this.vertical.build(e,"v2")),m.push(this.horizontal.build(e,"v2")),m.push(this.sides.build(e,"i")),m.push(this.isMask.build(e,"b")),m.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),m.push(this.alpha.build(e,"f")),m.push(this.calpha),e.format(p+"("+m.join(",")+")",this.getType(e),t)}return console.warn("PatterNode is not compatible with "+e.shader+" shader."),e.format("vec3(0.0)",this.getType(e),t)}}]),n}(aP);oD.DrawFunctions=function(){var e=new dP("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}"),t=new dP("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 }",[e]);return{tileAndCenter:t,circle:new dP("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 }",[t]),ring:new dP("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 }",[t]),polygon:new dP("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 }",[t]),cross:new dP("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 }",[t]),diamond:new dP("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 }",[t]),checkerboard:new dP("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 dP("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 }",[t]),wave:new dP("// 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; 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 sD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u){var c;return(0,b.Z)(this,n),(c=t.call(this,"v3")).nodeType="Rainbow",c.filmThickness=e,c.movement=i,c.wavelengths=r,c.noiseStrength=a,c.noiseScale=o,c.offset=s,c.isMask=u,c.alpha=l,c.calpha="g".concat(c.uuid.toString().replace(/-/g,""),"_calpha"),c}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");var i=e.include(n.Nodes.rainbow),r=[];return r.push(this.filmThickness.build(e,"f")),r.push(this.movement.build(e,"f")),r.push(this.wavelengths.build(e,"v3")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.offset.build(e,"v3")),r.push(this.isMask.build(e,"b")),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);sD.Nodes=function(){var e=new dP("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 }",[iD.simplexFast]);return{rainbow:new dP("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 }",[e])}}();var lD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h){var d;return(0,b.Z)(this,n),(d=t.call(this,"v3")).nodeType="Toon",d.positioning=e,d.colors=i,d.steps=r,d.source=a,d.isWorldSpace=o,d.noiseStrength=s,d.noiseScale=l,d.shadowColor=u,d.offset=c,d.alpha=h,d.calpha="g".concat(d.uuid.toString().replace(/-/g,""),"_calpha"),d}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.require("worldNormal"),e.require("worldPosition"),e.isShader("fragment")){e.define("COLORS_MAX",10),e.addFragmentVariable(this.calpha,"float");var i=e.include(n.Nodes.toon),r=[];return r.push(this.positioning.build(e,"i")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.source.build(e,"v3")),r.push(this.isWorldSpace.build(e,"b")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.shadowColor.build(e,"v4")),r.push(this.offset.build(e,"v3")),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("ToonNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);lD.Nodes=function(){var e=new dP("float rand(float n) {\n\t\t\t\treturn fract(sin(n) * 43758.5453123);\n\t\t\t}"),t=new dP("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}"),n=new dP("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 -> 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}",[t]),i=new dP("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 dP('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',[i]);return{toon:new dP('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; 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}\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 }',[iD.simplexFast,e,n,r])}}();var uD={textureBicubic:new dP("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 }")};function cD(e,t){return e>=t?new Dt(t/e,1):new Dt(1,e/t)}var hD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u){var c;return(0,b.Z)(this,n),(c=t.call(this,"v3")).nodeType="Transmission",c.thickness=e,c.ior=i,c.roughness=r,c.transmissionSamplerSize=a,c.transmissionSamplerMap=o,c.transmissionDepthMap=s,c.aspectRatio=l,c.alpha=u,c.calpha="g".concat(c.uuid.toString().replace(/-/g,""),"_calpha"),c}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,e.isShader("fragment")){e.define("NUM_SAMPLES",6),e.define("BLUR_SLOD",Math.pow(2,vD.transmissionLod.value)),e.require("worldPosition"),e.requires.worldNormal=!0,e.requires.modelMatrix=!0,e.requires.projectionMatrix=!0,e.addFragmentVariable(this.calpha,"float");var i=e.include(n.Nodes.transmission),r=[];return r.push(this.thickness.build(e,"f")),r.push(this.ior.build(e,"f")),r.push(this.roughness.build(e,"f")),r.push(this.transmissionSamplerSize.build(e,"v2")),r.push(this.transmissionSamplerMap.getTexture(e,"t")),r.push(this.transmissionDepthMap.getTexture(e,"t")),r.push(this.aspectRatio.build(e,"v2")),r.push("normal"),r.push(this.mask?"luminance(".concat(this.mask.flow(e,"v3").result,")"):"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);hD.Nodes=function(){var e=new dP("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 }"),t=new dP("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 }"),n=new dP("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}"),i=new dP('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}',[uD.textureBicubic,n,e]),r=new dP("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.\n\t\t\t\treturn getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );\n \t\t}",[i,t]);return{transmission:new dP("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 dD=function(e){return e.NOISE="noise",e.MAP="map",e}(dD||{}),fD=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c,h,d){var f;return(0,b.Z)(this,n),(f=t.call(this,"v3")).displacementTypeIndex=new FP(0),f.nodeType="VertexDisplacement",f.intensity=e,f.movementOrTexture=i,"map"===Object.values(dD)[f.displacementTypeIndex.value]&&(f.mat=new GP(f.movementOrTexture.value.matrix)),f.cropOrOffset=r,f.scale=h,f.noiseFunctionIndex=d,f.voronoiStyle=a,f.smoothness=o,f.seed=s,f.highCut=l,f.lowCut=u,f.quality=c,f}return(0,w.Z)(n,[{key:"generate",value:function(e,t){if(e.isShader("vertex")){e.define("USE_LAYER_DISPLACE");var i,r=[];switch(r.push("displaced_position"),r.push("displaced_normal"),Object.values(dD)[this.displacementTypeIndex.value]){case"map":i=e.include(n.Nodes.map),r.push(this.movementOrTexture.getTexture(e,"t")),r.push("uv"),r.push(this.cropOrOffset.build(e,"f")),this.mat&&r.push(this.mat.build(e,"mat3"));break;case"noise":var a=["simplexPrecise","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseFunctionIndex.value],o=new dP("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="voronoi"==a?"\n\t\t\t\t\tfloat v = ".concat(a,"((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 * ".concat(a,"((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;\n\t\t\t\t\t"),l=new dP("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".concat(s,"\n\t\t\t\t\t\t}"),[iD.simplexPrecise,iD.simplexFractal,iD.simplexAshima,iD.fbm,iD.perlin,iD.voronoi]),u=new dP("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 calculate 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}",[l,o]);i=e.include(u),r.push(this.scale.build(e,"f")),r.push(this.cropOrOffset.build(e,"v3")),r.push(this.movementOrTexture.build(e,"f")),r.push(this.voronoiStyle.build(e,"i")),r.push(this.smoothness.build(e,"f")),r.push(this.seed.build(e,"f")),r.push(this.highCut.build(e,"f")),r.push(this.lowCut.build(e,"f")),r.push(this.quality.build(e,"i"))}return r.push(this.intensity.build(e,"f")),r.push("displaced_normal"),e.format(i+"("+r.join(",")+")",this.getType(e),t)}return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}}]),n}(aP);fD.Nodes=function(){var e=new dP("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}"),t=new dP("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 dP("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}",[e,t])}}();for(var vD={normalRenderTarget:new wP,normalRenderTargetDepth:new wP,transmissionRenderTarget:new wP,aspectRatio:new sP,transmissionSize:new sP(2048,2048),transmissionRenderTargetDepth:new wP,aoRenderTarget:new wP,aoEnabled:new NP,pixelRatioNode:new SP(1),resolution:new sP,penumbraSize:new UP(5,.5),frameIndex:new FP(0),transmissionLod:new FP(2),taaEnabled:new NP(!0)},pD=0,mD=Object.values(vD);pD","#include ","#include ","#include "].join("\n"));var i=["#include ","#include ","\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \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 ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","#include ","#include ","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED","\tvNormal = transformedNormal;","#endif"),i.push("#include ","#include ","#include ","\tvViewPosition = - mvPosition.xyz;","#include "),i.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=i.join("\n")}else{void 0===this.color&&(this.color=new zP(Hx)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});var r=this.color.flow(e,"c",{slot:"color"}),a=this.alpha?this.alpha.flow(e,"f"):void 0,o=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,s=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=void 0!==a,e.addParsCode(["varying vec3 vWPosition;","#include ","#include ","varying vec3 vViewPosition;","#include "].join("\n"));var l=["#include ",r.code];a&&l.push(a.code,"#ifdef ALPHATEST"," if ( "+a.result+" <= ALPHATEST ) discard;","#endif"),s?l.push(s.code,"vec3 outgoingLight = ".concat(r.result,";"),"vec3 finalColor = spe_blend(outgoingLight, ".concat(s.result,", 1.0, SPE_BLENDING_NORMAL);")):l.push("vec3 finalColor = ".concat(r.result,";"));var u="1.0";this.mask&&(this.mask.analyze(e),u="luminance(".concat(this.mask.flow(e,"v3").result,")")),a?l.push("gl_FragColor = vec4( finalColor, accumAlpha * ".concat(a.result," * ").concat(u," );")):l.push("gl_FragColor = vec4("+r.result+", 1.0 );"),o&&l.push("gl_FragColor.a *= ".concat(o.result,";")),l.push("#include ","#include "),t=l.join("\n")}return t}},{key:"category",get:function(){return"phong"}}]),n}(nP),bD=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,"lambert")).nodeType="Lambert",e.color=new zP(Hx),e.emissive=new zP(0),e.emissiveIntensity=new SP(1),e.previousModelViewMatrix=new HP,e.previouseProjectionMatrix=new HP,e.shadingAlpha=new SP(1),e.shadingBlend=new FP(0),e.occlusion=new NP(!0),e}return(0,w.Z)(n,[{key:"build",value:function(e){var t;if(e.define("LAMBERT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){var n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({resolution:vD.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(rr.merge([_r.fog,_r.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying vec3 vIndirectBack;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var i=["#include ","#include ","\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \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 ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","#include ","#include ","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\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"),i.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 ","\t#include "),i.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=i.join("\n")}else{e.mergeUniform({penumbraSize:vD.penumbraSize}),e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({aoMap:vD.aoRenderTarget}),e.mergeUniform({aoEnabled:vD.aoEnabled}),void 0===this.color&&(this.color=new zP(Hx)),this.color.analyze(e,{slot:"color"}),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);var r=this.color.flow(e,"c",{slot:"color"}),a=this.emissive.flow(e,"c",{slot:"emissive"}),o=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),s=this.occlusion.flow(e,"b",{slot:"occlusion"}),l=this.shadingAlpha.flow(e,"f"),u=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0,d=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==h,e.addParsCode(["uniform float penumbraSize[".concat(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 ","#ifdef DOUBLE_SIDED","\tvarying vec3 vLightBack;","\tvarying vec3 vIndirectBack;","#endif","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var f=["#include ","\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 "];f.push(r.code,"vec3 diffuseColor = "+r.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),h&&f.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),f.push("#ifdef DOUBLE_SIDED","\treflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else","\treflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include ","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();"),a&&f.push(a.code,"reflectedLight.directDiffuse += "+a.result+" * "+o.result+";"),f.push("vec3 ao = aoEnabled && "+s.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");var v="1.0";this.mask&&(this.mask.analyze(e),v="luminance(".concat(this.mask.flow(e,"v3").result,")")),f.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 ) * ".concat(l.result," * ").concat(v," * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ").concat(l.result," * ").concat(v,", ").concat(u.result," );\n\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t")),c&&f.push(c.code,"outgoingLight = spe_blend(outgoingLight, ".concat(c.result,", 1.0, SPE_BLENDING_NORMAL);")),h?f.push("gl_FragColor = vec4( outgoingLight, accumAlpha * ".concat(h.result," );")):f.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d&&f.push("gl_FragColor.a *= ".concat(d.result,";")),f.push("#include ","#include ","#include "),t=f.join("\n")}return t}},{key:"category",get:function(){return"lambert"}}]),n}(nP),wD={dHdxy:new dP("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 }"),perturbNormalArb:new dP("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 }")},SD=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,"phong")).nodeType="Phong",e.color=new zP(Hx),e.specular=new zP(1118481),e.shininess=new SP(30),e.previousModelViewMatrix=new HP,e.previouseProjectionMatrix=new HP,e.shadingAlpha=new SP(1),e.shadingBlend=new FP(0),e.occlusion=new NP(!0),e}return(0,w.Z)(n,[{key:"build",value:function(e){var t;if(e.define("PHONG"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){var n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({resolution:vD.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(rr.merge([_r.fog,_r.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var i=["#include ","#include ","\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \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 ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","#include ","#include ","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\t#include ","\t#include "),i.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=i.join("\n")}else{e.mergeUniform({penumbraSize:vD.penumbraSize}),e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({aoMap:vD.aoRenderTarget}),e.mergeUniform({aoEnabled:vD.aoEnabled}),void 0===this.color&&(this.color=new zP(Hx)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e);var r=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);var a=this.color.flow(e,"c",{slot:"color"}),o=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),l=this.shadingAlpha.flow(e,"f"),u=this.shadingBlend.flow(e,"i"),c=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0,d=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==h,e.addParsCode(["varying vec3 vWPosition;","uniform vec3 emissive;","uniform float penumbraSize[".concat(5,"];"),"uniform sampler2D aoMap;","uniform bool aoEnabled;","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var f=["#include ","\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;"];if(this.bumpMap){e.include(wD.dHdxy),e.include(wD.perturbNormalArb);var v=this.bumpMap.texture.flow(e,"t"),p=this.bumpMap.flow(e,"v3"),m=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",g="";g=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".concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(").concat(v.result,", uv0, ").concat(m,");\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(").concat(v.result,", uv1, ").concat(m,");\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(").concat(v.result,", uv2, ").concat(m,");\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".concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(").concat(v.result,", bumpMapCachedUv, ").concat(m,");\n\t\t\t\t\tnormal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );\n\t\t\t\t\t"),f.push("// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates\n\t\t\t\t\t".concat(p.result,";\n\t\t\t\t\t").concat(g,"\n\t\t\t\t\t"))}f.push(a.code,"\tvec3 diffuseColor = "+a.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );","\tvec3 totalEmissiveRadiance = emissive;",o.code,"\tvec3 specular = "+o.result+";",s.code,"\tfloat shininess = max( 0.0001, "+s.result+" );","\tfloat specularStrength = 1.0;"),h&&f.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),f.push("material.diffuseColor = diffuseColor;"),f.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include ","#include "),f.push("vec3 ao = aoEnabled && "+r.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;");var y="1.0";this.mask&&(this.mask.analyze(e),y="luminance(".concat(this.mask.flow(e,"v3").result,")")),f.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 ) * ".concat(l.result," * ").concat(y," * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ").concat(l.result," * ").concat(y,", ").concat(u.result," );\n\t\t\t\t\t\n\t\t\t\t\toutgoingLight *= ao;\n\t\t\t\t}\n\t\t\t\t")),c&&f.push(c.code,"outgoingLight = spe_blend(outgoingLight, ".concat(c.result,", 1.0, SPE_BLENDING_NORMAL);")),h?f.push("gl_FragColor = vec4( outgoingLight, accumAlpha * ".concat(h.result,");")):f.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),d&&f.push("gl_FragColor.a *= ".concat(d.result,";")),f.push("#include ","#include ","#include "),t=f.join("\n")}return t}},{key:"category",get:function(){return"phong"}}]),n}(nP),_D=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,"standard")).nodeType="Standard",e.color=new zP(Hx),e.roughness=new SP(.3),e.metalness=new SP(0),e.reflectivity=new SP(.5),e.previousModelViewMatrix=new HP,e.previouseProjectionMatrix=new HP,e.shadingAlpha=new SP(1),e.shadingBlend=new FP(0),e.occlusion=new NP(!0),e}return(0,w.Z)(n,[{key:"build",value:function(e){var t;if(e.define("STANDARD"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){var n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({resolution:vD.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(rr.merge([_r.fog,_r.lights])),_r.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var i=["#include ","#include ","\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \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 ","\n\t\t\t\t#if !defined( USE_LAYER_DISPLACE )\n\t\t\t\t\t#include \n\t\t\t\t#endif /* !USE_LAYER_DISPLACE */\n\t\t\t\t"];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","#include ","#include ","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("#include ","#include ","#include ","\tvViewPosition = - mvPosition.xyz;","#include ","#include "),i.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=i.join("\n")}else{e.mergeUniform({penumbraSize:vD.penumbraSize}),e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({aoMap:vD.aoRenderTarget}),e.mergeUniform({aoEnabled:vD.aoEnabled});var r={gamma:!0};void 0===this.color&&(this.color=new zP(Hx)),this.color.analyze(e,{slot:"color",context:r}),this.roughness.analyze(e),this.metalness.analyze(e);var a=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.reflectivity&&this.reflectivity.analyze(e);var o=this.color.flow(e,"c",{slot:"color",context:r}),s=this.roughness.flow(e,"f"),l=this.metalness.flow(e,"f"),u=this.shadingAlpha.flow(e,"f"),c=this.shadingBlend.flow(e,"i"),h=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,d=this.alpha?this.alpha.flow(e,"f"):void 0,f=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,v=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=void 0!==d,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","uniform float penumbraSize[".concat(5,"];"),"uniform sampler2D aoMap;","uniform bool aoEnabled;","#include ","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var p=["#include ","\t#include ","\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 );"];if(this.bumpMap){e.include(wD.dHdxy),e.include(wD.perturbNormalArb);var m=this.bumpMap.texture.flow(e,"t"),g=this.bumpMap.flow(e,"v3"),y=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",x="";x=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".concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(").concat(m.result,", uv0, ").concat(y,");\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(").concat(m.result,", uv1, ").concat(y,");\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(").concat(m.result,", uv2, ").concat(y,");\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".concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(").concat(m.result,", bumpMapCachedUv, ").concat(y,");\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".concat(g.result,";\n\t\t\t\t\t").concat(x,"\n\t\t\t\t\t"))}if(p.push(o.code,"\tvec3 diffuseColor = "+o.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",l.code,"\tfloat metalnessFactor = "+l.result+";"),this.roughnessMap){var b=this.roughnessMap.texture.flow(e,"t"),w=this.roughnessMap.flow(e,"v3"),S="";S=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".concat(this.roughnessMap.uuid.toString().replace(/-/g,""),"_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g").concat(this.roughnessMap.uuid.toString().replace(/-/g,""),"_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g").concat(this.roughnessMap.uuid.toString().replace(/-/g,""),"_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g").concat(this.roughnessMap.uuid.toString().replace(/-/g,""),"_triplanarWeights;\n\n\t\t\t\t\t\tfloat r0 = luminance(texture(").concat(b.result,", uv0).rgb) * roughnessScale;\n\t\t\t\t\t\tfloat r1 = luminance(texture(").concat(b.result,", uv1).rgb) * roughnessScale;\n\t\t\t\t\t\tfloat r2 = luminance(texture(").concat(b.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 * ").concat(s.result,";\n\t\t\t\t\t"):"\n\t\t\t\t\tvec2 roughnessMapCachedUv = g".concat(this.roughnessMap.uuid.toString().replace(/-/g,""),"_writeUvs;\n\n\t\t\t\t\tvec4 vals = texture(").concat(b.result,", roughnessMapCachedUv);\n\t\t\t\t\tfloat roughnessFactor = luminance(vals.rgb) * ").concat(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".concat(w.result,";\n\n\t\t\t\t\tconst float roughnessScale = 1.0;\n\n\t\t\t\t\t").concat(S,"\n\t\t\t\t"))}else p.push(s.code,"\tfloat roughnessFactor = "+s.result+";");d&&p.push(d.code,"#ifdef ALPHATEST","\tif ( "+d.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 );"),v?p.push(v.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+v.result+" ) ), diffuseColor, metalnessFactor );"):p.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),p.push("#include "),p.push("#include "),p.push("vec3 ao = aoEnabled && "+a.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular;");var _="1.0";this.mask&&(this.mask.analyze(e),_="luminance(".concat(this.mask.flow(e,"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 ) * ".concat(u.result," * ").concat(_," * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ").concat(u.result," * ").concat(_,", ").concat(c.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, ".concat(h.result,", 1.0, SPE_BLENDING_NORMAL);")),d?p.push("gl_FragColor = vec4( outgoingLight, accumAlpha * ".concat(d.result," );")):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),f&&p.push("gl_FragColor.a *= ".concat(f.result,";")),p.push("#include ","#include ","#include "),t=p.join("\n")}return t}},{key:"category",get:function(){return"physical"}}]),n}(nP),AD=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,"toon")).nodeType="Toon",e.color=new zP(Hx),e.specular=new zP(1118481),e.shininess=new SP(30),e.previousModelViewMatrix=new HP,e.previouseProjectionMatrix=new HP,e.shadingAlpha=new SP(1),e.shadingBlend=new FP(0),e}return(0,w.Z)(n,[{key:"build",value:function(e){var t;if(e.define("TOON"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){var n=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({resolution:vD.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(rr.merge([_r.fog,_r.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include ","#include ","#include ","#include ","#include ","#include "].join("\n"));var i=["#include ","#include ","\n\t\t\t\t#include \n\t\t\t\t#include \n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \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 ","\n\t\t\t\t#ifndef USE_LAYER_DISPLACE\n\t\t\t\t\t#include \n\t\t\t\t#endif\n\t\t\t\t"];n&&i.push(n.code,n.result?"displaced_position = "+n.result+";":""),i.push("transformed = displaced_position;","#include ","#include ","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),i.push("\t#include ","\t#include ","\t#include ","\tvViewPosition = - mvPosition.xyz;","\t#include ","\t#include ","\t#include "),i.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=i.join("\n")}else{e.mergeUniform({penumbraSize:vD.penumbraSize}),e.mergeUniform({frameIndex:vD.frameIndex}),e.mergeUniform({aoMap:vD.aoRenderTarget}),e.mergeUniform({aoEnabled:vD.aoEnabled}),void 0===this.color&&(this.color=new zP(Hx)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);var r=this.color.flow(e,"c",{slot:"color"}),a=this.specular.flow(e,"c"),o=this.shininess.flow(e,"f"),s=this.shadingAlpha.flow(e,"f"),l=this.shadingBlend.flow(e,"i"),u=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=void 0!==c,e.addParsCode(["uniform float penumbraSize[".concat(5,"];"),"uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vWPosition;","#include ","#include ","#include ","#include ","#include ","#include ","\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 ","#include ","#include "].join("\n"));var d=["#include ","\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;"];if(this.bumpMap){e.include(wD.dHdxy),e.include(wD.perturbNormalArb);var f=this.bumpMap.texture.flow(e,"t"),v=this.bumpMap.flow(e,"v3"),p=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",m="";m=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".concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs0;\n\t\t\t\t\t\tvec2 uv1 = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs1;\n\t\t\t\t\t\tvec2 uv2 = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs2;\n\t\t\t\t\t\tvec3 weights = g").concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_triplanarWeights;\n\n\t\t\t\t\t\tvec2 grad0 = dHdxy(").concat(f.result,", uv0, ").concat(p,");\n\t\t\t\t\t\tvec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);\n\n\t\t\t\t\t\tvec2 grad1 = dHdxy(").concat(f.result,", uv1, ").concat(p,");\n\t\t\t\t\t\tvec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);\n\n\t\t\t\t\t\tvec2 grad2 = dHdxy(").concat(f.result,", uv2, ").concat(p,");\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".concat(this.bumpMap.uuid.toString().replace(/-/g,""),"_writeUvs;\n\t\t\t\t\tvec2 grad = dHdxy(").concat(f.result,", bumpMapCachedUv, ").concat(p,");\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".concat(v.result,";\n\t\t\t\t\t").concat(m,"\n\t\t\t\t\t"))}d.push(r.code,"\tvec3 diffuseColor = "+r.result+";","\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",a.code,"\tvec3 specular = "+a.result+";",o.code,"\tfloat shininess = max( 0.0001, "+o.result+" );","\tfloat specularStrength = 1.0;"),c&&d.push(c.code,"#ifdef ALPHATEST","if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),d.push("material.diffuseColor = diffuseColor;"),d.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include ","#include "),d.push("vec3 ao = aoEnabled ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * ao) + reflectedLight.directSpecular;");var g="1.0";this.mask&&(this.mask.analyze(e),g="luminance(".concat(this.mask.flow(e,"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 ) * ".concat(s.result," * ").concat(g," * lightAccu;\n\t\t\t\t\toutgoingLight = spe_blend( diffuseColor, outgoingLight, ").concat(s.result," * ").concat(g,", ").concat(l.result," );\n\t\t\t\t}\n\t\t\t\t")),u&&d.push(u.code,"outgoingLight = spe_blend(outgoingLight, ".concat(u.result,", 1.0, SPE_BLENDING_NORMAL);")),c?d.push("gl_FragColor = vec4( outgoingLight, accumAlpha * ".concat(c.result," );")):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h&&d.push("gl_FragColor.a *= ".concat(h.result,";")),d.push("#include ","#include ","#include "),t=d.join("\n")}return t}},{key:"category",get:function(){return"toon"}}]),n}(nP),MD=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return(0,w.Z)(n,[{key:"create",value:function(e){return URL.createObjectURL(new Blob([e]))}},{key:"dispose",value:function(e,t){URL.revokeObjectURL(t)}}]),n}(function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;(0,b.Z)(this,e),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.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}return(0,w.Z)(e,[{key:"log",value:function(){}},{key:"remove",value:function(e){var t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.data=null)}},{key:"scheduleCleanup",value:function(){var e=this;this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout((function(){e.hasClean=!1,e.cleanupTimer=null,e.log("cleaning");for(var t=Date.now(),n=e.head.next;n.time"u")){e.next=2;break}return e.abrupt("return");case 2:if(this.disposeTextures(),this.loaded=!1,n=function(){a.loaded=!0;for(var e=0,t=Object.values(a._cache);e1&&void 0!==arguments[1]?arguments[1]:1008,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1006,o=null===(t=this._cache[e])||void 0===t||null===(n=t[r])||void 0===n?void 0:n[a];return o||(i=this.isBuffer?this.img.texture:this.isVideo?new Es(this.img,void 0,e,e):new tn(this.img,void 0,e,e,a,r),this.loaded&&(i.needsUpdate=!0),void 0===this._cache[e]&&(this._cache[e]={}),void 0===this._cache[e][r]&&(this._cache[e][r]={}),this._cache[e][r][a]=i,i)}},{key:"setNeedsUpdate",value:function(e){for(var t=0,n=Object.values(this._cache);t=0&&(i[a]=parseInt(n[r].value,10))}return i}catch(Ax){if(Ax instanceof RangeError)return[NaN];throw Ax}}(n,e):function(e,t){var n=e.format(t).replace(/\u200E/g,""),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[i[3],i[1],i[2],i[4],i[5],i[6]]}(n,e)}var OD={year:0,month:1,day:2,hour:3,minute:4,second:5};var ID={};function RD(e,t,n,i,r,a,o){var s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(i,r,a,o),s}var LD=36e5,BD={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function zD(e,t,n){var i,r,a;if(!e||(i=BD.timezoneZ.exec(e)))return 0;if(i=BD.timezoneHH.exec(e))return ND(a=parseInt(i[1],10))?-a*LD:NaN;if(i=BD.timezoneHHMM.exec(e)){a=parseInt(i[1],10);var o=parseInt(i[2],10);return ND(a,o)?(r=Math.abs(a)*LD+6e4*o,a>0?-r:r):NaN}if(function(e){if(UD[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),UD[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());var s=FD(n?t:function(e){return RD(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),e);return-(n?s:function(e,t,n){var i=e.getTime()-t,r=FD(new Date(i),n);if(t===r)return t;i-=r-t;var a=FD(new Date(i),n);return r===a?r:Math.max(r,a)}(t,s,e))}return NaN}function FD(e,t){var n=DD(e,t),i=RD(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=e.getTime(),a=r%1e3;return i-(r-=a>=0?a:1e3+a)}function ND(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var UD={};var ZD=U(G(),1),VD=U(H(),1),jD=36e5,GD={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,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 HD(e){var t,n={},i=GD.dateTimePattern.exec(e);if(i?(n.date=i[1],t=i[3]):(i=GD.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e),t){var r=GD.timeZone.exec(t);r?(n.time=t.replace(r[1],""),n.timeZone=r[1].trim()):n.time=t}return n}function WD(e,t){var n,i=GD.YYY[t],r=GD.YYYYY[t];if(n=GD.YYYY.exec(e)||r.exec(e)){var a=n[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(n=GD.YY.exec(e)||i.exec(e)){var o=n[1];return{year:100*parseInt(o,10),restDateString:e.slice(o.length)}}return{year:null}}function qD(e,t){if(null===t)return null;var n,i,r,a;if(0===e.length)return(i=new Date(0)).setUTCFullYear(t),i;if(n=GD.MM.exec(e))return i=new Date(0),$D(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=GD.DDD.exec(e)){i=new Date(0);var o=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=JD(e);return!(n&&t>366||!n&&t>365)}(t,o)?(i.setUTCFullYear(t,0,o),i):new Date(NaN)}if(n=GD.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return $D(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=GD.Www.exec(e))return eO(t,a=parseInt(n[1],10)-1)?YD(t,a):new Date(NaN);if(n=GD.WwwD.exec(e)){a=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return eO(t,a,l)?YD(t,a,l):new Date(NaN)}return null}function XD(e){var t,n,i;if(t=GD.HH.exec(e))return tO(n=parseFloat(t[1].replace(",",".")))?n%24*jD:NaN;if(t=GD.HHMM.exec(e))return tO(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*jD+6e4*i:NaN;if(t=GD.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return tO(n,i,r)?n%24*jD+6e4*i+1e3*r:NaN}return null}function YD(e,t,n){t=t||0,n=n||0;var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*t+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}var QD=[31,28,31,30,31,30,31,31,30,31,30,31],KD=[31,29,31,30,31,30,31,31,30,31,30,31];function JD(e){return e%400===0||e%4===0&&e%100!==0}function $D(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=JD(e);if(i&&n>KD[t]||!i&&n>QD[t])return!1}return!0}function eO(e,t,n){return!(t<0||t>52||null!=n&&(n<0||n>6))}function tO(e,t,n){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=n&&(n<0||n>=60))}function nO(e,t,n){var i=function(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var n=t||{},i=null==n.additionalDigits?2:(0,ZD.default)(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r=HD(e),a=WD(r.date,i),o=a.year,s=qD(a.restDateString,o);if(isNaN(s))return new Date(NaN);if(s){var l,u=s.getTime(),c=0;if(r.time&&(c=XD(r.time),isNaN(c)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=zD(r.timeZone||n.timeZone,new Date(u+c)),isNaN(l))return new Date(NaN)}else l=(0,VD.default)(new Date(u+c)),l=(0,VD.default)(new Date(u+c+l));return new Date(u+c+l)}return new Date(NaN)}(e,n),r=zD(t,i,!0),a=new Date(i.getTime()-r),o=new Date(0);return o.setFullYear(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()),o.setHours(a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()),o}function iO(e,t){return t.color(e)}function rO(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1?arguments[1]:void 0,n=t.format,i=e.getSeconds(),r=e;t&&null!==t.timeZone&&(r=nO(new Date,t.timeZone));var a,o=r.getHours(),s=r.getMinutes();"12ampm"===t.format12h24h&&(a=o>=12?"PM":"AM");var l,u,c=o;switch("24"!==t.format12h24h&&(0===(c=o%12)&&(c=12)),n){case"HH:mm:ss":l=[c,s,i];break;case"HH:mm":l=[c,s];break;case"HH":l=[c],a=void 0;break;case"mm":l=[s],a=void 0;break;case"ss":l=[i],a=void 0;break;case"year":u=r.getFullYear();break;case"month":u=r.getMonth()+1;break;case"dayOfYear":u=Math.floor((r.getTime()-new Date(r.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":u=r.getDate();break;case"secondOfDay":u=60*o*60+60*s+i;break;default:console.error("Unknown time format",n),u=0}return void 0!==l?{textValue:l,suffix:a}:u}function aO(e,t){switch(e.type){case"fresnel":return function(e,t){var n=e.bias,i=e.scale,r=e.intensity,a=e.factor,o=e.color;return k(k({},oO(e,t)),{},{color:iO(o,t),bias:n,scale:i,intensity:r,factor:a})}(e,t);case"gradient":return function(e,t){var n=e.gradientType,i=e.smooth,r=e.colors,o=e.steps,s=e.angle,u=e.offset,c=e.morph;return k(k({},oO(e,t)),{},{gradientType:n,smooth:i,colors:r.map((function(e){return new nn(e[0],e[1],e[2],e[3])})),num:r.length,steps:o,offset:(0,a.Z)(Dt,(0,l.Z)(u.map((function(e){return"number"==typeof e?e:0})))),morph:(0,a.Z)(Dt,(0,l.Z)(c.map((function(e){return"number"==typeof e?e:0})))),angle:s})}(e,t);case"depth":return function(e,t){var n=e.gradientType,i=e.near,r=e.far,o=e.isVector,s=e.isWorldSpace,u=e.origin,c=e.direction,h=e.colors,d=e.steps,f=e.smooth;return k(k({},oO(e,t)),{},{gradientType:n,near:i,far:r,isVector:o,isWorldSpace:s,origin:(0,a.Z)(un,(0,l.Z)(u)),direction:c?(0,a.Z)(un,(0,l.Z)(c)):new un(1,0,0),colors:h.map((function(e){return void 0!==e?new nn(e[0],e[1],e[2],e[3]):new nn(0,0,0,0)})),steps:d.slice(0,h.length),smooth:f})}(e,t);case"normal":return function(e,t){var n=e.cnormal;return k(k({},oO(e,t)),{},{cnormal:new un(n[0],n[1],n[2])})}(e,t);case"noise":return function(e,t){return k(k({},oO(e,t)),{},{scale:e.scale,move:e.move,fA:(0,a.Z)(Dt,(0,l.Z)(e.fA.map((function(e){return"number"==typeof e?e:0})))),fB:(0,a.Z)(Dt,(0,l.Z)(e.fB.map((function(e){return"number"==typeof e?e:0})))),size:(0,a.Z)(un,(0,l.Z)(e.size)),distortion:(0,a.Z)(Dt,(0,l.Z)(e.distortion.map((function(e){return"number"==typeof e?e:0})))),colorA:iO(e.colorA,t),colorB:iO(e.colorB,t),colorC:iO(e.colorC,t),colorD:iO(e.colorD,t),noiseType:e.noiseType,voronoiStyle:e.voronoiStyle,highCut:e.highCut,lowCut:e.lowCut,smoothness:e.smoothness,seed:e.seed,quality:e.quality})}(e,t);case"rainbow":return function(e,t){return k(k({},oO(e,t)),{},{filmThickness:e.filmThickness,movement:e.movement,wavelengths:(0,a.Z)(un,(0,l.Z)(e.wavelengths)),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:(0,a.Z)(un,(0,l.Z)(e.offset))})}(e,t);case"toon":return function(e,t){return k(k({},oO(e,t)),{},{positioning:e.positioning,colors:e.colors.map((function(e){return new nn(e[0],e[1],e[2],e[3])})),num:e.colors.length,steps:e.steps,source:(0,a.Z)(un,(0,l.Z)(e.source)),isWorldSpace:e.isWorldSpace,noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,shadowColor:iO(e.shadowColor,t),offset:(0,a.Z)(un,(0,l.Z)(e.offset))})}(e,t);case"outline":return function(e,t){return k(k({},oO(e,t)),{},{outlineColor:iO(e.outlineColor,t),contourColor:iO(e.contourColor,t),outlineWidth:e.outlineWidth,contourWidth:e.contourWidth,outlineThreshold:e.outlineThreshold,contourThreshold:e.contourThreshold,outlineSmoothing:e.outlineSmoothing,contourFrequency:e.contourFrequency,contourDirection:(0,a.Z)(un,(0,l.Z)(e.contourDirection)),positionalLines:e.positionalLines,compensation:e.compensation})}(e,t);case"transmission":return function(e,t){return k(k({},oO(e,t)),{},{thickness:e.thickness,ior:e.ior,roughness:e.roughness})}(e,t);case"pattern":return function(e,t){return k(k({},oO(e,t)),{},{style:e.style,projection:e.projection,axis:e.axis,blending:e.blending,offset:(0,a.Z)(Dt,(0,l.Z)(e.offset.map((function(e){return"number"==typeof e?e:0})))),colorA:iO(e.colorA,t),colorB:iO(e.colorB,t),frequency:(0,a.Z)(Dt,(0,l.Z)(e.frequency.map((function(e){return"number"==typeof e?e:0})))),size:e.size,variation:e.variation,smoothness:e.smoothness,zigzag:e.zigzag,rotation:e.rotation,vertical:(0,a.Z)(Dt,(0,l.Z)(e.vertical.map((function(e){return"number"==typeof e?e:0})))),horizontal:(0,a.Z)(Dt,(0,l.Z)(e.horizontal.map((function(e){return"number"==typeof e?e:0})))),sides:e.sides})}(e,t);case"color":default:return function(e,t){return k(k({},oO(e,t)),{},{color:iO(e.color,t)})}(e,t)}}function oO(e,t){var n,i=e.alpha,r=e.mode,a=e.isMask,o="string"==typeof i?(null!==(n=Number(t.getVariable(i)))&&void 0!==n?n:100)/100:i;return k(k({},function(e){return{type:e.type}}(e)),{},{alpha:o,mode:r,isMask:a})}var sO=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return n}(I_),lO={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},uO={depth:["colors"]};function cO(e,t,n){if("isMask"===t)return!0;var i=lO[e.type],r=uO[e.type];if(void 0!==r){var a=e.color;if(r.includes(t)){var o,s,l=null===(o=a[t])||void 0===o||null===(s=o.value)||void 0===s?void 0:s.length;if(void 0!==l&&l!==n.length)return!0}}return void 0!==i&&i.includes(t)}function hO(e,t){if(Array.isArray(t)){if(!Array.isArray(e)||e.length!==t.length)return!1;var n,i=D(t.entries());try{for(i.s();!(n=i.n()).done;){var r=(0,h.Z)(n.value,2),a=r[0],o=r[1],s=e[a];if("string"==typeof o||"number"==typeof o&&"string"==typeof s)return!0}}catch(c){i.e(c)}finally{i.f()}return!1}var l="string"==typeof e,u="string"==typeof t;return l!==u||l&&u}function dO(e,t,n){var i,r,a=n.uniforms["f".concat(n.id,"_texture")];if(!a)return!1;var o=!1,s=e;if("image"in s){var l=s.image,u=t.image(l),c=a;c.image instanceof PD||c.image.deref(),c.image=u}if("video"in s){var h=s.video,d=t.video(h),f=a;f.image instanceof PD||f.image.deref(),f.image=d}"wrapping"in s&&(a.wrap=s.wrapping);"minFilter"in s&&(a.minFilter=s.minFilter);"magFilter"in s&&(a.magFilter=s.magFilter);if("rotation"in s&&n.uniforms["f".concat(n.id,"_rotation")])return n.uniforms["f".concat(n.id,"_rotation")].value=(null!==(i=vO(null!==(r=s.rotation)&&void 0!==r?r:0,t))&&void 0!==i?i:0)*Pt.DEG2RAD,o;if("repeat"in s||"offset"in s||"rotation"in s){var v=n.uniforms["f".concat(n.id,"_").concat("mat")];if(!v)return o;if("repeat"in s){var p=s.repeat;hO(n.data.texture.repeat,p)&&(o=!0),v.repeat=gO(p,t).map((function(e,t){return"string"==typeof p[t]?1/e:e}))}if("offset"in s){var m=s.offset;hO(n.data.texture.offset,m)&&(o=!0),v.offset=gO(m,t).map((function(e,t){return"string"==typeof m[t]?-e:e}))}if("rotation"in s){var g,y,x=n.data.texture.rotation,b=null!==(g=s.rotation)&&void 0!==g?g:0;(void 0===x||hO(x,b))&&(o=!0),v.rotation=null!==(y=vO(b,t))&&void 0!==y?y:0}v.updateMatrix()}return o}var fO=function(e,t,n){var i,r;return null!==(i=Math.max(0,Math.min(1,Number(null!==(r=t.getVariable("number"==typeof e?100*e:e,n))&&void 0!==r?r:100)/100)))&&void 0!==i?i:1},vO=function(e,t,n){return"number"==typeof e?e:t.getVariable(e,n)},pO=function(e,t){var n,i,r;return e||(e=new un),e.x=null!==(n=vO(e.x,t))&&void 0!==n?n:0,e.y=null!==(i=vO(e.y,t))&&void 0!==i?i:0,e.z=null!==(r=vO(e.z,t))&&void 0!==r?r:0,e},mO=function(e,t){var n,i;return e||(e=new Dt),e.x=null!==(n=vO(e.x,t))&&void 0!==n?n:0,e.y=null!==(i=vO(e.y,t))&&void 0!==i?i:0,e},gO=function(e,t){var n=e.map((function(e){var n;return null!==(n=vO(e,t))&&void 0!==n?n:0}));return[n[0],n[1]]},yO=function(){function e(t,n,i,r,a){for(var o in(0,b.Z)(this,e),this.id=t,this.uuid=n,this.data=i,this.uniforms={},r)this.uniforms["f".concat(this.id,"_").concat(o)]=r[o];for(var s in i)AO(s,this,i,a)}return(0,w.Z)(e,[{key:"updateByOp",value:function(e,t,n){var i=e,r=!1;if(void 0===i.path[0]){for(var o=0,s=Object.keys(i.props);o1)return t[1];console.log("Layer.getName: error ".concat(e))}},{key:"getNames",value:function(){var e=[];for(var t in this.uniforms){var n=this.getName(t);n&&e.push(n)}return e}},{key:"type",get:function(){return this.data.type}}],[{key:"create",value:function(e,t,n,i){if("light"===n.type)return wO.createLightLayer(e,t,n,i);if("texture"===n.type||"video"===n.type){var r,o,s,u,c,h,d,f,v,p,m="texture"===n.type?null!==(r=i.uiBuffer(n.texture.image))&&void 0!==r?r:i.image(n.texture.image):i.video(n.texture.video),g=new jP(m,n.texture.wrapping,null!==(o=n.texture.minFilter)&&void 0!==o?o:1008,null!==(s=n.texture.magFilter)&&void 0!==s?s:1006),y=new VP(m),x=new qP(gO(n.texture.repeat,i),gO(n.texture.offset,i),vO(null!==(u=n.texture.rotation)&&void 0!==u?u:0,i)),b=new SP(n.crop?1:0),w=new FP(null!==(c=n.projection)&&void 0!==c?c:0),S=new FP(null!==(h=["x","y","z"].indexOf(n.axis))&&void 0!==h?h:0),_=new FP(null!==(d=n.side)&&void 0!==d?d:0),A=new sP(n.size?(0,a.Z)(Dt,(0,l.Z)(gO(n.size,i))):new Dt(100,100)),M=new SP(null!==(f=n.blending)&&void 0!==f?f:0),E=new SP(fO(n.alpha,i)),C=new FP(null!==(v=n.mode)&&void 0!==v?v:0),T=new NP(null!==(p=n.isMask)&&void 0!==p&&p),P=new JP(g,y,b,w,S,_,A,M,x,E,C,T),D=new bP(P.calpha,"f");return new xO(e,t,n,{texture:g,textureSize:y,crop:b,projection:w,axis:S,side:_,size:A,blending:M,mat:x,alpha:E,mode:C,isMask:T},P,C,D,T,i)}if("matcap"===n.type){var O,I,R,L,B,z,F=i.image(n.texture.image),N=new jP(F,n.texture.wrapping,null!==(O=n.texture.minFilter)&&void 0!==O?O:1008,null!==(I=n.texture.magFilter)&&void 0!==I?I:1006),U=new SP(fO(n.alpha,i)),Z=new FP(null!==(R=n.mode)&&void 0!==R?R:0),V=new NP(null!==(L=n.isMask)&&void 0!==L&&L),j=new SP((null!==(B=vO(null!==(z=n.texture.rotation)&&void 0!==z?z:0,i))&&void 0!==B?B:0)*Pt.DEG2RAD),G=new nD(N,U,Z,V,j),H=new bP(G.calpha,"f");return new xO(e,t,n,{texture:N,alpha:U,mode:Z,isMask:V,rotation:j},G,Z,H,V,i)}if("displace"===n.type){if("noise"===n.displacementType){var W,q,X,Y,Q,K,J,$,ee,te,ne=new lP((0,a.Z)(un,(0,l.Z)(n.offset.map((function(e){var t;return null!==(t=vO(e,i))&&void 0!==t?t:0}))))),ie=new SP(null!==(W=vO(n.scale,i))&&void 0!==W?W:10),re=new SP(null!==(q=vO(n.intensity,i))&&void 0!==q?q:8),ae=new SP(null!==(X=vO(n.movement,i))&&void 0!==X?X:1),oe=new FP(null!==(Y=n.noiseType)&&void 0!==Y?Y:0),se=new FP(null!==(Q=n.voronoiStyle)&&void 0!==Q?Q:0),le=new SP(null!==(K=vO(n.smoothness,i))&&void 0!==K?K:.5),ue=new SP(null!==(J=vO(n.seed,i))&&void 0!==J?J:0),ce=new SP(null!==($=vO(n.highCut,i))&&void 0!==$?$:1),he=new SP(null!==(ee=vO(n.lowCut,i))&&void 0!==ee?ee:0),de=new FP(null!==(te=vO(n.quality,i))&&void 0!==te?te:1),fe=new fD(re,ae,ne,se,le,ue,ce,he,de,ie,oe);return new bO(e,t,n,{offset:ne,scale:ie,intensity:re,movement:ae,noiseType:oe,voronoiStyle:se,smoothness:le,seed:ue,highCut:ce,lowCut:he,quality:de},fe,i)}throw new Error}return function(e,t,n,i){var r=aO(n,i);return function(e,t,n,i,r){switch(e.type){case"color":var a,o=new zP(null!==(a=i.color)&&void 0!==a?a:Hx),s=_O(i),l=new QP(o,s.alpha),u=new bP(l.calpha,"f");return new xO(t,n,e,k({color:o},s),l,s.mode,u,s.isMask,r);case"fresnel":var c,h,d,f,v,p=new zP(null!==(c=i.color)&&void 0!==c?c:16777215),m=new SP(null!==(h=vO(i.bias,r))&&void 0!==h?h:.1),g=new SP(null!==(d=vO(i.scale,r))&&void 0!==d?d:1),y=new SP(null!==(f=vO(i.intensity,r))&&void 0!==f?f:2),x=new SP(null!==(v=vO(i.factor,r))&&void 0!==v?v:1),b=_O(i),w=new eD(p,m,g,y,x,b.alpha,b.mode,b.isMask),S=new bP(w.calpha,"f");return new xO(t,n,e,k({color:p,bias:m,scale:g,intensity:y,factor:x},b),w,b.mode,S,b.isMask,r);case"rainbow":var _,A,M,E,C=new SP(null!==(_=vO(i.filmThickness,r))&&void 0!==_?_:30),T=new SP(null!==(A=vO(i.movement,r))&&void 0!==A?A:0),P=new lP(pO(i.wavelengths,r)),D=new SP(null!==(M=vO(i.noiseStrength,r))&&void 0!==M?M:0),O=new SP(null!==(E=vO(i.noiseScale,r))&&void 0!==E?E:1),I=new lP(pO(i.offset,r)),R=_O(i),L=new sD(C,T,P,D,O,I,R.alpha,R.isMask),B=new bP(L.calpha,"f");return new xO(t,n,e,k({filmThickness:C,movement:T,wavelengths:P,noiseStrength:D,noiseScale:O,offset:I},R),L,R.mode,B,R.isMask,r);case"transmission":var z,F,N,U=new SP(vO(null!==(z=i.thickness)&&void 0!==z?z:10,r)),Z=new SP(vO(null!==(F=i.ior)&&void 0!==F?F:1.5,r)),V=new SP(vO(null!==(N=i.roughness)&&void 0!==N?N:.5,r)),j=vD.transmissionSize,G=vD.transmissionRenderTarget,H=vD.transmissionRenderTargetDepth,W=window.innerWidth,q=window.innerHeight,X=W>=q?new sP(q/W,1):new sP(1,W/q),Y=_O(i),Q=new hD(U,Z,V,j,G,H,X,Y.alpha),K=new bP(Q.calpha,"f");return new xO(t,n,e,k({thickness:U,ior:Z,roughness:V,aspectRatio:X},Y),Q,Y.mode,K,Y.isMask,r);case"toon":var J,$,ee,te,ne,ie,re,ae,oe=new FP(null!==(J=i.positioning)&&void 0!==J?J:0);i.colors?re=new XP(i.colors.length,i.colors):(re=new XP(10,new nn(0,0,0,1))).value[1]=new nn(1,1,1,1),i.steps?ae=new UP(i.steps.length,i.steps):(ae=new UP(10,1)).value[0]=0;var se=new lP(pO(null!==($=i.source)&&void 0!==$?$:new un(0,0,0),r)),le=new NP(null===(ee=i.isWorldSpace)||void 0===ee||ee),ue=new SP(vO(null!==(te=i.noiseStrength)&&void 0!==te?te:0,r)),ce=new SP(vO(null!==(ne=i.noiseScale)&&void 0!==ne?ne:1,r)),he=new uP(i.shadowColor),de=new lP(pO(null!==(ie=i.offset)&&void 0!==ie?ie:new un(0,0,0),r)),fe=_O(i),ve=new lD(oe,re,ae,se,le,ue,ce,he,de,fe.alpha),pe=new bP(ve.calpha,"f");return new xO(t,n,e,k({positioning:oe,colors:re,steps:ae,source:se,isWorldSpace:le,noiseStrength:ue,noiseScale:ce,shadowColor:he,offset:de},fe),ve,fe.mode,pe,fe.isMask,r);case"outline":var me,ge,ye,xe,be,we,Se,_e,Ae,Me,Ee,Ce=new zP(null!==(me=i.outlineColor)&&void 0!==me?me:16777215),ke=new zP(null!==(ge=i.contourColor)&&void 0!==ge?ge:16777215),Te=new SP(vO(null!==(ye=i.outlineWidth)&&void 0!==ye?ye:.1,r)),Pe=new SP(vO(null!==(xe=i.contourWidth)&&void 0!==xe?xe:.1,r)),De=new SP(vO(null!==(be=i.outlineThreshold)&&void 0!==be?be:.1,r)),Oe=new SP(vO(null!==(we=i.contourThreshold)&&void 0!==we?we:.1,r)),Ie=new SP(vO(null!==(Se=i.outlineSmoothing)&&void 0!==Se?Se:.1,r)),Re=new SP(vO(null!==(_e=i.contourFrequency)&&void 0!==_e?_e:.1,r)),Le=new lP(pO(null!==(Ae=i.contourDirection)&&void 0!==Ae?Ae:new un(0,1,0),r)),Be=new NP(null!==(Me=i.positionalLines)&&void 0!==Me&&Me),ze=new NP(null===(Ee=i.compensation)||void 0===Ee||Ee),Fe=vD.normalRenderTarget,Ne=vD.normalRenderTargetDepth,Ue=vD.pixelRatioNode,Ze=vD.resolution,Ve=_O(i),je=new aD(Ce,ke,Te,Pe,De,Oe,Ie,Re,Le,Be,ze,Ze,Fe,Ne,Ue,Ve.alpha),Ge=new bP(je.calpha,"f");return new xO(t,n,e,k({outlineColor:Ce,contourColor:ke,outlineWidth:Te,contourWidth:Pe,outlineThreshold:De,contourThreshold:Oe,outlineSmoothing:Ie,contourFrequency:Re,contourDirection:Le,positionalLines:Be,compensation:ze},Ve),je,Ve.mode,Ge,Ve.isMask,r);case"depth":var He,We,qe,Xe,Ye,Qe,Ke,Je,$e=new FP(null!==(He=i.gradientType)&&void 0!==He?He:0),et=new NP(null!==(We=i.smooth)&&void 0!==We&&We),tt=new SP(null!==(qe=vO(i.near,r))&&void 0!==qe?qe:50),nt=new SP(null!==(Xe=vO(i.far,r))&&void 0!==Xe?Xe:200),it=new SP(null!==(Ye=i.isVector)&&void 0!==Ye?Ye:1),rt=new SP(null!==(Qe=i.isWorldSpace)&&void 0!==Qe?Qe:0),at=new lP(pO(i.origin,r)),ot=new lP(pO(i.direction,r));i.colors?Ke=new XP(i.colors.length,i.colors):(Ke=new XP(2,new nn(0,0,0,1))).value[1]=new nn(1,1,1,1),i.steps?Je=new UP(i.steps.length,i.steps):(Je=new UP(2,1)).value[0]=0;var st=_O(i),lt=new $P($e,et,tt,nt,it,rt,at,ot,Ke,Je,st.alpha,st.isMask),ut=new bP(lt.calpha,"f");return new xO(t,n,e,k({gradientType:$e,smooth:et,near:tt,far:nt,isVector:it,isWorldSpace:rt,origin:at,direction:ot,colors:Ke,steps:Je},st),lt,st.mode,ut,st.isMask,r);case"noise":var ct,ht,dt,ft,vt,pt,mt,gt,yt,xt,bt,wt,St,_t=new SP(null!==(ct=vO(i.scale,r))&&void 0!==ct?ct:1),At=new lP(pO(null!==(ht=i.size)&&void 0!==ht?ht:new un(100,100,100),r)),Mt=new SP(null!==(dt=vO(i.move,r))&&void 0!==dt?dt:1),Et=new sP(mO(null!==(ft=i.fA)&&void 0!==ft?ft:new Dt(1.7,9.2),r)),Ct=new sP(mO(null!==(vt=i.fB)&&void 0!==vt?vt:new Dt(8.3,2.8),r)),kt=new sP(mO(null!==(pt=i.distortion)&&void 0!==pt?pt:new Dt(1,1),r)),Tt=new uP(i.colorA),Pt=new uP(i.colorB),Ot=new uP(i.colorC),It=new uP(i.colorD),Rt=new FP(null!==(mt=i.noiseType)&&void 0!==mt?mt:0),Lt=new FP(null!==(gt=i.voronoiStyle)&&void 0!==gt?gt:0),Bt=new SP(null!==(yt=vO(i.highCut,r))&&void 0!==yt?yt:1),zt=new SP(null!==(xt=vO(i.lowCut,r))&&void 0!==xt?xt:0),Ft=new SP(null!==(bt=vO(i.smoothness,r))&&void 0!==bt?bt:.5),Nt=new SP(null!==(wt=vO(i.seed,r))&&void 0!==wt?wt:.5),Ut=new FP(null!==(St=i.quality)&&void 0!==St?St:1),Zt=_O(i),Vt=new rD(_t,At,Mt,Et,Ct,kt,Tt,Pt,Ot,It,Zt.alpha,Rt,Zt.isMask,Lt,Bt,zt,Ft,Nt,Ut),jt=new bP(Vt.calpha,"f");return new xO(t,n,e,k(k({scale:_t,size:At,move:Mt,fA:Et,fB:Ct,distortion:kt,colorA:Tt,colorB:Pt,colorC:Ot,colorD:It,noiseType:Rt},Zt),{},{voronoiStyle:Lt,highCut:Bt,lowCut:zt,smoothness:Ft,seed:Nt,quality:Ut}),Vt,Zt.mode,jt,Zt.isMask,r);case"normal":var Gt,Ht=new lP(null!==(Gt=i.cnormal)&&void 0!==Gt?Gt:new un(1,1,1)),Wt=_O(i),qt=new KP(Ht,Wt.alpha),Xt=new bP(qt.calpha,"f");return new xO(t,n,e,k({cnormal:Ht},Wt),qt,Wt.mode,Xt,Wt.isMask,r);case"gradient":var Yt,Qt,Kt,Jt,$t,en,tn,rn=new FP(null!==(Yt=i.gradientType)&&void 0!==Yt?Yt:0),an=new NP(null!==(Qt=i.smooth)&&void 0!==Qt&&Qt);i.colors?en=new XP(i.colors.length,i.colors):(en=new XP(10,new nn(0,0,0,1))).value[1]=new nn(1,1,1,1),i.steps?tn=new UP(i.steps.length,i.steps):(tn=new UP(10,1)).value[0]=0;var on=new sP(mO(null!==(Kt=i.offset)&&void 0!==Kt?Kt:new Dt(0,0),r)),sn=new sP(mO(null!==(Jt=i.morph)&&void 0!==Jt?Jt:new Dt(0,0),r)),ln=new SP(vO(null!==($t=i.angle)&&void 0!==$t?$t:0,r)),cn=_O(i),hn=new tD(rn,an,en,tn,on,sn,ln,cn.alpha,cn.isMask),dn=new bP(hn.calpha,"f");return new xO(t,n,e,k({gradientType:rn,smooth:an,colors:en,steps:tn,offset:on,morph:sn,angle:ln},cn),hn,cn.mode,dn,cn.isMask,r);case"pattern":var fn,vn,pn,mn,gn,yn,xn,bn,wn,Sn,_n,An,Mn,En=new FP(null!==(fn=i.style)&&void 0!==fn?fn:0),Cn=new FP(null!==(vn=i.projection)&&void 0!==vn?vn:0),kn=new FP(null!==(pn=["x","y","z"].indexOf(i.axis))&&void 0!==pn?pn:0),Tn=new SP(vO(null!==(mn=i.blending)&&void 0!==mn?mn:0,r)),Pn=new sP(mO(i.offset,r)),Dn=new uP(i.colorA),On=new uP(i.colorB),In=new sP(mO(null!==(gn=i.frequency)&&void 0!==gn?gn:new Dt(10,10),r)),Rn=new SP(vO(null!==(yn=i.size)&&void 0!==yn?yn:.5,r)),Ln=new SP(vO(null!==(xn=i.variation)&&void 0!==xn?xn:0,r)),Bn=new SP(vO(null!==(bn=i.smoothness)&&void 0!==bn?bn:.5,r)),zn=new SP(vO(null!==(wn=i.zigzag)&&void 0!==wn?wn:0,r)),Fn=new SP(vO(null!==(Sn=i.rotation)&&void 0!==Sn?Sn:0,r)),Nn=new sP(mO(null!==(_n=i.vertical)&&void 0!==_n?_n:new Dt(0,1),r)),Un=new sP(mO(null!==(An=i.horizontal)&&void 0!==An?An:new Dt(0,1),r)),Zn=new FP(null!==(Mn=i.sides)&&void 0!==Mn?Mn:6),Vn=_O(i),jn=new oD(En,Cn,kn,Tn,Pn,Dn,On,In,Rn,Ln,Bn,zn,Fn,Nn,Un,Zn,Vn.alpha,Vn.isMask),Gn=new bP(jn.calpha,"f");return new xO(t,n,e,k({style:En,projection:Cn,axis:kn,blending:Tn,offset:Pn,colorA:Dn,colorB:On,frequency:In,size:Rn,variation:Ln,smoothness:Bn,zigzag:zn,rotation:Fn,vertical:Nn,horizontal:Un,sides:Zn},Vn),jn,Vn.mode,Gn,Vn.isMask,r);default:var Hn=new zP(1,0,0,1),Wn=_O(i),qn=new QP(Hn,Wn.alpha),Xn=new bP(qn.calpha,"f");return new xO(t,n,e,k({color:Hn},Wn),qn,Wn.mode,Xn,Wn.isMask,r)}}(n,e,t,r,i)}(e,t,n,i)}}]),e}(),xO=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s,l,u,c){var h;return(0,b.Z)(this,n),(h=t.call(this,e,i,r,a,c)).params=a,h.color=o,h.mode=s,h.alpha=l,h.isMask=u,h}return n}(yO),bO=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s){var l;return(0,b.Z)(this,n),(l=t.call(this,e,i,r,a,s)).position=o,l}return n}(yO),wO=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a,o,s){var l;return(0,b.Z)(this,n),(l=t.call(this,e,i,r,o,s)).node=a,l}return(0,w.Z)(n,[{key:"category",get:function(){return this.node.category}}],[{key:"createLightLayer",value:function(e,t,i,r){var a,o,s=new SP(fO(i.alpha,r)),l=new FP(i.mode),u=new SP(i.bumpMapIntensity),c=new SP(fO(i.alphaOverride,r));if(i.visible)if("lambert"===i.category){var h,d;a=new bD;var f=new zP(null!==(h=r.color(i.emissive))&&void 0!==h?h:0),v=new NP(null===(d=i.occlusion)||void 0===d||d);o={emissive:f,occlusion:v},a.emissive=f,a.occlusion=v}else if("toon"===i.category){var p,m;a=new AD;var g=new SP(null!==(p=i.shininess)&&void 0!==p?p:30),y=new zP(null!==(m=r.color(i.specular))&&void 0!==m?m:1118481);o={shininess:g,specular:y},a.shininess=g,a.specular=y}else if("physical"===i.category){var x,b,w,S;a=new _D;var _=new SP(null!==(x=i.roughness)&&void 0!==x?x:.3),A=new SP(null!==(b=i.metalness)&&void 0!==b?b:0),M=new SP(null!==(w=i.reflectivity)&&void 0!==w?w:.5),E=new NP(null===(S=i.occlusion)||void 0===S||S);o={roughness:_,metalness:A,reflectivity:M,occlusion:E},a.roughness=_,a.metalness=A,a.reflectivity=M,a.occlusion=E}else{var C,k,T;a=new SD;var P=new SP(null!==(C=i.shininess)&&void 0!==C?C:30),D=new zP(void 0!==i.specular&&null!==(k=r.color(i.specular))&&void 0!==k?k:1118481),O=new NP(null===(T=i.occlusion)||void 0===T||T);o={shininess:P,specular:D,occlusion:O},a.shininess=P,a.specular=D,a.occlusion=O}else a=new xD,o={};return a.alpha=new SP(1),a.shadingAlpha=s,a.shadingBlend=l,a.bumpMapIntensity=u,a.alphaOverride=c,o.alpha=a.shadingAlpha,o.mode=a.shadingBlend,o.bumpMapIntensity=a.bumpMapIntensity,o.alphaOverride=a.alphaOverride,new n(e,t,i,a,o,r)}}]),n}(yO);function SO(e){var t=e instanceof yO?e.type:e;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}function _O(e){var t,n,i;return{alpha:new SP(null!==(t=e.alpha)&&void 0!==t?t:1),mode:new FP(null!==(n=e.mode)&&void 0!==n?n:0),isMask:new NP(null!==(i=e.isMask)&&void 0!==i&&i)}}function AO(e,t,n,i){if("displace"===n.type&&("intensity"===e||"visible"===e)){var r,a=t.uniforms["f".concat(t.id,"_intensity")];return a?(a.value=(null!==(r=vO(n.intensity,i))&&void 0!==r?r:1)*(n.visible?1:0),a):void 0}if("displace"!==n.type&&("alpha"===e||"visible"===e)){var o=t.uniforms["f".concat(t.id,"_alpha")];if(!o)return;if(o.value=fO(n.alpha,i)*(n.visible?1:0),"outline"===n.type&&"visible"===e){var s=t.uniforms["f".concat(t.id,"_compensation")];s&&(s.value=n.compensation&&n.visible)}return o}}function MO(e,t,n,i,r,a){var o,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],u=n,c=D(s);try{for(c.s();!(o=c.n()).done;){var h=o.value;h in u&&(u=u[h])}}catch(y){c.e(y)}finally{c.f()}var d,f=D(e);try{for(f.s();!(d=f.n()).done;){var v=d.value;v in u&&r.getVariable(u[v],["material",a,"layer",i].concat((0,l.Z)(s),[String(v)]))}}catch(y){f.e(y)}finally{f.f()}var p,m=D(t);try{var g=function(){var e=p.value;e in u&&u[e].forEach((function(t,n){r.getVariable(t,["material",a,"layer",i].concat((0,l.Z)(s),[String(e),0===n?"x":1===n?"y":"z"]))}))};for(m.s();!(p=m.n()).done;)g()}catch(y){m.e(y)}finally{m.f()}}function EO(e,t){var n=0,i=e.layers.find((function(e){return"light"===e.data.type}));if(i){var r=i.data,a=Number(t.getVariable(r.alphaOverride));if(("string"==typeof r.alphaOverride?a/100:r.alphaOverride)<1)return!0}var o,s=D(e.layers);try{for(s.s();!(o=s.n()).done;){var l=o.value;if("displace"!==l.data.type&&l.data.isMask)return!0;if("displace"!==l.data.type&&"alpha"in l.data&&"light"!==l.data.type&&"fresnel"!==l.data.type&&"texture"!==l.data.type&&"matcap"!==l.data.type&&"rainbow"!==l.data.type&&"outline"!==l.data.type&&"pattern"!==l.data.type){var u,c=l.data.visible?l.data.alpha:0;if("string"==typeof c&&(c=Math.max(0,Math.min(1,Number(null!==(u=t.getVariable(c))&&void 0!==u?u:100)/100))),1===c&&"depth"===l.data.type||"gradient"===l.data.type){var h,d=D(l.data.colors);try{for(d.s();!(h=d.n()).done;){var f=h.value;if(f[3]<1){c=f[3];break}}}catch(x){d.e(x)}finally{d.f()}}else if(1===c&&"noise"===l.data.type){var v=t.color(l.data.colorA).a,p=t.color(l.data.colorB).a,m=t.color(l.data.colorC).a,g=t.color(l.data.colorD).a,y=Math.min(v,Math.min(p,Math.min(m,g)));y<1&&(c=y)}n+=(1-n)*c}}}catch(x){s.e(x)}finally{s.f()}return n<1}var CO=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,void 0)).flatShading=!1,e.needsJitter=!0,e.shadersPatchedForShapeBlend=!1,e.nodeContextUuid=0,e.fog=!0,e.dithering=!0,e.vertexColors=!0,e.transparent=!0,e}return(0,w.Z)(n,[{key:"customProgramCacheKey",value:function(){return""}}]),n}(ar),kO=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a){var o;return(0,b.Z)(this,n),(o=t.call(this)).flatShading=e,o.side=i,o.wireframe=r,o.root=a,o}return(0,w.Z)(n,[{key:"updateAfterBuild",value:function(){var e=this.root;this.lights=e.lights,this.vertexShader=e.vertexShader,this.fragmentShader=e.fragmentShader,Object.assign(this.defines,e.defines),Object.assign(this.uniforms,e.uniforms),this.extensions=e.extensions,this.transparent=e.transparent,this.cacheKey=e.customProgramCacheKey()+"flat"+this.flatShading+this.side}},{key:"onBeforeCompile",value:function(e,t){this.root.onBeforeCompile(e)}},{key:"getFlavor",value:function(e,t,n,i){return this.root.getFlavor(e,t,n,i)}},{key:"getLayersOfType",value:function(e){return this.root.getLayersOfType(e)}},{key:"getLayerByUuid",value:function(e){return this.root.getLayerByUuid(e)}},{key:"updateByOp",value:function(e,t,n){this.root.updateByOp(e,t,n)}},{key:"nodeMaterialDispose",value:function(){this.root.nodeMaterialDispose()}},{key:"data",get:function(){return this.root.data}},{key:"category",get:function(){return this.root.category}},{key:"hasAO",get:function(){return this.root.hasAO}},{key:"layers",get:function(){return this.root.layers}},{key:"fragment",get:function(){return this.root.fragment}}]),n}(CO),TO=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return(0,b.Z)(this,n),(r=t.call(this)).data=e,r.allowVariableSaves=a,r.layerIdGen=0,r.flavors=[],r.masks={},r.type="NodeMaterial",r.updaters=[],r.needsJitter=i.shared.needsJitter,nP.startContext((0,f.Z)(r)),r.reset0(e,i),nP.endContext((0,f.Z)(r)),r}return(0,w.Z)(n,[{key:"getFlavor",value:function(e,t,n,i){var r,a=n?6:(e?3:0)+t;if(0===(a+=7*((null!==(r=null===i||void 0===i?void 0:i.resolutionLevel)&&void 0!==r?r:0)-(null!==i&&void 0!==i&&i.useChildrenColors?4:0))))return this;void 0===this.flavors&&(this.flavors=[]),a-=1;var o=this.flavors[a];return void 0===o&&((o=new kO(e,t,n,this)).needsJitter=this.needsJitter,this.flavors[a]=o,o.flatShading=e,o.side=t,o.updateAfterBuild(),i&&(o.defines.SHAPEBLEND=i.resolutionLevel,o.defines.SHAPEBLEND_C=i.useChildrenColors?1:0)),o}},{key:"reset",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];nP.startContext(this),(this.data!==e||n)&&this.reset0(e,t),nP.endContext(this)}},{key:"reset0",value:function(e,t){var n,i,r=this;this.data=e;var a=null!==(n=e.layers)&&void 0!==n?n:Ab.defaultTwoLayerData("phong").layers;try{this.layers=a.map((function(e){return yO.create(r.layerIdGen++,e.id,e.data,t.shared)}))}catch(o){this.layers=[]}this.layers.reverse(),this.name=null!==(i=e.name)&&void 0!==i?i:"Untitled Material",this.onUpdate(t.shared),this.transparent=EO(e,t.shared),this.saveVariableLocations(t)}},{key:"onVariableUpdate",value:function(e,t,n){if("alphaOverride"===e[0])this.transparent=EO(this.data,n.shared),this.lightLayer.setValue("alphaOverride",Math.max(0,Math.min(Number(t)/100,1)));else if("layer"===e[0]){var i=e[1],r=e[2];if(i&&r){var a=this.layers.find((function(e){return e.uuid===i}));if(null!==a&&void 0!==a&&a.hasValue(r))if("alpha"===r)this.transparent=EO(this.data,n.shared),a.setValue(r,Math.max(0,Math.min(Number(t)/100,1)));else{var o=a.getValue(r),s=e[3],l=e[4];if(o instanceof tn){var u,c=o[s];return"number"==typeof c?u=Number(t):c.isVector2&&(u=c.toArray(),"x"===l?u[0]=Number(t):"y"===l&&(u[1]=Number(t))),void dO((0,g.Z)({},s,u),n.shared,a)}("x"===s||"y"===s||"z"===s)&&o.isVector3||("x"===s||"y"===s)&&o.isVector2?o[s]=Number(t):a.setValue(r,t)}}}}},{key:"saveVariableLocations",value:function(e){var t=this;if(this.allowVariableSaves){var n=this.data.layers.find((function(e){return"light"===e.data.type}));n&&e.shared.getVariable(n.data.alphaOverride,["material",this.uuid,"alphaOverride"]),this.data.layers.forEach((function(n){"alpha"in n.data&&"string"==typeof n.data.alpha&&e.shared.getVariable(n.data.alpha,["material",t.uuid,"layer",n.id,"alpha"]),"displace"===n.data.type?"noise"===n.data.displacementType?MO(["intensity","scale","movement","smoothness","seed","highCut","lowCut"],["offset"],n.data,n.id,e.shared,t.uuid):MO(["intensity"],[],n.data,n.id,e.shared,t.uuid):"depth"===n.data.type?MO(["near","far"],["origin","direction"],n.data,n.id,e.shared,t.uuid):"fresnel"===n.data.type?MO(["bias","scale","intensity","factor"],[],n.data,n.id,e.shared,t.uuid):"rainbow"===n.data.type?MO(["filmThickness","movement","noiseStrength","noiseScale"],["offset","wavelengths"],n.data,n.id,e.shared,t.uuid):"noise"===n.data.type?MO(["scale","move","seed","highCut","lowCut","smoothness"],["size","distortion","fA","fB"],n.data,n.id,e.shared,t.uuid):"pattern"===n.data.type?MO(["blending","size","variation","smoothness","zigzag","rotation"],["offset","frequency","vertical","horizontal"],n.data,n.id,e.shared,t.uuid):"outline"===n.data.type?MO(["outlineWidth","contourWidth","outlineThreshold","contourThreshold","outlineSmoothing","contourFrequency"],["contourDirection"],n.data,n.id,e.shared,t.uuid):"toon"===n.data.type?MO(["noiseStrength","noiseScale"],["offset","source"],n.data,n.id,e.shared,t.uuid):"transmission"===n.data.type?MO(["roughness","thickness","ior"],[],n.data,n.id,e.shared,t.uuid):"texture"===n.data.type||"video"===n.data.type?(MO([],["size"],n.data,n.id,e.shared,t.uuid),MO(["rotation"],["repeat","offset"],n.data,n.id,e.shared,t.uuid,["texture"])):"gradient"===n.data.type?MO(["angle"],["offset","morph"],n.data,n.id,e.shared,t.uuid):"matcap"===n.data.type&&MO(["rotation"],[],n.data,n.id,e.shared,t.uuid,["texture"])}))}}},{key:"getLayersOfType",value:function(e){return this.layers.filter((function(t){return t.type===e}))}},{key:"getLayerByUuid",value:function(e){return this.layers.find((function(t){return t.uuid===e}))}},{key:"onUpdate",value:function(e){this.lightLayer=this.layers.find((function(e){return e instanceof wO})),void 0===this.lightLayer&&(this.lightLayer=new wO(0,"",k(k({},Sb.defaultData("light","phong")),{},{visible:!1}),new xD,{},e)),this.dispose();var t,n=D(this.flavors);try{for(n.s();!(t=n.n()).done;){var i=t.value;i&&i.dispose()}}catch(r){n.e(r)}finally{n.f()}this.applyTextureMaps(),this.applyMasks(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.build(),this.nodeContextUuid=0}},{key:"applyTextureMaps",value:function(){var e=this.layers.find((function(e){return e instanceof wO}));if(e){var t=e.data,n=t.bumpMap,i=t.roughnessMap;e.node.bumpMap=void 0,e.node.roughnessMap=void 0;for(var r=0;r0){var r=n-1,a=this.layers[r];a instanceof wO?a.node.mask=new AP(i.color,i.alpha,AP.MUL):a instanceof xO&&(a.isMask.value||(a.color.mask=new AP(i.color,i.alpha,AP.MUL)))}}}},{key:"blendColors",value:function(){var e=this.layers.findIndex((function(e){return e instanceof xO})),t=this.layers.findIndex((function(e){return e instanceof wO}));if(-1!==e&&et+1){for(var n=t+1;n0){for(var t=e[0].position,n=1;n1?(i.replay(),i.loopsRemaining--):(i._status="stopped",i.loopsRemaining=i._loop)},n="string"==typeof r?{src:r}:{src:OO(r),format:"wav"},this.sound=new LO.Howl(n),this.sound.on("end",this.onEnd),this.src=r,void 0!==a&&(this.volume=a),void 0!==o&&(this.delay=o),void 0!==s&&(this.loop=s)}return(0,w.Z)(e,[{key:"replay",value:function(){var e=this;this.clearDelay(),this.delayTimerId=window.setTimeout((function(){e.sound.play(),e.clearDelay()}),this.delay)}},{key:"fade",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout((function(){t.sound.fade(t._volume,0,n),t.clearFade()}),e)):this.sound.fade(this._volume,0,n)}},{key:"on",value:function(e,t,n){this.sound.on(e,t,n)}},{key:"off",value:function(e,t,n){this.sound.off(e,t,n)}},{key:"play",value:function(){"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"))}},{key:"pause",value:function(){"playing"===this._status&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}},{key:"stop",value:function(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}},{key:"clearFade",value:function(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}},{key:"clearDelay",value:function(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}},{key:"dispose",value:function(){this.off(),this.stop(),this.clearFade(),this.clearDelay()}},{key:"status",get:function(){return this._status}},{key:"volume",get:function(){return this._volume},set:function(e){this._volume=e,this.sound.volume(e)}},{key:"loop",get:function(){return this._loop},set:function(e){this._loop=e,this.loopsRemaining=e}}]),e}(),GO=function(){function e(){(0,b.Z)(this,e),this.type="ShapePath",this.color=new Yt,this.subPaths=[],this.currentPath=null}return(0,w.Z)(e,[{key:"moveTo",value:function(e,t){return this.currentPath=new Ys,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}},{key:"lineTo",value:function(e,t){var n;return null!==(n=this.currentPath)&&void 0!==n&&n.lineTo(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,i){var r;return null!==(r=this.currentPath)&&void 0!==r&&r.quadraticCurveTo(e,t,n,i),this}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){var o;return null!==(o=this.currentPath)&&void 0!==o&&o.bezierCurveTo(e,t,n,i,r,a),this}},{key:"splineThru",value:function(e){var t;return null!==(t=this.currentPath)&&void 0!==t&&t.splineThru(e),this}},{key:"toShapes",value:function(){var e=this,t=0,n=1,i=2,r=3,a=4,o=5,s=6,l={loc:t,t:0};function u(e,n,r,a){var o=e.x,s=n.x,u=r.x,h=a.x,d=e.y,f=n.y,v=r.y,p=a.y,m=(h-u)*(d-v)-(p-v)*(o-u),g=(p-v)*(s-o)-(h-u)*(f-d),y=m/g,x=((s-o)*(d-v)-(f-d)*(o-u))/g;if(0===g&&0!==m||y<=0||y>=1||x<0||x>1)return null;if(0===m&&0===g){for(var b=0;b<2;b++){if(c(0===b?r:a,e,n),l.loc===t){var w=0===b?r:a;return{x:w.x,y:w.y,t:l.t}}if(l.loc===i)return{x:+(o+l.t*(s-o)).toPrecision(10),y:+(d+l.t*(f-d)).toPrecision(10),t:l.t}}return null}for(var S=0;S<2;S++)if(c(0===S?r:a,e,n),l.loc===t){var _=0===S?r:a;return{x:_.x,y:_.y,t:l.t}}return{x:+(o+y*(s-o)).toPrecision(10),y:+(d+y*(f-d)).toPrecision(10),t:y}}function c(e,u,c){var h,d=c.x-u.x,f=c.y-u.y,v=e.x-u.x,p=e.y-u.y,m=d*p-v*f;if(e.x===u.x&&e.y===u.y)return l.loc=t,void(l.t=0);if(e.x===c.x&&e.y===c.y)return l.loc=n,void(l.t=1);m<-Number.EPSILON?l.loc=r:m>Number.EPSILON?l.loc=a:d*v<0||f*p<0?l.loc=o:Math.sqrt(d*d+f*f)=l.t-Number.EPSILON}))&&(n.push(l),i.push(new Dt(l.x,l.y)))},l=1;ln&&(n=s.y),s.yr&&(r=s.x),s.x=a&&(f=a-1),t.length&&p.push({curves:e.curves,points:t,isCW:kl.isClockWise(t),identifier:d++,boundingBox:new Ju(new Dt(a,i),new Dt(r,n))})}));var m=p.map((function(t){var n;return function(e,t,n,i,r){(null==r||""===r)&&(r="nonzero");var a=new Dt;e.boundingBox.getCenter(a);var o=h([new Dt(n,a.y),new Dt(i,a.y)],e.boundingBox,t);o.sort((function(e,t){return e.point.x-t.point.x}));var s=[],l=[];o.forEach((function(t){t.identifier===e.identifier?s.push(t):l.push(t)}));for(var u=s[0].point.x,c=[],d=0;d0&&c[c.length-1]===l[d].identifier?c.pop():c.push(l[d].identifier),d++;if(c.push(e.identifier),"evenodd"===r){var f=c.length%2===0,v=c[c.length-2];return{identifier:e.identifier,isHole:f,for:v}}if("nonzero"===r){for(var p=!0,m=null,g=null,y=0;y2&&void 0!==a[2]?a[2]:function(){},e.next=3,WO;case 3:r=e.sent,(0,r.load)(t,(function(e,t){e||!t?i(null!==e&&void 0!==e?e:"Something went wrong"):n(t)}));case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"parse",value:function(){var e=(0,c.Z)(x().mark((function e(t){var n,i,r,a,o,s;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,WO;case 2:return n=e.sent,i=n.parse,r=n.Bidi,e.prev=5,a=i(t),o=new r,s=function(e){return a.charToGlyphIndex(e.char)},e.abrupt("return",(o.registerModifier("glyphIndex",null,s),o.applyFeatures(a,a.defaultRenderOptions.features),{font:a,bidi:o}));case 10:e.prev=10,e.t0=e.catch(5),console.error(e.t0);case 13:case"end":return e.stop()}}),e,null,[[5,10]])})));return function(t){return e.apply(this,arguments)}}()}]),e}());function JO(e){return $O.apply(this,arguments)}function $O(){return($O=(0,c.Z)(x().mark((function e(t){var n,i,r,a;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!1,!t.url){e.next=9;break}return e.next=4,YO(t.url);case 4:n=e.sent,i=t.url,r=t.url.startsWith("/"),e.next=10;break;case 9:t.data&&(n=t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength));case 10:if(!n){e.next=20;break}if(!HO){e.next=19;break}return e.next=14,KO.parse(n);case 14:if(!(a=e.sent)){e.next=17;break}return e.abrupt("return",{font:a.font,url:i,intercepted:r,arr:n,bidi:a.bidi});case 17:e.next=20;break;case 19:return e.abrupt("return",{font:void 0,url:i,intercepted:r,arr:n,bidi:null});case 20:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function eI(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}var tI=function(){function e(t){var n,i=this;(0,b.Z)(this,e),this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=null!==(n=t.isUserFont)&&void 0!==n&&n,this._loadingPromise=JO(t).then((function(e){e&&(i._arrayBuffer=e.arr,i._url=e.url,i.font=e.font,i._intercepted=e.intercepted,i._isLoaded=!0,i._bidi=e.bidi)}))}return(0,w.Z)(e,[{key:"update",value:function(e){var t,n=this;this._isLoaded=!1,this._isUserFont=null!==(t=e.isUserFont)&&void 0!==t&&t,this._loadingPromise=JO(e).then((function(e){e&&(n._arrayBuffer=e.arr,n._url=e.url,n.font=e.font,n._intercepted=e.intercepted,n._isLoaded=!0,n._bidi=e.bidi)}))}},{key:"reverseLigaturesTable",value:function(e,t,n){if(!this._bidi)return[];var i=this._bidi;i.getTextGlyphs(t);for(var r=i.tokenizer.tokens,a=[],o=0,s=n.length===r.length,l=0;lt.length&&(m=!0);a.push({char:c,index:u,replacements:v,replacementChars:Array.from(d)}),o++}}return a}},{key:"generateShapes",value:function(e,t,n){var i=this;if(this._isLoaded){for(var r=this.font,a=t.fontSize/this.unitsPerEm,o=t.fontSize*t.lineHeight,s=e.map((function(e){return i.getTextWidth(e,t)})),u="string"==typeof t.width?Number(n.getVariable(t.width)):t.width,c="string"==typeof t.height?Number(n.getVariable(t.height)):t.height,h=this.getCharWidth("\n",t),d=1===t.horizontalAlign?h:0,f=this.getLineInitialOffsetX(s[0],u,t.horizontalAlign,e[0],h),v=this.getLineInitialOffsetY(o,e.length,c,a,t.verticalAlign),p=[],m=e.map((function(e){return[]})),g=e.map((function(e){return[]})),y=function(l){var c,y=e[l],x={features:{liga:!0},letterSpacing:t.letterSpacing},b=[];try{b=r.stringToGlyphs(y,x)}catch(M){console.warn(M)}f=i.getLineInitialOffsetX(s[l],u,t.horizontalAlign,y,h);var w=[];try{w=i.reverseLigaturesTable(r,y,b)}catch(M){console.warn(M)}var S=i.computeSpaceWidthForLine(e,l,t,n),_=0,A=b[0];A&&2===t.horizontalAlign&&void 0!==A.leftSideBearing&&(f-=A.leftSideBearing*a),null!==(c=i.font)&&void 0!==c&&c.forEachGlyph(y,f,v,t.fontSize,x,(function(e,n,o,s,u){var c=0===e.index?"\n":e.unicode?String.fromCharCode(e.unicode):void 0,h=w[_],f=0;if("\n"===c)f=d;else if(" "===c)f=S;else{var v=i.createPath(e,a,n,o,t);v&&(f=v.offsetX,p.push(v.path))}if(1===h.replacements.length)g[l].push([n,o]),m[l].push(f);else for(var y=h.replacements.map((function(e){var t;return(null!==(t=r.glyphs.get(e).advanceWidth)&&void 0!==t?t:0)*a})),x=y.reduce((function(e,t){return e+t}),0),b=y.map((function(e){return e/x})),A=n,M=0;M=0&&(e-=r),3===n?.5*t-.5*e:2===n?t-e:0}},{key:"getLineInitialOffsetY",value:function(e,t,n,i,r){var a=t*e,o=e-Math.abs(this.ascender-this.descender)*i,s=-this.ascender*i-o/2;return 3===r?-(n-a-s):2===r?-(.5*n-.5*a-s):s}},{key:"createPath",value:function(e,t,n,i,r){var a,o=e.getPath(n,-i,r.fontSize,{kerning:!1,letterSpacing:r.letterSpacing});if(o){var s=new GO,l=(null!==(a=e.advanceWidth)&&void 0!==a?a:1)*t;if(e){var u,c=D(o.commands);try{for(c.s();!(u=c.n()).done;){var h,d=u.value,f=null===(h=s.currentPath)||void 0===h?void 0:h.currentPoint;if(!f||"Z"===d.type||f.x!==d.x||-f.y!==d.y)switch(d.type){case"M":s.moveTo(d.x,-d.y);break;case"L":s.lineTo(d.x,-d.y);break;case"Q":s.quadraticCurveTo(d.x1,-d.y1,d.x,-d.y);break;case"C":s.bezierCurveTo(d.x1,-d.y1,d.x2,-d.y2,d.x,-d.y)}}}catch(v){c.e(v)}finally{c.f()}}return s.subPaths.forEach((function(e){var t=function(e){if(e.length){var t=e[0];if(t instanceof Vs)return t.v1;if(t instanceof Us||t instanceof Gs)return t.v0}}(e.curves);void 0!==t&&e.currentPoint.distanceTo(t)>0&&e.lineTo(t.x,t.y)})),{offsetX:l,path:s}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".")}},{key:"getCharWidth",value:function(e,t){var n,i;return null!==(n=null===(i=this.font)||void 0===i?void 0:i.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing}))&&void 0!==n?n:0}},{key:"getTextWidth",value:function(e,t){var n,i;return null!==(n=null===(i=this.font)||void 0===i?void 0:i.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing}))&&void 0!==n?n:0}},{key:"computeSpaceWidthForLine",value:function(e,t,n,i){var r=this.getCharWidth(" ",n),a=e[t];if(a){var o=this.countSpaces(a.trimEnd());if(4===n.horizontalAlign&&taI&&(this.reconnectWaitFor=aI),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout((function(){e.scheduledReconnectHandle=void 0,e.connect()}),this.reconnectWaitFor)}},{key:"update",value:function(e){this.userWebhook=e}},{key:"dispose",value:function(){this._connected&&this.disconnect()}},{key:"on",value:function(e,t){this.emitter.on(e,t)}},{key:"off",value:function(e,t){this.emitter.off(e,t)}},{key:"getParametersKeys",value:function(){return this.userWebhook.parametersSchemas.map((function(e){return e.data.name}))}},{key:"getParameterValue",value:function(e){if(this.getParametersKeys().includes(e)){var t;if(this.result)return null===(t=this.result)||void 0===t?void 0:t[e];var n,i=D(this.userWebhook.parametersSchemas);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.data.name===e)return Cw.defaultParameterValueByType(r.data.type)}}catch(a){i.e(a)}finally{i.f()}}}},{key:"connected",get:function(){return this._connected}}]),e}()),uI=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],cI=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],hI=[],dI=[],fI=1;fI<=8;fI++)for(var vI=0;vImI[0]&&hI[t]mI[0]&&hI[t]3&&void 0!==arguments[3]?arguments[3]:"frequency",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-100,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:-30;n||(n=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(n));var o,s,l,u=t/2,c=1/n.length*u;if("music"===i||"voice"===i){for(var h="voice"===i?gI:hI,d=Array(h.length).fill(r),f=0;f=0;m--)if(v>h[m]){d[m]=Math.max(d[m],p);break}o=d,s="voice"===i?gI:hI,l="voice"===i?yI:dI}else l=(s=(o=Array.from(n)).map((function(e,t){return c*t}))).map((function(e){return"".concat(e.toFixed(2)," Hz")}));var g=o.map((function(e){return Math.max(0,Math.min((e-r)/(a-r),1))}));return{values:new Float32Array(g),frequencies:s,labels:l}}}]),e}();function bI(e){return wI.apply(this,arguments)}function wI(){return(wI=(0,c.Z)(x().mark((function e(t){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("https://relayserver.spline.design/session?uuidfile="+t);case 3:return e.next=5,e.sent.json();case 5:return e.abrupt("return",e.sent.token);case 8:e.prev=8,e.t0=e.catch(0),console.error("Token generation error:",e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))).apply(this,arguments)}var SI=function(){function e(t){(0,b.Z)(this,e),this.value=0,this.frequencies=new Float32Array(0);var n=new AudioContext;this.source=n.createMediaStreamSource(t),this.analyser=n.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}return(0,w.Z)(e,[{key:"getFrequencies",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-100,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-30;if(!this.analyser)throw new Error("Not connected, please call .connect() first");return xI.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}},{key:"update",value:function(){var e=this.getFrequencies(),t=e.values.reduce((function(e,t){return e+t}),0)/e.values.length;this.value=t,this.frequencies=e.values}},{key:"disconnect",value:function(){this.source.disconnect(),this.analyser.disconnect()}}]),e}(),_I=function(){function e(t,n,i){var r=this;(0,b.Z)(this,e),this.data=t,this.id=n,this.shared=i,this.emitter=jk(),this.rafId=0,this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onMessage=function(e){var t,n=JSON.parse(e.data);if(r.appendEvent(n),"session.created"===n.type&&r.onSessionCreated(),"response.done"===n.type&&null!==(t=n.response)&&void 0!==t&&t.output){var i,a=D(n.response.output);try{for(a.s();!(i=a.n()).done;){var o=i.value;if("function_call"===o.type){var s,l=D(r.tools);try{for(l.s();!(s=l.n()).done;){var u=(0,h.Z)(s.value,2),c=u[0],d=u[1];o.name===c.name&&(d(JSON.parse(o.arguments)),setTimeout((function(){r.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})})))}}catch(f){l.e(f)}finally{l.f()}}}}catch(f){a.e(f)}finally{a.f()}}},this.onSessionCreated=function(){r.isToolsAdded||r.registerTools()},this.onOpen=function(){r.events=[],r.isConnected=!0,r.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})},this.animate=function(){if(r.rafId=requestAnimationFrame(r.animate),r.isConnected&&r.analyser){r.analyser.update();var e=r.analyser.value,t=r.analyser.frequencies;r.voice=e,r.frequencies=t,r.emitter.emit("voice",{value:e,frequencies:t})}}}return(0,w.Z)(e,[{key:"update",value:function(e){this.data=e}},{key:"setColorByName",value:function(e,t){var n=this.shared.getColorByName(e);if(n){var i,r=n.id,a=null!==(i=Bk.hexStringToRgb(t))&&void 0!==i?i:{r:0,g:0,b:0},o=a.r,s=a.g,l=a.b;this.shared.updateColor(r,{r:o/255,g:s/255,b:l/255})}}},{key:"connect",value:function(){var e=(0,c.Z)(x().mark((function e(){var t,n,i,r,a=this;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isConnected){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,bI(this.data.integration.hash);case 4:return t=e.sent,this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=function(e){var t=e.streams[0];a.audioElement.srcObject=t,a.analyser=new SI(t)},e.next=8,navigator.mediaDevices.getUserMedia({audio:!0});case 8:return n=e.sent,this.pc.addTrack(n.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen),e.next=12,this.pc.createOffer();case 12:return i=e.sent,e.next=15,this.pc.setLocalDescription(i);case 15:return e.next=17,fetch("https://api.openai.com/v1/realtime?model=".concat("gpt-4o-realtime-preview-2024-12-17"),{method:"POST",body:i.sdp,headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/sdp"}});case 17:return e.next=19,e.sent.text();case 19:return e.t0=e.sent,r={type:"answer",sdp:e.t0},e.next=23,this.pc.setRemoteDescription(r);case 23:this.animate();case 24:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"appendEvent",value:function(e){this.events=[e].concat((0,l.Z)(this.events))}},{key:"sendClientEvent",value:function(e){this.dc?(e.event_id=e.event_id||crypto.randomUUID(),this.dc.send(JSON.stringify(e)),this.appendEvent(e)):console.error("Failed to send message - no data channel available",e)}},{key:"registerTools",value:function(){var e=this;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"]}},(function(t){var n=t.color;e.setColorByName("Voice Assistant Color",n)}));var 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: ".concat(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"]}},(function(t){var n=t.name,i=t.value,r=e.shared.getVariableByName(n);if(r){var a,o=e.shared.getVariable(r.id);a="number"==typeof o?parseFloat(i):"boolean"==typeof o?"true"===i.toLowerCase():{textValue:i},e.shared.updateVariable(r.id,a)}}));var n=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: ".concat(n,". 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"]}},(function(t){var n=t.name,i=t.value;e.setColorByName(n,i)}));var i=this.shared.scene,r=[];i.traverseEntity((function(e){e.data.events.forEach((function(e){if("AIAssistantTrigger"===e.data.type){var t=e.data.description;r.push(t)}}))})),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:"The name of the event that needs to be triggered. Here's a list of available events: ".concat(JSON.stringify(r),".")},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},(function(t){var n=t.description,i=t.direction;e.emitter.emit("trigger_event",{description:n,direction:i})})),this.sendClientEvent({type:"session.update",session:{tools:this.tools.map((function(e){return(0,h.Z)(e,1)[0]}))}})}},{key:"registerTool",value:function(e,t){this.tools.push([e,t])}},{key:"disconnect",value:function(){var e,t,n,i,r,a;cancelAnimationFrame(this.rafId),null!==(e=this.analyser)&&void 0!==e&&e.disconnect(),this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,null!==(t=this.dc)&&void 0!==t&&t.removeEventListener("message",this.onMessage),null!==(n=this.dc)&&void 0!==n&&n.removeEventListener("open",this.onOpen),null!==(i=this.dc)&&void 0!==i&&i.close(),null!==(r=this.pc)&&void 0!==r&&r.getSenders().forEach((function(e){e.track&&e.track.stop()})),null!==(a=this.pc)&&void 0!==a&&a.close(),this.pc=void 0}},{key:"computeAnalysisForListenerEvent",value:function(e){if("range"===e.analysis){var t,n=(t=this.frequencies).slice.apply(t,(0,l.Z)(e.analysisRange));return n.reduce((function(e,t){return e+t}),0)/n.length}return"single"===e.analysis?this.frequencies[e.analysisSingle]:this.voice}},{key:"on",value:function(e,t){this.emitter.on(e,t)}},{key:"off",value:function(e,t){this.emitter.off(e,t)}}]),e}();function AI(e){return"variable_"+e}var MI=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this)).shared=e,i}return(0,w.Z)(n,[{key:"create",value:function(e){return new TD(e,this.shared)}}]),n}(kD),EI=function(){function e(t){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if((0,b.Z)(this,e),this.data=t,this.needsJitter=r,this.enableLocalStorageForPersistentVariables=a,this.geometryCache=new nI(!0),this.geometryCache2=new nI(!1),this.imageHolderCache=new MI(this),this.thisContext={scene:iI,shared:this},this.deletedMaterial=new PO(Ab.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new PD(nS.emptyImage,this),this.deletedVideo=new PD(yb.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=function(){n._requestRender&&n._requestRender()},i.images)for(var o=0,s=Object.entries(i.images);o1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.data=e,this.resetLib(e.lib);var i,r=D(e.variables);try{for(r.s();!(i=r.n()).done;){var a=i.value,o=a.id,s=a.data;this.addVariableHolder(o,s),t&&this.updateVariableHolder(o,s)}}catch(ue){r.e(ue)}finally{r.f()}for(var l=0,u=Object.entries(null!==(c=e.userAPIs)&&void 0!==c?c:{});l=0;a--){var o=this.variables[e].locations[a];if("material"===o[0])!function(){var e=o[1],t=i,a={scene:r,shared:n},s=o.slice(2);r.traverseMaterial((function(n){var i,r=null!==(i=n.root)&&void 0!==i?i:n;r.uuid===e&&r.onVariableUpdate(s,t,a)}));var l=n.materials[e];l&&l.onVariableUpdate(s,t,a)}();else{var s=r.find(o[0]);if(void 0===s){this.variables[e].locations.splice(a,1);continue}if("geometry"!==o[1]&&"particles"!==o[1]){for(var l=1;l1&&this.getMaterial(e.path[1]).updateByOp(sg.drop(e,2),t.materials[e.path[1]],{shared:this,scene:n});else if("fonts"===e.path[0])2===e.path.length&&0===e.type?this.updateFont(e.path[1],e,n):1===e.path.length&&1===e.type?this.addFont(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteFont(e.id);else if("variables"===e.path[0])2===e.path.length&&0===e.type?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):1===e.path.length&&4===e.type?this.addVariableHolder(e.id,e.data):1===e.path.length&&5===e.type&&this.deleteVariable(e.id);else if("userAPIs"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserAPI(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserAPI(e.id);else if("string"==typeof e.path[1]){var i=t.userAPIs[e.path[1]];if(i){var r=0===e.type&&void 0===e.props.debounce,a=this.getUserAPI(e.path[1]);a instanceof _I?a.update(i):null===a||void 0===a||a.update(i,this,r)}}}else if("userWebhooks"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserWebhook(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserWebhook(e.id);else if("string"==typeof e.path[1]){var o,s=t.userWebhooks[e.path[1]];s&&(null===(o=this.getUserWebhook(e.path[1]))||void 0===o||o.update(s))}}else"lib"===e.path[0]&&this.updateLibByOp(sg.drop(e,1),n)}},{key:"updateFont",value:function(e,t,n){var i=this;if(t.props.url){var r=this.getFont(e),a=k(k({},this.data.fonts[e]),{},{url:t.props.url});r.update(a),r.loadingPromise.then((function(){return i.requestRender()})),n.updateFont(e,this)}}},{key:"addUserAPI",value:function(e,t){var n,i;return this.userAPIs[e]?(this.userAPIs[e].update(t,this),!0):(null===(n=this.openAIRealtime)||void 0===n?void 0:n.id)===e?(this.openAIRealtime.update(t),!0):"VoiceAssistant"===(null===(i=t.integration)||void 0===i?void 0:i.type)?(this.openAIRealtime=new _I(t,e,this),!1):(this.userAPIs[e]=new Gk(e,t,this),!1)}},{key:"getUserAPI",value:function(e){var t;return(null===(t=this.openAIRealtime)||void 0===t?void 0:t.id)===e?this.openAIRealtime:this.userAPIs[e]}},{key:"getUserAPIs",value:function(){return this.userAPIs}},{key:"deleteUserAPI",value:function(e){var t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}},{key:"addUserWebhook",value:function(e,t){return this.userWebhooks[e]?(this.userWebhooks[e].update(t),!0):(this.userWebhooks[e]=new lI(e,t),!1)}},{key:"getUserWebhook",value:function(e){return this.userWebhooks[e]}},{key:"getUserWebhooks",value:function(){return this.userWebhooks}},{key:"deleteUserWebhook",value:function(e){var t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}},{key:"scene",get:function(){return this.entityOpContext.scene}}]),e}(),CI=(new EI(Rw.emptyData()),function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return(0,w.Z)(n,[{key:"updateByPatchedOp",value:function(e,t,i){if((0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOp",this).call(this,e,t,i),null!==function(e,t){var n=[];if(t.length!==e.length)return null;for(var i=0;i0&&void 0!==arguments[0]&&arguments[0];AT.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&AT.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}},{key:"updateTopology",value:function(){var e;this.originalGeometry.dispose(),this.originalGeometry=AT.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=AT.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=null!==(e=this.subdividedGeometry)&&void 0!==e?e:this.originalGeometry}},{key:"raycast",value:function(e,t){var n=this.localGeometry;this.localGeometry=this.originalGeometryNew,eP.prototype.raycast.call(this,e,t),this.localGeometry=n}},{key:"activateSVDCompensation",value:function(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}},{key:"deactivateSVDCompensation",value:function(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}},{key:"calcBoundingBox",value:function(){var e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new Pn,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));var t=e.attributes.position,n=e.boundingSphere.center;BI.setFromBufferAttribute(t),BI.getCenter(n),e.boundingSphere.radius=n.distanceTo(BI.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),BI.getSize(zI),this.hasNonUniformScale&&zI.divide(this.scale);var i={width:zI.x,height:zI.y,depth:zI.z};return this.geometry.userData.parameters=i,i}},{key:"updateBoundingSphere",value:function(e){var t=this.originalGeometry;BI.min.set(e[0],e[2],e[4]),BI.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(BI.min.applyMatrix4(this.shearScaleInv),BI.max.applyMatrix4(this.shearScaleInv)),null===t.boundingSphere&&(t.boundingSphere=new Pn);var n=t.boundingSphere.center;BI.getCenter(n),t.boundingSphere.radius=n.distanceTo(BI.max)}},{key:"freeSubdivPointer",value:function(){var e,t;this.subdivPointer&&(AT.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,null!==(e=this.originalGeometry)&&void 0!==e&&e.dispose(),null===(t=this.subdividedGeometry)||void 0===t||t.dispose()}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.freeSubdivPointer()}},{key:"updateByPatchedOpGeometry",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOpGeometry",this).call(this,e,t,i),this.localGeometry&&this.createGeometryByControls(t)}},{key:"subdivPointerNew",get:function(){return void 0!==this.localGeometry?this.subdivPointer:this.geometry.ensureSubdivPointer()}},{key:"originalGeometryNew",get:function(){return void 0!==this.localGeometry?this.originalGeometry:this.geometry.originalGeometry}},{key:"phongAngle",get:function(){var e;return null!==(e=this.data.geometry.phongAngle)&&void 0!==e?e:45}}]),n}(II),UI={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},ZI={polygon_center:0,edge:1,vertex:2},VI=function(e,t){return function(n,i){return t&&0!==n&&0!==e?e*i/100:0}},jI=function(e,t){var n=Math.abs(t),i=-1*n;return(e- -1)*(n-i)/2+i},GI=new un,HI=new un,WI=new un,qI=new un;function XI(e,t){var n=WI.fromArray(e),i=qI.fromArray(t);HI.copy(i).sub(n);var r=HI.length();return HI.normalize().multiplyScalar(.5*r),GI.copy(n).add(HI).toArray()}var YI=new wi,QI=new un,KI=new un,JI=new un;var $I=function(e){return.5*(1-Math.cos(e*Math.PI))},eR=function(){function e(){(0,b.Z)(this,e),this.perlin=new Array(4096)}return(0,w.Z)(e,[{key:"noise",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null==this.perlin){this.perlin=new Array(4096);for(var i=0;i<4096;i++)this.perlin[i]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),n<0&&(n=-n);for(var r,a,o,s,l,u=Math.floor(e),c=Math.floor(t),h=Math.floor(n),d=e-u,f=t-c,v=n-h,p=0,m=.5,g=0;g<4;g++){var y=u+(c<<4)+(h<<8);r=$I(d),a=$I(f),o=this.perlin[4095&y],o+=r*(this.perlin[y+1&4095]-o),s=this.perlin[y+16&4095],o+=a*((s+=r*(this.perlin[y+16+1&4095]-s))-o),y+=256,s=this.perlin[4095&y],s+=r*(this.perlin[y+1&4095]-s),l=this.perlin[y+16&4095],s+=a*((l+=r*(this.perlin[y+16+1&4095]-l))-s),p+=(o+=$I(v)*(s-o))*m,m*=.5,u<<=1,c<<=1,h<<=1,(d*=2)>=1&&(u++,d--),(f*=2)>=1&&(c++,f--),(v*=2)>=1&&(h++,v--)}return p}},{key:"noiseSeed",value:function(e){var t=function(){var e,t;return{setSeed:function(n){t=e=(null!==n&&void 0!==n?n:4294967296*Math.random())>>>0},getSeed:function(){return e},rand:function(){return(t=(1664525*t+1013904223)%4294967296)/4294967296}}}();t.setSeed(e),this.perlin=new Array(4096);for(var n=0;n<4096;n++)this.perlin[n]=t.rand()}}]),e}(),tR=new un,nR=new Nn,iR=new Fn;function rR(e){var t=!1;return e.scene.objects.traverse((function(e,n){"Mesh"===n.type&&("TextGeometry"===n.geometry.type||"InputGeometry"===n.geometry.type)&&(t=!0)})),t}var aR,oR,sR,lR,uR=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).data=i,a}return(0,w.Z)(n,[{key:"raycast",value:function(e,t){var n=this.matrixWorld;if(!isNaN(e.ray.origin.x)&&0!==this.scale.x&&0!==this.scale.y&&0!==this.scale.z&&(nR.copy(n).invert(),iR.copy(e.ray).applyMatrix4(nR),iR.intersectBox(this.singleBBox,tR))){var i=tR.applyMatrix4(n),r=e.ray.origin.distanceTo(i);t.push({distance:r,point:i.clone(),object:this})}}},{key:"textGeometry",get:function(){return this.geometry}},{key:"charWidths",get:function(){return this.textGeometry.charWidths}},{key:"charCoords",get:function(){return this.textGeometry.charCoords}},{key:"wrappedText",get:function(){return this.textGeometry.wrappedText}},{key:"font",get:function(){return this.textGeometry.font}},{key:"initialOffsetY",get:function(){var e,t,n=this.dataPatched;return null!==(e=null===(t=this.font)||void 0===t?void 0:t.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,"number"==typeof n.geometry.height?n.geometry.height:1,this.fontScale,n.geometry.verticalAlign))&&void 0!==e?e:0}},{key:"fontScale",get:function(){var e=this.dataPatched;return this.font?e.geometry.fontSize/this.font.unitsPerEm:1}},{key:"AD",get:function(){return Math.abs(this.ascender-this.descender)}},{key:"ascender",get:function(){var e,t;return(null!==(e=null===(t=this.font)||void 0===t?void 0:t.ascender)&&void 0!==e?e:1)*this.fontScale}},{key:"descender",get:function(){var e,t;return(null!==(e=null===(t=this.font)||void 0===t?void 0:t.descender)&&void 0!==e?e:1)*this.fontScale}},{key:"lineHeight",get:function(){var e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}}]),n}(II),cR=1e-4,hR=new un,dR=new un;hT.then((function(e){oR=[(aR=e).get_face_center,aR.get_edge_midpoint,aR.get_vertex_position],sR=[aR.get_face_normal,aR.get_edge_normal,aR.get_vertex_normal],lR=[aR.face_count,aR.edge_count,aR.vertex_count]}));var fR=new Nn,vR=new Nn,pR=new un,mR=new un,gR=new un,yR=new un,xR=new un,bR=new un;function wR(e,t){var n,i,r;return["number"==typeof(null===e||void 0===e?void 0:e[0])?e[0]:"string"==typeof(null===e||void 0===e?void 0:e[0])&&t?parseFloat(String(null!==(n=t.shared.getVariable(e[0]))&&void 0!==n?n:"0")):0,"number"==typeof(null===e||void 0===e?void 0:e[1])?e[1]:"string"==typeof(null===e||void 0===e?void 0:e[1])&&t?parseFloat(String(null!==(i=t.shared.getVariable(e[1]))&&void 0!==i?i:"0")):0,"number"==typeof(null===e||void 0===e?void 0:e[2])?e[2]:"string"==typeof(null===e||void 0===e?void 0:e[2])&&t?parseFloat(String(null!==(r=t.shared.getVariable(e[2]))&&void 0!==r?r:"0")):0]}var SR=function e(t,n){var i,r=this;(0,b.Z)(this,e),this.data=t,this.is3D=n,this.perlin=new eR,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=n?function(e,t,n){return r.perlin.noise(e,t,n)}:function(e){return r.perlin.noise(e)}):this.noise=n?function(){var e=kM(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Math.random),t=new Float64Array(e).map((function(e){return CM[e%12*3]})),n=new Float64Array(e).map((function(e){return CM[e%12*3+1]})),i=new Float64Array(e).map((function(e){return CM[e%12*3+2]}));return function(r,a,o){var s,l,u,c,h,d,f,v,p,m,g=(r+a+o)*_M,y=MM(r+g),x=MM(a+g),b=MM(o+g),w=(y+x+b)*AM,S=r-(y-w),_=a-(x-w),A=o-(b-w);S>=_?_>=A?(h=1,d=0,f=0,v=1,p=1,m=0):S>=A?(h=1,d=0,f=0,v=1,p=0,m=1):(h=0,d=0,f=1,v=1,p=0,m=1):_0&&void 0!==arguments[0]?arguments[0]:Math.random),t=new Float64Array(e).map((function(e){return EM[e%12*2]})),n=new Float64Array(e).map((function(e){return EM[e%12*2+1]}));return function(i,r){var a,o,s=0,l=0,u=0,c=(i+r)*wM,h=MM(i+c),d=MM(r+c),f=(h+d)*SM,v=i-(h-f),p=r-(d-f);v>p?(a=1,o=0):(a=0,o=1);var m=v-a+SM,g=p-o+SM,y=v-1+2*SM,x=p-1+2*SM,b=255&h,w=255&d,S=.5-v*v-p*p;if(S>=0){var _=b+e[w];s=(S*=S)*S*(t[_]*v+n[_]*p)}var A=.5-m*m-g*g;if(A>=0){var M=b+a+e[w+o];l=(A*=A)*A*(t[M]*m+n[M]*g)}var E=.5-y*y-x*x;if(E>=0){var C=b+1+e[w+1];u=(E*=E)*E*(t[C]*y+n[C]*x)}return 70*(s+l+u)}}((0,bM.default)(null!==(i=t.seed)&&void 0!==i?i:""))},_R=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this)).parameters=i,r.objectForSample=void 0,r._pendingMediaLoad=!1,r.random=null,r.object=e,r}return(0,w.Z)(n,[{key:"resetOnMove",value:function(){this.removeFromParent(),this.parent=null}},{key:"expandClones",value:function(e){if(null===this.parent)this.updateState(this.parameters,e);else{var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;i instanceof NM&&i.expand()}}catch(r){n.e(r)}finally{n.f()}}}},{key:"invalidateTransform",value:function(e){this.matrixWorldNeedsUpdate=!0,this.traverse((function(t){t instanceof NM&&t.object===e&&(t.matrixWorldNeedsUpdate=!0)}))}},{key:"onObjUpdateMatrix",value:function(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}},{key:"update",value:function(e){switch(this._updateCount(e),this.parameters.type){case"radial":this._updateRadial(this.parameters,e);break;case"linear":this._updateLinear(this.parameters,e);break;case"grid":this._updateGrid(this.parameters,e);break;case"toObject":this._updateToObject(this.parameters,e)}var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;i.updateMatrix(),i.hasNonUniformScale&&(i.updateMatrixWorld(),i.updateMatrixWorldSVD())}}catch(r){n.e(r)}finally{n.f()}}},{key:"_updateCount",value:function(e,t){var n;if(void 0!==t)n=t;else{var i=wR(this.parameters.grid.count,e);n="grid"===this.parameters.type?Math.round(i[0])*Math.round(i[1])*Math.round(i[2]):this.parameters.count}if("toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===t&&"random"!==this.parameters.toObject.spreadType)return}else n=0;if("toObject"===this.parameters.type&&this.objectForSample){var r=this.children;if(r.length===n)return;if(r.length1&&void 0!==arguments[1]&&arguments[1];return(null===this.random||this.random.data.seed!==e.seed||this.random.is3D!==t)&&(this.random=new SR(e,t)),this.random}},{key:"_updateRadial",value:function(e,t){var n,i,r=e.radial,a=r.start*Pt.DEG2RAD,o=a-r.end*Pt.DEG2RAD,s=wR(r.rotation,t),l=new Yn(s[0],s[1],s[2]);switch(r.axis){case"z":i=new un(0,0,1);break;case"y":i=new un(0,1,0);break;default:case"x":i=new un(1,0,0)}var u,c=null!==(n=e.randomnessObject)&&void 0!==n?n:eb.defaultData([1,1,1]).randomnessObject,d=this.getRandom(c),f=VI(c.strength,this.parameters.randomness),v=D(this.children.entries());try{for(v.s();!(u=v.n()).done;){var p=(0,h.Z)(u.value,2),m=p[0],g=p[1],y=m*(c.freqScale/10)+c.movement,x=d.noise(y,y,y),b=m+1,w=wR(r.scale,t),S=wR(c.scale,t);g.scale.x=w[0]+f(b,jI(x,S[0]))||cR,g.scale.y=w[1]+f(b,jI(x,S[1]))||cR,g.scale.z=w[2]+f(b,jI(x,S[2]))||cR,g.position.setScalar(0);var _=o/e.count*m-a;switch(r.axis){case"x":g.rotation.set(0,_,0);break;case"y":g.rotation.set(0,0,_);break;case"z":g.rotation.set(_,0,0)}g.translateOnAxis(i,r.radius);var A=wR(r.position,t),M=wR(c.position,t);g.position.x+=A[0]+f(b,jI(x,M[0])),g.position.y+=A[1]+f(b,jI(x,M[1])),g.position.z+=A[2]+f(b,jI(x,M[2]));var E=wR(c.rotation,t),C=f(b,jI(x,E[0])),k=f(b,jI(x,E[1])),T=f(b,jI(x,E[2]));!0===r.alignment?(g.rotation.x+=l.x+C,g.rotation.y+=l.y+k,g.rotation.z+=l.z+T):g.rotation.set(l.x+C,l.y+k,l.z+T)}}catch(P){v.e(P)}finally{v.f()}}},{key:"_updateLinear",value:function(e,t){var n,i,r,a;if("linear"!==e.type)throw new Error;var o,s=e.linear,l=wR(s.rotation,t),u=wR(s.scale,t),c=wR(s.position,t),d=new Yn(null!==(n=l[0])&&void 0!==n?n:0,null!==(i=l[1])&&void 0!==i?i:0,null!==(r=l[2])&&void 0!==r?r:0),f=null!==(a=e.randomnessObject)&&void 0!==a?a:eb.defaultData([1,1,1]).randomnessObject,v=wR(f.rotation,t),p=wR(f.scale,t),m=wR(f.position,t),g=this.getRandom(f),y=VI(f.strength,this.parameters.randomness),x=D(this.children.entries());try{for(x.s();!(o=x.n()).done;){var b=(0,h.Z)(o.value,2),w=b[0],S=b[1],_=w*(f.freqScale/10)+f.movement,A=g.noise(_,_,_),M=w+1,E=y(M,jI(A,v[0])),C=y(M,jI(A,v[1])),k=y(M,jI(A,v[2]));S.scale.x=1+(u[0]-1)*w+y(M,jI(A,p[0]))||cR,S.scale.y=1+(u[1]-1)*w+y(M,jI(A,p[1]))||cR,S.scale.z=1+(u[2]-1)*w+y(M,jI(A,p[2]))||cR,S.rotation.x=d.x*w+E,S.rotation.y=d.y*w+C,S.rotation.z=d.z*w+k,S.position.x=c[0]*w+y(M,jI(A,m[0])),S.position.y=c[1]*w+y(M,jI(A,m[1])),S.position.z=c[2]*w+y(M,jI(A,m[2]))}}catch(T){x.e(T)}finally{x.f()}}},{key:"_updateGrid",value:function(e,t){var n,i=0,r=e.grid,a=null!==(n=e.randomnessObject)&&void 0!==n?n:eb.defaultData([1,1,1]).randomnessObject,o=wR(a.scale,t),s=wR(a.rotation,t),l=wR(a.position,t),u=this.getRandom(a,!0),c=VI(a.strength,this.parameters.randomness),h=wR(r.count,t),d=wR(r.size,t);if(!0===r.useCenter)for(var f={x:h[0]%2===0?2:1,y:h[1]%2===0?2:1,z:h[2]%2===0?2:1},v=new un(d[0]*(h[0]-f.x)*.5,d[1]*(h[1]-f.y)*.5,d[2]*(h[2]-f.z)*.5),p=0;p0){var g=Math.round(m.length*r.count/100);this._updateCount(t,g)}else{var y=this.objectForSample.geometry.getAttribute("position");if(!y||isNaN(y.count)||0===y.count)return void console.warn('Oh no! The object "'.concat(this.object.name,'" (').concat(this.object.uuid,') cannot be cloned on the surface of "').concat(this.objectForSample.name,'" (').concat(this.objectForSample.uuid,") because the latter does not have a valid geometry."))}this.objectForSample.updateMatrixWorld();var x=new DM(this.objectForSample).build(),b=UI[r.axis],w=this.children;x.setRandomGenerator((0,bM.default)(this.object.uuid+r.seed));var S,_=D(w.entries());try{for(_.s();!(S=_.n()).done;){var A=(0,h.Z)(S.value,2),M=A[0],E=A[1],C=M*(u.freqScale/10)+u.movement,k=v.noise(C,C,C),T=M+1,P=p(T,jI(k,c[0])),O=p(T,jI(k,c[1])),I=p(T,jI(k,c[2]));"random"===r.spreadType?x.sample(gR,yR):(m.length&&(gR.fromArray(m[M].pos),yR.fromArray(m[M].norm)),this.objectForSample instanceof NI&&gR.applyMatrix4(fR.copy(this.objectForSample.matrixWorld).invert())),gR.applyMatrix4(this.object.hiddenMatrix.clone().invert()),E.position.copy(gR),pR.fromArray(b);var R="normal"===r.align?yR:this.object.getWorldDirection(bR),L=mR.fromArray(o);mR.x+=p(T,jI(k,d[0])),mR.y+=p(T,jI(k,d[1])),mR.z+=p(T,jI(k,d[2]));var B=Math.acos(R.dot(pR)),z=xR.crossVectors(pR,R).normalize(),F=vR.makeRotationAxis(z,B),N=R.clone().cross(this.object.up).normalize(),U=N.clone().cross(R).normalize(),Z=(new Nn).makeBasis(N,R,U),V=new un(pR.y,pR.z,pR.x).normalize(),j=V.clone().cross(pR).normalize(),G=(new Nn).makeBasis(V,pR,j).invert(),H=(new Nn).multiplyMatrices(Z,G);E.rotation.setFromRotationMatrix(H),L.applyMatrix4(F),E.position.add(L),E.rotation.x=E.rotation.x+l.x+P,E.rotation.y=E.rotation.y+l.y+O,E.rotation.z=E.rotation.z+l.z+I,E.scale.setScalar(1),E.scale.x=E.scale.x+s[0]+p(T,jI(k,f[0]))||cR,E.scale.y=E.scale.y+s[1]+p(T,jI(k,f[1]))||cR,E.scale.z=E.scale.z+s[2]+p(T,jI(k,f[2]))||cR,E.scale.multiply(this.object.scale),E.hiddenMatrix=this.object.hiddenMatrix}}catch(Y){_.e(Y)}finally{_.f()}}}}else{var W,q=D(this.children.entries());try{for(q.s();!(W=q.n()).done;){var X=(0,h.Z)(W.value,2)[1];X.position.set(0,0,0),X.scale.setScalar(1),X.rotation.set(0,0,0)}}catch(Y){q.e(Y)}finally{q.f()}this.objectForSample=void 0}}},{key:"getSubdivData",value:function(){if(!this.objectForSample)return[];var e=this.parameters.toObject.spreadType,t=new Map,n=function(e,n){var i=Math.round(1e4*e[0])+"_"+Math.round(1e4*e[1])+"_"+Math.round(1e4*e[2]),r=t.get(i);r?(r.pos[0]+=e[0],r.pos[1]+=e[1],r.pos[2]+=e[2],r.norm[0]+=n[0],r.norm[1]+=n[1],r.norm[2]+=n[2],r.count+=1):t.set(i,{pos:(0,l.Z)(e),norm:(0,l.Z)(n),count:1})};if("random"===e)return[];if(this.objectForSample instanceof NI)for(var i=this.objectForSample,r=ZI[e],a=lR[r],o=oR[r],s=sR[r],u=a(i.subdivPointerNew),c=0;c<=u-1;c++){var h=o(i.subdivPointerNew,c),d=s(i.subdivPointerNew,c);hR.fromArray(h).applyMatrix4(i.matrixWorld),dR.fromArray(d),n(hR.toArray(),dR.toArray())}else(this.objectForSample.geometry.index?function(e){for(var t=[],n=0;n<=e.index.count;n++)QI.fromArray(e.index.array,3*n),YI.setFromAttributeAndIndices(e.attributes.position,QI.x,QI.y,QI.z),YI.getNormal(KI),YI.getMidpoint(JI),isNaN(JI.x)||isNaN(JI.y)||isNaN(JI.z)||function(){var e=YI.a,n=YI.b,i=YI.c,r=e.toArray(),a=n.toArray(),o=i.toArray(),s=e.distanceTo(n),l=n.distanceTo(i),u=i.distanceTo(e),c=XI(r,a),h=XI(a,o),d=XI(o,r),f=[s,l,u],v=Math.max.apply(Math,f),p=f.filter((function(e){return Math.round(e)===Math.round(v)})).length>1,m=[],g=YI.getMidpoint(JI).toArray();v===s&&!p&&(m=[h,d,d],g=c),v===l&&!p&&(m=[c,d,d],g=h),v===u&&!p&&(m=[c,h,h],g=d),p&&(m=[c,h,d]),t.push({vertices:[r,a,o],faceCenters:m,midpoint:g,norm:YI.getNormal(KI).toArray()})}();return t}(this.objectForSample.geometry):function(e){for(var t=[],n=e.attributes.position,i=0;i4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e,o=t,s=a.matrixWorld;if(null===o.boundingSphere&&o.computeBoundingSphere(),ER.copy(o.boundingSphere),ER.applyMatrix4(s),!1!==n.ray.intersectsSphere(ER)&&(CR.copy(s).invert(),MR.copy(n.ray).applyMatrix4(CR),null===o.boundingBox||!1!==MR.intersectsBox(o.boundingBox))){var l,u,c,h,d,f,v=o.index,p=o.attributes.position,m=o.drawRange;if(!1===r){var g=Math.max(0,m.start),y=Math.min(v.count,m.start+m.count);for(d=g,f=y;dE)){_.applyMatrix4(a.matrixWorld);var D=n.ray.origin.distanceTo(_);Dn.far||i.push({distance:D,point:S.clone().applyMatrix4(a.matrixWorld),object:e})}}function O(e,t,n,i,r,a,o){var s=new un,l=new un,u=new un,c=new un,h=new un;if(s.fromBufferAttribute(i,r),l.fromBufferAttribute(i,a),u.fromBufferAttribute(i,o),null===n.intersectTriangle(s,l,u,!1,c))return null;h.copy(c),h.applyMatrix4(e.matrixWorld);var d=t.ray.origin.distanceTo(h);return dt.far?null:{faceIndex:1,distance:d,point:h.clone(),object:e}}},TR=new un,PR=new or;function DR(e,t,n,i,r,a,o){TR.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),u=0,c=s.length;u0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k(k({},dw.defaultData),{},{name:""});(0,b.Z)(this,n),(e=t.call(this))._cameraType="OrthographicCamera",e.targetOffset=$x.DefaultTargetOffset,e.isUpVectorFlipped=!1,e.angleOffsetFromUp=0,e.wasMovedByUser=!1,e.wasMovedBySwitchCameraAction=!1,e.super_Entity(i,r),e.previousProjectionMatrix=new Nn,e.matrixAutoUpdate=!0,e.width=window.innerWidth,e.height=window.innerHeight;var a=e.width,o=e.height;return e.orthoCamera=new Or(-.5*a,.5*a,.5*o,-.5*o,-5e4,1e4),e.perspCamera=new sr(45,a/o,50,1e4),e.left=e.orthoCamera.left,e.right=e.orthoCamera.right,e.top=e.orthoCamera.top,e.bottom=e.orthoCamera.bottom,e.far=e.orthoCamera.far,e.view=e.orthoCamera.view,e.aspect=e.perspCamera.aspect,e.focus=e.perspCamera.focus,e.filmGauge=e.perspCamera.filmGauge,e.filmOffset=e.perspCamera.filmOffset,e.objectHelper.update(),e}return(0,w.Z)(n,[{key:"setNear",value:function(e,t){"PerspectiveCamera"===e?this.perspCamera.near=t:this.orthoCamera.near=t}},{key:"setZoom",value:function(e,t){t>=0&&("PerspectiveCamera"===e?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}},{key:"lookAt",value:function(e,t,i){"number"==typeof e&&(e=new un(e,t,i)),(0,d.Z)((0,m.Z)(n.prototype),"lookAt",this).call(this,e),this.getWorldPosition(LR),this.targetOffset=LR.distanceTo(e)}},{key:"getTarget",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new un;return this.getWorldDirection(BR),this.getWorldPosition(LR),BR.multiplyScalar(this.targetOffset),e.copy(LR).add(BR),e}},{key:"getDistanceToTarget",value:function(){var e=this.getTarget();return this.getWorldPosition(LR),LR.distanceTo(e)}},{key:"updateUp",value:function(){this.getWorldQuaternion(zR),FR.set(0,0,1).applyQuaternion(zR),NR.copy(ci.DEFAULT_UP),this.isUpVectorFlipped&&NR.negate(),NR.applyQuaternion(zR),UR.copy(ci.DEFAULT_UP).projectOnPlane(FR),this.angleOffsetFromUp=UR.angleTo(NR),this.angleOffsetFromUp*=UR.cross(NR).dot(FR)>=0?1:-1}},{key:"updateTransformState",value:function(e,t){var i=(0,d.Z)((0,m.Z)(n.prototype),"updateTransformState",this).call(this,e,t);return void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}},{key:"getViewFrontToObject",value:function(e){var t=e.getWorldPosition(new un),n=e.getWorldDirection(new un).multiplyScalar(this.targetOffset);return{position:t.clone().add(n),target:t}}},{key:"getViewToTarget",value:function(e){var t=this.getWorldDirection(new un).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}},{key:"getViewToObject",value:function(e){var t=new un;return e.getWorldPosition(t),this.getViewToTarget(t)}},{key:"setViewplaneSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.aspect=e/t,n){var i=e>t?this.aspect:1,r=e>t?1:this.aspect;this.left=-395*i,this.right=395*i,this.top=1/r*395,this.bottom=1/r*-395}else this.left=.5*-e,this.right=.5*e,this.top=.5*t,this.bottom=.5*-t;this.updateProjectionMatrix()}},{key:"copyViewPlaneSize",value:function(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}},{key:"toOrthographic",value:function(){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()}},{key:"toPerspective",value:function(){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()}},{key:"setFocalLength",value:function(e){this.perspCamera.setFocalLength(e),this.toPerspective()}},{key:"getFocalLength",value:function(){return this.perspCamera.getFocalLength()}},{key:"getEffectiveFOV",value:function(){return this.perspCamera.getEffectiveFOV()}},{key:"getFilmWidth",value:function(){return this.perspCamera.getFilmWidth()}},{key:"getFilmHeight",value:function(){return this.perspCamera.getFilmHeight()}},{key:"setViewOffset",value:function(e,t,n,i,r,a){"PerspectiveCamera"===this._cameraType?this.perspCamera.setViewOffset(e,t,n,i,r,a):this.orthoCamera.setViewOffset(e,t,n,i,r,a)}},{key:"clearViewOffset",value:function(){"PerspectiveCamera"===this._cameraType?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}},{key:"copyHistory",value:function(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}},{key:"updateProjectionMatrix",value:function(){"PerspectiveCamera"===this._cameraType?this.toPerspective():"OrthographicCamera"===this._cameraType&&this.toOrthographic()}},{key:"updateMatrixWorld",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"copy",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"copy",this).call(this,e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=null===e.view?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}},{key:"toCameraState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t={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 hm(t,e)}},{key:"updateCameraSubtype",value:function(e,t){var n="perspective"===e?"PerspectiveCamera":"OrthographicCamera";void 0!==t.zoom&&this.setZoom(n,t.zoom),void 0!==t.near&&this.setNear(n,t.near),void 0!==t.fov&&"PerspectiveCamera"===n&&(this.fov=t.fov)}},{key:"updateState",value:function(e,t){this.updateCameraState(e,t)}},{key:"updateCameraState",value:function(e,t){this.updateState_Entity(e,t),void 0!==e.far&&(this.far=e.far),void 0!==e.orthographic&&this.updateCameraSubtype("orthographic",e.orthographic),void 0!==e.perspective&&this.updateCameraSubtype("perspective",e.perspective),void 0!==e.type&&(this.cameraType=e.type),void 0!==e.up&&this.up.fromArray(e.up.map((function(e){return"number"==typeof e?e:0}))),void 0!==e.targetOffset&&(this.targetOffset=e.targetOffset),void 0!==e.isUpVectorFlipped&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}},{key:"updateByPatchedOp",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOp",this).call(this,e,t,i),1===e.path.length&&0===e.type&&this.updateCameraSubtype(e.path[0],e.props)}},{key:"toState",value:function(e){return k(k(k({},(0,d.Z)((0,m.Z)(n.prototype),"toState",this).call(this,e)),this.toCameraState(e)),{},{type:this.cameraType})}},{key:"isPerspectiveCamera",get:function(){return"PerspectiveCamera"===this.cameraType}},{key:"isOrthographicCamera",get:function(){return!this.isPerspectiveCamera}},{key:"cameraType",get:function(){return this._cameraType},set:function(e){"PerspectiveCamera"===e?this.toPerspective():"OrthographicCamera"===e&&this.toOrthographic()}},{key:"fov",set:function(e){this.perspCamera.fov=e},get:function(){return this.perspCamera.fov}},{key:"near",get:function(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.near:this.orthoCamera.near},set:function(e){"PerspectiveCamera"===this._cameraType?this.perspCamera.near=e:this.orthoCamera.near=e}},{key:"zoom",get:function(){return"PerspectiveCamera"===this._cameraType?this.perspCamera.zoom:this.orthoCamera.zoom},set:function(e){e>=0&&("PerspectiveCamera"===this._cameraType?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}}]),n}(RR(or,IR)),VR=new Nn,jR=new Nn;function GR(e){var t=!1;return e.scene.objects.traverse((function(e,n){var i;"BooleanGeometry"===(null===(i=n.geometry)||void 0===i?void 0:i.type)&&(t=!0)})),t}var HR,WR=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a,o;return(0,b.Z)(this,n),(o=t.call(this,e,i)).data=i,o.meshSetAddresses=[],o.needsTransformForDownstream=!1,o.geometry=new Fi,o.onAfterRender=function(e,t,i,r,s,l){(0,d.Z)((a=(0,f.Z)(o),(0,m.Z)(n.prototype)),"onAfterRender",a).call(a,e,t,i,r,s,l),o.recomputeBoolean()},o.geometry.userData.parameters={width:0,height:0,depth:0},o}return(0,w.Z)(n,[{key:"updateByPatchedOp",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOp",this).call(this,e,t,i),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}},{key:"freeBooleanPointer",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"freeBooleanPointer",this).call(this),this.geometry.dispose()}},{key:"recomputeBoolean",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(-1===this.booleanMeshSetAddress||e){for(var i=0;i0&&s.geometry.drawRange.count>0&&0!==s.booleanMeshSetAddress){VR.multiplyMatrices(s.hiddenMatrix,s.matrix).multiply(s.pivotMatrix);try{if(-1===s.booleanMeshSetAddress){var l;if((null!==(l=s.geometry.index)&&void 0!==l?l:s.geometry.getAttribute("position")).count/3<15e5&&(s.booleanMeshSetAddress=BT.getMeshSet(s.geometry,!0===e,t)),-1===s.booleanMeshSetAddress)return;BT.transformMeshSet(s.booleanMeshSetAddress,VR),s.booleanMatrixInvOld.copy(VR).invert(),s.booleanWasTransformed=!1}else s instanceof n&&!0===s.needsTransformForDownstream?(BT.transformMeshSet(s.booleanMeshSetAddress,VR),s.needsTransformForDownstream=!1):!0===s.booleanWasTransformed&&(BT.transformMeshSet(s.booleanMeshSetAddress,jR.multiplyMatrices(VR,s.booleanMatrixInvOld)),s.booleanMatrixInvOld.copy(VR).invert(),s.booleanWasTransformed=!1)}catch(Ix){console.error(Ix),s.booleanMeshSetAddress=0,s.geometry.userData.booleanOperationDidFail=!0;continue}!1===BT.hasOpenEdges(s.booleanMeshSetAddress)||a===this.children.length-1&&2===this.booleanOp?(this.meshSetAddresses.push(s.booleanMeshSetAddress),s.geometry.userData.booleanOperationDidFail=!1):s.geometry.userData.booleanOperationDidFail="openEdges"}}if(0===this.meshSetAddresses.length)return this.geometry.setAttribute("position",new Pi([],0)),void this.geometry.setDrawRange(0,0);if(!0===e)return BT.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);var u=this.geometry;u.dispose(),this.geometry=new Fi,this.geometry.userData=u.userData,this.geometry.boundingSphere=u.boundingSphere;try{this.booleanMeshSetAddress=BT.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,RI(this),LI(this)}}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.geometry.dispose()}},{key:"booleanOp",get:function(){return this.data.geometry.operation}},{key:"phongAngle",get:function(){var e;return null!==(e=this.data.geometry.phongAngle)&&void 0!==e?e:45}},{key:"isLOD",get:function(){return this.recomputeBoolean(),!1}}]),n}(CI);!function(e){e.is=function(e){return BM.is(e)&&e instanceof hu}}(HR||(HR={}));var qR=function(e,t){return function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return(0,w.Z)(n,[{key:"updateState_Light",value:function(e,t){this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity),void 0!==e.depth&&(this.shadow.camera.far=e.depth,this.shadow.needsUpdate=!0),void 0!==e.shadows&&(this.castShadow=e.shadows)}}]),n}(RR(e,t))},XR=function(e){return e instanceof eP},YR=function(e){return null!==e&&e instanceof WR},QR=function(e){return OR.is(e)},KR=new un(1,1,1),JR=new un,$R=new un,eL=new ln,tL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;return(0,b.Z)(this,n),(i=t.call(this,r)).object=e,i.dummy=new Go,i.object.updateMatrixWorld(),i.name="EmptyObjectHelper: ".concat(e.uuid),i.matrix=i.dummy.matrixWorld,i.matrixAutoUpdate=!1,i.object.isBone&&(i.visible=!1),i}return(0,w.Z)(n,[{key:"raycast",value:function(e,t){kR(this.object,n.geometryHelper,e,t,!1,this.dummy)}},{key:"update",value:function(){}},{key:"updateMatrix",value:function(){}},{key:"updateMatrixWorld",value:function(e){this.object.matrixWorld.decompose(JR,eL,$R),this.matrix.compose(JR,eL,KR),(0,d.Z)((0,m.Z)(n.prototype),"updateMatrixWorld",this).call(this,e)}},{key:"updateWorldMatrix",value:function(e,t){}}]),n}(AR(vc)),nL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this)).super_Entity(e,i),r.objectHelper.update(),r}return(0,w.Z)(n,[{key:"updateState",value:function(e,t){this.updateState_Entity(e,t),"buffer"in e&&1===Object.keys(e).length&&t.scene.reloadSplats()}}]),n}(RR(Go,tL)),iL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this)).super_Entity(e,i),a.context=r,a.objectHelper.update(),a}return(0,w.Z)(n,[{key:"updateState",value:function(e,t){this.updateState_Entity(e,t)}}]),n}(RR(Go,tL)),rL=0,aL=1,oL="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",sL="#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;}}",lL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,b.Z)(this,n),(e=t.call(this,{name:"BokehMaterial",defines:{PASS:i?"2":"1"},uniforms:{kernel64:new Wu(null),kernel16:new Wu(null),inputBuffer:new Wu(null),cocBuffer:new Wu(null),texelSize:new Wu(new Dt),scale:new Wu(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:sL,vertexShader:oL})).toneMapped=!1,r&&(e.defines.FOREGROUND="1"),e.generateKernel(),e}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.uniforms.inputBuffer.value=e}},{key:"setCoCBuffer",value:function(e){this.uniforms.cocBuffer.value=e}},{key:"getScale",value:function(e){return this.uniforms.scale.value=e}},{key:"setScale",value:function(e){this.uniforms.scale.value=e}},{key:"generateKernel",value:function(){for(var e=new Float32Array(128),t=new Float32Array(32),n=0,i=0,r=0;r<80;++r){var a=2.39996323*r,o=Math.sqrt(r)/Math.sqrt(80),s=o*Math.cos(a),l=o*Math.sin(a);r%5===0?(t[i++]=s,t[i++]=l):(e[n++]=s,e[n++]=l)}for(var u=[],c=[],h=0;h<128;)u.push(new nn(e[h++],e[h++],e[h++],e[h++]));for(var d=0;d<32;)c.push(new nn(t[d++],t[d++],t[d++],t[d++]));this.uniforms.kernel64.value=u,this.uniforms.kernel16.value=c}},{key:"setTexelSize",value:function(e,t){this.uniforms.texelSize.value.set(e,t)}},{key:"setSize",value:function(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}},{key:"cocBuffer",set:function(e){this.uniforms.cocBuffer.value=e}},{key:"scale",get:function(){return this.uniforms.scale.value},set:function(e){this.uniforms.scale.value=e}}]),n}(ar);function uL(e,t,n){return e*(t-n)-t}function cL(e,t,n){return Math.min(Math.max((e+t)/(t-n),0),1)}var hL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;return(0,b.Z)(this,n),(i=t.call(this,{name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new Wu(null),focusDistance:new Wu(0),focusRange:new Wu(0),cameraNear:new Wu(.3),cameraFar:new Wu(1e3)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:"#include \n#include \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:oL})).toneMapped=!1,i.uniforms.focalLength=i.uniforms.focusRange,i.adoptCameraSettings(e),i}return(0,w.Z)(n,[{key:"setDepthBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;this.depthBuffer=e,this.depthPacking=t}},{key:"getFocusDistance",value:function(e){this.uniforms.focusDistance.value=e}},{key:"setFocusDistance",value:function(e){this.uniforms.focusDistance.value=e}},{key:"getFocalLength",value:function(e){return this.focusRange}},{key:"setFocalLength",value:function(e){this.focusRange=e}},{key:"adoptCameraSettings",value:function(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof sr?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},{key:"near",get:function(){return this.uniforms.cameraNear.value}},{key:"far",get:function(){return this.uniforms.cameraFar.value}},{key:"depthBuffer",set:function(e){this.uniforms.depthBuffer.value=e}},{key:"depthPacking",set:function(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}},{key:"focusDistance",get:function(){return this.uniforms.focusDistance.value},set:function(e){this.uniforms.focusDistance.value=e}},{key:"worldFocusDistance",get:function(){return-uL(this.focusDistance,this.near,this.far)},set:function(e){this.focusDistance=cL(-e,this.near,this.far)}},{key:"focalLength",get:function(){return this.focusRange},set:function(e){this.focusRange=e}},{key:"focusRange",get:function(){return this.uniforms.focusRange.value},set:function(e){this.uniforms.focusRange.value=e}},{key:"worldFocusRange",get:function(){return-uL(this.focusRange,this.near,this.far)},set:function(e){this.focusRange=cL(-e,this.near,this.far)}}]),n}(ar),dL="#include \n#include \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 \n#include \n}",fL="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);}",vL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt;return(0,b.Z)(this,n),(e=t.call(this,{name:"KawaseBlurMaterial",uniforms:{inputBuffer:new Wu(null),texelSize:new Wu(new Dt),halfTexelSize:new Wu(new Dt),kernel:new Wu(0),scale:new Wu(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:dL,vertexShader:fL})).toneMapped=!1,e.setTexelSize(i.x,i.y),e}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.inputBuffer=e}},{key:"getScale",value:function(){return this.uniforms.scale.value}},{key:"setScale",value:function(e){this.uniforms.scale.value=e}},{key:"getKernel",value:function(){return null}},{key:"setKernel",value:function(e){this.kernel=e}},{key:"setTexelSize",value:function(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}},{key:"setSize",value:function(e,t){var n=this.uniforms;n.texelSize.value.set(1/e,1/t),n.halfTexelSize.value.copy(n.texelSize.value).multiplyScalar(.5)}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}},{key:"scale",get:function(){return this.uniforms.scale.value},set:function(e){this.uniforms.scale.value=e}},{key:"kernel",get:function(){return this.uniforms.kernel.value},set:function(e){this.uniforms.kernel.value=e}}]),n}(ar),pL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,{name:"CopyMaterial",uniforms:{inputBuffer:new Wu(null),opacity:new Wu(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 \n}",vertexShader:oL})).toneMapped=!1,e}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.uniforms.inputBuffer.value=e}},{key:"getOpacity",value:function(e){return this.uniforms.opacity.value}},{key:"setOpacity",value:function(e){this.uniforms.opacity.value=e}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}}]),n}(ar),mL="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 \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}",gL="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);}",yL=2,xL=0,bL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yL;return(0,b.Z)(this,n),(e=t.call(this,{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 Wu(null),depthBuffer:new Wu(null),predicationBuffer:new Wu(null),texelSize:new Wu(i)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:mL,vertexShader:gL})).toneMapped=!1,e.edgeDetectionMode=r,e}return(0,w.Z)(n,[{key:"setDepthBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;this.depthBuffer=e,this.depthPacking=t}},{key:"getEdgeDetectionMode",value:function(){return this.edgeDetectionMode}},{key:"setEdgeDetectionMode",value:function(e){this.edgeDetectionMode=e}},{key:"getLocalContrastAdaptationFactor",value:function(){return this.localContrastAdaptationFactor}},{key:"setLocalContrastAdaptationFactor",value:function(e){this.localContrastAdaptationFactor=e}},{key:"getEdgeDetectionThreshold",value:function(){return this.edgeDetectionThreshold}},{key:"setEdgeDetectionThreshold",value:function(e){this.edgeDetectionThreshold=e}},{key:"getPredicationMode",value:function(){return this.predicationMode}},{key:"setPredicationMode",value:function(e){this.predicationMode=e}},{key:"setPredicationBuffer",value:function(e){this.uniforms.predicationBuffer.value=e}},{key:"getPredicationThreshold",value:function(){return this.predicationThreshold}},{key:"setPredicationThreshold",value:function(e){this.predicationThreshold=e}},{key:"getPredicationScale",value:function(){return this.predicationScale}},{key:"setPredicationScale",value:function(e){this.predicationScale=e}},{key:"getPredicationStrength",value:function(){return this.predicationStrength}},{key:"setPredicationStrength",value:function(e){this.predicationStrength=e}},{key:"setSize",value:function(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},{key:"depthBuffer",set:function(e){this.uniforms.depthBuffer.value=e}},{key:"depthPacking",set:function(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}},{key:"edgeDetectionMode",get:function(){return Number(this.defines.EDGE_DETECTION_MODE)},set:function(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}},{key:"localContrastAdaptationFactor",get:function(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)},set:function(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}},{key:"edgeDetectionThreshold",get:function(){return Number(this.defines.EDGE_THRESHOLD)},set:function(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(.1*e).toFixed("6"),this.needsUpdate=!0}},{key:"predicationMode",get:function(){return Number(this.defines.PREDICATION_MODE)},set:function(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}},{key:"predicationBuffer",set:function(e){this.uniforms.predicationBuffer.value=e}},{key:"predicationThreshold",get:function(){return Number(this.defines.PREDICATION_THRESHOLD)},set:function(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}},{key:"predicationScale",get:function(){return Number(this.defines.PREDICATION_SCALE)},set:function(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}},{key:"predicationStrength",get:function(){return Number(this.defines.PREDICATION_STRENGTH)},set:function(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}}]),n}(ar),wL={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"},SL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a){var o,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return(0,b.Z)(this,n),(o=t.call(this,{name:"EffectMaterial",defines:{THREE_REVISION:Y.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new Wu(null),depthBuffer:new Wu(null),resolution:new Wu(new Dt),texelSize:new Wu(new Dt),cameraNear:new Wu(.3),cameraFar:new Wu(1e3),aspect:new Wu(1),time:new Wu(0)},blending:0,depthWrite:!1,depthTest:!1,dithering:s})).toneMapped=!1,e&&o.setShaderParts(e),i&&o.setDefines(i),r&&o.setUniforms(r),o.adoptCameraSettings(a),o}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.uniforms.inputBuffer.value=e}},{key:"setDepthBuffer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;this.depthBuffer=e,this.depthPacking=t}},{key:"setShaderParts",value:function(e){return this.fragmentShader="#include \n#include \n#include \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 \n#endif\n#include \n}".replace(wL.FRAGMENT_HEAD,e.get(wL.FRAGMENT_HEAD)).replace(wL.FRAGMENT_MAIN_UV,e.get(wL.FRAGMENT_MAIN_UV)).replace(wL.FRAGMENT_MAIN_IMAGE,e.get(wL.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(wL.VERTEX_HEAD,e.get(wL.VERTEX_HEAD)).replace(wL.VERTEX_MAIN_SUPPORT,e.get(wL.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}},{key:"setDefines",value:function(e){var t,n=D(e.entries());try{for(n.s();!(t=n.n()).done;){var i=t.value;this.defines[i[0]]=i[1]}}catch(r){n.e(r)}finally{n.f()}return this.needsUpdate=!0,this}},{key:"setUniforms",value:function(e){var t,n=D(e.entries());try{for(n.s();!(t=n.n()).done;){var i=t.value;this.uniforms[i[0]]=i[1]}}catch(r){n.e(r)}finally{n.f()}return this}},{key:"setExtensions",value:function(e){this.extensions={};var t,n=D(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.extensions[i]=!0}}catch(r){n.e(r)}finally{n.f()}return this}},{key:"isOutputEncodingEnabled",value:function(e){return this.encodeOutput}},{key:"setOutputEncodingEnabled",value:function(e){this.encodeOutput=e}},{key:"setDeltaTime",value:function(e){this.uniforms.time.value+=e}},{key:"adoptCameraSettings",value:function(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof sr?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},{key:"setSize",value:function(e,t){var n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}},{key:"depthBuffer",get:function(){return this.uniforms.depthBuffer.value},set:function(e){this.uniforms.depthBuffer.value=e}},{key:"depthPacking",get:function(){return Number(this.defines.DEPTH_PACKING)},set:function(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}},{key:"encodeOutput",get:function(){return void 0!==this.defines.ENCODE_OUTPUT},set:function(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}},{key:"time",get:function(){return this.uniforms.time.value},set:function(e){this.uniforms.time.value=e}}],[{key:"Section",get:function(){return wL}}]),n}(ar),_L="#include \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}",AL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,b.Z)(this,n),(e=t.call(this,{name:"LuminanceMaterial",defines:{THREE_REVISION:Y.replace(/\D+/g,"")},uniforms:{inputBuffer:new Wu(null),threshold:new Wu(0),smoothing:new Wu(1),range:new Wu(null)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:_L,vertexShader:oL})).toneMapped=!1,e.colorOutput=i,e.luminanceRange=r,e}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.uniforms.inputBuffer.value=e}},{key:"getThreshold",value:function(){return this.threshold}},{key:"setThreshold",value:function(e){this.threshold=e}},{key:"getSmoothingFactor",value:function(){return this.smoothing}},{key:"setSmoothingFactor",value:function(e){this.smoothing=e}},{key:"isColorOutputEnabled",value:function(e){return this.colorOutput}},{key:"setColorOutputEnabled",value:function(e){this.colorOutput=e}},{key:"getLuminanceRange",value:function(){return this.luminanceRange}},{key:"setLuminanceRange",value:function(e){this.luminanceRange=e}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}},{key:"threshold",get:function(){return this.uniforms.threshold.value},set:function(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}},{key:"smoothing",get:function(){return this.uniforms.smoothing.value},set:function(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}},{key:"useThreshold",get:function(){return this.threshold>0||this.smoothing>0},set:function(e){}},{key:"colorOutput",get:function(){return void 0!==this.defines.COLOR},set:function(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}},{key:"useRange",get:function(){return null!==this.luminanceRange},set:function(e){this.luminanceRange=null}},{key:"luminanceRange",get:function(){return this.uniforms.range.value},set:function(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}}]),n}(ar),ML="#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}",EL=0,CL=1,kL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return(0,b.Z)(this,n),(e=t.call(this,{name:"MaskMaterial",uniforms:{maskTexture:new Wu(i),inputBuffer:new Wu(null),strength:new Wu(1)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:ML,vertexShader:oL})).toneMapped=!1,e.setColorChannel(rL),e.setMaskFunction(EL),e}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.uniforms.inputBuffer.value=e}},{key:"setMaskTexture",value:function(e){this.maskTexture=e}},{key:"setColorChannel",value:function(e){this.colorChannel=e}},{key:"setMaskFunction",value:function(e){this.maskFunction=e}},{key:"isInverted",value:function(){return this.inverted}},{key:"setInverted",value:function(e){this.inverted=e}},{key:"getStrength",value:function(){return this.strength}},{key:"setStrength",value:function(e){this.strength=e}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}},{key:"maskTexture",set:function(e){this.uniforms.maskTexture.value=e,delete this.defines.MASK_PRECISION_HIGH,e.type!==he&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}},{key:"colorChannel",set:function(e){this.defines.COLOR_CHANNEL=e.toFixed(0),this.needsUpdate=!0}},{key:"maskFunction",set:function(e){this.defines.MASK_FUNCTION=e.toFixed(0),this.needsUpdate=!0}},{key:"inverted",get:function(){return void 0!==this.defines.INVERTED},set:function(e){this.inverted&&!e?delete this.defines.INVERTED:e&&(this.defines.INVERTED="1"),this.needsUpdate=!0}},{key:"strength",get:function(){return this.uniforms.strength.value},set:function(e){this.uniforms.strength.value=e}}]),n}(ar),TL="#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;i0.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;i0.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;iend&&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;i0.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;iend&&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;i0.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;}",PL="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);}",DL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Dt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Dt;return(0,b.Z)(this,n),(e=t.call(this,{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 Wu(null),searchTexture:new Wu(null),areaTexture:new Wu(null),resolution:new Wu(r),texelSize:new Wu(i)},blending:0,depthWrite:!1,depthTest:!1,fragmentShader:TL,vertexShader:PL})).toneMapped=!1,e}return(0,w.Z)(n,[{key:"setInputBuffer",value:function(e){this.uniforms.inputBuffer.value=e}},{key:"setLookupTextures",value:function(e,t){this.searchTexture=e,this.areaTexture=t}},{key:"setOrthogonalSearchSteps",value:function(e){this.orthogonalSearchSteps=e}},{key:"setDiagonalSearchSteps",value:function(e){this.diagonalSearchSteps=e}},{key:"isDiagonalDetectionEnabled",value:function(){return this.diagonalDetection}},{key:"setDiagonalDetectionEnabled",value:function(e){this.diagonalDetection=e}},{key:"setCornerRounding",value:function(e){this.cornerRounding=e}},{key:"isCornerRoundingEnabled",value:function(){return this.cornerDetection}},{key:"setCornerRoundingEnabled",value:function(e){this.cornerDetection=e}},{key:"setSize",value:function(e,t){var n=this.uniforms;n.texelSize.value.set(1/e,1/t),n.resolution.value.set(e,t)}},{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}},{key:"searchTexture",get:function(){return this.uniforms.searchTexture.value},set:function(e){this.uniforms.searchTexture.value=e}},{key:"areaTexture",get:function(){return this.uniforms.areaTexture.value},set:function(e){this.uniforms.areaTexture.value=e}},{key:"orthogonalSearchSteps",get:function(){return Number(this.defines.MAX_SEARCH_STEPS_INT)},set:function(e){var t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}},{key:"diagonalSearchSteps",get:function(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)},set:function(e){var t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}},{key:"diagonalDetection",get:function(){return void 0===this.defines.DISABLE_DIAG_DETECTION},set:function(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}},{key:"cornerRounding",get:function(){return Number(this.defines.CORNER_ROUNDING)},set:function(e){var t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}},{key:"cornerDetection",get:function(){return void 0===this.defines.DISABLE_CORNER_DETECTION},set:function(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}}]),n}(ar),OL=new or,IL=null;var RL=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Pass",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new es,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:OL;(0,b.Z)(this,e),this.name=t,this.renderer=null,this.scene=n,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}return(0,w.Z)(e,[{key:"setRenderer",value:function(e){this.renderer=e}},{key:"isEnabled",value:function(){return this.enabled}},{key:"setEnabled",value:function(e){this.enabled=e}},{key:"getFullscreenMaterial",value:function(){return this.fullscreenMaterial}},{key:"setFullscreenMaterial",value:function(e){this.fullscreenMaterial=e}},{key:"getDepthTexture",value:function(){return null}},{key:"setDepthTexture",value:function(e){}},{key:"render",value:function(e,t,n,i,r){throw new Error("Render method not implemented!")}},{key:"setSize",value:function(e,t){}},{key:"initialize",value:function(e,t,n){}},{key:"dispose",value:function(){for(var e=0,t=Object.keys(this);e1&&void 0!==arguments[1])||arguments[1];return(0,b.Z)(this,n),(i=t.call(this,"CopyPass")).fullscreenMaterial=new pL,i.needsSwap=!1,i.renderTarget=e,void 0===e&&(i.renderTarget=new rn(1,1,{minFilter:ue,magFilter:ue,stencilBuffer:!1,depthBuffer:!1}),i.renderTarget.texture.name="CopyPass.Target"),i.autoResize=r,i}return(0,w.Z)(n,[{key:"getTexture",value:function(){return this.renderTarget.texture}},{key:"setAutoResizeEnabled",value:function(e){this.autoResize=e}},{key:"render",value:function(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}},{key:"setSize",value:function(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}},{key:"initialize",value:function(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,n!==he?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e.outputEncoding===st&&(this.renderTarget.texture.encoding=st))}},{key:"resize",get:function(){return this.autoResize},set:function(e){this.autoResize=e}},{key:"texture",get:function(){return this.renderTarget.texture}}]),n}(RL),BL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,"ClearMaskPass",null,null)).needsSwap=!1,e}return(0,w.Z)(n,[{key:"render",value:function(e,t,n,i,r){var a=e.state.buffers.stencil;a.setLocked(!1),a.setTest(!1)}}]),n}(RL),zL=new Yt,FL=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(0,b.Z)(this,n),(e=t.call(this,"ClearPass",null,null)).needsSwap=!1,e.color=i,e.depth=r,e.stencil=a,e.overrideClearColor=null,e.overrideClearAlpha=-1,e}return(0,w.Z)(n,[{key:"setClearFlags",value:function(e,t,n){this.color=e,this.depth=t,this.stencil=n}},{key:"getOverrideClearColor",value:function(){return this.overrideClearColor}},{key:"setOverrideClearColor",value:function(e){this.overrideClearColor=e}},{key:"getOverrideClearAlpha",value:function(){return this.overrideClearAlpha}},{key:"setOverrideClearAlpha",value:function(e){this.overrideClearAlpha=e}},{key:"render",value:function(e,t,n,i,r){var a=this.overrideClearColor,o=this.overrideClearAlpha,s=e.getClearAlpha(),l=null!==a,u=o>=0;l?(zL.copy(e.getClearColor(zL)),e.setClearColor(a,u?o:s)):u&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(zL,s):u&&e.setClearAlpha(s)}}]),n}(RL),NL=-1,UL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NL,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NL,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return(0,b.Z)(this,n),(i=t.call(this)).resizable=e,i.base=new Dt(1,1),i.preferred=new Dt(r,a),i.target=i.preferred,i.s=o,i}return(0,w.Z)(n,[{key:"getWidth",value:function(){return this.width}},{key:"getHeight",value:function(){return this.height}},{key:"getScale",value:function(){return this.scale}},{key:"setScale",value:function(e){this.scale=e}},{key:"getBaseWidth",value:function(){return this.base.width}},{key:"setBaseWidth",value:function(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"getBaseHeight",value:function(){return this.baseHeight}},{key:"setBaseHeight",value:function(e){this.baseHeight=e}},{key:"setBaseSize",value:function(e,t){(this.base.width!==e||this.base.height!==t)&&(this.base.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"getPreferredWidth",value:function(){return this.preferredWidth}},{key:"setPreferredWidth",value:function(e){this.preferredWidth=e}},{key:"getPreferredHeight",value:function(){return this.preferredHeight}},{key:"setPreferredHeight",value:function(e){this.preferredHeight=e}},{key:"setPreferredSize",value:function(e,t){(this.preferred.width!==e||this.preferred.height!==t)&&(this.preferred.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"copy",value:function(e){this.base.set(e.getBaseWidth(),e.getBaseHeight()),this.preferred.set(e.getPreferredWidth(),e.getPreferredHeight()),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height)}},{key:"width",get:function(){var e=this.base,t=this.preferred,n=this.scale;return t.width!==NL?t.width:t.height!==NL?Math.round(t.height*(e.width/Math.max(e.height,1))):Math.round(e.width*n)},set:function(e){this.preferredWidth=e}},{key:"height",get:function(){var e=this.base,t=this.preferred,n=this.scale;return t.height!==NL?t.height:t.width!==NL?Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):Math.round(e.height*n)},set:function(e){this.preferredHeight=e}},{key:"scale",get:function(){return this.s},set:function(e){this.s!==e&&(this.s=e,this.preferred.setScalar(NL),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"baseWidth",get:function(){return this.base.width},set:function(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"baseHeight",get:function(){return this.base.height},set:function(e){this.base.height!==e&&(this.base.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"preferredWidth",get:function(){return this.preferred.width},set:function(e){this.preferred.width!==e&&(this.preferred.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}},{key:"preferredHeight",get:function(){return this.preferred.height},set:function(e){this.preferred.height!==e&&(this.preferred.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}}],[{key:"AUTO_SIZE",get:function(){return NL}}]),n}(mt),ZL=!1,VL=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;(0,b.Z)(this,e),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(n),this.meshCount=0,this.replaceMaterial=function(e){if(e.isMesh){var n;if(e.material.flatShading)switch(e.material.side){case 2:n=t.materialsFlatShadedDoubleSide;break;case 1:n=t.materialsFlatShadedBackSide;break;default:n=t.materialsFlatShaded}else switch(e.material.side){case 2:n=t.materialsDoubleSide;break;case 1:n=t.materialsBackSide;break;default:n=t.materials}t.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=n[2]:e.isInstancedMesh?e.material=n[1]:e.material=n[0],++t.meshCount}}}return(0,w.Z)(e,[{key:"setMaterial",value:function(e){if(this.disposeMaterials(),this.material=e,null!==e){for(var t=this.materials=[e.clone(),e.clone(),e.clone()],n=0,i=t;n2&&void 0!==arguments[2]?arguments[2]:null;return(0,b.Z)(this,n),(r=t.call(this,"RenderPass",e,i)).needsSwap=!1,r.clearPass=new FL,r.overrideMaterialManager=null===a?null:new VL(a),r.ignoreBackground=!1,r.skipShadowMapUpdate=!1,r.selection=null,r}return(0,w.Z)(n,[{key:"getOverrideMaterial",value:function(){return this.overrideMaterial}},{key:"setOverrideMaterial",value:function(e){this.overrideMaterial=e}},{key:"getSelection",value:function(){return this.selection}},{key:"setSelection",value:function(e){this.selection=e}},{key:"isBackgroundDisabled",value:function(){return this.ignoreBackground}},{key:"setBackgroundDisabled",value:function(e){this.ignoreBackground=e}},{key:"isShadowMapDisabled",value:function(){return this.skipShadowMapUpdate}},{key:"setShadowMapDisabled",value:function(e){this.skipShadowMapUpdate=e}},{key:"getClearPass",value:function(){return this.clearPass}},{key:"render",value:function(e,t,n,i,r){var a=this.scene,o=this.camera,s=this.selection,l=o.layers.mask,u=a.background,c=e.shadowMap.autoUpdate,h=this.renderToScreen?null:t;null!==s&&o.layers.set(s.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(a.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(h),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,a,o):e.render(a,o),o.layers.mask=l,a.background=u,e.shadowMap.autoUpdate=c}},{key:"renderToScreen",get:function(){return(0,d.Z)((0,m.Z)(n.prototype),"renderToScreen",this)},set:function(e){(0,r.Z)((0,m.Z)(n.prototype),"renderToScreen",e,this,!0),this.clearPass.renderToScreen=e}},{key:"overrideMaterial",get:function(){var e=this.overrideMaterialManager;return null!==e?e.material:null},set:function(e){var t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new VL(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}},{key:"clear",get:function(){return this.clearPass.enabled},set:function(e){this.clearPass.enabled=e}}]),n}(RL),GL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=a.resolutionScale,s=void 0===o?1:o,l=a.width,u=void 0===l?UL.AUTO_SIZE:l,c=a.height,h=void 0===c?UL.AUTO_SIZE:c,d=a.renderTarget;(0,b.Z)(this,n),(r=t.call(this,"DepthPass")).needsSwap=!1,r.renderPass=new jL(e,i,new zo({depthPacking:ut}));var v=r.renderPass;v.skipShadowMapUpdate=!0,v.ignoreBackground=!0;var p=v.getClearPass();p.overrideClearColor=new Yt(16777215),p.overrideClearAlpha=1,r.renderTarget=d,void 0===r.renderTarget&&(r.renderTarget=new rn(1,1,{minFilter:se,magFilter:se,stencilBuffer:!1}),r.renderTarget.texture.name="DepthPass.Target");var m=r.resolution=new UL((0,f.Z)(r),u,h,s);return m.addEventListener("change",(function(e){return r.setSize(m.baseWidth,m.baseHeight)})),r}return(0,w.Z)(n,[{key:"getTexture",value:function(){return this.renderTarget.texture}},{key:"getResolution",value:function(){return this.resolution}},{key:"getResolutionScale",value:function(){return this.resolution.scale}},{key:"setResolutionScale",value:function(e){this.resolution.scale=e}},{key:"render",value:function(e,t,n,i,r){var a=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,a)}},{key:"setSize",value:function(e,t){var n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},{key:"texture",get:function(){return this.renderTarget.texture}}]),n}(RL),HL=(new Float32Array([255/256/Math.pow(256,3),255/256/Math.pow(256,2),255/256/256,255/256]),{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}),WL=new Map([[HL.SKIP,null],[HL.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);}"],[HL.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));}"],[HL.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);}"],[HL.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);}"],[HL.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);}"],[HL.DARKEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}"],[HL.DIFFERENCE,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}"],[HL.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);}"],[HL.LIGHTEN,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}"],[HL.MULTIPLY,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}"],[HL.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);}"],[HL.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);}"],[HL.NORMAL,"vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}"],[HL.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);}"],[HL.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);}"],[HL.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);}"],[HL.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);}"],[HL.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);}"]]),qL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(0,b.Z)(this,n),(i=t.call(this)).f=e,i.opacity=new Wu(r),i}return(0,w.Z)(n,[{key:"getOpacity",value:function(){return this.opacity.value}},{key:"setOpacity",value:function(e){this.opacity.value=e}},{key:"getBlendFunction",value:function(){return this.blendFunction}},{key:"setBlendFunction",value:function(e){this.blendFunction=e}},{key:"getShaderCode",value:function(){return WL.get(this.blendFunction)}},{key:"blendFunction",get:function(){return this.f},set:function(e){this.f=e,this.dispatchEvent({type:"change"})}}]),n}(mt),XL=0,YL=1,QL=2,KL=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=a.attributes,s=void 0===o?XL:o,l=a.blendFunction,u=void 0===l?HL.SCREEN:l,c=a.defines,h=void 0===c?new Map:c,d=a.uniforms,f=void 0===d?new Map:d,v=a.extensions,p=void 0===v?null:v,m=a.vertexShader,g=void 0===m?null:m;return(0,b.Z)(this,n),(r=t.call(this)).name=e,r.renderer=null,r.attributes=s,r.fragmentShader=i,r.vertexShader=g,r.defines=h,r.uniforms=f,r.extensions=p,r.blendMode=new qL(u),r.blendMode.addEventListener("change",(function(e){return r.setChanged()})),r}return(0,w.Z)(n,[{key:"getName",value:function(){return this.name}},{key:"setRenderer",value:function(e){this.renderer=e}},{key:"getDefines",value:function(){return this.defines}},{key:"getUniforms",value:function(){return this.uniforms}},{key:"getExtensions",value:function(){return this.extensions}},{key:"getBlendMode",value:function(){return this.blendMode}},{key:"getAttributes",value:function(){return this.attributes}},{key:"setAttributes",value:function(e){this.attributes=e,this.setChanged()}},{key:"getFragmentShader",value:function(){return this.fragmentShader}},{key:"setFragmentShader",value:function(e){this.fragmentShader=e,this.setChanged()}},{key:"getVertexShader",value:function(){return this.vertexShader}},{key:"setVertexShader",value:function(e){this.vertexShader=e,this.setChanged()}},{key:"setChanged",value:function(){this.dispatchEvent({type:"change"})}},{key:"setDepthTexture",value:function(e){}},{key:"update",value:function(e,t,n){}},{key:"setSize",value:function(e,t){}},{key:"initialize",value:function(e,t,n){}},{key:"dispose",value:function(){for(var e=0,t=Object.keys(this);e1?r-1:0),o=1;ot&&console.warn("The current rendering context doesn't support more than "+t+" uniforms, but "+this.uniformCount+" were defined"),t=e.maxVaryings,this.varyingCount>t&&console.warn("The current rendering context doesn't support more than "+t+" varyings, but "+this.varyingCount+" were defined")}},{key:"updateMaterial",value:function(){var e,t=SL.Section,n=new Map([[t.FRAGMENT_HEAD,""],[t.FRAGMENT_MAIN_UV,""],[t.FRAGMENT_MAIN_IMAGE,""],[t.VERTEX_HEAD,""],[t.VERTEX_MAIN_SUPPORT,""]]),i=new Map,r=new Map,a=new Map,o=new Set,s=0,l=0,u=0,c=!1,h=!1,d=D(this.effects);try{for(d.s();!(e=d.n()).done;){var f=e.value;if(f.blendMode.blendFunction===HL.SKIP)u|=f.getAttributes()&YL;else if(0!==(u&f.getAttributes()&QL))console.error("Convolution effects cannot be merged",f);else{u|=f.getAttributes();var v=$L("e"+s++,f,n,i,r,a,u);if(l+=v.varyings.length,c=c||v.transformedUv,h=h||v.readDepth,null!==f.extensions){var p,m=D(f.extensions);try{for(m.s();!(p=m.n()).done;){var g=p.value;o.add(g)}}catch(_){m.e(_)}finally{m.f()}}}}}catch(_){d.e(_)}finally{d.f()}var y,x=/\bblend\b/g,b=D(i.values());try{for(b.s();!(y=b.n()).done;){var w=y.value,S=w.getShaderCode().replace(x,"blend".concat(w.blendFunction));n.set(t.FRAGMENT_HEAD,n.get(t.FRAGMENT_HEAD)+S+"\n")}}catch(_){b.e(_)}finally{b.f()}if(0!==(u&YL)){if(h){n.set(t.FRAGMENT_MAIN_IMAGE,"float depth = readDepth(UV);\n\n\t"+n.get(t.FRAGMENT_MAIN_IMAGE))}this.needsDepthTexture=null===this.getDepthTexture()}else this.needsDepthTexture=!1;if(c){n.set(t.FRAGMENT_MAIN_UV,"vec2 transformedUv = vUv;\n"+n.get(t.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")}else r.set("UV","vUv");n.forEach((function(e,t,n){return n.set(t,e.trim().replace(/^#/,"\n#"))})),this.uniformCount=a.size,this.varyingCount=l,this.skipRendering=0===s,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(n).setExtensions(o).setUniforms(a).setDefines(r)}},{key:"recompile",value:function(){this.updateMaterial(),this.verifyResources()}},{key:"getDepthTexture",value:function(){return this.fullscreenMaterial.depthBuffer}},{key:"setDepthTexture",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;var n,i=D(this.effects);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.setDepthTexture(e,t)}}catch(a){i.e(a)}finally{i.f()}}},{key:"render",value:function(e,t,n,i,r){var a,o=D(this.effects);try{for(o.s();!(a=o.n()).done;){a.value.update(e,t,i)}}catch(l){o.e(l)}finally{o.f()}if(!this.skipRendering||this.renderToScreen){var s=this.fullscreenMaterial;s.inputBuffer=t.texture,s.time+=i,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}},{key:"setSize",value:function(e,t){this.fullscreenMaterial.setSize(e,t);var n,i=D(this.effects);try{for(i.s();!(n=i.n()).done;){n.value.setSize(e,t)}}catch(r){i.e(r)}finally{i.f()}}},{key:"initialize",value:function(e,t,n){var i=this;this.renderer=e;var r,a=D(this.effects);try{for(a.s();!(r=a.n()).done;){var o=r.value;o.initialize(e,t,n),o.addEventListener("change",(function(e){return i.handleEvent(e)}))}}catch(s){a.e(s)}finally{a.f()}this.updateMaterial(),this.verifyResources(),void 0!==n&&n!==he&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this);var e,t=D(this.effects);try{for(t.s();!(e=t.n()).done;){e.value.dispose()}}catch(i){t.e(i)}finally{t.f()}}},{key:"handleEvent",value:function(e){switch(e.type){case"change":this.recompile()}}},{key:"encodeOutput",get:function(){return this.fullscreenMaterial.encodeOutput},set:function(e){this.fullscreenMaterial.encodeOutput=e}},{key:"dithering",get:function(){return this.fullscreenMaterial.dithering},set:function(e){var t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}}]),n}(RL),tB=[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])],nB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.resolutionScale,a=void 0===r?.5:r,o=i.width,s=void 0===o?UL.AUTO_SIZE:o,l=i.height,u=void 0===l?UL.AUTO_SIZE:l,c=i.kernelSize,h=void 0===c?lB.LARGE:c;(0,b.Z)(this,n),(e=t.call(this,"KawaseBlurPass")).renderTargetA=new rn(1,1,{minFilter:ue,magFilter:ue,stencilBuffer:!1,depthBuffer:!1}),e.renderTargetA.texture.name="Blur.Target.A",e.renderTargetB=e.renderTargetA.clone(),e.renderTargetB.texture.name="Blur.Target.B";var d=e.resolution=new UL((0,f.Z)(e),s,u,a);return d.addEventListener("change",(function(t){return e.setSize(d.baseWidth,d.baseHeight)})),e.blurMaterial=new vL,e.ditheredBlurMaterial=new vL,e.ditheredBlurMaterial.uniforms.scale=e.blurMaterial.uniforms.scale,e.ditheredBlurMaterial.dithering=!0,e.dithering=!1,e.kernelSize=h,e}return(0,w.Z)(n,[{key:"getResolution",value:function(){return this.resolution}},{key:"getScale",value:function(){return this.blurMaterial.scale}},{key:"setScale",value:function(e){this.blurMaterial.scale=e}},{key:"getKernelSize",value:function(){return this.kernelSize}},{key:"setKernelSize",value:function(e){this.kernelSize=e}},{key:"getResolutionScale",value:function(){return this.resolution.scale}},{key:"setResolutionScale",value:function(e){this.resolution.scale=e}},{key:"render",value:function(e,t,n,i,r){var a,o,s=this.scene,l=this.camera,u=this.renderTargetA,c=this.renderTargetB,h=tB[this.kernelSize],d=this.blurMaterial,f=t;for(this.fullscreenMaterial=d,a=0,o=h.length-1;a0&&void 0!==arguments[0]?arguments[0]:{},r=i.width,a=void 0===r?UL.AUTO_SIZE:r,o=i.height,s=void 0===o?UL.AUTO_SIZE:o,l=i.renderTarget,u=i.luminanceRange,c=i.colorOutput;(0,b.Z)(this,n),(e=t.call(this,"LuminancePass")).fullscreenMaterial=new AL(c,u),e.needsSwap=!1,e.renderTarget=l,void 0===e.renderTarget&&(e.renderTarget=new rn(1,1,{minFilter:ue,magFilter:ue,stencilBuffer:!1,depthBuffer:!1}),e.renderTarget.texture.name="LuminancePass.Target",e.renderTarget.texture.generateMipmaps=!1);var h=e.resolution=new UL((0,f.Z)(e),a,s);return h.addEventListener("change",(function(t){return e.setSize(h.baseWidth,h.baseHeight)})),e}return(0,w.Z)(n,[{key:"getTexture",value:function(){return this.renderTarget.texture}},{key:"getResolution",value:function(){return this.resolution}},{key:"render",value:function(e,t,n,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}},{key:"setSize",value:function(e,t){var n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}},{key:"initialize",value:function(e,t,n){void 0!==n&&n!==he&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},{key:"texture",get:function(){return this.renderTarget.texture}}]),n}(RL),rB=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this,"MaskPass",e,i)).needsSwap=!1,r.clearPass=new FL(!1,!1,!0),r.inverse=!1,r}return(0,w.Z)(n,[{key:"getClearPass",value:function(){return this.clearPass}},{key:"isInverted",value:function(){return this.inverted}},{key:"setInverted",value:function(e){this.inverted=e}},{key:"render",value:function(e,t,n,i,r){var a=e.getContext(),o=e.state.buffers,s=this.scene,l=this.camera,u=this.clearPass,c=this.inverted?0:1,h=1-c;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.stencil.setFunc(a.ALWAYS,c,4294967295),o.stencil.setClear(h),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?u.render(e,null):(u.render(e,t),u.render(e,n))),this.renderToScreen?(e.setRenderTarget(null),e.render(s,l)):(e.setRenderTarget(t),e.render(s,l),e.setRenderTarget(n),e.render(s,l)),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(a.EQUAL,1,4294967295),o.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),o.stencil.setLocked(!0)}},{key:"inverted",get:function(){return this.inverse},set:function(e){this.inverse=e}},{key:"clear",get:function(){return this.clearPass.enabled},set:function(e){this.clearPass.enabled=e}}]),n}(RL),aB=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"inputBuffer";return(0,b.Z)(this,n),(i=t.call(this,"ShaderPass")).fullscreenMaterial=e,i.inputBufferUniform=null,i.setInput(r),i}return(0,w.Z)(n,[{key:"setInput",value:function(e){if(this.inputBufferUniform=null,null!==this.fullscreenMaterial){var t=this.fullscreenMaterial.uniforms;void 0!==t&&void 0!==t[e]&&(this.inputBufferUniform=t[e])}}},{key:"render",value:function(e,t,n,i,r){null!==this.inputBufferUniform&&null!==t&&(this.inputBufferUniform.value=t.texture),e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}},{key:"initialize",value:function(e,t,n){void 0!==n&&n!==he&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}}]),n}(RL),oB=.001,sB=function(){function e(){(0,b.Z)(this,e),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}return(0,w.Z)(e,[{key:"setFixedDeltaEnabled",value:function(e){return this.fixedDeltaEnabled=e,this}},{key:"isAutoResetEnabled",value:function(e){return this.autoReset}},{key:"setAutoResetEnabled",value:function(e){return typeof document<"u"&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=e),this}},{key:"getDelta",value:function(){return this.delta*oB}},{key:"getFixedDelta",value:function(){return this.fixedDelta*oB}},{key:"setFixedDelta",value:function(e){return this.fixedDelta=1e3*e,this}},{key:"getElapsed",value:function(){return this.elapsed*oB}},{key:"getTimescale",value:function(){return this.timescale}},{key:"setTimescale",value:function(e){return this.timescale=e,this}},{key:"update",value:function(e){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=void 0!==e?e:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}},{key:"reset",value:function(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}},{key:"handleEvent",value:function(e){document.hidden||(this.currentTime=performance.now())}},{key:"dispose",value:function(){this.setAutoResetEnabled(!1)}}]),e}(),lB={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},uB="#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);}",cB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.blendFunction,a=void 0===r?HL.SCREEN:r,o=i.luminanceThreshold,s=void 0===o?.9:o,l=i.luminanceSmoothing,u=void 0===l?.025:l,c=i.resolutionScale,h=void 0===c?.5:c,d=i.intensity,f=void 0===d?1:d,v=i.width,p=void 0===v?UL.AUTO_SIZE:v,m=i.height,g=void 0===m?UL.AUTO_SIZE:m,y=i.kernelSize,x=void 0===y?lB.LARGE:y;(0,b.Z)(this,n),(e=t.call(this,"BloomEffect",uB,{blendFunction:a,uniforms:new Map([["map",new Wu(null)],["intensity",new Wu(f)]])})).renderTarget=new rn(1,1,{minFilter:ue,magFilter:ue,stencilBuffer:!1,depthBuffer:!1}),e.renderTarget.texture.name="Bloom.Target",e.renderTarget.texture.generateMipmaps=!1,e.uniforms.get("map").value=e.renderTarget.texture,e.luminancePass=new iB({renderTarget:e.renderTarget,colorOutput:!0}),e.luminanceMaterial.threshold=s,e.luminanceMaterial.smoothingFactor=u,e.blurPass=new nB({resolutionScale:h,width:p,height:g,kernelSize:x});var w=e.blurPass.getResolution();return w.addEventListener("change",(function(t){return e.setSize(w.baseWidth,w.baseHeight)})),e}return(0,w.Z)(n,[{key:"getTexture",value:function(){return this.renderTarget.texture}},{key:"getResolution",value:function(){return this.blurPass.resolution}},{key:"getBlurPass",value:function(){return this.blurPass}},{key:"getLuminancePass",value:function(){return this.luminancePass}},{key:"getLuminanceMaterial",value:function(){return this.luminancePass.fullscreenMaterial}},{key:"getIntensity",value:function(){return this.intensity}},{key:"setIntensity",value:function(e){this.intensity=e}},{key:"getResolutionScale",value:function(){return this.resolution.scale}},{key:"setResolutionScale",value:function(e){this.resolution.scale=e}},{key:"update",value:function(e,t,n){var i=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(e,t,i),this.blurPass.render(e,i,i)):this.blurPass.render(e,t,i)}},{key:"setSize",value:function(e,t){var n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.luminancePass.resolution.copy(n)}},{key:"initialize",value:function(e,t,n){this.blurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,e.outputEncoding===st&&(this.renderTarget.texture.encoding=st))}},{key:"texture",get:function(){return this.renderTarget.texture}},{key:"resolution",get:function(){return this.blurPass.resolution}},{key:"luminanceMaterial",get:function(){return this.luminancePass.fullscreenMaterial}},{key:"width",get:function(){return this.resolution.width},set:function(e){this.resolution.preferredWidth=e}},{key:"height",get:function(){return this.resolution.height},set:function(e){this.resolution.preferredHeight=e}},{key:"dithering",get:function(){return this.blurPass.dithering},set:function(e){this.blurPass.dithering=e}},{key:"kernelSize",get:function(){return this.blurPass.kernelSize},set:function(e){this.blurPass.kernelSize=e}},{key:"distinction",get:function(){return console.warn(this.name,"distinction was removed"),1},set:function(e){console.warn(this.name,"distinction was removed")}},{key:"intensity",get:function(){return this.uniforms.get("intensity").value},set:function(e){this.uniforms.get("intensity").value=e}}]),n}(KL),hB="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);}",dB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.blendFunction,r=void 0===i?HL.NORMAL:i,a=e.brightness,o=void 0===a?0:a,s=e.contrast,l=void 0===s?0:s;return(0,b.Z)(this,n),t.call(this,"BrightnessContrastEffect",hB,{blendFunction:r,uniforms:new Map([["brightness",new Wu(o)],["contrast",new Wu(l)]])})}return(0,w.Z)(n,[{key:"getBrightness",value:function(e){return this.brightness}},{key:"setBrightness",value:function(e){this.brightness=e}},{key:"getContrast",value:function(e){return this.contrast}},{key:"setContrast",value:function(e){this.contrast=e}},{key:"brightness",get:function(){return this.uniforms.get("brightness").value},set:function(e){this.uniforms.get("brightness").value=e}},{key:"contrast",get:function(){return this.uniforms.get("contrast").value},set:function(e){this.uniforms.get("contrast").value=e}}]),n}(KL),fB="void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(vec3(average(inputColor.rgb)),inputColor.a);}",vB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:HL.NORMAL;return(0,b.Z)(this,n),t.call(this,"ColorAverageEffect",fB,{blendFunction:e})}return n}(KL),pB="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));}",mB="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;}",gB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.blendFunction,r=void 0===i?HL.NORMAL:i,a=e.offset,o=void 0===a?new Dt(.001,5e-4):a;return(0,b.Z)(this,n),t.call(this,"ChromaticAberrationEffect",pB,{vertexShader:mB,blendFunction:r,attributes:QL,uniforms:new Map([["offset",new Wu(o)]])})}return(0,w.Z)(n,[{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(e){this.offset=e}},{key:"offset",get:function(){return this.uniforms.get("offset").value},set:function(e){this.uniforms.get("offset").value=e}}]),n}(KL),yB="#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;}",xB=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.blendFunction,o=void 0===a?HL.NORMAL:a,s=r.worldFocusDistance,l=r.worldFocusRange,u=r.focusDistance,c=void 0===u?0:u,h=r.focalLength,d=void 0===h?.1:h,f=r.focusRange,v=void 0===f?d:f,p=r.bokehScale,m=void 0===p?1:p,g=r.width,y=void 0===g?UL.AUTO_SIZE:g,x=r.height,w=void 0===x?UL.AUTO_SIZE:x;(0,b.Z)(this,n),(i=t.call(this,"DepthOfFieldEffect",yB,{blendFunction:o,attributes:YL,uniforms:new Map([["nearColorBuffer",new Wu(null)],["farColorBuffer",new Wu(null)],["nearCoCBuffer",new Wu(null)],["scale",new Wu(1)]])})).camera=e,i.renderTarget=new rn(1,1,{minFilter:ue,magFilter:ue,stencilBuffer:!1,depthBuffer:!1}),i.renderTarget.texture.name="DoF.Intermediate",i.renderTarget.texture.generateMipmaps=!1,i.renderTargetMasked=i.renderTarget.clone(),i.renderTargetMasked.texture.name="DoF.Masked.Far",i.renderTargetNear=i.renderTarget.clone(),i.renderTargetNear.texture.name="DoF.Bokeh.Near",i.uniforms.get("nearColorBuffer").value=i.renderTargetNear.texture,i.renderTargetFar=i.renderTarget.clone(),i.renderTargetFar.texture.name="DoF.Bokeh.Far",i.uniforms.get("farColorBuffer").value=i.renderTargetFar.texture,i.renderTargetCoC=i.renderTarget.clone(),i.renderTargetCoC.texture.name="DoF.CoC",i.renderTargetCoCBlurred=i.renderTargetCoC.clone(),i.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",i.uniforms.get("nearCoCBuffer").value=i.renderTargetCoCBlurred.texture,i.cocPass=new aB(new hL(e));var S=i.cocMaterial;S.focusDistance=c,S.focusRange=v,void 0!==s&&(S.worldFocusDistance=s),void 0!==l&&(S.worldFocusRange=l),i.blurPass=new nB({kernelSize:lB.MEDIUM,width:y,height:w});var _=i.blurPass.getResolution();_.addEventListener("change",(function(e){return i.setSize(_.getBaseWidth(),_.getBaseHeight())})),i.maskPass=new aB(new kL(i.renderTargetCoC.texture));var A=i.maskPass.fullscreenMaterial;return A.maskFunction=CL,A.colorChannel=aL,i.bokehNearBasePass=new aB(new lL(!1,!0)),i.bokehNearBasePass.fullscreenMaterial.cocBuffer=i.renderTargetCoCBlurred.texture,i.bokehNearFillPass=new aB(new lL(!0,!0)),i.bokehNearFillPass.fullscreenMaterial.cocBuffer=i.renderTargetCoCBlurred.texture,i.bokehFarBasePass=new aB(new lL(!1,!1)),i.bokehFarBasePass.fullscreenMaterial.cocBuffer=i.renderTargetCoC.texture,i.bokehFarFillPass=new aB(new lL(!0,!1)),i.bokehFarFillPass.fullscreenMaterial.cocBuffer=i.renderTargetCoC.texture,i.target=null,i.bokehScale=m,i}return(0,w.Z)(n,[{key:"getCircleOfConfusionMaterial",value:function(){return this.circleOfConfusionMaterial}},{key:"getBlurPass",value:function(){return this.blurPass}},{key:"getResolution",value:function(){return this.blurPass.getResolution()}},{key:"getBokehScale",value:function(){return this.bokehScale}},{key:"setBokehScale",value:function(e){this.bokehScale=e}},{key:"getTarget",value:function(){return this.target}},{key:"setTarget",value:function(e){this.target=e}},{key:"calculateFocusDistance",value:function(e){var t=this.camera;return cL(-t.position.distanceTo(e),t.near,t.far)}},{key:"setDepthTexture",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;this.circleOfConfusionMaterial.depthBuffer=e,this.circleOfConfusionMaterial.depthPacking=t}},{key:"update",value:function(e,t,n){var i=this.renderTarget,r=this.renderTargetCoC,a=this.renderTargetCoCBlurred,o=this.renderTargetMasked;if(null!==this.target){var s=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=s}this.cocPass.render(e,null,r),this.blurPass.render(e,r,a),this.maskPass.render(e,t,o),this.bokehFarBasePass.render(e,o,i),this.bokehFarFillPass.render(e,i,this.renderTargetFar),this.bokehNearBasePass.render(e,t,i),this.bokehNearFillPass.render(e,i,this.renderTargetNear)}},{key:"setSize",value:function(e,t){var n=this.resolution;n.setBaseSize(e,t);var i=n.width,r=n.height,a=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];a.push(this.renderTargetCoC,this.renderTargetMasked),a.forEach((function(n){return n.setSize(e,t)})),(a=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred]).forEach((function(e){return e.setSize(i,r)})),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach((function(e){return e.fullscreenMaterial.setSize(i,r)}))}},{key:"initialize",value:function(e,t,n){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach((function(i){return i.initialize(e,t,n)})),this.blurPass.initialize(e,t,he),void 0!==n&&(this.renderTarget.texture.type=n,this.renderTargetNear.texture.type=n,this.renderTargetFar.texture.type=n,this.renderTargetMasked.texture.type=n,e.outputEncoding===st&&(this.renderTarget.texture.encoding=st,this.renderTargetNear.texture.encoding=st,this.renderTargetFar.texture.encoding=st,this.renderTargetMasked.texture.encoding=st))}},{key:"cocTexture",get:function(){return this.renderTargetCoC.texture}},{key:"cocMaterial",get:function(){return this.cocPass.fullscreenMaterial}},{key:"circleOfConfusionMaterial",get:function(){return this.cocMaterial}},{key:"resolution",get:function(){return this.blurPass.getResolution()}},{key:"bokehScale",get:function(){return this.uniforms.get("scale").value},set:function(e){for(var t=0,n=[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];t0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}"),wB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.blendFunction,a=void 0===r?HL.NORMAL:r,o=i.hue,s=void 0===o?0:o,l=i.saturation,u=void 0===l?0:l;return(0,b.Z)(this,n),(e=t.call(this,"HueSaturationEffect",bB,{blendFunction:a,uniforms:new Map([["hue",new Wu(new un)],["saturation",new Wu(u)]])})).hue=s,e}return(0,w.Z)(n,[{key:"getSaturation",value:function(){return this.saturation}},{key:"setSaturation",value:function(e){this.saturation=e}},{key:"getHue",value:function(){return this.hue}},{key:"setHue",value:function(e){this.hue=e}},{key:"saturation",get:function(){return this.uniforms.get("saturation").value},set:function(e){this.uniforms.get("saturation").value=e}},{key:"hue",get:function(){var e=this.uniforms.get("hue").value;return Math.acos((3*e.x-1)/2)},set:function(e){var t=Math.sin(e),n=Math.cos(e);this.uniforms.get("hue").value.set((2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3)}}]),n}(KL),SB=(new Yt,"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}"),_B=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=i.blendFunction,a=void 0===r?HL.SCREEN:r,o=i.premultiply,s=void 0!==o&&o;return(0,b.Z)(this,n),(e=t.call(this,"NoiseEffect",SB,{blendFunction:a})).premultiply=s,e}return(0,w.Z)(n,[{key:"isPremultiplied",value:function(){return this.premultiply}},{key:"setPremultiplied",value:function(e){this.premultiply=e}},{key:"premultiply",get:function(){return this.defines.has("PREMULTIPLY")},set:function(e){this.premultiply!==e&&(e?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}}]),n}(KL),AB="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));}}",MB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:30;return(0,b.Z)(this,n),(e=t.call(this,"PixelationEffect",AB,{uniforms:new Map([["active",new Wu(!1)],["d",new Wu(new Dt)]])})).resolution=new Dt,e.d=0,e.granularity=i,e}return(0,w.Z)(n,[{key:"getGranularity",value:function(){return this.granularity}},{key:"setGranularity",value:function(e){this.granularity=e}},{key:"setSize",value:function(e,t){this.resolution.set(e,t),this.uniforms.get("d").value.setScalar(this.d).divide(this.resolution)}},{key:"granularity",get:function(){return this.d},set:function(e){var t=Math.floor(e);t%2>0&&(t+=1),this.d=t,this.uniforms.get("active").value=t>0,this.setSize(this.resolution.width,this.resolution.height)}}]),n}(KL),EB=(Math.PI,new un,new un,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC"),CB="data:image/png;base64,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",kB="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;}",TB="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);}",PB=0,DB=1,OB=2,IB=3,RB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e,i,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=a.preset,s=void 0===o?DB:o,l=a.edgeDetectionMode,u=void 0===l?yL:l,c=a.predicationMode,h=void 0===c?xL:c;(0,b.Z)(this,n),e=t.call(this,"SMAAEffect",kB,{vertexShader:TB,blendFunction:HL.NORMAL,attributes:QL|YL,uniforms:new Map([["weightMap",new Wu(null)]])}),arguments.length>1&&(i=arguments[0],r=arguments[1],arguments.length>2&&(s=arguments[2]),arguments.length>3&&(u=arguments[3])),e.renderTargetEdges=new rn(1,1,{minFilter:ue,stencilBuffer:!1,depthBuffer:!1}),e.renderTargetEdges.texture.name="SMAA.Edges",e.renderTargetWeights=e.renderTargetEdges.clone(),e.renderTargetWeights.texture.name="SMAA.Weights",e.uniforms.get("weightMap").value=e.renderTargetWeights.texture,e.clearPass=new FL(!0,!1,!1),e.clearPass.overrideClearColor=new Yt(0),e.clearPass.overrideClearAlpha=1,e.edgeDetectionPass=new aB(new bL),e.edgeDetectionMaterial.edgeDetectionMode=u,e.edgeDetectionMaterial.predicationMode=h,e.weightsPass=new aB(new DL);var d=new iu;return d.onLoad=function(){var t=new tn(i);t.name="SMAA.Search",t.magFilter=se,t.minFilter=se,t.generateMipmaps=!1,t.needsUpdate=!0,t.flipY=!0,e.weightsMaterial.searchTexture=t;var n=new tn(r);n.name="SMAA.Area",n.magFilter=ue,n.minFilter=ue,n.generateMipmaps=!1,n.needsUpdate=!0,n.flipY=!1,e.weightsMaterial.areaTexture=n,e.dispatchEvent({type:"load"})},d.itemStart("search"),d.itemStart("area"),void 0!==i&&void 0!==r?(d.itemEnd("search"),d.itemEnd("area")):typeof Image<"u"&&(i=new Image,r=new Image,i.addEventListener("load",(function(){return d.itemEnd("search")})),r.addEventListener("load",(function(){return d.itemEnd("area")})),i.src=EB,r.src=CB),e.applyPreset(s),e}return(0,w.Z)(n,[{key:"getEdgesTexture",value:function(){return this.edgesTexture}},{key:"getWeightsTexture",value:function(){return this.weightsTexture}},{key:"getEdgeDetectionMaterial",value:function(){return this.edgeDetectionMaterial}},{key:"getWeightsMaterial",value:function(){return this.weightsMaterial}},{key:"setEdgeDetectionThreshold",value:function(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}},{key:"setOrthogonalSearchSteps",value:function(e){this.weightsMaterial.orthogonalSearchSteps=e}},{key:"applyPreset",value:function(e){var t=this.edgeDetectionMaterial,n=this.weightsMaterial;switch(e){case PB:t.edgeDetectionThreshold=.15,n.orthogonalSearchSteps=4,n.diagonalDetection=!1,n.cornerDetection=!1;break;case DB:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=8,n.diagonalDetection=!1,n.cornerDetection=!1;break;case OB:t.edgeDetectionThreshold=.1,n.orthogonalSearchSteps=16,n.diagonalSearchSteps=8,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0;break;case IB:t.edgeDetectionThreshold=.05,n.orthogonalSearchSteps=32,n.diagonalSearchSteps=16,n.cornerRounding=25,n.diagonalDetection=!0,n.cornerDetection=!0}}},{key:"setDepthTexture",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lt;this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}},{key:"update",value:function(e,t,n){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}},{key:"setSize",value:function(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}},{key:"dispose",value:function(){var e=this.weightsMaterial,t=e.searchTexture,i=e.areaTexture;null!==t&&null!==i&&(t.dispose(),i.dispose()),(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this)}},{key:"edgesTexture",get:function(){return this.renderTargetEdges.texture}},{key:"weightsTexture",get:function(){return this.renderTargetWeights.texture}},{key:"edgeDetectionMaterial",get:function(){return this.edgeDetectionPass.fullscreenMaterial}},{key:"colorEdgesMaterial",get:function(){return this.edgeDetectionMaterial}},{key:"weightsMaterial",get:function(){return this.weightsPass.fullscreenMaterial}}],[{key:"searchImageDataURL",get:function(){return EB}},{key:"areaImageDataURL",get:function(){return CB}}]),n}(KL),LB="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);}",BB=0,zB=1,FB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.blendFunction,r=void 0===i?HL.NORMAL:i,a=e.technique,o=void 0===a?BB:a,s=(e.eskil,e.offset),l=void 0===s?.5:s,u=e.darkness,c=void 0===u?.5:u;return(0,b.Z)(this,n),t.call(this,"VignetteEffect",LB,{blendFunction:r,defines:new Map([["VIGNETTE_TECHNIQUE",o.toFixed(0)]]),uniforms:new Map([["offset",new Wu(l)],["darkness",new Wu(c)]])})}return(0,w.Z)(n,[{key:"getTechnique",value:function(){return this.technique}},{key:"setTechnique",value:function(e){this.technique=e}},{key:"getOffset",value:function(){return this.offset}},{key:"setOffset",value:function(e){this.offset=e}},{key:"getDarkness",value:function(){return this.darkness}},{key:"setDarkness",value:function(e){this.darkness=e}},{key:"technique",get:function(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))},set:function(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}},{key:"eskil",get:function(){return this.technique===zB},set:function(e){this.technique=e?zB:BB}},{key:"offset",get:function(){return this.uniforms.get("offset").value},set:function(e){this.uniforms.get("offset").value=e}},{key:"darkness",get:function(){return this.uniforms.get("darkness").value},set:function(e){this.uniforms.get("darkness").value=e}}]),n}(KL);new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),new Map([[UB(0,0,0,0),new Float32Array([0,0,0,0])],[UB(0,0,0,1),new Float32Array([0,0,0,1])],[UB(0,0,1,0),new Float32Array([0,0,1,0])],[UB(0,0,1,1),new Float32Array([0,0,1,1])],[UB(0,1,0,0),new Float32Array([0,1,0,0])],[UB(0,1,0,1),new Float32Array([0,1,0,1])],[UB(0,1,1,0),new Float32Array([0,1,1,0])],[UB(0,1,1,1),new Float32Array([0,1,1,1])],[UB(1,0,0,0),new Float32Array([1,0,0,0])],[UB(1,0,0,1),new Float32Array([1,0,0,1])],[UB(1,0,1,0),new Float32Array([1,0,1,0])],[UB(1,0,1,1),new Float32Array([1,0,1,1])],[UB(1,1,0,0),new Float32Array([1,1,0,0])],[UB(1,1,0,1),new Float32Array([1,1,0,1])],[UB(1,1,1,0),new Float32Array([1,1,1,0])],[UB(1,1,1,1),new Float32Array([1,1,1,1])]]);function NB(e,t,n){return e+(t-e)*n}function UB(e,t,n,i){var r=NB(e,t,.75),a=NB(n,i,.75);return NB(r,a,.875)}var ZB=function(){function e(t,n){(0,b.Z)(this,e),this.enabled=!1,this.effect=new t(n),Object.defineProperty(this,"opacity",{enumerable:!0,set:function(e){this.effect.blendMode.opacity.value=e},get:function(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set:function(e){this.effect.blendMode.setBlendFunction(Number(e))},get:function(){return this.effect.blendMode.blendFunction}}),this.blendFunction=HL.NORMAL}return(0,w.Z)(e,[{key:"dispose",value:function(){this.effect.dispose()}}]),e}(),VB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,cB)).blendFunction=HL.SCREEN,e}return(0,w.Z)(n,[{key:"intensity",set:function(e){this.effect.intensity=e},get:function(){return this.effect.intensity}},{key:"luminanceThreshold",set:function(e){this.effect.luminanceMaterial.threshold=e},get:function(){return this.effect.luminanceMaterial.threshold}},{key:"luminanceSmoothing",set:function(e){this.effect.luminanceMaterial.smoothing=e},get:function(){return this.effect.luminanceMaterial.smoothing}},{key:"blurScale",set:function(e){this.effect.blurPass.scale=e},get:function(){return this.effect.blurPass.scale}},{key:"kernelSize",set:function(e){this.effect.blurPass.kernelSize=e},get:function(){return this.effect.blurPass.kernelSize}}]),n}(ZB),jB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this,dB)}return(0,w.Z)(n,[{key:"contrast",set:function(e){this.effect.uniforms.get("contrast").value=e},get:function(){return this.effect.uniforms.get("contrast").value}},{key:"brightness",set:function(e){this.effect.uniforms.get("brightness").value=e},get:function(){return this.effect.uniforms.get("brightness").value}}]),n}(ZB),GB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,gB)).effect.offset=new Dt(.01,.01),e}return(0,w.Z)(n,[{key:"offset",set:function(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)},get:function(){return[1e3*this.effect.offset.x,1e3*this.effect.offset.y]}}]),n}(ZB),HB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this,vB)}return n}(ZB),WB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,wB))._hue=0,e}return(0,w.Z)(n,[{key:"hue",set:function(e){this._hue=e,this.effect.setHue(e)},get:function(){return this._hue}},{key:"saturation",set:function(e){this.effect.uniforms.get("saturation").value=e},get:function(){return this.effect.uniforms.get("saturation").value}}]),n}(ZB),qB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,_B)).blendFunction=HL.OVERLAY,e}return n}(ZB),XB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this,FB)}return(0,w.Z)(n,[{key:"eskil",get:function(){return this.effect.eskil},set:function(e){this.effect.eskil=e}},{key:"darkness",get:function(){return this.effect.uniforms.get("darkness").value},set:function(e){this.effect.uniforms.get("darkness").value=e}},{key:"offset",get:function(){return this.effect.uniforms.get("offset").value},set:function(e){this.effect.uniforms.get("offset").value=e}}]),n}(ZB),YB=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){return(0,b.Z)(this,n),t.call(this,xB)}return(0,w.Z)(n,[{key:"setCamera",value:function(e){var t=!1;(e.isPerspectiveCamera&&!1===this.isPerspectiveCamera||!e.isPerspectiveCamera&&!0===this.isPerspectiveCamera)&&(t=!0),e.isPerspectiveCamera?(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e.perspCamera),this.isPerspectiveCamera=!0):(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e),this.isPerspectiveCamera=!1),t&&this.effect.setChanged()}},{key:"focalLength",set:function(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e/2e3},get:function(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}},{key:"focusDistance",set:function(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=this.isPerspectiveCamera?e/2e3:(e+992)/2e3},get:function(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}},{key:"bokehScale",get:function(){return this.effect.bokehScale},set:function(e){this.effect.bokehScale=e}}]),n}(ZB),QB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this,MB)}return(0,w.Z)(n,[{key:"granularity",get:function(){return this.effect.getGranularity()},set:function(e){this.effect.setGranularity(e)}}]),n}(ZB),KB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this,{name:"PassthroughMaterial",uniforms:{inputBuffer:new Wu(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);}"})}return(0,w.Z)(n,[{key:"inputBuffer",set:function(e){this.uniforms.inputBuffer.value=e}}]),n}(ar),JB=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,"TAAResolvePass")).MRTCompatible=!0,e.needsSwap=!1,e.passThroughMaterial=new KB,e.resolutionVector=new Dt,e.resolveMaterial=new ar({name:"TAAResolveMaterial",uniforms:{inputBuffer:new Wu(null),historyBuffer:new Wu(null),velocityBuffer:new Wu(null),depthBuffer:new Wu(null),resolution:new Wu(new Dt)},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 \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;vec3 RGB_YCoCg(vec3 c){return vec3(c.x/4.0+c.y/2.0+c.z/4.0,c.x/2.0-c.z/2.0,-c.x/4.0+c.y/2.0-c.z/4.0);}vec3 YCoCg_RGB(vec3 c){return clamp(vec3(c.x+c.y-c.z,c.x+c.z,c.x-c.y-c.z),vec3(0.0),vec3(1.0));}vec4 sample_color(sampler2D tex,vec2 uv){\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_depth1.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]=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}"}),e.historyRenderTarget=new rn(1024,1024,{minFilter:ue,stencilBuffer:!1,depthBuffer:!1}),e.historyRenderTarget.texture.name="TAA.History",e.resultRenderTarget=new rn(1024,1024,{minFilter:ue,stencilBuffer:!1,depthBuffer:!1}),e.resultRenderTarget.texture.name="TAA.Output",e}return(0,w.Z)(n,[{key:"setSize",value:function(e,t){this.historyRenderTarget.setSize(e,t),this.resultRenderTarget.setSize(e,t)}},{key:"render",value:function(e,t){this.fullscreenMaterial=this.resolveMaterial,this.resolveMaterial.uniforms.inputBuffer.value=t.texture[0],this.resolveMaterial.uniforms.velocityBuffer.value=t.texture[1],this.resolveMaterial.uniforms.depthBuffer.value=t.depthTexture,this.resolveMaterial.uniforms.historyBuffer.value=this.historyRenderTarget.texture,this.resolveMaterial.uniforms.resolution.value.set(t.width,t.height),e.setRenderTarget(this.resultRenderTarget),e.render(this.scene,this.camera),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(this.historyRenderTarget),e.render(this.scene,this.camera);var n=this.renderToScreen?null:t;this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(n),e.render(this.scene,this.camera)}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}}]),n}(RL),$B=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,"TransmissionPass",void 0,i)).MRTCompatible=!0,a.depthPass=new GL(e,i,{renderTarget:r.transmissionDepthTarget}),a.passThroughMaterial=new KB,a.splineScene=e,a.needsSwap=!1,a}return(0,w.Z)(n,[{key:"updatePasses",value:function(e){this.passThroughMaterial.dispose(),this.passThroughMaterial=new KB,this.depthPass.dispose(),this.depthPass=new GL(this.splineScene,this.camera,{renderTarget:e.transmissionDepthTarget})}},{key:"setCamera",value:function(e){this.camera=e}},{key:"setScene",value:function(e){this.splineScene=e}},{key:"render",value:function(e,t,n){var i=this.camera.layers.mask,r=e;r.setRenderTarget(r.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=t.texture[0],r.clear(),r.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(e,t,n),r.shadowMap.needsUpdate=!1,r.shadowMap.autoUpdate=!1;var a=this.renderToScreen?null:t;this.camera.layers.set(3),e.setRenderTarget(a),e.render(this.splineScene,this.camera),this.camera.layers.mask=i}},{key:"dispose",value:function(){var e;(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),null!==(e=this.depthPass)&&void 0!==e&&e.renderPass.dispose(),this.depthPass.dispose(),this.passThroughMaterial.dispose(),this.depthPass=void 0,this.passThroughMaterial=void 0,this.splineScene=void 0,this.scene=void 0,this.camera=void 0}}]),n}(RL),ez=new es,tz=new ar({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 "}),nz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,"OpaquePass",null!==i&&void 0!==i?i:ez,r)).MRTCompatible=!0,a.originalMaterials=[],a.hasTransmissionPass=!1,a.clear=!0,a.clearColorOnly=!1,a.clearDepth=!1,a.needsSwap=!1,a.MRTCompatible=e,a}return(0,w.Z)(n,[{key:"setCamera",value:function(e){this.camera=e}},{key:"setScene",value:function(e){this.scene=null!==e&&void 0!==e?e:ez}},{key:"getScene",value:function(){return this.scene}},{key:"render",value:function(e,t){var n=this;this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.length=0,this.scene.traverse((function(e){e.layers.isEnabled(3)&&e instanceof eP&&(n.originalMaterials.push([e,e.material]),e.material=tz)})),e.shadowMap.needsUpdate=!0,e.shadowMap.autoUpdate=!0),this.camera.layers.enable(8);var i=this.renderToScreen?null:t;e.setRenderTarget(i),this.clearColorOnly&&e.clear(!0,!1,!0),this.clear&&e.clear(),e.render(this.scene,this.camera),this.clearDepth&&e.clear(!1,!0,!1),this.hasTransmissionPass&&this.originalMaterials.forEach((function(e){e[0].material=e[1]}))}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.originalMaterials.length=0,this.scene=void 0,this.camera=void 0}}]),n}(RL),iz=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.depthBuffer,r=void 0===i||i,a=n.stencilBuffer,o=void 0!==a&&a,s=n.multisampling,l=void 0===s?0:s,u=n.frameBufferType,c=void 0===u?0:u;(0,b.Z)(this,e),this.renderer=t,this.helperStartIndex=0,this.copyPass=new LL,this.depthTexture=null,this.timer=new sB,this._width=1,this._height=1,this.passes=[],this.helperPasses=[],this.autoRenderToScreen=!0,this.inputBuffer=this.createBuffer(r,o,c,l,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(r,o,c,l,!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(r,o,c,l,!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)}return(0,w.Z)(e,[{key:"getTimer",value:function(){return this.timer}},{key:"getRenderer",value:function(){return this.renderer}},{key:"setRenderer",value:function(e){if(this.renderer=e,null!==e){var t,n,i=e.getSize(new Dt),r=null!==(t=null===(n=e.getContext().getContextAttributes())||void 0===n?void 0:n.alpha)&&void 0!==t&&t,a=this.inputBuffer.texture[0].type;a===he&&e.outputEncoding===st&&(this.inputBuffer.texture[0].encoding=st,this.outputBuffer.texture[0].encoding=st,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),e.autoClear=!1,this.setSize(i.width,i.height,!1);var o,s=D(this.passes);try{for(s.s();!(o=s.n()).done;){o.value.initialize(e,r,a)}}catch(l){s.e(l)}finally{s.f()}}}},{key:"replaceRenderer",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.renderer,i=n.domElement.parentNode;return this.setRenderer(e),t&&null!==i&&(i.removeChild(n.domElement),i.appendChild(e.domElement)),n}},{key:"createDepthTexture",value:function(){var e=this.depthTexture=new qo(this._width,this._height);return this.inputBuffer.depthTexture=e,this.inputBuffer.stencilBuffer?(e.format=xe,e.type=me):e.type=fe,e}},{key:"deleteDepthTexture",value:function(){if(null!==this.depthTexture){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();var e,t=D(this.passes);try{for(t.s();!(e=t.n()).done;){e.value.setDepthTexture(null)}}catch(n){t.e(n)}finally{t.f()}}}},{key:"createBuffer",value:function(e,t,n,i,r,a){var o,s=this.renderer,l=null===s?new Dt:s.getDrawingBufferSize(new Dt),u={minFilter:ue,magFilter:ue,wrapS:ae,wrapT:ae,stencilBuffer:t,depthBuffer:e};return i>0?(o=new rn(l.width,l.height,u)).samples=i:(r?(o=new sn(l.width,l.height,2,u)).texture[1].type=pe:o=new rn(l.width,l.height,u),o.depthTexture=new qo(2048,2048),o.depthTexture.type=ve),n===he&&null!==s&&s.outputEncoding===st&&(Array.isArray(o.texture)?o.texture.forEach((function(e){return e.encoding=st})):o.texture.encoding=st),Array.isArray(o.texture)?o.texture.forEach((function(e,t){e.name="EffectComposer.Buffer ".concat(r," ").concat(t),e.generateMipmaps=!1})):(o.texture.name="EffectComposer.Buffer ".concat(r),o.texture.generateMipmaps=!1),o.name=a,o}},{key:"addPass",value:function(e,t){var n,i,r,a=this.passes,o=this.renderer,s=o.getDrawingBufferSize(new Dt),l=null!==(n=null===(i=o.getContext().getContextAttributes())||void 0===i?void 0:i.alpha)&&void 0!==n&&n;if(e.MRTCompatible&&(r=this.inputBuffer.texture[0].type),e.MRTCompatible||(r=this.inputBuffer.texture.type),e.setRenderer(o),e.setSize(s.width,s.height),e.initialize(o,l,r),this.autoRenderToScreen&&(a.length>0&&(a[a.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?a.splice(t,0,e):a.push(e),this.autoRenderToScreen&&(a[a.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthTexture)if(null===this.depthTexture){var u,c=this.createDepthTexture(),h=D(a);try{for(h.s();!(u=h.n()).done;)(e=u.value).setDepthTexture(c)}catch(d){h.e(d)}finally{h.f()}}else e.setDepthTexture(this.depthTexture)}},{key:"setHelperStartIndex",value:function(e){this.helperStartIndex=e}},{key:"removePass",value:function(e){var t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){if(null!==this.depthTexture){t.reduce((function(e,t){return e||t.needsDepthTexture}),!1)||e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null)}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}},{key:"removeAllPasses",value:function(){var e=this.passes;e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}},{key:"render",value:function(e){var t,n,i,r,a=this.renderer,o=this.copyPass,s=this.inputBuffer,l=this.outputBuffer,u=this.inputBufferSingle,c=this.outputBufferSingle,h=!1;void 0===e&&(e=this.timer.update().getDelta());var d,f=D(this.passes);try{for(f.s();!(d=f.n()).done;){var v=d.value;v.enabled&&(v.MRTCompatible?v.render(a,s,l,e,h):v.render(a,u,c,e,h),v.needsSwap&&(h&&(o.renderToScreen=v.renderToScreen,t=a.getContext(),(n=a.state.buffers.stencil).setFunc(t.NOTEQUAL,1,4294967295),o.render(a,s,l,e,h),n.setFunc(t.EQUAL,1,4294967295)),i=s,r=u,s=l,u=c,l=i,c=r),v instanceof rB?h=!0:v instanceof BL&&(h=!1))}}catch(p){f.e(p)}finally{f.f()}}},{key:"setSize",value:function(e,t,n){var i=this.renderer;if(this._width=e,this._height=t,void 0===e||void 0===t){var r=i.getSize(new Dt);e=r.width,t=r.height}i.setSize(e,t,n);var a=i.getDrawingBufferSize(new Dt);this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height),this.inputBufferSingle.setSize(a.width,a.height),this.outputBufferSingle.setSize(a.width,a.height);var o,s=D(this.passes);try{for(s.s();!(o=s.n()).done;){o.value.setSize(a.width,a.height)}}catch(l){s.e(l)}finally{s.f()}}},{key:"reset",value:function(){var e=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(e)}},{key:"dispose",value:function(){var e,t=D(this.passes);try{for(t.s();!(e=t.n()).done;){e.value.dispose()}}catch(n){t.e(n)}finally{t.f()}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()}},{key:"multisampling",get:function(){return this.inputBuffer.samples||0},set:function(e){var t=this.inputBuffer,n=this.multisampling;n>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):n!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("creating new input buffer"),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}}]),e}(),rz=new ar({name:"CombineMaterial",uniforms:{inputBufferA:new Wu(null),inputBufferB:new Wu(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"}),az=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i;(0,b.Z)(this,n),(i=t.call(this,"HelperPass",void 0,e)).MRTCompatible=!1,i.fullscreenMaterial=rz,i.helperPass=new nz(!1,void 0,i.camera),i.helperPass.hasTransmissionPass=!1,i.helperPass.clear=!1,i.helperPass.renderToScreen=!1,i.helperPassOnTop=new nz(!1,void 0,i.camera),i.helperPassOnTop.hasTransmissionPass=!1,i.helperPassOnTop.clear=!1,i.helperPassOnTop.renderToScreen=!1;var r=new RB({preset:PB,edgeDetectionMode:yL});return i.effectPass=new eB(i.camera,r),i.rt=new rn(10,10,{minFilter:ue,magFilter:ue,wrapS:ae,wrapT:ae,depthBuffer:!0}),i}return(0,w.Z)(n,[{key:"setSize",value:function(e,t){this.rt.setSize(e,t),this.effectPass.setSize(e,t)}},{key:"setCamera",value:function(e){this.helperPass.setCamera(e),this.helperPassOnTop.setCamera(e)}},{key:"initialize",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"initialize",this).call(this,e,t,i),this.effectPass.initialize(e,t,i)}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.rt.dispose(),this.effectPass.dispose(),this.helperPass.dispose(),this.helperPassOnTop.dispose()}},{key:"render",value:function(e,t,n){this.rt.depthTexture=t.depthTexture;var i=e.getClearAlpha();e.setClearAlpha(0),this.helperPass.clearDepth=!0,this.helperPass.clearColorOnly=!0,this.helperPass.render(e,this.rt),this.helperPassOnTop.render(e,this.rt),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.rt,n),this.fullscreenMaterial.uniforms.inputBufferA.value=n.texture,this.fullscreenMaterial.uniforms.inputBufferB.value=t.texture,e.setClearAlpha(i),e.setRenderTarget(null),e.clear(),e.render(this.scene,this.camera)}},{key:"sceneHelpers",set:function(e){this.helperPass.setScene(e)},get:function(){return this.helperPass.getScene()}},{key:"sceneHelpersOnTop",set:function(e){this.helperPassOnTop.setScene(e)},get:function(){return this.helperPassOnTop.getScene()}}]),n}(RL),oz=[[.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]],sz=new ar({vertexShader:"#define GLSLIFY 1\n#include \n#include \nout vec3 n;void main(){\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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);}"}),lz=new ar({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));gl_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 Wu(null),texture_depth_lrez:new Wu(null),texture_depth_hrez:new Wu(null),near:new Wu(null),far:new Wu(null)}}),uz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;(0,b.Z)(this,n),(r=t.call(this,"AmbientOcclusionPass",void 0,i)).fogEnabled=!1,r.fogNear=1,r.fogFar=1e3,r.frameIndex=0,r.sanitizeViewport=!1,r._runHalfRes=!0,r._width=1,r._height=1;var a=1024,o=1024;r.gBuffer=new rn(a,o,{type:wm?pe:ve,depthTexture:new qo(a,o),minFilter:ue,magFilter:ue}),r.depthBufferHighRes=new rn(a,o,{depthTexture:new qo(a,o)}),r.aoBuffer=new rn(a,o,{minFilter:ue,magFilter:ue}),r.splineScene=e,r.splineCamera=i;for(var s=new Float32Array(2*oz.length),l=0;l=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 Wu(null),far:new Wu(null),fov:new Wu(null),proj_info:new Wu(new nn),is_ortho:new Wu(!1),resolution:new Wu(new Dt),radius_of_influence:new Wu(8),radius_in_screen_space:new Wu(1),exponent:new Wu(1),ao_color:new Wu(new un),bias:new Wu(.5),texture_depth:new Wu(null),texture_normals:new Wu(null),texture_blue_noise:new Wu(null),texture_blue_noise_in_disk:new Wu(r.blueNoiseInDiskTexture),frame_index:new Wu(0),fog_enabled:new Wu(!1),fog_near:new Wu(1),fog_far:new Wu(1e3)}}),r.radius=128,r.aoColor={r:0,g:0,b:0},r.bias=.5,r.hbaoMaterial.uniforms.texture_depth.value=r.gBuffer.depthTexture,r.hbaoMaterial.uniforms.texture_normals.value=r.gBuffer.texture,r.needsSwap=!0,r.aaBuffer=new rn(a,o,{minFilter:ue,magFilter:ue,wrapS:ae,wrapT:ae,depthBuffer:!1,type:ve});var c=new RB({preset:IB,edgeDetectionMode:yL});return r.effectPass=new eB(r.camera,c),r}return(0,w.Z)(n,[{key:"initialize",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"initialize",this).call(this,e,t,i),this.effectPass.initialize(e,t,i)}},{key:"setBlueNoiseTexture",value:function(e){this.hbaoMaterial.uniforms.texture_blue_noise.value=e}},{key:"setSize",value:function(e,t){this._width=e,this._height=t,this.depthBufferHighRes.setSize(e,t);var n=this._runHalfRes?.5:1,i=e*n,r=t*n;this.gBuffer.setSize(i,r),this.aoBuffer.setSize(i,r),this.hbaoMaterial.uniforms.resolution.value.set(i,r),this.aaBuffer.setSize(i,r),this.effectPass.setSize(i,r)}},{key:"setCamera",value:function(e){this.splineCamera=e}},{key:"setScene",value:function(e){this.splineScene=e}},{key:"setDepthTexture",value:function(e){this.depthBufferHighRes.depthTexture=e,lz.uniforms.texture_depth_hrez.value=e,lz.needsUpdate=!0}},{key:"render",value:function(e,t,n){var i=null,r=null,a=null,o=null,s=function(t){e.setViewport(0,0,t.width,t.height)};this.sanitizeViewport&&(i=new nn,r=new nn,e.getViewport(i),e.getScissor(r),a=e.getScissorTest(),o=e.getRenderTarget(),e.setScissorTest(!1)),this.splineScene.overrideMaterial=sz;var l=this.splineCamera.layers.mask;if(this.splineCamera.layers.set(5),e.setRenderTarget(this.gBuffer),this.sanitizeViewport&&s(this.gBuffer),e.clear(),e.render(this.splineScene,this.splineCamera),e.setRenderTarget(this.depthBufferHighRes),this.sanitizeViewport&&s(this.depthBufferHighRes),e.clear(),e.render(this.splineScene,this.splineCamera),this.splineScene.overrideMaterial=null,this.splineCamera.layers.mask=l,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;var u=this.splineCamera.perspCamera.projectionMatrix.elements,c=2/u[0],h=2/u[5],d=-(1-u[8])/u[0],f=-(1+u[9])/u[5];this.hbaoMaterial.uniforms.proj_info.value.set(c,h,d,f);var v=this.splineCamera.perspCamera.fov*(Math.PI/180),p=this.hbaoMaterial.uniforms.resolution.value.y/(2*Math.tan(.5*v)),m=.5*this.hbaoMaterial.uniforms.radius_of_influence.value*p;this.hbaoMaterial.uniforms.radius_in_screen_space.value=m,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;var g=this.splineCamera.orthoCamera.projectionMatrix.elements,y=2/g[0],x=2/g[5],b=-(1+g[12])/g[0],w=-(1-g[13])/g[5];this.hbaoMaterial.uniforms.proj_info.value.set(y,x,b,w);var S=this.hbaoMaterial.uniforms.resolution.value.y/x*.5,_=this.hbaoMaterial.uniforms.radius_of_influence.value*S;this.hbaoMaterial.uniforms.radius_in_screen_space.value=_,this.hbaoMaterial.uniforms.is_ortho.value=!0}var A=e.aoRenderTarget;this.runHalfRes?(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aoBuffer),this.sanitizeViewport&&s(this.aoBuffer),e.clear(),e.render(this.scene,this.camera),this.fullscreenMaterial=lz,lz.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,lz.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,lz.uniforms.texture_depth_hrez.value=this.depthBufferHighRes.depthTexture,e.setRenderTarget(A),this.sanitizeViewport&&s(A),e.clear(),e.render(this.scene,this.camera)):(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aaBuffer),this.sanitizeViewport&&s(this.aaBuffer),e.clear(),e.render(this.scene,this.camera),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.aaBuffer,A)),this.sanitizeViewport&&i&&r&&null!==a&&(e.setRenderTarget(o),e.setViewport(i.x,i.y,i.z,i.w),e.setScissor(r.x,r.y,r.z,r.w),e.setScissorTest(a))}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.gBuffer.dispose(),this.depthBufferHighRes.dispose(),this.aoBuffer.dispose(),this.aaBuffer.dispose(),this.effectPass.dispose(),this.hbaoMaterial.dispose(),this.blueNoiseInDiskTexture.dispose(),this.splineScene=null,this.splineCamera=null}},{key:"runHalfRes",get:function(){return this._runHalfRes},set:function(e){this._runHalfRes=e,this.setSize(this._width,this._height)}}]),n}(RL),cz=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,new ar({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 with 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}\n",uniforms:{tInput:new Wu(null),tMap:new Wu(null),uResolution:new Wu(new Dt),uSize:new Wu(new Dt),uCoords:new Wu(new Dt),uScale:new Wu(1),uSceneColor:new Wu(new Yt(16711680)),uDPR:new Wu(1),uCurrent:new Wu(0)}}),"tInput")).needsSwap=!0,e}return(0,w.Z)(n,[{key:"uniforms",get:function(){return this.fullscreenMaterial.uniforms}},{key:"texture",get:function(){return this.uniforms.tMap.value},set:function(e){this.uniforms.tMap.value=e}}]),n}(aB),hz=[],dz=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,new ar({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 Wu(null),fromScene:new Wu(null),uResolution:new Wu(new Dt),uDPR:new Wu(1),mixRatio:new Wu(0),threshold:new Wu(.1),useTexture:new Wu(0),tMixTexture:{value:hz[0]}}}),"toScene")).needsSwap=!0,e}return(0,w.Z)(n,[{key:"uniforms",get:function(){return this.fullscreenMaterial.uniforms}},{key:"texture",get:function(){return this.uniforms.fromScene.value},set:function(e){this.uniforms.fromScene.value=e}}]),n}(aB),fz=function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this,new ar({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 Wu(null),blurredInputBuffer:new Wu(null),overlay:new Wu(null),uResolution:new Wu(new Dt),uDPR:new Wu(1),blurIntensity:new Wu(0)}})))._blurEnabled=!1,e.blurTarget=new rn(1,1,{minFilter:ue,magFilter:ue,wrapS:ae,wrapT:ae}),e.blurPass=new nB({width:window.innerWidth,height:window.innerHeight,kernelSize:lB.HUGE,resolutionScale:.25}),e.blurPass.renderToScreen=!1,e.uniforms.blurredInputBuffer.value=e.blurTarget.texture,e}return(0,w.Z)(n,[{key:"setResolution",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.uniforms.uResolution.value.set(e,t),this.uniforms.uDPR.value=n,this.blurPass.setSize(e,t),this.blurTarget.setSize(e,t),this.blurPass.setSize(e,t)}},{key:"render",value:function(e,t,i,r,a){this._blurEnabled&&(this.blurPass.setDepthTexture(this.getDepthTexture()),this.blurPass.render(e,t,this.blurTarget,r,a)),(0,d.Z)((0,m.Z)(n.prototype),"render",this).call(this,e,t,i,r,a)}},{key:"dispose",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this),this.blurTarget.dispose(),this.blurPass.dispose(),this.fullscreenMaterial.dispose(),this._uiCanvas=void 0}},{key:"uniforms",get:function(){return this.fullscreenMaterial.uniforms}},{key:"texture",get:function(){return this.uniforms.overlay.value},set:function(e){this.uniforms.overlay.value=e}},{key:"uiCanvas",get:function(){return this._uiCanvas},set:function(e){this._uiCanvas=e,e.texture&&(this.uniforms.overlay.value=e.texture);var t=e.frame;if(t){var n=t.data.backgroundBlur,i=n.radius;this._blurEnabled=n.enabled,this.uniforms.blurIntensity.value=this._blurEnabled?1:0,this.blurPass.scale=i/3}}}]),n}(aB),vz=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.call(this,new ar({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 Wu(null),tOverlayImage:new Wu(null),uResolution:new Wu(new Dt),uImageSize:new Wu(new Dt),uRightBottom:new Wu(new Dt(20,20)),uScale:new Wu(.25),uDPR:new Wu(1)}}),"tInput")}return(0,w.Z)(n,[{key:"uniforms",get:function(){return this.fullscreenMaterial.uniforms}},{key:"texture",get:function(){return this.uniforms.tOverlayImage.value},set:function(e){this.uniforms.tOverlayImage.value=e,this.uniforms.uImageSize.value.set(e.image.width,e.image.height)}}]),n}(aB);function pz(e,t){return t&&t.enabled&&e.push(t.effect),e}var mz=function(e){return Object.values(HL).includes(e)?e:HL.NORMAL},gz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this))._needsDOFResize=i,r.postprocessingState=Hb.defaultData,r._scene=new es,r._camera=new ZR,r.effects=new Map,r.blueNoiseTexture=new as,r._renderToScreen=!0,r._isUIOverlayEnabled=!1,r.clock=new ku,r.renderer=e,r.debug=!1,r.effects.set("bloom",new VB),r.effects.set("chromaticAberration",new GB),r.effects.set("vignette",new XB),r.effects.set("noise",new qB),r.effects.set("colorAverage",new HB),r.effects.set("hueSaturation",new WB),r.effects.set("brightnessContrast",new jB),r.effects.set("depthOfField",new YB),r.effects.set("pixelation",new QB),r.effectComposer=new iz(r.renderer),r.effectComposer.autoRenderToScreen=!1,r.opaquePass=new nz(!0,r.scene,r.camera),r.opaquePass.clear=!0,r.transmissionPass=new $B(r.scene,r.camera,r.renderer),r.aoPass=new uz(r.scene,r.camera),r.taaPass=new JB,r.taaPass.renderToScreen=!1,r.helperPass=new az(r.camera),r.helperPass.renderToScreen=!1,r.stylesOverlayPass=new cz,r.stylesOverlayPass.enabled=!1,r.uiOverlayPass=new fz,r.uiOverlayPass.enabled=!1,r.logoOverlayPass=new vz,r.logoOverlayPass.enabled=!1,r.sceneTransitionPass=new dz,r.sceneTransitionPass.enabled=!1,r._initCopyPass(),r._initPasses(),r}return(0,w.Z)(n,[{key:"updateRenderToScreen",value:function(){for(var e=!1,t=this.effectComposer.passes.length-1;t>=0;t--){var n=this.effectComposer.passes[t];!0!==n.enabled||e||!this._renderToScreen?n.renderToScreen=!1:(n.renderToScreen=!0,e=!0)}}},{key:"disableUIOverlay",value:function(){this._isUIOverlayEnabled=!1}},{key:"enableUIOverlay",value:function(){this._isUIOverlayEnabled=!0}},{key:"disableHelpers",value:function(){this.helperPass.enabled=!1,this.updateRenderToScreen()}},{key:"enableHelpers",value:function(){this.helperPass.enabled=!0,this.updateRenderToScreen()}},{key:"updateBlueNoiseTexture",value:function(e){this.blueNoiseTexture=new as(e,128,128),this.blueNoiseTexture.wrapS=re,this.blueNoiseTexture.wrapT=re,this.blueNoiseTexture.minFilter=se,this.blueNoiseTexture.magFilter=se,this.blueNoiseTexture.needsUpdate=!0}},{key:"setAmbientOcclusionParams",value:function(e,t,n,i,r,a,o,s){this.aoPass.enabled=e,this.aoPass.radius=t,this.aoPass.bias=n,this.aoPass.aoColor=i,this.aoPass.fogEnabled=r,this.aoPass.fogNear=a,this.aoPass.fogFar=o,this.aoPass.runHalfRes!==!s&&(this.aoPass.runHalfRes=!s)}},{key:"setTransmissionPassEnabled",value:function(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}},{key:"_initPasses",value:function(){var e,t;if(null!==(e=this.uvEffectPass)&&void 0!==e&&e.dispose(),null!==(t=this.effectPass)&&void 0!==t&&t.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){var n,i=[this.effects.get("pixelation")].reduce(pz,[]);i.length>0&&(this.uvEffectPass=(0,a.Z)(eB,[this.camera].concat((0,l.Z)(i))),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));var r=[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(pz,[]);if(r.length>0&&(this.effectPass=(0,a.Z)(eB,[this.camera].concat((0,l.Z)(r))),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&null!==(n=this.effects.get("depthOfField"))&&void 0!==n&&n.enabled&&void 0!==window)){var o=this.renderer.viewportWidth,s=this.renderer.viewportHeight;this.renderer.setSize(o-1,s-1),this.renderer.setSize(o,s)}}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)}},{key:"_initCopyPass",value:function(){if(!this._savePass){var e=new Dt;this.renderer.getDrawingBufferSize(e),this._rt=new rn(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:re,wrapT:re}),this._rt.samples=0,this._savePass=new LL(this._rt,!1),this._savePass.renderToScreen=!1}}},{key:"setCopyPass",value:function(e){this._rt=e,this._savePass=new LL(this._rt,!1),this.renderToScreen=!1}},{key:"setWatermark",value:function(e){this.logoOverlayPass.enabled=null!==e,e&&(this.logoOverlayPass.texture=e)}},{key:"updatePostprocessing",value:function(e){var t=e.enabled,n=(0,o.Z)(e,["enabled"]),i=!1;t!==this.postprocessingState.enabled&&(i=!0);for(var r=0,a=Object.entries(n);r 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 ];\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;\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; 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")},xz=Sr.lights_fragment_begin,bz=Sr.shadowmask_pars_fragment,wz=null,Sz=function(e){switch(e){case"low":return 8;case"medium":return 16;case"high":return 32;default:return 16}},_z=new ar({vertexShader:"\nattribute vec3 randomColor;\nvarying vec3 vNormal;\nflat out vec3 vColor;\n#include \n#include \n\t\nvoid main()\n{\n#include \n#include \n#include \n#include \nvec3 transformed = vec3(position);\n#include \n#include \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;\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}}}),Az=new tn,Mz=new Dt,Ez=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r;(0,b.Z)(this,n),(r=t.call(this,e))._pixelRatio=r.getPixelRatio(),r.viewportWidth=1,r.viewportHeight=1,r.resolution=new Dt,r.dummyCamera=new ZR,r.sceneTransitionDuration=0,r.sceneTransitionTimeRemaining=-1,r.isXRCopyPassSet=!1,r.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=r.getContext(),a=0;e&&(a|=i.COLOR_BUFFER_BIT),t&&(a|=i.DEPTH_BUFFER_BIT),n&&(a|=i.STENCIL_BUFFER_BIT),i.clear(a),i.clearBufferfv(i.COLOR,1,[0,0,0,1])},r.pipeline=new gz((0,f.Z)(r),null!==(i=null===e||void 0===e?void 0:e.needsDOFResize)&&void 0!==i&&i),r.autoClear=!1;var a=r.setPixelRatio.bind((0,f.Z)(r)),o=r.setSize.bind((0,f.Z)(r));r.shadowMap.enabled=!0,r.shadowMap.type=1,r.dummyCamera.matrixAutoUpdate=!1,r.domElement.removeAttribute("data-engine");var s=r.getContext();if(s&&"drawingBufferColorSpace"in s)try{s.drawingBufferColorSpace="display-p3"}catch(Ax){console.warn(Ax)}return r.setPixelRatio=function(e){r._pixelRatio!==e&&(r._pixelRatio=e,a(e))},r.setSize=function(e,t){var n,i,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(r.viewportWidth!==e||r.viewportHeight!==t)&&(r.viewportWidth=e,r.viewportHeight=t,o(e,t,a),null!==(n=r.normalRenderTarget)&&void 0!==n&&n.setSize(e*r._pixelRatio,t*r._pixelRatio),r._resizeTransmission(e,t),null!==(i=r.transmissionDepthTarget)&&void 0!==i&&i.setSize(e*r._pixelRatio/2,t*r._pixelRatio/2),r.pipeline.resize(e,t,a))},r._superDispose=r.dispose,r.dispose=r._currentDispose,r}return(0,w.Z)(n,[{key:"createAORenderTarget",value:function(){void 0===this.aoRenderTarget&&(this.aoRenderTarget=new rn(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:ue,magFilter:ue,wrapS:ae,wrapT:ae,depthBuffer:!1}))}},{key:"_resizeTransmission",value:function(e,t){var n,i;null!==(n=this.transmissionRenderTarget)&&void 0!==n&&n.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),null===(i=this.aoRenderTarget)||void 0===i||i.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}},{key:"createTransmissionRenderTarget",value:function(){void 0===this.transmissionRenderTarget&&(this.transmissionRenderTarget=new rn(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:ce,magFilter:ue,wrapS:ae,wrapT:ae,depthBuffer:!1}),this.transmissionDepthTarget=new rn(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:se,magFilter:se,depthBuffer:!1}))}},{key:"createNormalRenderTarget",value:function(){void 0===this.normalRenderTarget&&(this.normalRenderTarget=new rn(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:se,magFilter:se,type:ve,depthTexture:new qo(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}))}},{key:"renderNormal",value:function(e,t,n){this.normalRenderTarget&&(this.setClearColor(0),n.layers.enable(8),n.layers.disable(0),n.layers.disable(3),t.traverseEntity((function(e){e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!1)})),this.setRenderTarget(this.normalRenderTarget),this.clear(),_z.uniforms.depthContrast.value=n instanceof ZR?(n.far-n.near)/1e4:1,t.overrideMaterial=_z,this.render(t,n),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?nU:null,n.layers.enable(0),n.layers.enable(3),t.traverseEntity((function(e){e.layers.isEnabled(8)&&(e.copyPreviousMatrix=!0)})))}},{key:"renderSplineSceneWithDummyCamera",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.dummyCamera.updateCameraState(t.dataPatched),this.dummyCamera.matrix.copy(t.matrixWorld);var i=t.height,r=t.width,a=this.viewportWidth/this.viewportHeight;r2&&void 0!==arguments[2]?arguments[2]:{},a=r.sceneHelpers,o=void 0===a?this.sceneHelpers:a,s=r.sceneHelpersOnTop,l=void 0===s?this.sceneHelpersOnTop:s,u=r.overrideTransmission,c=void 0===u?void 0:u,h=r.overrideNormal,d=void 0===h?void 0:h,f=e instanceof rU?e.activePage:e,v=f.visible;f.visible=!0;var p=f.scene;this.xr.enabled&&(!1===this.isXRCopyPassSet&&null!==this.getRenderTarget()&&(this.pipeline.setCopyPass(this.getRenderTarget()),this.isXRCopyPassSet=!0),this.xr.updateCamera(t)),this.setClearColor(f.bgColor,f.bgColor.a),f.penumbraSizeArray.forEach((function(e,t){vD.penumbraSize.value[t]=e})),vD.pixelRatioNode.value=this.getPixelRatio(),0!==this.resolution.x&&0!==this.resolution.y?vD.resolution.value.set(this.resolution.x,this.resolution.y):vD.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio),void 0!==d?(vD.normalRenderTarget.value=d,vD.normalRenderTargetDepth.value=Az):p.needsNormal()&&(this.createNormalRenderTarget(),vD.normalRenderTarget.value=this.normalRenderTarget.texture,vD.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(p,f,t));var m=f.data.ao,g=m.occlusion;if(g&&(this.createAORenderTarget(),vD.aoRenderTarget.value=this.aoRenderTarget.texture),vD.aoEnabled.value=g,this.pipeline.setAmbientOcclusionParams(m.occlusion,m.radius,m.bias,f.aoColor,null!==f.fog,f.backupFog.near,f.backupFog.far,m.aoFullRes&&!wm),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&null!==(n=f.uiCanvas)&&void 0!==n&&n.enabled&&f.uiCanvas.texture&&f.uiCanvas.texture.image.width>0){var y=this.getSize(Mz),x=this.getPixelRatio();(f.uiCanvas.width!==this.viewportWidth||f.uiCanvas.height!==this.viewportHeight||f.uiCanvas.dpr!==x)&&f.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},x),f.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=f.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(y.x,y.y,x),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){var b=this.getSize(Mz),w=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(b.x,b.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=w}var S=!1;if(void 0!==c)vD.transmissionRenderTarget.value=c,vD.transmissionRenderTargetDepth.value=Az,this.pipeline.setTransmissionPassEnabled(!1);else{var _=p.needsTransmission();_&&(void 0===this.transmissionRenderTarget&&(S=!0),this.createTransmissionRenderTarget(),vD.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,vD.aspectRatio.value=cD(this.viewportWidth,this.viewportHeight),vD.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(_)}t.layers.enable(3),t.layers.enable(8),this.pipeline.sceneHelpers=o,this.pipeline.sceneHelpersOnTop=l,this.pipeline.taaPass.enabled=vD.taaEnabled.value,this.pipeline.scene=f,this.pipeline.camera=t,S&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState!==f.postprocessing&&(this.pipeline.updatePostprocessing(f.postprocessing),!o&&!l&&this.pipeline.disableHelpers()),void 0!==this.clearAlphaOverride&&this.setClearAlpha(this.clearAlphaOverride),p.shapeBlendIntances.forEach((function(e){e.onBeforeShadowPass(i)})),f.overrideMaterial=p.wireframeState?nU:null,this.pipeline.render(),vD.taaEnabled.value&&(vD.frameIndex.value=(vD.frameIndex.value+1)%16),t instanceof ZR&&t.copyHistory(),f.visible=v}},{key:"renderFromSceneForSceneTransitionPass",value:function(e,t,n){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,t),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=n,this.sceneTransitionTimeRemaining=n,this.pipeline.renderToScreen=!0;var i=this.pipeline.sceneTransitionPass.uniforms;i.uDPR.value=window.devicePixelRatio,i.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}},{key:"_currentDispose",value:function(){var e,t,n,i,r,a;this._superDispose(),this.pipeline.dispose(),null!==(e=this.aoRenderTarget)&&void 0!==e&&e.dispose(),this.aoRenderTarget=void 0,null!==(t=this.transmissionRenderTarget)&&void 0!==t&&t.dispose(),this.transmissionRenderTarget=void 0,null!==(n=this.transmissionDepthTarget)&&void 0!==n&&n.dispose(),this.transmissionDepthTarget=void 0,null!==(i=this.normalRenderTarget)&&void 0!==i&&null!==(r=i.depthTexture)&&void 0!==r&&r.dispose(),null!==(a=this.normalRenderTarget)&&void 0!==a&&a.dispose(),this.normalRenderTarget=void 0,this.dummyCamera.dispose(),this.dummyCamera=void 0,vD.normalRenderTarget.value=Az,vD.normalRenderTargetDepth.value=Az,vD.transmissionRenderTarget.value=Az,vD.transmissionRenderTargetDepth.value=Az,vD.aoRenderTarget.value=Az}},{key:"hdTransmission",get:function(){return 1===vD.transmissionLod.value},set:function(e){vD.transmissionLod.value=!0===e?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}}]),n}(Jo),Cz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10066329;return(0,b.Z)(this,n),(i=t.call(this,e,r,a)).object=e,i.added=!1,i.name="DirectionalLightHelper: ".concat(e.uuid),i}return(0,w.Z)(n,[{key:"raycast",value:function(e,t){kR(this.object,n.geometryHelper,e,t)}}]),n}(AR(lc)),kz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6710886;return(0,b.Z)(this,n),(i=t.call(this,e,r,a)).object=e,i.name="PointLightHelper: ".concat(e.uuid),i}return(0,w.Z)(n,[{key:"raycast",value:function(e,t){kR(this.object,n.geometryHelper,e,t)}}]),n}(AR(rc)),Tz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6710886;return(0,b.Z)(this,n),(i=t.call(this,e,r)).object=e,i.name="SpotLightHelper: ".concat(e.uuid),i}return(0,w.Z)(n,[{key:"raycast",value:function(e,t){kR(this.object,n.geometryHelper,e,t)}},{key:"update",value:function(){if(void 0!==this.object){var e=n._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);var r=void 0!==this.color?this.color:this.light.color;if(this.cone.material instanceof Array)for(var a=0,o=this.cone.material.length;a0?Oz(t,e-1):[null,null],s=(0,h.Z)(o,2),l=s[0],u=s[1];"\n"===(e>0&&t.length?t[l].charAt(u):null)&&(r++,a=0),this.current.start=e,this.current.end=void 0;var c=Dz(this.object,r,a),d=(0,h.Z)(c,2),f=d[0],v=d[1],p=this.object,m=p.AD,g=p.descender,y=g+.5*m,x=this.object.geometry.userData.parameters,b=x.width,w=x.height,S=x.depth,_="string"==typeof b?0:b,A="string"==typeof w?0:w;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(f-.5*_,v+y+.5*A,S),this.hideSelectionMesh(),this.showCaretMesh()}}},{key:"setSelection",value:function(e,t){if(void 0!==this.object){var n=this.object.wrappedText;this.current.start=e,this.current.end=t;var i,r=[],a=[],o=function(e,t,n){var i=Oz(e,t),r=(0,h.Z)(i,2),a=r[0],o=r[1],s=Oz(e,n),l=(0,h.Z)(s,2),u=l[0],c=l[1],d=[];o>=e[a].length&&(a++,o=0);for(var f=a;f<=u;f++){var v=e[f],p=f===a?o:0,m=f===u?c:v.length;d.push([f,p,m])}return d}(n,e,t),s=this.object,l=s.lineHeight,u=s.AD,c=s.descender+.5*u-.5*l,d=D(o);try{for(d.s();!(i=d.n()).done;){var f=(0,h.Z)(i.value,3),v=f[0],p=f[1],m=f[2];if(p!==m){var g=Dz(this.object,v,p),y=(0,h.Z)(g,2),x=y[0],b=y[1],w=Dz(this.object,v,m),S=(0,h.Z)(w,2),_=S[0],A=S[1];b+=c,A+=c,A+=l;var M=r.length/3;r.push(x,b,0),r.push(_,b,0),r.push(_,A,0),r.push(x,A,0),a.push(M+0,M+1,M+2),a.push(M+2,M+3,M+0)}}}catch(R){d.e(R)}finally{d.f()}var E=new Fi;E.setIndex(a),E.setAttribute("position",new Pi(r,3));var C=this.object.geometry.userData.parameters,k=C.width,T=C.height,P=C.depth,O="string"==typeof k?0:k,I="string"==typeof T?0:T;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=E,this.selectionMesh.position.x=.5*-O,this.selectionMesh.position.y=.5*I,this.selectionMesh.position.z=P,this.showSelectionMesh(),this.hideCaretMesh()}}},{key:"getSelectionFromPosition",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"previous";if(void 0!==this.object&&void 0!==this.object.font){var i=this.object.wrappedText,r=i.length,a=this.object.lineHeight,o=r*a,s=this.object.geometry.userData.parameters,l=s.height,u=s.verticalAlign,c="string"==typeof l?0:l,h=0;3===u?h=c-o:2===u&&(h=.5*c-.5*o);var d=Math.min(Math.floor(Math.max(Math.min(-t-h,o),0)/a),r-1),f=this.object.charCoords[d],v=this.object.charWidths[d],p=0,m=!1;if("previous"===n){for(var g=0;g0){p=g,m=!0;break}}else if("closest"===n)for(var y=1/0,x=0;x=_&&e=d.length&&(v+=r[t][n-1]),[v,p]}function Oz(e,t){for(var n,i,r=0,a=0;a1&&void 0!==arguments[1]?arguments[1]:e.identity(),i=0,r=t.length;i2&&void 0!==arguments[2]?arguments[2]:n,r=e.getAbcdef(t),a=(0,h.Z)(r,6),o=a[0],s=a[1],l=a[2],u=a[3],c=a[4],d=a[5];return e.setAbcdef(t,o*n,s*i,l*n,u*i,c*n,d*i),t},e.rotate=function(t,n){var i=Math.cos(n),r=Math.sin(n),a=e.getAbcdef(t),o=(0,h.Z)(a,6),s=o[0],l=o[1],u=o[2],c=o[3],d=o[4],f=o[5];return e.setAbcdef(t,s*i-l*r,s*r+l*i,u*i-c*r,u*r+c*i,d*i-f*r,d*r+f*i),t},e.rotateAround=function(t,n,i){var r=(0,h.Z)(i,2),a=r[0],o=r[1],s=e.translate(t,-a,-o);return s=e.rotate(s,n),s=e.translate(s,a,o)},e.translate=function(t,n,i){var r=e.getAbcdef(t),a=(0,h.Z)(r,6),o=a[0],s=a[1],l=a[2],u=a[3],c=a[4],d=a[5];return e.setAbcdef(t,o,s,l,u,c+n,d+i),t},e.setTranslate=function(t,n,i){var r=e.getAbcdef(t),a=(0,h.Z)(r,4),o=a[0],s=a[1],l=a[2],u=a[3];return e.setAbcdef(t,o,s,l,u,n,i),t},e.setPosition=function(t,n,i){var r=e.getAbcdef(t),a=(0,h.Z)(r,4),o=a[0],s=a[1],l=a[2],u=a[3];return e.setAbcdef(t,o,s,l,u,n,i),t},e.getScale=function(t){var n=e.getAbcdef(t),i=(0,h.Z)(n,4),r=i[0],a=i[1],o=i[2],s=i[3];return[Math.sqrt(r*r+a*a),Math.sqrt(o*o+s*s)]},e.getPosition=function(t){var n=e.getAbcdef(t),i=(0,h.Z)(n,6);return[i[4],i[5]]},e.getRotation=function(t,n){return e.decompose(t,n).rotation},e.decompose=function(t,n){var i=e.getAbcdef(t),r=(0,h.Z)(i,6),a=r[0],o=r[1],s=r[2],l=r[3],u=r[4],c=r[5],d=jz([[a,s],[o,l]]),f=d.rotation,v=d.scale,p=d.shear;return{position:[u+(n[0]*a+n[1]*s)-n[0],c+(n[0]*o+n[1]*l)-n[1]],scale:v,rotation:f,shear:p,pivot:n}},e.compose=function(t,n,i,r){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[0,0],o=(0,h.Z)(t,2),s=o[0],l=o[1],u=(0,h.Z)(r,2),c=u[0],d=u[1],f=Gz({rotation:i,scale:n,shear:a}),v=(0,h.Z)(f,4),p=v[0],m=v[1],g=v[2],y=v[3],x=s-(c*p+d*g)+c,b=l-(c*m+d*y)+d;return e.create(p,m,g,y,x,b)}}(Lz||(Lz={}));var Hz=Math.PI/180;Math.PI;var Wz=function(){function e(t,n,i){var r;(0,b.Z)(this,e),this.uuid=t,this.data=n,this.localMatrix=Lz.identity(),this.worldMatrix=Lz.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new nF,this._recursiveBBox=new nF,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=jk(),this.dpr=null!==(r=i.dpr)&&void 0!==r?r:1,this.dataPatched=n}return(0,w.Z)(e,[{key:"project",value:function(e,t){var n=this.worldMatrix;return t&&(n=Lz.append(t.worldMatrix,n)),Lz.applyInverse(e,n)}},{key:"intersects",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace.apply(this,(0,l.Z)(this.project([e,t],n)).concat([i]))}},{key:"intersectsInLocalSpace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=n?this.recursiveBBox:this.singleBBox,r=i.min,a=i.max;return e>=r[0]&&e<=a[0]&&t>=r[1]&&t<=a[1]}},{key:"applyTransforms",value:function(e){e.setTransform(this.worldMatrix,this.ignoreCameraZoom)}},{key:"updateLocalMatrix",value:function(){this.localMatrix=Lz.compose(this.position,this.scale,function(e){return e*Hz}(this.rotation),xS.getPivot(this.dataPatched),this.shear)}},{key:"updateWorldMatrix",value:function(e,t,n){var i=this.parent;t&&null!==i&&void 0!==i&&i.updateWorldMatrix(e,!0,!1),e&&this.updateLocalMatrix(),this.parent?this.worldMatrix=Lz.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=Lz.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}},{key:"getCenter",value:function(){return[0,0]}},{key:"getHalfSize",value:function(){return[0,0]}},{key:"resetBBoxNeedsUpdateSelf",value:function(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}},{key:"resetBBoxNeedsUpdate",value:function(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors((function(e){e.resetBBoxNeedsUpdateSelf()}))}},{key:"updateTransformState",value:function(e){var t=!1;void 0!==e.position&&(t=!0,this.position=e.position),void 0!==e.rotation&&(t=!0,this.rotation=e.rotation),void 0!==e.scale&&(t=!0,this.scale=e.scale),void 0!==e.shear&&(t=!0,this.shear=e.shear),t&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}},{key:"updateByOp",value:function(e,t,n){0===e.type&&void 0!==e.props.visible&&(this.visible=e.props.visible),this.data=t,this.data=t;var i=e,r=Lg(e.path,["states","*"]);if(null!==r){if(0===e.type){var a=(0,h.Z)(r,1)[0];if((null===this||void 0===this?void 0:this.stateSelection)===a){var s=k({},e.props);if(delete s.name,Object.values(e.props).some((function(e){return void 0===e}))){var l=this.data;if(void 0!==l){var u=Tg.zoom(l,e.path.slice(2));if(u)for(var c in e.props)void 0===e.props[c]&&c in u&&(s[c]=u[c])}}i=k(k({},e),{},{props:s,path:e.path.slice(2)})}}}else if(0===e.type){var d=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==d){if(void 0!==e.props.name&&d.name){var f=d;f.name;d=(0,o.Z)(f,["name"])}var v=Tg.removeOverridden(e.path,e.props,d);i=k(k({},e),{},{props:v})}}this.updateByPatchedOpBase(i,lS.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),n)}},{key:"changeSelectedState",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0!==this.data.states.length||i){var r,a=D(this.data.states);try{for(a.s();!(r=a.n()).done;){var o=r.value;lS.toOps(this.data,o.data).forEach((function(e){var i=og.replaceProps(e,n.data);n.dataPatched=n.data,n.updateByPatchedOp(i,n.data,t)}))}}catch(l){a.e(l)}finally{a.f()}if(null!==e){var s=this.data.states.data(e);s&&(this.dataPatched=lS.patch(this.data,s),lS.toOps(this.data,s).forEach((function(e){n.updateByPatchedOp(e,n.dataPatched,t)})))}i&&this.updateTransformState(this.dataPatched),this.stateSelection=e}}},{key:"updateState",value:function(e,t){void 0!==e.name&&(this.name=e.name),void 0!==e.visible&&(this.visible=e.visible),this.updateTransformState(e)}},{key:"updateByPatchedOpBase",value:function(e,t,n){this.dataPatched=t,this.updateByPatchedOp(e,t,n)}},{key:"updateByPatchedOp",value:function(e,t,n){0===e.path.length&&0===e.type&&this.updateState(e.props,n),this.requestRender()}},{key:"traverseFrameAncestors",value:function(e){this.traverseAncestors((function(t){"frame2d"===t.data.type&&e(t)}))}},{key:"traverseAncestors",value:function(e){for(var t=this.parent;t;)e(t),t=t.parent}},{key:"requestRender",value:function(){this.traverseFrameAncestors((function(e){e.requestRender()}))}},{key:"clone",value:function(t){var n=new e(this.uuid,this.data,t);return n.parent=void 0,n}},{key:"addEventListener",value:function(e,t){this.emitter.on(e,t)}},{key:"removeEventListener",value:function(e,t){this.emitter.off(e,t)}},{key:"dispatchEvent",value:function(e){var t;this.emitter.emit(e.type,k(k({},e),{},{target:null!==(t=e.target)&&void 0!==t?t:this}))}},{key:"traverseSortNextHelper",value:function(){var e=this.parent;if(e){var t=e.children;if(t){var n=t.indexOf(this)+1;return t[n]?t[n]:e.traverseSortNextHelper()}}}},{key:"sortNext",value:function(){var e=this.children;return e&&e.length>0&&e[0]?e[0]:this.traverseSortNextHelper()}},{key:"isDescendantOf",value:function(t){t instanceof e&&(t=t.uuid);for(var n=this;n.parent;){if(n.parent.uuid===t)return!0;n=n.parent}return!1}},{key:"singleBBox",get:function(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}},{key:"recursiveBBox",get:function(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}},{key:"pivot",get:function(){return xS.getPivot(this.data)}},{key:"id",get:function(){return this.uuid}}]),e}(),qz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).uuid=e,a.data=i,a.context=r,a.children=[],a}return(0,w.Z)(n,[{key:"add",value:function(e){e.parent&&e.parent instanceof n&&e.parent.remove(e),this.children.push(e),e.parent=this}},{key:"remove",value:function(e){var t=this.children.indexOf(e);t>=0&&(this.children.splice(t,1),e.parent=void 0)}},{key:"traverse",value:function(e){var t=e(this);if(!0!==t){var i,r=D(this.children);try{for(r.s();!(i=r.n()).done;){var a=i.value;a instanceof n?a.traverse(e):t=e(a)}}catch(o){r.e(o)}finally{r.f()}}}},{key:"intersectsChildrenHelper",value:function(e,t,i,r,a){var o,s=D(this.children);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(l.intersects(e,t,i,!1)&&(a.push(l),r)||l instanceof n&&l.intersectsChildrenHelper(e,t,i,r,a))return!0}}catch(u){s.e(u)}finally{s.f()}return!1}},{key:"intersectsChildren",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return this.intersectsChildrenHelper(e,t,n,i,r),r}},{key:"intersectsChildrenHelperReverse",value:function(e,t,i,r,a){var o,s=D(this.children);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(l instanceof n&&l.intersectsChildrenHelperReverse(e,t,i,r,a)||l.intersects(e,t,i,!1)&&(a.push(l),r))return!0}}catch(u){s.e(u)}finally{s.f()}return!1}},{key:"intersectsChildrenReverse",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return this.intersectsChildrenHelperReverse(e,t,n,i,r),r}},{key:"updateWorldMatrix",value:function(e,t,i){if((0,d.Z)((0,m.Z)(n.prototype),"updateWorldMatrix",this).call(this,e,t,i),i&&this.children){var r,a=D(this.children);try{for(a.s();!(r=a.n()).done;){r.value.updateWorldMatrix(e,!1,!0)}}catch(o){a.e(o)}finally{a.f()}}}},{key:"find",value:function(e){var t;return this.traverse((function(n){n.uuid===e&&(t=n)})),t}},{key:"innerDrawChildren",value:function(e){for(var t=this.children.length-1;t>=0;t--)this.children[t].draw(e)}},{key:"resetBBoxNeedsUpdate",value:function(){(0,d.Z)((0,m.Z)(n.prototype),"resetBBoxNeedsUpdate",this).call(this),this.traverse((function(e){e.resetBBoxNeedsUpdateSelf()}))}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);t.parent=void 0;var i,r=D(this.children);try{for(r.s();!(i=r.n()).done;){var a=i.value;t.add(a.clone(e))}}catch(o){r.e(o)}finally{r.f()}return t}}]),n}(Wz),Xz=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).uuid=e,a.data=i,a.updateState(i,r),a}return(0,w.Z)(n,[{key:"draw",value:function(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);t.parent=void 0;var i,r=D(this.children);try{for(r.s();!(i=r.n()).done;){var a=i.value;t.add(a.clone(e))}}catch(o){r.e(o)}finally{r.f()}return t}}]),n}(qz);function Yz(e,t){var n=(0,h.Z)(e,2),i=(0,h.Z)(n[0],2),r=i[0],a=i[1],o=(0,h.Z)(n[1],2),s=o[0],l=o[1],u=(0,h.Z)(t,2),c=(0,h.Z)(u[0],2),d=c[0],f=c[1],v=(0,h.Z)(u[1],2),p=v[0],m=v[1],g=(r-s)*(f-m)-(a-l)*(d-p);if(0===g)return!1;var y=((r-d)*(f-m)-(a-f)*(d-p))/g,x=-((r-s)*(a-f)-(a-l)*(r-d))/g;return y>=0&&y<=1&&x>=0&&x<=1}var Qz,Kz,Jz,$z,eF=[[-1,1],[-1,-1],[1,-1],[1,1]],tF=function(e,t,n){var i=e.getCenter(),r=e.getHalfSize(),a=Lz.append(t,e.worldMatrix);0===r[0]&&0===r[1]?n.push(Lz.apply(i,a)):eF.forEach((function(e){var t=[e[0]*r[0]+i[0],e[1]*r[1]+i[1]];n.push(Lz.apply(t,a))}))},nF=function(){function e(){(0,b.Z)(this,e),this.matrix=Lz.identity(),this.min=[1/0,1/0],this.max=[-1/0,-1/0],this.vertices=[],this.edges=[]}return(0,w.Z)(e,[{key:"setFromObjectSize",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(),this.makeEmpty(),Lz.copy(e.worldMatrix,this.matrix);var n=Lz.invert(e.worldMatrix);this.expandByObjectSize(e,n,t)}},{key:"expandByObjectSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[];!0===n&&e instanceof qz?e.traverse((function(e){e.visible&&tF(e,t,i)})):tF(e,t,i),this.setFromPoints(i)}},{key:"setFromSize",value:function(e,t,n){this.makeEmpty(),Lz.copy(n,this.matrix),this.expandBySize(e,t,n)}},{key:"expandBySize",value:function(e,t,n){var i=this;[Lz.apply([0,0],n),Lz.apply([0,t],n),Lz.apply([e,t],n),Lz.apply([e,0],n)].forEach((function(e){return i.expandByPoint(e)}))}},{key:"getCenter",value:function(){var e=(0,h.Z)(this.min,2),t=e[0],n=e[1],i=this.getHalfSize(),r=(0,h.Z)(i,2),a=r[0],o=r[1];return Lz.apply([t+a,n+o],this.matrix)}},{key:"getSize",value:function(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}},{key:"getHalfSize",value:function(){return[.5*(this.max[0]-this.min[0]),.5*(this.max[1]-this.min[1])]}},{key:"makeEmpty",value:function(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}},{key:"setFromPoints",value:function(e){this.makeEmpty();var t,n=D(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.expandByPoint(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"expandByPoint",value:function(e){this.min=[Math.min(this.min[0],e[0]),Math.min(this.min[1],e[1])],this.max=[Math.max(this.max[0],e[0]),Math.max(this.max[1],e[1])]}},{key:"computeVertices",value:function(){var e=this.getHalfSize(),t=(0,h.Z)(e,2),n=t[0],i=t[1],r=this.getCenter(),a=Lz.getAbcdef(this.matrix),o=(0,h.Z)(a,4),s=o[0],l=o[1],u=o[2],c=o[3],d=Lz.create(s,l,u,c,r[0],r[1]);this.vertices=eF.map((function(e){var t=(0,h.Z)(e,2),r=t[0],a=t[1];return Lz.apply([r*n,a*i],d)}))}},{key:"computeEdges",value:function(){this.edges=[];for(var e=0,t=this.vertices.length;e=n[0]&&e<=i[0]&&t>=n[1]&&t<=i[1]}},{key:"containsPoint",value:function(e){var t=(0,h.Z)(e,2),n=t[0],i=t[1],r=(0,h.Z)(this.min,2),a=r[0],o=r[1],s=(0,h.Z)(this.max,2),l=s[0],u=s[1];return n>=a&&n<=l&&i>=o&&i<=u}},{key:"intersectsBBox2D",value:function(e){for(var t=0,n=this.edges.length;t1&&void 0!==arguments[1]?arguments[1]:1;(0,b.Z)(this,e),this.canvas=t,this._dpr=n,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=Ux.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=Ux.transparent,this._fonts=new Map,this._isSizeDirty=!1;try{var i=t.getBoundingClientRect();t.width=i.width*n,t.height=i.height*n}catch(r){console.log(t.width,n)}this._currentM3Transform=uF,this._currentTransform=new Float32Array(uF)}return(0,w.Z)(e,[{key:"init",value:function(){var e=(0,c.Z)(x().mark((function e(){var t,n;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.wasmURL){e.next=2;break}throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");case 2:return e.next=4,sF(this.wasmURL);case 4:this._surface=Jz.MakeWebGLCanvasSurface(this.canvas),this.ctx=null===(t=this._surface)||void 0===t?void 0:t.getCanvas(),this._paint=new Jz.Paint,this._paint.setAntiAlias(!0),this._paintFill=this._paint.copy(),this._paintFill.setStyle(Jz.PaintStyle.Fill),this._paintStroke=this._paint.copy(),this._paintStroke.setStyle(Jz.PaintStyle.Stroke),null===(n=this.ctx)||void 0===n||n.scale(this.dpr,this.dpr);case 13:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"loadFont",value:function(){var e=(0,c.Z)(x().mark((function e(t,n){var i;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return e.next=4,e.sent.arrayBuffer();case 4:i=e.sent,this.registerFont(i,n);case 6:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"registerFont",value:function(e,t){if(!this._fonts.has(t)){var n=Jz.FontMgr.FromData(e);if(!n)throw new Error("Invalid font data for "+t);this._fonts.set(t,n)}}},{key:"clear",value:function(){var e;null===(e=this.ctx)||void 0===e||e.clear(Jz.TRANSPARENT)}},{key:"save",value:function(){var e;null===(e=this.ctx)||void 0===e||e.save()}},{key:"restore",value:function(){var e;null===(e=this.ctx)||void 0===e||e.restore()}},{key:"beginPath",value:function(){var e;null!==(e=this._currentPath)&&void 0!==e&&e.delete(),this._currentPath=new Jz.Path}},{key:"closePath",value:function(){var e=this._currentPath;if(e){if(e.isEmpty())return;var t=e.getBounds();(t[3]-t[1]||t[2]-t[0])&&e.close()}}},{key:"fill",value:function(){this._paintInner(this._paintFill,!0)}},{key:"stroke",value:function(){this._paintInner(this._paintStroke,!1)}},{key:"clipRect",value:function(e,t,n,i){var r,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,u=Jz.XYWHRect(e,t,n,i);if(0===a&&0===o&&0===l&&0===s)null===(r=this.ctx)||void 0===r||r.clipRect(u,Jz.ClipOp.Intersect,!0);else{var c,h=Jz.RRectXY(u,a,a);h[4]=h[5]=a,h[6]=h[7]=o,h[8]=h[9]=s,h[10]=h[11]=l,null===(c=this.ctx)||void 0===c||c.clipRRect(h,Jz.ClipOp.Intersect,!0)}}},{key:"_applyShadowOffsetMatrix",value:function(){if(this.ctx){var e=Lz.invert(this.currentTransform);this.ctx.concat(e);var t=Lz.translate(Lz.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(t),this.ctx.concat(this._currentTransform)}}},{key:"_applyEffectsToPaint",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.ctx&&this._currentPath){var i,r=!1;if(n&&this._hasDropShadow()){var a,o,s,l,u=e.copy();u.setColor(dF(this._dropShadowColor)),this._dropShadowBlur>0&&(l=Jz.MaskFilter.MakeBlur(Jz.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(null!==(a=null===(o=this.camera)||void 0===o?void 0:o.scale)&&void 0!==a?a:1),!1),u.setMaskFilter(l)),this.ctx.save(),this.ctx.clipPath(this._currentPath,Jz.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),t(u),this.ctx.restore(),u.delete(),null===(s=l)||void 0===s||s.delete()}if(this._backgroundBlur>0&&n){this.ctx.save(),this.ctx.clipPath(this._currentPath,Jz.ClipOp.Intersect,!0);var c=Jz.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,Jz.TileMode.Clamp,null),d=e.copy();d.setImageFilter(c),d.setAlphaf(1);var f=this._currentPath.computeTightBounds();this.ctx.saveLayer(d,f,null,Jz.SaveLayerInitWithPrevious),this.ctx.drawColor(e.getColor()),this.ctx.restore(),this.ctx.restore(),d.delete(),c.delete(),r=!0}if(this._layerBlur>0){var v,p,m=e.copy();i=Jz.MaskFilter.MakeBlur(Jz.BlurStyle.Normal,this._layerBlur*this.dpr*(null!==(v=null===(p=this.camera)||void 0===p?void 0:p.scale)&&void 0!==v?v:1),!1),m.setMaskFilter(i),t(m),m.delete(),i.delete(),r=!0}if(r||t(e),n&&this._hasInnerShadow()){var g,y,x,b,w,S=new Jz.Paint;S.setAntiAlias(!0),S.setStyle(Jz.PaintStyle.Fill),S.setColor(dF(this._innerShadowColor)),this._innerShadowBlur>0&&(w=Jz.MaskFilter.MakeBlur(Jz.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(null!==(g=null===(y=this.camera)||void 0===y?void 0:y.scale)&&void 0!==g?g:1),!1),S.setMaskFilter(w));var _=this._currentPath.computeTightBounds(),A=(0,h.Z)(_,4),M=A[0],E=A[1],C=A[2],k=A[3],T=C-M,P=k-E;this.ctx.save(),this.ctx.clipPath(this._currentPath,Jz.ClipOp.Intersect,!0),this.ctx.saveLayer(S,_,null,Jz.SaveLayerInitWithPrevious),null!==(x=this.ctx)&&void 0!==x&&x.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(Jz.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+T+Math.abs(2*this._innerShadowOffsetX),2e3+P+Math.abs(2*this._innerShadowOffsetY)),S),S.setBlendMode(Jz.BlendMode.Clear),this.ctx.drawPath(this._currentPath,S),this.ctx.restore(),this.ctx.restore(),S.delete(),null===(b=w)||void 0===b||b.delete()}}}},{key:"_paintInner",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.ctx&&this._currentPath&&e){var i=this.ctx,r=this._currentPath;this._applyEffectsToPaint(e,(function(e){var a=!1;!n&&"center"!==t._strokeMode&&(i.save(),i.clipPath(r,"outside"===t._strokeMode?Jz.ClipOp.Difference:Jz.ClipOp.Intersect,!0),a=!0),i.drawPath(r,e),a&&i.restore()}),n)}}},{key:"_hasDropShadow",value:function(){var e;return(null===(e=this._dropShadowColor)||void 0===e?void 0:e.a)>0}},{key:"_hasInnerShadow",value:function(){var e;return(null===(e=this._innerShadowColor)||void 0===e?void 0:e.a)>0}},{key:"path",value:function(e){var t;null===(t=this._currentPath)||void 0===t||t.addPath(Jz.Path.MakeFromSVGString(e))}},{key:"ellipse",value:function(e,t,n,i,r,a,o,s){var l;if(hF([e,t,n,i])&&this._currentPath){if(n<0||i<0)throw Error("radii cannot be negative");var u=Jz.XYWHRect(e-n,t-i,2*n,2*i);null===(l=this._currentPath)||void 0===l||l.addOval(u)}}},{key:"rect",value:function(e,t,n,i){var r,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,u=Jz.XYWHRect(e,t,n,i);if(hF(u))if(0===a&&0===o&&0===l&&0===s)null===(r=this._currentPath)||void 0===r||r.addRect(u);else{var c,h=Jz.RRectXY(u,a,a);h[4]=h[5]=a,h[6]=h[7]=o,h[8]=h[9]=s,h[10]=h[11]=l,null===(c=this._currentPath)||void 0===c||c.addRRect(h)}}},{key:"getHorizontalAlign",value:function(e){switch(e){case 2:return Jz.TextAlign.Right;case 3:return Jz.TextAlign.Center;case 4:return Jz.TextAlign.Justify;case 1:default:return Jz.TextAlign.Left}}},{key:"drawTextInner",value:function(e,t,n,i,r,a){var o=(0,h.Z)(i,4),s=o[0],l=o[1],u=o[2],c=o[3],d=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],f=0,v=this.ctx;if(!v)return f;var p=a.copy(),m=a.copy();return m.setAlphaf(0),this._applyEffectsToPaint(p,(function(i){t.pushPaintStyle(n,i,m),t.addText(e);var a=t.build();a.layout(u);var o=l;2===r?o+=(c-a.getHeight())/2:3===r&&(o+=c-a.getHeight()),v.drawParagraph(a,s,o),f=a.getHeight(),t.reset(),a.delete()}),d),p.delete(),m.delete(),f}},{key:"drawText",value:function(e,t){var n=0,i=this._fonts.get(t.font),r=this.ctx,a=this._paintFill,o=this._paintStroke;if(i&&r){var s=new Jz.TextStyle({fontFamilies:[t.font],fontSize:t.fontSize,heightMultiplier:t.lineHeight,letterSpacing:t.letterSpacing}),l=new Jz.ParagraphStyle({textStyle:s,textAlign:this.getHorizontalAlign(t.horizontalAlign)}),u=Jz.XYWHRect(t.x,t.y,t.width,t.height),c=Jz.ParagraphBuilder.Make(l,i);a&&(n=this.drawTextInner(e,c,s,u,t.verticalAlign,a,!0)),o&&(n=this.drawTextInner(e,c,s,u,t.verticalAlign,o,!1)),c.delete()}return{height:n}}},{key:"render",value:function(){var e;null===(e=this._surface)||void 0===e||e.flush()}},{key:"moveTo",value:function(e,t){var n;null===(n=this._currentPath)||void 0===n||n.moveTo(e,t)}},{key:"lineTo",value:function(e,t){var n;null===(n=this._currentPath)||void 0===n||n.lineTo(e,t)}},{key:"bezierCurveTo",value:function(e,t,n,i,r,a){var o;null===(o=this._currentPath)||void 0===o||o.cubicTo(e,t,n,i,r,a)}},{key:"quadraticCurveTo",value:function(e,t,n,i){var r;null===(r=this._currentPath)||void 0===r||r.quadTo(e,t,n,i)}},{key:"setTransform",value:function(e){var t,n,i,r,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ctx){var o=this.ctx.getTotalMatrix(),s=Lz.invert(o);if(s&&this.ctx.concat(s),null!==(t=this.ctx)&&void 0!==t&&t.scale(this.dpr,this.dpr),null!==(n=this.camera)&&void 0!==n&&n.enabled&&(null!==(i=this.ctx)&&void 0!==i&&i.concat(this.camera.worldMatrix),a)){var l,u=Lz.getScale(this.camera.worldMatrix);null===(l=this.ctx)||void 0===l||l.scale(1/u[0],1/u[1])}null!==(r=this.ctx)&&void 0!==r&&r.concat(e),this.currentTransform=e}}},{key:"transform",value:function(e){var t;null===(t=this.ctx)||void 0===t||t.concat(e)}},{key:"setSize",value:function(e,t){var n;!this._isSizeDirty&&e===this._width&&t===this._height||(this._isSizeDirty=!1,this._width=e,this._height=t,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.dpr,this.canvas.height=t*this.dpr,this._surface&&(this._surface=Jz.MakeWebGLCanvasSurface(this.canvas),this.ctx=null===(n=this._surface)||void 0===n?void 0:n.getCanvas()))}},{key:"dpr",get:function(){return this._dpr},set:function(e){this._dpr=e,this._isSizeDirty=!0}},{key:"currentTransform",get:function(){return this._currentM3Transform},set:function(e){this._currentM3Transform=e,this._currentTransform.set(e)}},{key:"currentTransformBuffer",get:function(){return this._currentTransform}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"strokeColor",set:function(e){this._paintStroke&&this._paintStroke.setColor(dF(e),Jz.ColorSpace.DISPLAY_P3)}},{key:"fillColor",set:function(e){this._paintFill&&this._paintFill.setColor(dF(e),Jz.ColorSpace.DISPLAY_P3)}},{key:"lineWidth",set:function(e){this._paintStroke&&this._paintStroke.setStrokeWidth("center"===this._strokeMode?e:2*e)}},{key:"strokeMode",set:function(e){this._strokeMode=e}},{key:"dropShadowBlur",set:function(e){this._dropShadowBlur=e}},{key:"dropShadowColor",set:function(e){this._dropShadowColor=e}},{key:"dropShadowOffsetX",set:function(e){this._dropShadowOffsetX=e}},{key:"dropShadowOffsetY",set:function(e){this._dropShadowOffsetY=e}},{key:"innerShadowBlur",set:function(e){this._innerShadowBlur=e}},{key:"innerShadowColor",set:function(e){this._innerShadowColor=e}},{key:"innerShadowOffsetX",set:function(e){this._innerShadowOffsetX=e}},{key:"innerShadowOffsetY",set:function(e){this._innerShadowOffsetY=e}},{key:"innerShadowSpread",set:function(e){this._innerShadowSpread=e}},{key:"layerBlur",set:function(e){this._layerBlur=e}},{key:"backgroundBlur",set:function(e){this._backgroundBlur=e}}]),e}();function hF(e){for(var t=0;t0?this.stroke.color:Ux.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}},{key:"applyFilters",value:function(e){this.layerBlur.enabled?e.layerBlur=5*this.layerBlur.radius:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=5*this.backgroundBlur.radius:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=5*this.dropShadow.blurRadius,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=Ux.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=5*this.innerShadow.blurRadius,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=Ux.transparent}},{key:"innerDraw",value:function(e){}},{key:"draw",value:function(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore())}},{key:"updateByPatchedOp",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOp",this).call(this,e,t,i),0===e.type&&(Lg(e.path,["fill"])?this.fill.update(e.props):Lg(e.path,["stroke"])?this.stroke.update(e.props):Lg(e.path,["dropShadow"])?this.dropShadow.update(e.props):Lg(e.path,["innerShadow"])?this.innerShadow.update(e.props):Lg(e.path,["layerBlur"])?this.layerBlur.update(e.props):Lg(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}},{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),void 0!==e.fill&&this.fill.update(e.fill),void 0!==e.stroke&&this.stroke.update(e.stroke),void 0!==e.dropShadow&&this.dropShadow.update(e.dropShadow),void 0!==e.innerShadow&&this.innerShadow.update(e.innerShadow),void 0!==e.layerBlur&&this.layerBlur.update(e.layerBlur),void 0!==e.backgroundBlur&&this.backgroundBlur.update(e.backgroundBlur)}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);return t.parent=void 0,t}}]),n}(Wz),wF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).uuid=e,a.data=i,a.width=0,a.height=0,a.updateState(i,r),a}return(0,w.Z)(n,[{key:"innerDraw",value:function(e){e.ellipse(.5*this.width,.5*this.height,.5*this.width,.5*this.height,0,0,2*Math.PI)}},{key:"intersectsInLocalSpace",value:function(e,t){return function(e,t,n,i,r,a){var o=e-n,s=t-i;return o*o/(r*r)+s*s/(a*a)<=1}(e,t,.5*this.width,.5*this.height,.5*this.width,.5*this.height)}},{key:"getCenter",value:function(){return[.5*this.width,.5*this.height]}},{key:"getHalfSize",value:function(){return[.5*this.width,.5*this.height]}},{key:"updateSizeState",value:function(e){var t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}},{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),this.updateSizeState(e)}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);return t.parent=void 0,t}}]),n}(bF),SF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).uuid=e,a.data=i,a.width=0,a.height=0,a.cornerRadius=[0,0,0,0],a.updateState(i,r),a}return(0,w.Z)(n,[{key:"innerDraw",value:function(e){e.rect.apply(e,[0,0,this.width,this.height].concat((0,l.Z)(this.cornerRadius)))}},{key:"getCenter",value:function(){return[.5*this.width,.5*this.height]}},{key:"getHalfSize",value:function(){return[.5*this.width,.5*this.height]}},{key:"updateCornerState",value:function(e){void 0!==e.cornerRadius&&(this.cornerRadius=e.cornerRadius)}},{key:"updateSizeState",value:function(e){var t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}},{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),this.updateSizeState(e),this.updateCornerState(e)}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);return t.parent=void 0,t}}]),n}(bF),_F=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).uuid=e,a.data=i,a._textHeight=0,a._textHeightDirty=!0,a.width=0,a.height=0,a.updateState(i,r),a}return(0,w.Z)(n,[{key:"applyFillStroke",value:function(e){e.fillColor=this.fill.enabled?this.fill.color:Ux.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Ux.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}},{key:"innerDraw",value:function(e){var t,n,i;(null===(t=this._fontHolder)||void 0===t?void 0:t.arrayBuffer)&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);var r=this.data.textTransform,a=this.data.text.textValue.toString(),o=2===r?a.toUpperCase():3===r?a.toLowerCase():a,s=e.drawText(o,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:null!==(n=this.data.lineHeight)&&void 0!==n?n:1,letterSpacing:null!==(i=this.data.letterSpacing)&&void 0!==i?i:0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font}).height;this._textHeight=s}},{key:"getCenter",value:function(){return[.5*this.width,.5*this.height]}},{key:"getHalfSize",value:function(){return[.5*this.width,.5*this.height]}},{key:"updateSizeState",value:function(e){var t=!1;void 0!==e.width&&(this.width="number"==typeof e.width?e.width:this.width,t=!0),void 0!==e.height&&(this.height="number"==typeof e.height?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}},{key:"updateFontState",value:function(e,t){var n=this,i=t.shared;void 0!==e.font&&(this._fontHolder=i.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then((function(){n.requestRender()})))}},{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),this.updateSizeState(e),this.updateFontState(e,t)}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);return t.parent=void 0,t}},{key:"textHeight",get:function(){return this._textHeight}}]),n}(bF),AF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).uuid=e,a.data=i,a.curves=[],a.extremasBBox={min:[0,0],max:[0,0]},a.updateState(i,r),a}return(0,w.Z)(n,[{key:"computeExtremas",value:function(){0===this.curves.length&&this.computeCurves();for(var e=this.curves.map((function(e){return fF.extremas(e)})),t=[1/0,1/0],n=[-1/0,-1/0],i=0,r=e.length;in[0]&&(n[0]=a[1][0]),a[1][1]>n[1]&&(n[1]=a[1][1])}return this.extremasBBox.min=[t[0],t[1]],this.extremasBBox.max=[n[0],n[1]],this.extremasBBox}},{key:"computeCurves",value:function(){this.curves=[];for(var e=1,t=this.data.points.length;e=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&t>=this._pathBBox.y&&t<=this._pathBBox.y+this._pathBBox.height}},{key:"getCenter",value:function(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}},{key:"getHalfSize",value:function(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}},{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),void 0!==e.path&&(this.path=e.path,this.computeSVGBBox())}},{key:"clone",value:function(e){var t=new n(this.uuid,this.data,e);return t.parent=void 0,t}}]),n}(bF);function kF(e){return/NaN/.test(e)}function TF(e){var t,n=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"];return e.map((function(e){var i=[];n.forEach((function(t){if(t in e){var n=1*e[t];i.length&&n>=0&&i.push(","),i.push(n)}}));var r=(t===e.code?i[0]<0?"":",":e.code)+i.join("");return t=e.code,r})).join("")}var PF=function(){function e(t,n,i){(0,b.Z)(this,e),this.uuid=t,this.data=n,this.group=new Xz(e.GROUP_ID,k({},gS.defaultData),i),this.createChildrenObjects(n.objects,this.group,i)}return(0,w.Z)(e,[{key:"createObject",value:function(e,t,n,i,r,a){var o=function(e,t,n){switch(t.type){case"ellipse2d":return new wF(e,t,n);case"rectangle2d":return new SF(e,t,n);case"text2d":return new _F(e,t,n);case"vector2d":return new AF(e,t,n);case"path2d":return new CF(e,t,n);case"frame2d":return new MF(e,t,n);case"group2d":default:return new Xz(e,t,n)}}(e,t,a);o&&(i.add(o),i.children.splice(r,0,i.children.pop()),o.updateWorldMatrix(),n.length>0&&(o instanceof Xz||o instanceof MF)&&this.createChildrenObjects(n,o,a))}},{key:"createChildrenObjects",value:function(e,t,n){var i,r=0,a=D(e);try{for(a.s();!(i=a.n()).done;){var o=i.value;this.createObject(o.id,o.data,o.children,t,r,n),r+=1}}catch(s){a.e(s)}finally{a.f()}}},{key:"draw",value:function(e){this.group.draw(e)}},{key:"updateEntityByOp",value:function(e,t,n,i){var r=this.find(e);if(r)try{r.updateByOp(t,n,{shared:i})}catch(Ax){console.error(Ax)}}},{key:"updateTreeByOp",value:function(e,t){if(0===e.path.length&&7===e.type){var n=null===e.parent?this.group:this.find(e.parent);void 0!==n&&n instanceof qz&&(this.createObject(e.id,e.data,e.children,n,e.localIndex,t),n.requestRender())}else if(0===e.path.length&&8===e.type){var i=this.find(e.id);if(void 0!==i&&void 0!==i.parent&&i.parent instanceof qz){var r=i.parent;i.resetBBoxNeedsUpdate(),null!==r&&void 0!==r&&r.remove(i),null===r||void 0===r||r.requestRender()}}else if(0===e.path.length&&9===e.type){var a=this.find(e.id);if(void 0!==a){var o=a.parent,s=null===e.parent?this:this.find(e.parent);if(s instanceof qz||s===this){s.add(a);var l=e.localIndex;s.children.splice(l,0,s.children.pop()),a.updateWorldMatrix(!0,!1,!0),null!==o&&void 0!==o&&o.requestRender(),a.requestRender()}a.resetBBoxNeedsUpdate()}}}},{key:"add",value:function(e){this.group.add(e)}},{key:"remove",value:function(e){this.group.remove(e)}},{key:"traverse",value:function(e){var t=this;this.group.traverse((function(n){n!==t.group&&e(n)}))}},{key:"intersectsChildren",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return this.group.intersectsChildren(e,t,n,i,r,!0)}},{key:"intersectsChildrenReverse",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];return this.group.intersectsChildrenReverse(e,t,n,i,r,!0)}},{key:"find",value:function(e){return this.group.find(e)}},{key:"project",value:function(e,t){return this.group.project(e,t)}},{key:"getWithSortKey",value:function(e){var t=this.find(e);if(void 0!==t){for(var n=[],i=t;i!==this.group;){var r=i,a=(i=i.parent).children.indexOf(r);n.splice(0,0,a)}return{entity:t,sortKey:n}}}},{key:"getAllSorted",value:function(e){var t,n=[],i=D(e);try{for(i.s();!(t=i.n()).done;){var r=t.value,a=this.getWithSortKey(r.id);void 0!==a&&n.push(a)}}catch(o){i.e(o)}finally{i.f()}return n.sort((function(e,t){return aw(e.sortKey,t.sortKey)})),n.map((function(e){return e.entity}))}},{key:"children",get:function(){return this.group.children}}]),e}();function DF(e){var t=e.constraints,n=e.newParentWidth,i=e.newParentHeight,r=e.initialParentWidth,a=e.initialParentHeight,o=e.objectInitialWidth,s=e.objectInitialHeight,l=e.objectInitialPosition,u=t.horizontalConstraint,c=t.verticalConstraint,h=n-r,d=i-a,f=o,v=s,p=l[0],m=l[1];if(0!==u)if(1===u)p+=h;else if(3===u)p+=h/2;else if(2===u)f=Math.max(1,f+h);else if(4===u){var g=n/r;f*=g,p*=g}if(0!==c)if(1===c)m+=d;else if(3===c)m+=d/2;else if(2===c)v=Math.max(1,v+d);else if(4===c){var y=i/a;v*=y,m*=y}return{width:f,height:v,position:[p,m]}}PF.GROUP_ID="scene2d";U(q(),1);var OF=new Or(-1,1,1,-1,0,1),IF=new(function(e){(0,v.Z)(n,e);var t=T(n);function n(){var e;return(0,b.Z)(this,n),(e=t.call(this)).setAttribute("position",new Pi([-1,3,0,-1,-1,0,3,-1,0],3)),e.setAttribute("uv",new Pi([0,2,0,0,2,0],2)),e}return n}(Fi)),RF=function(){function e(t){(0,b.Z)(this,e),this._mesh=new Ji(IF,t)}return(0,w.Z)(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,OF)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}(),LF=new ar({defines:{},uniforms:{tDiffuse:new Wu(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}"}),BF=new RF(LF),zF=null,FF=null,NF=Lz.identity(),UF=function(){function e(t,n,i,r){var a=this;(0,b.Z)(this,e),this.uuid=t,this.width=n,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=function(){a.isFrameDirty=!0,a.context.shared.requestRender()},this._innerApplySize=function(){var e=a.width,t=a.height,n=a.dpr;a.renderer.dpr=a.isScreenSpace?n:Math.floor(2048/Math.max(e,t)),a.renderer.setSize(e,t)},this.onFrameOverrideObjectEvent=function(e){var t;if(void 0!==(null===(t=e.target)||void 0===t?void 0:t.uuid)){var n,i=null===(n=a.frameRoot)||void 0===n?void 0:n.find(e.target.uuid);i&&i.dispatchEvent(k(k({},e),{},{target:i}))}},this.scene2d=new PF(Pt.generateUUID(),bS.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=(null===zF&&(zF=document.createElement("canvas")),zF),this.renderer=function(e){return null===FF&&(FF=new cF(e)),FF}(this.canvas),this.promise=this.init(),this.renderTarget=new rn(1,1,{type:pe,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}return(0,w.Z)(e,[{key:"init",value:function(){var e=(0,c.Z)(x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.renderer instanceof cF&&(this.renderer.wasmURL=yD.skiaWasmUrl),e.next=3,this.renderer.init();case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(e){if(this.isFrameDirty){var t,n;this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),null!==(t=this.frameOverride)&&void 0!==t&&t.draw(this.renderer),this.renderer.render(),LF.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;var i=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),BF.render(e),e.setRenderTarget(i),null===(n=this.textureHolder)||void 0===n||n.setNeedsUpdate(!0)}}},{key:"updateEntity2DByOp",value:function(e,t,n,i){this.scene2d.updateEntityByOp(e,t,n,i),this.applySize()}},{key:"updateTreeByOp",value:function(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}},{key:"applyOverrides",value:function(e){if(this.frameOverride&&this.frameRoot){var t,n;this.frameOverride.position=[0,0],this.frameOverride.rotation=0;var i=null!==(t=null===e||void 0===e?void 0:e.width)&&void 0!==t?t:this.width,r=null!==(n=null===e||void 0===e?void 0:e.height)&&void 0!==n?n:this.height;this.frameOverride.width=i,this.frameOverride.height=r,this.frameOverride.localMatrix=NF,this.isScreenSpace&&(this.frameOverride.fill.color=Ux.from0to1([0,0,0,0])),this.frameOverride.data=k(k({},this.frameOverride.data),{},{width:i,height:r}),ZF({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)}}},{key:"applySize",value:function(e){var t,n,i,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window.devicePixelRatio,o=Math.max(1,null!==(t=null===e||void 0===e?void 0:e.width)&&void 0!==t?t:this.width),s=Math.max(1,null!==(n=null===e||void 0===e?void 0:e.height)&&void 0!==n?n:this.height);this.dpr=a,this.width=o,this.height=s,this._innerApplySize();var l=1,u=512,c=512;(o*a1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t<=0||n<=0)return e;if(kF(e))return console.warn("Cannot scale invalid path",e),TF([]);try{return TF((0,EF.parseSVG)(e).map((function(e){var i=k({},e);return"x"in i&&(i.x=i.x*t),"y"in i&&(i.y=i.y*n),"x1"in i&&(i.x1=i.x1*t),"x2"in i&&(i.x2=i.x2*t),"y1"in i&&(i.y1=i.y1*n),"y2"in i&&(i.y2=i.y2*n),"rx"in i&&(i.rx=i.rx*t),"ry"in i&&(i.ry=i.ry*n),i})))}catch(r){return console.warn("Error parsing SVG path",r),TF([])}}(g.path,y,x),t.data=k(k({},t.data),{},{path:t.path})}}function jF(e){var t,n,i=e.stateId,r=e.objectOverride,a=e.objectRoot,o=e.newParentWidth,s=e.newParentHeight,l=e.initialParentWidth,u=e.initialParentHeight,c=null===(t=r.states)||void 0===t?void 0:t[i],h=null===(n=a.states)||void 0===n?void 0:n[i];if(c&&h){var d=DF({constraints:r.data,newParentWidth:o,newParentHeight:s,initialParentWidth:l,initialParentHeight:u,objectInitialWidth:xS.isResizeable(h)?h.width:0,objectInitialHeight:xS.isResizeable(h)?h.height:0,objectInitialPosition:h.position}),f=d.width,v=d.height,p=d.position;Object.assign(r.states[i],{position:p}),xS.isResizeable(c)&&Object.assign(r.states[i],{width:f,height:v})}}function GF(e){return e instanceof SF||e instanceof MF||e instanceof wF||e instanceof _F}var HF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this)).data=i,a.bgColor=new I_(1,1,1,1),a.fog=null,a.backupFog=new $o(16777215,.1,2e3),a.fogUseBGColor=!1,a.isActive=!1,a.aoColor=new Yt,a.penumbraSizeArrayCache=null,a.super_Entity(e,i),a.personalCamera=new ZR(jx,k(k(k({},dw.defaultData),i.camera),{},{name:"Personal Camera"})),a.personalCamera.objectHelper.visible=!1,a.add(a.personalCamera),a.activeCamera=a.personalCamera,a.ambientLight=new du(13882323,8553090,.75),a.ambientLight.name="Default Ambient Light",a.ambientLight.layers.enable(3),a.ambientLight.removeFromParent(),a.add(a.ambientLight),i.uiScene?a.uiScene=new PF((Array.isArray(e)?e[0]:e)+"-ui",i.uiScene,{dpr:window.devicePixelRatio,shared:r.shared}):i.uiFrame&&a.createUICanvas(i.uiFrame,r),a}return(0,w.Z)(n,[{key:"createUICanvas",value:function(e,t){var n=this;this.uiCanvas=new UF(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then((function(){var t,i;null!==(t=n.uiCanvas)&&void 0!==t&&t.applyFrame(e),null===(i=n.uiCanvas)||void 0===i||i.applySize()}))}},{key:"updateVisible",value:function(){}},{key:"setBackgroundColor",value:function(e){this.bgColor=e,!0===this.fogUseBGColor&&(this.backupFog.color=e)}},{key:"entityChildrenCount",value:function(){return this.uiScene?this.uiScene.children.length:(0,d.Z)((0,m.Z)(n.prototype),"entityChildrenCount",this).call(this)}},{key:"updateAmbientLight",value:function(e,t){void 0!==e.color&&(this.ambientLight.color=iO(e.color,t)),void 0!==e.intensity&&(this.ambientLight.intensity=e.intensity),void 0!==e.enabled&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}},{key:"onDeactive",value:function(){this.isActive=!1}},{key:"onActive",value:function(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity((function(e){e instanceof WR&&e.recomputeBoolean()})),this.updateShadow(this.data.shadow)}},{key:"forceMaterialsUpdate",value:function(){this.traverseEntity((function(e){if(e instanceof CI)if(Array.isArray(e.material)){var t,n=D(e.material);try{for(n.s();!(t=n.n()).done;){t.value.needsUpdate=!0}}catch(i){n.e(i)}finally{n.f()}}else e.material.needsUpdate=!0,e.material.dispose()}))}},{key:"updateShadow",value:function(e){void 0!==e.softShadowQuality&&this.isActive&&function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"medium";if(wz===e)return!1;wz=e;var t=Sz(e);Sr.shadowmap_pars_fragment=yz(t);var n=xz.slice();n=(n=n.replace("getShadow( spotShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX + ".concat(3,", spotShadowMap[ i ]"))).replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),Sr.lights_fragment_begin=n;var i=bz.slice();return i=i.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),Sr.shadowmask_pars_fragment=i,!0}(e.softShadowQuality)&&this.forceMaterialsUpdate()}},{key:"updateFog",value:function(e,t){(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive)&&(this.scene.fog=this.fog);this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=iO(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}},{key:"updateAo",value:function(e,t){void 0!==e.aoColor&&(this.aoColor=iO(e.aoColor,t))}},{key:"updateByOp",value:function(e,t,i,r){var a=this.data.uiFrame;(0,d.Z)((0,m.Z)(n.prototype),"updateByOp",this).call(this,e,t,i,r);var o=t;Lg(e.path,["fog"])?this.updateFog(o.fog,i.shared):Lg(e.path,["ao"])?this.updateAo(o.ao,i.shared):Lg(e.path,["ambient"])?this.updateAmbientLight(o.ambient,i.shared):Lg(e.path,["shadow"])?this.updateShadow(o.shadow):0===e.type&&0===e.path.length&&(void 0!==e.props.uiFrame||a!==o.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}},{key:"updateUIFrame",value:function(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}},{key:"updateState",value:function(e,t){this.updateState_Entity(e,t),void 0!==e.backgroundColor&&this.setBackgroundColor(iO(e.backgroundColor,t.shared)),void 0!==e.fog&&this.updateFog(e.fog,t.shared),void 0!==e.ambient&&this.updateAmbientLight(e.ambient,t.shared),void 0!==e.ao&&this.updateAo(e.ao,t.shared),void 0!==e.shadow&&this.updateShadow(e.shadow)}},{key:"createFrame",value:function(e,t){}},{key:"raycast",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"raycast",this).call(this,e,t)}},{key:"switchActiveCamera",value:function(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}},{key:"switchToPlayCamera",value:function(){this.switchActiveCamera(this.playCamera)}},{key:"updatePenumbraSizeArray",value:function(){var e=this;this.penumbraSizeArrayCache=new Array(5).fill(.5);var t=0,n=0;this.traverseEntity((function(i){var r,a;if(!i.visible)return!0;i instanceof Bz&&i.visible&&t<3&&(e.penumbraSizeArrayCache[t]=null!==(r=i.data.penumbraSize)&&void 0!==r?r:.5,t+=1),i instanceof Uz&&i.visible&&t<2&&(e.penumbraSizeArrayCache[3+n]=null!==(a=i.data.penumbraSize)&&void 0!==a?a:.5,n+=1)}))}},{key:"raycastWithClones",value:function(e){var t=this,n=[];return function i(r){var a,o=D(r.children);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.cloner;BM.is(s)&&(s.visible||(null===l||void 0===l?void 0:l.object.data.visible))&&((XR(s)||QR(s)&&t.scene.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,n),UN(s,e,n,!0)),i(s))}}catch(u){o.e(u)}finally{o.f()}}(this),n}},{key:"updateEntity2DByOp",value:function(e,t,n,i){var r;null===(r=this.uiCanvas)||void 0===r||r.updateEntity2DByOp(e,t,n,i)}},{key:"scene",get:function(){return this.parent}},{key:"postprocessing",get:function(){return this.data.postprocessing}},{key:"frameId",get:function(){return this.data.uiFrame}},{key:"frame",get:function(){var e;return null===(e=this.uiCanvas)||void 0===e?void 0:e.frame}},{key:"playCamera",get:function(){var e,t;return null!==(e=null===(t=this.scene)||void 0===t?void 0:t.find(this.data.publish.playCamera))&&void 0!==e?e:this.personalCamera}},{key:"penumbraSizeArray",get:function(){return null===this.penumbraSizeArrayCache&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}}]),n}(lE(es)),WF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;(0,b.Z)(this,n),(a=t.call(this)).super_Entity(e,i),a.castShadow=!0,a.shadow.mapSize.width=1024,a.shadow.mapSize.height=1024,a.shadow.normalBias=1,a.layers.enable(3);var o=a.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;var s=new un(-o.far+a.position.x,-o.far+a.position.y,-o.far+a.position.z),l=new un(o.far+a.position.x,o.far+a.position.y,o.far+a.position.z),u=new dn(s,l),c=new fc(u,new Yt(16755200));return c.visible=!1,a.gizmos.shadowmap=c,a.update(),a}return(0,w.Z)(n,[{key:"update",value:function(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(var e in this.gizmos){var t=this.gizmos[e];if(t instanceof fc){var n=this.shadow.camera,i=new un(-n.far+this.position.x,-n.far+this.position.y,-n.far+this.position.z),r=new un(n.far+this.position.x,n.far+this.position.y,n.far+this.position.z);t.box.set(i,r),t.updateMatrixWorld(!0)}}}},{key:"updateMatrixWorld",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"updateMatrixWorld",this).call(this,e),this.objectHelper&&this.objectHelper.update()}},{key:"updateState",value:function(e,t){this.updateState_Light(e,t),void 0!==e.distance&&(this.distance=e.distance),void 0!==e.decay&&(this.decay=e.decay),void 0!==e.shadowRadius&&(this.shadow.radius=e.shadowRadius),void 0!==e.shadowResolution&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}}]),n}(qR(_u,kz)),qF=function(e){(0,v.Z)(n,e);var t=T(n);function n(){return(0,b.Z)(this,n),t.apply(this,arguments)}return(0,w.Z)(n,[{key:"updateEntityBoxSize",value:function(e,t){var i=this.geometry.getAttribute("position");void 0!==i?KT(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):(0,d.Z)((0,m.Z)(n.prototype),"updateEntityBoxSize",this).call(this,e,t)}},{key:"forceComputeSize",get:function(){return!0}},{key:"shape",get:function(){return this.geometry.userData.shape}}]),n}(II),XF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r))._shapeId=null,a._context=r,a}return(0,w.Z)(n,[{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),this.updateShape(),this.refreshAttachedCloners(t)}},{key:"updateShape",value:function(){var e,t=this,n=k({},this.data.geometry.extrusion.shape);for(var i in n)"string"==typeof n[i]&&(n[i]=this._context.shared.getVariable(n[i],[this.uuid,"geometry","extrusion","shape",i]));if("Custom"===n.type){var r=n.shapeId;if(r!==this._shapeId&&this.detachShape(),r){var a;this._shapeId=r;var o=this._context.scene.find(r);null!==o&&void 0!==o&&o.data&&(o.attachedPaths.add(this),e=null===(a=o.geometry.userData)||void 0===a?void 0:a.shape),e||this._context.scene.addPendingCommand((function(){return t.updateShape()}))}}else{var s;switch(n.type){case"Rectangle":s=Ek;break;case"Ellipse":s=UC;break;case"Polygon":s=bk;break;case"Star":s=Dk;break;default:throw new Error("Unknown shape type: ".concat(n.type))}e=s.create({parameters:n}).userData.shape}var l=this.geometry;e&&l.inputs&&(l.inputs.shapeData=e,l.build())}},{key:"detachShape",value:function(){var e;null!==this._shapeId&&(null===(e=this._context.scene.find(this._shapeId))||void 0===e||e.attachedPaths.delete(this))}},{key:"createGeometryDelayed",value:function(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}},{key:"updateTransformState",value:function(e,t){return(0,d.Z)((0,m.Z)(n.prototype),"updateTransformState",this).call(this,e,t)}},{key:"updateGeometryInteractions",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateGeometryInteractions",this).call(this,e,t),this.updateShape()}},{key:"updateEntityBoxSize",value:function(e,t){var i=this.geometry.getAttribute("position");void 0!==i?KT(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):(0,d.Z)((0,m.Z)(n.prototype),"updateEntityBoxSize",this).call(this,e,t)}}]),n}(II),YF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).data=i,a}return n}(uR),QF=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),a=t.call(this),"Instance"===i.type&&"string"==typeof e&&(i=a.transformAssignData(i,r)),a.super_Entity(e,i),a.objectHelper.update(),a}return(0,w.Z)(n,[{key:"transformAssignData",value:function(e,t){var n=tS.getComponentData({scene:t.scene.data,shared:t.shared.data},e.component);if(n){var i,r,a,o=D(pw.rootOverrideProps);try{for(o.s();!(a=o.n()).done;){var s=a.value;void 0===e[s]?(void 0===i&&(i=k({},e)),i[s]=n.data[s]):(void 0===r&&(r={}),r[s]=e[s],void 0===i&&(i=k({},e)),i[s]=rg.apply(n.data[s],e[s]))}}catch(l){o.e(l)}finally{o.f()}return this.overrideData=r,i}return k(k(k({},ow.defaultData),e),pm(ow.defaultData,pw.rootOverrideProps))}},{key:"updateByOp",value:function(e,t,i,r){var a,o;if(this.isInstanceRoot&&!r)if(t=this.transformAssignData(t,i),0===e.type&&0===e.path.length&&this.component){var s,l=D(pw.rootOverrideProps);try{for(l.s();!(s=l.n()).done;){var u=s.value;u in e.props&&void 0===e.props[u]&&(void 0===o&&(o=k(k({},e),{},{props:k({},e.props)})),o.props[u]=this.component.data[u])}}catch(h){l.e(h)}finally{l.f()}}else if(0===e.type&&e.path.length>0&&pw.rootOverrideProps.includes(e.path[0])){var c=e.path[0];void 0===o&&(o=k(k({},e),{},{path:[],props:(0,g.Z)({},c,t[c])}))}(0,d.Z)((0,m.Z)(n.prototype),"updateByOp",this).call(this,null!==(a=o)&&void 0!==a?a:e,t,i,r)}},{key:"updateState",value:function(e,t){this.updateState_Entity(e,t)}},{key:"expandInstanceChildren",value:function(e){var t=this,n=this.data;if(void 0===this.component){var i,r=null!==(i=e.scene.find(n.component))&&void 0!==i?i:null,a=!1;if(r!==this.oldComponent){if(this.oldComponent){var o,s=0,l=D(this.children);try{for(l.s();!(o=l.n()).done;){var u=o.value;if(!BM.is(u))break;e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(u),KF(u),s+=1}}catch(c){l.e(c)}finally{l.f()}this.children.splice(0,s)}a=!0}r&&function(){var i={};$F(e,[t.uuid],n.overrides,t,r,r,0,a,i);var o,s=D(t.children);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(BM.is(l)){var u=l.data;"Empty"===u.type&&u.animations&&l.traverseEntity((function(t){var n=t.dataPatched;if(t instanceof II&&n.bones&&n.boneInverses){var r=t.dataPatched;if(r.bones&&r.boneInverses){var a=r.bones.map((function(t){return e.scene.find(i[t])})),o=r.boneInverses.map((function(e){return(new Nn).fromArray(e)})),s=new ls(a,o);t.bind(s,t.bindMatrix)}}else t.matrixAutoUpdate=!0}))}}}catch(c){s.e(c)}finally{s.f()}}(),this.oldComponent=this.component}}},{key:"isComponentRoot",get:function(){return"Component"===this.data.type&&"string"==typeof this.identity}},{key:"isInstanceRoot",get:function(){return"Instance"===this.data.type&&"string"==typeof this.identity}}]),n}(RR(Go,tL));function KF(e){if(e.component){var t=e.component.instances.indexOf(e);t>=0&&e.component.instances.splice(t,1);var n,i=D(e.children);try{for(i.s();!(n=i.n()).done;){var r=n.value;BM.is(r)&&KF(r)}}catch(a){i.e(a)}finally{i.f()}}}function JF(e,t,n,i){return e.component===t&&om(e.identity,i)?e.overrideData===n?2:1:0}function $F(e,t,n,i,r,a,o,s,u){if(o>50)return!1;if(i.component!==r){if(i.component){var c=i.component.instances.indexOf(i);c>=0&&i.component.instances.splice(c,1)}r.instances.find((function(e){return e===i}))||r.instances.push(i),i.component=r}r instanceof QF&&r.isInstanceRoot&&r.expandInstanceChildren(e);var h,d=0,f=D(r.children);try{for(f.s();!(h=f.n()).done;){var v=h.value;if(BM.is(v)){var p=[].concat((0,l.Z)(t),(0,l.Z)("string"==typeof v.identity?[v.identity]:v.identity)),m=vw.resolve(n,p,1);null==m||m instanceof ug||(Object.setPrototypeOf(m,ug.prototype),console.error("wrong prototype"));var g=null,y=void 0;if(!s){var x,b=i.children[d];if(null!==(g=BM.is(b)?b:null)){var w=JF(g,v,m,p);y=w>=1?g.stateSelection:void 0,2!==w&&(g=null)}if(null===g&&null!==(g=null!==(x=e.scene.findInstance(p))&&void 0!==x?x:null)){var S=JF(g,v,m,p);if(y=S>=1?g.stateSelection:void 0,2!==S)g=null;else{var _=g.parent.children.indexOf(g);g.parent.children.splice(_,1),i.children.splice(d,0,g),g.parent===i?_<=d&&console.error("not possible"):(g.parent=i,g.matrixWorldNeedsUpdate=!0,g.resetBBoxNeedsUpdate(),g.updateVisible(),e.pendingDeletes.delete(g))}}}if(null===g){var A=m?rg.apply(v.data,m):v.data;Jx.is(A.type)&&(A=k(k({},A),{},{type:"Empty"})),(g=XM.createEntity(p,A,e)).overrideData=m,i.add(g),i.children.splice(i.children.length-1,1),i.children.splice(d,0,g),g.updateState(g.data,e),y&&g.changeSelectedState(y,e),e.scene.registerInstanceAndSetUuid(g)}if(g.isBone)u[g.identity[g.identity.length-1]]=g.uuid;d+=1,$F(e,t,n,g,v,a,o+1,s,u)}}}catch(C){f.e(C)}finally{f.f()}if(!s){for(var M=d;;){var E=i.children[d];if(!BM.is(E))break;e.pendingDeletes.add(E),d+=1}i.children.splice(M,d-M)}return!0}var eN=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this)).super_Entity(e,i),r.objectHelper.update(),r.matrixAutoUpdate=!0,r}return(0,w.Z)(n,[{key:"updateState",value:function(e,t){this.updateState_Entity(e,t)}}]),n}(RR(rs,tL)),tN=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r){var a;return(0,b.Z)(this,n),(a=t.call(this,e,i,r)).onBeforeRender=function(e){a.uiCanvas.render(e)},a.uiCanvas=new UF(e+"-canvas",i.geometry.width,i.geometry.height,r),a.uiCanvas.promise.then((function(){a.applyFrame(a.dataPatched.geometry.frame,r.shared)})),a}return(0,w.Z)(n,[{key:"updateByPatchedOpGeometry",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOpGeometry",this).call(this,e,t,i),0===e.type&&(void 0!==e.props.frame&&this.applyFrame(e.props.frame,i.shared),(void 0!==e.props.width||void 0!==e.props.height)&&this.applySize(e.props,i.shared))}},{key:"applySize",value:function(e,t){var n,i,r=null!==(n=null===e||void 0===e?void 0:e.width)&&void 0!==n?n:this.dataPatched.geometry.width,a=null!==(i=null===e||void 0===e?void 0:e.height)&&void 0!==i?i:this.dataPatched.geometry.height;this.uiCanvas.applySize({width:r,height:a}),this.applyGeometryParametersFromFrame(t)}},{key:"applyFrame",value:function(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}},{key:"applyGeometryParametersFromFrame",value:function(e){var t,n=this.frame;n&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:n.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:n.cornerRadius,cornerType:0})}),null!==(t=this.localGeometry)&&void 0!==t&&t.dispose(),this.localGeometry=pT(this.dataPatched.geometry,e,this.data.flatShading,this))}},{key:"applyMaterialParametersFromFrame",value:function(e){var t=this.frame;if(t){var n,i,r=t.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:r.radius,alpha:r.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:r.radius,alpha:r.enabled?1:0}),null===(n=(i=this.material).reset)||void 0===n||n.call(i,this.dataPatched.material,e,!0)}}},{key:"updateEntity2DByOp",value:function(e,t,n,i){this.uiCanvas.updateEntity2DByOp(e,t,n,i),e===this.frameId&&0===t.type&&(void 0!==t.props.cornerRadius?this.applyGeometryParametersFromFrame(i):Lg(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:i}))}},{key:"removeInteractionGeometry",value:function(e){(0,d.Z)((0,m.Z)(n.prototype),"removeInteractionGeometry",this).call(this,e),this.applySize({},e)}},{key:"updateGeometryInteractions",value:function(e,t){var i;(0,d.Z)((0,m.Z)(n.prototype),"updateGeometryInteractions",this).call(this,e,t),this.applySize({width:e.width,height:e.height},t);var r=k(k({},this.data.geometry),e);null!==(i=this.localGeometry)&&void 0!==i&&i.dispose(),this.localGeometry=pT(r,t,this.data.flatShading,this)}},{key:"frame",get:function(){return this.uiCanvas.frame}},{key:"frameId",get:function(){var e;return null===(e=this.frame)||void 0===e?void 0:e.uuid}}]),n}(II),nN=function e(t,n,i){(0,b.Z)(this,e),this.variables=[],this.currentTextureIndex=0;var r=ve,a=new es,o=new or;o.position.z=1;var s={passThruTexture:{value:null}},l=h("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",s),u=new Ji(new wr(2,2),l);function c(e){e.defines.resolution="vec2( "+t.toFixed(1)+", "+n.toFixed(1)+" )"}function h(e,t){var n=new ar({uniforms:t=t||{},vertexShader:"void main()\t{\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:e});return c(n),n}a.add(u),this.setDataType=function(e){return r=e,this},this.addVariable=function(e,t,n){var i={name:e,initialValueTexture:n,material:this.createShaderMaterial(t),dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:se,magFilter:se};return this.variables.push(i),i},this.setVariableDependencies=function(e,t){e.dependencies=t},this.init=function(){if(!1===i.capabilities.isWebGL2&&!1===i.extensions.has("OES_texture_float"))return"No OES_texture_float support for float textures.";if(0===i.capabilities.maxVertexTextures)return"No support for vertex shader textures.";for(var e=0;ee){r=a;break}e1&&(r=1-r,a=1-a),iN.a.fromBufferAttribute(this.positionAttribute,3*e),iN.b.fromBufferAttribute(this.positionAttribute,3*e+1),iN.c.fromBufferAttribute(this.positionAttribute,3*e+2),t.set(0,0,0).addScaledVector(iN.a,r).addScaledVector(iN.b,a).addScaledVector(iN.c,1-(r+a)),void 0!==n&&iN.getNormal(n),void 0!==i&&void 0!==this.colorAttribute&&(iN.a.fromBufferAttribute(this.colorAttribute,3*e),iN.b.fromBufferAttribute(this.colorAttribute,3*e+1),iN.c.fromBufferAttribute(this.colorAttribute,3*e+2),rN.set(0,0,0).addScaledVector(iN.a,r).addScaledVector(iN.b,a).addScaledVector(iN.c,1-(r+a)),i.r=rN.x,i.g=rN.y,i.b=rN.z),this}}]),e}();function oN(e,t){for(var n=e,i=new Float32Array(4*t*t),r=0;r 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 ".concat("\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 collision\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 ").concat("\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 ").concat("\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"),lN="\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",uN="\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;\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 ".concat("\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 ").concat(lN,"\n"),cN="\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 "+lN+" \n ".concat("\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"),hN=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i){var r;return(0,b.Z)(this,n),(r=t.call(this)).needsJitter=!0,r.type="ParticleMaterial",r.easeOpacity="linearFadeIn",r.easeSize="linearFadeIn",r.useSizeEnd=!1,r.isColoringRandom=!1,r.init(e,i),r.context=i,r}return(0,w.Z)(n,[{key:"reset",value:function(){}},{key:"init",value:function(e,t){this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.easeOpacity=e.ease,this.easeSize=e.easeSize,this.layers=[],nP.startContext(nP.globalContext),this.lightLayer=new wO(0,"",k(k({},Sb.defaultData("light","phong")),{},{visible:!1}),new xD,{},t.shared),nP.endContext(nP.globalContext),this.build()}},{key:"updateState",value:function(e){void 0!==e.coloring&&(this.isColoringRandom="random"===e.coloring),void 0!==e.color&&(e.color instanceof Array?this.uniforms.uColor.value=e.color:this.uniforms.uColor.value=this.context.shared.color(e.color)),void 0!==e.color2&&(e.color2 instanceof Array?this.uniforms.uColor2.value=e.color2:this.uniforms.uColor2.value=this.context.shared.color(e.color2)),void 0!==e.size&&(this.uniforms.uSize.value=e.size[0],this.uniforms.uSizeEnd.value=e.size[1],e.size[0]!==e.size[1]?this.useSizeEnd=!0:this.useSizeEnd=!1),void 0!==e.ease&&(this.easeOpacity=e.ease,this.build()),void 0!==e.easeSize&&(this.easeSize=e.easeSize,this.build()),this.needsUpdate=!0}},{key:"onBeforeCompile",value:function(e){this.build(),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader}},{key:"build",value:function(){var e=new BP;return e.needsJitter=this.needsJitter,e.addFragmentParsCode("\nlayout(location = 1) out vec4 gVelocity;\n"),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.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&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(uN),e.addFragmentParsCode(cN),e.addVertexFinalCode(function(e){var t=e.easeSize;return"\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 = ".concat(void 0===t?"linearFadeOut":t,"(1. - lifeLeft);\n // Scaled Over Time\n vec3 scaledPosition = position * vec3(uSize * easeSize);\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})),e.addFragmentFinalCode(function(e){var t=e.easeOpacity;return" \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 = ".concat(void 0===t?"linearFadeOut":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=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms=k(k({},e.uniforms),this.uniforms),this.extensions=e.extensions,this}},{key:"getDefines",value:function(){return this.defines}},{key:"nodeMaterialDispose",value:function(){this.layers.forEach((function(e){return e.dispose()})),(0,d.Z)((0,m.Z)(n.prototype),"dispose",this).call(this)}},{key:"nodeMaterial",get:function(){return this}},{key:"fragment",get:function(){return this.lightLayer.node}}]),n}(ar),dN=function(){function e(t,n,i,r){var a;(0,b.Z)(this,e),this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=t,this.type=i,this.textureSize=function(e){var t=Math.ceil(Math.sqrt(e));return Math.max(t,1)}(n);this.targetMesh="BufferGeometry"===(null===r||void 0===r?void 0:r.geometry.type)||"Mesh"===(null===r||void 0===r?void 0:r.type)&&r&&r.geometry.hasAttribute("position")&&r.geometry.hasAttribute("normal")?r:this.getMesh(i,1);var o=this.createPositions(this.textureSize,null!==(a=this.targetMesh)&&void 0!==a?a:this.getMesh(i,1)),s=o.positions,l=o.dataTexture,u=o.dataTextureNormals;this.positionsTexture=l,this.positionsAttribute=s,this.directionsTexture=u}return(0,w.Z)(e,[{key:"createPositions",value:function(e,t){var n=function(e,t){var n=new Ji(e.geometry,e.material),i=[],r=[],a=new un,o=new un;null!==n.geometry.index&&(n.geometry=n.geometry.toNonIndexed());for(var s=new aN(n).build(),l=0;l0&&this.renderColliders(),this.gpuCompute.compute()}else this.reset()}},{key:"renderColliders",value:function(){if(this.velocitySimRT){var e=this.system.colliderEntities[0],t=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&t&&this.init(fN(k(k({},this.system.data),{},{colliderEntityId:null}))),e&&!e.destroyedInAction){e.getWorldPosition(this.colliderV3),0===this.colliderV3.y&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);var n=e.data.size;this.colliderV3.fromArray(n),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),e.getWorldQuaternion(this.colliderQuaternion),this.velocitySimRT.material.uniforms.uColliderQuaternion.value.copy(this.colliderQuaternion.normalize()),this.velocitySimRT.material.uniforms.uColliderQuaternionInvert.value.copy(this.colliderQuaternion.normalize().invert())}}}},{key:"updateState",value:function(e){!this.velocitySimRT||!this.positionSimRT||(e.renderMaterial&&this.updateMaterialState(e.renderMaterial),this.updateParticleState(e))}},{key:"updateVariableState",value:function(e,t){var n=this;if(this.velocitySimRT&&this.positionSimRT){"size"===t[2]&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),"sizeEnd"===t[2]&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});var i=function(e,t){var i=(0,l.Z)(n.system.data.shape.size);i[e]=t,n.updateParticleState({shape:k(k({},n.system.data.shape),{},{size:i})})};"shape_size_0"===t[2]&&i(0,e),"shape_size_1"===t[2]&&i(1,e),"shape_size_2"===t[2]&&i(2,e),"speed"===t[2]&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/10),"gravity"===t[2]&&this.worldGravity.set(0,e/100,0),"noiseStrength"===t[2]&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),"noiseScale"===t[2]&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),"direction_x"===t[2]&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),"direction_y"===t[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),"direction_z"===t[2]&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}}},{key:"updateMaterialState",value:function(e){this.material.updateState(k(k({},e),{},{size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]})),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}},{key:"updateParticleState",value:function(e){if(this.positionSimRT&&this.velocitySimRT){var t,n;if(this.shouldReInitGPUCompute(e)&&this.init(fN(this.system.data)),void 0!==e.life&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),void 0!==e.speed&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/10),void 0!==e.collisionBounce&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),void 0!==e.noiseStrength&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),void 0!==e.noiseScale&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),void 0!==e.noiseSeed&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),void 0!==e.randomMass&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),void 0!==(null===(t=e.renderMaterial)||void 0===t?void 0:t.size)){var i=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(i)}if(void 0!==(null===(n=e.renderMaterial)||void 0===n?void 0:n.spriteRotation)&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),void 0!==e.shape){var r,a,o=null!==(r=e.shape.size)&&void 0!==r?r:this.system.data.shape.size,s=[Number(this.shared.getVariable(o[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(o[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(o[2],[this.uuid,"particles","shape_size_2"]))],l=k(k({},fN(this.system.data).shape),{},{size:s});null===(a=this.emitterShape)||void 0===a||a.applyToShader(this.positionSimRT.material.uniforms,l)}if(void 0!==e.gravity&&(this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.velocitySimRT.material.uniforms.uGravity={value:this.worldGravity}),void 0!==e.direction){var u=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(u),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}void 0!==e.randomRotation&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),void 0!==e.randomScale&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}},{key:"updateForceFieldParameters",value:function(e){!this.velocitySimRT||(void 0!==e.forceIntensity&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),void 0!==e.forceDambing&&(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}},{key:"getDirectionAxis",value:function(e){var t=[Number(e[0])*Pt.DEG2RAD,Number(e[1])*Pt.DEG2RAD,Number(e[2])*Pt.DEG2RAD],n=new Yn(t[0],t[1],t[2],"XYZ");return this.directionAxis.set(0,1,0).applyEuler(n).normalize(),this.velocitySimRT&&(this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis),this.directionAxis}},{key:"shouldReInitGPUCompute",value:function(e){var t=e.birthRatePerSec,n=e.rootObjectType,i=e.colliderEntityId,r=e.shape,a=e.emitTimeDuration,o=e.emitTimeCycle,s=e.life,l=e.directionMode,u=e.noiseType;return void 0!==t||void 0!==n||i||null===i||void 0!==o||void 0!==r||void 0!==s||void 0!==a||void 0!==l||void 0!==u}},{key:"init",value:function(e){var t=this;this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.birthRatePerSec,particleMaxLifeTime:e.life,loopDuration:"infinity"===e.emitTimeCycle?0:e.emitTimeDuration}),this.particlesAmount>1e5&&(console.warn("The maximum number of particles is limited to ".concat(1e5,".")),this.particlesAmount=1e5),this.emitterShape=this.createShape(e.shape,this.particlesAmount);var n=setInterval((function(){if(t.emitterShape){if(isNaN(t.emitterShape.positionsTexture.source.data.data[0]))return void t.init(e);clearInterval(n)}}),100);if(this.emitterShape){var i=new nN(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),r=this.updateSimulationDefinition(e),a=i.addVariable("uCurrentPosition",r+"\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;\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);\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),o=i.addVariable("uCurrentVelocity",r+sN,this.emitterShape.directionsTexture),s=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;\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(e){for(var t=new Float32Array(4*e*e),n=0;n0){var t=this.system.getColliderData(e.colliderEntityId);switch(null===t||void 0===t?void 0:t.forceType){case"attractor":this.simFeaturesDefinition.USE_ATTRACTOR=!0;break;case"collider":this.simFeaturesDefinition.USE_COLLIDER=!0;break;case"vortex":this.simFeaturesDefinition.USE_VORTEX=!0}var n=null===t||void 0===t?void 0:t.colliderType;"sphere"===n&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),"box"===n&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),"helper"===(null===t||void 0===t?void 0:t.forceRange)&&(this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!0)}"normals"===e.directionMode&&(this.simFeaturesDefinition.USE_NORMALS=!0),"curl"===e.noiseType&&(this.simFeaturesDefinition.USE_CURL_NOISE=!0),"simplex"===e.noiseType&&(this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!0),"fbm"===e.noiseType&&(this.simFeaturesDefinition.USE_FBM_NOISE=!0);for(var i="",r=0,a=Object.entries(this.simFeaturesDefinition);r=i){var r=Math.max(1,Math.floor(n/i));return this.lastEmitTime=e,this.emittedParticlesAmount+r>this.particlesAmount&&(this.emittedParticlesAmount=0),this.emittedParticlesAmount+=r,r}return 0}},{key:"checkIfAllParticlesAreDead",value:function(){return this.lastEmitTime+this.system.data.life+11e3*this.data.emitTimeDuration&&(this.stopped||(this.stop(),t||this.start(1e3*this.data.emitTimeDelay))),this.emitter&&this.started){var n=this.actualTime/1e3;this.emitter.update(n,e)}this.scale.set(1,1,1),this.updateMatrix()}}},{key:"isReady",value:function(){return!!this.emitter}},{key:"hasCollider",value:function(e){return this.colliderEntities.some((function(t){return t.identity===e}))}},{key:"getColliderData",value:function(e){var t=this.colliderEntities.find((function(t){return t.identity===e}));return t?t.data:null}},{key:"updateByPatchedOp",value:function(e,t,i){(0,d.Z)((0,m.Z)(n.prototype),"updateByPatchedOp",this).call(this,e,t,i),Lg(e.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:k(k({},this.data.renderMaterial),sg.drop(e,1).props)}),Lg(e.path,["shape"])&&this.updateParticleState({shape:k(k({},this.data.shape),sg.drop(e,1).props)})}},{key:"updateState",value:function(e,t){(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),this.updateParticleState(e)}},{key:"updateParticleState",value:function(e){if(this.emitter){if(void 0!==e.colliderEntityId&&null!==e.colliderEntityId){var t=this.context.scene.find(e.colliderEntityId);this.colliderEntities=t?[t]:[]}null===e.colliderEntityId&&(this.colliderEntities=[]),this.emitter.updateState(e),e.emitTimeCycle&&this.started&&this.start()}}},{key:"updateFromColliderEntity",value:function(e){!this.emitter||(this.emitter.updateForceFieldParameters(e),this.stop(),this.start())}},{key:"start",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.currentLoopTime=0,n?this.timeoutId=window.setTimeout((function(){t.start(0)}),n):(this.started=!0,this.stopped=!1,this.isFrozen=!1,null===(e=this.emitter)||void 0===e||e.startEmitting(this.actualTime/1e3))}},{key:"froze",value:function(){this.isFrozen=!0}},{key:"unFroze",value:function(){this.isFrozen=!1}},{key:"stop",value:function(){var e;this.stopped=!0,this.currentLoopTime=0,null!==(e=this.emitter)&&void 0!==e&&e.stopEmitting(),clearTimeout(this.timeoutId)}},{key:"reset",value:function(){var e;this.started=!1,this.stopped=!1,null===(e=this.emitter)||void 0===e||e.reset()}},{key:"wakeUp",value:function(){this.isIdle=!1}},{key:"sleep",value:function(){this.isIdle=!0,this.reset()}}]),n}(eP);var mN=function(){try{var e=window.location.href;if(e.includes("reducesubdiv=")){var t=e.indexOf("reducesubdiv=")+13;return parseInt(e.slice(t,t+1))}}catch(n){}}();function gN(e,t,n){return console.assert(void 0!==t.type),"Mesh"===t.type?function(e,t,n){var i;return void 0!==mN&&(null===t||void 0===t?void 0:t.geometry)&&"subdivisions"in t.geometry&&(null!==(i=t.geometry.subdivisions)&&void 0!==i?i:0)>mN&&Object.assign(t.geometry,{subdivisions:mN}),"TextGeometry"===t.geometry.type?new uR(e,t,n):"InputGeometry"===t.geometry.type?new YF(e,t,n):"SubdivGeometry"===t.geometry.type?new NI(e,t,n):"PathGeometry"===t.geometry.type?new XF(e,t,n):"VectorGeometry"===t.geometry.type?new qF(e,t,n):"BooleanGeometry"===t.geometry.type?new WR(e,t,n):"ShapeBlendGeometry"===t.geometry.type?new MN(e,t,n):"UIGeometry"===t.geometry.type?new tN(e,t,n):new II(e,t,n)}(e,t,n):"Empty"===t.type?new nL(e,t):"Particle"===t.type?new pN(e,t,n):"ParticleCollider"===t.type?new iL(e,t,n):"Splat"===t.type?new nL(e,t):"Bone"===t.type?new eN(e,t):"Page"===t.type?new HF(e,t,n):"PointLight"===t.type?new WF(e,t,n):"SpotLight"===t.type?new Uz(e,t,n):"DirectionalLight"===t.type?new Bz(e,t,n):"Component"===t.type||"Instance"===t.type?new QF(e,t,n):Jx.is(t.type)?new ZR(e,t):(console.error(t),new nL(e,t))}XM.createEntity=gN,XM.changeEntityProptotype=function(e,t,n){var i=gN(e.identity,t,n),r=e.children,a=e.attachedPaths,o=e.parent,s=e.component,u=e.instances,c=e.overrideData,h=e.uuid,d=e.stateSelection;e.dispose();for(var f=0,v=Object.keys(e);f=0;u--){var c=u%2===l%2?r[0]:r[1],h=u===l?i:u%2===l%2?r[1]:r[0];this.pyramidPassUniforms.inputTexture.value=Array.isArray(h.texture)?h.texture[1]:h.texture,this.pyramidPassUniforms.inputWidth.value="width"in h?h.width:1,this.pyramidPassUniforms.inputHeight.value="height"in h?h.height:1,n.setRenderTarget(c);var d=t[u],f=n.getPixelRatio();n.setViewport(this.pyramidPassUniforms.outputShiftX.value/f,0,d/f,d/f),2===u&&e%2!==0&&n.setViewport(this.pyramidPassUniforms.outputShiftX.value/f,0,3/f,3/f),n.render(this.pyramidPassScene,bN);var v=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=v,u\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:t.uniforms,defines:a.material.defines}),a.isMeshDepthMaterial=!0,a.customDistanceMaterial=new ar({vertexShader:t.vertexShader,fragmentShader:"\n\t\t\t\t\t#include \n\t\t\t\t\t#include \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:k({nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new un},opacity:{value:0}},t.uniforms),defines:a.material.defines});var i=a.customDistanceMaterial;i.referencePosition=new un,i.nearDistance=0,i.farDistance=0,i.opacity=1,i.isMeshDistanceMaterial=!0}}else a.patchVertexShaderForShapeBlend(t),t.shadersPatchedForShapeBlend=!0,a.customDepthMaterialNeedsUpdate=!0;if(a.spatialPassUniforms.npart.value=a.npart,a.spatialPassUniforms.spatialn.value=a.spatialn,a.potentialPassUniforms.npart.value=a.npart,a.potentialPassUniforms.spatialn.value=a.spatialn,a.needsRebuild){a.needsRebuild=!1,a.spatialMesh.material.defines.RES=a.resolutionLevel,a.spatialMesh.material.needsUpdate=!0,a.potentialMesh.material.defines.RES=a.resolutionLevel,a.potentialPassUniforms.spatialPassTexture.value=a.spatialPassRenderTarget.texture,a.potentialMesh.material.needsUpdate=!0,a.voxelMesh.material.defines.RES=a.resolutionLevel,a.voxelMesh.material.needsUpdate=!0,a.voxelPassUniforms.potentialPassTexture.value=a.potentialPassRenderTarget.texture,a.marchPassUniforms.potentialPassTexture.value=a.potentialPassRenderTarget.texture,a.marchPassUniforms.voxelPassTexture.value=a.voxelPassRenderTarget.texture[0],a.material.defines.RES=a.resolutionLevel,a.material.defines.LEVELS=a.pyramidLevelSizes.length,a.material.defines.LOOP=a.pyramidLevelSizes.length%2===0?a.pyramidLevelSizes.length-3:a.pyramidLevelSizes.length-2,a.material.defines.HALF=a.pyramidLevelSizes.length%2===0?1:0,a.material.needsUpdate=!0;var r=a.pyramidLevelSizes.length%2===0?0:1,o=a.pyramidLevelSizes.length%2===0?1:0;a.marchPassUniforms.pyramidTexture2.value=a.pyramidRenderTarget[r].texture,a.marchPassUniforms.pyramidTexture2Size.value=new Dt(a.pyramidRenderTarget[r].width,a.pyramidRenderTarget[r].height),a.marchPassUniforms.pyramidTexture1.value=a.pyramidRenderTarget[o].texture,a.marchPassUniforms.pyramidTexture1Size.value=new Dt(a.pyramidRenderTarget[o].width,a.pyramidRenderTarget[o].height),Object.assign(a.material.uniforms,a.marchPassUniforms)}var s=e.shadowMap.enabled;e.shadowMap.enabled=!1;var l=e.getRenderTarget();e.setRenderTarget(a.spatialPassRenderTarget),e.render(a.spatialscene,bN),e.setRenderTarget(a.potentialPassRenderTarget),e.render(a.potentialPassScene,bN),e.setRenderTarget(a.voxelPassRenderTarget),e.render(a.voxelPassScene,bN),n.streamCompaction.renderPyramid(a.resolutionLevel,a.pyramidLevelSizes,e,a.voxelPassRenderTarget,a.pyramidRenderTarget).then((function(e){a.material.wireframe&&(3*e>a.geometry.attributes.position.count||a.drawRangeNeedsForceUpdate)&&(a.geometry.dispose(),a.geometry=new Fi,a.geometry.userData.parameters={width:a.bboxSize,height:a.bboxSize,depth:a.bboxSize,centerOffset:[a.bboxOffset,a.bboxOffset,a.bboxOffset]},a.geometry.attributes.position=new Ci(new Float32Array(3*e*2),3)),(3*e>a.geometry.drawRange.count||a.drawRangeNeedsForceUpdate)&&(a.geometry.drawRange.count=3*Math.floor(1.2*e)),a.drawRangeNeedsForceUpdate=!1})),e.shadowMap.enabled=s,e.setRenderTarget(l)}else a.geometry.drawRange.count=0},a}return(0,w.Z)(n,[{key:"updateState",value:function(e,t){var i=this.material;(0,d.Z)((0,m.Z)(n.prototype),"updateState",this).call(this,e,t),i!==this.material&&(this.needsRebuild=!0),e.geometry&&(this.resolutionLevel=e.geometry.resolutionLevel,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]}),e.wireframe&&!this.geometry.getAttribute("position")?this.geometry.setAttribute("position",new Ci(new Float32Array(3*this.geometry.drawRange.count),3)):!e.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}},{key:"spatialPassMaterial",value:function(){var e="\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\t\t\tconst float spatialDivisions = ".concat(this.spatialDivisions,".;\n\t\t\tuniform float span;\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\t").concat(AN.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 = ").concat(23,".; ii >= 0.; ii--) {\n\t\t\t\t\tfloat i = ii + lowi;\n\t\t\t\t\tfloat iin = (i + 0.5) / ").concat(_N,".;\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").concat(AN.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) * ").concat(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+").concat(SN,".);\n\t\t\t\tpc_FragColor.z = spatialKey(lowi+").concat(48,".);\n\t\t\t\tpc_FragColor.w = spatialKey(lowi+").concat(72,".);\n\t\t\t}\n\t\t");return new xN({name:"Spatial Pass",fragmentShader:e,uniforms:this.spatialPassUniforms})}},{key:"potentialPassMaterial",value:function(){var e="\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\n\t\t\t".concat(AN.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 = ").concat(this.spatialDivisions,".;\n\t\t\tconst float spatialDivisions2 = spatialDivisions * spatialDivisions;\n\t\t\tconst float spatialDivisionsSub1 = spatialDivisions - 1.;\n\n\t\t\t").concat(AN.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 => 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 < ").concat(SN,".; 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) * ").concat(1/_N,";\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;\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 * ").concat(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+").concat(SN,"., activeKey.y, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+").concat(48,"., activeKey.z, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+").concat(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").concat(AN.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 xN({name:"PotentialPass",fragmentShader:e,uniforms:this.potentialPassUniforms})}},{key:"voxelPassMaterial",value:function(){var e="\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".concat(AN.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").concat(AN.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 xN({name:"VoxelPass",fragmentShader:e,uniforms:this.voxelPassUniforms})}},{key:"patchVertexShaderForShapeBlend",value:function(e){var t="\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 = ".concat(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").concat(AN.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");e.vertexShader=t+e.vertexShader.replace("#include ","\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 ");var n=e.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(n){var i="\n\t\t#ifdef SHAPEBLEND_C\n\t\t\t#if SHAPEBLEND_C == 1\n\t\t\t\t".concat(n[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").concat(n[0],"\n\t\t\t#endif\n\t\t#else\n\t\t\t").concat(n[0],"\n\t\t#endif\n\t\t");e.fragmentShader="in vec4 marchColor;\n"+e.fragmentShader.replace(n[0],i),Object.assign(e.uniforms,this.marchPassUniforms)}}},{key:"initDebugPass",value:function(e){var t=this;console.log("fboToDebug.width",e.width,e.height),this.geometry=new wr(e.width,e.height),this.geometry.userData={parameters:{width:4,height:4}};var n={inputTexture:{value:Array.isArray(e.texture)?e.texture[1]:e.texture},pyramidTextureSize:{value:void 0}},i=function(e){e.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",e.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",n.pyramidTextureSize.value=new Dt(t.pyramidRenderTarget[0].width,t.pyramidRenderTarget[0].height),Object.assign(e.uniforms,n)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}},{key:"npart",set:function(e){e!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=e,this.spatialn=Math.ceil(e/96))},get:function(){return this._npart}},{key:"resolutionLevel",set:function(e){var t=Math.min(8,Math.max(5,e));if(t!==this._resolutionLevel){switch(this._resolutionLevel=t,this.resolution=Math.pow(2,t),this.resolutionLevel){case 5:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192],this.bboxSize=496,this.bboxOffset=-8;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=504,this.bboxOffset=-4;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=508,this.bboxOffset=-2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=510,this.bboxOffset=-1}this.pyramidTexture1Width=0,this.pyramidTexture2Width=0,this.pyramidTexture1Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-2],this.pyramidTexture2Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-3];for(var n=this.pyramidLevelSizes.length-2;n>=0;n--)(this.pyramidLevelSizes.length-2)%2===n%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[n]:this.pyramidTexture2Width+=this.pyramidLevelSizes[n];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:function(){return this._resolutionLevel}},{key:"spatialPassRenderTarget",get:function(){var e=this._spatialPassRenderTargets[this.resolutionLevel];return e||(e=new rn(this.spatialDivisions*this.spatialn,Math.pow(this.spatialDivisions,2),{format:ge,type:ve,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:se,magFilter:se}),this._spatialPassRenderTargets[this.resolutionLevel]=e),e}},{key:"potentialPassRenderTarget",get:function(){var e=this._potentialPassRenderTargets[this.resolutionLevel];return e||(e=new rn(this.basePyramidSize,this.basePyramidSize,{format:ge,type:ve,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:se,magFilter:se}),this._potentialPassRenderTargets[this.resolutionLevel]=e),e}},{key:"voxelPassRenderTarget",get:function(){var e=this._voxelPassRenderTargets[this.resolutionLevel];return e||((e=new sn(this.basePyramidSize,this.basePyramidSize,2,{stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:se,magFilter:se})).texture[0].format=ge,e.texture[0].type=ve,e.texture[1].format=be,e.texture[1].type=ve,this._voxelPassRenderTargets[this.resolutionLevel]=e),e}},{key:"pyramidRenderTarget",get:function(){var e=this._pyramidRenderTargets[this.resolutionLevel];e||(e=[new rn(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:ge,type:ve,stencilBuffer:!1,depthBuffer:!1,magFilter:se,minFilter:se}),new rn(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:ge,type:ve,stencilBuffer:!1,depthBuffer:!1,magFilter:se,minFilter:se})],this._pyramidRenderTargets[this.resolutionLevel]=e);return e}}]),n}(II);MN.streamCompaction=new wN;var EN=new Nn,CN=new Nn,kN=new ln,TN=new un,PN=new un,DN=new ln;function ON(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.children.length;n--;){var i=this.children[n];TM.is(i)&&IN.call(i,e,t+1)}}function IN(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!0!==e(this,t))for(var n=this.children.length;n--;){var i=this.children[n];TM.is(i)&&IN.call(i,e,t+1)}}function RN(){var e=this;if(void 0===this.shapesDataTexture.value){var t=new as(new Float32Array(1920),_N,5,ge,ve);this.shapesDataTexture.value=t}var n=this.shapesDataTexture.value,i=n.image.data;n.needsUpdate=!0;var r=0,a=this.data.geometry.blendRange,o=EN.copy(this.matrixWorld).invert(),s=0;ON.call(this,(function(t){var n,l;if(!1===t.visible)return!0;if(!(t instanceof _R)&&!(t instanceof iL||t instanceof pN)){l=t instanceof NM?t.object:t;var u=null===(n=t.data)||void 0===n?void 0:n.cloner;if((!BM.is(t)||!u||u.hideBase||"radial"===u.type||!0===u.disabled)&&l instanceof II){var c=l.geometry.userData.parameters,h=c.shapeBlendNode;if(void 0!==h){if(CN.multiplyMatrices(o,t.matrixWorld).decompose(PN,kN,TN),"TorusGeometry"===c.type&&360!==c.arc){var d=c.arc*Math.PI/180;d/=4,kN.multiply(DN.set(0,0,Math.sin(d),Math.cos(d)))}var f=h.overrideGlobalBlend?h.blendRange:a;f=f/e.bboxSize*2,i[4*s]=(PN.x-e.bboxOffset)/e.bboxSize*2,i[4*s+1]=(PN.y-e.bboxOffset)/e.bboxSize*2,i[4*s+2]=(PN.z-e.bboxOffset)/e.bboxSize*2,i[4*s+3]=0===h.operation?1:2===h.operation?-1:-2,i[384+4*s]=-kN.x,i[384+4*s+1]=-kN.y,i[384+4*s+2]=-kN.z,i[384+4*s+3]=kN.w;var v=new Float32Array(4),p=0;if("SphereGeometry"===c.type)c.width===c.height&&c.width===c.depth?v[0]=0:v[0]=1,v[1]=c.width/e.bboxSize,v[2]=c.height/e.bboxSize,v[3]=c.depth/e.bboxSize,r=Math.max(r,v[1]*TN.x+f,v[2]*TN.x+f,v[3]*TN.x+f);else if("CubeGeometry"===c.type){p=c.cornerRadius;var m=c.width,g=c.height,y=c.depth;v[0]=2,v[1]=(m-2*p)/e.bboxSize,v[2]=(g-2*p)/e.bboxSize,v[3]=(y-2*p)/e.bboxSize,r=Math.max(r,Math.sqrt(Math.pow(m,2)+Math.pow(g,2)+Math.pow(y,2))/e.bboxSize*TN.x+f)}else if("CylinderGeometry"===c.type){p=c.cornerRadius;var x=c.height,b=c.radiusBottom,w=c.radiusTop;if(w>=b){var S=Math.atan2(w-b,x),_=(Math.PI/2-S)/2;w-=p/Math.tan(_),b-=p*Math.tan(_)}else if(b>w){var A=Math.atan2(b-w,x),M=(Math.PI/2-A)/2;w-=p*Math.tan(M),b-=p/Math.tan(M)}v[1]=(c.height-2*p)/e.bboxSize,b===w?(v[0]=3,v[2]=b/e.bboxSize*2):(v[0]=4,v[2]=b/e.bboxSize*2,v[3]=w/e.bboxSize*2),r=Math.max(r,4*v[1]*TN.x+f)}else if("TorusGeometry"===c.type){if(v[0]=5,v[1]=(c.width-c.depth)/e.bboxSize,v[2]=c.depth/e.bboxSize,360!==c.arc){v[0]=6,v[3]=v[1],i[1152+4*s+3]=v[2];var E=2*Math.atan2(v[2]/2,v[1]),C=c.arc*Math.PI/180/2-E;v[1]=Math.sin(C),v[2]=Math.cos(C)}r=Math.max(r,c.width*TN.x/e.bboxSize+f)}i.set(v,768+4*s),i[1152+4*s]=f,i[1152+4*s+1]=p/e.bboxSize*2,i[1152+4*s+2]=TN.x;var k=l.material,T=k.uniforms.nodeU0.node.value,P=k.uniforms.nodeU1.value;0!==h.operation&&!h.useColor&&(P=-1),i[1536+4*s]=T.r,i[1536+4*s+1]=T.g,i[1536+4*s+2]=T.b,i[1536+4*s+3]=P,P<1&&1===e.material.defines.SHAPEBLEND_C&&(e.material.transparent=!0),s++}}}})),this.npart=s,this.spatialPassUniforms.span.value=1.4*r}function LN(e,t){var n=!1,i=512&e.layers.mask,r=t.getLayersOfType("transmission"),a=t.getLayersOfType("outline");return a.length>0&&(e.layers.set(8),r.length>0&&e.layers.enable(3),n=!0,LI(e),RI(e)),0===r.length&&0===a.length&&e.layers.set(0),i&&e.layers.set(9),e instanceof CI&&e.needsAO&&e.layers.enable(5),n}function BN(e,t){if(!t.layers)return!1;var n=512&e.layers.mask,i=!1,r=t.getLayersOfType("transmission").filter((function(e){return e.data.visible})),a=t.getLayersOfType("outline").filter((function(e){return e.data.visible}));return r.length>0&&(e.layers.set(3),a.length>0&&e.layers.enable(8),i=!0),0===r.length&&0===a.length&&e.layers.set(0),n&&e.layers.set(9),e.needsAO&&e.layers.enable(5),i}var zN=new qu,FN=new Nn,NN=new Fn;function UN(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=e.cloner;if(r){var a,o=D(r.children);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=FN.copy(s.matrixWorld).invert(),u=NN.copy(t.ray).applyMatrix4(l),c=e.matrixWorld;u.applyMatrix4(c);var h=zN;h.set(u.origin,u.direction),h.near=t.near,h.far=t.far;var d=h.intersectObject(e,!1);d.length>0&&n.push(k(k({},d[0]),{},{object:i?s:e}))}}catch(f){o.e(f)}finally{o.f()}}}var ZN=function(){function e(){(0,b.Z)(this,e),this._constraints=new Map}return(0,w.Z)(e,[{key:"setConstraint",value:function(e,t){null===t?this._constraints.delete(e):this._constraints.set(e,t)}},{key:"removeDependencies",value:function(e){this._constraints.delete(e)}},{key:"applyConstraints",value:function(e){var t=this,n=new Set;this._constraints.forEach((function(i,r){for(var a=[r,i],o=i;t._constraints.has(o);){if(o=t._constraints.get(o),a.includes(o)){console.warn("circular dependency detected: ".concat(a.join(" -> ")));break}n.has(o)||a.push(o)}for(var s=a.length-2;s>=0;s--)if(!n.has(a[s])){var l=e.find(a[s]);l?l.applyPathSnapping(e):console.warn("missing entity ".concat(a[s])),n.add(a[s])}}))}},{key:"findDependency",value:function(e,t){for(var n=e;this._constraints.has(n);)if((n=this._constraints.get(n))===t)return!0;return!1}}]),e}(),VN=function e(){(0,b.Z)(this,e)};function jN(e){var t,n,i,r,a,o,s,l,u,c,h,d,f,v,p,m;function g(e,t,o){var s=new Float32Array(c,a,3*n);i=0;for(var l=new Uint32Array(c,r,n),u=0;u=i[0]&&e<=i[3]&&t>=i[1]&&t<=i[4]&&n>=i[2]&&n<=i[5]}(r.x,r.y,r.z,i):function(e,t,n,i){var r=(e-i.cropCenter[0])*i.invRadiusX,a=(t-i.cropCenter[1])*i.invRadiusY,o=(n-i.cropCenter[2])*i.invRadiusZ;return r*r+a*a+o*o<=1}(r.x,r.y,r.z,i)}))}function x(e){var t=e.cropSize[0]/2,n=e.cropSize[1]/2,i=e.cropSize[2]/2,r=[e.cropCenter[0]-t,e.cropCenter[1]-n,e.cropCenter[2]-i,e.cropCenter[0]+t,e.cropCenter[1]+n,e.cropCenter[2]+i],a=b(e.cropRotation);return Object.assign(r,{invRotationMatrix:a,cropCenter:e.cropCenter})}function b(e){var t=[],n=e[0]*Math.PI/180,i=e[1]*Math.PI/180,r=e[2]*Math.PI/180,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r),h=a*u,d=a*c,f=o*u,v=o*c;return t[0]=s*u,t[1]=-s*c,t[2]=l,t[4]=d+f*l,t[5]=h-v*l,t[6]=-o*s,t[8]=v-h*l,t[9]=f+d*l,t[10]=a*s,t[12]=0,t[13]=0,t[14]=0,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}function w(e){var t=2/e.cropSize[0],n=2/e.cropSize[1],i=2/e.cropSize[2],r=b(e.cropRotation);return{invRadiusX:t,invRadiusY:n,invRadiusZ:i,cropCenter:e.cropCenter,invRotationMatrix:r}}e.onmessage=function(b){if(b.data.getCroppedIndexes){var S=new Uint32Array(function(e,t){for(var n=[],i=t.filter((function(e){return e.enabled&&"Include"===e.mode})).map((function(e){return"Box"===e.type?x(e):w(e)})),r=t.filter((function(e){return e.enabled&&"Exclude"===e.mode})).map((function(e){return"Box"===e.type?x(e):w(e)})),a=e.length,o=0;o1){t.exports.sortIndexes(r,a,u,o,s,l,d.DepthMapRange,i);var m=new Uint32Array(i);f=m.buffer,m.set(new Uint32Array(c,l,i))}else if(1===i){var g=new Uint32Array(i);g[0]=new Uint32Array(c,r,n)[0],f=g.buffer}else f=new ArrayBuffer(0);e.postMessage({sortDone:!0,indexesBuffer:f},[f])}(b.data.sort.view,b.data.sort.cameraPosition);else if(b.data.init){d=b.data.init.Constants,n=b.data.init.splatCount;var _=d.BytesPerInt,A=3*d.BytesPerFloat,M=new Uint8Array(b.data.init.sorterWasmBytes),E=n*(_+A)+(n*d.BytesPerInt*2+d.DepthMapRange*d.BytesPerInt*2)+32*d.MemoryPageSize,C=Math.floor(E/d.MemoryPageSize)+1,k={module:{},env:{memory:new WebAssembly.Memory({initial:2*C,maximum:3*C,shared:!0})}};WebAssembly.compile(M).then((function(e){return WebAssembly.instantiate(e,k)})).then((function(i){t=i,r=0,u=(o=(a=n*_)+n*A)+16*d.BytesPerFloat*2,s=u+n*d.BytesPerInt,l=s+d.DepthMapRange*d.BytesPerInt,c=k.env.memory.buffer,e.postMessage({sortSetupPhase1Complete:!0})}))}}}Z(VN,"DepthMapRange",65536),Z(VN,"MemoryPageSize",65536),Z(VN,"BytesPerFloat",4),Z(VN,"BytesPerInt",4);var GN=function(){var e=new Float32Array(1),t=new Int32Array(e.buffer);return function(n){return e[0]=n,t[0]}}(),HN=function(e,t,n,i){return e+(t<<8)+(n<<16)+(i<<24)},WN=new Dt;function qN(e){var t=!1;return e.scene.objects.traverse((function(e,n){if(!1===n.visible)return!0;"Splat"===n.type&&(t=!0)})),t}var XN,YN,QN,KN=function(e){(0,v.Z)(n,e);var t=T(n);function n(e,i,r,a){var o,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,u=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0;return(0,b.Z)(this,n),(o=t.call(this,r,a)).splatCount=i,o.meshIndexIntervals=u,o.meshMatrixWorlds=c,o.splatBuffers=e,o.geometry=r,o.material=a,o.splatDataTextures=null,o.halfPrecisionCovariancesOnGPU=s,o.devicePixelRatio=l,o.resetLocalSplatDataAndTexturesFromSplatBuffer(),o}return(0,w.Z)(n,[{key:"resetLocalSplatDataAndTexturesFromSplatBuffer",value:function(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}},{key:"updateLocalSplatDataFromSplatBuffer",value:function(){this.splatBuffers.forEach((function(e){return e.buildPreComputedBuffers()})),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);var e,t=0,n=0,i=0,r=D(this.splatBuffers);try{for(r.s();!(e=r.n()).done;){var a=e.value,o=a.nsplats;this.colors.subarray(t,t+4*o).set(a.colorsA),t+=4*o,this.centers.subarray(n,n+3*o).set(a.decoded.xyz.denormDequant().data),n+=3*o,this.covariances.subarray(i,i+6*o).set(new Float32Array(a.precomputedCovarianceBufferData)),i+=6*o}}catch(s){r.e(s)}finally{r.f()}}},{key:"allocateAndStoreLocalSplatDataInTextures",value:function(){for(var e=this.splatCount,t=new Dt(4096,1024);t.x*t.y*2<6*e;)t.y*=2;for(var n,i,r=new Dt(4096,1024);r.x*r.y*4<4*e;)r.y*=2;if(this.halfPrecisionCovariancesOnGPU){i=new Uint16Array(t.x*t.y*2);for(var a=0;a0&&(WN.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(WN),this.material.uniforms.basisViewport.value.set(2/WN.x,2/WN.y),this.material.uniforms.focal.value.set(t,n),this.material.uniforms.orthoZoom.value=i,this.material.uniformsNeedUpdate=!0)}},{key:"getSplatDataTextures",value:function(){return this.splatDataTextures}},{key:"getSplatCount",value:function(){return this.splatCount}},{key:"getCenters",value:function(){return this.centers}},{key:"getColors",value:function(){return this.colors}},{key:"getCovariances",value:function(){return this.covariances}},{key:"dispose",value:function(){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()}}],[{key:"buildMesh",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=n.buildGeomtery(t),l=n.buildMaterial(a);return new n(e,t,s,l,i,r,a,o)}},{key:"buildMaterial",value:function(e){var t={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new Dt},viewport:{type:"v2",value:new Dt},basisViewport:{type:"v2",value:new Dt},debugColor:{type:"v3",value:new Yt},covariancesTextureSize:{type:"v2",value:new Dt(1024,1024)},centersColorsTextureSize:{type:"v2",value:new Dt(1024,1024)},orthoZoom:{type:"f",value:-1}};return new ar({uniforms:t,vertexShader:"\n precision highp float;\n #include \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(offset)) / 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 bounding 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 \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})}},{key:"buildGeomtery",value:function(e){var t=new Fi;t.setIndex([0,1,2,0,2,3]);var n=new Float32Array(12),i=new Ci(n,3);t.setAttribute("position",i),i.setXYZ(0,-1,-1,0),i.setXYZ(1,-1,1,0),i.setXYZ(2,1,1,0),i.setXYZ(3,1,-1,0),i.needsUpdate=!0;var r=(new Eu).copy(t),a=new Uint32Array(e),o=new us(a,1,!1);return o.setUsage(35048),r.setAttribute("splatIndex",o),r.instanceCount=e,r}}]),n}(Ji),JN=new Promise((function(e){XN=e})),$N=!1;function eU(){if(!$N)return YN||(YN=function(){return e.apply(this,arguments)}());function e(){return(e=(0,c.Z)(x().mark((function e(){var t;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.e(10164).then(n.bind(n,10164));case 2:t=e.sent,XN(t),$N=!0;case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}}JN.then((function(e){return QN=e}));var tU=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,b.Z)(this,e),Z(this,"updateView",function(){var e=new Nn,t=[],n=new un(0,0,-1),i=new un(0,0,-1),r=new un,a=new un;return function(){var o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=arguments.length>1?arguments[1]:void 0,l=this.updateMatrixWorldsInWorkerIfNeeded(),u=this.cropsChanged();if(!o){i.set(0,0,-1).applyQuaternion(s.quaternion);var c=!1,h=!1;if(i.dot(n)<=.95&&(c=!0),a.copy(s.position).sub(r).length()>=1&&(h=!0),!c&&!h&&!l&&!u&&!this.needsInitialRender)return}this.needsInitialRender=!1,r.copy(s.position),n.copy(i),e.copy(s.matrixWorld).invert(),e.premultiply(this.dummyPerspectiveMatrix),t[0]=s.position.x,t[1]=s.position.y,t[2]=s.position.z;var d=k(k({sort:{view:e.elements,cameraPosition:t,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount}},l?{newMatrixWorlds:this.meshMatrixWorlds}:{}),u?{newCropsArray:this.cropsArray}:{});this.sortRunning?this.queuedMessage=d:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(d))}}()),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 Nn).makePerspective(-1,1,-1,1,.1,1e3)}return(0,w.Z)(e,[{key:"updateSplatMeshUniforms",value:function(e,t){var n=new Dt;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(e.getSize(n),this.cameraFocalLengthX=t.projectionMatrix.elements[0]*this.devicePixelRatio*n.x*.45,this.cameraFocalLengthY=t.projectionMatrix.elements[5]*this.devicePixelRatio*n.y*.45,this.splatMesh.updateUniforms(n,this.cameraFocalLengthX,this.cameraFocalLengthY,t.isPerspectiveCamera?-1:t.zoom*this.devicePixelRatio))}},{key:"loadSplat",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.activePage=this.scene.activePage,e.position&&(e.position=(new un).fromArray(e.position)),e.orientation&&(e.orientation=(new ln).fromArray(e.orientation)),e.halfPrecisionCovariances=!!e.halfPrecisionCovariances;var t=[];if(this.splatEntries=t,this.activePage.traverseVisibleEntity((function(e){"Splat"===e.data.type&&t.push(e)})),this.splatMesh&&this.splatMesh.dispose(),0===t.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=t.map((function(e){return e.matrixWorld})),this.meshMatrixWorldsOld=t.map((function(e){return e.matrixWorld.clone()})),this.cropsArray=t.map((function(e){return e.data.crops.map((function(e){return e.data}))}));var n,i=t.map((function(e){return new QN.GSplineBuffer(new Uint8Array(e.data.buffer).buffer)})),r=0,a=[0],o=D(i);try{for(o.s();!(n=o.n()).done;){var s=n.value;r+=s.getSplatCount(),a.push(r)}}catch(l){o.e(l)}finally{o.f()}return this.setupSplatMesh(i,r,e.position,e.orientation,e.halfPrecisionCovariances,this.devicePixelRatio,a,this.meshMatrixWorlds),this.setupSortWorker(r),!0}},{key:"updateMatrixWorldsInWorkerIfNeeded",value:function(){for(var e=this,t=this.splatDataTextures.meshMatrixWorlds.data,n=0;n2&&void 0!==arguments[2]?arguments[2]:new un,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ln,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0;this.splatMesh=KN.buildMesh(e,t,a,o,s,l),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=t,this.splatMesh.onBeforeRender=function(e,t,i){return n.update(e,i)}}},{key:"setupSortWorker",value:function(e){var t=this;this.sortWorker=function(e){for(var t=new Worker(URL.createObjectURL(new Blob(["(",jN.toString(),")(self)"],{type:"application/javascript"}))),n=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),i=new Uint8Array(n.length),r=0;r5&&void 0!==arguments[5]?arguments[5]:[];e.updateEntityByOp(t,n,i,r),this.traverseEntity((function(e){var o;(e instanceof tN||e instanceof HF)&&(a.includes(null!==(o=e.frameId)&&void 0!==o?o:"")||e.frameId===t)&&e.updateEntity2DByOp(t,n,i,r)}))}},{key:"switchActiveCamera",value:function(e){this.activePage.switchActiveCamera(e)}},{key:"isInvisibleObjects",value:function(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}},{key:"init",value:function(e,t){var n=Object.entries(t.data.lib.components).map((function(e,t){return{data:e[1].asset.data,children:e[1].asset.children,id:e[0],fi:t}}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:t}),this.add(this.invisibleObjects),this.createChildrenObjects(n,this.invisibleObjects,t),this.createChildrenObjects(e.objects,this,t),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(t,!0),this.traverseEntity((function(e){e instanceof ZR&&e.updateUp()})),this.doPendingExpandCloner({scene:this,shared:t}),this.applyPendingCommands()}},{key:"markNeedsRecomputeInstances",value:function(){this.needsRecomputeInstances=!0}},{key:"markNeedsRecomputeInstancesForChildren",value:function(e){var t=this;e.traverseEntity((function(e){("Component"===e.data.type||"Instance"===e.data.type)&&t.markNeedsRecomputeInstances()}))}},{key:"markNeedsRecomputeInstancesForAncessors",value:function(e){var t=this;BM.is(e)&&("Component"===e.data.type&&this.markNeedsRecomputeInstances(),e.traverseAncestors((function(e){BM.is(e)&&"Component"===e.data.type&&t.markNeedsRecomputeInstances()})))}},{key:"relativeizeInner",value:function(e,t,n,i,r,a,o){var s=this;if(e){var u=i.find(e);u&&u!==i&&r.forInstancesRec((function(i){i.data=Ig(i.data,(function(r){var u=r.events.data(o.id),c=i.goUp(a);if(c){var h=[].concat((0,l.Z)(rw(c.identity)),[e]).join("-"),d=s.entityIdentityToEntity[h];if(d){var f=d.uuid;Tg.zoom(u,t)[n]=f}else console.warn("cannot find instance")}})).data}))}}},{key:"rewriteActions",value:function(e,t,n,i,r,a){var o=this;e.forEach((function(e){"Transition"===e.data.type||"Animation"===e.data.type?o.relativeizeInner(e.data.object,[].concat((0,l.Z)(t),[e.id]),"object",n,i,r,a):"Conditional"===e.data.type&&(o.rewriteActions(e.data.ifActions,[].concat((0,l.Z)(t),[e.id,"ifActions"]),n,i,r,a),o.rewriteActions(e.data.elseActions,[].concat((0,l.Z)(t),[e.id,"elseActions"]),n,i,r,a))}))}},{key:"rewriteEventsBeforeGoToPlayMode",value:function(){var e=this;this.traverseEntity((function(t){if(t instanceof QF&&"string"==typeof t.identity&&"Component"===t.data.type)return t.traverseEntity((function(n,i){n.data.events.forEach((function(r){if("GameControl"===r.data.type){var a=!1;if(n.forInstancesRec((function(e){e.data=Ig(e.data,(function(t){e.isInstanceRoot||(t.events.delete(r.id),a=!0)})).data})),!1===a){var o,s=D(Lw.list);try{for(s.s();!(o=s.n()).done;){var l=o.value;e.rewriteActions(r.data.gameActions[l],["gameActions",l],t,n,i,r)}}catch(u){s.e(u)}finally{s.f()}}}else"Conditional"===r.data.type?("Distance"===r.data.condition.type?(e.relativeizeInner(r.data.condition.fromObject,["condition"],"fromObject",t,n,i,r),e.relativeizeInner(r.data.condition.toObject,["condition"],"toObject",t,n,i,r)):"State"===r.data.condition.type?e.relativeizeInner(r.data.condition.object,["condition"],"object",t,n,i,r):"Comparison"===r.data.condition.type&&("Property"===r.data.condition.lOperand.type&&e.relativeizeInner(r.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,n,i,r),"Property"===r.data.condition.rOperand.type&&e.relativeizeInner(r.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,n,i,r)),e.rewriteActions(r.data.inActions,["inActions"],t,n,i,r),e.rewriteActions(r.data.outActions,["outActions"],t,n,i,r)):"actions"in r.data&&e.rewriteActions(r.data.actions,["actions"],t,n,i,r)}))})),!0}))}},{key:"expandInstances",value:function(e,t,n){var i=this,r=new Set;this.traverseEntity((function(a){if(a instanceof QF&&a.isInstanceRoot)return a.expandInstanceChildren({scene:i,shared:e,pendingDeletes:r}),t||a.resetBBoxNeedsUpdate(),n&&a.traverseEntity((function(e){n.addClip(e)})),!0}));var a,o=D(r);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(s),KF(s)}}catch(l){o.e(l)}finally{o.f()}}},{key:"recomputeInstances",value:function(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity((function(e){e instanceof QF&&e.isInstanceRoot&&(e.component=void 0)})),this.expandInstances(e,!1,t))}},{key:"disposeAndUnregisterEntityRecursivelyIfNotReregistered",value:function(e){var t=this;e.traverseEntity((function(e){var n="string"==typeof e.identity?e.identity:e.identity.join("-");t.entityIdentityToEntity[n]===e&&(delete t.entityByUuid[e.uuid],delete t.entityIdentityToEntity[n]),e.dispose()}))}},{key:"clearScene",value:function(){var e,t=D(this.children);try{for(t.s();!(e=t.n()).done;){var n=e.value;BM.is(n)&&n.disposeRecursively()}}catch(i){t.e(i)}finally{t.f()}this.children.length=0}},{key:"resetAfterClear",value:function(e,t){this.init(e,t)}},{key:"raycast",value:function(e){return this.raycast1(e,!1)}},{key:"raycast1",value:function(e,t){var n=this,i=[];return function r(a){var o,s=D(a.children);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=l.cloner;if(BM.is(l)&&!l.raycastLock&&(l.visible||null!==u&&void 0!==u&&u.object.data.visible))if(!0===t&&l.isInstanceRoot){var c=[];if(e.intersectObject(l,!0,c),c.length){var h=c[0];h.object=l,h.point.applyMatrix4(h.object.matrixWorld);var d=l.matrixWorld.clone().invert();h.point.applyMatrix4(d),i.push(h)}}else(XR(l)||QR(l)&&n.enableHelpers&&l.objectHelper.visible)&&(e.intersectObject(l,!1,i),UN(l,e,i)),r(l)}}catch(f){s.e(f)}finally{s.f()}}(this.activePage),i}},{key:"raycastWithClones",value:function(e){var t=this,n=[];return function i(r){var a,o=D(r.children);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.cloner;BM.is(s)&&(s.visible||(null===l||void 0===l?void 0:l.object.data.visible))&&((XR(s)||QR(s)&&t.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,n),UN(s,e,n,!0)),i(s))}}catch(u){o.e(u)}finally{o.f()}}(this),n}},{key:"forEachEntity",value:function(e){var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;BM.is(i)&&e(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"traverseConcreteEntity",value:function(e){var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;BM.is(i)&&i.isConcreteEntity&&i.traverseEntity(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"traverseEntity",value:function(e){var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;BM.is(i)&&i.traverseEntity(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"updateFont",value:function(e,t){this.traverseEntity((function(n){if(n instanceof II&&"Mesh"===n.data.type&&("TextGeometry"===n.data.geometry.type||"InputGeometry"===n.data.geometry.type)&&n.data.geometry.font===e){var i=n.geometry,r=n.data.geometry;i.updateFont(e,t).then((function(){i.update(r,t);var e=n.invalidateDownstreamBooleanData();YR(e)&&e.recomputeBoolean()}))}}))}},{key:"traverseObject",value:function(e){var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;TM.is(i)&&i.traverseObject(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"traverseVisibleEntity",value:function(e){var t,n=D(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;BM.is(i)&&i.visible&&i.traverseVisibleEntity(e)}}catch(r){n.e(r)}finally{n.f()}}},{key:"dispose",value:function(){this.clearScene()}},{key:"createChildrenObjects",value:function(e,t,n){var i,r=0,a=D(e);try{for(a.s();!(i=a.n()).done;){var o=i.value;this.createObject(o.id,o.data,o.children,t,r,n),r+=1}}catch(s){a.e(s)}finally{a.f()}}},{key:"registerObjectCreatedInLegacy",value:function(e){this.entityByUuid[e.uuid]=e}},{key:"unregisterObject",value:function(e){delete this.entityByUuid[e.uuid];var t,n=D(e.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.unregisterObject(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"createObject",value:function(e,t,n,i,r,a){var o,s=this,l={scene:this,shared:a},u=gN(e,t,l);return u instanceof MN&&this.shapeBlendIntances.push(u),u&&(this.entityByUuid[e]=u,i.add(u),i.children.splice(r,0,i.children.pop()),n.length>0&&(u.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(n,u,a)),u.updateState(t,l),u instanceof II&&u.updateGeometryGroupsIfNeeded(),u.updateVisible(this),u.cloner&&this.toExpandCloner.add(u),null!==(o=t.pathSnapping)&&void 0!==o&&o.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),"Empty"===t.type&&t.animations&&u.traverseEntity((function(e){var t=e.dataPatched;if(e instanceof II&&t.bones&&t.boneInverses){var n=t.bones.map((function(e){return s.find(e)})),i=t.boneInverses.map((function(e){return(new Nn).fromArray(e)})),r=new ls(n,i);e.bind(r,e.bindMatrix)}else e.matrixAutoUpdate=!0})),u}},{key:"getCenter",value:function(e){for(var t=[],n=0,i=e.length;n2&&void 0!==arguments[2]&&arguments[2];this.traverseConcreteEntity((function(i){i instanceof ZR&&i.setViewplaneSize(e,t,n)}))}},{key:"initializeSplatViewer",value:function(){this.splatViewer=new tU({scene:this}),this.reloadSplats()}},{key:"reloadSplats",value:function(){var e;null===(e=this.splatViewer)||void 0===e||e.loadSplat()}},{key:"bgColor",get:function(){return this.activePage.bgColor}},{key:"postprocessing",get:function(){return this.activePage.data.postprocessing}},{key:"playPage",get:function(){var e;return null!==(e=this.find(this.data.publish.playPage))&&void 0!==e?e:this.errorPage}},{key:"activeCamera",get:function(){return this.activePage.activeCamera}}]),n}(es),aU=function(e,t){var n=t.x-e.x,i=t.y-e.y;return Math.sqrt(n*n+i*i)},oU=function(e){return e*(Math.PI/180)},sU=function(e){return e*(180/Math.PI)},lU=new Map,uU=function(e,t,n){for(var i,r=t.split(/[ ,]+/g),a=0;a=0&&n._handlers_[e].splice(n._handlers_[e].indexOf(t),1),n},AU.prototype.trigger=function(e,t){var n,i=this,r=e.split(/[ ,]+/g);i._handlers_=i._handlers_||{};for(var a=0;aa&&r<3*a&&!e.lockX?t="up":r>-a&&r<=a&&!e.lockY?t="left":r>3*-a&&r<=-a&&!e.lockX?t="down":e.lockY||(t="right"),e.lockY||(n=r>-o&&r0?"up":"down"),e.force>this.options.threshold){var s,l={};for(s in this.direction)this.direction.hasOwnProperty(s)&&(l[s]=this.direction[s]);var u={};for(s in this.direction={x:n,y:i,angle:t},e.direction=this.direction,l)l[s]===this.direction[s]&&(u[s]=!0);if(u.x&&u.y&&u.angle)return e;(!u.x||!u.y)&&this.trigger("plain",e),u.x||this.trigger("plain:"+n,e),u.y||this.trigger("plain:"+i,e),u.angle||this.trigger("dir dir:"+t,e)}else this.resetDirection();return e};var CU=EU;function kU(e,t){var n=this;n.nipples=[],n.idles=[],n.actives=[],n.ids=[],n.pressureIntervals={},n.manager=e,n.id=kU.id,kU.id+=1,n.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},n.config(t),("static"===n.options.mode||"semi"===n.options.mode)&&(n.options.multitouch=!1),n.options.multitouch||(n.options.maxNumberOfNipples=1);var i=getComputedStyle(n.options.zone.parentElement);return i&&"flex"===i.display&&(n.parentIsFlex=!0),n.updateBox(),n.prepareNipples(),n.bindings(),n.begin(),n.nipples}kU.prototype=new MU,kU.constructor=kU,kU.id=0,kU.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(e){if(void 0===e)return t[0];for(var n=0,i=t.length;n