run-scene-v2 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +1 -0
- package/package.json +13 -7
- package/index.js +0 -1
package/build/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("run-scene-core"),require("three"),require("@allex/md5"),require("postprocessing")):"function"==typeof define&&define.amd?define(["axios","js-funcs","run-scene-core","three","@allex/md5","postprocessing"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("run-scene-core"),require("three"),require("@allex/md5"),require("postprocessing")):e.RunScene=t(e.axios,e["js-funcs"],e["run-scene-core"],e.three,e["@allex/md5"],e.postprocessing)}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__5521__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__,__WEBPACK_EXTERNAL_MODULE__3243__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,n)=>{function r(e,t,n){t=s(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(r)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=s(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return He(e)||Ve(e)}function y(e){return(rt=D(e,nt))&&_n}function b(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(nt[e]=t)&&rt&&(rt[e]=t)||nt}function w(){return 0}function S(e,t,n){return(n=e[t])&&He(n)?e[t]():m(n)&&e.getAttribute&&e.getAttribute(t)||n}function _(e,t){(e=e.split(",")).forEach(t)}function T(e,t,n,r){st.length&>(),e.render(t,n,r),st.length&>()}function M(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function D(e,t){for(var n in t)e[n]=t[n];return e}function P(e,t){for(var n in t)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=Ge(t[n])?P(e[n]||(e[n]={}),t[n]):t[n]);return e}function k(e){var t,n=e.parent||le,r=e.keyframes?(t=qe(e.keyframes),function(e,n){for(var r in n)r in e||"duration"===r&&t||"ease"===r||(e[r]=n[r])}):vt;if(Ke(e.inherit))for(;n;)r(e,n.vars.defaults),n=n.parent||n._dp;return e}function O(e){return!e||e._ts&&O(e.parent)}function A(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function N(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function L(e,t){var n;if((t._time||t._initted&&!t._dur)&&(n=N(e.rawTime(),t),(!t._dur||W(0,t.totalDuration(),n)-t._tTime>Ie)&&t.render(n,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)0<=n.rawTime()&&n.totalTime(n._tTime),n=n._dp;e._zTime=-Ie}}function I(e,t,n,r){return t.parent&&xt(t),t._start=mt((We(n)?n:n||e!==le?V(e,n,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=4<arguments.length?arguments[4]:void 0,s=e[i];if(a)for(n=t[a];s&&s[a]>n;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),F(t)||(e._recent=t),r||L(e,t),e}function R(e,t){(nt.ScrollTrigger||it("scrollTrigger",t))&&nt.ScrollTrigger.create(t,e)}function U(e,t,n,r){return Zt(e,t),e._initted?!n&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Bt.frame?(st.push(e),e._lazy=[t,r]):void 0:1}function B(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||B(e))}function F(e){return"isFromStart"===(e=e.data)||"isStart"===e}function j(e,t,n,r){var i=e._repeat,a=mt(t)||0;return(t=e._tTime/e._tDur)&&!r&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:mt(a*(i+1)+e._rDelay*i):a,0<t&&!r?_t(e,e._tTime=e._tDur*t):e.parent&&St(e),n||wt(e.parent,e),e}function z(e){return e instanceof sn?wt(e):j(e,e._dur)}function V(e,t,n){var r,i,a,s=e.labels,o=e._recent||Tt,l=e.duration()>=Le?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(i=t.charAt(0),a="%"===t.substr(-1),r=t.indexOf("="),"<"===i||">"===i?(0<=r&&(t=t.replace(/=/,"")),("<"===i?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(a?(r<0?o:n).totalDuration()/100:1)):r<0?(t in s||(s[t]=l),s[t]):(i=parseFloat(t.charAt(r-1)+t.substr(r+1)),a&&n&&(i=i/100*(qe(n)?n[0]:n).totalDuration()),1<r?V(e,t.substr(0,r-1),n)+i:l+i)):null==t?l:+t}function H(e,t,n){var r,i,a=We(t[1]),s=(a?2:1)+(e<2?0:1),o=t[s];if(a&&(o.duration=t[1]),o.parent=n,e){for(r=o,i=n;i&&!("immediateRender"in r);)r=i.vars.defaults||{},i=Ke(i.vars.inherit)&&i.parent;o.immediateRender=Ke(r.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hn(t[0],o,t[1+s])}function W(e,t,n){return n<e?e:t<n?t:n}function G(e){if(He(e))return e;var t=Ge(e)?e:{each:e},n=Wt(t.ease),r=t.from||0,i=parseFloat(t.base)||0,a={},s=(e=0<r&&r<1,isNaN(r)||e),o=t.axis,l=r,u=r;return Ve(r)?l=u={center:.5,edges:.5,end:1}[r]||0:!e&&s&&(l=r[0],u=r[1]),function(e,c,d){var h,p,f,m,g,v,y,b,x=(d||t).length,w=a[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Le])[1])){for(v=-Le;v<(v=d[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=a[x]=[],h=s?Math.min(b,x)*l-.5:r%b,p=b===Le?0:s?x*u/b-.5:r/b|0,y=Le,g=v=0;g<x;g++)m=g%b-h,f=p-(g/b|0),w[g]=m=o?Math.abs("y"===o?f:m):Fe(m*m+f*f),v<m&&(v=m),m<y&&(y=m);"random"===r&&Ot(w),w.max=v-y,w.min=y,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<b?x-1:o?"y"===o?x/b:b:Math.max(b,x/b))||0)*("edges"===r?-1:1),w.b=x<0?i-x:i,w.u=Et(t.amount||t.each)||0,n=n&&x<0?Ht(n):n}return x=(w[e]-w.min)/w.max||0,mt(w.b+(n?n(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var r=Math.round(parseFloat(n)/e)*e*t;return(r-r%1)/t+(We(n)?0:Et(n))}}function Z(e,t){var n,r,i=qe(e);return!i&&Ge(e)&&(n=i=e.radius||Le,e.values?(e=kt(e.values),(r=!We(e[0]))&&(n*=n)):e=K(e.increment)),Mt(t,i?He(e)?function(t){return r=e(t),Math.abs(r-t)<=n?r:t}:function(t){for(var i,a,s=parseFloat(r?t.x:t),o=parseFloat(r?t.y:0),l=Le,u=0,c=e.length;c--;)(i=r?(i=e[c].x-s)*i+(a=e[c].y-o)*a:Math.abs(e[c]-s))<l&&(l=i,u=c);return u=!n||l<=n?e[u]:t,r||u===t||We(t)?u:u+Et(t)}:K(e))}function q(e,t,n,r){return Mt(qe(e)?!t:!0===n?!!(n=0):!r,(function(){return qe(e)?e[~~(Math.random()*e.length)]:(n=n||1e-5)&&(r=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+.99*n))/n)*n*r)/r}))}function X(e,t,n){return Mt(n,(function(n){return e[~~t(n)]}))}function Y(e,t,n,r,i){var a=t-e,s=r-n;return Mt(i,(function(t){return n+((t-e)/a*s||0)}))}function Q(e,t,n){var r,i,a,s=e.labels,o=Le;for(r in s)(i=s[r]-t)<0==!!n&&i&&o>(i=Math.abs(i))&&(a=r,o=i);return a}function J(e,t,n){var r=e.vars,i=r[t];i&&(t=r[t+"Params"],r=r.callbackScope||e,n&&st.length&>(),t?i.apply(r,t):i.call(r))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(e,"onInterrupt"),e}function ee(e,t,n){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(n-t)*e*6:e<.5?n:3*e<2?t+(n-t)*(2/3-e)*6:t)*Ct+.5|0}function te(e,t,n){var r,i,a,s,o="",l=(e+o).match(Rt),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=Lt(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),n&&(a=It(e),(r=n.c).join(o)!==a.c.join(o)))for(s=(i=e.replace(Rt,"1").split(Qe)).length-1;c<s;c++)o+=i[c]+(~r.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!i)for(s=(i=e.split(Rt)).length-1;c<s;c++)o+=i[c]+l[c];return o+i[s]}function ne(e,t){for(var n,r=e._first;r;)r instanceof sn?ne(r,t):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===t||(r.timeline?ne(r.timeline,t):(n=r._ease,r._ease=r._yEase,r._yEase=n,r._yoyo=t)),r=r._next}function re(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:r,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};_(e,(function(e){for(var t in jt[e]=nt[e]=i,jt[n=e.toLowerCase()]=r,i)jt[n+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=jt[e+"."+t]=i[t]}))}function ie(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ae(e,t,n){function r(e){return 1===e?1:i*Math.pow(2,-10*e)*ze((e-a)*s)+1}var i=1<=t?t:1,a=(s=(n||(e?.3:.45))/(t<1?t:1))/Re*(Math.asin(1/i)||0),s=(n="out"===e?r:"in"===e?function(e){return 1-r(1-e)}:ie(r),Re/s);return n.config=function(t,n){return ae(e,t,n)},n}function se(e){function t(e){return e?--e*e*((n+1)*e+n)+1:0}var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,r="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ie(t);return r.config=function(t){return se(e,t)},r}n.d(t,{Q3:()=>hn});var oe,le,ue,ce,de,he,pe,fe,me,ge,ve,ye,be,xe,we,Se,_e,Te,Me,Ee,De,Pe,ke,Oe,Ae,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Ne={duration:.5,overwrite:!1,delay:0},Le=1e8,Ie=1/Le,Re=2*Math.PI,Ue=Re/4,Be=0,Fe=Math.sqrt,je=Math.cos,ze=Math.sin,Ve=function(e){return"string"==typeof e},He=function(e){return"function"==typeof e},We=function(e){return"number"==typeof e},Ge=function(e){return"object"==f(e)},Ke=function(e){return!1!==e},Ze="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},qe=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Ye=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Qe=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,nt={},rt={},it=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},at={},st=[],ot={},lt={},ut={},ct=30,dt=[],ht="",pt=function(e){var t,n,r=e[0];if(Ge(r)||He(r)||(e=[e]),!(t=(r._gsap||{}).harness)){for(n=dt.length;n--&&!dt[n].targetTest(r););t=dt[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new rn(e[n],t)))||e.splice(n,1);return e},ft=function(e){return e._gsap||pt(kt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,n=st.length,r=st.slice(0);for(ot={},e=st.length=0;e<n;e++)(t=r[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},yt=function(e,t){var n,r={};for(n in e)n in t||(r[n]=e[n]);return r},bt=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,a=t._next;i?i._next=a:e[n]===t&&(e[n]=a),a?a._prev=i:e[r]===t&&(e[r]=i),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},_t=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=mt(n._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),n._dirty||wt(n,e)),e},Tt={_start:0,endTime:w,totalDuration:w},Mt=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},Dt=[].slice,Pt=function(e,t){return e&&Ge(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Ge(e[0]))&&!e.nodeType&&e!==ue},kt=function(e,t,n){return!Ve(e)||n||!ce&&Ft()?qe(e)?function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||Pt(e,1)?n.push.apply(n,h(kt(e))):n.push(e)}))||n}(e,n):Pt(e)?Dt.call(e,0):e?[e]:[]:Dt.call((t||de).querySelectorAll(e),0)},Ot=function(e){return e.sort((function(){return.5-Math.random()}))},At=function(e){for(var t,n,r,i,a=0,s="";~(t=e.indexOf("random(",a));)r=e.indexOf(")",t),i="["===e.charAt(t+7),n=e.substr(t+7,r-t-7).match(i?et:Xe),s+=e.substr(a,t-a)+q(i?n:+n[0],i?0:+n[1],+n[2]||1e-5),a=r+1;return s+e.substr(a,e.length-a)},Ct=255,Nt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Lt=function(e,t,n){var r,i,a,s,o,l,u,c=e?We(e)?[e>>16,e>>8&Ct,e&Ct]:0:Nt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Nt[e])c=Nt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(r=e.charAt(1))+r+(i=e.charAt(2))+i+(a=e.charAt(3))+a+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Ct,c&Ct,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Xe),t){if(~e.indexOf("="))return c=e.match(Ye),n&&c.length<4&&(c[3]=1),c}else s=+c[0]%360/360,o=+c[1]/100,r=2*(l=+c[2]/100)-(i=l<=.5?l*(o+1):l+o-l*o),3<c.length&&(c[3]*=1),c[0]=ee(s+1/3,r,i),c[1]=ee(s,r,i),c[2]=ee(s-1/3,r,i);else c=e.match(Xe)||Nt.transparent;c=c.map(Number)}return t&&!u&&(r=c[0]/Ct,i=c[1]/Ct,a=c[2]/Ct,l=((e=Math.max(r,i,a))+(t=Math.min(r,i,a)))/2,e===t?s=o=0:(u=e-t,o=.5<l?u/(2-e-t):u/(e+t),s=e===r?(i-a)/u+(i<a?6:0):e===i?(a-r)/u+2:(r-i)/u+4,s*=60),c[0]=~~(s+.5),c[1]=~~(100*o+.5),c[2]=~~(100*l+.5)),n&&c.length<4&&(c[3]=1),c},It=function(e){var t=[],n=[],r=-1;return e.split(Rt).forEach((function(e){e=e.match(Qe)||[],t.push.apply(t,h(e)),n.push(r+=e.length+1)})),t.c=n,t},Rt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Nt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ut=/hsl[a]?\(/,Bt=(we=Date.now,Se=500,_e=33,Te=we(),Me=Te,De=Ee=1e3/240,ke={time:0,frame:0,tick:function(){Gt(!0)},deltaRatio:function(e){return be/(1e3/(e||60))},wake:function(){he&&(!ce&&g()&&(ue=ce=window,de=ue.document||{},nt.gsap=_n,(ue.gsapVersions||(ue.gsapVersions=[])).push(_n.version),y(rt||ue.GreenSockGlobals||!ue.gsap&&ue||{}),ye=ue.requestAnimationFrame),ge&&ke.sleep(),ve=ye||function(e){return setTimeout(e,De-1e3*ke.time+1|0)},me=1,Gt(2))},sleep:function(){(ye?ue.cancelAnimationFrame:clearTimeout)(ge),me=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,_e=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),De=1e3*ke.time+Ee},add:function(e){Pe.indexOf(e)<0&&Pe.push(e),Ft()},remove:function(e,t){~(t=Pe.indexOf(e))&&Pe.splice(t,1)&&t<=xe&&xe--},_listeners:Pe=[]}),Ft=function(){return!me&&Bt.wake()},jt={},zt=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Ht=function(e){return function(t){return 1-e(1-t)}},Wt=function(e,t){return e&&(He(e)?e:jt[e]||function(e){var t,n,r,i=(e+"").split("("),a=jt[i[0]];return a&&1<i.length&&a.config?a.config.apply(null,~e.indexOf("{")?[function(e){for(var t,n,r,i={},a=e.substr(1,e.length-3).split(":"),s=a[0],o=1,l=a.length;o<l;o++)n=a[o],t=o!==l-1?n.lastIndexOf(","):n.length,r=n.substr(0,t),i[s]=isNaN(r)?r.replace(Vt,"").trim():+r,s=n.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,n=i.indexOf(")"),r=i.indexOf("(",t),i.substring(t,~r&&r<n?i.indexOf(")",n+1):n).split(",").map(M))):jt._CE&&zt.test(e)?jt._CE("",e):a}(e))||t};function Gt(e){var t,n,r,i=we()-Me,a=!0===e;if(Se<i&&(Te+=i-_e),(0<(i=(n=(Me+=i)-Te)-De)||a)&&(r=++ke.frame,be=n-1e3*ke.time,ke.time=n/=1e3,De+=i+(Ee<=i?4:Ee-i),t=1),a||(ge=ve(Gt)),t)for(xe=0;xe<Pe.length;xe++)Pe[xe](n,be,r,e)}function Kt(e){return e<Ae?Oe*e*e:e<.7272727272727273?Oe*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Oe*(e-=2.25/2.75)*e+.9375:Oe*Math.pow(e-2.625/2.75,2)+.984375}function Zt(e,t){var n,r,i,a,s,o,l,u,c,d,h,p,f,m=e.vars,g=m.ease,v=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,_=m.runBackwards,T=m.yoyoEase,M=m.keyframes,E=m.autoRevert,D=e._dur,P=e._startAt,k=e._targets,O=e.parent,A=O&&"nested"===O.data?O.parent._targets:k,C="auto"===e._overwrite&&!oe,N=e.timeline;if(e._ease=Wt(g=!N||M&&g?g:"none",Ne.ease),e._yEase=T?Ht(Wt(!0===T?g:T,Ne.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!N&&!!m.runBackwards,!N||M&&!m.stagger){if(p=(u=k[0]?ft(k[0]).harness:0)&&m[u.prop],n=yt(m,at),P&&xt(P.render(-1,!0)),v)if(xt(e._startAt=hn.set(k,vt({data:"isStart",overwrite:!1,parent:O,immediateRender:!0,lazy:Ke(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!y&&!E&&e._startAt.render(-1,!0),y){if(0<t&&!E&&(e._startAt=0),D&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(_&&D)if(P)E||(e._startAt=0);else if(i=vt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:O},n),p&&(i[u.prop]=p),xt(e._startAt=hn.set(k,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Zt(e._startAt,Ie);for(e._pt=0,b=D&&Ke(b)||b&&!D,r=0;r<k.length;r++){if(l=(s=k[r])._gsap||pt(k)[r]._gsap,e._ptLookup[r]=d={},ot[l.id]&&st.length&>(),h=A===k?r:A.indexOf(s),u&&!1!==(c=new u).init(s,p||n,e,h,A)&&(e._pt=a=new xn(e._pt,s,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){d[e]=a})),c.priority&&(o=1)),!u||p)for(i in n)lt[i]&&(c=un(i,n,e,h,s,A))?c.priority&&(o=1):d[i]=a=ln.call(e,s,i,"get",n[i],h,A,0,m.stringFilter);e._op&&e._op[r]&&e.kill(s,e._op[r]),C&&e._pt&&(nn=e,le.killTweensOf(s,d,e.globalTime(t)),f=!e.parent,nn=0),e._pt&&b&&(ot[l.id]=1)}o&&bn(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,M&&t<=0&&N.render(Le,!0,!0)}function qt(e,t,n,r,i){return He(e)?e.call(t,n,r,i):Ve(e)&&~e.indexOf("random(")?At(e):e}function Xt(e,t,n){return e.setAttribute(t,n)}function Yt(e,t){var n=t._pt,r="";if(!e&&t.b)r=t.b;else if(1===e&&t.e)r=t.e;else{for(;n;)r=n.p+(n.m?n.m(n.s+n.c*e):Math.round(1e4*(n.s+n.c*e))/1e4)+r,n=n._next;r+=t.c}t.set(t.t,t.p,r,t)}function Qt(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next}function Jt(e,t,n,r){for(var i,a=this._pt;a;)i=a._next,a.p===r&&a.modifier(e,t,n),a=i}function $t(e){for(var t,n,r=this._pt;r;)n=r._next,r.p===e&&!r.op||r.op===e?bt(this,r,"_pt"):r.dep||(t=1),r=n;return!t}function en(e,t,n,r){r.mSet(e,t,r.m.call(r.tween,n,r.mt),r)}function tn(e,t){return{name:e,rawVars:1,init:function(e,n,r){r._onInit=function(e){var r,i;if(Ve(n)&&(r={},_(n,(function(e){return r[e]=1})),n=r),t){for(i in r={},n)r[i]=t(n[i]);n=r}var a,s,o,l=e,u=n,c=l._targets;for(a in u)for(s=c.length;s--;)(o=(o=l._ptLookup[s][a])&&o.d)&&(o._pt&&(o=Sn(o,a)),o&&o.modifier&&o.modifier(u[a],l,c[s],a))}}}}_("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var n=t<5?t+1:t;re(e+",Power"+(n-1),t?function(e){return Math.pow(e,n)}:function(e){return e},(function(e){return 1-Math.pow(1-e,n)}),(function(e){return e<.5?Math.pow(2*e,n)/2:1-Math.pow(2*(1-e),n)/2}))})),jt.Linear.easeNone=jt.none=jt.Linear.easeIn,re("Elastic",ae("in"),ae("out"),ae()),Oe=7.5625,Ae=1/2.75,re("Bounce",(function(e){return 1-Kt(1-e)}),Kt),re("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),re("Circ",(function(e){return-(Fe(1-e*e)-1)})),re("Sine",(function(e){return 1===e?1:1-je(e*Ue)})),re("Back",se("in"),se("out"),se()),jt.SteppedEase=jt.steps=nt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,n=1/e,r=e+(t?0:1),i=t?1:0,a=1-Ie;return function(e){return((r*W(0,a,e)|0)+i)*n}}},Ne.ease=jt["quad.out"],_("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return ht+=e+","+e+"Params,"}));var nn,rn=c((function e(t,n){d(this,e),this.id=Be++,(t._gsap=this).target=t,this.harness=n,this.get=n?n.get:S,this.set=n?n.getSetter:gn})),an=function(){function e(t){d(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,j(this,+t.duration,1,1),this.data=t.data,me||Bt.wake()}return c(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,j(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Ft(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(_t(this,e),n._dp&&!n.parent&&L(n,this);n&&n.parent;)n.parent._time!==n._start+(0<=n._ts?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+A(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+A(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*n,t):this._repeat?C(this._tTime,n)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?N(this.parent._time,this):this._tTime,n=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(W(-this._delay,this._tDur,t),!0)).parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ft(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ie&&(this._tTime-=Ie)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||I(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Ke(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?N(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,n=arguments.length?e:t.rawTime();t;)n=t._start+n/(t._ts||1),t=t._dp;return n}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,z(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,z(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(V(this,e),Ke(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Ke(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-Ie))}},{key:"eventCallback",value:function(e,t,n){var r=this.vars;return 1<arguments.length?(t?(r[e]=t,n&&(r[e+"Params"]=n),"onUpdate"===e&&(this._onUpdate=t)):delete r[e],this):r[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(n){function r(){var e=t.then;t.then=null,He(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),n(i),t.then=e}var i=He(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?r():t._prom=r}))}},{key:"kill",value:function(){$(this)}}]),e}(),sn=(vt(an.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Ie,_prom:0,_ps:!1,_rts:1}),function(){function e(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=1<arguments.length?arguments[1]:void 0;return d(this,e),(t=r(this,e,[n])).labels={},t.smoothChildTiming=!!n.smoothChildTiming,t.autoRemoveChildren=!!n.autoRemoveChildren,t._sort=Ke(n.sortChildren),le&&I(n.parent||le,i(t),a),n.reversed&&t.reverse(),n.paused&&t.paused(!0),n.scrollTrigger&&R(i(t),n.scrollTrigger),t}return o(e,an),c(e,[{key:"to",value:function(e,t,n){return H(0,arguments,this),this}},{key:"from",value:function(e,t,n){return H(1,arguments,this),this}},{key:"fromTo",value:function(e,t,n,r){return H(2,arguments,this),this}},{key:"set",value:function(e,t,n){return t.duration=0,t.parent=this,k(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hn(e,t,V(this,n),1),this}},{key:"call",value:function(e,t,n){return I(this,hn.delayedCall(0,e,t),n)}},{key:"staggerTo",value:function(e,t,n,r,i,a,s){return n.duration=t,n.stagger=n.stagger||r,n.onComplete=a,n.onCompleteParams=s,n.parent=this,new hn(e,n,V(this,i)),this}},{key:"staggerFrom",value:function(e,t,n,r,i,a,s){return n.runBackwards=1,k(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,r,i,a,s)}},{key:"staggerFromTo",value:function(e,t,n,r,i,a,s,o){return r.startAt=n,k(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,i,a,s,o)}},{key:"render",value:function(e,t,n){var r,i,a,s,o,l,u,c,d,h,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,g=e<=0?0:mt(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((g=this!==le&&f<g&&0<=e?f:g)!==this._tTime||n||v){if(p!==this._time&&m&&(g+=this._time-p,e+=this._time-p),r=g,c=this._start,o=!(u=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,n);if(r=mt(g%s),g===f?(a=this._repeat,r=m):((a=~~(g/s))&&a===g/s&&(r=m,a--),m<r&&(r=m)),d=C(this._tTime,s),v&&1&a&&(r=m-r,h=1),a!==(d=!p&&this._tTime&&d!==a?a:d)&&!this._lock){var y=v&&1&d;if(v=y===(v&&1&a),p=(y=a<d?!y:y)?0:m,this._lock=1,this.render(p||(h?0:mt(a*s)),t,!m)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!h&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,v&&(this._lock=2,this.render(p=y?m:-1e-4,!0),this.vars.repeatRefresh&&!h&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;ne(this,h)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,n){var r;if(t<n)for(r=e._first;r&&r._start<=n;){if("isPause"===r.data&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=n;){if("isPause"===r.data&&r._start<t)return r;r=r._prev}}(this,mt(p),mt(r)))&&(g-=r-(r=l._start)),this._tTime=g,this._time=r,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&r&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=r&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||r>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(r-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(r-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!o){l=0,i&&(g+=this._zTime=-Ie);break}}b=i}else for(var b=this._last,x=e<0?e:r;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!o){l=0,i&&(g+=this._zTime=x?-Ie:Ie);break}}b=i}if(l&&!t&&(this.pause(),l.render(p<=r?0:-Ie)._zTime=p<=r?1:-1,this._ts))return this._start=c,St(this),this.render(e,t,n);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===f&&f>=this.totalDuration()||!g&&p)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(g===f&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&f||(J(this,g===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var n=this;if(We(t)||(t=V(this,t,e)),!(e instanceof an)){if(qe(e))return e.forEach((function(e){return n.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!He(e))return this;e=hn.delayedCall(0,e)}return this!==e?I(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Le,i=[],a=this._first;a;)a._start>=r&&(a instanceof hn?t&&i.push(a):(n&&i.push(a),e&&i.push.apply(i,h(a.getChildren(!0,t,n))))),a=a._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),n=t.length;n--;)if(t[n].vars.id===e)return t[n]}},{key:"remove",value:function(e){return Ve(e)?this.removeLabel(e):He(e)?this.killTweensOf(e):(bt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(t,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Bt.time-(0<this._ts?t/this._ts:(this.totalDuration()-t)/-this._ts))),a(s(e.prototype),"totalTime",this).call(this,t,n),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=V(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,n){return(t=hn.delayedCall(0,t||w,n)).data="isPause",this._hasPause=1,I(this,t,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,n){for(var r=this.getTweensOf(e,n),i=r.length;i--;)nn!==r[i]&&r[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var n,r=[],i=kt(e),a=this._first,s=We(t);a;)a instanceof hn?function(e,t){for(var n=t.length,r=0;e.indexOf(t[r])<0&&++r<n;);return r<n}(a._targets,i)&&(s?(!nn||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&r.push(a):(n=a.getTweensOf(i,t)).length&&r.push.apply(r,h(n)),a=a._next;return r}},{key:"tweenTo",value:function(e,t){t=t||{};var n,r=this,i=V(r,e),a=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,hn.to(r,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale())||Ie,onStart:function(){var e;r.pause(),n||(e=t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale()),l._dur!==e&&j(l,e,0,1).render(l._time,!0,!0),n=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,n){return this.tweenTo(t,vt({startAt:{time:V(this,e)}},n))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Q(this,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Q(this,V(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ie)}},{key:"shiftChildren",value:function(e,t){for(var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,a=this.labels;i;)i._start>=r&&(i._start+=e,i._end+=e),i=i._next;if(t)for(n in a)a[n]>=r&&(a[n]+=e);return wt(this)}},{key:"invalidate",value:function(){var t=this._first;for(this._lock=0;t;)t.invalidate(),t=t._next;return a(s(e.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,n,r,i=0,a=this,s=a._last,o=Le;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-e:e));if(a._dirty){for(r=a.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,I(a,s,n-s._delay,1)._lock=0):o=n,n<0&&s._ts&&(i-=n,(!r&&!a._dp||r&&r.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-1/0),o=0),s._end>i&&s._ts&&(i=s._end),s=t;j(a,a===le&&a._time>i?a._time:i,1,1),a._dirty=0}return a._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,N(e,le)),pe=Bt.frame),Bt.frame>=ct){ct+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&Bt._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Bt.sleep()}}}}]),e}()),on=(vt(sn.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,n,r,i,a,s){var o,l,u,c,d,h=new xn(this._pt,e,t,0,1,Yt,null,i),p=0,f=0;for(h.b=n,h.e=r,n+="",(i=~(r+="").indexOf("random("))&&(r=At(r)),a&&(a(a=[n,r],e,t),n=a[0],r=a[1]),o=n.match(Je)||[];c=Je.exec(r);)u=c[0],c=r.substring(p,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==o[f++]&&(d=parseFloat(o[f-1])||0,h._pt={_next:h._pt,p:c||1===f?c:",",s:d,c:"="===u.charAt(1)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-d,m:l&&l<4?Math.round:0},p=Je.lastIndex);return h.c=p<r.length?r.substring(p,r.length):"",h.fp=s,($e.test(r)||i)&&(h.e=0),this._pt=h}),ln=function(e,t,n,r,i,a,s,o,l){var u;if(He(r)&&(r=r(i||0,e,a)),i=e[t],a="get"!==n?n:He(i)?l?e[t.indexOf("set")||!He(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,n=He(i)?l?mn:fn:pn,Ve(r)&&"="===(r=~r.indexOf("random(")?At(r):r).charAt(1)&&(!(u=parseFloat(a)+parseFloat(r.substr(2))*("-"===r.charAt(0)?-1:1)+(Et(a)||0))&&0!==u||(r=u)),a!==r)return isNaN(a*r)||""===r?(i||t in e||it(t,r),on.call(this,e,t,a,r,n,o||Ce.stringFilter,l)):(u=new xn(this._pt,e,t,+a||0,r-(a||0),"boolean"==typeof i?yn:vn,0,n),l&&(u.fp=l),s&&u.modifier(s,this,e),this._pt=u)},un=function(e,t,n,r,i,a){var s,o,l,u;if(lt[e]&&!1!==(s=new lt[e]).init(i,s.rawVars?t[e]:function(e,t,n,r,i){if(He(e)&&(e=qt(e,i,t,n,r)),!Ge(e)||e.style&&e.nodeType||qe(e)||Ze(e))return Ve(e)?qt(e,i,t,n,r):e;var a,s={};for(a in e)s[a]=qt(e[a],i,t,n,r);return s}(t[e],r,i,a,n),n,r,a)&&(n._pt=o=new xn(n._pt,i,e,0,1,s.render,s,0,s.priority),n!==fe))for(l=n._ptLookup[n._targets.indexOf(i)],u=s._props.length;u--;)l[s._props[u]]=o;return s},cn=ht+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",dn={},hn=(_(cn+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return dn[e]=1})),function(){function e(t,n,a,s){d(this,e),"number"==typeof n&&(a.duration=n,n=a,a=null);var o,l,u,c,h,p,f,m,g,y=(s=(o=r(this,e,[s?n:k(n)])).vars).duration,x=s.delay,w=s.immediateRender,S=s.stagger,_=s.overwrite,T=s.keyframes,M=s.defaults,E=s.scrollTrigger,P=s.yoyoEase,A=(s=n.parent||le,(qe(t)||Ze(t)?We(t[0]):"length"in n)?[t]:kt(t));if(o._targets=A.length?pt(A):b("GSAP target "+t+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=_,T||S||v(y)||v(x)){if(n=o.vars,(l=o.timeline=new sn({data:"nested",defaults:M||{}})).kill(),l.parent=l._dp=i(o),l._start=0,S||v(y)||v(x)){if(h=A.length,m=S&&G(S),Ge(S))for(p in S)~cn.indexOf(p)&&((g=g||{})[p]=S[p]);for(u=0;u<h;u++)(c=yt(n,dn)).stagger=0,P&&(c.yoyoEase=P),g&&D(c,g),f=A[u],c.duration=+qt(y,i(o),u,f,A),c.delay=(+qt(x,i(o),u,f,A)||0)-o._delay,!S&&1===h&&c.delay&&(o._delay=x=c.delay,o._start+=x,c.delay=0),l.to(f,c,m?m(u,f,A):0),l._ease=jt.none;l.duration()?y=x=0:o.timeline=0}else if(T){k(vt(l.vars.defaults,{ease:"none"})),l._ease=Wt(T.ease||n.ease||"none");var C,N,L,U=0;if(qe(T))T.forEach((function(e){return l.to(A,e,">")}));else{for(p in c={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,n,r){var i,a,s=t.ease||r||"power1.inOut";if(qe(t))a=n[e]||(n[e]=[]),t.forEach((function(e,n){return a.push({t:n/(t.length-1)*100,v:e,e:s})}));else for(i in t)a=n[i]||(n[i]=[]),"ease"!==i&&a.push({t:parseFloat(e),v:t[i],e:s})}(p,T[p],c,T.easeEach);for(p in c)for(C=c[p].sort((function(e,t){return e.t-t.t})),U=0,u=0;u<C.length;u++)(L={ease:(N=C[u]).e,duration:(N.t-(u?C[u-1].t:0))/100*y})[p]=N.v,l.to(A,L,U),U+=L.duration;l.duration()<y&&l.to({},{duration:y-l.duration()})}}y||o.duration(y=l.duration())}else o.timeline=0;return!0!==_||oe||(nn=i(o),le.killTweensOf(A),nn=0),I(s,i(o),a),n.reversed&&o.reverse(),n.paused&&o.paused(!0),(w||!y&&!T&&o._start===mt(s._time)&&Ke(w)&&O(i(o))&&"nested"!==s.data)&&(o._tTime=-Ie,o.render(Math.max(0,-x))),E&&R(i(o),E),o}return o(e,an),c(e,[{key:"render",value:function(e,t,n){var r,i,a=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){if(l!==this._tTime||!e||n||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(d=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*d+e,t,n);if(m=mt(l%d),l===s?(v=this._repeat,m=o):((v=~~(l/d))&&v===l/d&&(m=o,v--),o<m&&(m=o)),(p=this._yoyo&&1&v)&&(h=this._yEase,m=o-m),y=C(this._tTime,d),m===a&&!n&&this._initted)return this;v!==y&&(f&&this._yEase&&ne(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=n=1,this.render(mt(d*v),!0).invalidate()._lock=0))}if(!this._initted){if(U(this,e<0?e:m,n,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,n)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(h||this._ease)(m/o),this._from&&(this.ratio=i=1-i),m&&!a&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(r=this._pt;r;)r.r(i,r.d),r=r._next;f&&f.render(e<0?e:!m&&p?-Ie:f._dur*f._ease(m/this._dur),t,n)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,n),J(this,"onUpdate")),this._repeat&&v!==y&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!a||!l&&!a||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var u,c,d=this,h=e,p=t,f=n,m=d.ratio,g=h<0||!h&&(!d._start&&B(d)&&(d._initted||!F(d))||(d._ts<0||d._dp._ts<0)&&!F(d))?0:1,v=d._rDelay,y=0;if(v&&d._repeat&&(c=C(y=W(0,d._tDur,h),v),d._yoyo&&1&c&&(g=1-g),c!==C(d._tTime,v)&&(m=1-g,d.vars.repeatRefresh&&d._initted&&d.invalidate())),g!==m||f||d._zTime===Ie||!h&&d._zTime){if(d._initted||!U(d,h,f,p)){for(c=d._zTime,d._zTime=h||(p?Ie:0),p=p||h&&!c,d.ratio=g,d._from&&(g=1-g),d._time=0,d._tTime=y,u=d._pt;u;)u.r(g,u.d),u=u._next;d._startAt&&h<0&&d._startAt.render(h,!0,!0),d._onUpdate&&!p&&J(d,"onUpdate"),y&&d._repeat&&!p&&d.parent&&J(d,"onRepeat"),(h>=d._tDur||h<0)&&d.ratio===g&&(g&&xt(d,1),p||(J(d,g?"onComplete":"onReverseComplete",!0),d._prom&&d._prom()))}}else d._zTime||(d._zTime=h)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),a(s(e.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return h=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,nn&&!0!==nn.vars.overwrite)._first||$(this),this.parent&&h!==this.timeline.totalDuration()&&j(this,this._dur*this.timeline._tDur/h,0,1),this;var n,r,i,a,s,o,l,u=this._targets,c=e?kt(e):u,d=this._ptLookup,h=this._pt;if((!t||"all"===t)&&function(e,t){for(var n=e.length,r=n===t.length;r&&n--&&e[n]===t[n];);return n<0}(u,c))return"all"===t&&(this._pt=0),$(this);for(n=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},_(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var n,r,i,a,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(r in n=D({},t),s)if(r in n)for(i=(a=s[r].split(",")).length;i--;)n[a[i]]=n[r];return n}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(s in r=d[l],"all"===t?(n[l]=t,a=r,i={}):(i=n[l]=n[l]||{},a=t),a)(o=r&&r[s])&&("kill"in o.d&&!0!==o.d.kill(s)||bt(this,o,"_pt"),delete r[s]),"all"!==i&&(i[s]=1);return this._initted&&!this._pt&&h&&$(this),this}}],[{key:"to",value:function(t,n){return new e(t,n,arguments[2])}},{key:"from",value:function(e,t){return H(1,arguments)}},{key:"delayedCall",value:function(t,n,r,i){return new e(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:n,onReverseComplete:n,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})}},{key:"fromTo",value:function(e,t,n){return H(2,arguments)}},{key:"set",value:function(t,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new e(t,n)}},{key:"killTweensOf",value:function(e,t,n){return le.killTweensOf(e,t,n)}}]),e}()),pn=(vt(hn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),_("staggerTo,staggerFrom,staggerFromTo",(function(e){hn[e]=function(){var t=new sn,n=Dt.call(arguments,0);return n.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,n)}})),function(e,t,n){return e[t]=n}),fn=function(e,t,n){return e[t](n)},mn=function(e,t,n,r){return e[t](r.fp,n)},gn=function(e,t){return He(e[t])?fn:m(e[t])&&e.setAttribute?Xt:pn},vn=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},yn=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},bn=function(e){for(var t,n,r,i,a=e._pt;a;){for(t=a._next,n=r;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:i)?a._prev._next=a:r=a,(a._next=n)?n._prev=a:i=a,a=t}e._pt=r},xn=function(){function e(t,n,r,i,a,s,o,l,u){d(this,e),this.t=n,this.s=i,this.c=a,this.p=r,this.r=s||vn,this.d=o||this,this.set=l||pn,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,n){this.mSet=this.mSet||this.set,this.set=en,this.m=e,this.mt=n,this.tween=t}}]),e}(),wn=(_(ht+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return at[e]=1})),nt.TweenMax=nt.TweenLite=hn,nt.TimelineLite=nt.TimelineMax=sn,le=new sn({sortChildren:!1,defaults:Ne,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Rt.lastIndex=0,Rt.test(t))return t=Ut.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,It(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,n=He(e),r=(n=t&&!n&&e.init?function(){this._props=[]}:e,{init:w,render:Qt,add:ln,kill:$t,modifier:Jt,rawVars:0}),i={targetTest:0,get:0,getSetter:gn,aliases:{},register:0};if(Ft(),e!==n){if(lt[t])return;vt(n,vt(yt(e,r),i)),D(n.prototype,D(r,yt(e,i))),lt[n.prop=t]=n,e.targetTest&&(dt.push(n),at[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,n),e.register&&e.register(_n,n,xn)}))},timeline:function(e){return new sn(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,n,r){Ve(e)&&(e=kt(e)[0]);var i=ft(e||{}).get,a=n?E:M;return"native"===n&&(n=""),e&&(t?a((lt[t]&<[t].get||i)(e,t,n,r)):function(t,n,r){return a((lt[t]&<[t].get||i)(e,t,n,r))})},quickSetter:function(e,t,n){var r,i;if(1<(e=kt(e)).length)return r=e.map((function(e){return _n.quickSetter(e,t,n)})),i=r.length,function(e){for(var t=i;t--;)r[t](e)};e=e[0]||{};var a=lt[t],s=ft(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=a?function(t){var r=new a;fe._pt=0,r.init(e,n?t+n:t,fe,0,[e]),r.render(1,r),fe._pt&&Qt(1,fe)}:s.set(e,o);return a?l:function(t){return l(e,o,n?t+n:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Wt(e.ease,Ne.ease)),P(Ne,e||{})},config:function(e){return P(Ce,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,r=e.plugins,i=e.defaults;e=e.extendTimeline,(r||"").split(",").forEach((function(e){return e&&!lt[e]&&!nt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,r){return n(kt(e),vt(t||{},i),r)},e&&(sn.prototype[t]=function(e,n,r){return this.add(ut[t](e,Ge(n)?n:(r=n)&&{},this),r)})},registerEase:function(e,t){jt[e]=Wt(t)},parseEase:function(e,t){return arguments.length?Wt(e,t):jt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0,i=new sn(n);for(i.smoothChildTiming=Ke(n.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!r&&!e._dur&&e instanceof hn&&e.vars.onComplete===e._targets[0]||I(i,e,e._start-e._delay),e=t;return I(le,i,0),i},utils:{wrap:function e(t,n,r){var i=n-t;return qe(t)?X(t,e(0,t.length),n):Mt(r,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,n,r){var i=n-t,a=2*i;return qe(t)?X(t,e(0,t.length-1),n):Mt(r,(function(e){return t+(i<(e=(a+(e-t)%a)%a||0)?a-e:e)}))},distribute:G,random:q,snap:Z,normalize:function(e,t,n){return Y(e,t,0,1,n)},getUnit:Et,clamp:function(e,t,n){return Mt(n,(function(n){return W(e,t,n)}))},splitColor:Lt,toArray:kt,selector:function(e){return e=kt(e)[0]||b("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return kt(t,n.querySelectorAll?n:n===e?b("Invalid scope")||de.createElement("div"):e)}},mapRange:Y,pipe:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(n){return e(parseFloat(n))+(t||Et(n))}},interpolate:function e(t,n,r,i){var a=isNaN(t+n)?0:function(e){return(1-e)*t+e*n};if(!a){var s,o,l,u,c,d=Ve(t),h={};if(!0===r&&(i=1)&&(r=null),d)t={p:t},n={p:n};else if(qe(t)&&!qe(n)){for(l=[],u=t.length,c=u-2,o=1;o<u;o++)l.push(e(t[o-1],t[o]));u--,a=function(e){e*=u;var t=Math.min(c,~~e);return l[t](e-t)},r=n}else i||(t=D(qe(t)?[]:{},t));if(!l){for(s in n)ln.call(h,t,s,"get",n[s]);a=function(e){return Qt(e,h),d?t.p:t}}}return Mt(r,a)},shuffle:Ot},install:y,effects:ut,ticker:Bt,updateRoot:sn.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:xn,globals:x,Tween:hn,Timeline:sn,Animation:an,getCache:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return oe=e}}}),Sn=(_("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return wn[e]=hn[e]})),Bt.add(sn.updateRoot),fe=wn.to({},{duration:0}),function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n}),_n=wn.registerPlugin({name:"attr",init:function(e,t,n,r,i){var a,s;for(a in t)(s=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],r,i,0,0,a))&&(s.op=a),this._props.push(a)}},{name:"endArray",init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n])}},tn("roundProps",K),tn("modifiers"),tn("snap",Z))||wn;hn.version=sn.version=_n.version="3.9.1",he=1,g()&&Ft(),jt.Power0,jt.Power1,jt.Power2,jt.Power3,jt.Power4,jt.Linear,jt.Quad,jt.Cubic,jt.Quart,jt.Quint,jt.Strong,jt.Elastic,jt.Back,jt.SteppedEase,jt.Bounce,jt.Sine,jt.Expo,jt.Circ},4961:(e,t,n)=>{n.d(t,{Z:()=>r});class r{constructor(e,t){this.runScene=e,this.parent=t}}},7995:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(6001);class i{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var n;return null==(n=t.fn)?void 0:n.call(t,e)})),this.emit=this.cb}add(e,t,n){if(!n||!this.get(e))return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,r.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){void 0!==(e=(this.get(e)||{}).index)&&this.cbs.splice(e,1)}}},4230:(e,t,n)=>{n.d(t,{N:()=>l,Z:()=>o});var r=n(5521),i=n(1794),a=n(6272),s=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class o{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.setTemp(e,{time:.5,onComplete:()=>{t(0)}})})))))}})},this.clean=()=>{this.temp.clear(),this.setBackground(null)},this.backgroudDom=null,this.temp=new i.Z,this.pointerDown=()=>{this.closeAnima()},this.animaData={animaIns:null,onBreak:null},this.runScene=e,this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited),this.runScene.cb.renderEx.setSize.add("camera",(({width:e,height:t})=>{const n=this.runScene.assetsEx.get().camera;n.aspect=e/t,n.updateProjectionMatrix(),this.setBackgroundSize(e,t)}))}setBackgroundUrl(e){return s(this,void 0,void 0,(function*(){return this.setBackground(yield(0,a.sR)(e,"blob"))}))}setBackgroundTexture(e){return s(this,void 0,void 0,(function*(){var t=e.userData.blob;return this.setBackground(t)}))}setBackground(e){this.backgroudData=e;const t=this.runScene.assetsEx.engineDom;this.backgroudDom||(this.backgroudDom=document.createElement("div"),this.backgroudDom.style.width="100%",this.backgroudDom.style.height="100%",this.backgroudDom.style.position="absolute",this.backgroudDom.style.top="0px",this.backgroudDom.style.left="0px",t.appendChild(this.backgroudDom)),this.runScene.cb.camera.set.cb({type:"background",data:e}),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+URL.createObjectURL(e)+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}setBackgroundSize(e,t){this.backgroudDom&&(this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")}create(e){const t=new(e||r.PerspectiveCamera)(59,1,.3,1e3);return t.userData.isCamera=!0,t}createOrthographic(){const e=new r.OrthographicCamera;return e.userData.isCamera=!0,e}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20),e.near=.1,e.far=1e3,e.fov=50,e.updateProjectionMatrix()}get(){return this.runScene.assetsEx.get().camera}setSize(e){var{width:t,height:n}=e||this.runScene.renderEx.getDomSize();const r=(null==e?void 0:e.inputCamera)||this.getCamera();r.aspect=t/n,r.updateProjectionMatrix()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx.get(),{x:e,y:n,z:r}=e.position,{x:t,y:i,z:a}=t.target;return{x:e,y:n,z:r,tx:t,ty:i,tz:a}}closeAnima(){var e,t;this.animaData.animaIns&&(null!=(e=this.animaData.animaIns)&&e.kill(),(this.animaData.animaIns=null)!=(t=(e=this.animaData).onBreak)&&t.call(e),this.animaData.onBreak=null)}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):(null!=t&&t.onComplete(),Promise.resolve())}anima(e,t){return new Promise((n=>{const{time:r,onComplete:i,onUpdate:s,onBreak:o}=t||{},{camera:l,controls:u}=this.runScene.assetsEx.get();this.closeAnima(),this.animaData.onBreak=o,this.animaData.animaIns=(0,a.gY)(this.getLocal(),e,r||.5,(e=>{var{x:t,y:n,z:r,tx:i,ty:a,tz:o}=e;l.position.set(t,n,r),u.target.set(i,a,o),u.update(),null!=s&&s(e)}),(()=>{null!=i&&i(),n(0)}))}))}static toJSON(e){const t=e.assetsEx.get().camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const l=e=>null==e?void 0:e.isCamera},713:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>Code});var js_funcs__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_0__),_RunScene__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(5682),_Libs_Three__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(5247),_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(6272);class Code{constructor(e){this.inited=()=>{this.bindEvent()},this.str={const:"",code:"()=>{}"},(this.runScene=e).cb.inited.add("code",this.inited),e.cb.clean.add("code",(()=>{this.str={const:void 0,code:void 0}}))}set(e,t){this.str[e]=_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.encrypt(t)}get(e){return _Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str[e])}bindEvent(){this.runScene.exporter.gltf.options.addOption({type:"code",process:()=>JSON.stringify(this.str),parse:e=>{if(e)try{var t=JSON.parse(e);this.str=t}catch(e){}}})}copy(e){return this.mergeStr(this.get("code"),e)}mergeStr(e,t){let n=`(map)=>{\n const { \n camera,\n scene,\n controls,\n renderer,\n render2,\n render3,\n bus,\n runScene,\n getModel,\n core,\n Three,\n constant,\n Utils,\n } = map;\n /**\n *以下为内置环境变量 可直接使用 不可重复定义\n *camera,\n *scene,\n *controls,\n *renderer,\n *render2,\n *render3,\n *bus,\n *runScene,\n *getModel,\n *core:各导出模块挂载的根对象,\n *Three,\n *constant:常亮对象,\n *Utils,\n */\n ${e}\n };`;return t?`(runScene, inputData= {}, constant= {})=>{\n const fn = ${n}\n const modules = fn({\n runScene,\n getModel: runScene.modelEx.getModel.bind(runScene.modelEx),\n core: runScene.custom,\n ...runScene.assetsEx.get(),\n ...inputData,\n Three,\n constant,\n window:null,\n });\n if(!modules) return;\n modules.map((TheClass) => {\n const ins = new TheClass();\n if (!ins.name) throw TypeError("代码出错");\n runScene.custom[ins.name] = ins;\n return ins;\n }).map((ins)=>ins.mounted?.())\n }`:n}getParms(){return{base:{Three:_Libs_Three__WEBPACK_IMPORTED_MODULE_2__.Z,Utils:_RunScene__WEBPACK_IMPORTED_MODULE_1__.cQ,window:null},other:Object.assign(Object.assign({bus:new _RunScene__WEBPACK_IMPORTED_MODULE_1__.Gc},this.runScene.assetsEx.get()),{runScene:this.runScene,getModel:this.runScene.modelEx.getModel.bind(this.runScene.modelEx),core:this.runScene.custom})}}getAll(){return{code:_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str.code),const:_Utils_UtilsJs__WEBPACK_IMPORTED_MODULE_3__.Uf.decrypt(this.str.const)}}createFunc(map){const tMap=map||this.getAll(),tStr=this.mergeStr(tMap.code||"()=>{}"),fn=eval(tStr),constFn=eval(" ()=>{"+tMap.const+"};"),baseData=this.getParms();return(e={})=>{e=Object.assign(Object.assign(Object.assign(Object.assign({},baseData.other),e),baseData.base),{constant:constFn()||{}});const t=fn(e);null!=t&&t.map((e=>{if(!(e=new e).name)throw TypeError("代码出错");this.runScene.custom[e.name]=e})),(0,js_funcs__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.runScene.custom,((e,t)=>{var n;return null==(n=t.mounted)?void 0:n.call(t)})),e.bus}}run(){this.createFunc()()}toJSON(){return{const:this.str.const,code:this.str.code}}}},3975:(e,t,n)=>{n.d(t,{c6:()=>r});const r=["Group","Box","Plane","Sphere","Sprite","VerticesRain","Water","3DDom","3DSprite","2DDom","GroundProjected","Lod"]},4330:(e,t,n)=>{n.d(t,{sG:()=>r,zX:()=>i});const r=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},5003:(e,t,n)=>{n.r(t),n.d(t,{create:()=>h,filter:()=>r,findMultiIndex:()=>c,findThenDel:()=>u,isDef:()=>o,isEmpty:()=>i,isTrues:()=>d,notEmpty:()=>a,random:()=>s,toArr:()=>l});const r=e=>e.filter((e=>e)),i=e=>0===e.length,a=e=>0!==e.length,s=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},o=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1},l=e=>Array.isArray(e)?e:[e],u=(e,t)=>-1!==(t=e.findIndex(t))&&(e.splice(t,1),!0),c=(e,t)=>e.map(((e,n)=>t(e)?n:void 0)).filter((e=>void 0!==e)),d=e=>{for(const t of e)if(!t)return!1;return!0},h=(e=0)=>new Array(e).fill("")},960:(e,t,n)=>{n.d(t,{F6:()=>r,YD:()=>i});var r=n(5003),i=(n(1794),n(272),n(7201));n(874)},1794:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(6001);class i extends Map{constructor(e){e?super((0,r.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const n of this.entries())"key"==e?t.push(n[0]):t.push(n[1]);return t}map(e){return[...this.entries()].map(((t,n)=>{var[t,r]=t;return e(t,r,n)}))}toJSON(){const e={};return this.forEach(((t,n)=>{e[n]=t})),e}toString(){return JSON.stringify(this.map)}filterData(e){let t=[];for(var[n,r]of this.entries())e(n,r)&&t.push({key:n,val:r});return t}find(e){for(var[t,n]of this.entries())if(e(t,n))return n}static formJSON(e){return new i(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}clone(){const e=new i;return this.map(((t,n)=>e.set(t,n))),e}index(e,t="key"){return this.toArray(t)[e]}}},874:(e,t,n)=>{n.d(t,{le:()=>i});var r=n(6272);const i=(e,t)=>(0,r.Ft)(e)||isNaN(e)?t:(e=Number(e),isNaN(e)?t:e)},7201:(e,t,n)=>{n.r(t),n.d(t,{ObjEx:()=>h,is:()=>a,isDef:()=>i,logObj:()=>c,objLength:()=>d,objToStr:()=>u,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var r=n(6001);const i=(e,t)=>{if(!a(e))return!0;var n=Object.keys(e);for(let o=0;o<n.length;o++){var r=n[o],s=e[r];if(r=t[r],a(s))return!a(r)||i(s,r);if(s!==r)return!0}return!1},a=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r];n[r]=t(r,a,i)})),n},o=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r],{k:r,v:a}=t(r,a,i);n[r]=a})),n},l=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r];n[t(r,a,i)]=a})),n},u=e=>{let t="";return(0,r.mapObj)(e,((e,n)=>{t=(t+=e+":")+(a(n)?u(n):n)})),t},c=e=>{console.log(u(e))},d=e=>Object.keys(e).length;class h extends Object{constructor(e){super(e),this.isObj=!0,(0,r.mapObj)(e,((e,t)=>{this[e]=t}))}}},272:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>this.add(e)))}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const n=[];let r=0;return this.forEach((i=>{if(i=e(i,++r),!t)return n.push(i);i&&n.push(i)})),n}find(e){for(const t of this)if(e(t))return t}findThenDel(e){for(const t of this)if(e(t))return this.delete(t),!0}filter(e){const t=[];for(const n of this)e(n)&&t.push(n);return t}toJSON(){return this.toArray()}index(e){return[...this][e]}static accurateDel(e){const{set:t,fn:n}=e;for(const e of t.values())if(n(e))return void t.delete(e)}}},5247:(e,t,n)=>{n.d(t,{Z:()=>i,z:()=>r.z}),t=n(5521);var r=n(9219);const i=t},7626:(e,t,n)=>{n.d(t,{ZP:()=>L,RQ:()=>I});var r=n(6001),i=n(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t,n){t=o(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],o(e).constructor):t.apply(e,n))&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var r=new i.BufferGeometry,a=(r.setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),new i.LineBasicMaterial({fog:!1}));return((r=s(this,n,[r,a])).light=e,r.color=t,r.type="RectAreaLightHelper",a=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),a.computeBoundingSphere(),r.add(new i.Mesh(a,new i.MeshBasicMaterial({side:i.BackSide,fog:!1}))),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e),t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.Line),c=n(5247),d=n(3736),h=n(1398),p=n(2233);class f{constructor(e){this.snapshot={create:e=>({}),set(e){}},this.runScene=e}}var m=n(3924);const g={intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class v extends f{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},v.toJSON(t)),e}},this.type="AmbientLight"}get(){}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a}=e;return{type:t,intensity:n,name:r,visible:i,id:(0,p.Ki)(e),color:a.getHexString()}}setConfig(e,t){var{type:t,intensity:n,name:r,visible:i,color:a}=t;return e.intensity=n,e.type=t,e.name=r,e.visible=i,e.color=new c.Z.Color("#"+a),e}parseJSON(e,t){t=this.runScene.lightEx.get("AmbientLight",t);var[n]=t,r=e.id;return this.setConfig(n,e),(0,d.M)(n,"id",r),t}}v.snapshot={create:e=>h.LV.getDiff(g,e),set:e=>{var{map:e,light:t,runScene:n,data:r}=e;h.LV.set({def:g,data:r,runScene:n,map:e,target:t})}};var y,b=n(5682),x=n(4852),w=n(7169),S=n(5317);const _={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},T={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class M extends f{constructor(){super(...arguments),this.type="DirectionalLight",this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},M.toJSON(t)),e}}}static toJSON(e){const{intensity:t,name:n,type:r,position:i,visible:a,color:s,castShadow:o,shadow:l,rotation:u,target:c}=e;var{mapSize:d,camera:h}=l,{scale:h,near:f,far:m}=h;return{type:r,intensity:t,name:n,visible:a,color:s.getHexString(),castShadow:o,shadow:{mapSize:d.x,camera:{near:f,far:m,scale:h.x}},id:(0,p.Ki)(e),position:{x:i.x,y:i.y,z:i.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:c.position.x,y:c.position.y,z:c.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[n]=t;return M.setConfig(n,e),(0,d.M)(n,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){var{intensity:t,position:n,rotation:r,targetPosition:i,name:a,visible:s,color:o,castShadow:l,shadow:u}=t,{mapSize:u,camera:c}=u,{scale:c,near:d,far:h}=c;e.intensity=t,e.name=a,e.visible=s,e.castShadow=l,e.color=(0,S.getColorByHexStr)(o),n&&e.position.set(n.x,n.y,n.z),r&&e.rotation.set(r.x,r.y,r.z),i&&e.target.position.set(i.x,i.y,i.z),e.add(e.target),e.shadow.mapSize.x=u,e.shadow.mapSize.y=u,e.shadow.camera.scale.x=c,e.shadow.camera.scale.y=c,e.shadow.camera.scale.z=c,e.shadow.camera.near=d,e.shadow.camera.far=h,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}setConfig(e,t){return M.setConfig(e,t)}setQuality(e){const{light:t,quality:n,addUndo:r}=e,i=[];if(n!==t.shadow.mapSize.x){if(e=this.runScene.lightEx.setMultip([{model:t,typeList:["shadow","mapSize","x"],newVal:n},{model:t,typeList:["shadow","mapSize","y"],newVal:n}],(()=>{var e;t.shadow.camera.updateProjectionMatrix(),t.shadow.camera.matrixWorldNeedsUpdate=!0,null!=(e=t.cameraHelper)&&e.update()}),!0,!1),i.push(...e),e=t.shadow.clone(),i.push(this.runScene.lightEx.setNormal({model:t,info:"shadow",val:e},!1)),t.cameraHelper){i.push(new w.Z({model:t.cameraHelper,parent:t.parent,runScene:this.runScene,addTree:!1}).execute());const n=t.userData.id,r=new b.Sf.CameraHelper(e.camera);this.runScene.helperEx.setHelper(r,!0,(e=>{e.userData.id=n})),r.userData.id=n,i.push(new x.Z({model:r,parent:this.runScene.sceneEx.get(),runScene:this.runScene,addTree:!1}).execute()),i.push(this.runScene.lightEx.setNormal({model:t,info:"cameraHelper",val:r},!1))}r&&this.runScene.undoEx.addUndo(i)}}}(y=M).snapshot={create:e=>{const t=h.LV.getDiff(T,e);var n=e.shadow,{mapSize:n,camera:r}=n,{scale:r,near:i,far:a}=r,{x:e,y:s,z:o}=e.target.position;return(0,S.isDef)(n.x,_.mapSizeX)&&(t.m=n.x),(0,S.isDef)({x:e,y:s,z:o},_.targetPosition)&&(t.tp={x:e,y:s,z:o}),(0,S.isDef)(r.x,_.scaleX)&&(t.s=r.x),(0,S.isDef)(i,_.near)&&(t.n=i),(0,S.isDef)(a,_.far)&&(t.f=a),t},set:e=>{const{map:t,light:n,runScene:r,data:i}=e,{m:a,tp:s,s:o,n:l,f:u}=(h.LV.set({def:T,data:i,runScene:r,map:t,target:n}),i),c=a||_.mapSizeX;t.data.completedCbs.push((()=>{var{far:e,near:t,scaleX:i,targetPosition:a}=_,{x:a,y:d,z:h}=s||a,a=(n.target.position.set(a,d,h),r.lightEx.lightExMap.DirectionalLight.setQuality({light:n,quality:c}),o||i);n.shadow.camera.scale.x=a,n.shadow.camera.scale.y=a,n.shadow.camera.scale.z=a,n.shadow.camera.near=l||t,n.shadow.camera.far=u||e,y.snapshot.update(n)}))},update(e){e.shadow.camera.updateProjectionMatrix(),e.shadow.camera.matrixWorldNeedsUpdate=!0,e.shadow.updateMatrices(e),null!=(e=e.cameraHelper)&&e.update()}};class E extends f{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},E.toJSON(t)),e}},this.type="HemisphereLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,groundColor:s,position:o}=e;return{name:r,id:(0,p.Ki)(e),type:t,intensity:n,visible:i,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:a.getHexString()}}setConfig(e,t){var{type:t,intensity:n,name:r,visible:i,color:a,groundColor:s,position:o}=t;e.type=t,e.intensity=n,e.name=r,e.visible=i,e.color=new c.Z.Color("#"+a),e.groundColor=new c.Z.Color("#"+s),e.position.set(o.x,o.y,o.z)}parseJSON(e,t){t=this.runScene.lightEx.get("HemisphereLight",t);var[n]=t,r=e.id;return this.setConfig(n,e),(0,d.M)(n,"id",r),t}}class D extends f{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},D.toJSON(t)),e}},this.type="PointLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:n,intensity:r,distance:i,decay:a,renderOrder:s,color:o,visible:l,castShadow:u,shadow:c,position:d}=e;var{mapSize:h,camera:f,bias:m,radius:g}=c,{scale:f,near:v,far:y}=f;return{name:t,type:n,intensity:r,visible:l,color:o.getHexString(),castShadow:u,id:(0,p.Ki)(e),distance:i,decay:a,renderOrder:s,shadow:{mapSize:h.x,camera:{near:v,far:y,scale:f.x},radius:g,bias:m},position:{x:d.x,y:d.y,z:d.z}}}setConfig(e,t){var{name:t,type:n,intensity:r,distance:i,decay:a,renderOrder:s,color:o,visible:l,castShadow:u,shadow:d,position:h}=t,{mapSize:d,camera:p,bias:f,radius:m}=d,{scale:p,near:g,far:v}=p;e.intensity=r,e.type=n,e.name=t,e.visible=l,e.castShadow=u,e.distance=i,e.renderOrder=s,e.color=new c.Z.Color("#"+o),e.position.set(h.x,h.y,h.z),e.shadow.mapSize.x=d,e.shadow.mapSize.y=d,e.shadow.bias=f,e.decay=a,e.shadow.radius=m,e.shadow.camera.scale.x=p,e.shadow.camera.scale.y=p,e.shadow.camera.scale.z=p,e.shadow.camera.near=g,e.shadow.camera.far=v,e.shadow.camera.updateProjectionMatrix()}parseJSON(e,t){t=this.runScene.lightEx.get("PointLight",t);var[n]=t,r=e.id;return this.setConfig(n,e),(0,d.M)(n,"id",r),t}}class P extends f{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},P.toJSON(t)),e}},this.type="RectAreaLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,position:s}=e;return{name:r,type:t,intensity:n,id:(0,p.Ki)(e),visible:i,position:{x:s.x,y:s.y,z:s.z},color:a.getHexString()}}setConfig(e,t){var{type:t,intensity:n,name:r,visible:i,color:a,position:s}=t;e.type=t,e.intensity=n,e.name=r,e.visible=i,e.color=new c.Z.Color("#"+a),e.position.set(s.x,s.y,s.z)}parseJSON(e,t){t=this.runScene.lightEx.get("RectAreaLight",t);var[n]=t,r=e.id;return this.setConfig(n,e),(0,d.M)(n,"id",r),t}}class k extends f{constructor(){super(...arguments),this.parseNromalLight=e=>{var t=(e=e.normal).id;return e=this.parseJSON(e,{id:t}),this.runScene.lightEx.update(e[0]),e},this.toNormalLight=e=>{var{type:e,model:t}=e;if(e===this.type){const e=(0,m.createDefModel)("Box");return e.userData.normal=Object.assign({type:this.type},k.toJSON(t)),e}},this.type="SpotLight"}get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:n,color:r,distance:i,decay:a,intensity:s,angle:o,penumbra:l,visible:u,castShadow:c,shadow:d,renderOrder:h,position:f,target:m}=e;var{bias:g,camera:v,normalBias:y,mapSize:b,radius:x}=d,v=v.near;return{type:n,intensity:s,name:t,visible:u,distance:i,angle:o,id:(0,p.Ki)(e),decay:a,penumbra:l,renderOrder:h,color:r.getHexString(),castShadow:c,shadow:{bias:g,normalBias:y,mapSize:b.x,camera:{near:v},radius:x},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:m.position.x,y:m.position.y,z:m.position.z}}}setConfig(e,t){var{name:t,type:n,color:r,distance:i,decay:a,intensity:s,angle:o,penumbra:l,visible:u,castShadow:d,shadow:h,renderOrder:p,position:f,targetPosition:m}=t,{bias:h,camera:g,normalBias:v,mapSize:y,radius:b}=h,g=g.near;return e.intensity=s,e.type=n,e.name=t,e.visible=u,e.distance=i,e.decay=a,e.angle=o,e.penumbra=l,e.renderOrder=p,e.castShadow=d,e.color=new c.Z.Color("#"+r),e.position.set(f.x,f.y,f.z),e.shadow.mapSize.x=y,e.shadow.mapSize.y=y,e.shadow.camera.near=g,e.target.position.set(m.x,m.y,m.z),e.shadow.bias=h,e.shadow.normalBias=v,e.shadow.radius=b,e.shadow.camera.updateProjectionMatrix(),e}parseJSON(e,t){t=this.runScene.lightEx.get("SpotLight",t);var[n]=t,r=e.id;return this.setConfig(n,e),(0,d.M)(n,"id",r),t}}var O=n(3735),A=n(2510),C=n(7201);const N={DirectionalLight:M,PointLight:D,SpotLight:k,RectAreaLight:P,HemisphereLight:E,AmbientLight:v};class L{constructor(e){this.inited=()=>{(0,r.mapObj)(this.lightExMap,((e,t)=>{this.runScene.modelEx.importAndExport.addParses(t.type,{parse:t.parseNromalLight,toNormal:t.toNormalLight})}))},this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.snapshot={create:e=>{const t=this.runScene.uniqueEx.model.getModelsByType("light"),n={};t.map((e=>{var t=e.type,r=(0,p.Ki)(e),i=null==(i=null==(t=N[t].snapshot)?void 0:t.create)?void 0:i.call(t,e);i&&r&&(n[r]=i)})),0!==(0,C.objLength)(n)&&e.data.set("light",n)},set:e=>{var t=e.snapshot.data.get("light");t&&!e.ignoreModules.includes("light")&&(0,r.mapObj)(t,((t,n)=>{var r,i=((t=this.runScene.modelEx.getById(t))||{}).type;i&&null!=(r=null==(i=N[i].snapshot)?void 0:i.set)&&r.call(i,{data:n,runScene:this.runScene,light:t,map:e})}))}},this.setAllHelpers=e=>{this.getAll().map((t=>{this.setHelperState(t,e)}))},this.runScene=e,this.lightExMap={DirectionalLight:new M(e),PointLight:new D(e),SpotLight:new k(e),RectAreaLight:new P(e),HemisphereLight:new E(e),AmbientLight:new v(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.delUseless.add("light",(t=>{(0,r.mapObj)(t,((t,n)=>{const i=n.data.light;i&&((0,r.mapObj)(i,(t=>{e.uniqueEx.model.has(t)||delete i[t]})),0===(0,C.objLength)(i)&&delete n.data.light)}))})),e.cb.snapshot.set.add("light",this.snapshot.set),e.cb.snapshot.getLength.add("light",(e=>{var t=e.data.data.get("light");t&&(e.inputData.light=Object.keys(t).length)})),e.cb.inited.add("light",this.inited),this.runScene.cb.snapshot.resetItem.add("light",(e=>{const{targets:t,datas:n}=e;"light"===e.type&&n.map((e=>{const n=e.data;let r=n.get("light");r||(r={},n.set("light",r)),t.map((e=>{var t,n,i=(0,p.Ki)(e);i&&(t=e.type,(n=null==(n=null==(t=N[t].snapshot)?void 0:t.create)?void 0:n.call(t,e))&&(r[i]=n))}))}))}))}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}add(e,t){e=e.map((e=>this.runScene.modelEx.add(e,void 0,Object.assign(Object.assign({},t),{select:!!I(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,S.mergeObject)({id:(0,r.getId)()},t).id;let n=new c.Z[e],i=[n];return n.position.y=10,n.name=e,n.userData.id=t,this.shadowList.includes(e)&&(n.castShadow=!0),this.setLight(n),i.push(...this.setLightHelper(n)),null!=(t=null==n?void 0:n.lightHelper)&&t.update(),i}setNull(e){e.lightTarget&&this.setNull(e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.lightTarget&&this.setSelect(e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.lightTarget&&(e=e.lightTarget),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t),this.runScene.renderEx.shadowManager.render())}remove(e,t=!0){let n;return this.runScene.helperEx.unfocus(),n="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new w.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new w.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&n&&this.runScene.undoEx.addUndo(n),n}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const n=(0,p.Ki)(t);let r,i=[];switch(e){case"RectAreaLight":r=new u(t,16773120);break;case"DirectionalLight":if(r=new c.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new c.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.lightTarget=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=n,e.userData.unClick=!0})),e.userData.id=n,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,i.push(e);break;case"PointLight":r=new c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":r=new c.Z.SpotLightHelper(t);let a=new c.Z.Object3D;(t.target=a).name="helperModel",a.userData.isLightTarget=!0,a.lightTarget=t,a.position.y=-10,t.shadow.autoUpdate=!0,t.add(a);const s=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=n})),s.userData.id=n,s.visible=!1,t.cameraHelper=s,i.push(s);break;case"HemisphereLight":r=new c.Z.HemisphereLightHelper(t,1,16773135)}return r.name="helperModel",this.runScene.helperEx.setHelper(r,!0,(e=>{e.userData.id=n})),r.userData.id=n,(r.light=t).helper=r,this.update(t),i.push(r),i}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:n,val:r,cb:i}=e;return new A.Z({target:e,runScene:this.runScene,info:n,oldVal:e[n],newVal:r,cb:i}).execute()}setMultip(e,t,n=!0,r=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:r,newVal:i}=e;const a=new O.Z({target:e,typeList:r,newVal:i,cb:t});return n?a.execute():a})),r&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:a}=e;const s=new O.Z({target:i,typeList:e,newVal:a,cb:t});return r&&this.runScene.undoEx.addUndo(s),n?s.execute():s}}isLight(e){return null==(e=null==e?void 0:e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){var t=N[e.type].toJSON(e),n=this.get(e.type),[r]=n;return this.lightExMap[e.type].setConfig(r,t),n}toJSON(e){return e.filter((e=>!(0,m.isHelper)(e))).map((e=>N[e.type].toJSON(e)))}getAll(){return this.runScene.uniqueEx.model.find((e=>"light"===e.type))}setHelperState(e,t){this.helperList.includes(e.type)&&(e.helper.visible=t)}}const I=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},9576:(e,t,n)=>{n.d(t,{B:()=>Ve,Z:()=>ze});var r=n(5521),i=(t=n(3300),n.n(t)),a=n(6001),s=n(8881);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t,n){t=u(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(r)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=new WeakMap,p=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){var t,r,i;if(this instanceof n)return i={},(r="catchData")in(t=c(e=l(this,n,[e])))?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,e.decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e),t=n,(e=[{key:"setCatch",value:function(e){this.catchData=e}},{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,r){var i=this,a=new s.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){i.parse(e,t,r)}),n,r)}},{key:"parse",value:function(e,t,n){this.decodeDracoFile(e,t,null,null,s.SRGBColorSpace).catch(n)}},{key:"decodeDracoFile",value:function(e,t,n,r){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:s.LinearSRGBColorSpace;return r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i},this.decodeGeometry(e,r).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,r=this,i=JSON.stringify(t);if(h.has(e)){if((s=h.get(e)).key===i)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var a=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(a,s).then((function(r){return n=r,new Promise((function(r,i){n._callbacks[a]={resolve:r,reject:i},n.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){n&&a&&r._releaseTask(n,a)})),h.set(e,{key:i,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new s.BufferGeometry;e.index&&t.setIndex(new s.BufferAttribute(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n],i=r.name,a=r.array,o=r.itemSize;o=new s.BufferAttribute(a,o),"color"===i&&(this._assignVertexColorSpace(o,r.vertexColorSpace),o.normalized=a instanceof Float32Array==0),t.setAttribute(i,o)}return t}},{key:"_assignVertexColorSpace",value:function(e,t){if(t===s.SRGBColorSpace)for(var n=new s.Color,r=0,i=e.count;r<i;r++)n.fromBufferAttribute(e,r).convertSRGBToLinear(),e.setXYZ(r,n.r,n.g,n.b)}},{key:"_loadLibrary",value:function(e,t){var n=new s.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t,n,r="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,i=[];return r?i.push(this._loadLibrary("draco_decoder.js","text")):(t=(n=this.catchData).draco_wasm_wrapper,n=n.draco_decoder,i.push(t?Promise.resolve(t):this._loadLibrary("draco_wasm_wrapper.js","text")),i.push(n?Promise.resolve(n):this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(i).then((function(t){var n=t[0];r||(e.decoderConfig.wasmBinary=t[1]),t=function(){var e,t;onmessage=function(n){var r=n.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=r.buffer,a=r.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder;try{var n=function(e,t,n,r){var i,a=r.attributeIDs,s=r.attributeTypes,o=t.GetEncodedGeometryType(n);if(o===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeArrayToMesh(n,n.byteLength,i);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeArrayToPointCloud(n,n.byteLength,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,d,h,p,f,m,g,v,y,b,x={index:null,attributes:[]};for(l in a){var w=self[s[l]],S=void 0,_=void 0;if(r.useUniqueIDs)_=a[l],S=t.GetAttributeByUniqueId(i,_);else{if(-1===(_=t.GetAttributeId(i,e[a[l]])))continue;S=t.GetAttribute(i,_)}_=e,u=t,T=i,c=l,d=S.num_components(),p=(h=T.num_points()*d)*w.BYTES_PER_ELEMENT,f=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(_,w),m=_._malloc(p),u.GetAttributeDataArrayForAllPoints(T,S,f,p,m),u=new w(_.HEAPF32.buffer,m,h).slice(),_._free(m);var T={name:c,array:u,itemSize:d};"color"===l&&(T.vertexColorSpace=r.vertexColorSpace),x.attributes.push(T)}return o===e.TRIANGULAR_MESH&&(x.index=(n=e,g=t,y=4*(v=3*(o=i).num_faces()),b=n._malloc(y),g.GetTrianglesUInt32Array(o,y,b),g=new Uint32Array(n.HEAPF32.buffer,b,v).slice(),n._free(b),{array:g,itemSize:1})),e.destroy(i),x}(e,t,new Int8Array(i),a),s=n.attributes.map((function(e){return e.array.buffer}));n.index&&s.push(n.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:n},s)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([n]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){n.workerPool.length<n.workerLimit?((r=new Worker(n.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)):n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var r,i=n.workerPool[n.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(s.Loader),f=n(5317);function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var g=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":m(WebAssembly)))return{supported:!1};var n,r=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",i=WebAssembly.instantiate(a(r),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));function a(e){for(var n=new Uint8Array(e.length),r=0;r<e.length;++r){var i=e.charCodeAt(r);n[r]=96<i?i-97:64<i?i-39:i+4}var a=0;for(r=0;r<e.length;++r)n[a++]=n[r]<60?t[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,a)}function s(e,t,r,i,a,s){var o=n.exports.sbrk,l=r+3&-4,u=o(l*i),c=o(a.length),d=new Uint8Array(n.exports.memory.buffer);if(0==(d.set(a,c),e=e(u,r,i,c,a.length))&&s&&s(u,l,i),t.set(d.subarray(u,u+r*i)),o(u-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],c=0;return{ready:i,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(a(r))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+s.toString()+function(e){i.then((function(){var t=e.data;try{var r=new Uint8Array(t.count*t.size);s(n.exports[t.mode],r,t.count,t.size,t.source,n.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:r},[r.buffer])}catch(r){self.postMessage({id:t.id,count:t.count,action:"reject",value:r})}}))}.toString(),o=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(o);URL.revokeObjectURL(o)}(e)},decodeVertexBuffer:function(e,t,r,i,a){s(n.exports.meshopt_decodeVertexBuffer,e,t,r,i,n.exports[o[a]])},decodeIndexBuffer:function(e,t,r,i){s(n.exports.meshopt_decodeIndexBuffer,e,t,r,i)},decodeIndexSequence:function(e,t,r,i){s(n.exports.meshopt_decodeIndexSequence,e,t,r,i)},decodeGltfBuffer:function(e,t,r,i,a,u){s(n.exports[l[a]],e,t,r,i,n.exports[o[u]])},decodeGltfBufferAsync:function(e,t,r,a,d){if(0<u.length){for(var h=e,p=t,f=r,m=l[a],g=o[d],v=u[0],y=1;y<u.length;++y)u[y].pending<v.pending&&(v=u[y]);return new Promise((function(e,t){var n=new Uint8Array(f),r=c++;v.pending+=h,v.requests[r]={resolve:e,reject:t},v.object.postMessage({id:r,count:h,size:p,source:n,mode:m,filter:g},[n.buffer])}))}return i.then((function(){var i=new Uint8Array(e*t);return s(n.exports[l[a]],i,e,t,r,n.exports[o[d]]),i}))}}}(),v=n(9174),y={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var b=new(function(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,n,r){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,a=!1,s=0,o=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,this.itemStart=function(e){o++,!1===a&&void 0!==i.onStart&&i.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){return-1!==(e=u.indexOf(e))&&u.splice(e,2),this},this.getHandler=function(e){for(var t=0,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})));var x=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:b,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,n;return t=e,(n=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t){return(T=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}x.DEFAULT_MATERIAL_NAME="__DEFAULT";var M=function(){var e=n,t=x;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");function n(e){if(this instanceof n)return(e=function(e,t,n){t=_(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],_(e).constructor):t.apply(e,n))&&("object"===w(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n,[e])).isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t),e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=this,s=y.get(e);if(void 0!==s)return a.manager.itemStart(e),setTimeout((function(){t&&t(s),a.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var n=(r=a.options).textureQuality,r=r.reverseTexture,s=i.notCompress,o=i.size,l=0===e.size?new ImageData(1,1):e,u=(c=i.size).w,c=c.h;s=s?1:n,t(createImageBitmap(l,Object.assign(a.options,o?{imageOrientation:r?"none":"flipY",resizeHeight:c*s,resizeWidth:u*s}:{imageOrientation:r?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(n){n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),2!==a.length);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e)||function(e,t){if(e){if("string"==typeof e)return S(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n);var r=n[0];n=n[1],y.add(e,r),t&&t(r,n),a.manager.itemEnd(e)})).catch((function(t){console.log(t,"e"),r&&r(t),a.manager.itemError(e),a.manager.itemEnd(e)})),a.manager.itemStart(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),E=n(768);function D(){D=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function d(){}function h(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(p=f),h.prototype=c.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==A(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.then(s,s):s()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var s=new v(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var s=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function P(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function k(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function s(e){P(a,r,i,s,o,"next",e)}function o(e){P(a,r,i,s,o,"throw",e)}s(void 0)}))}}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e,t)||L(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function C(){return(C="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=j(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function N(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=L(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function L(e,t){if(e){if("string"==typeof e)return I(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function F(e,t,n){t=j(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],j(e).constructor):t.apply(e,n))&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&V(e,t)}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var H=function(){function e(t){return R(this,e),(t=F(this,e,[t])).dracoLoader=null,t.ktx2Loader=null,t.meshoptDecoder=null,t.pluginCallbacks=[],t.register((function(e){return new X(e)})),t.register((function(e){return new ne(e)})),t.register((function(e){return new re(e)})),t.register((function(e){return new Q(e)})),t.register((function(e){return new J(e)})),t.register((function(e){return new $(e)})),t.register((function(e){return new ee(e)})),t.register((function(e){return new q(e)})),t.register((function(e){return new te(e)})),t.register((function(e){return new Y(e)})),t.register((function(e){return new K(e)})),t.register((function(e){return new ie(e)})),t.register((function(e){return new ae(e)})),t}return z(e,r.Loader),B(e,[{key:"load",value:function(e,t,n,i){function a(t){i?i(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new r.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(n){try{s.parse(n,o,(function(n){t(n),s.manager.itemEnd(e)}),a)}catch(n){a(n)}}),n,a)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r,i){var a,s={},o={},l=new TextDecoder;if("string"==typeof e)a=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===se){try{s[G.KHR_BINARY_GLTF]=new oe(e)}catch(e){return void(r&&r(e))}a=JSON.parse(s[G.KHR_BINARY_GLTF].content)}else{var u=i.processOriginUnDecodeArrayBuffer(e);if(console.log(u,"outData"),u){if(l.decode(new Uint8Array(u,0,4))===se){try{s[G.KHR_BINARY_GLTF]=new oe(u)}catch(e){return void(r&&r(e))}a=JSON.parse(s[G.KHR_BINARY_GLTF].content)}}else a=JSON.parse(l.decode(e))}else a=e;if(void 0===a.asset||a.asset.version[0]<2)r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(i.valid(a)){i.beforeParse({json:a,data:e});var c=new De(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:i});c.fileLoader.setRequestHeader(this.requestHeader);for(var d=0;d<this.pluginCallbacks.length;d++){var h=this.pluginCallbacks[d](c);s[(o[h.name]=h).name]=!0}if(a.extensionsUsed)for(var p=0;p<a.extensionsUsed.length;++p){var f=a.extensionsUsed[p],m=a.extensionsRequired||[];switch(f){case G.KHR_MATERIALS_UNLIT:s[f]=new Z;break;case G.KHR_DRACO_MESH_COMPRESSION:s[f]=new le(a,this.dracoLoader);break;case G.KHR_TEXTURE_TRANSFORM:s[f]=new ue;break;case G.KHR_MESH_QUANTIZATION:s[f]=new ce;break;default:0<=m.indexOf(f)&&void 0===o[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(n,r)}}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}]),e}();function W(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var G={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},K=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return B(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;var a,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new r.Color(16777215),u=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(a=new r.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new r.PointLight(l)).distance=u;break;case"spot":(a=new r.SpotLight(l)).distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,_e(a,o),void 0!==o.intensity&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),i=Promise.resolve(a),t.cache.add(n,i),i}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{key:"createNodeAttachment",value:function(e){var t=this,n=this.parser,r=((e=n.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}]),e}(),Z=function(){function e(){R(this,e),this.name=G.KHR_MATERIALS_UNLIT}return B(e,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,n){var i,a=[];return e.color=new r.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(i=t.baseColorFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.baseColorTexture&&a.push(n.assignTexture(e,"map",t.baseColorTexture,r.sRGBEncoding))),Promise.all(a)}}]),e}(),q=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_EMISSIVE_STRENGTH}return B(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),X=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_CLEARCOAT}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(n=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new r.Vector2(n,n))),Promise.all(i)}}]),e}(),Y=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_IRIDESCENCE}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[];return void 0!==(e=e.extensions[this.name]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(r)}}]),e}(),Q=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_SHEEN}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",e.sheenColorTexture,r.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),J=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_TRANSMISSION}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(r)}}]),e}(),$=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_VOLUME}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(i=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],i=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new r.Color(i[0],i[1],i[2]),Promise.all(n)}}]),e}(),ee=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_IOR}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),te=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_MATERIALS_SPECULAR}return B(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[],a=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new r.Color(a[0],a[1],a[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",e.specularColorTexture,r.sRGBEncoding)),Promise.all(i)}}]),e}(),ne=function(){function e(t){R(this,e),this.parser=t,this.name=G.KHR_TEXTURE_BASISU}return B(e,[{key:"loadTexture",value:function(e){var t=this.parser,n=t.json;if(!(r=n.textures[e]).extensions||!r.extensions[this.name])return null;var r=r.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,r.source,i);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),re=function(){function e(t){R(this,e),this.parser=t,this.name=G.EXT_TEXTURE_WEBP,this.isSupported=null}return B(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json;if(!(a=r.textures[e]).extensions||!a.extensions[t])return null;var i=a.extensions[t],a=r.images[i.source],s=n.textureLoader;return a.uri&&null!==(a=n.options.manager.getHandler(a.uri))&&(s=a),this.detectSupport().then((function(a){if(a)return n.loadTextureImage(e,i.source,s);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),ie=function(){function e(t){R(this,e),this.name=G.EXT_MESHOPT_COMPRESSION,this.parser=t}return B(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var n=e.extensions[this.name],r=(e=this.parser.getDependency("buffer",n.buffer),this.parser.options.meshoptDecoder);if(r&&r.supported)return e.then((function(e){var t=n.byteOffset||0,i=n.byteLength||0,a=n.count,s=n.byteStride,o=new Uint8Array(e,t,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,n.mode,n.filter).then((function(e){return e.buffer})):r.ready.then((function(){var e=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(e),a,s,o,n.mode,n.filter),e}))}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return null}}]),e}(),ae=function(){function e(t){R(this,e),this.name=G.EXT_MESH_GPU_INSTANCING,this.parser=t}return B(e,[{key:"createNodeMesh",value:function(e){var t=this,n=this.parser.json,i=n.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;var a,s=N(n.meshes[i.mesh].primitives);try{for(s.s();!(a=s.n()).done;){var o=a.value;if(o.mode!==fe.TRIANGLES&&o.mode!==fe.TRIANGLE_STRIP&&o.mode!==fe.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,u=i.extensions[this.name].attributes,c=[],d={};for(l in u)!function(e){c.push(t.parser.getDependency("accessor",u[e]).then((function(t){return d[e]=t,d[e]})))}(l);return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then((function(e){var n,i=e.pop(),a=i.isGroup?i.children:[i],s=e[0].count,o=[],l=N(a);try{for(l.s();!(n=l.n()).done;){for(var u,c=n.value,h=new r.Matrix4,p=new r.Vector3,f=new r.Quaternion,m=new r.Vector3(1,1,1),g=new r.InstancedMesh(c.geometry,c.material,s),v=0;v<s;v++)d.TRANSLATION&&p.fromBufferAttribute(d.TRANSLATION,v),d.ROTATION&&f.fromBufferAttribute(d.ROTATION,v),d.SCALE&&m.fromBufferAttribute(d.SCALE,v),g.setMatrixAt(v,h.compose(p,f,m));for(u in d)"TRANSLATION"!==u&&"ROTATION"!==u&&"SCALE"!==u&&c.geometry.setAttribute(u,d[u]);r.Object3D.prototype.copy.call(g,c),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return i.isGroup?(i.clear(),i.add.apply(i,o),i):o[0]})))}}]),e}(),se="glTF",oe=B((function e(t){R(this,e),this.name=G.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==se)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,a=new DataView(t,12),s=0;s<i;){var o,l=a.getUint32(s,!0),u=(s+=4,a.getUint32(s,!0));s+=4,1313821514===u?(o=new Uint8Array(t,12+s,l),this.content=r.decode(o)):5130562===u&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),le=function(){function e(t,n){if(R(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=G.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return B(e,[{key:"decodePrimitive",value:function(e,t){var n,r,i=this.json,a=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},u={},c={};for(n in o){var d=be[n]||n.toLowerCase();l[d]=o[n]}for(r in e.attributes){var h,p,f=be[r]||r.toLowerCase();void 0!==o[r]&&(h=i.accessors[e.attributes[r]],p=me[h.componentType],c[f]=p.name,u[f]=!0===h.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n];void 0!==(n=u[n])&&(r.normalized=n)}t(e)}),l,c)}))}))}}]),e}(),ue=function(){function e(){R(this,e),this.name=G.KHR_TEXTURE_TRANSFORM}return B(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),ce=B((function e(){R(this,e),this.name=G.KHR_MESH_QUANTIZATION})),de=function(){function e(t,n,r,i){return R(this,e),F(this,e,[t,n,r,i])}return z(e,r.Interpolant),B(e,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,u=r-t,c=e*l,d=c-l,h=-2*(t=(n=(r=(n-t)/u)*r)*r)+3*n,p=t-n,f=1-h,m=p-n+r,g=0;g!==s;g++){var v=a[d+g+s],y=a[d+g+o]*u,b=a[c+g+s],x=a[c+g]*u;i[g]=f*v+m*y+h*b+p*x}return i}}]),e}(),he=new r.Quaternion,pe=function(){function e(){return R(this,e),F(this,e,arguments)}return z(e,de),B(e,[{key:"interpolate_",value:function(t,n,r,i){return t=C(j(e.prototype),"interpolate_",this).call(this,t,n,r,i),he.fromArray(t).normalize().toArray(t),t}}]),e}(),fe={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},me={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ge={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},ve={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},ye={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},be={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},xe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},we={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function Se(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function _e(e,t){void 0!==t.extras&&("object"===A(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Te(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Me(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var Ee=new r.Matrix4,De=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};R(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new W,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof navigator&&(/^((?!chrome|android).)*safari/i.test(navigator.userAgent),-1<navigator.userAgent.indexOf("Firefox")&&navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]),"textureLoader"===(null==(t=n.ex.runScene.optionsEx.options)||null==(n=t.texture)?void 0:n.loader)||"undefined"==typeof createImageBitmap?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new M(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new E.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return B(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};Se(i,a,r),_e(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].joints,s=0,o=a.length;s<o;s++)e[a[s]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(n[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,n){var r=this;if(e.refs[t]<=1)return n;var i=n.clone();return function e(t,n){var i,a=r.associations.get(t),s=(null!=a&&r.associations.set(n,a),N(t.children.entries()));try{for(s.s();!(i=s.n()).done;){var o=O(i.value,2),l=o[0];e(o[1],n.children[l])}}catch(e){s.e(e)}finally{s.f()}}(n,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),n=(t.unshift(this),[]),r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})))break;throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t,n,r=this.cache.get(e);return r||(n=(t=this).json[e+("mesh"===e?"es":"s")]||[],r=Promise.all(n.map((function(n,r){return t.getDependency(e,r)}))),this.cache.add(e,r)),r}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[G.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,a){n.load(r.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{key:"loadAccessor",value:function(e){var t,n=this,i=this.json,a=this.json.accessors[e];if(void 0===a.bufferView&&void 0===a.sparse)return e=ye[a.type],s=me[a.componentType],t=!0===a.normalized,s=new s(a.count*e),Promise.resolve(new r.BufferAttribute(s,e,t));var s=[];return void 0!==a.bufferView?s.push(this.getDependency("bufferView",a.bufferView)):s.push(null),void 0!==a.sparse&&(s.push(this.getDependency("bufferView",a.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",a.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=ye[a.type],l=me[a.componentType],u=l.BYTES_PER_ELEMENT,c=a.byteOffset||0,d=void 0!==a.bufferView?i.bufferViews[a.bufferView].byteStride:void 0,h=!0===a.normalized,p=d&&d!==u*o?(f=Math.floor(c/d),m="InterleavedBuffer:"+a.bufferView+":"+a.componentType+":"+f+":"+a.count,(g=n.cache.get(m))||(t=new l(s,f*d,a.count*d/u),g=new r.InterleavedBuffer(t,d/u),n.cache.add(m,g)),new r.InterleavedBufferAttribute(g,o,c%d/u,h)):(t=null===s?new l(a.count*o):new l(s,c,a.count*o),new r.BufferAttribute(t,o,h));if(void 0!==a.sparse){var f=me[a.sparse.indices.componentType],m=a.sparse.indices.byteOffset||0,g=a.sparse.values.byteOffset||0,v=new f(e[1],m,a.sparse.count*ye.SCALAR),y=new l(e[2],g,a.sparse.count*o);null!==s&&(p=new r.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var b=0,x=v.length;b<x;b++){var w=v[b];if(p.setX(w,y[b*o]),2<=o&&p.setY(w,y[b*o+1]),3<=o&&p.setZ(w,y[b*o+2]),4<=o&&p.setW(w,y[b*o+3]),5<=o)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p}))}},{key:"loadTexture",value:function(e){var t=this.json,n=this.options,r=t.textures[e].source,i=(t=t.images[r],this.textureLoader);return t.uri&&null!==(n=n.manager.getHandler(t.uri))&&(i=n),this.loadTextureImage(e,r,i)}},{key:"loadTextureImage",value:function(e,t,n){var i=this,a=this.json,s=a.textures[e],o=a.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,n,e).then(function(){var t=k(D().mark((function t(n){var l;return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.flipY=!1,n.name=s.name||o.name||"",l=(l=a.samplers||{})[s.sampler]||{},n.magFilter=ge[l.magFilter]||r.LinearFilter,n.minFilter=ge[l.minFilter]||r.LinearMipmapLinearFilter,n.wrapS=ve[l.wrapS]||r.RepeatWrapping,n.wrapT=ve[l.wrapT]||r.RepeatWrapping,i.associations.set(n,{textures:e}),t.next=11,i.options.ex.loadTexture({texture:n,textureDef:s});case 11:return t.abrupt("return",n);case 12:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,n){var i=this,a=this.json,s=this.options,o=a.textures[n];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=a.images[e],u=self.URL||self.webkitURL,c=l.uri||"";if(void 0!==l.bufferView)c=i.getDependency("bufferView",l.bufferView).then((function(e){var t=new Blob([e],{type:l.mimeType});return{sourceURI:c=u.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return n=Promise.resolve(c).then((function(e){var n=e.sourceURI,a=e.blob;return new Promise(function(){var e=k(D().mark((function e(l,c){var d,h,p,f;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0===a.size)return h=new r.Texture,e.abrupt("return",l({texture:h,blob:a}));e.next=3;break;case 3:if(d=l,!o.isHdr){e.next=8;break}o.cloneSourceId?l({texture:new r.Texture(document.createElement("canvas")),blob:new Blob([new ArrayBuffer(1)])}):((h=new FileReader).readAsDataURL(a),h.addEventListener("load",(function(e){e=e.target.result,i.rgbeLoader.loadAsync(e).then((function(e){e.encoding=r.sRGBEncoding,e.needsUpdate=!0,l({texture:e,blob:a})}))}))),e.next=21;break;case 8:if(!o.type){e.next=20;break}if(p=u.createObjectURL(a),"onlySave"!==o.type){e.next=14;break}f=new r.Texture(new Image(1,1)),e.next=17;break;case 14:return e.next=16,s.ex.runScene.loaderer.getTexture(p,{type:o.type});case 16:f=e.sent;case 17:l({texture:f,blob:a}),e.next=21;break;case 20:!0===t.isImageBitmapLoader?(d=function(e,t){(e=new r.Texture(e)).needsUpdate=!0,l({texture:e,blob:t})},o.cloneSourceId?l({texture:new r.Texture(document.createElement("canvas")),blob:new Blob([new ArrayBuffer(1)])}):t.load(r.LoaderUtils.resolveURL(n,s.path),d,void 0,c,o)):(s.ex.options.loadConfig.reverseTexture,t.load(r.LoaderUtils.resolveURL(n,s.path),(function(e){l({texture:e,blob:a})}),void 0,c));case 21:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}())})).then((function(e){var t=e.texture;return e=e.blob,"editor"!==s.ex.options.mode||o.isHdr||(t.userData.url=c),t.userData.blob=e,t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",c),e})),this.sourceCache[e]=n}},{key:"assignTexture",value:function(e,t,n,r){var i=this;return this.getDependency("texture",n.index).then((function(a){return a?(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[G.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==n.extensions?n.extensions[G.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=i.associations.get(a),a=i.extensions[G.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),i.associations.set(a,o)),void 0!==r&&(a.encoding=r),e[t]=a):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,n,i=e.geometry,a=e.material,s=void 0===i.attributes.tangent,o=void 0!==i.attributes.color,l=void 0===i.attributes.normal;e.isPoints?(t="PointsMaterial:"+a.uuid,(n=this.cache.get(t))||(n=new r.PointsMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),n.map=a.map,n.sizeAttenuation=!1,this.cache.add(t,n)),a=n):e.isLine&&(t="LineBasicMaterial:"+a.uuid,(n=this.cache.get(t))||(n=new r.LineBasicMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),this.cache.add(t,n)),a=n),(s||o||l)&&(t="ClonedMaterial:"+a.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(n=this.cache.get(t))||(n=a.clone(),o&&(n.vertexColors=!0),l&&(n.flatShading=!0),s&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.add(t,n),this.associations.set(n,this.associations.get(a)))),a.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),this.options.ex.loadMaterial({material:a,materialDef:a.userData,model:e}),e.material=a}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,n,i=this,a=this.json,s=this.extensions,o=a.materials[e],l={},u=(a=[],(o.extensions||{})[G.KHR_MATERIALS_UNLIT]?(n=s[G.KHR_MATERIALS_UNLIT],t=n.getMaterialType(),a.push(n.extendParams(l,o,i))):(n=o.pbrMetallicRoughness||{},l.color=new r.Color(1,1,1),l.opacity=1,Array.isArray(n.baseColorFactor)&&(u=n.baseColorFactor,l.color.fromArray(u),l.opacity=u[3]),void 0!==n.baseColorTexture&&a.push(i.assignTexture(l,"map",n.baseColorTexture,r.sRGBEncoding)),l.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,l.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(i.assignTexture(l,"metalnessMap",n.metallicRoughnessTexture)),a.push(i.assignTexture(l,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),a.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=r.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===u?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===u&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==r.MeshBasicMaterial&&(a.push(i.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new r.Vector2(1,1),void 0!==o.normalTexture.scale&&(n=o.normalTexture.scale,l.normalScale.set(n,n))),void 0!==o.occlusionTexture&&t!==r.MeshBasicMaterial&&(a.push(i.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==r.MeshBasicMaterial&&(l.emissive=(new r.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==r.MeshBasicMaterial&&a.push(i.assignTexture(l,"emissiveMap",o.emissiveTexture,r.sRGBEncoding)),Promise.all(a).then((function(){var n=new t(l);return o.name&&(n.name=o.name),_e(n,o),i.associations.set(n,{materials:e}),o.extensions&&Se(s,n,o),n}))}},{key:"createUniqueName",value:function(e){for(var t=e,n=1;this.nodeNamesUsed[t];++n)t=e+"_"+n;return this.nodeNamesUsed[t]=!0,t}},{key:"loadGeometries",value:function(e){for(var t=this,n=this.extensions,i=this.primitiveCache,a=[],s=0,o=e.length;s<o;s++){var l=e[s],u=(c=void 0,c=(c=(u=l).extensions&&u.extensions[G.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+Te(c.attributes):u.indices+":"+Te(u.attributes)+":"+u.mode),c=i[u];c?a.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[G.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[G.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return Pe(n,e,t)}))}(l):Pe(new r.BufferGeometry,l,t),i[u]={primitive:l,promise:c},a.push(c))}return Promise.all(a)}},{key:"loadMesh",value:function(e){for(var t=this,n=this.json,i=this.extensions,a=n.meshes[e],s=a.primitives,o=[],l=0,u=s.length;l<u;l++){var c=void 0===s[l].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial):this.getDependency("material",s[l].material);o.push(c)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(n){for(var o=n.slice(0,n.length-1),l=n[n.length-1],u=[],c=0,d=l.length;c<d;c++){var h=l[c],p=s[c],f=void 0,m=o[c];if(p.mode===fe.TRIANGLES||p.mode===fe.TRIANGLE_STRIP||p.mode===fe.TRIANGLE_FAN||void 0===p.mode)!0!==(f=new(!0===a.isSkinnedMesh?r.SkinnedMesh:r.Mesh)(h,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),p.mode===fe.TRIANGLE_STRIP?f.geometry=(0,v.Vs)(f.geometry,r.TriangleStripDrawMode):p.mode===fe.TRIANGLE_FAN&&(f.geometry=(0,v.Vs)(f.geometry,r.TriangleFanDrawMode));else if(p.mode===fe.LINES)f=new r.LineSegments(h,m);else if(p.mode===fe.LINE_STRIP)f=new r.Line(h,m);else if(p.mode===fe.LINE_LOOP)f=new r.LineLoop(h,m);else{if(p.mode!==fe.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new r.Points(h,m)}if(0<Object.keys(f.geometry.morphAttributes).length){_=S=w=x=b=g=void 0;var g=f,y=a;if(g.updateMorphTargets(),void 0!==y.weights)for(var b=0,x=y.weights.length;b<x;b++)g.morphTargetInfluences[b]=y.weights[b];if(y.extras&&Array.isArray(y.extras.targetNames)){var w=y.extras.targetNames;if(g.morphTargetInfluences.length===w.length){g.morphTargetDictionary={};for(var S=0,_=w.length;S<_;S++)g.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(a.name||"mesh_"+e),_e(f,a),p.extensions&&Se(i,f,p),t.assignFinalMaterial(f),u.push(f)}for(var T=0,M=u.length;T<M;T++)t.associations.set(u[T],{meshes:e,primitives:T});if(1===u.length)return u[0];var E=new r.Group;t.associations.set(E,{meshes:e});for(var D=0,P=u.length;D<P;D++)E.add(u[D]);return E}))}},{key:"loadCamera",value:function(e){var t,n=(e=this.json.cameras[e])[e.type];if(n)return"perspective"===e.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===e.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),_e(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],n=[],i=0,a=t.joints.length;i<a;i++)n.push(this.getDependency("node",t.joints[i]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){for(var n=e.pop(),i=e,a=[],s=[],o=0,l=i.length;o<l;o++){var u=i[o];u?(a.push(u),u=new r.Matrix4,null!==n&&u.fromArray(n.array,16*o),s.push(u)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new r.Skeleton(a,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],n=[],i=[],a=[],s=[],o=[],l=0,u=t.channels.length;l<u;l++){var c=t.channels[l],d=t.samplers[c.sampler],h=(c=c.target).node,p=void 0!==t.parameters?t.parameters[d.input]:d.input,f=void 0!==t.parameters?t.parameters[d.output]:d.output;n.push(this.getDependency("node",h)),i.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",f)),s.push(d),o.push(c)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(a),Promise.all(s),Promise.all(o)]).then((function(n){for(var i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=[],c=0,d=i.length;c<d;c++)!function(){var e,t=i[_i15],n=a[_i15],c=s[_i15],d=o[_i15],h=l[_i15];if(void 0!==t){switch(t.updateMatrix(),xe[h.path]){case xe.weights:e=r.NumberKeyframeTrack;break;case xe.rotation:e=r.QuaternionKeyframeTrack;break;default:e=r.VectorKeyframeTrack}var p=t.name||t.uuid,f=void 0!==d.interpolation?we[d.interpolation]:r.InterpolateLinear,m=[],g=(xe[h.path]===xe.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(p),c.array);if(c.normalized){for(var v=Me(g.constructor),y=new Float32Array(g.length),b=0,x=g.length;b<x;b++)y[b]=g[b]*v;g=y}for(var w=0,S=m.length;w<S;w++){var _=new e(m[w]+"."+xe[h.path],n.array,g,f);"CUBICSPLINE"===d.interpolation&&(_.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?pe:de)(this.times,this.values,this.getValueSize()/3,e)},_.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(_)}}}();return n=t.name||"animation_"+e,new r.AnimationClip(n,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){return e=n._getNodeRef(n.meshCache,r.mesh,e),void 0!==r.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t=this.json,n=this.extensions,i=this,a=t.nodes[e],s=a.name?i.createUniqueName(a.name):"";return function(){for(var t=[],n=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),r=(n&&t.push(n),void 0!==a.camera&&t.push(i.getDependency("camera",a.camera).then((function(e){return i._getNodeRef(i.cameraCache,a.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=a.children||[],o=0,l=s.length;o<l;o++)r.push(i.getDependency("node",s[o]));return n=void 0===a.skin?Promise.resolve(null):i.getDependency("skin",a.skin),Promise.all([Promise.all(t),Promise.all(r),n])}().then((function(t){var o=t[0],l=t[1],u=t[2],c=!0===a.isBone?new r.Bone:1<o.length?new r.Group:1===o.length?o[0]:new r.Object3D;if(c!==o[0])for(var d=0,h=o.length;d<h;d++)c.add(o[d]);a.name&&(c.userData.name=a.name,c.name=s),_e(c,a),a.extensions&&Se(n,c,a),void 0!==a.matrix?((t=new r.Matrix4).fromArray(a.matrix),c.applyMatrix4(t)):(void 0!==a.translation&&c.position.fromArray(a.translation),void 0!==a.rotation&&c.quaternion.fromArray(a.rotation),void 0!==a.scale&&c.scale.fromArray(a.scale)),i.associations.has(c)||i.associations.set(c,{}),i.associations.get(c).nodes=e,null!==u&&c.traverse((function(e){e.isSkinnedMesh&&e.bind(u,Ee)}));for(var p=0,f=l.length;p<f;p++)c.add(l[p]);return i.options.ex.loadNode({node:c,nodeDef:a})||c}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,n=(e=this.json.scenes[e],this),i=new r.Group,a=(e.name&&(i.name=n.createUniqueName(e.name)),_e(i,e),e.extensions&&Se(t,i,e),e.nodes||[]),s=[],o=0,l=a.length;o<l;o++)s.push(n.getDependency("node",a[o]));return Promise.all(s).then((function(e){for(var t=0,a=e.length;t<a;t++)i.add(e[t]);return n.options.ex.loadScene(i),n.associations=function(e){var t,i=new Map,a=N(n.associations);try{for(a.s();!(t=a.n()).done;){var s=O(t.value,2),o=s[0],l=s[1];(o instanceof r.Material||o instanceof r.Texture)&&i.set(o,l)}}catch(e){a.e(e)}finally{a.f()}return e.traverse((function(e){var t=n.associations.get(e);null!=t&&i.set(e,t)})),i}(i),i}))}}]),e}();function Pe(e,t,n){var i,a=t.attributes,s=[];for(i in a){var o=be[i]||i.toLowerCase();o in e.attributes||s.push(function(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}(a[i],o))}void 0===t.indices||e.index||(l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),_e(e,t);var l=e,u=t,c=n,d=u.attributes,h=new r.Box3;if(void 0!==d.POSITION){var p=(d=c.json.accessors[d.POSITION]).min,f=d.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{h.set(new r.Vector3(p[0],p[1],p[2]),new r.Vector3(f[0],f[1],f[2])),d.normalized&&(p=Me(me[d.componentType]),h.min.multiplyScalar(p),h.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var g=new r.Vector3,v=new r.Vector3,y=0,b=m.length;y<b;y++){var x,w,S=m[y];void 0!==S.POSITION&&(w=(S=c.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=Me(me[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}h.expandByVector(g)}l.boundingBox=h,f=new r.Sphere,h.getCenter(f.center),f.radius=h.min.distanceTo(h.max)/2,l.boundingSphere=f}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var r=e,i=t.targets,a=n,s=!1,o=!1,l=!1,u=0,c=i.length;u<c;u++){var d=i[u];if(void 0!==d.POSITION&&(s=!0),void 0!==d.NORMAL&&(o=!0),void 0!==d.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(r);for(var h=[],p=[],f=[],m=0,g=i.length;m<g;m++){var v,y=i[m];s&&(v=void 0!==y.POSITION?a.getDependency("accessor",y.POSITION):r.attributes.position,h.push(v)),o&&(v=void 0!==y.NORMAL?a.getDependency("accessor",y.NORMAL):r.attributes.normal,p.push(v)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,f.push(y))}return Promise.all([Promise.all(h),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],n=e[1];return e=e[2],s&&(r.morphAttributes.position=t),o&&(r.morphAttributes.normal=n),l&&(r.morphAttributes.color=e),r.morphTargetsRelative=!0,r}))}))}var ke=n(6272);class Oe{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new H;const n=this.draco=new p;n.setDecoderPath(e),this._gltf.setMeshoptDecoder(g),this._gltf.setDRACOLoader(n)}return t}parse(e){const{arrayBuffer:t,onDone:n,onError:r}=e;Oe.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(t,"",n,(e=>{console.log(e,"e"),r(e)}),this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:n,node:r,idMap:i,children:a}=e;i&&i.set(t,r);try{if(void 0!==a&&(null==a?void 0:a.length)===n.children.length){let e=!0;a.forEach((t=>{i.get(t)||(e=!1)})),e&&(n.children=[...i.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),i.clear())}}catch(e){console.log(e,"e")}}beforeParse(e){const{json:t,data:n}=e;if(n instanceof ArrayBuffer&&t.extensionsRequired&&t.extensionsRequired.find((e=>"KHR_draco_mesh_compression"===e)))return this.runScene.loaderer.gltf.parseByCompressAb(n)}processOriginUnDecodeArrayBuffer(e){const t=this.runScene.loaderer.getTextDecoder(),n=t.decode(e.slice(0,1e3));if(n.includes("v")){var{v:r,l:i}=JSON.parse(n);if("0.1"===ke.Uf.decrypt(r)){const n=t.decode(e.slice(e.byteLength-i));r=JSON.parse(n);const s={};return(0,a.mapObj)(r,((t,n)=>{s[t]=e.slice(n.begin,n.end)})),s.draco_decoder&&Oe.draco.setCatch({draco_decoder:s.draco_decoder,draco_wasm_wrapper:t.decode(s.draco_wasm_wrapper)}),s.data}}}}var Ae=n(1794);class Ce{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof M?(this.helper.isImageBitmapLoader=!0,e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})):this.helper.isImageBitmapLoader=!1}}class Ne{constructor(e,t){this.pending=[],this.models=[],this.module=new Ae.Z,this.isImageBitmapLoader=!0,this.runScene=e,this.loadConfig=t,this.bindCallback(),this.options=new Ce(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}complete(e,t){this.parseSavedMap(t),this.callback("complete",{models:e,json:t})}clean(){}parseSavedMap(e){var t;(e=null==(e=null==(e=null==e?void 0:e.asset)?void 0:e.ex)?void 0:e.savedMap)&&null!=(t=this.module.get("material"))&&t.parseSavedMap(e.materialIds)}loadTexture(e){return e=this.callback("loadTexture",e),Promise.all(e)}processBase64(e){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,ke.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}bindCallback(){const e="loaded-gltf-core";this.runScene.cb.load.modelAdded.add(e,(t=>{this.callback("modelAdded",t),this.runScene.cb.load.modelAdded.delete(e)}))}callback(e,t){var n,r;return this.loadConfig.triggerCb&&null!=(n=null==(r=this.runScene.cb.loaderer.gltf[e])?void 0:r.cb)&&n.call(r,t),null!=(r=null==(n=this.loadConfig.callBack)?void 0:n[e])&&r.call(n,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}var Le=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class Ie{constructor(e){this.dracoPath="./draco/",this.draco=new p,this.parseByCompressAb=e=>{var t=new TextDecoder("utf-8"),n=t.decode(e).split("_||_");if(1===n.length)return e;n=JSON.parse((0,a.lastArrayEle)(n));const r={};return(0,a.mapObj)(n,((t,n)=>{r[t]=e.slice(n.begin,n.end)})),Oe.draco.setCatch({draco_decoder:r.draco_decoder,draco_wasm_wrapper:t.decode(r.draco_wasm_wrapper)}),r.data},this.runScene=e}load(e,t){return Le(this,void 0,void 0,(function*(){var n=yield i().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var n,{total:e,loaded:r}=e;let i=r/e;1<(i=i<0?0:i)&&(i=1);var r=Number(i.toFixed(2));e=Math.floor(100*r),null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&n.call(r,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return n?this.parse(n,t):Promise.resolve()}))}parse(e,t){e instanceof ArrayBuffer||(e=e.substring(e.indexOf("{")));const n=(0,f.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0,modelAdded:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),r=new Ne(this.runScene,n);return r.callback("getArrayBuffer",e),new Promise((t=>{new Oe({rootModel:this.runScene.assetsEx.get().scene,models:[],core:r,runScene:this.runScene,loadConfig:n,mode:this.runScene.optionsEx.options.mode},this.runScene).parse({arrayBuffer:e,onDone:e=>Le(this,void 0,void 0,(function*(){r.callback("loadedGltf",e);try{yield this.afterParse(e.parser.options.ex.options,e,n)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}r.callback("modelLoaded",r.models),t({models:r.models,loadConfig:n})})),onError:e=>{console.log(e,"_a")}})}))}parseForStr(e,t){const n=(0,f.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0,modelAdded:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),r=new Ne(this.runScene,n);return r.callback("getArrayBuffer",e),new Promise((t=>{new Oe({rootModel:this.runScene.assetsEx.get().scene,models:[],core:r,runScene:this.runScene,loadConfig:n,mode:this.runScene.optionsEx.options.mode},this.runScene).parse({arrayBuffer:e,onDone:e=>Le(this,void 0,void 0,(function*(){r.callback("loadedGltf",e);try{yield this.afterParse(e.parser.options.ex.options,e,n)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}r.callback("modelLoaded",r.models),t({models:r.models,loadConfig:n})})),onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,n){var r;return Le(this,void 0,void 0,(function*(){const i=e.core;yield Promise.all(i.pending),i.callback("afterParse",{options:e,json:t,loadConfig:n});var{cleanJSON:a,callBack:s}=n;if(!t.asset.ex){const{models:n,core:r}=e,i=this.runScene.sceneEx.cleanUnlessLevel(n[0]);i.traverse((e=>{e.material&&this.runScene.materialEx.afterLoader(e.material)})),r.models.push(i),0<t.animations.length&&(i.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),i.complete(e.models,t),null!=(r=null==s?void 0:s.getJSON)&&r.call(s,t),a&&this.disposeJSON(t),i.clean()}))}disposeJSON(e){}}var Re=n(3736),Ue=n(110);class Be{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new Fe(e)}parse(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Fe{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Re.M)(t,"type",Ue.Z.tools.type),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}var je=n(3243);class ze{constructor(e){this.imgBitMap=new r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.textureLoader=new r.TextureLoader,this.lut3dlLoader=new je.LUT3dlLoader,this.lutCubeLoader=new je.LUTCubeLoader,this.getTextEncoder=()=>this.textEncoder||(this.textEncoder=new TextEncoder),this.getTextDecoder=()=>this.textDecoder||(this.textDecoder=new TextDecoder),this.runScene=e,this.gltf=new Ie(e),this.json=new Be(e)}getTexture(e,t){return("3dl"===(t=(t||{}).type)||/.3dl$/im.test(e)?this.lut3dlLoader:"cube"===t||/.cube$/im.test(e)?this.lutCubeLoader:this.textureLoader).loadAsync(e)}}const Ve=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}}},7013:(e,t,n)=>{n.d(t,{Ws:()=>Re,ZP:()=>Ue,ee:()=>Be}),t=n(3447);var r=n(2218),i=n(6053),a=n(135),s=n(144),o=n(6001),l=n(5521),u=n(960),c=n(272),d=n(5124),h=n(3736),p=n(1398),f=n(9151),m=n(3735),g=n(2233),v=n(6272);class y extends l.ShaderMaterial{constructor(e){super(e)}set opacity(e){var t;null!=(t=this.uniforms)&&t.opacity&&(this.uniforms.opacity.value=e)}get opacity(){var e;return(null==(e=null==(e=this.uniforms)?void 0:e.opacity)?void 0:e.value)||1}}var b,x=n(6282);const w={opacity:s.Gf.opacity},S=["depthTest","depthWrite","fog","wireframe","side","transparent"];class _{constructor(e){this.map=new c.Z,this.clock=new l.Clock,this.render=()=>{const e=this.clock.getElapsedTime();this.map.map((t=>{t.render({material:t.material,time:e,runScene:this.runScene})}))},this.baseUrl="./assets/image/textures/shader/",this.textureLoader=new l.TextureLoader,this.iChannel0=new l.Texture,this.iChannel1=new l.Texture,this.iChannel2=new l.Texture,this.iChannel3=new l.Texture,this.init=()=>function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var e;"editor"===(0,d.F)(this.runScene).mode&&(this.iChannel0=yield this.textureLoader.loadAsync(this.baseUrl+"下载.png"),e=yield(0,v.sR)(this.baseUrl+"下载.png","blob"),this.iChannel0.userData.blob=e)})),(this.runScene=e).cb.render.add(_.tools.type,this.render),e.cb.exporter.gltf.assets.bindTexture.add("ex-material",(({map:e})=>(this.iChannel0&&((0,g.x)(this.iChannel0,"this.iChannel0"),e.set("this.iChannel0",this.iChannel0)),Promise.resolve()))),e.textureEx.setAwaitLoaded("this.iChannel0",(e=>{this.iChannel0=e,f.textureAssets.set(e,!0)})),e.cb.inited.add("ex-material",this.init)}createByType(e){var t=x.sC[e];let n=t.uniforms||{iTime:{value:0},MAX_RADIUS:{value:10},iChannelResolution:{value:[new l.Vector2(1900,1900)]},iResolution:{value:new l.Vector2(1900,1900)},iMouse:{value:new l.Vector3(100,100,100)},iChannel0:{value:this.iChannel0},iChannel1:{value:this.iChannel1},iChannel2:{value:this.iChannel2},iChannel3:{value:this.iChannel3}};n.iChannel0||(n.iChannel0={}),n.fogColor||(n.fogColor={value:new l.Color("#ffffff")}),(n=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),l.UniformsLib.common),l.UniformsLib.specularmap),l.UniformsLib.envmap),l.UniformsLib.aomap),l.UniformsLib.lightmap),l.UniformsLib.fog)).iChannel0.value=this.iChannel0;const r=new y({uniforms:n,side:2,depthWrite:!1,transparent:!0,vertexShader:t.vertex||x.iB,fragmentShader:t.fragmentShader});return _.tools.bind(r,e),this.map.add({type:e,material:r,render:t.render}),r.depthTest=!0,r.depthWrite=!0,r}}(b=_).tools={type:"ExMaterial",bind(e,t){(0,h.M)(e,"type",_.tools.type),(0,h.M)(e,"subType",t)},create:()=>{var e=new l.LineBasicMaterial;return b.tools.bind(e),e},parseData:(e,t)=>{const{texture:n,normal:r,core:i}=e,{data:a,load:s}=n;var{subType:e,uniforms:l,base:c}=r;const d=t.materialEx.def.map.ExMaterial.createByType(e),h=(c&&(0,o.mapObj)(c,((e,t)=>{d[e]=t})),[]);return s&&(t=u.F6.filter(a.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{i.runScene.materialEx.setTexture({material:d,type:t,newVal:n},!1)}}))),h.push(...t)),l&&(0,o.mapObj)(l,((e,t)=>{d.uniforms[e]&&(d.uniforms[e].value=t.value)})),i.runScene.materialEx.parseNromals(r,d),b.tools.bind(d,e),{material:d,setTextureFns:h}},toNormal:(e,t)=>{var n=e.userData.subType;const r={},i=((0,o.mapObj)(e.uniforms,((e,t)=>{t.isTemp||!t.type||(0,v.Ft)(t.value)||(r[e]={value:t.value})})),{});return S.map((t=>{var n=e[t];n!==s.ZP.defVal[t]&&(i[t]=n)})),e.fog&&(i.fog=!0),{material:t.materialEx.create("BasicMaterial"),normal:{type:b.tools.type,subType:n,uniforms:r,base:i},textures:[]}},clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>p.LV.getDiff(w,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:w,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}},validType:e=>e.userData.type===b.tools.type,setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},textureNames:[]};var T,M,E,D,P=n(6651);class k{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;k.TextureNames.includes((0,o.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,o.lastArrayEle)(t),newVal:n}):this.runScene.undoEx.addUndo(new m.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}}(T=k).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],k.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],k.tools={type:"FakeInterior",textureNames:T.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:["uniforms",n,"value"],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e.uniforms[t].value},getTextures:e=>{const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},create:(e,t)=>{var n=new l.ShaderMaterial({uniforms:(0,P.d9)(O.uniforms),vertexShader:O.vertexShader,fragmentShader:O.fragmentShader});return T.tools.bind(n),n},parseData:(e,t)=>{const{texture:n,normal:r,material:i}=e,{data:a,load:s}=n,o=new l.ShaderMaterial({uniforms:(0,P.d9)(O.uniforms),vertexShader:O.vertexShader,fragmentShader:O.fragmentShader}),u=[];return s&&u.push(...a.map((e=>()=>{t.materialEx.setTexture({material:o,type:e.type,newVal:e.texture})}))),Object.keys(r.uniforms).filter((e=>!k.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];o.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new l.Vector4(t.x,t.y,t.z,t.w):t})),o.name=r.name,o.userData.id=i.userData.id,T.tools.bind(o),{material:o,setTextureFns:u}},toNormal:e=>{const t=(0,a.createDefMaterial)(),n=(t.userData=Object.assign({},t.userData),{}),r=e.uniforms,i=O.uniforms;return Object.keys(r).filter((e=>!k.TextureNames.includes(e))).map((e=>{var t,a,s,o,u,c,d=r[e].value,h=i[e].value;d instanceof l.Vector4?(({x:t,y:a,z:s}=d),({x:o,y:u,z:c}=h),t===o&&a===u&&s===c||(n[e]=d)):d!==h&&(n[e]=d)})),{material:t,normal:{type:T.tools.type,uniforms:n,name:e.name},textures:T.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=T.tools.create(t);return Object.keys(n).filter((e=>!k.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",T.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const O={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new l.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new l.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new l.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "},A={depthTest:s.Gf.depthTest,depthWrite:s.Gf.depthWrite,emissive:s.Gf.emissive,emissiveMap:s.Gf.emissiveMap,envMap:s.Gf.envMap,envMapIntensity:s.Gf.envMapIntensity,isSurge:{type:"other",label:["isSurge","value"],val:!1,shortKey:"is"},fresnelBias:{type:"number",label:["fresnelBias","value"],val:0,shortKey:"fb"},fresnelScale:{type:"number",label:["fresnelScale","value"],val:1,shortKey:"fs"},fresnelPower:{type:"number",label:["fresnelPower","value"],val:3,shortKey:"fp"},thickness:{type:"number",val:0,shortKey:"thn"},ior:{type:"number",val:1.5,shortKey:"ior"}};class C{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;C.TextureNames.includes((0,o.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,o.lastArrayEle)(t),newVal:n}).then():this.runScene.undoEx.addUndo(new m.Z({target:e,typeList:[...t],newVal:n}).execute())}}(M=C).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],C.TextureNames=["envMap","displacementMap"],C.tools={type:"Fresnel",textureNames:M.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},create:(e,t)=>{const n=new N(void 0,void 0,e);return n.insertFresnelShader(),M.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name),n},parseData:(e,t)=>{const{texture:n,normal:r,material:i}=e,{data:s,load:o}=n,l=(0,a.mergeMaterial)(i,new N(void 0,void 0,t)),u=[];return o&&u.push(...s.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture},!1)}))),Object.keys(r.uniforms).filter((e=>!C.TextureNames.includes(e))).map((e=>{l[e]=r.uniforms[e]})),l.insertFresnelShader(),l.name=r.name,l.userData.id=i.userData.id,M.tools.bind(l),{material:l,setTextureFns:u}},toNormal:e=>{const t=(0,a.mergeMaterial)(e,(0,a.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=L.uniforms;return Object.keys(r).filter((e=>!C.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),{material:t,normal:{type:M.tools.type,uniforms:n,name:e.name},textures:M.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=M.tools.create(t);return Object.keys(n).filter((e=>!C.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",M.tools.type)},validType:e=>"Fresnel"===e.userData.type,snapshot:{getDiff:e=>p.LV.getDiff(A,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:A,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};class N extends l.MeshPhysicalMaterial{constructor(e,t,n){if(e?super(e):(super(),this.emissive=new l.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=n,this.isSpecialMaterial=!0,t?(this.fresnelBias=new l.Uniform(t.fresnelBias),this.fresnelScale=new l.Uniform(t.fresnelScale),this.fresnelPower=new l.Uniform(t.fresnelPower)):(this.fresnelBias=new l.Uniform(L.uniforms.fresnelBias.value),this.fresnelScale=new l.Uniform(L.uniforms.fresnelScale.value),this.fresnelPower=new l.Uniform(L.uniforms.fresnelPower.value)),this.clock=new l.Clock,this.isSurge=new l.Uniform(!1),this.deltaTime=new l.Uniform(0),!this.cubeCamera){const e=new l.WebGLCubeRenderTarget(2048);e.texture.mapping=l.CubeRefractionMapping,this.cubeCamera=new l.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vViewPosition;/g,L.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,L.vertexShader1),e.vertexShader=e.vertexShader.replace(/#include <worldpos_vertex>/g,L.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/varying vec3 vViewPosition;/g,L.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,L.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const L={uniforms:{isSurge:new l.Uniform(!1),deltaTime:new l.Uniform(0),fresnelBias:new l.Uniform(0),fresnelScale:new l.Uniform(1),fresnelPower:new l.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vCustomWP;\n varying vec3 vCustomWN;\n varying vec3 vViewPosition;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vec4 worldPosition = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n vCustomWP = worldPosition.xyz;\n vCustomWN = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n varying vec3 vCustomWP;\n varying vec3 vCustomWN;\n varying vec3 vViewPosition;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vCustomWP);\n float fresnelNdot = dot(viewDir, vCustomWN);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "},I={color:s.Gf.color,opacity:s.Gf.opacity};class R{constructor(e){this.runScene=e}}(E=R).tools={type:"LineBasicMaterial",bind(e){(0,h.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new l.LineBasicMaterial;return E.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:r,material:i}=e,{data:a,load:s}=t,o=[];return s&&o.push(...u.F6.filter(a.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{r.runScene.materialEx.setTexture({material:i,type:t,newVal:n},!1)}})))),r.runScene.materialEx.parseNromals(n,i),E.tools.bind(i),{material:i,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:E.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>p.LV.getDiff(I,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:I,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}},validType:e=>e.type===E.tools.type,setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},textureNames:[]};const U={color:s.Gf.color,map:s.Gf.map,transparent:s.Gf.transparent,opacity:s.Gf.opacity,alphaMap:s.Gf.alphaMap,depthTest:s.Gf.depthTest,depthWrite:s.Gf.depthWrite,matcap:{type:"texture",val:null,shortKey:"mc"},bumpScale:{type:"number",val:1,shortKey:"bs"},bumpMap:{type:"texture",val:null,shortKey:"bm"}};class B{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;B.TextureNames.includes((0,o.lastArrayEle)(n))?this.runScene.materialEx.setTexture({material:t,type:(0,o.lastArrayEle)(n),newVal:r}).then():this.runScene.undoEx.addUndo(new m.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(D=B).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],B.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],B.tools={type:"Matcap",textureNames:D.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return B.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new l.MeshMatcapMaterial;return D.tools.bind(n),(t=t||e.modelEx.select)&&(n.name="Matcap-"+t.name),n},parseData:(e,t)=>{const{normal:n,texture:r,material:i}=e,{data:s,load:o}=r,u=(0,a.mergeMaterial)(i,new l.MeshMatcapMaterial),c=(delete u.emissive,[]);return o&&c.push(...s.map((e=>()=>{t.materialEx.setTexture({material:u,type:e.type,newVal:e.texture},!1)}))),Object.keys(n.uniforms).filter((e=>!B.IgnoredAttributes.includes(e))).map((e=>{u[e]="normalScale"===e?new l.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),u.name=n.name,u.userData.id=i.userData.id,D.tools.bind(u),{material:u,setTextureFns:c}},toNormal:e=>{var t=D.tools.getTextures(e);const n=(0,a.mergeMaterial)(e,(0,a.createDefMaterial)()),r=(n.userData=Object.assign({},n.userData),n.name=e.name,{}),i=new l.MeshMatcapMaterial;return Object.keys(e).filter((e=>!B.TextureNames.includes(e))).filter((e=>!B.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],a=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?n!==a&&(r[t]=n):"normalScale"!==t||n.x===a.x&&n.y===a.y||(r[t]=n)})),{material:n,normal:{type:D.tools.type,uniforms:r,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const n=D.tools.create(t);return Object.keys(n).filter((e=>!B.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",D.tools.type)},validType:e=>"Matcap"===e.userData.type,snapshot:{getDiff:e=>p.LV.getDiff(U,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:U,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};class F extends l.MeshStandardMaterial{constructor(e){super(e),this._tDepth={value:null},this._distortionMap={value:null},this._tDiffuse={value:null},this._tDiffuseBlur={value:null},this._textureMatrix={value:null},this._hasBlur={value:!1},this._mirror={value:0},this._mixBlur={value:0},this._blurStrength={value:.5},this._minDepthThreshold={value:.9},this._maxDepthThreshold={value:1},this._depthScale={value:0},this._depthToBlurRatioBias={value:.25},this._distortion={value:1},this._mixContrast={value:1},this.setValues(e)}onBeforeCompile(e){var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),e.uniforms.hasBlur=this._hasBlur,e.uniforms.tDiffuse=this._tDiffuse,e.uniforms.tDepth=this._tDepth,e.uniforms.distortionMap=this._distortionMap,e.uniforms.tDiffuseBlur=this._tDiffuseBlur,this._textureMatrix.value||(this._textureMatrix.value=new l.Matrix4),e.uniforms.textureMatrix=this._textureMatrix,e.uniforms.mirror=this._mirror,e.uniforms.mixBlur=this._mixBlur,e.uniforms.mixStrength=this._blurStrength,e.uniforms.minDepthThreshold=this._minDepthThreshold,e.uniforms.maxDepthThreshold=this._maxDepthThreshold,e.uniforms.depthScale=this._depthScale,e.uniforms.depthToBlurRatioBias=this._depthToBlurRatioBias,e.uniforms.distortion=this._distortion,e.uniforms.mixContrast=this._mixContrast,e.vertexShader="\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n "+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>","#include <project_vertex>\n my_vUv = textureMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );"),e.fragmentShader="\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float cameraNear;\n\t\t\t uniform float cameraFar;\n uniform bool hasBlur;\n uniform float mixBlur;\n uniform float mirror;\n uniform float mixStrength;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float mixContrast;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n "+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>","#include <emissivemap_fragment>\n\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n\n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n\n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n\n vec4 merge = base;\n\n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n\n float depthFactor = 0.0001;\n float blurFactor = 0.0;\n\n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n\n #endif\n\n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n\n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n\n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n\n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n ")}get tDiffuse(){return this._tDiffuse.value}set tDiffuse(e){this._tDiffuse.value=e}get tDepth(){return this._tDepth.value}set tDepth(e){this._tDepth.value=e}get distortionMap(){return this._distortionMap.value}set distortionMap(e){this._distortionMap.value=e}get tDiffuseBlur(){var e;return null==(e=this._tDiffuseBlur)?void 0:e.value}set tDiffuseBlur(e){this._tDiffuseBlur.value=e}get textureMatrix(){var e;return null==(e=this._textureMatrix)?void 0:e.value}set textureMatrix(e){this._textureMatrix||(this._textureMatrix=new l.Uniform(new l.Matrix4)),this._textureMatrix.value=e}get hasBlur(){return this._hasBlur.value}set hasBlur(e){this._hasBlur.value=e}get mirror(){return this._mirror.value}set mirror(e){this._mirror.value=e}get mixBlur(){return this._mixBlur.value}set mixBlur(e){this._mixBlur.value=e}get mixStrength(){return this._blurStrength.value}set mixStrength(e){this._blurStrength.value=e}get minDepthThreshold(){return this._minDepthThreshold.value}set minDepthThreshold(e){this._minDepthThreshold.value=e}get maxDepthThreshold(){return this._maxDepthThreshold.value}set maxDepthThreshold(e){this._maxDepthThreshold.value=e}get depthScale(){return this._depthScale.value}set depthScale(e){this._depthScale.value=e}get depthToBlurRatioBias(){return this._depthToBlurRatioBias.value}set depthToBlurRatioBias(e){this._depthToBlurRatioBias.value=e}get distortion(){return this._distortion.value}set distortion(e){this._distortion.value=e}get mixContrast(){return this._mixContrast.value}set mixContrast(e){this._mixContrast.value=e}}const j="\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat noise2D(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\nvec2 i1;\n//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n//i1.y = 1.0 - i1.x;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n// x0 = x0 - 0.0 + 0.0 * C.xx ;\n// x1 = x0 - i1 + 1.0 * C.xx ;\n// x2 = x0 - 1.0 + 2.0 * C.xx ;\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\n\n// Permutations\ni = mod289(i); // Avoid truncation effects in permutation\nvec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\n ",z="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float noise3D(vec3 v) {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n \n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n \n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;\n // -1.0+3.0*C.x = -0.5 = -D.y\n \n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n }\n ",V="\nuniform float fbmAmplitude;\nuniform float fbmFrequency;\n\nfloat fbm(vec2 st) {\n // 控制噪声的不同层次\n float value = 0.0;\n float amplitude = fbmAmplitude;\n float frequency = fbmFrequency;\n // 累加多个噪声层次\n for (int i = 0; i < 5; ++i) {\n value += amplitude * noise2D(st * frequency);\n amplitude *= 0.5; // 减小振幅\n frequency *= 2.0; // 增加频率\n }\n // FBM默认输出范围是[-1, 1]\n return value;\n}\n ",H={defines:{USE_UV:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null]},maskArray:{value:[null,null,null,null,null]},mapUvTransArray:{value:[new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3]},maskUvTransArray:{value:[new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3]},diffuse:{value:new l.Color(16777215)},uvTransform:{value:new l.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};var W,G=n(9430);const K={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[0]=n},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[1]=n},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[2]=n},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[3]=n},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[4]=n},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[5]=n},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[6]=n},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.mapArray.value[7]=n},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[0]=n},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[1]=n},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[2]=n},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[3]=n},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[4]=n},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[5]=n},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.maskArray.value[6]=n},shortKey:"k6"}};class Z{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e,i=n[0],a=(0,o.lastArrayEle)(n),s=i+"-"+a;if(Z.BaseTextureNames.includes(i)){const e=Ue.getTexture({material:t,type:s});this.runScene.undoEx.addUndo(new G.Z({undo:()=>{t.uniforms[i].value[Number(a)]=e,this.runScene.cb.texture.setMaterial.cb({target:t,type:s,oldVal:r,val:e,targetType:"material"})},redo:()=>{t.uniforms[i].value[Number(a)]=r,this.runScene.cb.texture.setMaterial.cb({target:t,type:s,oldVal:e,val:r,targetType:"material"})}}).execute())}else this.runScene.undoEx.addUndo(new m.Z({target:t,typeList:["uniforms",...n],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=H.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=H.vertex,t.fragmentShader=H.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,j)})}mergeUniforms(e,t){if(e&&t)for(const n in e)t[n]=e[n]}onTexRepeatChange(e,t,n){var r;e&&0<=t&&(n?(n=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale((null==(r=null==n?void 0:n.repeat)?void 0:r.x)||1,(null==(r=null==n?void 0:n.repeat)?void 0:r.y)||1)):(n=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale((null==(r=null==n?void 0:n.repeat)?void 0:r.x)||1,(null==(e=null==n?void 0:n.repeat)?void 0:e.y)||1)))}}(W=Z).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],Z.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],Z.BaseTextureNames=["maskArray","mapArray"],Z.tools={type:"MixTexture",textureNames:W.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:n,texture:r}=e;var[e,i]=n.split("-");return e=new m.Z({target:t,typeList:["uniforms",e,"value",i+""],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){const{material:t,type:n}=e;var[e,r]=n.split("-");return t.uniforms[e].value[Number(r)]},getTextures:e=>{const t=[];return Z.TextureNames.forEach((n=>{var r=parseInt(n.slice(-1));n.startsWith("terrainMap")?e.uniforms.mapArray.value[r]&&t.push({type:n,texture:e.uniforms.mapArray.value[r]}):n.startsWith("terrainMask")&&e.uniforms.maskArray.value[r]&&t.push({type:n,texture:e.uniforms.maskArray.value[r]})})),t},create:(e,t)=>{const n=new l.ShadowMaterial({color:0,opacity:1});return n.uniforms=l.UniformsUtils.clone(H.uniforms),e.materialEx.def.map.MixTexture.insertShader(n),W.tools.bind(n),n},parseData:(e,t)=>{const{texture:n,normal:r,material:i}=e,{data:a,load:s}=n,o=new l.ShadowMaterial({color:0,opacity:1}),u=(o.uniforms=l.UniformsUtils.clone(H.uniforms),t.materialEx.def.map.MixTexture.insertShader(o),[]);return s&&u.push(...a.map((e=>()=>{var n=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(o.uniforms.mapArray.value[n]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(o,n,!0),t.cb.texture.setMaterial.cb({target:o,type:"mapArray-"+n,oldVal:null,val:e.texture,targetType:"material"})):e.type.startsWith("terrainMask")&&(o.uniforms.maskArray.value[n]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(o,n,!1),t.cb.texture.setMaterial.cb({target:o,type:"maskArray-"+n,oldVal:null,val:e.texture,targetType:"material"}))}))),Object.keys(r.uniforms).filter((e=>!Z.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];"diffuse"===e?o.uniforms[e].value=new l.Color(parseInt(t,16)):"uvTransform"!==e&&(o.uniforms[e].value=t)})),o.name=r.name,o.userData.id=i.userData.id,W.tools.bind(o),{material:o,setTextureFns:u}},toNormal:e=>{const t=(0,a.createDefMaterial)(),n=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:W.tools.type,uniforms:{},name:e.name},textures:W.tools.getTextures(e)}),{}),r=e.uniforms,i=H.uniforms;return Object.keys(r).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=r[e].value,a=i[e].value;"diffuse"===e?t.getHexString()!==a.getHexString()&&(n[e]=t.getHexString()):"uvTransform"!==e&&t!==a&&(n[e]=t)})),{material:t,normal:{type:W.tools.type,uniforms:n,name:e.name},textures:W.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=W.tools.create(t);return Object.keys(n).filter((e=>!Z.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",W.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>p.LV.getDiff(K,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:K,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};var q,X=n(4156),Y=n(9457);class Q{constructor(e){this.runScene=e}}(q=Q).tools={type:"MyPointsMaterial",bind(e){(0,h.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var n=e[t];if(n)return{type:t,texture:n}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),q.tools.bind(t),t),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},parseData:(e,t)=>{var{texture:e,material:n,normal:r}=e;const{data:i,load:s}=e,o=[];var{name:e,size:r}=r;const l=Q.tools.create({size:r},t);return(0,g.x)(l,(0,g.Ki)(n)),l.fog=n.fog,e&&(l.name=e),s&&o.push(...i.map((e=>{const{type:n,texture:r}=e;return()=>{t.materialEx.setTexture({material:l,type:n,newVal:r},!1),(0,a.updateMaterial)(l)}}))),{material:l,setTextureFns:o}},toNormal:e=>{const t=(0,a.createDefMaterial)();var n={type:Q.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:n,textures:Q.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=Q.tools.type,t},textureNames:[]};var J,$=n(110),ee=n(9663),te=n(5247);const ne={color:s.Gf.color,map:s.Gf.map,emissive:s.Gf.emissive,emissiveMap:s.Gf.emissiveMap,roughness:s.Gf.roughness,roughnessMap:s.Gf.roughnessMap,metalness:s.Gf.metalness,metalnessMap:s.Gf.metalnessMap,lightMap:s.Gf.lightMap,lightMapIntensity:s.Gf.lightMapIntensity,envMap:s.Gf.envMap,envMapIntensity:s.Gf.envMapIntensity,transparent:s.Gf.transparent,opacity:s.Gf.opacity,alphaMap:s.Gf.alphaMap,depthTest:s.Gf.depthTest,depthWrite:s.Gf.depthWrite,fog:s.Gf.fog,attenuationColor:{type:"color",val:{r:1,g:1,b:1},shortKey:"atc"},attenuationDistance:{type:"number",val:1,shortKey:"atd"},clearcoat:{type:"number",val:0,shortKey:"cc"},clearcoatMap:{type:"texture",val:null,shortKey:"cct"},clearcoatRoughness:{type:"number",val:0,shortKey:"ccr"},clearcoatRoughnessMap:{type:"texture",val:null,shortKey:"ccrt"},ior:{type:"number",val:1.5,shortKey:"ior"},reflectivity:{type:"number",val:.5,shortKey:"refl"},sheen:{type:"number",val:0,shortKey:"sh"},sheenRoughness:{type:"number",val:1,shortKey:"shr"},sheenRoughnessMap:{type:"texture",val:null,shortKey:"shrt"},sheenColor:{type:"color",val:{r:0,g:0,b:0},shortKey:"shc"},sheenColorMap:{type:"texture",val:null,shortKey:"shct"},specularIntensity:{type:"number",val:1,shortKey:"si"},specularIntensityMap:{type:"texture",val:null,shortKey:"sit"},specularColor:{type:"color",val:{r:1,g:1,b:1},shortKey:"sc"},specularColorMap:{type:"texture",val:null,shortKey:"sct"},thickness:{type:"number",val:0,shortKey:"th"},thicknessMap:{type:"texture",val:null,shortKey:"tht"},transmission:{type:"number",val:0,shortKey:"tr"},transmissionMap:{type:"texture",val:null,shortKey:"trt"},iridescence:{type:"number",val:0,shortKey:"ir"},iridescenceMap:{type:"texture",val:null,shortKey:"irt"},iridescenceIOR:{type:"number",val:1.3,shortKey:"iri"},iridescenceThicknessMap:{type:"texture",val:null,shortKey:"irtht"}};class re{constructor(e){this.runScene=e,this.runScene.cb.texture.setInfo.add("Physical",(({type:t,texture:n})=>{"repeat"===t&&(t=e.uniqueEx.texture.getMaterials((0,g.Ki)(n)))&&(0,o.mapObj)(t,(t=>{(t=e.uniqueEx.material.get(t))&&(Ue.getTypeByMaterial(t),re.tools.type)}))}))}undo(e){var{material:e,list:t,val:n}=e;re.TextureNames.includes((0,o.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,o.lastArrayEle)(t),newVal:n}).then():this.runScene.undoEx.addUndo(new m.Z({target:e,typeList:[...t],newVal:n}).execute())}}(J=re).IgnoredAttributes=["_listeners","version","userData","color","emissive","uuid","name","type","defines","onBeforeCompile"],re.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap","iridescenceMap","iridescenceThicknessMap"],re.tools={type:"Physical",textureNames:J.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return re.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new te.Z.MeshPhysicalMaterial;return J.tools.bind(n),(t=t||e.modelEx.select)&&(n.name="Physical-"+t.name),n},parseData:(e,t)=>{const{normal:n,texture:r,material:i}=e,{data:s,load:o}=r,l=(0,a.mergeMaterial)(i,new te.Z.MeshPhysicalMaterial),u=[];return o&&u.push(...s.map((e=>()=>{t.materialEx.setTexture({material:l,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(n.uniforms).filter((e=>!re.IgnoredAttributes.includes(e))).map((e=>{var t=n.uniforms[e];"attenuationColor"===e||"sheenColor"===e||"specularColor"===e?l[e]=(0,ee.ZD)(t):"clearcoatNormalScale"===e?l[e]=new te.Z.Vector2(t.x,t.y):"normalScale"===e?l[e].set(t,t):l[e]=t})),l.name=n.name,l.userData.id=i.userData.id,J.tools.bind(l),{material:l,setTextureFns:u}},toNormal:e=>{const t=(0,a.mergeMaterial)(e,(0,a.createDefMaterial)()),n=(t.name=e.name,{}),r=new te.Z.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!re.TextureNames.includes(e))).filter((e=>!re.IgnoredAttributes.includes(e))).map((t=>{let i=e[t];const a=r[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==a.getHexString()&&(n[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===a.x&&i.y===a.y||(n[t]=i):"normalScale"===t?i.x===a.x&&i.y===a.y||(n[t]=i.x):(0,v.Xq)(a,i)&&(n[t]=i)})),{material:t,normal:{type:J.tools.type,uniforms:n,name:e.name},textures:J.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=J.tools.create(t);return Object.keys(n).filter((e=>!re.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n.color.copy(e.color),n.emissive.copy(e.emissive),n},bind:e=>{(0,h.M)(e,"type",J.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type,snapshot:{getDiff:e=>p.LV.getDiff(ne,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:ne,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};var ie=n(1705);const ae={uniforms:{tDiffuse:new l.Uniform(null),h:new l.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},se={uniforms:{tDiffuse:new l.Uniform(null),v:new l.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};var oe,le,ue,ce;new l.Uniform(null),new l.Uniform(null),new l.Uniform(0),new l.Uniform(0),new l.Uniform(0),new l.Uniform(new l.Vector2),new l.Uniform(.1),new l.Uniform(1e3);class de{constructor(e){this.materials={},this.render=()=>{(0,o.mapObj)(this.materials,((e,t)=>{const{model:n,material:r}=t;r.update(n)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var n=(0,o.getId)();t.userData.id=n,this.materials[n]=e}undo(e){var{material:e,list:t,val:n}=e;de.TextureNames.includes((0,o.lastArrayEle)(t))?this.runScene.materialEx.setTexture({material:e,type:(0,o.lastArrayEle)(t),newVal:n}).then():this.runScene.undoEx.addUndo(new m.Z({target:e,typeList:[...t],newVal:n}).execute())}dispose(){this.materials={}}}(oe=de).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],de.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],de.tools={type:"Reflector",textureNames:oe.TextureNames.map((e=>({type:e}))),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>(0,a.getTexturesByMaterial)(e),create:(e,t)=>{const n=new he(void 0,void 0,e);return n.insertReflectorShader(),oe.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:n}),n},parseData:(e,t)=>{const{texture:n,normal:r,models:i,material:s}=e,{data:o,load:u}=n,c=(0,a.mergeMaterial)(s,new he(void 0,void 0,t)),d=[];return u&&d.push(...o.map((e=>()=>{t.materialEx.setTexture({material:c,type:e.type,newVal:e.texture},!1)}))),Object.keys(r.uniforms).filter((e=>!de.TextureNames.includes(e))).map((e=>{c[e]="normalScale"===e?new l.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.uniforms[e]})),c.setRTSize(c.resolution),c.setBlurPass(c.blurSize),c.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:i[0],material:c}),c.name=r.name,c.userData.id=s.userData.id,oe.tools.bind(c),{material:c,setTextureFns:d}},toNormal:e=>{const t=(0,a.mergeMaterial)(e,(0,a.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=pe.uniforms;return Object.keys(r).filter((e=>!de.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),t.normalScale&&(n.normalScale=t.normalScale),{material:t,normal:{type:oe.tools.type,uniforms:n,name:e.name},textures:oe.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=oe.tools.create(t);return Object.keys(n).filter((e=>!de.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",oe.tools.type)},validType:e=>"Reflector"===e.userData.type};class he extends l.MeshStandardMaterial{constructor(e,t,n){e?super(e):(super(),this.opacity=pe.uniforms.opacity.value,this.transparent=pe.uniforms.transparent.value,this.roughness=pe.uniforms.roughness.value,this.metalness=pe.uniforms.metalness.value),this.runScene=n,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new l.Uniform(t.mirror),this.mixBlur=new l.Uniform(t.mixBlur),this.mixStrength=new l.Uniform(t.mixStrength),this.mixContrast=new l.Uniform(t.mixContrast)):(this.resolution=pe.uniforms.resolution.value,this.blurSize=pe.uniforms.blurSize.value,this.mirror=new l.Uniform(pe.uniforms.mirror.value),this.mixBlur=new l.Uniform(pe.uniforms.mixBlur.value),this.mixStrength=new l.Uniform(pe.uniforms.mixStrength.value),this.mixContrast=new l.Uniform(pe.uniforms.mixContrast.value)),this.textureMatrix=new l.Uniform(new l.Matrix4),this.reflectorWorldPosition=new l.Vector3,this.cameraWorldPosition=new l.Vector3,this.rotationMatrix=new l.Matrix4,this.normal=new l.Vector3,this.view=new l.Vector3,this.lookAtPosition=new l.Vector3,this.target=new l.Vector3,this.tempQuaternion=new l.Vector4,this.virtualCamera=new l.PerspectiveCamera,this.reflectorPlane=new l.Plane,this.clipPlane=new l.Vector4,e={minFilter:l.LinearFilter,magFilter:l.LinearFilter,type:l.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new l.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new l.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new l.Uniform(this.glRT1.texture),this.tDiffuseBlur=new l.Uniform(this.glRT2.texture),this.hBlurPass=new ie.T(ae),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new ie.T(se),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=pe.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",pe.vertexShader),e.fragmentShader=pe.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",pe.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){if(this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),!(0<this.view.dot(this.normal))){this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant);const t=this.virtualCamera.projectionMatrix;this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+t.elements[8])/t.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+t.elements[9])/t.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+t.elements[10])/t.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),t.elements[2]=this.clipPlane.x,t.elements[6]=this.clipPlane.y,t.elements[10]=this.clipPlane.z+1,t.elements[14]=this.clipPlane.w}}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const pe={uniforms:{opacity:new l.Uniform(1),transparent:new l.Uniform(!1),roughness:new l.Uniform(1),metalness:new l.Uniform(.6),resolution:new l.Uniform(1024),blurSize:new l.Uniform(1024),mirror:new l.Uniform(0),mixBlur:new l.Uniform(10),mixStrength:new l.Uniform(2),mixContrast:new l.Uniform(1),depthTest:new l.Uniform(!0),depthWrite:new l.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},fe={opacity:{type:"number",label:["uniforms","opacity","value"],val:1,shortKey:"op"},tFlip:{type:"number",label:["uniforms","tFlip","value"],val:-1,shortKey:"tf"},tCube:{type:"texture",val:null,get:e=>(e=e.uniforms.tCube.value)?(0,g.Ki)(e):null,set:e=>{const{target:t,end:n}=e;t.uniforms.tCube.value=n},shortKey:"tc"}};class me{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;me.TextureNames.includes(t[1])?this.runScene.materialEx.setTexture({material:e,type:t[1],newVal:n}).then():this.runScene.undoEx.addUndo(new m.Z({target:e,typeList:[...t],newVal:n}).execute())}}(le=me).TextureNames=["tCube"],me.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],me.tools={type:"SkyBox",textureNames:le.TextureNames.map((e=>"tCube"===e?{type:e,isCube:!0}:{type:e})),setTexture:e=>{const{material:t,type:n,texture:r}=e;if(r&&!(0,f.isCubeTexture)(r))throw TypeError("SkyBox材质仅可使用立方体纹理");return e=new m.Z({target:t,typeList:["uniforms",n,"value"],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:e=>{var{material:e,type:t}=e;return e.uniforms[t].value},getTextures:e=>{const t=[];return me.TextureNames.forEach((n=>{var r;e[n]?t.push({type:n,texture:e[n]}):null!=(r=e.uniforms[n])&&r.value&&t.push({type:n,texture:e.uniforms[n].value})})),t},create:(e,t)=>{var n=te.Z.ShaderLib.cube;const r=new te.Z.ShaderMaterial({uniforms:(0,P.d9)(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,depthWrite:!1,side:te.Z.BackSide});return r.name="SkyBoxMaterial",le.tools.bind(r),r},parseData:(e,t)=>{const{texture:n,normal:r,material:i}=e,{data:a,load:s}=n;e=te.Z.ShaderLib.cube;const o=new te.Z.ShaderMaterial({uniforms:(0,P.d9)(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,depthWrite:!1,side:te.Z.BackSide}),l=(o.name="SkyBoxMaterial",[]);return s&&l.push(...a.map((e=>()=>{o.uniforms[e.type].value=e.texture,t.materialEx.setTexture({material:o,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(r.uniforms).filter((e=>!me.TextureNames.includes(e))).map((e=>{o.uniforms[e].value=r.uniforms[e]})),o.name=r.name,o.userData.id=i.userData.id,le.tools.bind(o),{material:o,setTextureFns:l}},toNormal:e=>{const t=(0,a.createDefMaterial)(),n=(t.name=e.name,{}),r=e.uniforms;var i=te.Z.ShaderLib.cube;const s=new te.Z.ShaderMaterial({uniforms:(0,P.d9)(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,depthWrite:!1,side:te.Z.BackSide});return Object.keys(r).filter((e=>!me.TextureNames.includes(e))).map((e=>{var t=r[e].value,i=s.uniforms[e].value;(0,v.Xq)(i,t)&&(n[e]=t)})),{material:t,normal:{type:le.tools.type,uniforms:n,name:e.name},textures:le.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=le.tools.create(t);return Object.keys(n).filter((e=>!me.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",le.tools.type)},validType:e=>"SkyBox"===e.userData.type,snapshot:{getDiff:e=>p.LV.getDiff(fe,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:fe,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};const ge="\n#define STANDARD\n\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n\n// Insert Noise3D\n// Insert WorldUniforms\nuniform float uTime;\nuniform float uWindForce;\nuniform float uWindSpeed;\nuniform float uWindWaveScale;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n \n // #include <project_vertex>\n // Insert WorldVertex\n float tSpeed = uTime * uWindSpeed * 5.0;\n float wNoise = noise3D((vWorldPos + vec3(tSpeed)) * uWindWaveScale);\n float pOffset = wNoise * uWindForce * 30.0;\n transformed.xyz += vec3(pOffset);\n \n vec4 mvPosition = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n vWorldPos = (modelMatrix * mvPosition).xyz;\n #endif\n mvPosition = modelViewMatrix * mvPosition;\n gl_Position = projectionMatrix * mvPosition;\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n #ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n #endif\n}\n ",ve="\n#define STANDARD\n\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n uniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\n\nvarying vec3 vViewPosition;\n// Insert WorldUniforms\n// Insert Noise2D\n// Insert FBM\n// Insert SnowUniforms\n// uniform float ldContrast;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n \n // 自定义光照计算(支持平行光、环境光)\n //vec3 lightColor = directionalLights[0].color;\n //vec3 lightDirection = normalize(directionalLights[0].direction);\n //float dotNL = dot(normal, lightDirection);\n //float diffuseStrength = dotNL > ldContrast ? dotNL : ldContrast;\n //vec3 outgoingLight = (lightColor * diffuseStrength + ambientLightColor) * diffuseColor.rgb;\n\n // accumulation\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n \n #ifdef USE_SHEEN\n // Sheen energy compensation approximation calculation can be found at the end of\n // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n // Insert AccumulatedSnow\n #include <dithering_fragment>\n}\n ",ye="\n// float faceDirection = 1.0;\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx(vViewPosition );\n vec3 fdy = dFdy(vViewPosition );\n vec3 normal = normalize(cross(fdx, fdy));\n#else\n vec3 normal = normalize(vNormal);\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( -vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\n\n// non perturbed normal for clearcoat among others\nvec3 nonPerturbedNormal = normal;\n ",be="\nvarying vec2 vUv;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n ",xe="\nvUv = uv;\nvWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;\nvWorldNor = normalize(mat3(modelMatrix) * normal);\n// vWorldNor = normalize(normalMatrix * normal);\n ",we="\n#define MAX_RADIUS 1\n#define HASHSCALE1 .1031\n#define HASHSCALE3 vec3(.1031, .1030, .0973)\n\nfloat hash12(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nvec2 hash22(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE3);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.xx + p3.yz) * p3.zy);\n}\n ",Se="\nuniform float showSnow;\nuniform float snowAmount;\n ",_e="\nuniform float showRipple;\nuniform float rippleScale;\nuniform float rippleDestiny;\nuniform float rippleSpeed;\nuniform float rippleFrequency;\n ",Te="\nif (showSnow > 0.0) {\n float snowFactor = step(0.0, vWorldPos.y);\n snowFactor *= smoothstep(0.5, 1.0, vWorldNor.y);\n \n // 使用FBM噪声调整积雪因子\n float noiseFactor = fbm(vWorldPos.xz * 0.1);\n snowFactor *= (0.5 * noiseFactor + snowAmount);\n \n // 调整混合因子以防止过度覆盖(限制最大值)\n snowFactor = clamp(snowFactor, 0.0, 1.0);\n \n vec4 snowColorVec = vec4(1.0);\n gl_FragColor = mix(gl_FragColor, snowColorVec, snowFactor);\n}\n ",Me="\nif (showRipple > 0.0) {\n if (vWorldNor.y > 0.9) {\n vec2 uv = vUv * rippleScale;\n vec2 p0 = floor(uv);\n vec2 circles = vec2(0.0);\n for (int j = -MAX_RADIUS; j <= MAX_RADIUS; ++j) {\n for (int i = -MAX_RADIUS; i <= MAX_RADIUS; ++i) {\n vec2 pi = p0 + vec2(i, j);\n // 使用随机概率来决定是否生成涟漪\n float random = fract(sin(dot(pi, vec2(12.9898,78.233))) * 43758.5453);\n if (random > rippleDestiny) {\n vec2 p = pi + hash22(pi);\n vec2 v = p - uv;\n float t = fract(rippleSpeed * time + hash12(pi));\n float d = length(v) - (float(MAX_RADIUS) + 1.0) * t;\n \n float h = 1e-3;\n float d1 = d - h;\n float d2 = d + h;\n float p1 = sin(rippleFrequency * d1) * smoothstep(-0.6, -0.3, d1) * smoothstep(0.0, -0.3, d1);\n float p2 = sin(rippleFrequency * d2) * smoothstep(-0.6, -0.3, d2) * smoothstep(0.0, -0.3, d2);\n circles += 0.5 * normalize(v) * ((p2 - p1) / (2.0 * h) * (1.0 - t) * (1.0 - t));\n }\n }\n }\n circles /= float((MAX_RADIUS * 2 + 1) * (MAX_RADIUS * 2 + 1));\n vec3 n = vec3(circles, sqrt(1.0 - dot(circles, circles)));\n vec3 color = gl_FragColor.rgb + 5.0 * pow(clamp(dot(n, normalize(vec3(1.0, 0.7, 0.5))), 0.0, 1.0), 6.0);\n \n gl_FragColor = vec4(color, 1.0);\n }\n}\n ",Ee={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},showSnow:{type:"number",label:["uniforms","showSnow","value"],val:0,shortKey:"shs"},snowAmount:{type:"number",label:["uniforms","snowAmount","value"],val:.5,shortKey:"sna"},fbmAmplitude:{type:"number",label:["uniforms","fbmAmplitude","value"],val:.5,shortKey:"fbma"},fbmFrequency:{type:"number",label:["uniforms","fbmFrequency","value"],val:1,shortKey:"fbmf"}};class De{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;De.TextureNames.includes((0,o.lastArrayEle)(n))?this.runScene.materialEx.setTexture({material:t,type:(0,o.lastArrayEle)(n),newVal:r}).then():this.runScene.undoEx.addUndo(new m.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(ue=De).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],De.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],De.tools={type:"TreeLeaf",textureNames:ue.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return De.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:e=>{const t=new ke(e);return ue.tools.bind(t),t.name="TreeLeafMaterial",t},parseData:(e,t)=>{const{normal:n,texture:r,material:i}=e,{data:s,load:o}=r,u=(0,a.mergeMaterial)(i,new ke(t)),c=[];return o&&c.push(...s.map((e=>()=>{t.materialEx.setTexture({material:u,type:e.type,newVal:e.texture},!1)}))),Object.keys(n.uniforms).filter((e=>!De.IgnoredAttributes.includes(e))).map((e=>{var t=n.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?u[e]=new l.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"ldContrast"===e||"showSnow"===e||"snowAmount"===e||"fbmAmplitude"===e||"fbmFrequency"===e?u.uniforms[e]=new l.Uniform(t):u[e]=n.uniforms[e])})),u.name=n.name,u.userData.id=i.userData.id,ue.tools.bind(u),{material:u,setTextureFns:c}},toNormal:(e,t)=>{var n=ue.tools.getTextures(e);const r=(0,a.mergeMaterial)(e,(0,a.createDefMaterial)()),i=(r.name=e.name,{}),s=new ke(t);return Object.keys(s).filter((e=>!De.TextureNames.includes(e))).filter((e=>!De.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],r=s[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?n.x===r.x&&n.y===r.y||(i[t]=n):"uniforms"===t?Object.keys(r).map((t=>{var n=e.uniforms[t].value,r=s.uniforms[t].value;"windForce"!==t&&"windSpeed"!==t&&"windWaveScale"!==t&&"ldContrast"!==t&&"showSnow"!==t&&"snowAmount"!==t&&"fbmAmplitude"!==t&&"fbmFrequency"!==t||n!==r&&(i[t]=n)})):n!==r&&(i[t]=n))})),{material:r,normal:{type:ue.tools.type,uniforms:i,name:e.name},textures:n}},clone:(e,t)=>e,copy:(e,t)=>{const n=ue.tools.create(t);return Object.keys(n).filter((e=>!De.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",ue.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>p.LV.getDiff(Ee,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:Ee,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};const Pe=new l.Clock;class ke extends l.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new l.Uniform(0),windForce:new l.Uniform(.3),windSpeed:new l.Uniform(.5),windWaveScale:new l.Uniform(.25),ldContrast:new l.Uniform(.15),showSnow:new l.Uniform(0),snowAmount:new l.Uniform(.5),fbmAmplitude:new l.Uniform(.5),fbmFrequency:new l.Uniform(1)},this.insertShader(),e&&e.cb.render.add("TreeLeaf",(()=>{this.update()}))}insertShader(){this.onBeforeCompile=e=>{e.uniforms.uTime=this.uniforms.time,e.uniforms.uWindForce=this.uniforms.windForce,e.uniforms.uWindSpeed=this.uniforms.windSpeed,e.uniforms.uWindWaveScale=this.uniforms.windWaveScale,e.uniforms.ldContrast=this.uniforms.ldContrast,e.uniforms.showSnow=this.uniforms.showSnow,e.uniforms.snowAmount=this.uniforms.snowAmount,e.uniforms.fbmAmplitude=this.uniforms.fbmAmplitude,e.uniforms.fbmFrequency=this.uniforms.fbmFrequency,e.vertexShader=ge,e.fragmentShader=ve,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,z),e.vertexShader=e.vertexShader.replace(/\/\/ Insert WorldUniforms/g,be),e.vertexShader=e.vertexShader.replace(/\/\/ Insert WorldVertex/g,xe),e.fragmentShader=e.fragmentShader.replace(/#include <normal_fragment_begin>/g,ye),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert WorldUniforms/g,be),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert Noise2D/g,j),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert FBM/g,V),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert SnowUniforms/g,Se),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert AccumulatedSnow/g,Te)}}update(){this.uniforms.time.value=Pe.getElapsedTime()}}const Oe="\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n// Insert WorldUniforms\n\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n // Insert WorldVertex\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n\n #ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n #endif\n}\n ",Ae="\n#define STANDARD\n\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n uniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\n\nvarying vec3 vViewPosition;\n\n// Insert WorldUniforms\n// Insert Noise2D\n// Insert FBM\n// Insert SnowUniforms\n\n// Insert Hash\n// Insert RippleUniforms\nuniform float time;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n #include <transmission_fragment>\n\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n #ifdef USE_SHEEN\n // Sheen energy compensation approximation calculation can be found at the end of\n // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n \n // Insert AccumulatedSnow\n // Insert Ripples\n \n #include <dithering_fragment>\n}\n ",Ce={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},showSnow:{type:"number",label:["uniforms","showSnow","value"],val:0,shortKey:"shs"},snowAmount:{type:"number",label:["uniforms","snowAmount","value"],val:.5,shortKey:"sna"},fbmAmplitude:{type:"number",label:["uniforms","fbmAmplitude","value"],val:.5,shortKey:"fbma"},fbmFrequency:{type:"number",label:["uniforms","fbmFrequency","value"],val:1,shortKey:"fbmf"},showRipple:{type:"number",label:["uniforms","showRipple","value"],val:0,shortKey:"shr"},rippleScale:{type:"number",label:["uniforms","rippleScale","value"],val:80,shortKey:"rps"},rippleDestiny:{type:"number",label:["uniforms","rippleDestiny","value"],val:.9,shortKey:"rpd"},rippleSpeed:{type:"number",label:["uniforms","rippleSpeed","value"],val:.3,shortKey:"rpe"},rippleFrequency:{type:"number",label:["uniforms","rippleFrequency","value"],val:11,shortKey:"rpf"}};class Ne{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;Ne.TextureNames.includes((0,o.lastArrayEle)(n))?this.runScene.materialEx.setTexture({material:t,type:(0,o.lastArrayEle)(n),newVal:r}).then():this.runScene.undoEx.addUndo(new m.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(ce=Ne).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],Ne.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],Ne.tools={type:"Weather",textureNames:ce.TextureNames.map((e=>"envMap"===e?{type:e,isEnv:!0}:{type:e})),setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new m.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},getTextures:e=>{const t=[];return Ne.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:e=>{const t=new Ie(e);return ce.tools.bind(t),t.name="WeatherMaterial",t},parseData:(e,t)=>{const{normal:n,texture:r,material:i}=e,{data:s,load:o}=r,u=(0,a.mergeMaterial)(i,new Ie(t)),c=[];return o&&c.push(...s.map((e=>()=>{t.materialEx.setTexture({material:u,type:e.type,newVal:e.texture},!1).then()}))),Object.keys(n.uniforms).filter((e=>!Ne.IgnoredAttributes.includes(e))).map((e=>{var t=n.uniforms[e];"color"!==e&&"emissive"!==e&&("showSnow"===e||"snowAmount"===e||"fbmAmplitude"===e||"fbmFrequency"===e||"showRipple"===e||"rippleScale"===e||"rippleDestiny"===e||"rippleSpeed"===e||"rippleFrequency"===e?u.uniforms[e]=new l.Uniform(t):u[e]=n.uniforms[e])})),u.name=n.name,u.userData.id=i.userData.id,ce.tools.bind(u),{material:u,setTextureFns:c}},toNormal:(e,t)=>{var n=ce.tools.getTextures(e);const r=(0,a.mergeMaterial)(e,(0,a.createDefMaterial)()),i=(r.name=e.name,{}),s=new Ie(t);return Object.keys(e).filter((e=>!Ne.TextureNames.includes(e))).filter((e=>!Ne.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],r=s[t];"color"!==t&&"emissive"!==t&&("uniforms"===t?Object.keys(n).map((t=>{var n=e.uniforms[t].value,r=s.uniforms[t].value;"showSnow"!==t&&"snowAmount"!==t&&"fbmAmplitude"!==t&&"fbmFrequency"!==t&&"showRipple"!==t&&"rippleScale"!==t&&"rippleDestiny"!==t&&"rippleSpeed"!==t&&"rippleFrequency"!==t||n!==r&&(i[t]=n)})):n!==r&&(i[t]=n))})),{material:r,normal:{type:ce.tools.type,uniforms:i,name:e.name},textures:n}},clone:(e,t)=>e,copy:(e,t)=>{const n=ce.tools.create(t);return Object.keys(n).filter((e=>!Ne.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,h.M)(e,"type",ce.tools.type)},validType:e=>"Weather"===e.userData.type,snapshot:{getDiff:e=>p.LV.getDiff(Ce,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;p.LV.set({def:Ce,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,a.updateMaterial)(n)}))}}};const Le=new l.Clock;class Ie extends l.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new l.Uniform(0),showSnow:new l.Uniform(0),snowAmount:new l.Uniform(.5),fbmAmplitude:new l.Uniform(.5),fbmFrequency:new l.Uniform(1),showRipple:new l.Uniform(0),rippleScale:new l.Uniform(80),rippleDestiny:new l.Uniform(.9),rippleSpeed:new l.Uniform(.3),rippleFrequency:new l.Uniform(11)},this.insertShader(),e&&e.cb.render.add("Weather",(()=>{this.update()}))}insertShader(){this.onBeforeCompile=e=>{e.uniforms.time=this.uniforms.time,e.uniforms.showSnow=this.uniforms.showSnow,e.uniforms.snowAmount=this.uniforms.snowAmount,e.uniforms.fbmAmplitude=this.uniforms.fbmAmplitude,e.uniforms.fbmFrequency=this.uniforms.fbmFrequency,e.uniforms.showRipple=this.uniforms.showRipple,e.uniforms.rippleScale=this.uniforms.rippleScale,e.uniforms.rippleDestiny=this.uniforms.rippleDestiny,e.uniforms.rippleSpeed=this.uniforms.rippleSpeed,e.uniforms.rippleFrequency=this.uniforms.rippleFrequency,e.vertexShader=Oe,e.fragmentShader=Ae,e.vertexShader=e.vertexShader.replace(/\/\/ Insert WorldUniforms/g,be),e.vertexShader=e.vertexShader.replace(/\/\/ Insert WorldVertex/g,xe),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert WorldUniforms/g,be),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert Noise2D/g,j),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert FBM/g,V),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert SnowUniforms/g,Se),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert AccumulatedSnow/g,Te),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert Hash/g,we),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert RippleUniforms/g,_e),e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert Ripples/g,Me)}}update(){this.uniforms.time.value=Le.getElapsedTime()}}const Re={SpriteMaterial:$.Z,FakeInterior:k,Fresnel:C,Matcap:B,MixTexture:Z,Physical:re,MeshLambertMaterial:X.Z,MyMeshPhongMaterial:Y.Z,MeshPhongMaterial:Y.Z,Reflector:de,TreeLeaf:De,Weather:Ne,SkyBox:me,BasicMaterial:s.ZP,LineBasicMaterial:R,MyPointsMaterial:Q,Water:r.Z,MyMeshLambertMaterial:X.Z,[t.Z.tools.type]:t.Z,[_.tools.type]:_};class Ue{constructor(e){this.runScene=e,this.map={SpriteMaterial:new $.Z(e),FakeInterior:new k(e),Fresnel:new C(e),Matcap:new B(e),MixTexture:new Z(e),Physical:new re(e),Reflector:new de(e),TreeLeaf:new De(e),Weather:new Ne(e),SkyBox:new me(e),BasicMaterial:new s.ZP(e),ExMaterial:new _(e)},e.cb.unique.material.add.add("def-material",(t=>{var n,r=Ue.getTypeByMaterial(t);r&&null!=(r=null==(r=Re[r])?void 0:(n=r.tools).onAdd)&&r.call(n,{material:t,runScene:e})}))}static create(e,t){return"MeshReflectorMaterial"===e?new F({}):Re[e].tools.create(t)}static copy(e,t,n){return Re[e].tools.copy(t,n)}static clone(e,t){return Re[e].tools.clone(t)}static setTexture(e){var t=e.material;if(t=this.getTypeByMaterial(t))return Re[t].tools.setTexture(e)}static getTexture(e){var t=e.material;return(t=this.getTypeByMaterial(t))?Re[t].tools.getTexture(e):null}static toNromal(e,t,n){return Re[e].tools.toNormal(t,n)}static parseData(e,t,n){var r=t.material;let i=e;return Re.LineBasicMaterial.tools.validType(r)&&(i=Re.LineBasicMaterial.tools.type),(null==(e=Re[i])?void 0:e.tools.parseData(t,n))||{material:(0,a.createDefMaterial)(),setTextureFns:[]}}static bind(e){e&&("MeshStandardMaterial"===e.type?s.ZP.tools.bind(e):"SpriteMaterial"===e.type?$.Z.tools.bind(e):"MeshPhysicalMaterial"===e.type&&re.tools.bind(e))}static _getTextures(e){var t=Be(e);return t?Re[t].tools.getTextures(e):[]}static getTextures(e){let t=[];return(Array.isArray(e)?e:[e]).map((e=>{t.push(...this._getTextures(e))})),t}static parseNode(e){e.material&&(e=e.material,(0,a.isBaseMaterial)(e)&&s.ZP.tools.bind(e),e.isSpriteMaterial&&$.Z.tools.bind(e))}static validType(e,t){if(e)return!Re[e].tools.validType||Re[e].tools.validType(t)}static getTypeByMaterial(e){var t=e.userData.type;if(t&&this.validType(t,e))return t}static getTextureNames(e){var t=e.userData.type;return this.validType(t,e)?Re[t].tools.textureNames:[]}}Ue.snapshot={getDiff:e=>{var t=Be(e);if(!Re[t])throw TypeError("该材质没有类型");const n=Re[t].tools.snapshot.getDiff(e);return(t=i.Z.snapshot.getDiff(e))&&(n.clip=t),n},set:e=>{var t=e.material;if(t=Be(t),!Re[t])throw TypeError("该材质没有类型");Re[t].tools.snapshot.set(e),i.Z.snapshot.set(e)}};const Be=e=>{var t=e.userData.type;if(t)return Ue.validType(t,e)?t:void 0}},6053:(e,t,n)=>{n.d(t,{Z:()=>d});var r,i=n(6001),a=n(5521),s=n(3736),o=n(1398),l=n(2233),u=n(135);const c={clip:{type:"v3",val:{x:-1,y:-1,z:-1},shortKey:"clip",get:e=>d.snapshot.getV3(e,!0),onUpdate:e=>{const{target:t,data:n,runScene:r}=e;(0,i.mapObj)(n,((e,n)=>{r.materialEx.clipping.setLocal({material:t,axis:e,local:n})}))}}};class d{constructor(e){this.parse=e=>{const t=e.material;(e=this.getClip(t))&&(0,i.mapObj)(e,((e,n)=>{(0,i.mapObj)(n,((n,r)=>{this.parseData({material:t,axis:e,type:n,val:r})}))}))},this.axisMap={x:new a.Plane(new a.Vector3(1,0,0),0),y:new a.Plane(new a.Vector3(0,-1,0),0),z:new a.Plane(new a.Vector3(0,0,-1),0)},this.setSavedHelper=e=>{const{material:t,axis:n,plane:r}=e,i=(t.clipHelper||(t.clipHelper={}),t.clipHelper);return i[n]||(i[n]=this.getHelper({model:r,axis:n})),i[n]},this.getSavedHelper=e=>{var{material:e,axis:t}=e;return null==(e=null==e?void 0:e.clipHelper)?void 0:e[t]},this.heleprColor={x:16711680,y:65280,z:255},this.getHelper=e=>{var{model:e,axis:t}=e;const n=new a.PlaneHelper(e,20,this.heleprColor[t]);return n.children[0].material.side=2,this.runScene.helperEx.setHelper(n,!0),(0,s.qh)(n),n.visible=!1,n},this.getHelperData=e=>{var t=e.type;if(e=this.getSavedHelper(e))return e[t]},(this.runScene=e).cb.loaderer.gltf.material.afterParseNromal.add("MaterialClipping",this.parse)}setState(e){const{material:t,axis:n,state:r}=e;if((0,u.isNormalMaterial)(t)){if(e=this.getPleanByAxis(n),!t.clippingPlanes){if(!r)return;t.clippingPlanes=[]}r?this.getSaved(t,n)||(t.clippingPlanes.push(e),this.save({material:t,axis:n,model:e}),this.bindData({material:t,axis:n,type:"local",val:0}),this.setHelperState({material:t,state:r,plane:e,axis:n})):this.delAxis({material:t,axis:n})}}getPleanByAxis(e){const t=this.axisMap[e].clone();return t.userData={},(0,s.qh)(t),t}getSaved(e,t){if(e=e.clip)return e[t]}save(e){const{material:t,axis:n,model:r}=e;t.clip||(t.clip={}),t.clip[n]=r}getModel(e,t){var n=this.getPleanByAxis(t);return this.save({material:e,axis:t,model:n}),n}setLocal(e){var t,{material:e,axis:n,local:r}=e;let i=null==(t=null==e?void 0:e.clip)?void 0:t[n];(i=i||this.getModel(e,n)).constant=r,this.bindData({material:e,axis:n,type:"local",val:r})}getLocal(e){var{material:e,axis:t}=e;return this.getData({material:e,axis:t,type:"local"})||0}bindData(e){const{material:t,axis:n,type:r,val:i}=e,a=(t.userData.clipping||(t.userData.clipping={}),t.userData.clipping);(a[n]||(a[n]={}),a[n])[r]=i}getData(e){var{material:e,axis:t,type:n}=e;return null==(e=null==(e=e.userData.clipping)?void 0:e[t])?void 0:e[n]}getClip(e){return e.userData.clipping}setData(e){var{material:e,axis:t,type:n,val:r}=e;"local"===n?this.setLocal({material:e,axis:t,local:r}):"helperSize"===n&&this.setHelperData({material:e,axis:t,type:"size",val:r})}parseData(e){var{material:t,axis:n}=e;this.setState({material:t,axis:n,state:!0}),this.setData(e)}setHelperState(e){var{material:e,axis:t,state:n,plane:r}=e,i=this.getSavedHelper({material:e,axis:t});if(!n)return i?void this.runScene.modelEx.remove(i,!1):void 0;i||(n=this.setSavedHelper({material:e,axis:t,plane:r}),this.runScene.modelEx.add(n,void 0,{addUndo:!1}))}setHelperData(e){let t=this.getSavedHelper(e);var{material:n,axis:r}=e;if(!t){var i=n.clip[r];if(!i)return;t=this.setSavedHelper({material:n,axis:r,plane:i})}var{type:n,val:r}=e;"size"===n?(t.size=r,this.bindData(Object.assign(Object.assign({},e),{type:"helperSize",val:r}))):t.visible=r}getHelperSize(e){return(null==(e=this.getSavedHelper(e))?void 0:e.size)||20}delAxis(e){var t;const{material:n,axis:r}=e,i=null==(t=n.clip)?void 0:t[r];i&&(void 0!==(t=null==(t=n.clippingPlanes)?void 0:t.findIndex((e=>(0,l.Ki)(e)===(0,l.Ki)(i))))&&-1!==t&&n.clippingPlanes.splice(t,1),null!=(t=n.clip)&&delete t[r],this.delHelper(e))}delHelper(e){var{material:e,axis:t}=e,n=this.getSavedHelper({material:e,axis:t});n&&(this.runScene.modelEx.remove(n,!1),null!=(n=null==e?void 0:e.clipHelper)&&delete n[t])}static get(e){return e.userData.clipping}}(r=d).snapshot={getDiff:e=>r.snapshot.getV3(e),set:e=>{var{material:e,map:t,runScene:n,data:r}=e;o.LV.set({def:c,data:r,runScene:n,map:t,target:e})},baseV3:{x:-1,y:-1,z:-1},getV3:(e,t)=>{const n=r.get(e);if(n||t){const e={};return(0,i.mapObj)(r.snapshot.baseV3,(t=>{var r=null==n?void 0:n[t].local;e[t]=void 0!==r?r:-1})),e}}}},135:(e,t,n)=>{n.r(t),n.d(t,{SpecialMaterial:()=>Z,baseIgnoreTypes:()=>A,canSetMaterial:()=>ee,createDefMaterial:()=>L,defAllMaterialMap:()=>C,defBaseMaterialMap:()=>O,default:()=>N,disposeMaterial:()=>R,getBaseTextures:()=>F,getMaterialMapNameByModel:()=>te,getMaterialType:()=>q,getMaterials:()=>J,getTextures:()=>B,getTexturesByMaterial:()=>U,initMaterial:()=>z,isBaseMaterial:()=>K,isColor:()=>V,isMaterial:()=>W,isMultiMaterial:()=>Q,isNormalMaterial:()=>re,materialIgnore:()=>X,mergeMaterial:()=>I,mergeMaterialAll:()=>Y,setDefMaterialForSameGeo:()=>G,setMaterialIds:()=>$,setMaterialTexture:()=>j,specialMaterials:()=>ne,updateMaterial:()=>H});var r=n(6001),i=n(5521),a=n(4330),s=n(1794),o=n(3736),l=n(9151);class u extends n(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:n,oldVal:r,runScene:i,cb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,this.cb=a}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,a.zX.includes(this.info)){if(!e)return;this.runScene.materialEx.setTexture({material:this.target,type:this.info,newVal:e},!1)}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const c=u;var d=n(2510),h=n(2233),p=n(6272),f=n(5124),m=n(7013),g=n(144),v=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class y{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;let{materialDef:t,material:n,model:i}=e;z(n),t.id||(e=(0,r.getId)(),t.id=e,(0,h.x)(n,e),m.ZP.bind(n)),this.data.materialIns[t.id]||(this.data.materialIns[t.id]={material:n,models:[]}),this.data.materialIns[t.id].models.push(i)},this.done=e=>v(this,void 0,void 0,(function*(){var{json:t,core:n}=e,{materialMap:r,textureMap:i}=(null==(r=t.asset)?void 0:r.ex)||{};yield this.processTextureMap(i||{},t),this.processMaterialMap(r||{},t),this.processClonedTextures(),yield this.loadTextures(n)})),this.parser=null,this.loadTexture=e=>v(this,void 0,void 0,(function*(){var t=e.data;const{textureDef:n,texture:i}=t;(0,l.mergeDefUserData)(n,i.userData),n.channel&&(i.channel=n.channel),n.id||(t=(0,r.getId)(),n.id=t,(0,h.x)(i,t),(0,l.bindTextureBaseData)(i,this.runScene)),e.core.isImageBitmapLoader||(i.userData.flipY=!0);let a=i;(t=(0,l.isClonedTexture)(i))?(a=i,this.clonedTextures.push(i)):a=this.runScene.textureEx.getSameTexture(n.md5,i)||i,n.apngAnima&&((a=yield this.runScene.textureEx.parseApng(i.userData.blob,Object.assign({id:n.id},n.apngAnima))).userData=Object.assign(Object.assign({},i.userData),a.userData)),this.data.textureIns[n.id]=a})),this.processTextureMap=(()=>{const e=e=>{const{target:t,data:n}=e;var r;n&&(({x:e,y:r}="object"==typeof n?n:{x:n,y:n}),t.x=e,t.y=r)};return(t,n)=>Promise.all((0,r.mapObj)(t,((t,i)=>v(this,void 0,void 0,(function*(){var{format:a,center:s,rotation:o,offset:l,repeat:u,isHelper:c,encoding:d,flipY:h}=i;if(!c){let i=this.data.textureIns[t];if(i){if(i.userData.cubeMap){const e={};(0,r.mapObj)(i.userData.cubeMap,((t,n)=>{e[t]=this.data.textureIns[n].userData.blob}));var c=i.userData;(i=yield this.runScene.textureEx.praseCubeByBlobMap(e)).userData=Object.assign(Object.assign({},c),i.userData),void 0!==i.userData.lightProbeIntensity&&(c=this.runScene.textureEx.setLightProbeForCube(i,!0,i.userData.lightProbeIntensity),i.userData.lightProbe=c),i.userData.blob=e.px,this.data.textureIns[t]=i}i.encoding=d||3e3,i.format=a,e({target:i.repeat,data:u}),e({target:i.center,data:s}),e({target:i.offset,data:l}),o&&(i.rotation=o),void 0!==h&&(i.userData.flipY=1===h),this.runScene.textureEx.initTextureAndAddtoAll(i),this.runScene.textureEx.onLoaded(i,{isGlb:!0,isScene:"scene"===n.asset.ex.type})}}})))))})(),this.processMaterialMap=(()=>{const e=e=>v(this,void 0,void 0,(function*(){const{textures:t,normal:n,models:i,material:a}=e;var s=(0,r.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));let o={material:this.runScene.materialEx.defMaterial,setTextureFns:[]};const{material:l,setTextureFns:u}=o=(0,f.F)(this.runScene).material.load?this.runScene.materialEx.parseData(n.type,{normal:n,texture:{data:s,load:this.runScene.optionsEx.options.texture.load},core:this,models:i,material:a}):o;this.runScene.cb.loaderer.gltf.material.afterParseNromal.cb({material:l||a}),l&&(this.data.materialIns[(0,h.Ki)(a)].material=l,0<u.length&&this.lazyLoadFns.push(...u),i.map((e=>e.material=l)))}));return(t,n)=>Promise.all((0,r.mapObj)(t,((t,i)=>v(this,void 0,void 0,(function*(){var a=this.data.materialIns[t];if(a){const{material:t,models:s}=a;if(t){const{normal:o,textures:l}=i;o.type||(o.type=g.ZP.tools.type),"scene"===(null==(a=null==(a=n.asset)?void 0:a.ex)?void 0:a.type)&&n.asset.ex.sceneEx.materialId===t.userData.id&&(0,r.mapObj)(l,((e,n)=>{n=this.data.textureIns[n],j({material:t,type:e,texture:n})})),yield e({textures:l,models:s,material:t,normal:o}),t.needsUpdate=!0}}})))))})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(n,r,i)=>{const a=this.lazyLoadFns[n];if(!a)return r(0),e(i);a(),setTimeout((()=>t(++n,r,i)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((n=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,n,e):(this.lazyLoadFns.map((e=>e())),n(0))}))})(),this.afterParse=e=>{const{data:t,core:n,json:r}=e;if("material"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[r]=e,i=[];r.material?(this.runScene.materialEx.add(r.material),i.push(r.material)):r.children.map((e=>{e.material&&(i.push(e.material),this.runScene.materialEx.add(e.material))})),n.models.push(...i)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.Z({loadedGltf:e=>{e.core.pending.push(this.done(e))},loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}getById(e){return this.data.materialIns[e]}parseSavedMap(e){e.map((e=>{e=this.data.materialIns[e],this.runScene.materialEx.add(e.material)}))}processInput(e,t){return v(this,void 0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,l.getCloneIdFromTexture)(e);(t=this.data.textureIns[t])?(e.image=t.image,e.needsUpdate=!0,"editor"===this.runScene.optionsEx.options.mode&&(e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,e.userData.gm=t.userData.gm,(0,l.bindTextureBaseData)(e,this.runScene))):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[],this.lazyLoadFns=[]}}var b=n(7201);class x{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const n=t.data;let r=n.get("material");r||(r={},n.set("material",r)),e.targets.map((e=>{var t=(0,m.ee)(e);t&&m.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(r[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var n=(0,m.ee)(t);n&&m.Ws[n].tools.snapshot&&(n=(0,h.Ki)(t))&&(e[n]=this.getItem(t))})),e},this.create=e=>{var t=this.getDiff();0!==(0,b.objLength)(t)&&e.data.set("material",t)},this.set=e=>{var t=e.snapshot.data.get("material");t&&!e.ignoreModules.includes("material")&&(0,r.mapObj)(t,((t,n)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:n,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),e.cb.snapshot.delUseless.add("material",(t=>{(0,r.mapObj)(t,((t,n)=>{const i=n.data.material;i&&((0,r.mapObj)(i,(t=>{e.uniqueEx.material.isUsed(t)||delete i[t]})),0===(0,b.objLength)(i)&&delete n.data.material)}))})),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.getLength.add("material",(e=>{var t=e.data.data.get("material");t&&(e.inputData.material=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return m.ZP.snapshot.getDiff(e)}}var w=n(6053),S=(t=n(110),n(272)),_=n(9663),T=n(3924),M=n(5247),E=n(9457),D=n(4156),P=n(960),k=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const O={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1,fog:!0},A=["_listeners","version","userData","uniforms","onBeforeCompile","uuid","name","type","defines"],C=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class N{constructor(e){this.materialX={},this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"setMaterial",map:{parse:e=>{const t=e.model;return Promise.all(e.childs.map((e=>{var n,{type:e,data:r}=e;let i;"material-name"===e?i=this.runScene.uniqueEx.material.getByName(r):"material-map"===e?(n=r[(0,h.Ki)(t)],i=this.runScene.uniqueEx.material.get(n)):"material-id"===e&&(i=this.runScene.uniqueEx.material.get(r)),i&&this.resetMaterial(t,i,{addUndo:!1})})))}}})},this.clean=()=>{this.dispose()},this.defMaterial=L(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.getScreen=e=>{this.previewScene||(this.previewScene=this.getPreviewScene());const{scene:t,camera:n,render:r,model:i}=this.previewScene;return t.environment=this.runScene.assetsEx.scene.environment,i.material=e,r.render(t,n),new Promise((e=>{r.domElement.toBlob((t=>{e(t)}),"image/webp",1)}))},this.onSet=(e,t)=>{},this.runScene=e,this.def=new m.ZP(e),this.snaphot=new x(e),this.clipping=new w.Z(e),this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{this.addCb(e)})),e.cb.inited.add("material",this.onInited),this.runScene.cb.clean.add("EngineMaterial",this.clean),this.import=new y(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){m.Ws.LineBasicMaterial.tools.validType(e)&&m.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,n){X.is(e)||this.runScene.uniqueEx.material.add(e,t,n)}setEnvStrength(e,t,n=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!n&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,H(e))}create(e="BasicMaterial"){return e=m.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,r.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=q(e);if(t){const n=m.ZP.copy(t,e,this.runScene);return n.userData.id=(0,r.getId)(),n}}clone(e){var t=q(e);if(t){const n=m.ZP.clone(t,e);return n.userData.id=(0,r.getId)(),n}}setNormals(e,t=!0){const{info:n,newVal:r,materials:i,oldval:a,cb:s}=e;let o=r;return o.isVector2&&(o=o.clone()),e=i.map((e=>new c({info:n,target:e,newVal:o,oldVal:a||e[n],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new c(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return k(this,void 0,void 0,(function*(){const{info:n,newVal:r,materials:i,oldVal:a}=e;if(e.newVal=yield this.runScene.textureEx.parse(r),(0,l.isCubeTexture)(e.newVal)&&"envMap"!==n)throw this.runScene.optionsEx.log("立方体纹理只适用于环境","base","info"),TypeError("类型错误");"envMap"!==n||(0,l.isCubeTexture)(e.newVal)||(0,l.setTextureMapping)(e.newVal);var s=i.map((t=>new c({info:n,target:t,newVal:e.newVal,oldVal:a||t[n],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),i[0][n]}))}setTexture(e,t=!0){return k(this,void 0,void 0,(function*(){const{type:n,newVal:i,material:a,cb:s,isEnv:o,getUndo:u}=e;null!==i&&(e.newVal=yield this.runScene.textureEx.parse(i,{isEnv:o}),"envMap"!==n||e.newVal.isCubeTexture||(0,l.setTextureMapping)(e.newVal));var c=m.ZP.getTexture({material:a,type:n});const d=m.ZP.setTexture({material:a,type:n,texture:e.newVal});if(d)return d.cb=(e,t)=>{const{target:n,typeList:i,val:a,oldVal:o}=t;t=(0,r.lastArrayEle)(i),this.runScene.cb.texture.setMaterial.cb({target:n,type:t,oldVal:o,val:a,targetType:"material"}),null!=s&&s(),n.needsUpdate=!0},null!=s&&s(),this.runScene.cb.texture.setMaterial.cb({target:a,type:n,val:e.newVal,oldVal:c,targetType:"material"}),t&&this.runScene.undoEx.addUndo(d),u?d:e.newVal}))}_resetMaterial(e){const{mate:t,models:n,model:r}=e;(e=r.material)&&ee(e,t)&&n.add(r)}resetMaterial(e,t,n){const r=this,{addUndo:i,includeChild:a}=n=(0,p.Gm)({addUndo:!0,includeChild:!1},n);if(e&&t){const n=new Set;P.F6.toArr(e).map((e=>{a?e.traverse((e=>{this._resetMaterial({model:e,mate:t,models:n})})):e.material&&this._resetMaterial({model:e,mate:t,models:n})}));const s=[];return n.forEach((e=>{const n=e.material;s.push(new d.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:n,executeCb(i){var a,{type:i,val:s}=i;e.material=s,null!=(a=e.onSetInfo)&&a.call(e,"material",s),"undo"===i?r.runScene.uniqueEx.material.addModel(e,n,t):r.runScene.uniqueEx.material.addModel(e,t,n)}}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),i?(this.runScene.undoEx.addUndo(s),s):s}}toNromal(e){var t=q(e);if(t){const n=m.ZP.toNromal(t,e,this.runScene);return n.material.userData=Object.assign(Object.assign({},n.material.userData),e.userData),n}}setSelect(e){let t;t=Array.isArray(e)?e[0]:e,this.select=t,this.runScene.cb.setSelectMaterial.cb(t)}parseData(e,t){return m.ZP.parseData(e,t,this.runScene)}dispose(){this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,h.Ki)(e));t&&(this.resetMaterial(t.toArray(),L()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,p.ad)(O,e)}parseNromals(e,t){(0,r.mapObj)(e,((e,n)=>{var r,i,a,s,o;void 0!==O[e]&&("object"==typeof n?(({x:a,y:s,z:o}=n),null!=(i=null==(r=t[e])?void 0:r.set)&&i.call(r,a,s,o)):t[e]=n)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&g.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}getPreviewScene(e){const t=new i.Scene,n=new i.PerspectiveCamera(50,1,1,10),r=(n.position.z=2,new i.WebGLRenderer),a=new M.z(n,r.domElement),s=(t.background=new i.Color("#202020"),r.setSize(150,150),a.minDistance=2,a.maxDistance=5,a.enablePan=!1,(a.enableZoom=!1,T.getSphere)()),o=(e&&(s.material=e),s.scale.set(.8,.8,.8),t.add(s),t.add(new i.HemisphereLight(11184810,4473924)),new i.DirectionalLight(16777215,.5));return o.position.set(1,1,1),t.add(o),{scene:t,camera:n,render:r,controls:a,model:s}}setTextureByName(e){const{name:t,texture:n,material:i}=e;return!(!(e=m.ZP.getTextureNames(i).find((e=>(0,r.lastArrayEle)((0,p.dx)(t).split("_"))===e.type)))||e.isCube&&!(0,l.isCubeTexture)(n)||(this.setTexture({material:i,type:e.type,newVal:n,isEnv:e.isEnv}),0))}get(e){return Array.isArray(e)?e[0]:e}afterLoader(e){"MeshPhongMaterial"===e.type?E.Z.afterload(e,this.runScene):"MeshStandardMaterial"===e.type?g.ZP.afterload(e,this.runScene):"MeshLambertMaterial"===e.type&&D.Z.afterload(e,this.runScene)}}const L=e=>{const t=new i.MeshStandardMaterial(e);return t.userData.id=(0,r.getId)(),g.ZP.tools.bind(t),t},I=(e,t)=>(C.map((n=>{const r=e[n];"object"==typeof r&&(t[n]=r.clone?r.clone():Object.assign({},r)),t[n]=r})),t),R=e=>{e.dispose();const t=U(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},U=e=>F(e),B=e=>m.ZP.getTextures(e)||F(e),F=e=>a.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),j=e=>{const{material:t,type:n,texture:r}=e;"envMap"!==n||(0,l.isCubeTexture)(r)||(0,l.setTextureMapping)(r),t[n]=r,t.needsUpdate=!0},z=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},V=e=>null==e?void 0:e.isColor,H=e=>{e.needsUpdate=!0},W=e=>null==e?void 0:e.isMaterial,G=e=>{},K=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,Z={Sprite:t.Z},q=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.type)||"BasicMaterial",X={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")},Y=(e,t,n)=>{Object.keys(e).map((r=>{const i=new S.Z(A);n&&i.add(n);var a=e[r],s=t[r];!i.has(r)&&void 0!==s&&(0,_.ZE)(a,s)&&(0,_.Y6)({type:r,target:t,val:a})}))},Q=e=>Array.isArray(e),J=e=>Array.isArray(e)?e:[e],$=(e,t,n)=>{n?e.userData.multiMaterial={groups:[...e.geometry.groups],mateIds:t}:(delete e.userData.mateIds,delete e.userData.multiMaterial)},ee=(e,t)=>(e=m.ZP.getTypeByMaterial(P.F6.toArr(e)[0]),t=m.ZP.getTypeByMaterial(P.F6.toArr(t)[0]),!(!e||!t)&&("SpriteMaterial"==e?"SpriteMaterial"===t:"SpriteMaterial"!=t&&("LineBasicMaterial"==e?"LineBasicMaterial"===t:"LineBasicMaterial"!=t))),te=(e,t)=>{const n=new s.Z;return e.traverse((e=>{null!=t&&t(e),e.material&&!n.has(e.name)&&n.set(e.name,{material:e.material,model:e})})),n},ne=["SpriteMaterial","Reflector","SkyBox","LineBasicMaterial"],re=e=>!!(e=m.ZP.getTypeByMaterial(e))&&!ne.includes(e)},144:(e,t,n)=>{n.d(t,{Gf:()=>f,ZP:()=>m});var r,i=n(6001),a=n(5521),s=n(4330),o=n(960),l=n(3736),u=n(1398),c=n(3735),d=n(2233),h=n(135),p=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const f={color:{type:"color",val:{r:1,g:1,b:1},shortKey:"clr"},map:{type:"texture",val:null,shortKey:"map"},emissiveMap:{type:"texture",val:null,shortKey:"em"},roughnessMap:{type:"texture",val:null,shortKey:"rm"},emissive:{type:"color",val:{r:0,g:0,b:0},shortKey:"emi"},roughness:{type:"number",val:1,shortKey:"rgh"},metalness:{type:"number",val:0,shortKey:"meta"},metalnessMap:{type:"texture",val:null,shortKey:"mm"},lightMap:{type:"texture",val:null,shortKey:"lm"},lightMapIntensity:{type:"number",val:1,shortKey:"lmi"},envMap:{type:"texture",val:null,shortKey:"envm"},envMapIntensity:{type:"number",val:1,shortKey:"envI"},transparent:{type:"other",val:!1,shortKey:"trans"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,h.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class m{constructor(e){this.init(e)}static afterload(e,t){return p(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:n})=>p(this,void 0,void 0,(function*(){const r=e[n];if(r){let a=(0,d.Ki)(r);a||(a=(0,i.getId)(),(0,d.x)(r,a)),r.image?(yield t.textureEx.afterLoad(r),t.uniqueEx.texture.linkMaterial(r,{target:e,type:n,targetType:"material"})):t.textureEx.setAwaitLoaded(a,(()=>{t.uniqueEx.texture.linkMaterial(r,{target:e,type:n,targetType:"material"})}))}}))))}))}init(e){e.cb.material.add.add("base-material",(e=>{(0,h.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&m.tools.bind(e)}))}static isDefVal(e){for(const t in this.defVal){const n=this.defVal[t],r=e[t];if(n instanceof a.Color){if(n.getHexString()!==r.getHexString())return!1}else if("object"==typeof n){if(r.x!==n.x)return!1}else if(r!==n)return!1}for(const t of s.zX)if(e[t])return!1;return!0}create(){return(0,h.createDefMaterial)()}}(r=m).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"lightMap"},{type:"envMap",isEnv:!0},{type:"displacementMap"}],type:"BasicMaterial",bind(e){(0,l.M)(e,"type","BasicMaterial")},create:()=>{var e=new a.MeshStandardMaterial;return r.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:r,material:i}=e,{data:a,load:s}=t,l=[];return s&&l.push(...o.F6.filter(a.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{r.runScene.materialEx.setTexture({material:i,type:t,newVal:n},!1)}})))),r.runScene.materialEx.parseNromals(n,i),{material:i,setTextureFns:l}},toNormal:e=>{const t=e.clone();return t.side=e.side,{material:t,normal:{type:m.tools.type},textures:(0,h.getBaseTextures)(e)}},clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,h.getBaseTextures)(e),snapshot:{getDiff:e=>u.LV.getDiff(f,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;u.LV.set({def:f,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,h.updateMaterial)(n)}))}},validType:e=>"MeshStandardMaterial"===e.type,setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new c.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}},m.defVal={color:new a.Color(16777215),emissive:new a.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new a.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},6282:(e,t,n)=>{n.d(t,{sC:()=>a,cs:()=>o,iB:()=>s}),t=n(5521);var r="\nvarying vec2 vUv;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vUv = uv; \n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n\n}\n",i={fragmentShader:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n\n// 时间\nuniform float iTime;\n// 分辨率\nuniform vec2 iResolution;\nuniform vec2 iChannelResolution;\nuniform vec3 iMouse;\nuniform sampler2D iChannel3;\nuniform sampler2D iChannel1;\nuniform sampler2D iChannel2; \nvarying vec2 vUv;\n\n\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n"+(0,(n=n(9663)).ys)("precision highp float;\nprecision highp int;\n\nuniform float time;\nuniform vec3 color;\nuniform float waverSpeed;\nuniform float phaseSpeed;\nuniform float thickness;\nuniform float contrast;\nuniform float electricitySpeed;\nuniform float flashSpeed;\nuniform float turbulence;\n\n\nconst float F3 = 0.3333333;\nconst float G3 = 0.1666667;\n\nvec3 random3(vec3 c) {\n float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));\n vec3 r;\n r.z = fract(512.0*j);\n j *= .125;\n r.x = fract(512.0*j);\n j *= .125;\n r.y = fract(512.0*j);\n return r-0.5;\n}\n\nfloat simplex3d(vec3 p) {\n vec3 s = floor(p + dot(p, vec3(F3)));\n vec3 x = p - s + dot(s, vec3(G3));\n vec3 e = step(vec3(0.0), x - x.yzx);\n vec3 i1 = e*(1.0 - e.zxy);\n vec3 i2 = 1.0 - e.zxy*(1.0 - e);\n vec3 x1 = x - i1 + G3;\n vec3 x2 = x - i2 + 2.0*G3;\n vec3 x3 = x - 1.0 + 3.0*G3;\n vec4 w, d;\n w.x = dot(x, x);\n w.y = dot(x1, x1);\n w.z = dot(x2, x2);\n w.w = dot(x3, x3);\n w = max(0.6 - w, 0.0);\n d.x = dot(random3(s), x);\n d.y = dot(random3(s + i1), x1);\n d.z = dot(random3(s + i2), x2);\n d.w = dot(random3(s + 1.0), x3);\n w *= w;\n w *= w;\n d *= w;\n\n return dot(d, vec4(52.0));\n}\n\n// Add or remove octaves for more granular noise\nfloat noise(vec3 m) {\n return 0.5333333 * simplex3d( m )\n + 0.2666667 * simplex3d( 2.0 * m )\n + 0.1333333 * simplex3d( 4.0 * m )\n + 0.0666667 * simplex3d( 8.0 * m );\n}\n\nvoid main(void) { \n\n #include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n float simplexNoise =0.0;\n vec2 uvScaled = vUv.xy * 2.0 - 1.0; \n if(waverSpeed > 0.0){\n uvScaled.y += waverSpeed * 4.0 * ( -0.5 + mod( time * waverSpeed, 1.0 ) ); \n vec3 p3 = vec3( vUv.xy * turbulence, time * electricitySpeed ); \n simplexNoise = noise( vec3( p3 * 12.0 + 12.0 ) );\n }else {\n uvScaled.y -= waverSpeed * 4.0 * ( -0.5 + mod( time * waverSpeed, 1.0 ) ); \n vec3 p3 = vec3( vUv.xy * turbulence, time * electricitySpeed ); \n simplexNoise = 1.0 - noise( vec3( p3 * 12.0 + 12.0 ) ); \n\n }\n\n float t = clamp( ( uvScaled.x * -uvScaled.x * 0.16 ) + 0.15, 0.0, 1.0 );\n float y = abs( simplexNoise * -t + uvScaled.y ) * ( 0.6 + sin( time * flashSpeed ) );\n float g = pow( y, thickness );\n float pixel = pow(1.0 - g, contrast);\n // modulation\n gl_FragColor =vec4( pixel * color, pixel * opacity);\n\n// #include <aomap_fragment>\n// #include <output_fragment>\n// #include <envmap_fragment>\n// #include <opaque_fragment>\n// #include <tonemapping_fragment>\n// #include <colorspace_fragment>\n#include <fog_fragment>\n// #include <premultiplied_alpha_fragment>\n// #include <dithering_fragment>\n}"),vertex:"\nvarying vec2 vUv;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vUv = uv; \n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n\n}\n",uniforms:{iTime:{value:0},MAX_RADIUS:{value:10},iChannelResolution:{value:new t.Vector2(3800,1900)},iResolution:{value:new t.Vector2(1900,1080)},iMouse:{value:new t.Vector2(100,100)},time:{name:"time",displayName:null,glslType:"float",useGridHelper:!1,useRange:!1,range:null,isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:""},color:{name:"color",displayName:null,type:"c",glslType:"vec3",useGridHelper:!1,useRange:!1,range:null,isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"Example light color",value:{r:1,g:1,b:1}},phaseSpeed:{name:"phaseSpeed",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{min:"0",max:"10"},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:10},thickness:{name:"thickness",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{min:"0",max:"4"},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:1.20528104},contrast:{name:"contrast",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{min:"0",max:"20"},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:19.07526043},electricitySpeed:{name:"electricitySpeed",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{min:"0",max:"0.4"},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:.27169517},flashSpeed:{name:"flashSpeed",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{min:-10,max:10},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:0},turbulence:{name:"turbulence",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{max:"10",min:"0"},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:2.6210239},waverSpeed:{name:"waverSpeed",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,range:{min:"-2",max:"2"},isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:.47451395},opacity:{name:"opacity",displayName:null,type:"f",glslType:"float",useGridHelper:!1,useRange:!0,min:0,max:1,isRandom:!1,randomRange:null,useToggle:!1,toggle:null,description:"",value:1}},render:e=>{const{time:t,material:n}=e;n.uniforms.iMouse&&(e=e.runScene.events.mouse.moveEvent,n.uniforms.iMouse.value.x=e.clientX),n.uniforms.iTime&&(n.uniforms.iTime.value=t),n.uniforms.time&&(n.uniforms.time.value=t)}};(0,n.ys)("\n\nprecision highp float;\nuniform float time;\nuniform float frequency;\nuniform float amplitude;\nuniform vec3 color;\nvarying vec3 fPosition;\nvarying vec3 fNormal;\nvarying vec3 oPosition;\nmat3 cotangent_frame(vec3 N, vec3 p, vec2 uv) \n{\n\tvec3 dp1 = dFdx(p);\n\tvec3 dp2 = dFdy(p);\n\tvec2 duv1 = dFdx(uv);\n\tvec2 duv2 = dFdy(uv);\n\tvec3 dp2perp = cross(dp2, N);\n\tvec3 dp1perp = cross(N, dp1);\n\tvec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n\tvec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n\tfloat invmax = inversesqrt(max(dot(T, T), dot(B, B)));\n\treturn mat3(T * invmax, B * invmax, N);\n}\nvec3 perturb_normal(vec3 N, vec3 V, vec2 texcoord, vec3 P) \n{\n\tvec3 map = vec3(amplitude * cos(-P.x * frequency + time * 4.), 1.0, 1.0);\n\tmat3 TBN = cotangent_frame(N, -V, texcoord);\n\treturn normalize(TBN * map);\n}\nvec3 rim(vec3 color, float start, float end, float coef) \n{\n\tvec3 normal = normalize(fNormal);\n\tvec3 eye = normalize(-fPosition.xyz);\n\tfloat rim = smoothstep(start, end, 1.0 - dot(normal, eye));\n\treturn clamp(rim, 0.0, 1.0) * coef * color;\n}\nvec2 blinnPhongDir(vec3 N, vec3 lightDir, float lightInt, float Ka, float Kd, float Ks, float shininess) \n{\n\tvec3 s = normalize(lightDir);\n\tvec3 v = normalize(-fPosition);\n\tvec3 n = normalize(N);\n\tvec3 h = normalize(v + s);\n\tfloat diffuse = Ka + Kd * lightInt * max(0.0, dot(n, s));\n\tfloat spec = Ks * pow(max(0.0, dot(n, h)), shininess);\n\treturn vec2(diffuse, spec);\n}\nvec4 create() \n{\n\tvec4 outFrag = vec4(0.0);\n\t// vec3 N = normalize(fNormal);\n\t// vec3 V = normalize(-fPosition);\n\t// N = perturb_normal(N, V, gl_FragCoord.xy, oPosition);\n\t// vec3 rimi = rim(vec3(1.0, 0.5, 0.0), 0.2, 0.9, 1.0);\n\t// vec2 blin = blinnPhongDir(N, vec3(1.0, 1.0, 1.0), 1.0, 0.3, 0.6, 0.6, 42.0);\n\t// vec3 c = color;\n\t// outFrag = vec4(c, 1.0 * blin.x);\n\treturn outFrag;\n}\nvoid main() \n{\n\tgl_FragColor = create();}\n\n"),r={fragmentShader:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",uniforms:{color1:{value:{r:.9215686274509803,g:.8549019607843137,b:.796078431372549},type:"c",glslType:"vec3"},color2:{value:{r:.7411764705882353,g:.27450980392156865,b:.23921568627450981},type:"c",glslType:"vec3"},start:{value:0,type:"f",glslType:"float"},end:{value:.94319433,type:"f",glslType:"float"},alpha:{value:1,type:"f",glslType:"float"},Inner_Glow_color:{value:{r:1,g:1,b:1},type:"c",glslType:"vec3"},Soild_color:{value:{r:1,g:1,b:1},type:"c",glslType:"vec3"}},vertex:r,render:e=>{const{time:t,material:n}=e;n.uniforms.iMouse&&(e=e.runScene.events.mouse.moveEvent,n.uniforms.iMouse.value.x=e.clientX),n.uniforms.iTime&&(n.uniforms.iTime.value=t),n.uniforms.time&&(n.uniforms.time.value=t)}};const a={cloud:{fragmentShader:"\n uniform float ratio;\n float PI = 3.1415926;\n\t\tuniform float iTime;\n\t\tuniform vec2 iResolution; \n\t\tvarying vec2 vUv;\n const float cloudscale = 1.1;\n const float speed = 0.03;\n const float clouddark = 0.5;\n const float cloudlight = 0.3;\n const float cloudcover = 0.2;\n const float cloudalpha = 8.0;\n const float skytint = 0.5;\n const vec3 skycolour1 = vec3(0.2, 0.4, 0.6);\n const vec3 skycolour2 = vec3(0.4, 0.7, 1.0);\n const mat2 m = mat2( 1.6, 1.2, -1.2, 1.6 );\n vec2 hash( vec2 p ) {\n p = vec2(dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)));\n return -1.0 + 2.0*fract(sin(p)*43758.5453123);\n }\n float noise( in vec2 p ) {\n const float K1 = 0.366025404; // (sqrt(3)-1)/2;\n const float K2 = 0.211324865; // (3-sqrt(3))/6;\n vec2 i = floor(p + (p.x+p.y)*K1);\t\n vec2 a = p - i + (i.x+i.y)*K2;\n vec2 o = (a.x>a.y) ? vec2(1.0,0.0) : vec2(0.0,1.0); //vec2 of = 0.5 + 0.5*vec2(sign(a.x-a.y), sign(a.y-a.x));\n vec2 b = a - o + K2;\n vec2 c = a - 1.0 + 2.0*K2;\n vec3 h = max(0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );\n vec3 n = h*h*h*h*vec3( dot(a,hash(i+0.0)), dot(b,hash(i+o)), dot(c,hash(i+1.0)));\n return dot(n, vec3(70.0));\t\n }\n \n float fbm(vec2 n) {\n float total = 0.0, amplitude = 0.1;\n for (int i = 0; i < 7; i++) {\n total += noise(n) * amplitude;\n n = m * n;\n amplitude *= 0.4;\n }\n return total;\n }\n \n\t\tvoid main() { \n vec2 p = (vUv - 0.5) * 2.0;\n vec2 uv = p*vec2(iResolution.x/iResolution.y,1.0); \n float time = iTime * speed;\n float q = fbm(uv * cloudscale * 0.5);\n \n //ridged noise shape\n float r = 0.0;\n uv *= cloudscale;\n uv -= q - time;\n float weight = 0.8;\n for (int i=0; i<8; i++){\n r += abs(weight*noise( uv ));\n uv = m*uv + time;\n weight *= 0.7;\n }\n \n //noise shape\n float f = 0.0;\n uv = p*vec2(iResolution.x/iResolution.y,1.0);\n uv *= cloudscale;\n uv -= q - time;\n weight = 0.7;\n for (int i=0; i<8; i++){\n f += weight*noise( uv );\n uv = m*uv + time;\n weight *= 0.6;\n }\n \n f *= r + f;\n \n //noise colour\n float c = 0.0;\n time = iTime * speed * 2.0;\n uv = p*vec2(iResolution.x/iResolution.y,1.0);\n uv *= cloudscale*2.0;\n uv -= q - time;\n weight = 0.4;\n for (int i=0; i<7; i++){\n c += weight*noise( uv );\n uv = m*uv + time;\n weight *= 0.6;\n }\n \n //noise ridge colour\n float c1 = 0.0;\n time = iTime * speed * 3.0;\n uv = p*vec2(iResolution.x/iResolution.y,1.0);\n uv *= cloudscale*3.0;\n uv -= q - time;\n weight = 0.4;\n for (int i=0; i<7; i++){\n c1 += abs(weight*noise( uv ));\n uv = m*uv + time;\n weight *= 0.6;\n }\n \n c += c1;\n \n vec3 skycolour = mix(skycolour2, skycolour1, p.y);\n vec3 cloudcolour = vec3(1.1, 1.1, 0.9) * clamp((clouddark + cloudlight*c), 0.0, 1.0);\n \n f = cloudcover + cloudalpha*f*r;\n \n vec3 result = mix(skycolour, clamp(skytint * skycolour + cloudcolour, 0.0, 1.0), clamp(f + c, 0.0, 1.0));\n\n\t\t \tgl_FragColor = vec4( result, 1.0 );\n\t\t\t\n\t\t}\n\t\t",render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t},uniforms:void 0,vertex:void 0},water:{fragmentShader:"\n #define TAU 6.28318530718\n #define MAX_ITER 5\n precision highp float;\n\t\t uniform float iTime;\n\t\t uniform vec2 iResolution; \n\t\t varying vec2 vUv;\n\t\t uniform vec3 color;\n\t\t uniform float opacity;\n\t\t uniform float speed;\n\t\t uniform float repeat;\n\n void main(void) {\n float time = iTime * .5+23.0;\n // uv should be the 0-1 uv of texture...\n vec2 uv = vUv;\n uv *= repeat;\n #ifdef SHOW_TILING\n vec2 p = mod(uv*TAU*2.0, TAU)-250.0;\n #else\n vec2 p = mod(uv*TAU, TAU)-250.0;\n #endif\n vec2 i = vec2(p);\n float c = 1.0;\n float inten = .005;\n\n for (int n = 0; n < MAX_ITER; n++) \n {\n float t = time * (1.0 - (speed / float(n+1)));\n i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));\n c += 1.0/length(vec2(p.x / (sin(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));\n }\n c /= float(MAX_ITER);\n c = 1.17-pow(c, 1.4);\n vec3 colour = vec3(pow(abs(c), 8.0));\n colour = clamp(colour + color, 0.0, 1.0);\n \n\n #ifdef SHOW_TILING\n // Flash tile borders...\n vec2 pixel = 2.0 / iResolution.xy;\n uv *= 2.0;\n\n float f = floor(mod(iTime*.5, 2.0)); \t// Flash value.\n vec2 first = step(pixel, uv) * f;\t\t \t// Rule out first screen pixels and flash.\n uv = step(fract(uv), pixel);\t\t\t\t// Add one line of pixels per tile.\n colour = mix(colour, vec3(1.0, 1.0, 0.0), (uv.x + uv.y) * first.x * first.y); // Yellow line\n \n #endif\n gl_FragColor = vec4(colour, opacity);\n }\n\t\t",uniforms:{iTime:{value:0,isTemp:!0},iResolution:{value:new t.Vector2(19e3,19e3),type:"vec2"},opacity:{value:1,type:"f",min:0,max:1},speed:{value:3.5,type:"f",min:0,max:20},repeat:{value:1,type:"f",min:0,max:1e4},color:{value:{r:0,g:.35,b:.5},type:"c"}},render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t}},radar1:{fragmentShader:"\n uniform float iTime; \n varying vec2 vUv; \n vec3 hsb2rgb(in vec3 c)\n {\n vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),\n 6.0)-3.0)-1.0,\n 0.0,\n 1.0 );\n rgb = rgb*rgb*(3.0-2.0*rgb);\n return c.z * mix( vec3(1.0), rgb, c.y);\n }\n\n\n\n void main(void) {\n vec2 uv = (vUv - 0.5) * 4.0;\n float r = length(uv) * 0.9;\n vec3 color = hsb2rgb(vec3(0.24, 0.7, 0.4));\n \n float a = pow(r, 2.0);\n float b = sin(r * 0.8 - 1.6);\n float c = sin(r - 0.010);\n float s = sin(a - iTime * 3.0 + b) * c;\n float num = abs(1.0 / (s * 10.8)) - 0.01;\n color *= num;\n gl_FragColor = vec4(color,(num) * 1.);\n }\n ",render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t}},radar2:{fragmentShader:"\n\n const float PI = 3.14159265359; \n \n uniform float iTime;\n uniform vec2 iResolution; \n \n varying vec2 vUv;\n float distanceTo(vec2 src, vec2 dst) {\n float dx = src.x - dst.x;\n float dy = src.y - dst.y;\n float dv = dx * dx + dy * dy;\n return sqrt(dv);\n }\n\n vec3 hsb2rgb( in vec3 c ){\n vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),\n 6.0)-3.0)-1.0,\n 0.0,\n 1.0 );\n rgb = rgb*rgb*(3.0-2.0*rgb);\n return c.z * mix( vec3(1.0), rgb, c.y);\n }\n \n vec2 rotate2D (vec2 _st, float _angle) {\n _st = mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n return _st;\n }\n \n void main() { \n float len = distanceTo(vec2(0.5, 0.5), (vec2(vUv.x, vUv.y) )) * 2.0; \n vec2 p = (vUv-0.5) * 4.0;\n vec3 color = hsb2rgb(vec3(fract(iTime*.1),1.,1.));\n float r = length(p);\n float w = .3;\n p = rotate2D(p,(r*PI*6.-iTime*2.));\n color *= smoothstep(-w,.0,p.x)*smoothstep(w,.0,p.x);\n float num= abs(1./(sin(pow(r,2.)*2.-iTime*1.3)*6.))*.4;\n color*= num;\n gl_FragColor = vec4(color, (1.0 - len) * 0.5) ;\n }\n ",render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t}},radar3:{fragmentShader:"\n uniform float iTime;\n uniform vec2 iResolution; \n varying vec2 iMouse;\n varying vec2 vUv;\n\n\n #define PI 3.1415926\n #define NUM 20.\n #define PALETTE vec3(.0, 1.4, 2.)+1.5\n\n #define COLORED\n #define MIRROR\n //#define ROTATE\n #define ROT_OFST\n #define TRIANGLE_NOISE\n\n //#define SHOW_TRIANGLE_NOISE_ONLY\n\n mat2 mm2(in float a){float c = cos(a), s = sin(a);return mat2(c,-s,s,c);}\n float tri(in float x){return abs(fract(x)-.5);}\n vec2 tri2(in vec2 p){return vec2(tri(p.x+tri(p.y*2.)),tri(p.y+tri(p.x*2.)));}\n mat2 m2 = mat2( 0.970, 0.242, -0.242, 0.970 );\n\n float triangleNoise(in vec2 p)\n{\nfloat z=1.5;\nfloat z2=1.5;\nfloat rz = 0.;\nvec2 bp = p;\nfor (float i=0.; i<=3.; i++ )\n{\n vec2 dg = tri2(bp*2.)*.8;\n dg *= mm2(iTime*.3);\n p += dg/z2;\n\n bp *= 1.6;\n z2 *= .6;\n z *= 1.8;\n p *= 1.2;\n p*= m2;\n \n rz+= (tri(p.x+tri(p.y)))/z;\n}\nreturn rz;\n}\n \n\n void main(void) {\n float time = iTime* 1.2;\n float aspect = iResolution.x/iResolution.y;\n float w = 50./sqrt(iResolution.x*aspect+iResolution.y);\n\n vec2 p = (vUv -0.5) * 2.0 ;\n p.x *= aspect;\n p*= 1.05;\n vec2 bp = p;\n \n #ifdef ROTATE\n p *= mm2(time*.25);\n #endif\n \n float lp = length(p);\n float id = floor(lp*NUM+.5)/NUM;\n \n #ifdef ROT_OFST\n p *= mm2(id*11.);\n #endif\n \n #ifdef MIRROR\n p.y = abs(p.y); \n #endif\n \n //polar coords\n vec2 plr = vec2(lp, atan(p.y, p.x));\n \n //Draw concentric circles\n float rz = 1.-pow(abs(sin(plr.x*PI*NUM))*1.25/pow(w,0.25),2.5);\n \n //get the current arc length for a given id\n float enp = plr.y+sin((time+id*5.5))*1.52-1.5;\n rz *= smoothstep(0., 0.05, enp);\n \n //smooth out both sides of the arcs (and clamp the number)\n rz *= smoothstep(0.,.022*w/plr.x, enp)*step(id,1.);\n #ifndef MIRROR\n rz *= smoothstep(-0.01,.02*w/plr.x,PI-plr.y);\n #endif\n \n #ifdef TRIANGLE_NOISE\n rz *= (triangleNoise(p/(w*w))*0.9+0.4);\n vec3 col = (sin(PALETTE+id*5.+time)*0.5+0.5)*rz;\n col += smoothstep(.4,1.,rz)*0.15;\n col *= smoothstep(.2,1.,rz)+1.;\n \n #else\n vec3 col = (sin(PALETTE+id*5.+time)*0.5+0.5)*rz;\n col *= smoothstep(.8,1.15,rz)*.7+.8;\n #endif\n \n #ifndef COLORED\n col = vec3(dot(col,vec3(.7)));\n #endif\n \n #ifdef SHOW_TRIANGLE_NOISE_ONLY\n col = vec3(triangleNoise(bp));\n #endif\n \n gl_FragColor = vec4(col,rz * 1.0);\n }\n ",render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t}},code:{fragmentShader:"\n uniform float ratio;\n float PI2 = 6.28318530718;\n float PI = 3.1416;\n uniform float iTime;\n uniform vec2 iResolution; \n varying vec2 vUv;\n float vorocloud(vec2 p){\n float f = 0.0;\n vec2 pp = cos(vec2(p.x * 14.0, (16.0 * p.y + cos(floor(p.x * 30.0)) + iTime * PI2)) );\n p = cos(p * 12.1 + pp * 10.0 + 0.5 * cos(pp.x * 10.0));\n \n vec2 pts[4];\n \n pts[0] = vec2(0.5, 0.6);\n pts[1] = vec2(-0.4, 0.4);\n pts[2] = vec2(0.2, -0.7);\n pts[3] = vec2(-0.3, -0.4);\n \n float d = 5.0;\n \n for(int i = 0; i < 4; i++){\n pts[i].x += 0.03 * cos(float(i)) + p.x;\n pts[i].y += 0.03 * sin(float(i)) + p.y;\n d = min(d, distance(pts[i], pp));\n }\n \n f = 2.0 * pow(1.0 - 0.3 * d, 13.0);\n \n f = min(f, 1.0);\n \n return f;\n }\n vec4 scene(vec2 UV){\n float x = UV.x;\n float y = UV.y;\n vec2 p = vec2(-x, -y);\n vec4 col = vec4(0.0,0.0,0.0,0.0);\n col.g += 0.02;\n float v = vorocloud(p);\n v = 0.2 * floor(v * 5.0);\n col.r += 0.1 * v;\n col.g += 0.6 * v;\n col.b += 0.5 * pow(v, 5.0);\n v = vorocloud(p * 2.0);\n v = 0.2 * floor(v * 5.0);\n col.r += 0.1 * v;\n col.g += 0.2 * v;\n col.b += 0.01 * pow(v, 5.0);\n col.a = 1.0;\n return col;\n }\n \n float distanceTo(vec2 src, vec2 dst) {\n float dx = src.x - dst.x;\n float dy = src.y - dst.y;\n float dv = dx * dx + dy * dy;\n return sqrt(dv);\n }\n\n \n void main() { \n // float len = distanceTo(vec2(0.5, 0.5), vec2(vUv.x, vUv.y)) * 2.0; \n \n gl_FragColor = scene(vUv);\n \n }\n ",render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t}},ring1:{fragmentShader:"\n uniform float ratio;\n\n float M_PI = 3.1415926;\n float M_TWO_PI = 6.28318530718;\n vec3 iMouse = vec3(0.0, 0.0 ,0.0 );\n uniform float iTime;\n uniform vec2 iResolution; \n varying vec2 vUv;\n float rand(vec2 n) {\n return fract(sin(dot(n, vec2(12.9898,12.1414))) * 83758.5453);\n }\n \n float noise(vec2 n) {\n const vec2 d = vec2(0.0, 1.0);\n vec2 b = floor(n);\n vec2 f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y);\n }\n \n vec3 ramp(float t) {\n return t <= .5 ? vec3( 1. - t * 1.4, .2, 1.05 ) / t : vec3( .3 * (1. - t) * 2., .2, 1.05 ) / t;\n }\n vec2 polarMap(vec2 uv, float shift, float inner) {\n \n uv = vec2(0.5) - uv;\n \n \n float px = 1.0 - fract(atan(uv.y, uv.x) / 6.28 + 0.25) + shift;\n float py = (sqrt(uv.x * uv.x + uv.y * uv.y) * (1.0 + inner * 2.0) - inner) * 2.0;\n \n return vec2(px, py);\n }\n float fire(vec2 n) {\n return noise(n) + noise(n * 2.1) * .6 + noise(n * 5.4) * .42;\n }\n \n float shade(vec2 uv, float t) {\n uv.x += uv.y < .5 ? 23.0 + t * .035 : -11.0 + t * .03; \n uv.y = abs(uv.y - .5);\n uv.x *= 35.0;\n \n float q = fire(uv - t * .013) / 2.0;\n vec2 r = vec2(fire(uv + q / 2.0 + t - uv.x - uv.y), fire(uv + q - t));\n \n return pow((r.y + r.y) * max(.0, uv.y) + .1, 4.0);\n }\n \n vec3 color(float grad) {\n \n float m2 = iMouse.z < 0.0001 ? 1.15 : iMouse.y * 3.0 / iResolution.y;\n grad =sqrt( grad);\n vec3 color = vec3(1.0 / (pow(vec3(0.5, 0.0, .1) + 2.61, vec3(2.0))));\n color = ramp(grad);\n color /= (m2 + max(vec3(0), color));\n return color;\n \n }\n \n \n float distanceTo(vec2 src, vec2 dst) {\n float dx = src.x - dst.x;\n float dy = src.y - dst.y;\n float dv = dx * dx + dy * dy;\n return sqrt(dv);\n }\n\n \n void main() { \n float m1 = iMouse.z < 0.0001 ? 3.6 : iMouse.x * 5.0 / iResolution.x;\n float t = iTime;\n vec2 uv = vUv;\n float ff = 1.0 - uv.y;\n uv.x -= (iResolution.x / iResolution.y - 1.0) / 2.0;\n vec2 uv2 = uv;\n uv2.y = 1.0 - uv2.y;\n uv = polarMap(uv, 1.3, m1);\n uv2 = polarMap(uv2, 1.9, m1);\n float shade1 = shade(uv, t);\n vec3 c1 = color(shade1) * ff;\n vec3 c2 = color(shade(uv2, t)) * ff;\n gl_FragColor = vec4(c1 , (1.0 - shade1)* 1.0);\n \n }\n ",render:e=>{const{time:t,material:n}=e;n.uniforms.iTime.value=t}},circuitGrid:{fragmentShader:"\n #define PI 3.1415926535897932384626433832795\nprecision highp float;\nprecision highp int;\nuniform float time;\nuniform float resolution;\nuniform float intensity;\nuniform float speed;\nuniform vec3 lightColor;\nuniform vec3 baseColor;\nvarying vec3 vPosition;\nvarying vec2 vUv;\n\nvec2 circuit(vec2 p) \n{\np = fract(p);\nfloat r = 0.3;\nfloat v = 0.0, g = 1.0;\nfloat d;\nconst int iter = 7;\nfor (int i = 0;\n i < iter; i++) \n{\nd = p.x - r;\ng += pow(clamp(1.0 - abs(d), 0.0, 1.0), 200.0);\nif (d > 0.0) \n{\np.x = (p.x - r) / (1.8 - r);\n}\n else \n{\np.x = p.x;\n}\np = p.yx;\n}\nv /= float(iter);\nreturn vec2(g, v);\n}\nvec4 create() \n{\nvec4 outColor = vec4(0.0);\nvec2 uv = (vUv.xy + 0.5) * resolution;\nvec2 cid2 = floor(uv);\nfloat cid = (cid2.y + cid2.x);\nvec2 dg = circuit(uv);\nfloat d = dg.x; \nvec3 col1 = (0.2 - vec3(max(min(d, 2.0) - 1.0, 0.0))) * baseColor;\nvec3 col2 = vec3(max(d - 1.0, 0.0)) * lightColor;\n float f = max(0.9 - mod(uv.y - uv.x + (time * speed) + (dg.y * 0.2), 2.5), 0.0) * intensity;\ncol2 *= f;\noutColor = vec4(col1 + col2, 1.);\nreturn outColor;\n}\nvoid main() \n{\ngl_FragColor = create();\n}",uniforms:{time:{type:"f",glslType:"float"},resolution:{value:"15",type:"f",glslType:"float"},intensity:{value:"10",type:"f",glslType:"float"},speed:{value:"0.5",type:"f",glslType:"float"},lightColor:{value:{r:0,g:.9647058823529412,b:.14901960784313725},type:"c",glslType:"vec3"},baseColor:{value:{r:.7019607843137254,g:.7019607843137254,b:.7019607843137254},type:"c",glslType:"vec3"}},render:e=>{const{time:t,material:n}=e;n.uniforms.time&&(n.uniforms.time.value=t)}},Fresnel:{fragmentShader:"\n// 时间\nuniform float iTime;\n// 分辨率\nuniform vec2 iResolution;\nuniform vec2 iMouse;\nuniform sampler2D iChannel3;\nuniform sampler2D iChannel1;\nuniform sampler2D iChannel2; \nuniform sampler2D iChannel0; \nvarying vec2 vUv;\n\nprecision highp float;\nuniform vec3 color;\nuniform float start;\nuniform float end;\nuniform float alpha;\nvarying vec3 fPosition;\nvarying vec3 fNormal;\nvec4 create() \n{\nvec4 outColor = vec4(0.0);\nif (!gl_FrontFacing) \n{\ndiscard;\n}\n vec3 normal = normalize(fNormal);\n vec3 eye = normalize(-fPosition.xyz);\n float rim = smoothstep(start, end, 1.0 - dot(normal, eye));\n float value = clamp(rim, 0.0, 1.0) * alpha;\nvec4 color1 = texture2D(iChannel0,vUv);\noutColor = mix(vec4(value * texture2D(iChannel0,vUv).xyz, length(value)) , vec4(value * color, length(value)), 0.5);\nreturn outColor;\n}\nvoid main() \n{\ngl_FragColor = create();}\n\n",vertex:"\n \nprecision highp float;\nvarying vec3 fNormal;\nvarying vec3 fPosition;\nvarying vec2 vUv;\n\nvec4 create() \n{\nvec4 Fork_of_Transperent_Freshnel_FrontFacing1645494286334_382_gl_Position = vec4(0.0);\nfNormal = normalize(normalMatrix * normal);\nvec4 pos = modelViewMatrix * vec4(position, 1.0);\nfPosition = pos.xyz;\nFork_of_Transperent_Freshnel_FrontFacing1645494286334_382_gl_Position = projectionMatrix * pos;\nreturn Fork_of_Transperent_Freshnel_FrontFacing1645494286334_382_gl_Position *= 1.0;\n}\nvoid main() \n{\n vUv = uv;\ngl_Position = create();}\n\n",uniforms:{color:{value:{r:0,g:.8823529411764706,b:1},type:"c",glslType:"vec3"},start:{value:0,min:-1,max:1,type:"f",glslType:"float"},end:{value:1,type:"f",min:-1,max:1,glslType:"float"},alpha:{value:1,min:0,max:1,type:"f",glslType:"float"}},render:e=>{const{time:t,material:n}=e;n.uniforms.time&&(n.uniforms.time.value=t)}},honeycomb:{fragmentShader:(0,n.ys)("\n // 时间\nuniform float iTime;\n// 分辨率\nuniform vec2 iResolution;\nuniform vec2 iMouse;\nuniform sampler2D iChannel3;\nuniform sampler2D iChannel1;\nuniform sampler2D iChannel2; \nvarying vec2 vUv;\n float HexDist(vec2 p) {\n p = abs(p);\n float c = dot(p, normalize(vec2(1, 1.73205080757)));\n c= max(c, p.x);\n \n return c;\n }\n \n vec4 HexCoords(vec2 uv) {\n vec2 r = vec2(1, 1.73205080757);\n vec2 h = r*.5;\n \n vec2 a = mod(uv, r)-h;\n vec2 b = mod(uv-h, r)-h;\n \n vec2 gv = dot(a,a)<dot(b,b) ? a : b; //check if length a < length b\n \n float y = mod(.5 - HexDist(gv), .08);\n \n //original y function\n //float y = .5 - HexDist(gv);\n \n float x = atan(gv.x, gv.y);\n \n vec2 id = uv-gv;\n \n return vec4(x, y, id.x, id.y);\n }\n \n vec2 edgeDist(vec2 uv) {\n vec2 r = vec2(1, 1.73205080757);\n vec2 h = r*.5;\n \n vec2 a = mod(uv, r)-h;\n vec2 b = mod(uv-h, r)-h;\n \n vec2 gv = dot(a,a)<dot(b,b) ? a : b; //check if length a < length b\n return gv;\n }\n \n vec3 NeonPalette(float t) {\n // Interpolate between neon colors\n vec3 col1 = vec3(1.000,0.000,0.000);\n vec3 col2 = vec3(0.984,0.000,1.000);\n vec3 col3 = vec3(0.000,0.984,1.000);\n \n // Mix between col1, col2, and col3 based on 't'\n if (t < 0.5) {\n return mix(col1, col2, t * 2.0);\n } else {\n return mix(col2, col3, (t - 0.5) * 2.0);\n }\n }\n \n float random(vec2 st){\n return fract(sin(dot(st,vec2(12.9898,78.233))) * 43758.5453123);\n }\n \n void mainImage( out vec4 fragColor, in vec2 fragCoord )\n {\n vec2 uv = vUv;\n vec3 col = vec3(0);\n \n uv *= 10.;\n uv+=16.;\n \n vec4 hc = HexCoords(uv);\n \n vec2 id= hc.zw;\n \n float phaseShift = id.x * id.y;\n \n float t = (sin(hc.w*sin(hc.z) + iTime*1.2 + phaseShift*.5) +1.0) * .5;\n \n float c2 = smoothstep(.02, .05, hc.y * t);\n \n float uvEdge = abs(length(edgeDist(uv)));\n //float radial = sin(mod(hc.x, 2.1)+sin(hc.z*hc.w+iTime*.1));\n \n // Map 't' to a neon color from our palette\n vec3 neonColor = NeonPalette(t)*(uvEdge*6.*((cos(hc.z*hc.w+iTime*.6)+1.0)*.5));\n \n //float c = smoothstep(.02, .05, hc.y*((sin(hc.z*hc.w+iTime)+1.)*.5));\n //uvEdge *= c; \n //col.rg += uvEdge;\n \n // Apply glow (brightening)\n col = mix(col, neonColor/2., c2);\n //col *=radial;\n \n fragColor = vec4(col, 1.0);\n }\n "),render:e=>{const{time:t,material:n}=e;n.uniforms.iTime&&(n.uniforms.iTime.value=t)}},test:r,sweepWave:i},s="\nvarying vec3 vPosition;\nvarying vec2 vUv;\nvoid main() { \n vUv = uv; \n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n}\n",o={water:"水",cloud:"云",ExMaterial:"拓展材质",radar:"雷达",radar1:"雷达1",radar2:"雷达2",radar3:"雷达3",code:"代码",ring1:"环1",circuitGrid:"电子网格",honeycomb:"蜂窝",rain:"雨",sweepWave:"扫描波"}},4156:(e,t,n)=>{n.d(t,{Z:()=>f});var r,i=n(6001),a=n(5521),s=n(960),o=n(3736),l=n(1398),u=n(3735),c=n(2233),d=n(135),h=n(144),p=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class f extends h.ZP{static afterload(e,t){return p(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:n})=>{const r=e[n];if(r){let a=(0,c.Ki)(r);a||(a=(0,i.getId)(),(0,c.x)(r,a)),r.image?t.uniqueEx.texture.linkMaterial(r,{target:e,type:n,targetType:"material"}):t.textureEx.setAwaitLoaded(a,(()=>p(this,void 0,void 0,(function*(){(yield t.textureEx.toStandard(r)).valid?(e[n]=r,t.uniqueEx.texture.linkMaterial(r,{target:e,type:n,targetType:"material"})):delete e[n]}))))}}))}))}}(r=f).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"envMap",isEnv:!0},{type:"lightMap"},{type:"displacementMap"}],type:"MeshLambertMaterial",bind:e=>{(0,o.M)(e,"type",f.tools.type)},onAdd:e=>{const{material:t,runScene:n}=e;r.tools.textureNames.map((({type:e})=>p(void 0,void 0,void 0,(function*(){var r=t[e];r&&((yield n.textureEx.toStandard(r)).valid?n.uniqueEx.texture.linkMaterial(r,{target:t,type:e,targetType:"material"}):delete t[e])}))))},create:()=>{var e=new a.MeshLambertMaterial;return r.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:i,material:a}=e,{data:o,load:l}=t;var u=n.normalX;const h=r.tools.create(e.core.runScene),p=((0,d.mergeMaterial)(a,h),h.name=a.name,h.side=a.side,(0,c.x)(h,(0,c.Ki)(a)),r.tools.bind(h),[]);return l&&p.push(...s.F6.filter(o.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{i.runScene.materialEx.setTexture({material:h,type:t,newVal:n},!1)}})))),void 0!==u&&h.normalScale.set(u,-1*u),i.runScene.materialEx.parseNromals(n,h),{material:h,setTextureFns:p}},toNormal:e=>({material:e.clone(),normal:{type:f.tools.type,normalX:e.normalScale.x},textures:(0,d.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,d.getBaseTextures)(e),snapshot:{getDiff:e=>l.LV.getDiff(h.Gf,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;l.LV.set({def:h.Gf,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,d.updateMaterial)(n)}))}},validType:e=>"MeshLambertMaterial"===e.type||"MeshLambertMaterial"===e.type,setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new u.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}}},9457:(e,t,n)=>{n.d(t,{Z:()=>f});var r,i=n(6001),a=n(5521),s=n(960),o=n(3736),l=n(1398),u=n(3735),c=n(2233),d=n(135),h=n(144),p=(t=n(4156),function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))});class f extends h.ZP{static afterload(e,t){return p(this,void 0,void 0,(function*(){this.tools.bind(e),this.tools.textureNames.map((({type:n})=>{const r=e[n];if(r){let a=(0,c.Ki)(r);a||(a=(0,i.getId)(),(0,c.x)(r,a)),r.image?t.uniqueEx.texture.linkMaterial(r,{target:e,type:n,targetType:"material"}):t.textureEx.setAwaitLoaded(a,(()=>p(this,void 0,void 0,(function*(){(yield t.textureEx.toStandard(r)).valid?t.uniqueEx.texture.linkMaterial(r,{target:e,type:n,targetType:"material"}):delete e[n]}))))}}))}))}}(r=f).tools={textureNames:[{type:"map"},{type:"metalnessMap"},{type:"roughnessMap"},{type:"normalMap"},{type:"aoMap"},{type:"emissiveMap"},{type:"alphaMap"},{type:"lightMap"},{type:"displacementMap"}],type:"MyMeshPhongMaterial",bind:e=>{(0,o.M)(e,"type",f.tools.type)},onAdd:t.Z.tools.onAdd,create:()=>{var e=new a.MeshPhongMaterial;return r.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:i,material:a}=e,{data:o,load:l}=t,u=r.tools.create(e.core.runScene),h=((0,d.mergeMaterial)(a,u),u.name=a.name,u.side=a.side,(0,c.x)(u,(0,c.Ki)(a)),r.tools.bind(u),[]);return l&&h.push(...s.F6.filter(o.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{i.runScene.materialEx.setTexture({material:u,type:t,newVal:n},!1)}})))),i.runScene.materialEx.parseNromals(n,u),{material:u,setTextureFns:h}},toNormal:e=>({material:e.clone(),normal:{type:f.tools.type},textures:(0,d.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,d.getBaseTextures)(e),snapshot:{getDiff:e=>l.LV.getDiff(h.Gf,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;l.LV.set({def:h.Gf,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,d.updateMaterial)(n)}))}},validType:e=>"MyMeshPhongMaterial"===e.type||"MeshPhongMaterial"===e.type,setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new u.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]}}},110:(e,t,n)=>{n.d(t,{Z:()=>h});var r,i=n(5521),a=n(3924),s=n(3736),o=n(1398),l=n(2233),u=n(135),c=(t=n(144),n(3735));const d={color:t.Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,a.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,this.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const n=(0,a.createDefModel)("Sprite");var r=e.userData.layers;return(0,a.setLayers)(n,r),n.userData=Object.assign(Object.assign({},t),n.userData),this.merge(e,n),n.material=e.material,n}},this.merge=(e,t)=>{t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,t.name=e.name,(0,s.M)(e,"name",e.name),(0,a.setLayers)(t,1===e.layers.mask?0:1)},this.type="Sprite",this.runScene=e;const{parse:t,toNormal:n}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(this.type,{parse:t,toNormal:n}),e.modelEx.importAndExport.addParses("MySpriteMaterial",{parse:t,toNormal:n})}))}}(r=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var n=e[t];if(n)return{type:t,texture:n}})).filter((e=>e)),create:()=>{const e=new i.SpriteMaterial;return e.alphaToCoverage=!0,e.toneMapped=!1,r.tools.bind(e),e},setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new c.Z({target:t,typeList:[n],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e[t]},parseData:(e,t)=>{var{texture:e,material:n,normal:r}=e;const{data:i,load:a}=e,s=[],o=(0,u.mergeMaterial)(n,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(n));var{depthWrite:e,depthTest:n,name:r,fog:c}=r;return!1===c&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==n&&(o.depthTest=n),r&&(o.name=r),a&&s.push(...i.map((e=>{const{type:n,texture:r}=e;return()=>{t.materialEx.setTexture({material:o,type:n,newVal:r},!1)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)());var n=Object.assign({},t.userData);const r={type:h.tools.type,name:e.name};return e.fog||(r.fog=!1),e.depthWrite!==u.defBaseMaterialMap.depthWrite&&(r.depthWrite=e.depthWrite),e.depthTest!==u.defBaseMaterialMap.depthTest&&(r.depthTest=e.depthTest),t.userData=n,{normal:r,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(d,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;o.LV.set({def:d,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,u.updateMaterial)(n)}))}},textureNames:[{type:"map"},{type:"alphaMap"}]}},3801:(e,t,n)=>{n.d(t,{Ju:()=>a,t9:()=>i,zf:()=>s});var r=n(3736);const i={isDynamic:e=>e.userData.isDynamic},a={isDeleted(e,t=!1){var n;return!!e&&(!(null==(n=null==e?void 0:e.userData)||!n.isDeleted)||!!t&&a.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,r.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,r.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var n=e.userData.lock;return t?!!n||s.isLock(e.parent,t):void 0!==n&&n}}},3924:(e,t,n)=>{n.r(t),n.d(t,{bindModelCloneId:()=>xe,closeModelEvent:()=>ve,createDefModel:()=>K,createSpecialModel:()=>G,default:()=>W,delClonedModel:()=>se,deletedModel:()=>V.Ju,disposeModel:()=>Z,dynamicModel:()=>V.t9,eachParentForModel:()=>Ee,getAnimaModelMap:()=>Se,getClonedIdModel:()=>ie,getDeepModels:()=>ee,getIdMapByModel:()=>me,getModelMap:()=>_e,getModelSize:()=>ce,getModelType:()=>be,getSphere:()=>ye,hasSkeleton:()=>te,helperModel:()=>pe,instanceModel:()=>q,isDynamicModel:()=>re,isGLowModel:()=>oe,isGroup:()=>ue,isHelper:()=>J,isNormalModel:()=>we,isSprite:()=>le,lockModel:()=>V.zf,mergeModel:()=>X,modelInfos:()=>H,normalModel:()=>he,selectableModel:()=>de,setAnimaModelUniqueName:()=>Te,setClonedModel:()=>ae,setDynamicModel:()=>ne,setHelper:()=>Q,setLayers:()=>$,tempModel:()=>ge,uselessGroup:()=>fe,validCanInstanceModel:()=>Me,withAnima:()=>Y});var r=n(6001),i=n(5521),a=n(9174),s=n(4230),o=n(3975),l=n(5003),u=n(960),c=n(1794),d=n(272),h=n(5247),p=n(7626),f=n(7013),m=n(135),g=n(5124),v=n(3379),y=n(3736),b=n(4852),x=n(3735),w=n(2510);class S extends n(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.updateWorldMatrix(!0,!0),this.target.updateWorldMatrix(!0,!0),e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e,oldParent:t}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===(null==t?void 0:t.userData.id)&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const _=S;var T=n(7169),M=n(4380),E=n(2233),D=n(5317);class P{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var k=n(9576),O=n(110),A=n(7095),C=n(2037);class N{constructor(e){this.data=this.getData(),this.instancedMap={},this.parses=new c.Z,this.nodeType={MySpriteMaterial:O.Z,VerticesRain:A.Z},this.modelAdded=()=>{this.mergeClone()},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.awaitMateIds=new d.Z,this.loadNodeDef=e=>{let{node:t,nodeDef:n}=e;this.processModel(t),(0,r.mapObj)(this.runScene.modelEx.defNodeMap,((e,r)=>{var i=n[e];null!=i&&(t[e]=i)})),n.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.parseMateIds=e=>{const t=e.module.get("material");t&&this.awaitMateIds.map((({model:e,multiMaterial:n})=>{e.material=u.F6.filter(n.mateIds.map((e=>null==(e=t.getById(e))?void 0:e.material))),e.geometry.groups=n.groups}))},this.afterParse=e=>{const{config:t,data:n,json:r,core:i}=e;if(this.parseMateIds(i),this.awaitMateIds.clear(),"model"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let a=["glb_model"===(e=(e=n.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=a;fe.is(e)&&(a=[...e.children]),this.parseEx(r.asset.ex,a),i.models.push(...a)}},this.toNromal=e=>{var t=e.type;const n=this.parses.get(t);let r,i=e.model;return n&&(i=n.toNormal(e),r=null==(t=n.getTextures)?void 0:t.call(n,e)),{model:i,textures:r}},this.parse=e=>{var t=e.type;const n=this.parses.get(t);if(n)return n.parse(e)},this.runScene=e}getData(){return{map:new c.Z,clonedMap:{},helperModels:[]}}getMap(){return new c.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount,modelAdded:this.modelAdded})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:n,nodeDef:r}=e;if(r.extras){const{layers:o,normal:l,type:c,local:d,cloneId:h,id:p,animations:f,isDynamic:m,multiMaterial:v}=r.extras;m&&(n.userData.isDynamic=!0);var i,a,s=re(n,!0);f&&(n.animations=k.B.parse(f)),!h||s||(0,g.F)(this.runScene).instance.ignoreNames.includes(n.name)||(this.instancedMap[h]||(this.instancedMap[h]=new Set),this.instancedMap[h].add(n)),d&&([s,a,i]=d.split(","),n.position.set(s,a,i)),o&&(n.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:n,val:1})),r.extras.isHelper&&this.data.helperModels.push(n);let y=[];c&&(y=C.Z.process({runScene:this.runScene,model:n,info:r.extras})),0<(y=l?u.F6.toArr(this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene})):y).length&&([s,...a]=y,e.node=s,t.models.push(...a)),p&&this.data.map.set(p,e.node),u.F6.toArr([...y,e.node]).map((e=>{var n=null==(n=null==(n=null==e?void 0:e.material)?void 0:n.userData)?void 0:n.id;if(n){const r=t.module.get("material").data.materialIns[n];r&&r.models.push(e)}})),v&&this.awaitMateIds.add({model:e.node,multiMaterial:v}),this.runScene.cb.model.parse.cb({data:r.extras,model:e.node})}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){this.runScene.optionsEx.options.instance.enable&&"running"===this.runScene.optionsEx.options.mode||(this.instancedMap={})}parseEx(e,t){if(e=e.timeLine){const n={};t.map((e=>{e.traverse((e=>{var t=(0,E.Ki)(e);n[t]=e}))})),this.runScene.timeLineEx.parseSavedGroupMapForTargetMap(e,n,!1)}}mergeGeometry(){if(this.runScene.optionsEx.options.instance.enable){const t=[],n=[];(0,r.mapObj)(this.runScene.uniqueEx.model.map,((e,{model:r})=>{const{geometry:i,material:a}=r;var s;i&&a&&"BufferGeometry"===i.type&&(s=i.clone().applyMatrix4(r.matrixWorld),this.runScene.modelEx.remove(r,!1),t.push(a),n.push(s))}));var e=a.mergeBufferGeometries(n,!0);e=new h.Z.Mesh(e,t),this.runScene.modelEx.add(e,void 0,{addUndo:!1})}}processModel(e){["x","y","z"].map((t=>{isNaN(e.rotation[t])&&(e.rotation[t]=0)}))}}var L=n(9663);class I{constructor(e){this.copyData={name:"",data:void 0,modelId:""},this.useMap={name:"",model:void 0},this.onModelMove=e=>{var t;if(this.useMap.model&&0!==this.useMap.name.length&&this.get(e)&&(t=this.getLocalDataByName(e,this.useMap.name))){var{x:t,y:n,z:r,tx:a,ty:s,tz:o}=t.data;let c=e=(0,L.VU)(e,this.runScene.assetsEx.scene);var{x:e,y:l,z:u}=e;e={x:e+t,y:l+n,z:u+r},void 0!==a&&void 0!==s&&void 0!==o&&(c=new i.Vector3(e.x+a,e.y+s,e.z+o)),this.runScene.assetsEx.camera.position.set(e.x,e.y,e.z),this.runScene.assetsEx.camera.lookAt(c),this.runScene.assetsEx.controls.target.copy(c)}},(this.runScene=e).cb.model.setVector3.add("ModelExCamFlow",(({type:e,model:t})=>{"position"===e&&this.onModelMove(t)})),e.cb.inited.add("model-camFlow",(()=>{e.events.model.addOptions({name:"camFlow",map:{parse:e=>{var{model:e,childs:t}=e,[t]=t;return t?this.focus(e,t):Promise.resolve()}}})}))}teigger(){this.runScene.events.model.enable}link(e,t){var n=this.get(e);if(n&&(n=n[t])){let r=(0,E.Ki)(e);"id"===n.type&&(r=n.data),this.copyData={name:t,modelId:r,data:void 0}}}getDataById(e,t){return null==(e=null==(e=this.runScene.modelEx.getById(e))?void 0:e.userData[I.savedStr])?void 0:e[t]}copy(e,t){(e=this.getLocalDataByName(e,t))&&(this.copyData={name:t,data:e.data,modelId:""})}paste(e){const{name:t,modelId:n,data:r}=this.copyData;e.map((e=>{r?this.set({model:e,local:r,name:t,state:!0}):0<n.length&&this.set({model:e,modelId:n,name:t,state:!0})}))}set(e){var{model:e,local:t,name:n,state:r,modelId:i}=e;let a=this.get(e);if(a){if(!r)return void delete a[n]}else{if(!r)return;a={},(0,y.M)(e,I.savedStr,a)}r&&(i?i!==(0,E.Ki)(e)&&(a[n]={type:"id",data:i}):a[n]={type:"data",data:t||this.getBetween(e)})}use(e,t){this.useMap.model=e,this.useMap.name=t}clearUse(){this.useMap.model=void 0}get(e){return(0,y.is)(e,I.savedStr)}getBetween(e){var{x:e,y:t,z:n}=(0,L.VU)(e,this.runScene.assetsEx.scene),{x:r,y:i,z:a}=this.runScene.assetsEx.controls.target;return{x:this.runScene.assetsEx.camera.position.x-e,y:this.runScene.assetsEx.camera.position.y-t,z:this.runScene.assetsEx.camera.position.z-n,tx:r-this.runScene.assetsEx.camera.position.x,ty:i-this.runScene.assetsEx.camera.position.y,tz:a-this.runScene.assetsEx.camera.position.z}}used(e,t){return(0,E.Ki)(e)===(0,E.Ki)(this.useMap.model)&&t===this.useMap.name}getLocalDataByName(e,t){var n=this.get(e);if(n&&(n=n[t]))return"id"!==n.type?n:n.data!==(0,E.Ki)(e)?this.getDataById(n.data,t):void 0}getLocalByName(e,t){if(e=this.get(e))return e[t]}focus(e,t,n=.5){if(!(t=this.getLocalDataByName(e,t)))return Promise.resolve();var{x:r,y:a,z:s}=t.data,{x:o,y:l,z:u}=(0,L.VU)(e,this.runScene.assetsEx.scene);let c;return c=void 0!==t.data.tx&&void 0!==t.data.ty&&void 0!==t.data.tz?new i.Vector3(t.data.tx,t.data.ty,t.data.tz):(0,L.VU)(e,this.runScene.assetsEx.scene),t={x:o+r,y:l+a,z:u+s},this.runScene.cameraEx.anima({x:t.x,y:t.y,z:t.z,tx:t.x+c.x,ty:t.y+c.y,tz:t.z+c.z},{time:n}),new Promise((e=>{setTimeout(e,n)}))}}I.savedStr="camFLow",n(8881);var R=n(7201),U=n(1398);const B={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po"},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro"},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl"},visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class F{constructor(e){this.rmItem=e=>{"model"===e.type&&e.datas.map((t=>{let n=t.data.get("model");e.targets.map((e=>{delete n[(0,E.Ki)(e)]}))}))},this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const n=t.data;let r=n.get("model");r||(r={},n.set("model",r));const i=new d.Z;if(e.targets.map((e=>{e.traverse((e=>{var t=(0,E.Ki)(e);t&&(e.material&&i.add(e.material),r[t]=this.getItem(e))}))})),0!==i.size){const t=new d.Z;i.map((e=>{const n=f.ZP.getTextures(e);0!==n.length&&t.add(n.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:i.toArray()})}}))},this.create=e=>{var t=this.getDiff(this.runScene.sceneEx.getClearModels());0!==(0,R.objLength)(t)&&e.data.set("model",t)},this.set=e=>{var t=e.snapshot.data.get("model");if(t&&!e.ignoreModules.includes("model")){const n=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,r.mapObj)(t,((t,r)=>{const i=this.runScene.uniqueEx.model.get(t);i&&!1!==(null==i?void 0:i.isSnapshot)&&(i.snapshot?i.snapshot.set({inputMap:e,model:i,data:r,runScene:this.runScene}):(void 0===r.vi&&(i.visible=!0,this.runScene.cb.model.change.cb({model:i,type:"visible",val:!0})),U.LV.set({def:B,runScene:this.runScene,data:r,target:i,map:e}),n.push((()=>{var e;this.runScene.modelEx.setGlow(i,!!r.isGLow),r.isOutline?this.runScene.modelEx.setOutline(i,!0):i.userData.outline&&(i.userData.outline=!1),void 0!==r.vi&&this.runScene.cb.model.change.cb({model:i,type:"visible",val:i.visible}),r.materialId&&r.materialId!==(0,E.Ki)(i.material)&&(e=this.runScene.uniqueEx.material.get(r.materialId))&&this.runScene.materialEx.resetMaterial(i,e,{addUndo:!1,includeChild:!1})}))))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("model",this.create),e.cb.snapshot.delUseless.add("model",(t=>{(0,r.mapObj)(t,((t,n)=>{const i=n.data.model;i&&((0,r.mapObj)(i,(t=>{e.uniqueEx.model.has(t)||delete i[t]})),0===(0,R.objLength)(i)&&delete n.data.model)}))})),this.runScene.cb.snapshot.set.add("model",this.set),this.runScene.cb.snapshot.getLength.add("model",(e=>{var t=e.data.data.get("model");t&&(e.inputData.model=Object.keys(t).length)})),this.runScene.cb.snapshot.resetItem.add("model",(({targets:e,type:t,datas:n})=>{"model"===t&&this.resetItem({type:t,datas:n,targets:e})})),this.runScene.cb.snapshot.rmItem.add("model",(({targets:e,type:t,datas:n})=>{"model"===t&&this.rmItem({type:t,datas:n,targets:e})})),this.runScene.cb.snapshot.getByType.add("model",(({targets:e,type:t,data:n})=>{"model"===t&&this.resetItem({type:t,datas:[n],targets:e})})),this.runScene.cb.snapshot.delete.add("model",(({data:e})=>{(e=e.data.get("model"))&&(0,r.mapObj)(e,((e,t)=>{this.bindMaterialId(t.materialId,!1)}))})),this.runScene.cb.snapshot.parseJSON.add("model",(e=>{e.map(((e,t)=>{(t=t.data.get("model"))&&(0,r.mapObj)(t,((e,t)=>{this.bindMaterialId(t.materialId,!0)}))}))}))}bindMaterialId(e,t){e&&0!==e.length&&this.runScene.cb.assets.manager.set.cb({type:"material",id:e,isAdd:t})}getItem(e){const t=U.LV.getDiff(B,e);return oe(e)&&(t.isGLow=!0),(0,v.S)(e)&&(t.isOutline=!0),e.material&&!(0,m.isMultiMaterial)(e.material)&&(t.materialId=(0,E.Ki)(e.material),this.bindMaterialId(t.materialId,!0)),t}getDiff(e){const t={};return e.map((e=>{e.traverse((e=>{var n;!1!==(null==e?void 0:e.isSnapshot)&&(n=(0,E.Ki)(e))&&(e.snapshot?t[n]=e.snapshot.get():t[n]=this.getItem(e))}))})),t}getData(){}}t=n(4961);var j=n(8376);class z extends t.Z{process(e){e=(0,E.Ki)(e);const t=this.runScene.uniqueEx.geometry.getModelsById(e),n={};t.map((e=>{if(e.material){var t=(0,E.Ki)(e.material);let r=n[t];r||(n[t]=r={material:e.material,models:[],instanceModel:this.runScene.uniqueEx.geometry.getInstanceModel(e)}),r.models.push(e)}})),(0,r.mapObj)(n,((e,t)=>{const n=t.models;t=t.instanceModel||new j.Z({models:n,runScene:this.runScene}),n.map((e=>{var t=e.parent;this.parent.remove(e),this.parent.add(e.userData.helper,t)})),this.parent.add(t)}))}setMaterial(e){var{target:e,material:t}=e;const n=this.runScene.uniqueEx.geometry.map.get((0,E.Ki)(e.instanceModel.geometry));if(n){var r=(0,E.Ki)(t);n.materialInstanceModelMap||(n.materialInstanceModelMap={});let i=n.materialInstanceModelMap[r];i||(i={instanceModel:new j.Z({models:[e],runScene:this.runScene,toHelper:!1,baseModel:e.instanceModel,baseMaterial:t})},n.materialInstanceModelMap[r]=i,this.parent.add(i.instanceModel)),i.instanceModel.addFromOther(e)}}}var V=n(3801);const H=["material","visible","v3"];class W{constructor(e){this._selectModel=void 0,this.geometryMap=new c.Z,this.clonedMap=new c.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.keyDown=e=>{e=e.key;var t=this.getSelectedModels()[0];if(t)switch(e){case"arrowup":var n=t.parent;if(!n||!n.parent)break;this.setSelectByModel(n);break;case"arrowdown":if(!(n=t.children[0]))break;this.setSelectByModel(n);break;case"arrowright":if(-1===(n=this.getIndexByModel(t)))break;if(!(n=t.parent.children[n-1]))break;this.setSelectByModel(n);break;case"arrowleft":if(-1===(n=this.getIndexByModel(t)))break;if(!(n=t.parent.children[n+1]))break;this.setSelectByModel(n)}},this.onInited=()=>{const e=(e,t)=>{(0,r.mapObj)(e,((e,n)=>{t.map((t=>{"visible"===e?this.runScene.modelEx.setNormal({model:t,info:"visible",val:"auto"===n?!t.visible:n},!1):"glow"===e?this.runScene.modelEx.setGlow(t,"auto"===n?!oe(t):n):"outline"===e&&this.runScene.modelEx.setOutline(t,"auto"===n?!(0,v.S)(t):n)}))}))};this.runScene.cb.events.model.addOptions.cb({name:"setModel",map:{parse:t=>Promise.all(t.childs.map((t=>{e(t.data,this.runScene.modelEx.getById(t.modelIds))})))}})},this.onAdd=e=>{null!=e&&e.traverse((e=>{var t;return null==(t=e.onAdd)?void 0:t.call(e)}))},this.onDelete=e=>{null!=e&&e.traverse((e=>{var t;return null==(t=e.onDelete)?void 0:t.call(e)}))},this.onUniqueModelAdd=e=>{e=e.model;var{material:t,geometry:n}=e;if(t&&n&&(0,m.isMultiMaterial)(t)&&n.groups&&0!==n.groups.length){let a=!1;if(!a)for(const e of n.groups){var i=e.materialIndex;if(!t[i]){a=!0;break}}a&&(this.runScene.optionsEx.log(e.name+"模型出现错误,顶点需要的材质少于当前有的材质","base","error"),this.runScene.msg.add({tipType:"danger",type:"model",id:(0,r.getId)(),data:[{subType:"lessMaterial",id:(0,E.Ki)(e),ids:[(0,E.Ki)(e)]}]}))}},this.clean=()=>{this.reset()},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,n,r)=>{var{addUndo:i,isClone:a,select:s,addToTree:o,isScene:l}=(0,D.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0,isScene:!1},r);let c=n;if(c){var d=this.runScene.cb.model.validAddAndReplaceParent.cb({model:u.F6.toArr(t),parent:n}).pop();d&&(c=d)}return t instanceof Array?t.map((e=>this.add(e,n,Object.assign(Object.assign({},r),{isScene:!1})))):(e(t,a),this.setGeometryMap(t),this.setCloneMap(t),d=new b.Z({model:t,parent:c||this.runScene.sceneEx.get(),isClone:a,addTree:o,runScene:this.runScene,isScene:void 0!==l&&l}).execute(),!0===i&&this.runScene.undoEx.addUndo(d),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:a}),d)}})(),this.selectAble=!0,this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.parseUnStandard=e=>{const t=[];e.map((e=>{const n=this.getModel(e);n&&t.push((()=>function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var e=this.runScene.exporter.obj.model(n);(e=yield this.runScene.fileEx.obj(e))&&([e]=e.result,e&&(n.geometry=e.geometry))}))))})),(0,r.eachTriggerArray)(t)},this.setClonedModels=(e,t)=>{const n=e.geometry;if(n){const r=[],a=this.getTruthPosition(e);t.map((t=>{if(t.geometry&&(0,E.Ki)(t)!==(0,E.Ki)(e)&&e.geometry.uuid!==t.geometry.uuid){var s=this.getTruthPosition(t);r.push(new w.Z({target:t,info:"geometry",newVal:n,runScene:this.runScene,oldVal:t.geometry,cb(n,r){"redo"===r?xe(e,t):delete t.userData.cloneId}}).execute());const o=new i.Vector3;o.subVectors(s,a),r.push(new M.Z({target:t,info:"position",newV3:o,runScene:this.runScene,oldV3:t.position.clone()}).execute())}})),this.runScene.undoEx.addUndo(r)}},this.modelInfo=[],this.runScene=e,this.clone=(e=>(t,n=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var r,i,a,s=te(t),o=Se(t),[l]=u.F6.filter(e.cb.model.bindCloneModel.cb({model:t})),l=(s=s?function(e){var t=new Map,n=new Map,r=e.clone();return function e(t,n,r){r(t,n);for(var i=0;i<t.children.length;i++)e(t.children[i],n.children[i],r)}(e,r,(function(e,r){t.set(r,e),n.set(e,r)})),r.traverse((function(e){var r,i;e.isSkinnedMesh&&(i=(r=t.get(e)).skeleton.bones,e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=i.map((function(e){return n.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),r}(t):l||t.clone(),xe(t,s),(0,y.is)(t,"isDynamic")&&ne(s,!0),(0,D.getModelMap)(s,"id"));return r=s,(a=null==t?void 0:t.material)&&((0,m.isMultiMaterial)(a)?r.material=[...a]:(i=f.ZP.clone((0,f.ee)(a),a))&&i.uuid!==a.uuid&&(e.materialEx.resetMaterial(r,i,{addUndo:!0}),e.materialEx.add(i,t,a))),Te(e,{newModel:s,newModelMap:l,animaMap:o}),(0,E.x)(s),n&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new P(e),this.importAndExport=new N(e),this.snapsot=new F(e),this.def=new C.Z(e),this.camFlow=new I(e),this.instance=new z(e,this),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()})),e.cb.unique.model.add.add("model-ex",this.onUniqueModelAdd),e.cb.inited.add("model-ex",this.onInited),this.bindEvent(),e.cb.events.key.down.add("model-ex",this.keyDown)}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}bindEvent(){this.runScene.cb.model.setChange.add("model",(e=>{const{type:t,val:n,model:r,set:i,addUndo:a,undos:s}=e;return e=u.F6.toArr(r).map((e=>{var r=e[t];return new w.Z({runScene:this.runScene,target:e,info:t,newVal:n,oldVal:r,executeCb:i}).execute()})),s&&s.push(...e),!1!==a&&this.runScene.undoEx.addUndo(e),e})),this.runScene.cb.model.change.on((e=>{this.setInfo({type:e.type,data:e.val,model:e.model})}))}set(e,t,n){this[t]=n,this.runScene.cb.model.change.cb({model:e,type:t,val:n})}init(){var e={name:"node",loadCallBacks:this.importAndExport.getMap(),exportCallBacks:new c.Z};this.runScene.exporter.gltf.module.bind(e),this.runScene.cb.unique.model.add.add("model",(({model:e})=>{(0,v.S)(e)&&this.setOutline(e,!0)}))}getSelectedModels(){return[this.select,...this.runScene.multipSelector.getSelectedList("value")].filter((e=>e))}setGeometryMap(e){if((0,D.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,E.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:n,uv:r}=e.attributes,{normal:t,position:i,uv:a}=t.attributes;return e.array.length===t.array.length&&n.array.length===i.array.length&&r.array.length===a.array.length&&(e=(0,D.sameArr)([...e.array],[...t.array],20),t=(0,D.sameArr)([...n.array],[...i.array],20),n=(0,D.sameArr)([...r.array],[...a.array],20),e&&t&&n)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[n,r]=e;if(0!==r.size){var t=r.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return n}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,D.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=ie(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new d.Z),this.clonedMap.get(t).add((0,E.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,E.Ki)(e))}replaceClonedGroup(e,t){t=ie(t)||(0,E.Ki)(t);const n=this.clonedMap.get(t);n&&0!==n.size&&(e.userData.id=t,n.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:n,rotation:r,scale:i,name:a,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,E.Ki)(t),o.position.copy(n),o.rotation.copy(r),o.scale.copy(i),o.name=a,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const n=this.geometryMap.get(t);n&&0!==n.size&&(n.forEach((t=>{const n=this.runScene.uniqueEx.model.get(t);n&&(n.geometry=e,n.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,n))}setSelectAble(e){this.selectAble=e}setSelectByModel(e,t){var n;if(this.selectAble&&e){this.runScene.optionsEx.log({model:e,userData:e.userData,material:e.material,textures:e.material?f.ZP.getTextures(e.material):{}},"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)return r=this.select,this.runScene.modelEx.selectNull(),r&&this.runScene.multipSelector.add(r),this.runScene.multipSelector.add(e),void(null!=(r=e.onSelect)&&r.call(e));if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),null!=(n=(r=this._selectModel).onUnSelect)&&n.call(r),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(null!=(n=e.onSelect)&&n.call(e),this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let n=(0,l.toArr)(e);return this.selectNull(),e=n.map((e=>new T.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e),e}isNavieV3(e,t){var{x:e,y:n,z:r}=e;return e===(t=t?1:0)&&n===t&&r===t}isNavieV2(e,t=0){var{x:e,y:n}=e;return e===t&&n===t}isUnless(e){return!e.userData.normal&&!e.material&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!Y(e)}isUnlessLevel(e){return!e.geometry&&this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!Y(e)}create(e="Box"){return e=(0,D.getModelByType)(e),f.ZP.parseNode(e),e}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))).filter((e=>e)):this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e,t;this.selectAble&&((t=this._selectModel)&&(this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(t),null!=(e=t.onUnSelect)&&e.call(t)),this.runScene.cb.model.unFocus.cb(t),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus())}cloneV3(e){return e.clone()}setParent(e,t,n=!0){if(t=new _({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!n)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:n,newV3:r}=e;if(Array.isArray(t))return t.map((e=>{e[n].set(r.x,r.y,r.z),e.updateMatrix()}));this.setInfo({model:t,type:"v3",data:r}),t[n].set(r.x,r.y,r.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3s(e,t=!0,n=!0){let{model:r,info:i,newV3:a,oldV3:s}=e;if((0,D.isRunning)(this.runScene))return r.map(((e,t)=>{t=a[t],e[i].set(t.x,t.y,t.z),e.updateMatrix()}));e=r.map(((e,t)=>{var o=a[t];return t=s[t],new M.Z({target:e,info:i,runScene:this.runScene,oldV3:t,newV3:o,cb:()=>{this.setInfo({model:r,type:"v3",data:a})}}).execute(n)})),t&&this.runScene.undoEx.addUndo(e)}setV3(e,t=!0,n=!0){let{model:r,info:a,newV3:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:d,y:l,z:c}=s),s=new i.Vector3(d,l,c)),(0,D.isRunning)(this.runScene))return this._setV3(e);var d=u.F6.toArr(r).map((e=>new M.Z({target:e,info:a,oldV3:o||e[a].clone(),newV3:s,runScene:this.runScene,cb:()=>{this.setInfo({model:e,type:"v3",data:s})}}).execute(n)));return t&&this.runScene.undoEx.addUndo(d),d}setNormal(e,t=!0){const{model:n,oldVal:r,info:i,val:a,executeCb:s}=e,o=u.F6.toArr(n);if(0!==o.length){const n=new d.Z;return o.map((e=>{"castShadow"!==i&&"receiveShadow"!==i||"group"===be(e)&&e.traverse((e=>{"group"!==be(e)&&n.add(e)})),n.add(e)})),e=n.map((e=>new w.Z({target:e,info:i,runScene:this.runScene,oldVal:r||e[i],newVal:a,executeCb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}}setMaterial(e,t,n=!0){var r=new w.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t,cb(e,t,n,r){var i;null!=(i=null==e?void 0:e.onSetInfo)&&i.call(e,"material",n)}}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,n&&this.runScene.undoEx.addUndo(r)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!((0,p.RQ)(e)||(0,s.N)(s.N))}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t.uuid===e.uuid)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var n=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==n&&-1!==t){const r=Math.max(n,t),i=n===r?t:n;return e.parent.children.map(((e,t)=>t>i&&t<r&&e)).filter((e=>e))}}}setMultip(e){const{model:t,typeList:n,newVal:r,cb:i}=e;this.runScene.undoEx.addUndo(new x.Z({target:t,typeList:n,newVal:r,cb(e,t){null!=i&&i(t)}}).execute())}createGroup(e,t,n){const r=t||new i.Group,a=[],s=(a.push(new b.Z({model:r,runScene:this.runScene,parent:n||this.runScene.assetsEx.get().scene}).execute()),u.F6.toArr(e)),o=(0,D.getGroupCenter)(r,s);o&&(a.push(...this.setV3({model:r,info:"position",newV3:o.clone()},!1,!0)),s.map((e=>{a.push(new _({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute())})),n&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:r}),this.runScene.undoEx.addUndo(a),this.selectNull(),this.setSelectByModel(r))}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,r.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const n=[],r=e.children.map((e=>{if(e.parent.parent)return new _({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return n.push(...r.map((e=>e.execute()))),n.push(new T.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(n),n}}hideOther(e){const t=e.uuid,n=0<e.children.length,r=this.runScene.sceneEx.getClearModels(),i=[];r.map((r=>{r.traverse((r=>{n?!1===(0,D.deepFindParentByUuid)(r,t)&&r.uuid!==e.uuid&&i.push(r):r.uuid!==e.uuid&&i.push(r)}))}));var a=i.map((e=>new w.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(a),(0,D.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var n=t.map((e=>new w.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(n)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,n=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{n.push(new T.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(n)}_getModel(e){if(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new i.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,n=!1){let r=new i.Raycaster,a=new i.Vector2,s=(a.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,a.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,r.setFromCamera(a,this.runScene.assetsEx.camera),r.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(n){if(0===(e=s.filter((e=>(0,D.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:n}=this.runScene.assetsEx.camera.position,{x:r,y:i,z:a}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}}camAnima(e,t,n=1,r,i){return(0,D.anima)(e,t,n,(e=>{i&&i(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{r&&r()}))}setGlow(e,t=!0){t=t?1:0,e.userData.layers!==t&&(0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.ltPP.setModel({model:e,type:"SelectiveBloom",state:1==t}),this.runScene.cb.model.setLayers.cb({model:e,val:t}))}getPpState(e,t){if("SelectiveBloom"===e)return 1===t.userData.layers||this.runScene.ltPP.hasModel({model:t,type:e})}setOutline(e,t=!0){u.F6.toArr(e).map((e=>{e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}))}getBoxHelper(e){return this._boxHelper||(this._boxHelper=new i.BoxHelper(e))}focus(e,t){const{scene:n,camera:r,renderer:a,controls:s,inputBoxHelper:o}=Object.assign(Object.assign({},this.runScene.assetsEx.get()),t),l=new i.Vector3,u=new i.Vector3;if(void 0!==e.element||"Mesh"!==e.type&&"Group"!==e.type&&"Object3D"!==e.type){n.updateMatrixWorld(!0),t=new i.Vector3,e.getWorldPosition(t),u.set(t.x,t.y,t.z);let a=new i.Vector3;a.subVectors(r.position,u),a.normalize(),l.addVectors(u,a.multiplyScalar(3))}else{let n=o||("editor"===(0,g.F)(this.runScene).mode?this.runScene.helperEx.boxHelper:this.getBoxHelper(e));n.setFromObject(e),n.update();let s=(t=a.domElement.getBoundingClientRect()).width/t.height;const c=new i.Vector3;e=n.geometry.attributes.position.array,c.set(Math.abs(e[0]-e[3]),Math.abs(e[1]-e[7]),Math.abs(e[2]-e[14])),u.x=.5*(e[0]+e[3]),u.y=.5*(e[1]+e[7]),u.z=.5*(e[2]+e[14]);let d=new i.Vector3;d.subVectors(r.position,u),d.normalize(),1<s&&(s=1/s),t=c.length()/s,l.addVectors(u,d.multiplyScalar(t))}(0,D.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:s.target.x,targetY:s.target.y,targetZ:s.target.z},{positionX:l.x,positionY:l.y,positionZ:l.z,targetX:u.x,targetY:u.y,targetZ:u.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),s.target.set(e.targetX,e.targetY,e.targetZ),s.update(),this.runScene.cb.setUpdate.cb({state:!0,mode:"scene"})}))}instanceModel(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},n=Array.isArray(e)?e:[e],i=[];n.map((e=>{e.traverse((e=>{var n;e.geometry&&!re(e)&&(n=ie(e))&&(i.push(e),t[n]||(t[n]=new Set),t[n].add(e))}))})),(0,r.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||((t=q(e,[...t]))?(this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),oe(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1)):this.runScene.optionsEx.log("合并实例时包含不支持的模型:"+e.name))})),i.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){this.setSelectAble(!0);const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{Z(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,n){const{getOriginData:r,ignoreMove:a}=(0,D.mergeObject)({ignoreMove:!1,getOriginData:!1},n);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(n=>{if(a||!this.runScene.events.mouse.isMove){const a=new i.Raycaster,c=new i.Vector2,{engineDom:d,camera:h}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:u}=d.getBoundingClientRect(),o=n.pageX-o;n=n.pageY-s,c.x=o/l*2-1,c.y=-n/u*2+1,a.setFromCamera(c,h);const p=a.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:r?p:p.map((e=>e.object)))}}))}getSize(e){this.sizeBox||(this.sizeBox=new i.Box3),this.sizeBox.setFromObject(e);var{x:e,y:t,z:n}=this.sizeBox.getSize(new i.Vector3);return{x:e,y:t,z:n}}reCenter(e){const t=new h.Z.Vector3,n=new h.Z.Box3;n.setFromObject(e),n.getCenter(t),e.traverse((e=>{if(e instanceof h.Z.Mesh){const r=e.geometry;r.computeBoundingBox();var n=new h.Z.Vector3;r.boundingBox.getCenter(n);const i=r.vertices||r.attributes.position.array;for(let e=0;e<i.length;e++)i[e].sub(n).add(t);r.vertices?r.verticesNeedUpdate=!0:r.attributes.position.needsUpdate=!0}}))}getTruthPosition(e){const t=this.runScene.helperEx.boxHelper;if(this.runScene.helperEx.boxHelper.setFromObject(e),t.update(),t&&t.object){const n=new i.Vector3;e=t.geometry.attributes.position.array,n.set(Math.abs(e[0]-e[3]),Math.abs(e[1]-e[7]),Math.abs(e[2]-e[14]));const r=new i.Vector3;return r.x=.5*(e[0]+e[3]),r.y=.5*(e[1]+e[7]),r.z=.5*(e[2]+e[14]),r}}delBack(e){u.F6.toArr(e).map((e=>{e.traverse((e=>{var t,n=e.name;if(-1!==(t=e.name.lastIndexOf("_"))){var r=e.name.slice(0,t);const i=e.name.slice(t);var[,t]=i.split("_");isNaN(Number(t))||(e.name=r,this.runScene.uniqueEx.model.parseName(e),this.runScene.cb.model.changeName.cb({model:e,oldName:n,name:e.name}))}}))}))}updateV3(){this.runScene.helperEx.boxHelper.update(),this.runScene.multipSelector.updateBoxHelper()}instanceModels(e,t){this.runScene.assetsEx.scene.updateMatrixWorld();var n=e[0],r=q(n,[...e.slice(1,-1)]);r?(this.runScene.modelEx.add(r,t,{isClone:!1,select:!1,addUndo:!1}),oe(n)&&this.runScene.modelEx.setGlow(r,!0),e.map((e=>this.runScene.modelEx.remove(e,!1)))):this.runScene.optionsEx.log("合并实例时包含不支持的模型:"+n.name)}setGeometry(e){const{models:t,geometry:n,addUndo:r,undos:i}=e;0!==u.F6.toArr(t).length&&this.runScene.cb.model.setChange.cb({model:t,type:"geometry",val:n,undos:i,addUndo:r,set:e=>{const{val:n,target:r}=e;this.runScene.uniqueEx.geometry.replaceForModel({models:r,geometry:n}),this.runScene.cb.model.onChange.cb({model:t,type:"geometry",val:r.geometry}),r.geometry=n,this.runScene.cb.model.onChange.cb({model:t,type:"geometry",val:n})}})}setGroupCenter(e){var t=(0,D.getGroupCenter)(e);if(t){const n=[...e.children];n.map((t=>{e.remove(t)})),e.position.copy(t),n.map((t=>{this.setParent(t,e,!1)}))}}setCenter(e=this.select,t){if(e){if(e.geometry){var n=new i.Mesh(e.geometry);const r=this.getCenter(n);if(e.geometry.center(),!1!==(null==t?void 0:t.includeChild)&&e.children.map((e=>{e.geometry&&this.setCenter(e,{isChild:!0})})),n=this.getCenter(n),(0,D.isSameV3)(r,n))return;if(null!=t&&t.isChild)return;((null==t?void 0:t.sameGeoModels)||this.runScene.uniqueEx.geometry.getModelsById((0,E.Ki)(e.geometry))).map((e=>{var t=(0,D.addV3)(r,e.position);this.setV3({model:e,info:"position",newV3:new i.Vector3(t.x,t.y,t.z),oldV3:e.position},!1)}))}else this.setGroupCenter(e);this.runScene.cb.setUpdate.cb({state:!0,mode:"scene"})}}getCenter(e=this.select){if(e){const t=new i.Vector3,n=this.getBoxHelper(e);return n.setFromObject(e),e=n.geometry.attributes.position.array,t.x=.5*(e[0]+e[3]),t.y=.5*(e[1]+e[7]),t.z=.5*(e[2]+e[14]),t}}onDraging(e){this.runScene.events.mouse.isMove}setInfo(e){H.includes(e.type)&&this.runScene.cb.model.onSetInfo.cb(e)}getChildren(e){const{model:t,isGroup:n}=e,r=[];return u.F6.toArr(t).map((e=>{e.children.map((e=>{!0===n&&ue(e),r.push(e)}))})),r}}const G=e=>{},K=e=>{if(o.c6.includes(e))return e=(0,D.getModelByType)(e),f.ZP.parseNode(e),e;throw TypeError("")},Z=(e,t)=>{t=(t||{}).remove;const{geometry:n,material:r}=e;n&&(null!=n&&n.dispose(),delete e.geometry),r&&((0,m.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},q=(e,t)=>{if(Me(e)){var{material:n,geometry:r}=e;const i=new h.Z.InstancedMesh(r,n,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.instanceMatrix.needsUpdate=!0,i.computeBoundingSphere(),i.computeBoundingBox(),i.updateMorphTargets(),i.name=e.name,i}},X=(e,t)=>{const n=[];if(t.map((e=>{e=e.geometry,n.push(e)})),t=a.mergeBufferGeometries(n))return new h.Z.Mesh(t,e)},Y=e=>0!==e.animations.length,Q=e=>{e&&e.userData&&(e.userData.isHelper=!0)},J=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,$=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,y.M)(e,"layers",t))},ee=e=>{const t=[];e.traverse((e=>{t.push(e)}))},te=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},ne=(e,t)=>{t?(0,y.M)(e,"isDynamic",!0):delete e.userData.isDynamic},re=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&re(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,ie=e=>e.userData.cloneId,ae=(e,t)=>{(0,y.M)(e,"cloneId",t)},se=e=>{delete e.userData.cloneId},oe=e=>1===e.userData.layers,le=e=>e.isSprite,ue=e=>"Object3D"===e.type||"Group"===e.type,ce=e=>{var t=new i.Vector3;return(new i.Box3).setFromObject(e).getSize(t),t},de={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},he={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},pe={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e,t=!0){t?e.userData.isHelper=!0:delete e.userData.isHelper}},fe={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},me=(e,t)=>{let n=[];Array.isArray(e)?n.push(...e):n.push(e);const r={};return n.map((e=>e.traverse((e=>{null!=t&&t(e),r[(0,E.Ki)(e)]=e})))),r},ge={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}},ve={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.closeEvent),set(e,t){t?e.userData.closeEvent=t:delete e.userData.closeEvent}},ye=()=>{var e=new i.MeshBasicMaterial,t=new i.SphereGeometry(.7,300,300);return new i.Mesh(t,e)},be=e=>(0,s.N)(e)?"camera":(0,p.RQ)(e)?"light":J(e)||e.userData.isLightTarget?"helper":"Mesh"===e.type?"mesh":"Line"===e.type?"line":"Sprite"===e.type?"sprite":"Group"===e.type||"Object3D"===e.type?"group":void 0,xe=(e,t)=>{(0,y.M)(t,"cloneId",ie(e)||e.userData.id)},we=e=>!(0,s.N)(e)&&!(0,p.RQ)(e),Se=e=>{const t={};return _e(e,"id",(e=>{0<e.animations.length&&(t[(0,E.Ki)(e)]=e.animations)})),t},_e=(e,t="name",n)=>{const r={};return e.traverse((e=>{"id"===t?r[e.userData.id]=e:r[e[t]]=e,null!=n&&n(e)})),r},Te=(e,t)=>{const{animaMap:n,newModelMap:i}=t;(0,r.mapObj)(n,((t,n)=>{const a=i[t],s={};a&&(a.animations=[...n.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,r.mapObj)(s,((t,n)=>{var i=a.getObjectByName(t);if(i){(0,y.M)(i,"id",(0,r.getId)());const a=e.uniqueEx.model.parseName(i);n.map((e=>{e.name=a+e.name.slice(t.length)}))}})))}))},Me=e=>"TreeLeaf"!==f.ZP.getTypeByMaterial(e.material),Ee=(e,t)=>{t(e),(e=e.parent)&&(t(e),Ee(e,t))}},3447:(e,t,n)=>{n.d(t,{Z:()=>v});var r=n(5521),i=n(3924),a=n(2233),s=n(6001),o=n(135);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t,n){t=c(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))&&("object"===l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}class h extends(function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=this,a=n;if(!(i instanceof a))throw new TypeError("Cannot call a class as a function");return i=[e.isCubeTexture?"#define ENVMAP_TYPE_CUBE":""].join("\n")+"\n\n\t\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\t\tuniform float radius;\n\t\t\t\tuniform float height;\n\t\t\t\tuniform float angle;\n\n\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\tuniform samplerCube map;\n\n\t\t\t\t#else\n\n\t\t\t\t\tuniform sampler2D map;\n\n\t\t\t\t#endif\n\n\t\t\t\t// From: https://www.shadertoy.com/view/4tsBD7\n\t\t\t\tfloat diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) \n\t\t\t\t{\n\n\t\t\t\t\tfloat d = dot ( rd, n );\n\n\t\t\t\t\tif( d > 0.0 ) { return 1e6; }\n\n\t\t\t\t\tvec3 o = ro - c;\n\t\t\t\t\tfloat t = - dot( n, o ) / d;\n\t\t\t\t\tvec3 q = o + rd * t;\n\n\t\t\t\t\treturn ( dot( q, q ) < r * r ) ? t : 1e6;\n\n\t\t\t\t}\n\n\t\t\t\t// From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm\n\t\t\t\tfloat sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) {\n\n\t\t\t\t\tvec3 oc = ro - ce;\n\t\t\t\t\tfloat b = dot( oc, rd );\n\t\t\t\t\tfloat c = dot( oc, oc ) - ra * ra;\n\t\t\t\t\tfloat h = b * b - c;\n\n\t\t\t\t\tif( h < 0.0 ) { return -1.0; }\n\n\t\t\t\t\th = sqrt( h );\n\n\t\t\t\t\treturn - b + h;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 project() {\n\n\t\t\t\t\tvec3 p = normalize( vWorldPosition );\n\t\t\t\t\tvec3 camPos = cameraPosition;\n\t\t\t\t\tcamPos.y -= height;\n\n\t\t\t\t\tfloat intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );\n\t\t\t\t\tif( intersection > 0.0 ) {\n\n\t\t\t\t\t\tvec3 h = vec3( 0.0, - height, 0.0 );\n\t\t\t\t\t\tfloat intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );\n\t\t\t\t\t\tp = ( camPos + min( intersection, intersection2 ) * p ) / radius;\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tp = vec3( 0.0, 1.0, 0.0 );\n\n\t\t\t\t\t}\n\n\t\t\t\t\treturn p;\n\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 projectedWorldPosition = project();\n\n\t\t\t\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\t\t\t\tvec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tvec3 direction = normalize( projectedWorldPosition );\n\t\t\t\t\t\tvec2 uv = equirectUv( direction );\n\t\t\t\t\t\tvec3 outcolor = texture2D( map, uv ).rgb;\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\tgl_FragColor = vec4( outcolor, 1.0 );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <encodings_fragment>\n\n\t\t\t\t}\n\t\t\t\t",a={map:{value:e},height:{value:t.height||15},radius:{value:t.radius||100}},u(this,n,[new r.IcosahedronGeometry(1,16),new r.ShaderMaterial({uniforms:a,fragmentShader:i,vertexShader:"\n\t\t\tvarying vec3 vWorldPosition;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );\n\t\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t}\n\t\t\t",side:r.DoubleSide})])}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e),t=n,(e=[{key:"radius",get:function(){return this.material.uniforms.radius.value},set:function(e){this.material.uniforms.radius.value=e}},{key:"height",get:function(){return this.material.uniforms.height.value},set:function(e){this.material.uniforms.height.value=e}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(r.Mesh)){clone(){var e=this.material.uniforms.map.value;const t=new h(e);return t.name=this.name,t.visible=this.visible,t.position.copy(this.position),t.rotation.copy(this.rotation),t.scale.copy(this.scale),t.material.uniforms.height.value=this.material.uniforms.height.value,t.material.uniforms.radius.value=this.material.uniforms.radius.value,t.userData=Object.assign(Object.assign({},this.userData),{id:(0,s.getId)()}),t.material.userData=Object.assign(Object.assign({},this.material.userData),{id:(0,s.getId)()}),t}}var p,f=n(3735),m=n(960),g=n(9151);class v{constructor(e){this.inited=()=>{this.runScene.modelEx.importAndExport.addParses(v.type,{toNormal:e=>this.process(e),parse:e=>{var{model:e,normal:t}=e;const n=this.create();var r=e.userData.layers;return(0,i.setLayers)(n,r),n.userData=Object.assign(Object.assign({},t),n.userData),n.name=e.name,n.visible=e.visible,n.position.copy(e.position),n.rotation.copy(e.rotation),n.scale.copy(e.scale),n.material=e.material,n}})},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:v.type},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.material=e.material,t.scale.copy(e.scale),t},this.runScene=e,this.runScene.cb.inited.add(v.type,this.inited)}setTexture(e,t){this.runScene.materialEx.setTexture({material:e.material,type:"map",newVal:t}),e.material.uniforms.map.value=t}is(e){return(null==(e=e.userData.normal)?void 0:e.type)===v.type}create(){var e=new r.Texture;g.helperTexture.set(e,!0);const t=new h(e);return t.userData.normal={type:v.type},t.scale.set(100,100,100),t.name="地面投影天空球",(0,a.x)(t,(0,s.getId)()),v.tools.bind(t.material),t}}(p=v).type="group-projected",v.tools={type:"group-projected-material",create:e=>e.modelEx.def.create("GroundProjected").material,parseData:(e,t)=>{const{texture:n,normal:r,core:i,material:a}=e;var{height:e,radius:s}=r;const o=p.tools.create(t),{data:l,load:u}=(o.userData.id=a.userData.id,o.uniforms.height.value=e,o.uniforms.radius.value=s,n),c=[];return u&&c.push(...m.F6.filter(l.map((e=>{const t=e.texture;if(t)return()=>{i.runScene.materialEx.setTexture({material:o,type:"map",newVal:t},!1)}})))),{material:o,setTextureFns:c}},toNormal:e=>{var t=e.uniforms.map.value;const n=(0,o.createDefMaterial)(),r=(t&&(n.map=t),n.userData=Object.assign({},e.userData),[]);return t&&r.push({type:"map",texture:t}),{material:n,normal:{type:p.tools.type,height:e.uniforms.height.value,radius:e.uniforms.radius.value},textures:r}},clone:e=>e,copy:e=>e.clone(),getTextures:e=>[{type:"map",texture:e.uniforms.map.value}],bind:e=>{e.userData={type:p.tools.type,normal:{type:p.tools.type},id:(0,s.getId)()}},setTexture:e=>{const{material:t,texture:n}=e;return e=new f.Z({target:t,typeList:["uniforms","map","value"],newVal:n}).execute(),n&&(n.mapping=303,n.needsUpdate=!0),t.needsUpdate=!0,e},getTexture:e=>e.material.uniforms.map.value,textureNames:[{type:"map"}]}},7474:(e,t,n)=>{n.d(t,{Z:()=>h});var r=n(1398),i=n(2233),a=n(6272),s=n(9663),o=n(3924),l=n(8376);class u extends n(5521).Mesh{constructor(e){var{geometry:e,material:t,runScene:n}=e;super(e,t),this.isModelBase=!0,this.isDeletable=!0,this.changeParentable=!0,this.changeMatrixable=!0,this.isSnapshot=!0,this.runScene=n}}var c=n(1292);const d={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po",onAnimaUpdate:e=>{}},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro",onAnimaUpdate:e=>{}},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl",onAnimaUpdate:e=>{}}};class h extends u{constructor(e,t){var n=t.runScene,{geometry:i,material:s}=e,{instanceModel:s,index:n}=(super({geometry:i,material:s,runScene:n}),this.isModelBase=!0,this.isSnapshot=!0,this.catchChange={},this.clickable=!0,this.type="instanceHelper",this.snapshot=new c.Z({get:()=>{const e=r.LV.getDiff(d,this);return this.isDeleted&&(e.del=1),this.isHide&&(e.hide=1),e},set:e=>{(0,a.Ft)(e.del)||this.isDeleted||this.onDelete(),this.isHide=!!e.isHide,this.update()},config:d,model:this}),this.isDeleted=!1,this.isHide=!1,this.helperGeometry=i,t);this.instanceModel=s,this.index=n,this.copy(e),this.addEventListener("added",(()=>{this.onDraging()})),this.setChange((()=>{this.updateMatrix()}))}isHelper(){return!1}isNormal(){return!0}click(){if(!o.lockModel.isLock(this,!0)&&!this.isHide&&this.instanceModel.visible)return this.instanceModel.onChildClick(this.index),this.visible=!0,this}onAdd(){(this.isDeleted=!1,s.pn)(this,{ignoreSelf:!0})||(this.isHide=!0,this.visible=!1,this.update()),this.instanceModel.onHelperAdd({index:this.index,model:this})}onDelete(){this.isDeleted=!0,this.instanceModel.onHelperDelete({index:this.index,model:this})}setGeometry(e){this.geometry=e?this.instanceModel.geometry:this.instanceModel.defGeometry}onSelect(){!this.isHide&&this.instanceModel.visible&&(this.visible=!0,this.setGeometry(!0))}onUnSelect(){this.visible=!1,this.setGeometry(!1),this.update()}onDraging(e){this.instanceModel.onDraging({model:this,index:this.index,isDelay:null==e?void 0:e.isDelay})}onDragChanged(){}process(e){throw new Error("Method not implemented.")}create(){throw new Error("Method not implemented.")}is(e){return e.userData.type===this.type}to(e,t){e.userData.type=this.type,e.userData.v=1}clone(e){var t=this.instanceModel.getLength();const n=new h(this,{instanceModel:this.instanceModel,index:t,runScene:this.runScene});return n.isHide=this.isHide,n.visible=!1,this.runScene.isExporter||this.instanceModel.addHelper({model:n,index:t}),n}onSetInfo(e,t){"visible"===e?this.isHide=!t:"material"===e&&this.setMaterial(t),this.instanceModel.setHelperInfo({model:this,index:this.index,type:e,data:t})}toNromal(e){return this.geometry=this.instanceModel.geometry,this.to(this,{}),this.userData.name=this.name,this.visible=!this.isHide,{model:this}}static process(e){const{runScene:t,model:n,info:r}=e;let a=t.uniqueEx.geometry.get((0,i.Ki)(n.geometry)),s=(a=a||t.uniqueEx.geometry.onModelAdd({model:n})).materialInstanceModelMap;const o=[];s||(a.materialInstanceModelMap=s={});var u=(0,i.Ki)(n.material);let c=s[u];c||(s[u]=c={instanceModel:new l.Z({models:[n],toHelper:!1,runScene:e.runScene})});const d=c.instanceModel;u=c.instanceModel.getLength();const p=new h(n,{instanceModel:d,index:u,runScene:t});return 1===r.v&&(p.isHide=!n.visible),p.visible=!1,d.addHelper({index:u,model:p},!0),d.onHelperDelete({index:u,model:p,isLoad:!0}),o.push(p),c.isAwaitAdd||(c.isAwaitAdd=!0,o.push(d)),o}isShow(){return!this.isHide}updateMatrixWorld(e,t){e&&(super.updateMatrixWorld(e,t),this.update())}updateMatrix(){super.updateMatrix(),this.update(),this.matrixAutoUpdate=!1}applyMatrix4(e){const t=this.matrix.clone();t.premultiply(e),t.decompose(this.position,this.quaternion,this.scale),this.matrix.copy(t),this.updateMatrix()}update(){this.updateWorldMatrix(!1,!1),this.instanceModel.matrixAutoUpdate=!0,this.instanceModel.matrixWorldNeedsUpdate=!0;var e=this.isHide||this.isDeleted;this.instanceModel.setMatrixForHelper(this,!e),this.instanceModel.instanceMatrix.needsUpdate=!0}setMaterial(e){this.runScene.modelEx.instance.setMaterial({material:e,target:this})}getIsBeDisplayedFormModel(e){return!this.isHide&&!this.isDeleted&&(0,i.Ki)(this.material)===(0,i.Ki)(e.material)}}h.needsUpdate=[]},8376:(e,t,n)=>{n.d(t,{Z:()=>y});var r=n(6001),i=n(5521),a=n(960),s=n(1794),o=n(272),l=n(5124),u=n(1398),c=n(2233),d=n(3924),h=n(7474),p=n(1292);const f=new i.Matrix4,m=new i.Box3,g=new i.Sphere,v={visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class y extends i.InstancedMesh{constructor(e){const{models:t,toHelper:n,runScene:a,baseModel:c,baseMaterial:d}=e;e=c||t[0];var{material:f,geometry:m}=e;super(m,d||f,0),this.isModelBase=!0,this.isDeletable=!1,this.type="instanceModel",this.clickable=!0,this.models=[],this.ignoreIdxs=new Set,this.defGeometry=new i.BoxGeometry(0,0),this.snapshot=new p.Z({get:()=>u.LV.getDiff(v,this),set:e=>{},config:v,model:this}),this.isShow=()=>this.visible,this.changeParentable=!1,this.changeMatrixable=!1,this.isSnapshot=!0,this.helperGeometry=new i.BoxGeometry(0,0),this.dels=new o.Z,this.defMatrix=new i.Matrix4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1),this.needsUpdateBounding=!1,this.update=()=>{if(this.instanceMatrix.needsUpdate=!0,"editor"===(0,l.F)(this.runScene).mode){if(this.runScene.helperEx.transContro.isMoveing)return void(this.needsUpdateBounding=!1);this.needsUpdateBounding=!0}this._update()},this._update=(0,r.fnDebounce)((()=>{this.parent&&(this.updateMorphTargets(),this.runScene.setUpdate(),this.updateBounding())}),50),this._updateBounding=(0,r.fnDebounce)((()=>{this.computeBoundingSphere(),this.computeBoundingBox(),this._isUpdateBounding=!1,this._catchUpdateBounding&&(this._catchUpdateBounding=!1,this._updateBounding())}),50),this._isUpdateBounding=!1,this._catchUpdateBounding=!1,this.catchDatas=new s.Z,this.needsAddHelper=!1,this._addHelper=(0,r.fnDebounce)((e=>{if("hidden"===document.visibilityState)this.needsAddHelper=!0;else{this.needsAddHelper=!1;const n=this.catchDatas.toArray("value").filter((e=>void 0===this.models.find((t=>e.model.uuid===t.uuid))));var t;this.catchDatas.clear(),0!==n.length&&(t=this.instanceMatrix.array,this.count+=n.length,this.instanceMatrix=new i.InstancedBufferAttribute(new Float32Array(16*this.count),16),this.instanceMatrix.array.set(t),n.map((e=>{const{model:t,index:n}=e;t.geometry=this.helperGeometry,this.models[n]=t})),e||this.updateHelper(n))}}),50),this.updateHelper=(0,r.fnDebounce)(((e,t)=>{this._updateHelper(e,t)}),50),this.runScene=a,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.renderOrder=e.renderOrder,this.to(this),!1!==n&&(this.models=t.map(((e,t)=>(this.addHelper({index:t,model:e}),e.updateWorldMatrix(!0,!1),t=new h.Z(e,{instanceModel:this,index:t,runScene:this.runScene}),e.userData.helper=t)))),this.name=e.name,a.cb.loaderer.gltf.loaded.on((()=>{this._addHelper()})),a.cb.load.loaded.on((()=>{this._addHelper()})),a.cb.load.modelAdded.on((()=>{this._addHelper()})),a.cb.loaderer.gltf.modelAdded.on((()=>{this._addHelper()})),window.addEventListener("focus",(()=>{this.needsAddHelper&&(this.catchDatas.toArray("value").map((e=>e.model.onDraging({isDelay:!1}))),this._addHelper())}))}onDragChanged(e){throw new Error("Method not implemented.")}onSelect(e){return this.models[0]}onDelete(e){}toNromal(e){const t=(0,d.createDefModel)("Box");return t.geometry=this.geometry,t.material=this.material,t.userData={id:this.userData.clonedId,visible:this.visible},this.to(t),{model:t}}onSetInfo(e,t){}process(e){}create(){throw new Error("Method not implemented.")}is(e){throw new Error("Method not implemented.")}to(e,t){e.userData.type=this.type}onChildClick(e){const t=this.models[e];return t.geometry=this.geometry,t}getHelperById(e){return this.models[e]}click(e){if(this.visible)return({instanceId:e}=e),this.onChildClick(e)}onDraging(e){e&&(!1===e.isDelay?this._updateHelper(e):this.updateHelper(e))}onHelperDelete(e){!0!==e.isLoad&&(this._updateHelper(e,!0),this.runScene.setUpdate())}onHelperAdd(e){e.model.updateWorldMatrix(!1,!1),this._updateHelper(e),this.runScene.setUpdate()}setMatrixForHelper(e,t){var n=this.ignoreIdxs.has(e.index);if(this.setMatrixAt(e.index,t?e.matrixWorld:this.defMatrix),this.updateBounding(),t){if(!n)return;this.ignoreIdxs.delete(e.index)}else{if(n)return;this.ignoreIdxs.add(e.index)}this.updateBounding()}updateBounding(){this.ignoreIdxs.size!==this.count&&(this._isUpdateBounding?this._catchUpdateBounding=!0:(this._isUpdateBounding=!0,this._updateBounding()))}addHelper(e,t){this.catchDatas.set(e.index,e),t||this._addHelper(t)}_updateHelper(e,t){a.F6.toArr(e).map((e=>{var n;(e=e.model)&&(n=t||!(null!=(n=e.getIsBeDisplayedFormModel)&&n.call(e,this)),this.setMatrixForHelper(e,!n)),this.update()})),this.update()}onHelperUpdate(){}onAdd(e){this.models.map((e=>{e.update()})),this.update()}getLength(){return this.models.length+this.catchDatas.size}setHelperInfo(e){var{type:t,data:n}=e;"visible"===t?(e.model.isHide=!n,this._updateHelper(e,!n),this.runScene.setUpdate()):"v3"===t&&this._update()}clone(){const e=new y({models:this.models,toHelper:!1,baseModel:this,runScene:this.runScene});return e.geometry=this.geometry,e.material=this.material,e.visible=this.visible,e.userData.clonedId=this.userData.id,e}isNormal(){return!0}isHelper(){return!1}static process(e){const{runScene:t,model:n,info:r}=e;let i;const a=null==(e=t.uniqueEx.geometry.map.get((0,c.Ki)(n.geometry)))?void 0:e.materialInstanceModelMap[(0,c.Ki)(n.material)];return(i=null!=a&&a.instanceModel?a.instanceModel:i)||(i=new y({models:[n],toHelper:!1,runScene:t}),a&&(a.instanceModel=i)),i.visible=!1!==r.visible,i.userData.id=r.id,[i]}computeBoundingBox(){const e=this.geometry;var t=this.count;null===this.boundingBox&&(this.boundingBox=new i.Box3),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.ignoreIdxs.has(n)||(this.getMatrixAt(n,f),m.copy(e.boundingBox).applyMatrix4(f),this.boundingBox.union(m))}computeBoundingSphere(){const e=this.geometry;var t=this.count;null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.ignoreIdxs.has(n)||(this.getMatrixAt(n,f),g.copy(e.boundingSphere).applyMatrix4(f),this.boundingSphere.union(g))}addFromOther(e){e.instanceModel.toOther(e);var t=-1!==(t=this.models.findIndex((t=>t.uuid===e.uuid)))?t:this.getLength(),n=(e.index=t,e.instanceModel=this,{index:t,model:e});this.addHelper(n),this._updateHelper({index:t,model:e})}toOther(e){this.catchDatas.delete(e.index),this._updateHelper({index:e.index,model:e})}getModels(){return this.models.filter((e=>e.material.uuid===this.material.uuid))}}y.type="instanceModel"},1292:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(1398);class i{constructor(e){var{get:e,set:t,config:n,model:r}=e;this._get=e,this._set=t,this.config=n,this.model=r}set(e){var{inputMap:e,model:t,data:n,runScene:i}=e;const a=e.data.completedCbs;r.LV.set({def:this.config,runScene:i,data:n,target:t,map:e}),a.push((()=>{})),this._set(n)}get(){return this._get()}}},2037:(e,t,n)=>{n.d(t,{Z:()=>m});var r=n(7013),i=n(9663),a=n(7095);class s{constructor(e){this.runScene=e,this.rain=new a.Z(e)}}var o=n(2218),l=n(6001),u=n(5682),c=n(3736),d=n(2233);class h{constructor(e){this.type="lod",this.modelParse={toNormal:e=>{const t=e.model;return t.userData.normal={type:this.type,name:t.name,levels:t.levels.map((e=>Object.assign(Object.assign({},e),{object:(0,d.Ki)(e.object)})))},t},parse:e=>{const{model:t,normal:n}=e,r=this.create(),{levels:i,name:a}=n,s={};return r.userData=Object.assign({},t.userData),t.children.map((e=>{s[(0,d.Ki)(e)]=e})),i.map((e=>{var t,{distance:e,object:t}=e;(t=s[t])&&this.addLevel({lod:r,model:t,level:e})})),r.position.copy(t.position),r.scale.copy(t.scale),r.rotation.copy(t.rotation),r.visible=t.visible,r.name=a,r}},this.onModelAdd=e=>{var{parent:e,model:t}=e;this.is(e)&&this.addDef(e,t)},this.onModelDel=e=>{var{model:e,parent:t}=e;this.is(t)&&this.del(t,e)},this.onChangeParent=e=>{var{model:e,parent:t,oldParent:n}=e;this.is(n)&&this.del(n,e),this.is(t)&&this.addDef(t,e)},this.runScene=e;const{toNormal:t,parse:n}=this.modelParse;e.cb.inited.add("lod",(()=>{e.modelEx.importAndExport.addParses(this.type,{toNormal:t,parse:n})})),e.cb.model.remove.add("lod",this.onModelDel),e.cb.model.add.add("lod",this.onModelAdd),e.cb.model.setParent.add("lod",this.onChangeParent)}create(){const e=new u.Sf.LOD;return e.name=this.type,e.renderOrder=1,(0,c.M)(e,"id",(0,l.getId)()),(0,c.M)(e,"type",this.type),(0,c.M)(e,"normal",{type:this.type}),e}del(e,t){var n=e.levels.findIndex((e=>e.object===t));-1!==n&&e.levels.splice(n,1)}addLevel(e){const{lod:t,model:n,level:r}=e;this.has(t,n)||t.addLevel(n,r)}has(e,t){return-1!==e.levels.findIndex((e=>e.object.uuid===t.uuid))}is(e){return(null==(e=null==(e=null==e?void 0:e.userData)?void 0:e.normal)?void 0:e.type)===this.type}addDef(e,t){this.addLevel({lod:e,model:t,level:100*(e.levels.length+1)})}}var p=n(3447);t=n(7474),n=n(8376);const f={instanceHelper:t.Z,instanceModel:n.Z,InstanceModel:n.Z};class m{constructor(e){this.runScene=e,this.vertices=new s(e),this.water=new o.Z(e),this.groundProjected=new p.Z(e),this.lod=new h(e)}create(e,t){let n;return n="VerticesRain"===e?this.vertices.rain.create(t):"Water"===e?this.water.create():"2DDom"===e?this.runScene.renderEx.css2dDom.getDef():"3DDom"===e?this.runScene.renderEx.css3dDom.getDef():"3DSprite"===e?this.runScene.renderEx.css3dSprite.getDef():"GroundProjected"===e?this.groundProjected.create():"Lod"===e?this.lod.create():(0,i.Py)(e,t),r.ZP.parseNode(n),n}static getType(e){var t;return(null==(t=null==(t=e.userData)?void 0:t.normal)?void 0:t.type)||(null==(t=e.userData)?void 0:t.type)||e.type}static process(e){var t=e.info;return t.type,f[t.type].process(e)}}},7095:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(6001),i=n(5521),a=n(1794),s=n(5682),o=n(3736),l=n(2233),u=n(3924);class c{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new a.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:n}=e,r=(0,u.createDefModel)("Box");e=(0,l.Ki)(t);var i=n.modelEx.def.vertices.rain.map.get(e);if(r.material=t.material,!e||!i)throw TypeError("缺少属性");var{length:e,size:i,speed:a,fog:s}=i;return r.userData.normal={type:c.modelTools.type,length:e,size:i,speed:a,fog:s,materialId:(0,l.Ki)(t.material)},r},parse:e=>{const{runScene:t,normal:n,model:r}=e,i=t.modelEx.def.create(c.modelTools.type,n);return i.material=r.material,i.material.fog=n.fog,i.material.needsUpdate=!0,i.material.userData.id=n.materialId,i}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,n)=>{const{model:r,length:i,speed:a,del:s}=n;if(!s){r.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<i;e++)r.geometry.attributes.position.setY(e,r.geometry.attributes.position.getY(e)-a),0<=a?r.geometry.attributes.position.getY(e)<=-1e3&&r.geometry.attributes.position.setY(e,1e3):1e3<=r.geometry.attributes.position.getY(e)&&r.geometry.attributes.position.setY(e,-1e3),r.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=(0,u.createDefModel)("Box");var n=(0,l.Ki)(e),r=this.map.get(n);if(t.material.map=e.material.map,n&&r)return t.userData.normal=Object.assign({type:this.tools.type},r),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,l.Ki)(e));t&&(t.del=!1)}})),e.cb.model.remove.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,l.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:n}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(c.modelTools.type,{toNormal:t,parse:n})}))}bindMaterial(e,t){(0,o.M)(e,"id",t||(0,r.getId)()),(0,o.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const n=new s.Sf.Points(this.createGeo(t),this.createMaterial(e));return n.name="雨雪",n.renderOrder=1,t=(0,r.getId)(),(0,o.M)(n,"id",t),this.bindMaterial(n.material),(0,o.M)(n,"type",this.tools.type),(0,o.M)(n,"normal",{type:this.tools.type}),this.map.set(t,{model:n,length:e.length,size:e.size,speed:e.speed,fog:n.material.fog,del:!1}),n}createGeo(e){let t=[];const n=new i.BufferGeometry;for(let n=0;n<e;n++){var r=2e3*Math.random()-1e3,a=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(r,a,s)}return n.setAttribute("position",new i.Float32BufferAttribute(t,3)),n}createMaterial(e){var{size:e,map:t}=e;return new s.Sf.PointsMaterial({blending:s.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,fog:!0,map:t})}setForModel(e){var{model:e,type:t,data:n}=e;(e=(0,l.Ki)(e))&&this.set(e,t,n)}set(e,t,n){const r=this.map.get(e);if(r){const{model:e,size:a}=r;switch(t){case"show":e.visible=n;break;case"length":e.geometry=this.createGeo(n),r[t]=n;break;case"size":var i=e.material;e.material=this.createMaterial({map:e.material.map,size:n}),this.bindMaterial(e.material,(0,l.Ki)(i)),r[t]=n;break;case"speed":r[t]=n;break;case"fog":e.material.fog=n,e.material.needsUpdate=!0,r[t]=n;break;case"texture":i=e.material,e.material=this.createMaterial({map:n,size:a}),this.bindMaterial(e.material,(0,l.Ki)(i))}}}}c.modelTools={type:"VerticesRain",parseData:function(e,t,n){const r=n.modelEx.def.create(c.modelTools.type,t);return r.material=e.material,r.material.userData.id=t.materialId,r},toNormal:(e,t,n)=>{const r=(0,u.createDefModel)("Box");var i=(0,l.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(i),r.material=e.material,!i||!t)throw TypeError("缺少属性");var{length:i,size:t,speed:a}=t;return r.userData.normal={type:c.modelTools.type,length:i,size:t,speed:a,materialId:(0,l.Ki)(e.material)},r}}},2218:(e,t,n)=>{n.d(t,{Z:()=>w});var r=n(6001),i=n(5521),a=n(8881);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,n){t=l(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],l(e).constructor):t.apply(e,n))&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return u(r)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var d,h=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=this;if(!(r instanceof(s=n)))throw new TypeError("Cannot call a class as a function");(r=o(this,n,[e])).isWater=!0;var i=u(r),s=void 0!==t.textureWidth?t.textureWidth:512,l=(e=void 0!==t.textureHeight?t.textureHeight:512,void 0!==t.clipBias?t.clipBias:0),c=void 0!==t.alpha?t.alpha:1,d=void 0!==t.time?t.time:0,h=void 0!==t.waterNormals?t.waterNormals:null,p=void 0!==t.sunDirection?t.sunDirection:new a.Vector3(.70707,.70707,0),f=new a.Color(void 0!==t.sunColor?t.sunColor:16777215),m=new a.Color(void 0!==t.waterColor?t.waterColor:8355711),g=void 0!==t.eye?t.eye:new a.Vector3(0,0,0),v=void 0!==t.distortionScale?t.distortionScale:20,y=void 0!==t.side?t.side:a.FrontSide,b=(t=void 0!==t.fog&&t.fog,new a.Plane),x=new a.Vector3,w=new a.Vector3,S=new a.Vector3,_=new a.Matrix4,T=new a.Vector3(0,0,-1),M=new a.Vector4,E=new a.Vector3,D=new a.Vector3,P=new a.Vector4,k=new a.Matrix4,O=new a.PerspectiveCamera,A=new a.WebGLRenderTarget(s,e);return s={name:"MirrorShader",uniforms:a.UniformsUtils.merge([a.UniformsLib.fog,a.UniformsLib.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new a.Matrix4},sunColor:{value:new a.Color(8355711)},sunDirection:{value:new a.Vector3(.70707,.70707,0)},eye:{value:new a.Vector3},waterColor:{value:new a.Color(5592405)}}]),vertexShader:"\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tuniform float time;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <fog_pars_vertex>\n\t\t\t\t#include <shadowmap_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tmirrorCoord = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tworldPosition = mirrorCoord.xyzw;\n\t\t\t\t\tmirrorCoord = textureMatrix * mirrorCoord;\n\t\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t#include <fog_vertex>\n\t\t\t\t#include <shadowmap_vertex>\n\t\t\t}",fragmentShader:"\n\t\t\t\tuniform sampler2D mirrorSampler;\n\t\t\t\tuniform float alpha;\n\t\t\t\tuniform float time;\n\t\t\t\tuniform float size;\n\t\t\t\tuniform float distortionScale;\n\t\t\t\tuniform sampler2D normalSampler;\n\t\t\t\tuniform vec3 sunColor;\n\t\t\t\tuniform vec3 sunDirection;\n\t\t\t\tuniform vec3 eye;\n\t\t\t\tuniform vec3 waterColor;\n\n\t\t\t\tvarying vec4 mirrorCoord;\n\t\t\t\tvarying vec4 worldPosition;\n\n\t\t\t\tvec4 getNoise( vec2 uv ) {\n\t\t\t\t\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);\n\t\t\t\t\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );\n\t\t\t\t\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );\n\t\t\t\t\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );\n\t\t\t\t\tvec4 noise = texture2D( normalSampler, uv0 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv1 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv2 ) +\n\t\t\t\t\t\ttexture2D( normalSampler, uv3 );\n\t\t\t\t\treturn noise * 0.5 - 1.0;\n\t\t\t\t}\n\n\t\t\t\tvoid sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {\n\t\t\t\t\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );\n\t\t\t\t\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );\n\t\t\t\t\tspecularColor += pow( direction, shiny ) * sunColor * spec;\n\t\t\t\t\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;\n\t\t\t\t}\n\n\t\t\t\t#include <common>\n\t\t\t\t#include <packing>\n\t\t\t\t#include <bsdfs>\n\t\t\t\t#include <fog_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <lights_pars_begin>\n\t\t\t\t#include <shadowmap_pars_fragment>\n\t\t\t\t#include <shadowmask_pars_fragment>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\tvec4 noise = getNoise( worldPosition.xz * size );\n\t\t\t\t\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );\n\n\t\t\t\t\tvec3 diffuseLight = vec3(0.0);\n\t\t\t\t\tvec3 specularLight = vec3(0.0);\n\n\t\t\t\t\tvec3 worldToEye = eye-worldPosition.xyz;\n\t\t\t\t\tvec3 eyeDirection = normalize( worldToEye );\n\t\t\t\t\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );\n\n\t\t\t\t\tfloat distance = length(worldToEye);\n\n\t\t\t\t\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;\n\t\t\t\t\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );\n\n\t\t\t\t\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );\n\t\t\t\t\tfloat rf0 = 0.3;\n\t\t\t\t\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );\n\t\t\t\t\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;\n\t\t\t\t\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);\n\t\t\t\t\tvec3 outgoingLight = albedo;\n\t\t\t\t\tgl_FragColor = vec4( outgoingLight, alpha );\n\n\t\t\t\t\t#include <tonemapping_fragment>\n\t\t\t\t\t#include <colorspace_fragment>\n\t\t\t\t\t#include <fog_fragment>\t\n\t\t\t\t}"},(e=new a.ShaderMaterial({name:s.name,uniforms:a.UniformsUtils.clone(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,lights:!0,side:y,fog:t})).uniforms.mirrorSampler.value=A.texture,e.uniforms.textureMatrix.value=k,e.uniforms.alpha.value=c,e.uniforms.time.value=d,e.uniforms.normalSampler.value=h,e.uniforms.sunColor.value=f,e.uniforms.waterColor.value=m,e.uniforms.sunDirection.value=p,e.uniforms.distortionScale.value=v,e.uniforms.eye.value=g,i.material=e,i.onBeforeRender=function(e,t,n){var r,a,s;w.setFromMatrixPosition(i.matrixWorld),S.setFromMatrixPosition(n.matrixWorld),_.extractRotation(i.matrixWorld),x.set(0,0,1),x.applyMatrix4(_),E.subVectors(w,S),0<E.dot(x)||(E.reflect(x).negate(),E.add(w),_.extractRotation(n.matrixWorld),T.set(0,0,-1),T.applyMatrix4(_),T.add(S),D.subVectors(w,T),D.reflect(x).negate(),D.add(w),O.position.copy(E),O.up.set(0,1,0),O.up.applyMatrix4(_),O.up.reflect(x),O.lookAt(D),O.far=n.far,O.updateMatrixWorld(),O.projectionMatrix.copy(n.projectionMatrix),k.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),k.multiply(O.projectionMatrix),k.multiply(O.matrixWorldInverse),b.setFromNormalAndCoplanarPoint(x,w),b.applyMatrix4(O.matrixWorldInverse),M.set(b.normal.x,b.normal.y,b.normal.z,b.constant),r=O.projectionMatrix,P.x=(Math.sign(M.x)+r.elements[8])/r.elements[0],P.y=(Math.sign(M.y)+r.elements[9])/r.elements[5],P.z=-1,P.w=(1+r.elements[10])/r.elements[14],M.multiplyScalar(2/M.dot(P)),r.elements[2]=M.x,r.elements[6]=M.y,r.elements[10]=M.z+1-l,r.elements[14]=M.w,g.setFromMatrixPosition(n.matrixWorld),r=e.getRenderTarget(),a=e.xr.enabled,s=e.shadowMap.autoUpdate,i.visible=!1,e.xr.enabled=!1,e.shadowMap.autoUpdate=!1,e.setRenderTarget(A),e.state.buffers.depth.setMask(!0),!1===e.autoClear&&e.clear(),e.render(t,O),i.visible=!0,e.xr.enabled=a,e.shadowMap.autoUpdate=s,e.setRenderTarget(r),void 0!==(t=n.viewport)&&e.state.viewport(t))},r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e),t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(a.Mesh),p=n(1794),f=n(135),m=(t=n(144),n(5682)),g=n(3736),v=n(2233),y=n(9663),b=n(3924),x=n(3735);t.Gf.fog;class w{constructor(e){this.catchModel=new p.Z,this.map=new p.Z,this.inited=()=>{this.runScene.cb.render.add(w.type,this.render),this.runScene.cb.unique.model.add.add(w.type,this.onModelAdd),this.runScene.cb.unique.model.remove.add(w.type,this.onModelDel),this.runScene.modelEx.importAndExport.addParses("Water",{toNormal:e=>this.process(e),parse:e=>{const t=this.create(),n=e.model;return t.name=n.name,t.visible=n.visible,t.position.copy(n.position),t.rotation.copy(n.rotation),t.scale.copy(n.scale),this.catchModel.set(n.userData.normal.id,{model:t,material:t.material}),t.material=n.material,t.userData=Object.assign({},n.userData),t.matrixAutoUpdate=!0,n.matrixAutoUpdate=!0,t}}),this.runScene.cb.loaderer.gltf.complete.add("water-model",this.complete),this.runScene.cb.load.complete.add("water-model",this.complete)},this.complete=()=>{this.catchModel.map(((e,t)=>{const{model:n,material:r}=t;t=n.material,w.mergeMaterial(t,r),this.bindMaterialData(r),n.material=r})),this.catchModel.clear()},this.process=e=>{if(e=e.model,!this.is(e))return e;const t=(0,b.createDefModel)("Box");return t.userData.normal=Object.assign({type:"Water"},e.userData),t.name=e.name,t.visible=e.visible,t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.material=e.material,t},this.onModelAdd=e=>{const t=e.model;!this.is(e.model)||(e=(0,v.Ki)(t))&&(this.map.set(e,t),t.matrixAutoUpdate=!0)},this.onModelDel=e=>{this.is(e.model)&&(e=e.model,(e=(0,v.Ki)(e))&&this.map.delete(e))},this.render=()=>{0!==this.map.size&&this.map.map(((e,t)=>{t.material.uniforms.time.value+=t.material.userData.speed||1/60}))},this.runScene=e,this.runScene.cb.inited.add(w.type,this.inited)}create(){const e=new h(new i.PlaneGeometry(1e3,1e3),{textureWidth:2048,textureHeight:2048,sunDirection:new m.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:0});return this.bindData(e),e.rotation.x=-Math.PI/2,e.matrixAutoUpdate=!0,e}static create(){const e=new h(new i.PlaneGeometry(1e3,1e3),{textureWidth:2048,textureHeight:2048,sunDirection:new m.Sf.Vector3,sunColor:16711680,waterColor:16777215,distortionScale:0});return e.rotation.x=-Math.PI/2,e}is(e){return"Water"===(null==(e=e.userData.normal)?void 0:e.type)}bindData(e){e.userData.normal={type:"Water"},e.name="water",this.bindMaterialData(e.material)}bindMaterialData(e){e.userData.type="Water",e.userData.id=e.userData.id||(0,r.getId)(),e.userData.tools=w.tools}set(e,t,n){e.material[t]=n}static mergeMaterial(e,t){var{fog:n,side:r}=e,{waterColor:i,distortionScale:a,normalSampler:s}=e.uniforms;t.fog=n,t.side=r,t.uniforms.normalSampler.value=s.value,t.uniforms.waterColor.value.copy(i.value),t.uniforms.distortionScale.value=a.value,t.userData=Object.assign({},e.userData)}}(d=w).type="water-model",w.tools={type:"Water",bind(e){(0,g.M)(e,"type","Water")},getTextures:e=>["normalSampler"].map((t=>{var n=e.uniforms[t].value;if(n)return{type:t,texture:n}})).filter((e=>e)),create:()=>{const e=d.create();return e.material.type=d.tools.type,e.material.userData.tools=d.tools,e.material},parseData:(e,t)=>{const{texture:n,material:r,normal:i}=e,{data:a,load:s}=n,o=[],l=d.tools.create(t);var{side:e,fog:u,waterColor:c,distortionScale:h,speed:p}=i;return l.fog=void 0===u||u,e&&(l.side=e),c&&(l.uniforms.waterColor.value=(0,y.ZD)(c)),void 0!==h&&(l.uniforms.distortionScale.value=h),void 0!==p&&(r.userData.speed=p),s&&o.push(...a.map((e=>{const{type:n,texture:r}=e;return()=>{t.materialEx.setTexture({material:l,type:n,newVal:r},!1)}}))),l.userData=Object.assign({},r.userData),{material:l,setTextureFns:o}},setTexture:e=>{const{material:t,type:n,texture:r}=e;return e=new x.Z({target:t,typeList:["uniforms",n,"value"],newVal:r}).execute(),t.needsUpdate=!0,e},getTexture:function(e){var{material:e,type:t}=e;return e.uniforms[t].value},toNormal:e=>{const t=(0,f.createDefMaterial)();var n={type:"Water",id:(0,v.Ki)(t)};const r={type:"Water"};return e.fog||(r.fog=!1),0!==e.side&&(r.side=e.side),e.userData.speed&&(r.speed=e.userData.speed),r.waterColor=e.uniforms.waterColor.value.getHexString(),r.distortionScale=e.uniforms.distortionScale.value,t.userData=n,{normal:r,textures:w.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=w.tools.type,t},textureNames:[{type:"normalSampler"}]}},5124:(e,t,n)=>{function r(){var e=0,t=document.createElement("div");function n(e){return t.appendChild(e.dom),e}function i(n){for(var r=0;r<t.children.length;r++)t.children[r].style.display=r===n?"block":"none";e=n}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(n){n.preventDefault(),i(++e%t.children.length)}),!1);var a,s=(performance||Date).now(),o=s,l=0,u=n(new r.Panel("FPS","#0ff","#002")),c=n(new r.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(a=n(new r.Panel("MB","#f08","#201"))),i(0),{REVISION:16,dom:t,addPanel:n,showPanel:i,begin:function(){s=(performance||Date).now()},end:function(){l++;var e,t=(performance||Date).now();return c.update(t-s,200),o+1e3<=t&&(u.update(1e3*l/(t-o),100),o=t,l=0,a&&(e=performance.memory,a.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){s=this.end()},domElement:t,setMode:i}}n.d(t,{Z:()=>s,F:()=>o}),r.Panel=function(e,t,n){var r=1/0,i=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,u=3*s,c=2*s,d=3*s,h=15*s,p=74*s,f=30*s,m=document.createElement("canvas"),g=(m.width=o,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=n,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,u,c),g.fillRect(d,h,p,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d,h,p,f),{dom:m,update:function(l,v){r=Math.min(r,l),i=Math.max(i,l),g.fillStyle=n,g.globalAlpha=1,g.fillRect(0,0,o,h),g.fillStyle=t,g.fillText(a(l)+" "+e+" ("+a(r)+"-"+a(i)+")",u,c),g.drawImage(m,d+s,h,p-s,f,d,h,p-s,f),g.fillRect(d+p-s,h,s,f),g.fillStyle=n,g.globalAlpha=.9,g.fillRect(d+p-s,h,s,a((1-l/v)*f))}}};const i=r;var a=n(5317);class s{constructor(e,t){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instance:{enable:!0,ignoreNames:[]},render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1,stop:!1,static:!0,native:!1,event:{trigger:!0,ignores:[]},size:{width:0,height:0}},graph:{debug:!1},event:{base:"dom"},material:{load:!0},texture:{load:!0,loader:"imageBitMap",lazyLoad:{open:!1,intervalTime:16.6},quality:1},pp:{open:!0,glow:{open:!1}},camera:{showBackground:!1},ltPp:{lut:{baseUrl:"./assets/image/textures/luts/"}},config:{export:{snapshot:{screenshot:!0}}}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,a.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:n,cb:r}=t;e&&clearTimeout(e),e=setTimeout((()=>{r(),e=null,clearTimeout(e)}),n)}})(),this.runScene=e,this.options=(0,a.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=new i,this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",n="success"){var r;null!=(r=null==(r=this.options)?void 0:r.msg)&&r.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:n}),console.log(e))}}const o=e=>e.optionsEx.options},3379:(e,t,n)=>{n.d(t,{Q:()=>h,S:()=>p});var r=n(5682),i=n(8881),a=n(9432),s=n(3639);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t,n){t=u(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var d=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t,r,o){var u;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(u=l(this,n)).renderScene=t,u.renderCamera=r,u.selectedObjects=void 0!==o?o:[],u.visibleEdgeColor=new i.Color(1,1,1),u.hiddenEdgeColor=new i.Color(.1,.04,.02),u.edgeGlow=0,u.usePatternTexture=!1,u.edgeThickness=1,u.edgeStrength=3,u.downSampleRatio=2,u.pulsePeriod=0,u._visibilityCache=new Map,u.resolution=void 0!==e?new i.Vector2(e.x,e.y):new i.Vector2(256,256),t=Math.round(u.resolution.x/u.downSampleRatio),r=Math.round(u.resolution.y/u.downSampleRatio),u.renderTargetMaskBuffer=new i.WebGLRenderTarget(u.resolution.x,u.resolution.y),u.renderTargetMaskBuffer.texture.name="OutlinePass.mask",u.renderTargetMaskBuffer.texture.generateMipmaps=!1,u.depthMaterial=new i.MeshDepthMaterial,u.depthMaterial.side=i.DoubleSide,u.depthMaterial.depthPacking=i.RGBADepthPacking,u.depthMaterial.blending=i.NoBlending,u.prepareMaskMaterial=u.getPrepareMaskMaterial(),u.prepareMaskMaterial.side=i.DoubleSide,u.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(u.prepareMaskMaterial.fragmentShader,u.renderCamera),u.renderTargetDepthBuffer=new i.WebGLRenderTarget(u.resolution.x,u.resolution.y,{type:i.HalfFloatType}),u.renderTargetDepthBuffer.texture.name="OutlinePass.depth",u.renderTargetDepthBuffer.texture.generateMipmaps=!1,u.renderTargetMaskDownSampleBuffer=new i.WebGLRenderTarget(t,r,{type:i.HalfFloatType}),u.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",u.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,u.renderTargetBlurBuffer1=new i.WebGLRenderTarget(t,r,{type:i.HalfFloatType}),u.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",u.renderTargetBlurBuffer1.texture.generateMipmaps=!1,u.renderTargetBlurBuffer2=new i.WebGLRenderTarget(Math.round(t/2),Math.round(r/2),{type:i.HalfFloatType}),u.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",u.renderTargetBlurBuffer2.texture.generateMipmaps=!1,u.edgeDetectionMaterial=u.getEdgeDetectionMaterial(),u.renderTargetEdgeBuffer1=new i.WebGLRenderTarget(t,r,{type:i.HalfFloatType}),u.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",u.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,u.renderTargetEdgeBuffer2=new i.WebGLRenderTarget(Math.round(t/2),Math.round(r/2),{type:i.HalfFloatType}),u.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",u.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,u.separableBlurMaterial1=u.getSeperableBlurMaterial(4),u.separableBlurMaterial1.uniforms.texSize.value.set(t,r),u.separableBlurMaterial1.uniforms.kernelRadius.value=1,u.separableBlurMaterial2=u.getSeperableBlurMaterial(4),u.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(r/2)),u.separableBlurMaterial2.uniforms.kernelRadius.value=4,u.overlayMaterial=u.getOverlayMaterial(),o=s.C,u.copyUniforms=i.UniformsUtils.clone(o.uniforms),u.materialCopy=new i.ShaderMaterial({uniforms:u.copyUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,blending:i.NoBlending,depthTest:!1,depthWrite:!1}),u.enabled=!0,u.needsSwap=!1,u._oldClearColor=new i.Color,u.oldClearAlpha=1,u.fsQuad=new a.T(null),u.tempPulseColor1=new i.Color,u.tempPulseColor2=new i.Color,u.textureMatrix=new i.Matrix4,u}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e),t=n,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function n(n){n.isMesh&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}for(var r=0;r<this.selectedObjects.length;r++)this.selectedObjects[r].traverse(n)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,n=[];function r(e){e.isMesh&&n.push(e)}for(var i=0;i<this.selectedObjects.length;i++)this.selectedObjects[i].traverse(r);this.renderScene.traverse((function(r){if(r.isMesh||r.isSprite){for(var i,a=!1,s=0;s<n.length;s++)if(n[s].id===r.id){a=!0;break}!1===a&&(i=r.visible,!1!==e&&!0!==t.get(r)||(r.visible=e),t.set(r,i))}else(r.isPoints||r.isLine)&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,i,a){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,a&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=o,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,a&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new i.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new i.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new i.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new i.Vector2(.5,.5)},visibleEdgeColor:{value:new i.Vector3(1,1,1)},hiddenEdgeColor:{value:new i.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new i.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new i.Vector2(.5,.5)},direction:{value:new i.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new i.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:i.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.w);d.BlurDirectionX=new i.Vector2(1,0),d.BlurDirectionY=new i.Vector2(0,1);class h{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new d(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new r.Sf.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,n)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(n,1))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((n=>{e.uuid===n.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}const p=e=>e.userData.outline},3228:(e,t,n)=>{n.d(t,{ZP:()=>b,sH:()=>x});var r=n(5521),i=n(9278),a=n(3736),s=n(6001),o=n(1794),l=n(3924),u=n(2233),c=n(9663);class d{constructor(e){this.calls={getTextures:e=>(e=(e=e.model).userData.textureId,(e=this.runScene.uniqueEx.texture.get(e))?[e]:[]),toNormal:e=>{const t=(0,l.createDefModel)("Box");var n=(!(n=e.model.userData.textureId)||(n=this.runScene.uniqueEx.texture.get(n))&&(t.material.map=n),this.getSizeByModel(e.model));return t.userData=Object.assign(Object.assign({},e.model.userData),{name:e.model.name,size:n}),t.position.copy(e.model.position),t},parse:e=>{e=e.model;var{name:t,id:n}=e.userData,n=this.getDef({inputId:n,className:t});return this.copy(n,e,!0),n}},this.map=new o.Z,this.cloneModel=e=>{var t;if(e=e.model,this.is(e))return t=this.getDef(),this.copy(t,e,!1),(0,u.x)(t),t},this.onModelAdd=e=>{e=e.model,this.is(e)&&(this.map.set((0,u.Ki)(e),!0),this.onMapSet())},this.onModelDel=e=>{e=e.model,this.is(e)&&(this.map.delete((0,u.Ki)(e)),this.onMapSet())},(this.runScene=e).cb.inited.add("cssRender",(()=>{this.initEvent()})),e.cb.undo.normal.valid.add("cssRender",(({info:e,val:t,target:n})=>!this.is(n)||"name"!==e||null===t[0].match(/\d+/)||(this.runScene.optionsEx.log("该模型首位字符不可为数字","base","error"),!1))),e.cb.model.bindCloneModel.add("cssRender",this.cloneModel)}copy(e,t,n){var{size:r,id:i,alpha:o,url:l,textMap:u,name:c,textureId:d}=t.userData;e.name=c||t.name,e.position.copy(t.position),this.setSizeForModel(e,r),o&&this.setAlpha(e,o),u&&(0,s.mapObj)(u,((t,n)=>{this.setText({model:e,type:t,data:n})})),l&&this.setBgc({model:e,url:l}),n?((0,a.M)(e,"id",i),d&&this.runScene.textureEx.setAwaitLoaded(d,(t=>{this.segtBgcByTexture(e,t)}))):d&&(e.userData.textureId=d)}initEvent(){this.runScene.cb.unique.model.add.add("cssRender",this.onModelAdd),this.runScene.cb.unique.model.remove.add("cssRender",this.onModelDel),this.runScene.modelEx.importAndExport.addParses(this.type,this.calls)}onMapSet(){this.setState(0!==this.map.size)}getDom(e,t){let n;if(!(n=t?document.querySelector("."+t.replace(/ /g,"_")):n)){const t=document.createElement("div");t.style.width="10px",t.style.height="7px",t.style.textAlign="center",t.classList.add(this.prefix+"_model_"+e),t.classList.add("cssDom"),t.style.backgroundColor="#fff",this.runScene.assetsEx.engineDom.appendChild(t),n=t}return n}getSizeByModel(e){var{width:t,height:n}=e.element.getBoundingClientRect();return{width:(null==(e=e.userData.size)?void 0:e.width)||t||10,height:(null==e?void 0:e.height)||n||7}}setSizeForModel(e,t){if(t){var{width:t,height:n}=t;const r=e.element;r.style.width=t+"px",r.style.height=n+"px",r.style.lineHeight=n+"px",e.userData.size||(e.userData.size={}),e.userData.size.width=t,e.userData.size.height=n}}segtBgcByTexture(e,t){var{url:n,blob:r}=t.userData;this.setBgc({model:e,url:n,data:r,texture:t})}setBgc(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{model:t,url:n,data:r,texture:i}=e;let a;i?a=i:r?a=yield this.runScene.textureEx.parse(r,{url:n,flipY:!1}):t.userData.textureId&&(a=this.runScene.uniqueEx.texture.get(t.userData.textureId)),a&&(t.userData.textureId=(0,u.Ki)(a),this.runScene.uniqueEx.texture.linkMaterial(a,{target:t,type:"bgc",targetType:"model"}),t.userData.url=n,t.element.style.backgroundImage=`url(${n})`,t.element.style.backgroundSize="100% 100%")}))}setAlpha(e,t){e.userData.alpha=t,e.element.style.backgroundColor=t?"rgba(0,0,0,0)":"rgb(255,255,255)"}setText(e){const{model:t,type:n,data:r}=e;switch(n){case"innerText":t.element.innerText=r;break;case"font-size":t.element.style.fontSize=r+"px";break;default:t.element.style[n]=r}let i=t.userData.textMap;i||(t.userData.textMap=i={}),i[n]=r}getText(e){var{model:e,type:t}=e;return null==(e=e.userData.textMap)?void 0:e[t]}getDef(e){var{className:e,inputId:t,inputDom:n}=e||{},t=t||(0,s.getId)(),n=n||this.getDom(t,e);const r=this.getIns(n);return(0,a.M)(r,"id",t),(0,a.M)(r,"normal",{type:this.type}),r.name=this.type,r.element.addEventListener("pointerdown",(()=>{this.runScene.events.mouse.catchTrigger=r})),this.runScene.cb.model.setVisible.add(this.type+t,(()=>{var e=(0,c.pn)(r,{ignoreSelf:!0});e!==r.userData.affectedParentVisible&&(e?(r.element.classList.add("show"),r.element.classList.remove("hide")):(r.element.classList.add("hide"),r.element.classList.remove("show")),r.userData.affectedParentVisible=e)})),r}}class h extends d{constructor(){super(...arguments),this.type="Css2dDom",this.prefix="Css2dDom"}getIns(e){return new i.j(e)}get(e){return this.getDef({inputDom:e})}is(e){return(null==(e=(0,a.is)(e,"normal"))?void 0:e.type)===this.type}setState(e){this.runScene.globalConfig.setRender2(e)}}var p=n(1897),f=n(6272);class m extends d{constructor(){super(...arguments),this.type="Css3dDom",this.prefix="Css3dDom"}getIns(e){return new p.cp(e)}get(e){return this.getDef({inputDom:e})}is(e){var t;return(null==(t=(0,a.is)(e,"normal"))?void 0:t.type)===this.type||(null==(t=(0,a.is)(e,"normal"))?void 0:t.type)===this.runScene.renderEx.css3dSprite.type}setState(e){this.runScene.globalConfig.setRender3(e)}setBgc(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{model:t,url:n}=e;t.userData.url=n;var r=yield(0,f.o4)(n);t.element.appendChild(r)}))}}class g extends d{constructor(){super(...arguments),this.type="Css3dSprite",this.prefix="Css3dSprite"}getIns(e){return new p.P7(e)}get(e){return this.getDef({inputDom:e})}is(e){var t;return(null==(t=(0,a.is)(e,"normal"))?void 0:t.type)===this.type||(null==(t=(0,a.is)(e,"normal"))?void 0:t.type)===this.runScene.renderEx.css3dDom.type}setState(e){this.runScene.globalConfig.setRender3(e)}}class v extends n(4961).Z{constructor(){super(...arguments),this.lowFrame=60,this.modelAddedState=!1,this.frames=0,this.trigged=!1,this.modelAdded=()=>{this.modelAddedState=!0},this.afterRender=e=>{e=e.time,this.lowFrame=Math.min(this.lowFrame,1/e),this.modelAddedState&&(this.frames+=1,this.processClose())},this.staticMode=!0,this.render=()=>{this.runScene.assetsEx.renderer.shadowMap.autoUpdate=!0,this.staticMode&&this.closeAutoUpdate()},this.closeAutoUpdate=(0,s.fnDebounce)((()=>{this.runScene.assetsEx.renderer.shadowMap.autoUpdate=!1}),1e3)}inited(){this.runScene.cb.load.modelAdded.add("ShadowManaer",this.modelAdded),this.runScene.cb.loaderer.gltf.modelAdded.add("ShadowManaer",this.modelAdded),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("ShadowManaer",(()=>{this.trigged=!1,this.modelAddedState=!1,this.bindRender()})),this.bindRender()}bindRender(){this.runScene.cb.renderEx.after.get("ShadowManaer")||this.trigged||this.runScene.cb.renderEx.after.add("ShadowManaer",this.afterRender)}processClose(){this.frames<10||(this.runScene.assetsEx.renderer.shadowMap.autoUpdate=!1,this.runScene.cb.renderEx.after.delete("ShadowManaer"),this.runScene.cb.renderEx.fristFrame.cb(),this.trigged=!0,this.frames=0)}setStaticMode(e){this.staticMode=e}}var y=n(5247);class b{constructor(e){this.pixelRatio=1,this.ratio=0,this.size={width:0,height:0},this.inited=()=>{this.shadowManager.inited(),this.runScene.exporter.gltf.options.addOption({type:"renderer",process:()=>{var{outputColorSpace:e,toneMapping:t,toneMappingExposure:n}=this.runScene.assetsEx.renderer;const r={outputColorSpace:e,toneMapping:t,toneMappingExposure:n};return this.shadowManager.staticMode||(r.shadowManager={staticMode:0}),1!==this.pixelRatio&&(r.pixelRatio=this.pixelRatio),0!==this.ratio&&(r.ratio=this.ratio),JSON.stringify(r)},parse:e=>{var t,n,r,i,a,s;e&&(({outputColorSpace:e,outputEncoding:t,toneMapping:n,toneMappingExposure:r,pixelRatio:i,shadowManager:a,ratio:s}=JSON.parse(e)),this.setEncoding("srgb"===(t||e)?"srgb":"def"),this.setToneMapping(Object.keys(w)[n]),this.setExposure(r),this.setRatio(s||0),void 0!==i&&this.setPixelRatio(i),a&&0===a.staticMode&&this.shadowManager.setStaticMode(!1))}})},this.setSize=(e,t,n)=>{let{width:r,height:i}=this.getDomSize(),a=e||r,s=t||i;if(!n){const{width:e,height:t}=this.getSizeForRadio({width:a,height:s});a=e,s=t}e=Math.floor(a),t=Math.floor(s),this.size={width:e,height:t},this.runScene.setSize(e,t),this.runScene.cb.renderEx.setSize.cb({width:e,height:t})},this.runScene=e,this.css2dDom=new h(e),this.css3dDom=new m(e),this.css3dSprite=new g(e),this.shadowManager=new v(e),this.runScene.cb.resize.add("render-ex-resize",(e=>{var{width:e,height:t}=this.runScene.renderEx.getSizeForRadio(e);this.setSize(e,t)})),e.cb.inited.add("render",this.inited)}initOutDom(e){const t=document.createElement("div");var{width:n,height:r}=e.getBoundingClientRect();return t.style.width=n+"px",t.style.height=r+"px",t.style.position="absolute",t.style.top="50%",t.style.left="50%",t.style.overflow="hidden",t.style.transform="translate(-50%,-50%)",e.appendChild(t),t}setRatio(e){this.ratio=e;const t=this.runScene.assetsEx.parentDom;t&&this.runScene.cb.resize.cb(t.getBoundingClientRect())}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e||""}setPixelRatio(e){this.pixelRatio=e,this.runScene.assetsEx.renderer.setPixelRatio(e),this.runScene.cb.renderEx.setSize.cb(this.size)}create(e){let t=new r.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance",precision:"highp"});return t.capabilities.maxTextureSize=32768,t.setPixelRatio(this.pixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=r.PCFSoftShadowMap,t.useLegacyLights=!1,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}setEncoding(e){this.runScene.assetsEx.renderer.outputColorSpace="def"===e?y.Z.LinearSRGBColorSpace:y.Z.SRGBColorSpace,this.runScene.pp.onRenderEncodingChanged(e)}setToneMapping(e){this.runScene.assetsEx.renderer.toneMapping=w[e]}setExposure(e){this.runScene.assetsEx.renderer.toneMappingExposure=e}getDomSize(){var{width:e,height:t}=this.runScene.assetsEx.get().parentDom.getBoundingClientRect();return{width:e,height:t}}getSizeForRadio(e){var t=this.ratio,{width:n,height:r}=e;if(0===t)return e;let i=n,a=r;return(a=0!==t?i*t:a)>r&&(a=r,i=r/t),{width:i,height:a}}}const x=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()},w={NoToneMapping:y.Z.NoToneMapping,LinearToneMapping:y.Z.LinearToneMapping,ReinhardToneMapping:y.Z.ReinhardToneMapping,CineonToneMapping:y.Z.CineonToneMapping,ACESFilmicToneMapping:y.Z.ACESFilmicToneMapping,CustomToneMapping:y.Z.CustomToneMapping}},5682:(e,t,n)=>{n.d(t,{Gc:()=>Ou,al:()=>et,ch:()=>c,Az:()=>gn,Sf:()=>Au,cQ:()=>u,ZP:()=>Cu}),t={};var r=(n.r(t),n.d(t,{FBXLoader:()=>Xa}),n(3300)),i=n.n(r),a=n(6001),s=n(5521),o=(r=n(4961),n(9576)),l=n(5247),u=n(5317),c=n(3924),d=n(7995);class h extends r.Z{constructor(e){super(e),this.map={},this.clock=new s.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),e.cb.scene.validCloseUpdate.on((()=>0===this.playings.size)),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,c.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const n of e.animations)if(n.name===t)return n.id}parse(e,t){if(0!==e.animations.length||t){const i=e.animations.length?e.animations:o.B.parse(t),l=new s.AnimationMixer(e);for(const t of i){var n=(0,a.getId)(),r=(t.id=n,l.clipAction(t));const i={finished:()=>{},loop:()=>{}};l.addEventListener("finished",(()=>i.finished())),l.addEventListener("loop",(()=>i.loop())),this.map[n]={mixer:l,action:r,model:e,time:0,runState:"close",clip:t,eventMap:i}}i.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,n){e=this.findId(e,t);const r=this.map[e];if(r&&!this.playings.has(r)){t=(0,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},n);const{onProgress:i,onBeforeEnd:a,onLoop:s,onFinished:o,lastFrame:c,loop:d,reset:p}=t,{action:f,clip:m,eventMap:g}=(this.map[e].options=t,r);f.stop(),n=p?0:r.time,f.time=n,this.setPlayState(r,!0),p&&f.reset(),f.play(),r.runState="play",h.callback.play.cb();let v=!1;this.setUpdates(e,(()=>{var e=(0,u.getProgress)(f.time,m.duration,!0);99<=e&&!v&&(a(),v=!0),i(e)})),d?(f.loop=l.Z.LoopRepeat,g.loop=s):(f.clampWhenFinished=c,f.loop=l.Z.LoopOnce,g.finished=()=>{this.setPlayState(r,!1),i(100),o()})}}pause(e,t){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&(this.updateTime(n),this.setPlayState(n,!1),n.options.onPause(),n.runState="pause")}resume(e,t){var n=this.findId(e,t);const r=this.map[n];r&&this.playings.has(r)&&(r.options.onResume(),this.play(e,t,null==(n=this.map[t])?void 0:n.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((n=>{const{mixer:r,action:i}=this.map[n];i.play(),i.time=e,r.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,a.mapObj)(this.updates,((e,n)=>n(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:n}=e;n.reset(),n.stop(),t.time=0}resetItemByName(e,t){if((e=this.findId(e,t))&&(t=this.map[e])){const{mixer:e,action:n}=t;n.reset(),n.stop(),e.time=0}}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,n){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&r.options&&((t=(0,u.mergeObject)({resetAction:!0},n).resetAction)&&r.action.reset(),this.setPlayState(r,!1),this.updateTime(r,0),r.options.onClose(),r.options=null,r.runState="pause",h.callback.close.cb())}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:n,nextName:r,duration:i}=e;e=this.findId(e,t);const a=this.map[e];a&&(t=this.findId(n,r),(e=this.map[t])&&a.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const n=this.getItem(e,t);n&&(n.action.time=0)}}h.callback={play:new d.Z,close:new d.Z};var p=n(9278),f=n(1897),m=n(1794);class g{constructor(e){this.map={material:new m.Z,texture:new m.Z},this.onSet=e=>{var{type:e,id:t,isAdd:n}=e;n?(n=this.map[e].get(t)||0,this.map[e].set(t,++n)):this.map[e].get(t)&&(n=this.map[e].get(t),this.map[e].set(t,--n))},this.runScene=e,this.init()}init(){this.runScene.cb.assets.manager.set.add("AssetsManager",this.onSet)}isUsed(e,t){return void 0!==(e=this.map[e].get(t))&&0<e}}class v{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.parentDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.controlsEx.reset(),this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.manager=new g(e),this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new f.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.width="100%",e.domElement.style.height="100%",e.domElement.style.position="absolute",e.domElement.style.left="0px",e.domElement.style.top="0px",e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),e}initRender2(){const e=new p.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.width="100%",e.domElement.style.height="100%",e.domElement.style.position="absolute",e.domElement.style.left="0px",e.domElement.style.top="0px",e.domElement.classList.add("css2dRenderer"),this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e),this.runScene.controlsEx.reset()}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){this.render2&&e||(e?(this.render2=this.initRender2(),this.runScene.renderEx.setSize()):this.render2&&(this.disposeRender(this.render2),this.render2=null))}setRender3(e){this.render3&&e||(e?(this.render3=this.initRender3(),this.runScene.renderEx.setSize()):this.render3&&(this.disposeRender(this.render3),this.render3=null))}init(e){this.parentDom=e,this.engineDom=this.runScene.renderEx.initOutDom(e),e=this.runScene.sceneEx.create();var t=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(this.engineDom),r=this.runScene.controlsEx.create(t,this.engineDom),{render2:i,render3:a}=this.runScene.optionsEx.options;return this.camera=t,this.scene=e,this.renderer=n,this.controls=r,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(a),{scene:e,camera:t,render:n,controls:r,engineDom:this.engineDom}}get(){var{scene:e,renderer:t,controls:n,engineDom:r,render2:i,render3:a,parentDom:s}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:n,engineDom:r,render2:i,render3:a,parentDom:s}}}var y=n(3801),b=n(6272);class x{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.window={pointerup:e=>{this.events.runScene.cb.events.window.pointer.up.cb({event:e})}},this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.pageX,y:e.pageY}),this.isMove=!0},this.up=e=>{var t,n,r,i;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.pageX,n=e.pageY,({x:r,y:i}=this.downPosition[e.button]),(0,b.nx)(t,r,10)&&(0,b.nx)(n,i,10)&&(0===e.button&&this.trigger(e),2===e.button&&(!this.events.runScene.modelEx.select&&this.events.runScene.multipSelector.isEmpty()&&this.trigger(e),this.events.runScene.cb.events.pointer.rightTrigger.cb(e))))},this.selectable=!0,this.events=e}getEventLocal(e,t){var{top:e,left:n,width:r,height:i}=e.getBoundingClientRect();return{x:(t.pageX-n)/r*2-1,y:-(t.pageY-e)/i*2+1}}init(e){var t=this.events.runScene.optionsEx.options.event.base;let n=e;"dom"===t?n=e:"canvas"===t?n=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(n=window),this.events.addEvent({dom:n,name:"pointerdown",fn:this.down.bind(this)}),this.events.addEvent({dom:window,name:"pointerup",fn:this.up.bind(this)}),this.events.addEvent({dom:n,name:"pointerdown",fn:this.events.runScene.cb.events.pointer.down.cb}),this.events.addEvent({dom:n,name:"pointerup",fn:this.events.runScene.cb.events.pointer.up.cb}),this.events.addEvent({dom:n,name:"pointermove",fn:e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)}}),this.events.addEvent({dom:n,name:"mousemove",fn:this.events.runScene.cb.events.mouse.move.cb}),this.events.addEvent({dom:n,name:"mousedown",fn:this.events.runScene.cb.events.mouse.down.cb}),this.events.addEvent({dom:n,name:"mouseup",fn:this.events.runScene.cb.events.mouse.up.cb}),this.events.addEvent({dom:window,name:"pointerup",fn:this.window.pointerup}),this.events.addEvent({dom:n,name:"wheel",fn:this.events.runScene.cb.events.mouse.wheel.cb})}getTriggerModels(e,t){const n=new s.Raycaster;var{camera:r,scene:i,renderer:a}=this.events.runScene.assetsEx.get(),{x:a,y:e}=this.getEventLocal(a.domElement,e),a=new s.Vector2(a,e);n.setFromCamera(a,r),e=(t||i.children).filter((e=>!!e.clickable||(this.events.runScene.helperEx.isHelper(e)&&!e.userData.id||e.userData.unClick?void 0:e)));const o=n.intersectObjects(e,!0);return this.events.runScene.cb.events.pointer.trigger.cb(o),o.map((e=>{var t,n;return(null==(n=(t=e.object).click)?void 0:n.call(t,e))||e.object}))}removeHideOrLockModel(e){return console.log("Log-- ",e,"models"),this.events.runScene.optionsEx.log(e,"detail"),e.find((e=>{var t;if(e){let n=e;return null!=(t=e.isShow)&&t.call(e)&&(n=e.parent),this.events.runScene.modelEx.deepIsVisible(n)&&!y.zf.isLock(e,!0)&&c.selectableModel.is(e)}}))}set catchTrigger(e){this._catchTrigger=e}get catchTrigger(){var e=this._catchTrigger;return this._catchTrigger=void 0,e}trigger(e){let t=this.removeHideOrLockModel([this.catchTrigger,...this.getTriggerModels(e)]);if(console.log("Log-- ",t,"model"),this.selectable){if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl)return this.enableUp=!1,e=this.events.runScene.modelEx.select,this.events.runScene.modelEx.selectNull(),e&&this.events.runScene.multipSelector.add(e),this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;return e?void e.children.map((e=>{this.events.runScene.multipSelector.add(e,!0,!0)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}x.getCallback=()=>({up:new d.Z});var S=function(e){var t=e.ctx,n=e.width,r=e.x,i=e.y,a=.5*n;(e=e.state)?(i+=.3*a,r-=2):(i+=.4*a,a-=2,n-=2,--r),t.moveTo(r,i),t.lineTo(r+.55*n-1,i),t.lineTo(r+.55*n,i-.35*a),t.lineTo(r+n,i+.5*a),t.lineTo(r+.55*n,i+a+.35*a),t.lineTo(r+.55*n-1,i+a),t.lineTo(r,i+a),t.lineTo(r,i-1),t.lineWidth=2,e?t.fill():t.stroke(),t.beginPath(),t.lineWidth=2,e?t.fill():t.stroke(),t.beginPath()},_=function(e){var t=e.ctx,n=e.width,r=e.height,i=e.x,a=e.y;e.state?(t.beginPath(),t.roundRect(i,a,n,r,.5*n),t.fillStyle="rgb(64,158,255)",t.fill(),t.beginPath(),t.fillStyle="#fff",t.roundRect(i+r,a+.1*r,e=r-.2*r,r-.2*r,.5*e)):(t.roundRect(i,a,n,r,.5*n),t.fillStyle="rgb(108,109,112)",t.fill(),t.beginPath(),t.fillStyle="#fff",t.roundRect(i+.1*r,a+.1*r,e=r-.2*r,r-.2*r,.5*e)),t.fill()},T=function(e){var t=e.x,n=e.y,r=e.width,i=e.ctx;e=e.state,i.strokeStyle=i.fillStyle="rgb(1,165,238)",e?(i.arc(t,n,r,0,2*Math.PI),i.fill()):(i.roundRect(t-r,n-r,2*r,2*r,2*r*.5),i.lineWidth=2,i.stroke(),i.beginPath()),e=t+r+2,t=n-.6*r,n=.6*r,r*=.6,i.moveTo(e,t),i.lineTo(e,t+2*n),i.lineTo(e+n,t+r),i.lineTo(e,t),i.fill()},M=function(e){return E.LINEMAP.type.colorMap[e]||E.EVENT_LINK_COLOR},E={NODE_NAME_MAP:{},VERSION:.4,CANVAS_GRID_SIZE:10,NODE_TITLE_HEIGHT:30,NODE_TITLE_TEXT_Y:20,NODE_SLOT_HEIGHT:20,NODE_WIDGET_HEIGHT:20,NODE_WIDTH:140,NODE_MIN_WIDTH:50,NODE_COLLAPSED_RADIUS:10,NODE_COLLAPSED_WIDTH:80,NODE_TITLE_COLOR:"#999",NODE_SELECTED_TITLE_COLOR:"#FFF",NODE_TEXT_SIZE:14,NODE_TEXT_COLOR:"#AAA",NODE_SUBTEXT_SIZE:12,NODE_DEFAULT_COLOR:"#333",NODE_DEFAULT_BGCOLOR:"#353535",NODE_DEFAULT_BOXCOLOR:"#666",NODE_DEFAULT_SHAPE:"box",NODE_BOX_OUTLINE_COLOR:"#FFF",DEFAULT_SHADOW_COLOR:"rgba(0,0,0,0.5)",DEFAULT_GROUP_FONT:24,WIDGET_BGCOLOR:"#222",WIDGET_OUTLINE_COLOR:"#666",WIDGET_TEXT_COLOR:"#DDD",WIDGET_SECONDARY_TEXT_COLOR:"#999",LINK_COLOR:"#9A9",EVENT_LINK_COLOR:"#A86",CONNECTING_LINK_COLOR:"#AFA",MAX_NUMBER_OF_NODES:5e3,DEFAULT_POSITION:[100,100],VALID_SHAPES:["default","box","round","card"],BOX_SHAPE:1,ROUND_SHAPE:2,CIRCLE_SHAPE:3,CARD_SHAPE:4,ARROW_SHAPE:5,GRID_SHAPE:6,INPUT:1,OUTPUT:2,EVENT:-1,ACTION:-1,NODE_MODES:["Always","On Event","Never","On Trigger"],NODE_MODES_COLORS:["#666","#422","#333","#224","#626"],ALWAYS:0,ON_EVENT:1,NEVER:2,ON_TRIGGER:3,UP:1,DOWN:2,LEFT:3,RIGHT:4,CENTER:5,LINK_RENDER_MODES:["Straight","Linear","Spline"],STRAIGHT_LINK:0,LINEAR_LINK:1,SPLINE_LINK:2,NORMAL_TITLE:0,NO_TITLE:1,TRANSPARENT_TITLE:2,AUTOHIDE_TITLE:3,VERTICAL_LAYOUT:"vertical",proxy:null,node_images_path:"",debug:!1,catch_exceptions:!0,throw_errors:!0,allow_scripts:!1,registered_node_types:{},node_types_by_file_extension:{},Nodes:{},Globals:{},searchbox_extras:{},auto_sort_node_types:!1,node_box_coloured_when_on:!1,node_box_coloured_by_mode:!1,dialog_close_on_mouse_leave:!0,dialog_close_on_mouse_leave_delay:500,shift_click_do_break_link_from:!1,click_do_break_link_to:!1,search_hide_on_mouse_leave:!0,search_filter_enabled:!1,search_show_all_on_open:!0,auto_load_slot_types:!1,registered_slot_in_types:{},registered_slot_out_types:{},slot_types_in:[],slot_types_out:[],slot_types_default_in:[],slot_types_default_out:[],alt_drag_do_clone_nodes:!1,do_add_triggers_slots:!1,allow_multi_output_for_events:!0,middle_click_slot_add_default_node:!1,release_link_on_empty_shows_menu:!1,pointerevents_method:"mouse",registerNodeType:function(e,t){if(!t.prototype)throw"Cannot register a simple object, it must be a class with a prototype";t.type=e,E.debug&&console.log("Node registered: "+e),e.split("/");var n,r=t.name,i=e.lastIndexOf("/");if(t.category=e.substr(0,i),t.title||(t.title=r),t.prototype)for(var a in k.prototype)t.prototype[a]||(t.prototype[a]=k.prototype[a]);if((i=this.registered_node_types[e])&&E.debug)console.log("replacing node type: "+e);else if(Object.hasOwnProperty(t.prototype,"shape")||Object.defineProperty(t.prototype,"shape",{set:function(e){switch(e){case"default":delete this._shape;break;case"box":this._shape=E.BOX_SHAPE;break;case"round":this._shape=E.ROUND_SHAPE;break;case"circle":this._shape=E.CIRCLE_SHAPE;break;case"card":this._shape=E.CARD_SHAPE;break;default:this._shape=e}},get:function(e){return this._shape},enumerable:!0,configurable:!0}),t.prototype.onPropertyChange&&console.warn("LiteGraph node class "+e+" has onPropertyChange method, it must be called onPropertyChanged with d at the end"),t.supported_extensions)for(var a in t.supported_extensions)(n=t.supported_extensions[a])&&n.constructor===String&&(this.node_types_by_file_extension[n.toLowerCase()]=t);if((this.registered_node_types[e]=t).constructor.name&&(this.Nodes[r]=t),E.onNodeTypeRegistered&&E.onNodeTypeRegistered(e,t),i&&E.onNodeTypeReplaced&&E.onNodeTypeReplaced(e,t,i),t.prototype.onPropertyChange&&console.warn("LiteGraph node class "+e+" has onPropertyChange method, it must be called onPropertyChanged with d at the end"),t.supported_extensions)for(a=0;a<t.supported_extensions.length;a++)(n=t.supported_extensions[a])&&n.constructor===String&&(this.node_types_by_file_extension[n.toLowerCase()]=t);this.auto_load_slot_types&&(nodeTmp=new t(t.title||"tmpnode"))},unregisterNodeType:function(e){var t=e.constructor===String?this.registered_node_types[e]:e;if(!t)throw"node type not found: "+e;delete this.registered_node_types[t.type],t.constructor.name&&delete this.Nodes[t.constructor.name]},registerNodeAndSlotType:function(e,t,n){n=n||!1;var r,i=(e.constructor===String&&"anonymous"!==this.registered_node_types[e]?this.registered_node_types[e]:e).constructor.type;r="string"==typeof t?t.split(","):t==this.EVENT||t==this.ACTION?["_event_"]:["*"];for(var a=0;a<r.length;++a){var s=r[a],o=(""===s&&(s="*"),n?"registered_slot_out_types":"registered_slot_in_types");void 0===this[o][s]&&(this[o][s]={nodes:[]}),this[o][s].nodes.push(i),n?this.slot_types_out.includes(s.toLowerCase())||(this.slot_types_out.push(s.toLowerCase()),this.slot_types_out.sort()):this.slot_types_in.includes(s.toLowerCase())||(this.slot_types_in.push(s.toLowerCase()),this.slot_types_in.sort())}},wrapFunctionAsNode:function(e,t,n,r,i){for(var a=Array(t.length),s="",o=E.getParameterNames(t),l=0;l<o.length;++l)s+="this.addInput('"+o[l]+"',"+(n&&n[l]?"'"+n[l]+"'":"0")+");\n";s+="this.addOutput('out',"+(r?"'"+r+"'":0)+");\n",i&&(s+="this.properties = "+JSON.stringify(i)+";\n"),(r=Function(s)).title=e.split("/").pop(),r.desc="Generated from "+t.name,r.prototype.onExecute=function(){for(var e=0;e<a.length;++e)a[e]=this.getInputData(e);var n=t.apply(this,a);this.setOutputData(0,n)},this.registerNodeType(e,r)},clearRegisteredTypes:function(){this.registered_node_types={},this.node_types_by_file_extension={},this.Nodes={},this.searchbox_extras={}},addNodeMethod:function(e,t){for(var n in k.prototype[e]=t,this.registered_node_types)(n=this.registered_node_types[n]).prototype[e]&&(n.prototype["_"+e]=n.prototype[e]),n.prototype[e]=t},createNode:function(e,t,n){var r=this.NODE_NAME_MAP[e];if(!(r=this.registered_node_types[r||e]))return E.debug&&console.log('GraphNode type "'+e+'" not registered.'),null;r.prototype,t=t||r.title||e;var i=null;if(E.catch_exceptions)try{i=new r(t)}catch(e){return console.error(e),null}else i=new r(t);if(i.type=e,!i.title&&t&&(i.title=t),i.properties||(i.properties={}),i.properties_info||(i.properties_info=[]),i.flags||(i.flags={}),i.size||(i.size=i.computeSize()),i.pos||(i.pos=E.DEFAULT_POSITION.concat()),i.mode||(i.mode=E.ALWAYS),n)for(var a in n)i[a]=n[a];return i.onNodeCreated&&i.onNodeCreated(),i},getNodeType:function(e){return this.registered_node_types[e]},getNodeTypesInCategory:function(e,t){var n,r=[];for(n in this.registered_node_types){var i=this.registered_node_types[n];i.filter==t&&(""==e?null==i.category&&r.push(i):i.category==e&&r.push(i))}return this.auto_sort_node_types&&r.sort((function(e,t){return e.title.localeCompare(t.title)})),r},getNodeTypesCategories:function(e){var t={"":1};for(r in this.registered_node_types){var n=this.registered_node_types[r];n.category&&!n.skip_list&&n.filter==e&&(t[n.category]=1)}var r,i=[];for(r in t)i.push(r);return this.auto_sort_node_types?i.sort():i},reloadNodes:function(e){for(var t=document.getElementsByTagName("script"),n=[],r=0;r<t.length;r++)n.push(t[r]);var i=document.getElementsByTagName("head")[0];for(e=document.location.href+e,r=0;r<n.length;r++){var a=n[r].src;if(a&&a.substr(0,e.length)==e)try{E.debug&&console.log("Reloading: "+a);var s=document.createElement("script");s.type="text/javascript",s.src=a,i.appendChild(s),i.removeChild(n[r])}catch(e){if(E.throw_errors)throw e;E.debug&&console.log("Error while reloading "+a)}}E.debug&&console.log("Nodes reloaded")},cloneObject:function(e,t){if(null==e)return null;var n,r=JSON.parse(JSON.stringify(e));if(!t)return r;for(n in r)t[n]=r[n];return t},isValidConnection:function(e,t){if(""!=t&&"*"!==t||(t=0),!(e=""!=e&&"*"!==e?e:0)||!t||e==t||e==E.EVENT&&t==E.ACTION)return!0;if(e=String(e),t=String(t),e=e.toLowerCase(),t=t.toLowerCase(),-1==e.indexOf(",")&&-1==t.indexOf(","))return e==t;for(var n=e.split(","),r=t.split(","),i=0;i<n.length;++i)for(var a=0;a<r.length;++a)if(this.isValidConnection(n[i],r[a]))return!0;return!1},registerSearchboxExtra:function(e,t,n){this.searchbox_extras[t.toLowerCase()]={type:e,desc:t,data:n}},fetchFile:function(e,t,n,r){if(!e)return null;if(t=t||"text",e.constructor===String)return"http"==e.substr(0,4)&&E.proxy&&(e=E.proxy+e.substr(e.indexOf(":")+3)),fetch(e).then((function(e){if(e.ok)return"arraybuffer"==t?e.arrayBuffer():"text"==t||"string"==t?e.text():"json"==t?e.json():"blob"==t?e.blob():void 0;throw new Error("File not found")})).then((function(e){n&&n(e)})).catch((function(t){console.error("error fetching file:",e),r&&r(t)}));if(e.constructor===File||e.constructor===Blob){var i=new FileReader;if(i.onload=function(e){e=e.target.result,"json"==t&&(e=JSON.parse(e)),n&&n(e)},"arraybuffer"==t)return i.readAsArrayBuffer(e);if("text"==t||"json"==t)return i.readAsText(e);if("blob"==t)return i.readAsBinaryString(e)}return null}};function D(e){E.debug&&console.log("Graph created"),this.list_of_graphcanvas=null,this.clear(),e&&this.configure(e)}function P(e,t,n,r,i,a){this.id=e,this.type=t,this.origin_id=n,this.origin_slot=r,this.target_id=i,this.target_slot=a,this._data=null,this._pos=new Float32Array(2)}function k(e){this._ctor(e)}function O(e){this._ctor(e)}function A(e,t){this.offset=new Float32Array([0,0]),this.scale=1,this.max_scale=10,this.min_scale=.05,this.onredraw=null,this.enabled=!0,this.last_mouse=[0,0],this.element=null,this.visible_area=new Float32Array(4),e&&(this.element=e,t||this.bindEvents(e))}function C(e,t,n){this.options=n=n||{},this.background_image=C.DEFAULT_BACKGROUND_IMAGE,e&&e.constructor===String&&(e=document.querySelector(e)),this.ds=new A,this.zoom_modify_alpha=!0,this.title_text_font=E.NODE_TEXT_SIZE+"px Arial",this.inner_text_font="normal "+E.NODE_SUBTEXT_SIZE+"px Arial",this.node_title_color=E.NODE_TITLE_COLOR,this.default_link_color=E.LINK_COLOR,this.default_connection_color={input_off:"#778",input_on:E.EVENT_LINK_COLOR,output_off:"#778",output_on:E.EVENT_LINK_COLOR},this.default_connection_color_byType={},this.default_connection_color_byTypeOff={},this.highquality_render=!0,this.use_gradients=!1,this.editor_alpha=1,this.pause_rendering=!1,this.clear_background=!0,this.read_only=!1,this.render_only_selected=!0,this.live_mode=!1,this.show_info=!0,this.allow_dragcanvas=!0,this.allow_dragnodes=!0,this.allow_interaction=!0,this.allow_searchbox=!0,this.allow_reconnect_links=!0,this.align_to_grid=!1,this.drag_mode=!1,this.dragging_rectangle=null,this.filter=null,this.set_canvas_dirty_on_mouse_event=!0,this.always_render_background=!1,this.render_shadows=!0,this.render_canvas_border=!0,this.render_connections_shadows=!1,this.render_connections_border=!0,this.render_curved_connections=!1,this.render_connection_arrows=!1,this.render_collapsed_slots=!0,this.render_execution_order=!1,this.render_title_colored=!0,this.render_link_tooltip=!0,this.links_render_mode=E.SPLINE_LINK,this.mouse=[0,0],this.graph_mouse=[0,0],this.canvas_mouse=this.graph_mouse,this.onSearchBox=null,this.onSearchBoxSelection=null,this.onMouse=null,this.onDrawBackground=null,this.onDrawForeground=null,this.onDrawOverlay=null,this.onDrawLinkTooltip=null,this.onNodeMoved=null,this.onSelectionChange=null,this.onConnectingChange=null,this.onBeforeChange=null,this.onAfterChange=null,this.connections_width=3,this.round_radius=8,this.current_node=null,this.node_widget=null,this.over_link_center=null,this.last_mouse_position=[0,0],this.visible_area=this.ds.visible_area,this.visible_links=[],this.viewport=n.viewport||null,t&&t.attachCanvas(this),this.setCanvas(e,n.skip_events),this.clear(),n.skip_render||this.startRendering(),this.autoresize=n.autoresize}"undefined"!=typeof performance?E.getTime=performance.now.bind(performance):"undefined"!=typeof Date&&Date.now?E.getTime=Date.now.bind(Date):"undefined"!=typeof process?E.getTime=function(){var e=process.hrtime();return.001*e[0]+1e-6*e[1]}:E.getTime=function(){return(new Date).getTime()},D.supported_types=["number","string","boolean"],D.prototype.getSupportedTypes=function(){return this.supported_types||D.supported_types},D.STATUS_STOPPED=1,D.STATUS_RUNNING=2,D.prototype.clear=function(){if(this.stop(),this.status=D.STATUS_STOPPED,this.last_node_id=0,this.last_link_id=0,this._version=-1,this._nodes)for(var e=0;e<this._nodes.length;++e){var t=this._nodes[e];t.onRemoved&&t.onRemoved()}this._nodes=[],this._nodes_by_id={},this._nodes_in_order=[],this._nodes_executable=null,this._groups=[],this.links={},this.iteration=0,this.config={},this.vars={},this.extra={},this.globaltime=0,this.runningtime=0,this.fixedtime=0,this.fixedtime_lapse=.01,this.elapsed_time=.01,this.last_update_time=0,this.starttime=0,this.catch_errors=!0,this.nodes_executing=[],this.nodes_actioning=[],this.nodes_executedAction=[],this.inputs={},this.outputs={},this.change(),this.sendActionToCanvas("clear")},D.prototype.attachCanvas=function(e){if(e.constructor!=C)throw"attachCanvas expects a LGraphCanvas instance";e.graph&&e.graph!=this&&e.graph.detachCanvas(e),(e.graph=this).list_of_graphcanvas||(this.list_of_graphcanvas=[]),this.list_of_graphcanvas.push(e)},D.prototype.detachCanvas=function(e){var t;!this.list_of_graphcanvas||-1!=(t=this.list_of_graphcanvas.indexOf(e))&&(e.graph=null,this.list_of_graphcanvas.splice(t,1))},D.prototype.start=function(e){var t,n;this.status!=D.STATUS_RUNNING&&(this.status=D.STATUS_RUNNING,this.onPlayEvent&&this.onPlayEvent(),this.sendEventToAllNodes("onStart"),this.starttime=E.getTime(),this.last_update_time=this.starttime,t=this,0==(e=e||0)&&"undefined"!=typeof window&&window.requestAnimationFrame?(n=function e(){-1==t.execution_timer_id&&(window.requestAnimationFrame(e),t.onBeforeStep&&t.onBeforeStep(),t.runStep(1,!t.catch_errors),t.onAfterStep&&t.onAfterStep())},this.execution_timer_id=-1,n()):this.execution_timer_id=setInterval((function(){t.onBeforeStep&&t.onBeforeStep(),t.runStep(1,!t.catch_errors),t.onAfterStep&&t.onAfterStep()}),e))},D.prototype.stop=function(){this.status!=D.STATUS_STOPPED&&(this.status=D.STATUS_STOPPED,this.onStopEvent&&this.onStopEvent(),null!=this.execution_timer_id&&(-1!=this.execution_timer_id&&clearInterval(this.execution_timer_id),this.execution_timer_id=null),this.sendEventToAllNodes("onStop"),this.sendEventToAllNodes("onGraphStop"))},D.prototype.runStep=function(e,t,n){e=e||1;var r=E.getTime(),i=(this.globaltime=.001*(r-this.starttime),this._nodes_executable||this._nodes);if(i){if(n=n||i.length,t){for(var a=0;a<e;a++){for(var s=0;s<n;++s)(o=i[s]).mode==E.ALWAYS&&o.onExecute&&o.doExecute();this.fixedtime+=this.fixedtime_lapse,this.onExecuteStep&&this.onExecuteStep()}this.onAfterExecute&&this.onAfterExecute()}else try{for(a=0;a<e;a++){var o;for(s=0;s<n;++s)(o=i[s]).mode==E.ALWAYS&&o.onExecute&&o.onExecute();this.fixedtime+=this.fixedtime_lapse,this.onExecuteStep&&this.onExecuteStep()}this.onAfterExecute&&this.onAfterExecute(),this.errors_in_execution=!1}catch(e){if(this.errors_in_execution=!0,E.throw_errors)throw e;E.debug&&console.log("Error during execution: "+e),this.stop()}r=(t=E.getTime())-r,this.execution_time=.001*(r=0==r?1:r),this.globaltime+=.001*r,this.iteration+=1,this.elapsed_time=.001*(t-this.last_update_time),this.last_update_time=t,this.nodes_executing=[],this.nodes_actioning=[],this.nodes_executedAction=[]}},D.prototype.updateExecutionOrder=function(){this._nodes_in_order=this.computeExecutionOrder(!1),this._nodes_executable=[];for(var e=0;e<this._nodes_in_order.length;++e)this._nodes_in_order[e].onExecute&&this._nodes_executable.push(this._nodes_in_order[e])},D.prototype.computeExecutionOrder=function(e,t){for(var n=[],r=[],i={},a={},s={},o=0,l=this._nodes.length;o<l;++o){var u=this._nodes[o];if(!e||u.onExecute){var c=0;if((i[u.id]=u).inputs)for(var d=0,h=u.inputs.length;d<h;d++)u.inputs[d]&&null!=u.inputs[d].link&&(c+=1);0==c?(r.push(u),t&&(u._level=1)):(t&&(u._level=0),s[u.id]=c)}}for(;0!=r.length;)if(u=r.shift(),n.push(u),delete i[u.id],u.outputs)for(o=0;o<u.outputs.length;o++){var p=u.outputs[o];if(null!=p&&null!=p.links&&0!=p.links.length)for(d=0;d<p.links.length;d++){var f,m=p.links[d];!(m=this.links[m])||a[m.id]||(null==(f=this.getNodeById(m.target_id))?a[m.id]=!0:(t&&(!f._level||f._level<=u._level)&&(f._level=u._level+1),a[m.id]=!0,--s[f.id],0==s[f.id]&&r.push(f)))}}for(o in i)n.push(i[o]);for(n.length!=this._nodes.length&&E.debug&&console.warn("something went wrong, nodes missing"),l=n.length,o=0;o<l;++o)n[o].order=o;for(n=n.sort((function(e,t){var n=e.constructor.priority||e.priority||0,r=t.constructor.priority||t.priority||0;return n==r?e.order-t.order:n-r})),o=0;o<l;++o)n[o].order=o;return n},D.prototype.getAncestors=function(e){for(var t=[],n=[e],r={};n.length;){var i=n.shift();if(i.inputs){r[i.id]||i==e||(r[i.id]=!0,t.push(i));for(var a=0;a<i.inputs.length;++a){var s=i.getInputNode(a);s&&-1==t.indexOf(s)&&n.push(s)}}}return t.sort((function(e,t){return e.order-t.order})),t},D.prototype.arrange=function(e,t){e=e||100;for(var n=this.computeExecutionOrder(!1,!0),r=[],i=0;i<n.length;++i){var a=(d=n[i])._level||1;r[a]||(r[a]=[]),r[a].push(d)}var s=e;for(i=0;i<r.length;++i){var o=r[i];if(o){for(var l=100,u=e+E.NODE_TITLE_HEIGHT,c=0;c<o.length;++c){(d=o[c]).pos[0]=t==E.VERTICAL_LAYOUT?u:s,d.pos[1]=t==E.VERTICAL_LAYOUT?s:u;var d,h=t==E.VERTICAL_LAYOUT?1:0;d.size[h]>l&&(l=d.size[h]),h=t==E.VERTICAL_LAYOUT?0:1,u+=d.size[h]+e+E.NODE_TITLE_HEIGHT}s+=l+e}}this.setDirtyCanvas(!0,!0)},D.prototype.getTime=function(){return this.globaltime},D.prototype.getFixedTime=function(){return this.fixedtime},D.prototype.getElapsedTime=function(){return this.elapsed_time},D.prototype.sendEventToAllNodes=function(e,t,n){n=n||E.ALWAYS;var r=this._nodes_in_order||this._nodes;if(r)for(var i=0,a=r.length;i<a;++i){var s=r[i];s.constructor===E.Subgraph&&"onExecute"!=e?s.mode==n&&s.sendEventToAllNodes(e,t,n):s[e]&&s.mode==n&&(void 0===t?s[e]():t&&t.constructor===Array?s[e].apply(s,t):s[e](t))}},D.prototype.sendActionToCanvas=function(e,t){if(this.list_of_graphcanvas)for(var n=0;n<this.list_of_graphcanvas.length;++n){var r=this.list_of_graphcanvas[n];r[e]&&r[e].apply(r,t)}},D.prototype.add=function(e,t){if(e){if(e.constructor===O)return this._groups.push(e),this.setDirtyCanvas(!0),this.change(),void(e.graph=this)._version++;if(-1!=e.id&&null!=this._nodes_by_id[e.id]&&(console.warn("LiteGraph: there is already a node with this ID, changing it"),e.id=++this.last_node_id),this._nodes.length>=E.MAX_NUMBER_OF_NODES)throw"LiteGraph: max number of nodes in a graph reached";return null==e.id||-1==e.id?e.id=++this.last_node_id:this.last_node_id<e.id&&(this.last_node_id=e.id),(e.graph=this)._version++,this._nodes.push(e),(this._nodes_by_id[e.id]=e).onAdded&&e.onAdded(this),this.config.align_to_grid&&e.alignToGrid(),t||this.updateExecutionOrder(),this.onNodeAdded&&this.onNodeAdded(e),this.setDirtyCanvas(!0),this.change(),e}},D.prototype.remove=function(e){if(e.constructor===O)return-1!=(i=this._groups.indexOf(e))&&this._groups.splice(i,1),e.graph=null,this._version++,this.setDirtyCanvas(!0,!0),void this.change();if(null!=this._nodes_by_id[e.id]&&!e.ignore_remove){if(this.beforeChange(),e.inputs)for(var t=0;t<e.inputs.length;t++)null!=(n=e.inputs[t]).link&&e.disconnectInput(t);var n;if(e.outputs)for(t=0;t<e.outputs.length;t++)null!=(n=e.outputs[t]).links&&n.links.length&&e.disconnectOutput(t);if(e.onRemoved&&e.onRemoved(),e.graph=null,this._version++,this.list_of_graphcanvas)for(t=0;t<this.list_of_graphcanvas.length;++t){var r=this.list_of_graphcanvas[t];r.selected_nodes[e.id]&&delete r.selected_nodes[e.id],r.node_dragged==e&&(r.node_dragged=null)}var i=this._nodes.indexOf(e);-1!=i&&this._nodes.splice(i,1),delete this._nodes_by_id[e.id],this.onNodeRemoved&&this.onNodeRemoved(e),this.sendActionToCanvas("checkPanels"),this.setDirtyCanvas(!0,!0),this.afterChange(),this.change(),this.updateExecutionOrder()}},D.prototype.getNodeById=function(e){return null==e?null:this._nodes_by_id[e]},D.prototype.findNodesByClass=function(e,t){for(var n=(t=t||[]).length=0,r=this._nodes.length;n<r;++n)this._nodes[n].constructor===e&&t.push(this._nodes[n]);return t},D.prototype.findNodesByType=function(e,t){e=e.toLowerCase();for(var n=(t=t||[]).length=0,r=this._nodes.length;n<r;++n)this._nodes[n].type.toLowerCase()==e&&t.push(this._nodes[n]);return t},D.prototype.findNodeByTitle=function(e){for(var t=0,n=this._nodes.length;t<n;++t)if(this._nodes[t].title==e)return this._nodes[t];return null},D.prototype.findNodesByTitle=function(e){for(var t=[],n=0,r=this._nodes.length;n<r;++n)this._nodes[n].title==e&&t.push(this._nodes[n]);return t},D.prototype.getNodeOnPos=function(e,t,n,r){for(var i=(n=n||this._nodes).length-1;0<=i;i--){var a=n[i];if(a.isPointInside(e,t,r))return a}return null},D.prototype.getGroupOnPos=function(e,t){for(var n=this._groups.length-1;0<=n;n--){var r=this._groups[n];if(r.isPointInside(e,t,2,!0))return r}return null},D.prototype.checkNodeTypes=function(){for(var e=0;e<this._nodes.length;e++){var t=this._nodes[e],n=E.registered_node_types[t.type];t.constructor!=n&&(console.log("node being replaced by newer version: "+t.type),n=E.createNode(t.type),(this._nodes[e]=n).configure(t.serialize()),(n.graph=this)._nodes_by_id[n.id]=n,t.inputs&&(n.inputs=t.inputs.concat()),t.outputs&&(n.outputs=t.outputs.concat()))}this.updateExecutionOrder()},D.prototype.onAction=function(e,t,n){this._input_nodes=this.findNodesByClass(E.GraphInput,this._input_nodes);for(var r=0;r<this._input_nodes.length;++r){var i=this._input_nodes[r];if(i.properties.name==e){i.actionDo(e,t,n);break}}},D.prototype.trigger=function(e,t){this.onTrigger&&this.onTrigger(e,t)},D.prototype.addInput=function(e,t,n){this.inputs[e]||(this.beforeChange(),this.inputs[e]={name:e,type:t,value:n},this._version++,this.afterChange(),this.onInputAdded&&this.onInputAdded(e,t),this.onInputsOutputsChange&&this.onInputsOutputsChange())},D.prototype.setInputData=function(e,t){(e=this.inputs[e])&&(e.value=t)},D.prototype.getInputData=function(e){return(e=this.inputs[e])?e.value:null},D.prototype.renameInput=function(e,t){if(t!=e)return!!this.inputs[e]&&(this.inputs[t]?(console.error("there is already one input with that name"),!1):(this.inputs[t]=this.inputs[e],delete this.inputs[e],this._version++,this.onInputRenamed&&this.onInputRenamed(e,t),void(this.onInputsOutputsChange&&this.onInputsOutputsChange())))},D.prototype.changeInputType=function(e,t){if(!this.inputs[e])return!1;this.inputs[e].type&&String(this.inputs[e].type).toLowerCase()==String(t).toLowerCase()||(this.inputs[e].type=t,this._version++,this.onInputTypeChanged&&this.onInputTypeChanged(e,t))},D.prototype.removeInput=function(e){return!!this.inputs[e]&&(delete this.inputs[e],this._version++,this.onInputRemoved&&this.onInputRemoved(e),this.onInputsOutputsChange&&this.onInputsOutputsChange(),!0)},D.prototype.addOutput=function(e,t,n){this.outputs[e]={name:e,type:t,value:n},this._version++,this.onOutputAdded&&this.onOutputAdded(e,t),this.onInputsOutputsChange&&this.onInputsOutputsChange()},D.prototype.setOutputData=function(e,t){(e=this.outputs[e])&&(e.value=t)},D.prototype.getOutputData=function(e){return(e=this.outputs[e])?e.value:null},D.prototype.renameOutput=function(e,t){return!!this.outputs[e]&&(this.outputs[t]?(console.error("there is already one output with that name"),!1):(this.outputs[t]=this.outputs[e],delete this.outputs[e],this._version++,this.onOutputRenamed&&this.onOutputRenamed(e,t),void(this.onInputsOutputsChange&&this.onInputsOutputsChange())))},D.prototype.changeOutputType=function(e,t){if(!this.outputs[e])return!1;this.outputs[e].type&&String(this.outputs[e].type).toLowerCase()==String(t).toLowerCase()||(this.outputs[e].type=t,this._version++,this.onOutputTypeChanged&&this.onOutputTypeChanged(e,t))},D.prototype.removeOutput=function(e){return!!this.outputs[e]&&(delete this.outputs[e],this._version++,this.onOutputRemoved&&this.onOutputRemoved(e),this.onInputsOutputsChange&&this.onInputsOutputsChange(),!0)},D.prototype.triggerInput=function(e,t){for(var n=this.findNodesByTitle(e),r=0;r<n.length;++r)n[r].onTrigger(t)},D.prototype.setCallback=function(e,t){for(var n=this.findNodesByTitle(e),r=0;r<n.length;++r)n[r].setTrigger(t)},D.prototype.beforeChange=function(e){this.onBeforeChange&&this.onBeforeChange(this,e),this.sendActionToCanvas("onBeforeChange",this)},D.prototype.afterChange=function(e){this.onAfterChange&&this.onAfterChange(this,e),this.sendActionToCanvas("onAfterChange",this)},D.prototype.connectionChange=function(e,t){this.updateExecutionOrder(),this.onConnectionChange&&this.onConnectionChange(e),this._version++,this.sendActionToCanvas("onConnectionChange")},D.prototype.isLive=function(){if(!this.list_of_graphcanvas)return!1;for(var e=0;e<this.list_of_graphcanvas.length;++e)if(this.list_of_graphcanvas[e].live_mode)return!0;return!1},D.prototype.clearTriggeredSlots=function(){for(var e in this.links)(e=this.links[e])&&e._last_time&&(e._last_time=0)},D.prototype.change=function(){E.debug&&console.log("Graph changed"),this.sendActionToCanvas("setDirty",[!0,!0]),this.on_change&&this.on_change(this)},D.prototype.setDirtyCanvas=function(e,t){this.sendActionToCanvas("setDirty",[e,t])},D.prototype.removeLink=function(e){var t;!(e=this.links[e])||(t=this.getNodeById(e.target_id))&&t.disconnectInput(e.target_slot)},D.prototype.serialize=function(){for(var e=[],t=0,n=this._nodes.length;t<n;++t)e.push(this._nodes[t].serialize());var r=[];for(t in this.links){var i=this.links[t];if(!i.serialize){console.warn("weird LLink bug, link info is not a LLink but a regular object");var a,s=new P;for(a in i)s[a]=i[a];i=this.links[t]=s}r.push(i.serialize())}var o=[];for(t=0;t<this._groups.length;++t)o.push(this._groups[t].serialize());var l={last_node_id:this.last_node_id,last_link_id:this.last_link_id,nodes:e,links:r,groups:o,config:this.config,extra:this.extra,version:E.VERSION};return this.onSerialize&&this.onSerialize(l),l},D.prototype.configure=function(e,t){if(e){t||this.clear();var n=e.nodes;if(e.links&&e.links.constructor===Array){for(var r=[],i=0;i<e.links.length;++i){var a,s=e.links[i];s?((a=new P).configure(s),r[a.id]=a):console.warn("serialized graph link data contains errors, skipping.")}e.links=r}for(i in e)"nodes"!=i&&"groups"!=i&&(this[i]=e[i]);var o=!1;if(this._nodes=[],n){i=0;for(var l=n.length;i<l;++i){var u=n[i];(c=E.createNode(u.type,u.title))||(E.debug&&console.log("Node not found or has errors: "+u.type),(c=new k).last_serialization=u,o=c.has_errors=!0),c.id=u.id,this.add(c,!0)}for(i=0,l=n.length;i<l;++i){var c;u=n[i],(c=this.getNodeById(u.id))&&c.configure(u)}}if(this._groups.length=0,e.groups)for(i=0;i<e.groups.length;++i){var d=new O;d.configure(e.groups[i]),this.add(d)}return this.updateExecutionOrder(),this.extra=e.extra||{},this.onConfigure&&this.onConfigure(e),this._version++,this.setDirtyCanvas(!0,!0),o}},D.prototype.load=function(e,t){var n,r=this;if(e.constructor===File||e.constructor===Blob)return(n=new FileReader).addEventListener("load",(function(e){e=JSON.parse(e.target.result),r.configure(e),t&&t()})),void n.readAsText(e);var i=new XMLHttpRequest;i.open("GET",e,!0),i.send(null),i.onload=function(e){var n;200!==i.status?console.error("Error loading graph:",i.status,i.response):(n=JSON.parse(i.response),r.configure(n),t&&t())},i.onerror=function(e){console.error("Error loading graph:",e)}},D.prototype.onNodeTrace=function(e,t,n){},P.prototype.configure=function(e){return e.constructor===Array?(this.id=e[0],this.origin_id=e[1],this.origin_slot=e[2],this.target_id=e[3],this.target_slot=e[4],this.type=e[5]):(this.id=e.id,this.type=e.type,this.origin_id=e.origin_id,this.origin_slot=e.origin_slot,this.target_id=e.target_id,this.target_slot=e.target_slot),this},P.prototype.serialize=function(){return[this.id,this.origin_id,this.origin_slot,this.target_id,this.target_slot,this.type]},E.LLink=P,k.prototype._ctor=function(e){this.title=e||"Unnamed",this.size=[E.NODE_WIDTH,60],this.graph=null,this._pos=new Float32Array(10,10),Object.defineProperty(this,"pos",{set:function(e){!e||e.length<2||(this._pos[0]=e[0],this._pos[1]=e[1])},get:function(){return this._pos},enumerable:!0}),this.id=-1,this.type=null,this.inputs=[],this.outputs=[],this.connections=[],this.properties={},this.properties_info=[],this.flags={}},k.prototype.configure=function(e,t){var n,r=this;for(u in this.graph&&this.graph._version++,null!=(n=e.inputs)&&n.map((function(e,t){var n=r.inputs.find((function(t){return t.name===e.name})),i=(n||r.inputs.push(e),r.onInputAdded&&r.onInputAdded(e),r.graph?r.graph.links[e.link]:null);r.onConnectionsChange&&r.onConnectionsChange(E.INPUT,t,!0,i,n||e)})),null!=(n=e.outputs)&&n.map((function(e,t){var n=r.outputs.find((function(t){return t.name===e.name}));if(n||r.outputs.push(e),r.onOutputAdded&&r.onOutputAdded(e),e.links)for(var i=0;i<e.links.length;++i){var a=r.graph?r.graph.links[e.links[i]]:null;r.onConnectionsChange&&r.onConnectionsChange(E.OUTPUT,t,!0,a,n||e)}})),null!=(n=e.widgets)&&n.map((function(e){delete e.y})),delete e.inputs,delete e.outputs,e)if("properties"==u)for(var i in e.properties)this.properties[i]=e.properties[i],this.onPropertyChanged&&this.onPropertyChanged(i,e.properties[i]);else null!=e[u]&&("object"==w(e[u])?this[u]&&this[u].configure?this[u].configure(e[u]):this[u]=E.cloneObject(e[u],this[u]):this[u]=e[u]);if(e.title||(this.title=this.constructor.title),this.inputs&&(null==t||!t.keepLink))for(var a=0;a<this.inputs.length;++a){var s=this.inputs[a],o=this.graph?this.graph.links[s.link]:null;this.onConnectionsChange&&this.onConnectionsChange(E.INPUT,a,!0,o,s)}if(this.outputs&&(null==t||!t.keepLink))for(a=0;a<this.outputs.length;++a){var l=this.outputs[a];if(l.links)for(var u=0;u<l.links.length;++u)o=this.graph?this.graph.links[l.links[u]]:null,this.onConnectionsChange&&this.onConnectionsChange(E.OUTPUT,a,!0,o,l)}if(this.widgets){for(a=0;a<this.widgets.length;++a){var c=this.widgets[a];c&&c.options&&c.options.property&&this.properties[c.options.property]&&(c.value=JSON.parse(JSON.stringify(this.properties[c.options.property])))}if(e.widgets_values)for(a=0;a<e.widgets_values.length;++a)this.widgets[a]&&(this.widgets[a].value=e.widgets_values[a])}this.onConfigure&&this.onConfigure(e)},k.prototype.serialize=function(){var e={id:this.id,type:this.type,pos:this.pos,size:this.size,flags:E.cloneObject(this.flags),order:this.order,mode:this.mode};if(this.constructor===k&&this.last_serialization)return this.last_serialization;if(this.inputs&&(e.inputs=this.inputs),this.outputs){for(var t=0;t<this.outputs.length;t++)delete this.outputs[t]._data;e.outputs=this.outputs}if(this.title&&this.title!=this.constructor.title&&(e.title=this.title),this.properties&&(e.properties=E.cloneObject(this.properties)),this.widgets&&this.serialize_widgets)for(e.widgets_values=[],t=0;t<this.widgets.length;++t)this.widgets[t]?e.widgets_values[t]=this.widgets[t].value:e.widgets_values[t]=null;return e.type||(e.type=this.constructor.type),this.color&&(e.color=this.color),this.bgcolor&&(e.bgcolor=this.bgcolor),this.boxcolor&&(e.boxcolor=this.boxcolor),this.shape&&(e.shape=this.shape),this.onSerialize&&this.onSerialize(e)&&console.warn("node onSerialize shouldnt return anything, data should be stored in the object pass in the first parameter"),e},k.prototype.clone=function(){var e=E.createNode(this.type);if(!e)return null;var t=E.cloneObject(this.serialize());if(t.inputs)for(var n=0;n<t.inputs.length;++n)t.inputs[n].link=null;if(t.outputs)for(n=0;n<t.outputs.length;++n)t.outputs[n].links&&(t.outputs[n].links.length=0);return delete t.id,e.configure(t),e},k.prototype.toString=function(){return JSON.stringify(this.serialize())},k.prototype.getTitle=function(){return this.title||this.constructor.title},k.prototype.setProperty=function(e,t){if(this.properties||(this.properties={}),t!==this.properties[e]){var n=this.properties[e];if(this.properties[e]=t,this.onPropertyChanged&&!1===this.onPropertyChanged(e,t,n)&&(this.properties[e]=n),this.widgets)for(var r=0;r<this.widgets.length;++r){var i=this.widgets[r];if(i&&i.options.property==e){i.value=t;break}}}},k.prototype.setOutputData=function(e,t){if(this.outputs&&!(-1==e||e>=this.outputs.length)){var n=this.outputs[e];if(n&&(n._data=t,this.outputs[e].links))for(var r=0;r<this.outputs[e].links.length;r++){var i=this.outputs[e].links[r];(i=this.graph.links[i])&&(i.data=t)}}},k.prototype.setOutputDataType=function(e,t){if(this.outputs&&!(-1==e||e>=this.outputs.length)){var n=this.outputs[e];if(n&&(n.type=t,this.outputs[e].links))for(var r=0;r<this.outputs[e].links.length;r++){var i=this.outputs[e].links[r];this.graph.links[i].type=t}}},k.prototype.getInputData=function(e,t){if(this.inputs&&!(e>=this.inputs.length||null==this.inputs[e].link))return e=this.inputs[e].link,(e=this.graph.links[e])?t&&(t=this.graph.getNodeById(e.origin_id))?(t.updateOutputData?t.updateOutputData(e.origin_slot):t.onExecute&&t.onExecute(),e.data):e.data:null},k.prototype.getInputDataType=function(e){if(!this.inputs)return null;if(e>=this.inputs.length||null==this.inputs[e].link)return null;if(e=this.inputs[e].link,!(e=this.graph.links[e]))return null;var t=this.graph.getNodeById(e.origin_id);return t?(t=t.outputs[e.origin_slot])?t.type:null:e.type},k.prototype.getInputDataByName=function(e,t){return-1==(e=this.findInputSlot(e))?null:this.getInputData(e,t)},k.prototype.isInputConnected=function(e){return!!this.inputs&&e<this.inputs.length&&null!=this.inputs[e].link},k.prototype.getInputInfo=function(e){return this.inputs&&e<this.inputs.length?this.inputs[e]:null},k.prototype.getInputLink=function(e){return this.inputs&&e<this.inputs.length?(e=this.inputs[e],this.graph.links[e.link]):null},k.prototype.getInputNode=function(e){return this.inputs?e>=this.inputs.length?null:(e=this.inputs[e])&&null!==e.link&&(e=this.graph.links[e.link])?this.graph.getNodeById(e.origin_id):null:null},k.prototype.getInputOrProperty=function(e){if(!this.inputs||!this.inputs.length)return this.properties?this.properties[e]:null;for(var t=0,n=this.inputs.length;t<n;++t){var r=this.inputs[t];if(e==r.name&&null!=r.link&&(r=this.graph.links[r.link]))return r.data}return this.properties[e]},k.prototype.getOutputData=function(e){return!this.outputs||e>=this.outputs.length?null:this.outputs[e]._data},k.prototype.getOutputInfo=function(e){return this.outputs&&e<this.outputs.length?this.outputs[e]:null},k.prototype.isOutputConnected=function(e){return!!this.outputs&&e<this.outputs.length&&this.outputs[e].links&&this.outputs[e].links.length},k.prototype.isAnyOutputConnected=function(){if(!this.outputs)return!1;for(var e=0;e<this.outputs.length;++e)if(this.outputs[e].links&&this.outputs[e].links.length)return!0;return!1},k.prototype.getOutputNodes=function(e){if(!this.outputs||0==this.outputs.length)return null;if(e>=this.outputs.length)return null;var t=this.outputs[e];if(!t.links||0==t.links.length)return null;for(var n=[],r=0;r<t.links.length;r++){var i=t.links[r];!(i=this.graph.links[i])||(i=this.graph.getNodeById(i.target_id))&&n.push(i)}return n},k.prototype.getOutputNodeAndLinks=function(e){if(!this.outputs||0==this.outputs.length)return null;if(e>=this.outputs.length)return null;var t=this.outputs[e];if(!t.links||0==t.links.length)return null;for(var n=[],r=0;r<t.links.length;r++){var i,a=t.links[r];!(a=this.graph.links[a])||(i=this.graph.getNodeById(a.target_id))&&n.push({node:i,link:a})}return n},k.prototype.addOnTriggerInput=function(){var e=this.findInputSlot("onTrigger");return-1==e?(this.addInput("onTrigger",E.EVENT,{optional:!0,nameLocked:!0}),this.findInputSlot("onTrigger")):e},k.prototype.addOnExecutedOutput=function(){var e=this.findOutputSlot("onExecuted");return-1==e?(this.addOutput("onExecuted",E.ACTION,{optional:!0,nameLocked:!0}),this.findOutputSlot("onExecuted")):e},k.prototype.onAfterExecuteNode=function(e,t){var n=this.findOutputSlot("onExecuted");-1!=n&&this.triggerSlot(n,e,null,t)},k.prototype.changeMode=function(e){switch(e){case E.ON_EVENT:break;case E.ON_TRIGGER:this.addOnTriggerInput(),this.addOnExecutedOutput();break;case E.NEVER:case E.ALWAYS:case E.ON_REQUEST:break;default:return!1}return this.mode=e,!0},k.prototype.doExecute=function(e,t){t=t||{},this.onExecute&&(t.action_call||(t.action_call=this.id+"_exec_"+Math.floor(9999*Math.random())),this.graph.nodes_executing[this.id]=!0,this.onExecute(e,t),this.graph.nodes_executing[this.id]=!1,this.exec_version=this.graph.iteration,t&&t.action_call&&(this.action_call=t.action_call,this.graph.nodes_executedAction[this.id]=t.action_call)),this.execute_triggered=2,this.onAfterExecuteNode&&this.onAfterExecuteNode(e,t)},k.prototype.actionDo=function(e,t,n){n=n||{},this.onAction&&(n.action_call||(n.action_call=this.id+"_"+(e||"action")+"_"+Math.floor(9999*Math.random())),this.graph.nodes_actioning[this.id]=e||"actioning",this.onAction(e,t,n),this.graph.nodes_actioning[this.id]=!1,n&&n.action_call&&(this.action_call=n.action_call,this.graph.nodes_executedAction[this.id]=n.action_call)),this.action_triggered=2,this.onAfterExecuteNode&&this.onAfterExecuteNode(t,n)},k.prototype.trigger=function(e,t,n){if(this.outputs&&this.outputs.length){this.graph&&(this.graph._last_trigger_time=E.getTime());for(var r=0;r<this.outputs.length;++r){var i=this.outputs[r];!i||i.type!==E.EVENT||e&&i.name!=e||this.triggerSlot(r,t,null,n)}}},k.prototype.triggerSlot=function(e,t,n,r){if(r=r||{},this.outputs)if(null==e)console.error("slot must be a number");else if(e.constructor!==Number&&console.warn("slot must be a number, use node.trigger('name') if you want to use a string"),e=this.outputs[e]){var i=e.links;if(i&&i.length){this.graph&&(this.graph._last_trigger_time=E.getTime());for(var a=0;a<i.length;++a){var s,o,l=i[a];null!=n&&n!=l||(l=this.graph.links[i[a]])&&(l._last_time=E.getTime(),(s=this.graph.getNodeById(l.target_id))&&(o=s.inputs[l.target_slot],s.mode===E.ON_TRIGGER?(r.action_call||(r.action_call=this.id+"_trigg_"+Math.floor(9999*Math.random())),s.onExecute&&s.doExecute(t,r)):s.onAction&&(r.action_call||(r.action_call=this.id+"_act_"+Math.floor(9999*Math.random())),o=s.inputs[l.target_slot],s.actionDo(o.name,t,r))))}}}},k.prototype.clearTriggeredSlot=function(e,t){if(this.outputs&&(e=this.outputs[e])){var n=e.links;if(n&&n.length)for(var r=0;r<n.length;++r){var i=n[r];null!=t&&t!=i||(i=this.graph.links[n[r]])&&(i._last_time=0)}}},k.prototype.setSize=function(e){this.size=e,this.onResize&&this.onResize(this.size)},k.prototype.addProperty=function(e,t,n,r){var i={name:e,type:n,default_value:t};if(r)for(var a in r)i[a]=r[a];return this.properties_info||(this.properties_info=[]),this.properties_info.push(i),this.properties||(this.properties={}),this.properties[e]=t,i},k.prototype.addOutput=function(e,t,n){var r={name:e,type:t,links:null};if(n)for(var i in n)r[i]=n[i];return this.outputs||(this.outputs=[]),this.outputs.push(r),this.onOutputAdded&&this.onOutputAdded(r),E.auto_load_slot_types&&E.registerNodeAndSlotType(this,t,!0),this.setSize(this.computeSize()),this.setDirtyCanvas(!0,!0),r},k.prototype.addOutputs=function(e){for(var t=0;t<e.length;++t){var n=e[t],r={name:n[0],type:n[1],link:null};if(e[2])for(var i in n[2])r[i]=n[2][i];this.outputs||(this.outputs=[]),this.outputs.push(r),this.onOutputAdded&&this.onOutputAdded(r),E.auto_load_slot_types&&E.registerNodeAndSlotType(this,n[1],!0)}this.setSize(this.computeSize()),this.setDirtyCanvas(!0,!0)},k.prototype.removeOutput=function(e){this.disconnectOutput(e),this.outputs.splice(e,1);for(var t=e;t<this.outputs.length;++t)if(this.outputs[t]&&this.outputs[t].links)for(var n=this.outputs[t].links,r=0;r<n.length;++r){var i=this.graph.links[n[r]];i&&--i.origin_slot}this.setSize(this.computeSize()),this.onOutputRemoved&&this.onOutputRemoved(e),this.setDirtyCanvas(!0,!0)},k.prototype.addInput=function(e,t,n){var r={name:e,type:t=t||0,link:null};if(n)for(var i in n)r[i]=n[i];return this.inputs||(this.inputs=[]),this.inputs.push(r),this.setSize(this.computeSize()),this.onInputAdded&&this.onInputAdded(r),E.registerNodeAndSlotType(this,t),this.setDirtyCanvas(!0,!0),r},k.prototype.addInputs=function(e){for(var t=0;t<e.length;++t){var n=e[t],r={name:n[0],type:n[1],link:null};if(e[2])for(var i in n[2])r[i]=n[2][i];this.inputs||(this.inputs=[]),this.inputs.push(r),this.onInputAdded&&this.onInputAdded(r),E.registerNodeAndSlotType(this,n[1])}this.setSize(this.computeSize()),this.setDirtyCanvas(!0,!0)},k.prototype.removeInput=function(e){this.disconnectInput(e);for(var t,n=this.inputs.splice(e,1),r=e;r<this.inputs.length;++r)!this.inputs[r]||(t=this.graph.links[this.inputs[r].link])&&--t.target_slot;this.setSize(this.computeSize()),this.onInputRemoved&&this.onInputRemoved(e,n[0]),this.setDirtyCanvas(!0,!0)},k.prototype.addConnection=function(e,t,n,r){return e={name:e,type:t,pos:n,direction:r,links:null},this.connections.push(e),e},k.prototype.computeSize=function(e){if(this.constructor.size)return this.constructor.size.concat();var t=Math.max(this.inputs?this.inputs.length:1,this.outputs?this.outputs.length:1),n=e||new Float32Array([0,0]),r=(t=Math.max(t,1),E.NODE_TEXT_SIZE),i=(e=h(this.title),0),a=0;if(this.inputs)for(var s=0,o=this.inputs.length;s<o;++s){var l=this.inputs[s];i<(u=h(l.label||l.name||""))&&(i=u)}if(this.outputs)for(s=0,o=this.outputs.length;s<o;++s){var u,c=this.outputs[s];a<(u=h(c.label||c.name||""))&&(a=u)}n[0]=Math.max(i+a+10,e),n[0]=Math.max(n[0],E.NODE_WIDTH),this.widgets&&this.widgets.length&&(n[0]=Math.max(n[0],1.5*E.NODE_WIDTH)),n[1]=(this.constructor.slot_start_y||0)+t*E.NODE_SLOT_HEIGHT;var d=0;if(this.widgets&&this.widgets.length){for(s=0,o=this.widgets.length;s<o;++s)this.widgets[s].computeSize?d+=this.widgets[s].computeSize(n[0])[1]+4:d+=E.NODE_WIDGET_HEIGHT+4;d+=8}function h(e){return e?r*e.length*.6:0}return this.widgets_up?n[1]=Math.max(n[1],d):null!=this.widgets_start_y?n[1]=Math.max(n[1],d+this.widgets_start_y):n[1]+=d,this.constructor.min_height&&n[1]<this.constructor.min_height&&(n[1]=this.constructor.min_height),n[1]+=6,n},k.prototype.getPropertyInfo=function(e){var t=null;if(this.properties_info)for(var n=0;n<this.properties_info.length;++n)if(this.properties_info[n].name==e){t=this.properties_info[n];break}return this.constructor["@"+e]&&(t=this.constructor["@"+e]),(t=(t=!(t=this.constructor.widgets_info&&this.constructor.widgets_info[e]?this.constructor.widgets_info[e]:t)&&this.onGetPropertyInfo?this.onGetPropertyInfo(e):t)||{}).type||(t.type=w(this.properties[e])),"combo"==t.widget&&(t.type="enum"),t},k.prototype.addWidget=function(e,t,n,r,i){if(this.widgets||(this.widgets=[]),!i&&r&&r.constructor===Object&&(i=r,r=null),i&&i.constructor===String&&(i={property:i}),r&&r.constructor===String&&((i=i||{}).property=r,r=null),r&&r.constructor!==Function&&(console.warn("addWidget: callback must be a function"),r=null),void 0!==(t={type:e.toLowerCase(),name:t,value:n,callback:r,options:i||{}}).options.y&&(t.y=t.options.y),r||t.options.callback||t.options.property||console.warn("LiteGraph addWidget(...) without a callback or property assigned"),"combo"!=e||t.options.values)return this.widgets.push(t),this.setSize(this.computeSize()),null!=(n=this.onWidgetAdded)&&n.call(this,t),t;throw"LiteGraph addWidget('combo',...) requires to pass values in options: { values:['red','blue'] }"},k.prototype.addCustomWidget=function(e){return this.widgets||(this.widgets=[]),this.widgets.push(e),e},k.prototype.getBounding=function(e){return(e=e||new Float32Array(4))[0]=this.pos[0]-4,e[1]=this.pos[1]-E.NODE_TITLE_HEIGHT,e[2]=this.size[0]+4,e[3]=this.flags.collapsed?E.NODE_TITLE_HEIGHT:this.size[1]+E.NODE_TITLE_HEIGHT,this.onBounding&&this.onBounding(e),e},k.prototype.isPointInside=function(e,t,n,r){n=n||0;var i=this.graph&&this.graph.isLive()?0:E.NODE_TITLE_HEIGHT;if(r&&(i=0),this.flags&&this.flags.collapsed){if(z(e,t,this.pos[0]-n,this.pos[1]-E.NODE_TITLE_HEIGHT-n,(this._collapsed_width||E.NODE_COLLAPSED_WIDTH)+2*n,E.NODE_TITLE_HEIGHT+2*n))return!0}else if(this.pos[0]-4-n<e&&this.pos[0]+this.size[0]+4+n>e&&this.pos[1]-i-n<t&&this.pos[1]+this.size[1]+n>t)return!0;return!1},k.prototype.getSlotInPosition=function(e,t){var n=new Float32Array(2);if(this.inputs)for(var r=0,i=this.inputs.length;r<i;++r){var a=this.inputs[r];if(this.getConnectionPos(!0,r,n),z(e,t,n[0]-10,n[1]-5,20,10))return{input:a,slot:r,link_pos:n}}if(this.outputs)for(r=0,i=this.outputs.length;r<i;++r){var s=this.outputs[r];if(this.getConnectionPos(!1,r,n),z(e,t,n[0]-10,n[1]-5,20,10))return{output:s,slot:r,link_pos:n}}return null},k.prototype.findInputSlot=function(e,t){if(!this.inputs)return-1;for(var n=0,r=this.inputs.length;n<r;++n)if(e==this.inputs[n].name)return t?this.inputs[n]:n;return-1},k.prototype.findOutputSlot=function(e,t){if(t=t||!1,!this.outputs)return-1;for(var n=0,r=this.outputs.length;n<r;++n)if(e==this.outputs[n].name)return t?this.outputs[n]:n;return-1},k.prototype.findInputSlotFree=function(e){e=e||{};var t=Object.assign({returnObj:!1,typesNotAccepted:[]},e);if(!this.inputs)return-1;for(var n=0,r=this.inputs.length;n<r;++n)if(!(this.inputs[n].link&&null!=this.inputs[n].link||t.typesNotAccepted&&t.typesNotAccepted.includes&&t.typesNotAccepted.includes(this.inputs[n].type)))return t.returnObj?this.inputs[n]:n;return-1},k.prototype.findOutputSlotFree=function(e){e=e||{};var t=Object.assign({returnObj:!1,typesNotAccepted:[]},e);if(!this.outputs)return-1;for(var n=0,r=this.outputs.length;n<r;++n)if(!(this.outputs[n].links&&null!=this.outputs[n].links||t.typesNotAccepted&&t.typesNotAccepted.includes&&t.typesNotAccepted.includes(this.outputs[n].type)))return t.returnObj?this.outputs[n]:n;return-1},k.prototype.findInputSlotByType=function(e,t,n,r){return this.findSlotByType(!0,e,t,n,r)},k.prototype.findOutputSlotByType=function(e,t,n,r){return this.findSlotByType(!1,e,t,n,r)},k.prototype.findSlotByType=function(e,t,n,r,i){n=n||!1,r=r||!1,i=i||!1;var a=(e=e||!1)?this.inputs:this.outputs;if(!a)return-1;""!=t&&"*"!=t||(t=0);for(var s=0,o=a.length;s<o;++s){var l=(t+"").toLowerCase().split(",");d=((d="0"==a[s].type||"*"==a[s].type?"0":a[s].type)+"").toLowerCase().split(",");for(var u=0;u<l.length;u++)for(var c=0;c<d.length;c++)if("_event_"==l[u]&&(l[u]=E.EVENT),"_event_"==d[u]&&(d[u]=E.EVENT),"*"==l[u]&&(l[u]=0),"*"==d[u]&&(d[u]=0),!(l[u]!=d[c]||r&&a[s].links&&null!==a[s].links))return n?a[s]:s}if(r&&!i)for(s=0,o=a.length;s<o;++s){var d;l=(t+"").toLowerCase().split(","),d=((d="0"==a[s].type||"*"==a[s].type?"0":a[s].type)+"").toLowerCase().split(",");for(var h=0;h<l.length;h++)for(var p=0;p<d.length;p++)if("*"==l[h]&&(l[h]=0),"*"==d[h]&&(d[h]=0),l[h]==d[p])return n?a[s]:s}return-1},k.prototype.connectByType=function(e,t,n,r){var i;return r=r||{},r=Object.assign({createEventInCase:!0,firstFreeIfOutputGeneralInCase:!0,generalTypeInCase:!0},r),0<=(i=(t=t&&t.constructor===Number?this.graph.getNodeById(t):t).findInputSlotByType(n,!1,!0))&&null!==i?this.connect(e,t,i):r.createEventInCase&&n==E.EVENT?this.connect(e,t,-1):r.generalTypeInCase&&0<=(i=t.findInputSlotByType(0,!1,!0,!0))||r.firstFreeIfOutputGeneralInCase&&(0==n||"*"==n||""==n)&&0<=(i=t.findInputSlotFree({typesNotAccepted:[E.EVENT]}))?this.connect(e,t,i):(console.debug("no way to connect type: ",n," to targetNODE ",t),null)},k.prototype.connectByTypeOutput=function(e,t,n,r){var i;return r=r||{},r=Object.assign({createEventInCase:!0,firstFreeIfInputGeneralInCase:!0,generalTypeInCase:!0},r),0<=(i=(t=t&&t.constructor===Number?this.graph.getNodeById(t):t).findOutputSlotByType(n,!1,!0))&&null!==i||r.generalTypeInCase&&0<=(i=t.findOutputSlotByType(0,!1,!0,!0))?t.connect(i,this,e):r.createEventInCase&&n==E.EVENT&&E.do_add_triggers_slots?(i=t.addOnExecutedOutput(),t.connect(i,this,e)):r.firstFreeIfInputGeneralInCase&&(0==n||"*"==n||""==n)&&0<=(i=t.findOutputSlotFree({typesNotAccepted:[E.EVENT]}))?t.connect(i,this,e):(console.debug("no way to connect byOUT type: ",n," to sourceNODE ",t),null)},k.prototype.connect=function(e,t,n){if(n=n||0,!this.graph)return console.log("Connect: Error, node doesn't belong to any graph. Nodes must be added first to a graph before connecting them."),null;if(e.constructor===String){if(-1==(e=this.findOutputSlot(e)))return E.debug&&console.log("Connect: Error, no slot of name "+e),null}else if(!this.outputs||e>=this.outputs.length)return E.debug&&console.log("Connect: Error, slot number not found"),null;if(!(t=t&&t.constructor===Number?this.graph.getNodeById(t):t))throw"target node is null";if(t==this)return null;if(n.constructor===String){if(-1==(n=t.findInputSlot(n)))return E.debug&&console.log("Connect: Error, no slot of name "+n),null}else if(n===E.EVENT){if(!E.do_add_triggers_slots)return null;t.changeMode(E.ON_TRIGGER),n=t.findInputSlot("onTrigger")}else if(!t.inputs||n>=t.inputs.length)return E.debug&&console.log("Connect: Error, slot number not found"),null;var r=!1,i=t.inputs[n],a=null,s=this.outputs[e];return this.outputs[e]?!1!==(n=t.onBeforeConnectInput?t.onBeforeConnectInput(n):n)&&null!==n&&E.isValidConnection(s.type,i.type)?t.onConnectInput&&!1===t.onConnectInput(n,s.type,s,this,e)||this.onConnectOutput&&!1===this.onConnectOutput(e,i.type,i,t,n)?null:(t.inputs[n]&&null!=t.inputs[n].link&&(this.graph.beforeChange(),t.disconnectInput(n,{doProcessChange:!1}),r=!0),null!==s.links&&s.links.length&&s.type===E.EVENT&&!E.allow_multi_output_for_events&&(this.graph.beforeChange(),this.disconnectOutput(e,!1,{doProcessChange:!1}),r=!0),a=new P(++this.graph.last_link_id,i.type||s.type,this.id,e,t.id,n),this.graph.links[a.id]=a,null==s.links&&(s.links=[]),s.links.push(a.id),t.inputs[n].link=a.id,this.graph&&this.graph._version++,this.onConnectionsChange&&this.onConnectionsChange(E.OUTPUT,e,!0,a,s),t.onConnectionsChange&&t.onConnectionsChange(E.INPUT,n,!0,a,i),this.graph&&this.graph.onNodeConnectionChange&&(this.graph.onNodeConnectionChange(E.INPUT,t,n,this,e),this.graph.onNodeConnectionChange(E.OUTPUT,this,e,t,n)),this.setDirtyCanvas(!1,!0),this.graph.afterChange(),this.graph.connectionChange(this,a),a):(this.setDirtyCanvas(!1,!0),r&&this.graph.connectionChange(this,a),null):null},k.prototype.disconnectOutput=function(e,t){if(e.constructor===String){if(-1==(e=this.findOutputSlot(e)))return E.debug&&console.log("Connect: Error, no slot of name "+e),!1}else if(!this.outputs||e>=this.outputs.length)return E.debug&&console.log("Connect: Error, slot number not found"),!1;var n=this.outputs[e];if(!n||!n.links||0==n.links.length)return!1;if(t){if(!(t=t.constructor===Number?this.graph.getNodeById(t):t))throw"Target Node not found";for(var r=0,i=n.links.length;r<i;r++){var a=n.links[r];if((s=this.graph.links[a]).target_id==t.id){n.links.splice(r,1),(o=t.inputs[s.target_slot]).link=null,delete this.graph.links[a],this.graph&&this.graph._version++,t.onConnectionsChange&&t.onConnectionsChange(E.INPUT,s.target_slot,!1,s,o),this.onConnectionsChange&&this.onConnectionsChange(E.OUTPUT,e,!1,s,n),this.graph&&this.graph.onNodeConnectionChange&&this.graph.onNodeConnectionChange(E.OUTPUT,this,e),this.graph&&this.graph.onNodeConnectionChange&&(this.graph.onNodeConnectionChange(E.OUTPUT,this,e),this.graph.onNodeConnectionChange(E.INPUT,t,s.target_slot));break}}}else{for(r=0,i=n.links.length;r<i;r++){var s,o;a=n.links[r],(s=this.graph.links[a])&&(t=this.graph.getNodeById(s.target_id),o=null,this.graph&&this.graph._version++,t&&((o=t.inputs[s.target_slot]).link=null,t.onConnectionsChange&&t.onConnectionsChange(E.INPUT,s.target_slot,!1,s,o),this.graph&&this.graph.onNodeConnectionChange&&this.graph.onNodeConnectionChange(E.INPUT,t,s.target_slot)),delete this.graph.links[a],this.onConnectionsChange&&this.onConnectionsChange(E.OUTPUT,e,!1,s,n),this.graph&&this.graph.onNodeConnectionChange&&(this.graph.onNodeConnectionChange(E.OUTPUT,this,e),this.graph.onNodeConnectionChange(E.INPUT,t,s.target_slot)))}n.links=null}return this.setDirtyCanvas(!1,!0),this.graph.connectionChange(this),!0},k.prototype.disconnectInput=function(e){if(e.constructor===String){if(-1==(e=this.findInputSlot(e)))return E.debug&&console.log("Connect: Error, no slot of name "+e),!1}else if(!this.inputs||e>=this.inputs.length)return E.debug&&console.log("Connect: Error, slot number not found"),!1;var t=this.inputs[e];if(!t)return!1;var n=this.inputs[e].link;if(null!=n){this.inputs[e].link=null;var r=this.graph.links[n];if(r){var i=this.graph.getNodeById(r.origin_id);if(!i)return!1;var a=i.outputs[r.origin_slot];if(!a||!a.links||0==a.links.length)return!1;for(var s=0,o=a.links.length;s<o;s++)if(a.links[s]==n){a.links.splice(s,1);break}delete this.graph.links[n],this.graph&&this.graph._version++,this.onConnectionsChange&&this.onConnectionsChange(E.INPUT,e,!1,r,t),i.onConnectionsChange&&i.onConnectionsChange(E.OUTPUT,s,!1,r,a),this.graph&&this.graph.onNodeConnectionChange&&(this.graph.onNodeConnectionChange(E.OUTPUT,i,s),this.graph.onNodeConnectionChange(E.INPUT,this,e))}}return this.setDirtyCanvas(!1,!0),this.graph&&this.graph.connectionChange(this),!0},k.prototype.getConnectionPos=function(e,t,n){n=n||new Float32Array(2);var r,i=0,a=(e&&this.inputs&&(i=this.inputs.length),!e&&this.outputs&&(i=this.outputs.length),.5*E.NODE_SLOT_HEIGHT);return this.flags.collapsed?(r=this._collapsed_width||E.NODE_COLLAPSED_WIDTH,this.horizontal?(n[0]=this.pos[0]+.5*r,n[1]=e?this.pos[1]-E.NODE_TITLE_HEIGHT:this.pos[1]):(n[0]=e?this.pos[0]:this.pos[0]+r,n[1]=this.pos[1]-.5*E.NODE_TITLE_HEIGHT,n[1]-=10)):e&&-1==t?(n[0]=this.pos[0]+.5*E.NODE_TITLE_HEIGHT,n[1]=this.pos[1]+.5*E.NODE_TITLE_HEIGHT):e&&t<i&&this.inputs[t].pos?(n[0]=this.pos[0]+this.inputs[t].pos[0],n[1]=this.pos[1]+this.inputs[t].pos[1]):!e&&t<i&&this.outputs[t].pos?(n[0]=this.pos[0]+this.outputs[t].pos[0],n[1]=this.pos[1]+this.outputs[t].pos[1]):this.horizontal?(n[0]=this.pos[0]+(t+.5)*(this.size[0]/i),n[1]=e?this.pos[1]-E.NODE_TITLE_HEIGHT:this.pos[1]+this.size[1]):(n[0]=e?this.pos[0]+a:this.pos[0]+this.size[0]+1-a,n[1]=this.pos[1]+(t+.7)*E.NODE_SLOT_HEIGHT+(this.constructor.slot_start_y||0)),n},k.prototype.alignToGrid=function(){this.pos[0]=E.CANVAS_GRID_SIZE*Math.round(this.pos[0]/E.CANVAS_GRID_SIZE),this.pos[1]=E.CANVAS_GRID_SIZE*Math.round(this.pos[1]/E.CANVAS_GRID_SIZE)},k.prototype.trace=function(e){this.console||(this.console=[]),this.console.push(e),this.console.length>k.MAX_CONSOLE&&this.console.shift(),this.graph.onNodeTrace&&this.graph.onNodeTrace(this,e)},k.prototype.setDirtyCanvas=function(e,t){this.graph&&this.graph.sendActionToCanvas("setDirty",[e,t])},k.prototype.loadImage=function(e){var t=new Image,n=(t.src=E.node_images_path+e,t.ready=!1,this);return t.onload=function(){this.ready=!0,n.setDirtyCanvas(!0)},t},k.prototype.captureInput=function(e){if(this.graph&&this.graph.list_of_graphcanvas)for(var t=this.graph.list_of_graphcanvas,n=0;n<t.length;++n){var r=t[n];!e&&r.node_capturing_input!=this||(r.node_capturing_input=e?this:null)}},k.prototype.collapse=function(e){this.graph._version++,!1===this.constructor.collapsable&&!e||(this.flags.collapsed?this.flags.collapsed=!1:this.flags.collapsed=!0,this.setDirtyCanvas(!0,!0))},k.prototype.pin=function(e){this.graph._version++,this.flags.pinned=void 0===e?!this.flags.pinned:e},k.prototype.localToScreen=function(e,t,n){return[(e+this.pos[0])*n.scale+n.offset[0],(t+this.pos[1])*n.scale+n.offset[1]]},O.prototype._ctor=function(e){this.title=e||"Group",this.font_size=24,this.color=C.node_colors.pale_blue?C.node_colors.pale_blue.groupcolor:"#AAA",this._bounding=new Float32Array([10,10,140,80]),this._pos=this._bounding.subarray(0,2),this._size=this._bounding.subarray(2,4),this._nodes=[],this.graph=null,this.type="group",Object.defineProperty(this,"pos",{set:function(e){!e||e.length<2||(this._pos[0]=e[0],this._pos[1]=e[1])},get:function(){return this._pos},enumerable:!0}),Object.defineProperty(this,"size",{set:function(e){!e||e.length<2||(this._size[0]=Math.max(140,e[0]),this._size[1]=Math.max(80,e[1]))},get:function(){return this._size},enumerable:!0})},O.prototype.configure=function(e){return this.title=e.title,this._bounding.set(e.bounding),this.color=e.color,this.font=e.font,this},O.prototype.serialize=function(){var e=this._bounding;return{title:this.title,bounding:[Math.round(e[0]),Math.round(e[1]),Math.round(e[2]),Math.round(e[3])],color:this.color,font:this.font}},O.prototype.move=function(e,t,n){if(this._pos[0]+=e,this._pos[1]+=t,!n)for(var r=0;r<this._nodes.length;++r){var i=this._nodes[r];i.pos[0]+=e,i.pos[1]+=t}},O.prototype.recomputeInsideNodes=function(){this._nodes.length=0;for(var e=this.graph._nodes,t=new Float32Array(4),n=0;n<e.length;++n){var r=e[n];r.getBounding(t),V(this._bounding,t)&&this._nodes.push(r)}},O.prototype.isPointInside=k.prototype.isPointInside,O.prototype.setDirtyCanvas=k.prototype.setDirtyCanvas,(E.DragAndScale=A).prototype.bindEvents=function(e){this.last_mouse=new Float32Array(2),this._binded_mouse_callback=this.onMouse.bind(this),E.pointerListenerAdd(e,"down",this._binded_mouse_callback),E.pointerListenerAdd(e,"move",this._binded_mouse_callback),E.pointerListenerAdd(e,"up",this._binded_mouse_callback),e.addEventListener("mousewheel",this._binded_mouse_callback,!1),e.addEventListener("wheel",this._binded_mouse_callback,!1)},A.prototype.computeVisibleArea=function(e){var t,n,r,i;this.element?(i=this.element.width,t=this.element.height,n=-this.offset[0],r=-this.offset[1],e&&(n+=e[0]/this.scale,r+=e[1]/this.scale,i=e[2],t=e[3]),e=n+i/this.scale,i=r+t/this.scale,this.visible_area[0]=n,this.visible_area[1]=r,this.visible_area[2]=e-n,this.visible_area[3]=i-r):this.visible_area[0]=this.visible_area[1]=this.visible_area[2]=this.visible_area[3]=0},A.prototype.onMouse=function(e){var t,n,r,i,a,s;if(this.enabled)return r=(t=this.element).getBoundingClientRect(),n=e.clientX-r.left,r=e.clientY-r.top,e.canvasx=n,e.canvasy=r,e.dragging=this.dragging,i=!this.viewport||this.viewport&&n>=this.viewport[0]&&n<this.viewport[0]+this.viewport[2]&&r>=this.viewport[1]&&r<this.viewport[1]+this.viewport[3],a=!1,this.onmouse&&(a=this.onmouse(e)),e.type==E.pointerevents_method+"down"&&i?(this.dragging=!0,E.pointerListenerRemove(t,"move",this._binded_mouse_callback),E.pointerListenerAdd(document,"move",this._binded_mouse_callback),E.pointerListenerAdd(document,"up",this._binded_mouse_callback)):e.type==E.pointerevents_method+"move"?a||(a=n-this.last_mouse[0],s=r-this.last_mouse[1],this.dragging&&this.mouseDrag(a,s)):e.type==E.pointerevents_method+"up"?(this.dragging=!1,E.pointerListenerRemove(document,"move",this._binded_mouse_callback),E.pointerListenerRemove(document,"up",this._binded_mouse_callback),E.pointerListenerAdd(t,"move",this._binded_mouse_callback)):!i||"mousewheel"!=e.type&&"wheel"!=e.type&&"DOMMouseScroll"!=e.type||(e.eventType="mousewheel","wheel"==e.type?e.wheel=-e.deltaY:e.wheel=null!=e.wheelDeltaY?e.wheelDeltaY:-60*e.detail,e.delta=e.wheelDelta?e.wheelDelta/40:e.deltaY?-e.deltaY/3:0,console.log(1+.05*e.delta,"1.0 + e.delta * 0.05"),this.changeDeltaScale(1+.05*e.delta)),this.last_mouse[0]=n,this.last_mouse[1]=r,i?(e.preventDefault(),e.stopPropagation(),!1):void 0},A.prototype.toCanvasContext=function(e){e.scale(this.scale,this.scale),e.translate(this.offset[0],this.offset[1])},A.prototype.convertOffsetToCanvas=function(e){return[(e[0]+this.offset[0])*this.scale,(e[1]+this.offset[1])*this.scale]},A.prototype.convertCanvasToOffset=function(e,t){return(t=t||[0,0])[0]=e[0]/this.scale-this.offset[0],t[1]=e[1]/this.scale-this.offset[1],t},A.prototype.mouseDrag=function(e,t){this.offset[0]+=e/this.scale,this.offset[1]+=t/this.scale,console.log(e,t,"x,y"),this.onredraw&&this.onredraw(this)},A.prototype.changeScale=function(e,t){var n;e<this.min_scale?e=this.min_scale:e>this.max_scale&&(e=this.max_scale),e!=this.scale&&this.element&&(n=this.element.getBoundingClientRect())&&(t=t||[.5*n.width,.5*n.height],n=this.convertCanvasToOffset(t),this.scale=e,Math.abs(this.scale-1)<.01&&(this.scale=1),t=[(e=this.convertCanvasToOffset(t))[0]-n[0],e[1]-n[1]],this.offset[0]+=t[0],this.offset[1]+=t[1],this.onredraw&&this.onredraw(this))},A.prototype.changeDeltaScale=function(e,t){this.changeScale(this.scale*e,t)},A.prototype.reset=function(){this.scale=1,this.offset[0]=0,this.offset[1]=0},C.DEFAULT_BACKGROUND_IMAGE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQBJREFUeNrs1rEKwjAUhlETUkj3vP9rdmr1Ysammk2w5wdxuLgcMHyptfawuZX4pJSWZTnfnu/lnIe/jNNxHHGNn//HNbbv+4dr6V+11uF527arU7+u63qfa/bnmh8sWLBgwYJlqRf8MEptXPBXJXa37BSl3ixYsGDBMliwFLyCV/DeLIMFCxYsWLBMwSt4Be/NggXLYMGCBUvBK3iNruC9WbBgwYJlsGApeAWv4L1ZBgsWLFiwYJmCV/AK3psFC5bBggULloJX8BpdwXuzYMGCBctgwVLwCl7Be7MMFixYsGDBsu8FH1FaSmExVfAxBa/gvVmwYMGCZbBg/W4vAQYA5tRF9QYlv/QAAAAASUVORK5CYII=",C.link_type_colors={"-1":E.EVENT_LINK_COLOR,number:"#AAA",node:"#DCA"},C.gradients={},C.prototype.clear=function(){this.frame=0,this.last_draw_time=0,this.render_time=0,this.fps=0,this.dragging_rectangle=null,this.selected_nodes={},this.selected_group=null,this.visible_nodes=[],this.node_dragged=null,this.node_over=null,this.node_capturing_input=null,this.connecting_node=null,this.highlighted_links={},this.dragging_canvas=!1,this.dirty_canvas=!0,this.dirty_bgcanvas=!0,this.dirty_area=null,this.node_in_panel=null,this.node_widget=null,this.last_mouse=[0,0],this.last_mouseclick=0,this.pointer_is_down=!1,this.pointer_is_double=!1,this.visible_area.set([0,0,0,0]),this.onClear&&this.onClear()},C.prototype.setGraph=function(e,t){this.graph!=e&&(t||this.clear(),!e&&this.graph?this.graph.detachCanvas(this):(e.attachCanvas(this),this._graph_stack&&(this._graph_stack=null),this.setDirty(!0,!0)))},C.prototype.getTopGraph=function(){return this._graph_stack.length?this._graph_stack[0]:this.graph},C.prototype.openSubgraph=function(e){if(!e)throw"graph cannot be null";if(this.graph==e)throw"graph cannot be the same";this.clear(),this.graph&&(this._graph_stack||(this._graph_stack=[]),this._graph_stack.push(this.graph)),e.attachCanvas(this),this.checkPanels(),this.setDirty(!0,!0)},C.prototype.closeSubgraph=function(){var e,t;this._graph_stack&&0!=this._graph_stack.length&&(e=this.graph._subgraph_node,t=this._graph_stack.pop(),this.selected_nodes={},this.highlighted_links={},t.attachCanvas(this),this.setDirty(!0,!0),e&&(this.centerOnNode(e),this.selectNodes([e])),this.ds.offset=[0,0],this.ds.scale=1)},C.prototype.getCurrentGraph=function(){return this.graph},C.prototype.setCanvas=function(e,t){if(e&&e.constructor===String&&!(e=document.getElementById(e)))throw"Error creating LiteGraph canvas: Canvas not found";if(e!==this.canvas&&(e||!this.canvas||t||this.unbindEvents(),this.canvas=e,this.ds.element=e)){if(e.className+=" lgraphcanvas",e.data=this,e.tabindex="1",this.bgcanvas=null,this.bgcanvas||(this.bgcanvas=document.createElement("canvas"),this.bgcanvas.width=this.canvas.width,this.bgcanvas.height=this.canvas.height),null==e.getContext){if("canvas"!=e.localName)throw"Element supplied for LGraphCanvas must be a <canvas> element, you passed a "+e.localName;throw"This browser doesn't support Canvas"}null==(this.ctx=e.getContext("2d"))&&(e.webgl_enabled||console.warn("This canvas seems to be WebGL, enabling WebGL renderer"),this.enableWebGL()),t||this.bindEvents()}},C.prototype._doNothing=function(e){return e.preventDefault(),!1},C.prototype._doReturnTrue=function(e){return e.preventDefault(),!0},C.prototype.bindEvents=function(){var e,t;this._events_binded?console.warn("LGraphCanvas: events already binded"):(e=this.canvas,t=this.getCanvasWindow().document,this._mousedown_callback=this.processMouseDown.bind(this),this._mousewheel_callback=this.processMouseWheel.bind(this),this._mousemove_callback=this.processMouseMove.bind(this),this._mouseup_callback=this.processMouseUp.bind(this),E.pointerListenerAdd(e,"down",this._mousedown_callback,!0),e.addEventListener("mousewheel",this._mousewheel_callback,!1),E.pointerListenerAdd(e,"up",this._mouseup_callback,!0),E.pointerListenerAdd(e,"move",this._mousemove_callback),e.addEventListener("contextmenu",this._doNothing),e.addEventListener("DOMMouseScroll",this._mousewheel_callback,!1),this._key_callback=this.processKey.bind(this),e.addEventListener("keydown",this._key_callback,!0),t.addEventListener("keyup",this._key_callback,!0),this._ondrop_callback=this.processDrop.bind(this),e.addEventListener("dragover",this._doNothing,!1),e.addEventListener("dragend",this._doNothing,!1),e.addEventListener("drop",this._ondrop_callback,!1),e.addEventListener("dragenter",this._doReturnTrue,!1),this._events_binded=!0)},C.prototype.unbindEvents=function(){var e;this._events_binded?(e=this.getCanvasWindow().document,E.pointerListenerRemove(this.canvas,"move",this._mousedown_callback),E.pointerListenerRemove(this.canvas,"up",this._mousedown_callback),E.pointerListenerRemove(this.canvas,"down",this._mousedown_callback),this.canvas.removeEventListener("mousewheel",this._mousewheel_callback),this.canvas.removeEventListener("DOMMouseScroll",this._mousewheel_callback),this.canvas.removeEventListener("keydown",this._key_callback),e.removeEventListener("keyup",this._key_callback),this.canvas.removeEventListener("contextmenu",this._doNothing),this.canvas.removeEventListener("drop",this._ondrop_callback),this.canvas.removeEventListener("dragenter",this._doReturnTrue),this._mousedown_callback=null,this._mousewheel_callback=null,this._key_callback=null,this._ondrop_callback=null,this._events_binded=!1):console.warn("LGraphCanvas: no events binded")},C.getFileExtension=function(e){var t=e.indexOf("?");return-1==(t=(e=-1!=t?e.substr(0,t):e).lastIndexOf("."))?"":e.substr(t+1).toLowerCase()},C.prototype.enableWebGL=function(){if(void 0===("undefined"==typeof GL?"undefined":w(GL)))throw"litegl.js must be included to use a WebGL canvas";if(void 0===("undefined"==typeof enableWebGLCanvas?"undefined":w(enableWebGLCanvas)))throw"webglCanvas.js must be included to use this feature";this.gl=this.ctx=enableWebGLCanvas(this.canvas),this.ctx.webgl=!0,this.bgcanvas=this.canvas,this.bgctx=this.gl,this.canvas.webgl_enabled=!0},C.prototype.setDirty=function(e,t){e&&(this.dirty_canvas=!0),t&&(this.dirty_bgcanvas=!0)},C.prototype.getCanvasWindow=function(){if(!this.canvas)return window;var e=this.canvas.ownerDocument;return e.defaultView||e.parentWindow},C.prototype.startRendering=function(){this.is_rendering||(this.is_rendering=!0,function e(){this.pause_rendering||this.draw();var t=this.getCanvasWindow();this.is_rendering&&t.requestAnimationFrame(e.bind(this))}.call(this))},C.prototype.stopRendering=function(){this.is_rendering=!1},C.prototype.blockClick=function(){this.block_click=!0,this.last_mouseclick=0},C.prototype.processMouseDown=function(e){if(this.set_canvas_dirty_on_mouse_event&&(this.dirty_canvas=!0),this.graph){this.adjustMouseEvent(e);var t=this.getCanvasWindow(),n=(t.document,C.active_canvas=this),r=e.clientX,i=e.clientY;if(this.ds.viewport=this.viewport,r=!this.viewport||this.viewport&&r>=this.viewport[0]&&r<this.viewport[0]+this.viewport[2]&&i>=this.viewport[1]&&i<this.viewport[1]+this.viewport[3],this.options.skip_events||(E.pointerListenerRemove(this.canvas,"move",this._mousemove_callback),E.pointerListenerAdd(t.document,"move",this._mousemove_callback,!0),E.pointerListenerAdd(t.document,"up",this._mouseup_callback,!0)),r){var a=this.graph.getNodeOnPos(e.canvasX,e.canvasY,this.visible_nodes,5),s=!1,o=(i=E.getTime(),r=void 0===e.isPrimary||!e.isPrimary,i-this.last_mouseclick<300&&r);if(this.mouse[0]=e.clientX,this.mouse[1]=e.clientY,this.graph_mouse[0]=e.canvasX,this.graph_mouse[1]=e.canvasY,this.last_click_position=[this.mouse[0],this.mouse[1]],this.pointer_is_down&&r?this.pointer_is_double=!0:this.pointer_is_double=!1,this.pointer_is_down=!0,this.canvas.focus(),E.closeAllContextMenus(t),!this.onMouse||1!=this.onMouse(e)){var l;if(console.log(e.which,"e.which"),1!=e.which||this.pointer_is_double)if(2==e.which){if(this.dragging_canvas=!0,E.middle_click_slot_add_default_node&&a&&this.allow_interaction&&!s&&!this.read_only&&!this.connecting_node&&!a.flags.collapsed&&!this.live_mode){var u=!1,c=!1,d=!1;if(a.outputs)for(h=0,p=a.outputs.length;h<p;++h)if(f=a.outputs[h],m=a.getConnectionPos(!1,h),z(e.canvasX,e.canvasY,m[0]-15,m[1]-10,30,20)){u=f,c=h,d=!0;break}if(a.inputs)for(h=0,p=a.inputs.length;h<p;++h)if(v=a.inputs[h],m=a.getConnectionPos(!0,h),z(e.canvasX,e.canvasY,m[0]-15,m[1],30,20)){u=v,c=h,d=!1;break}u&&!1!==c&&(i=.5-(c+1)/(d?a.outputs:a.inputs).length,r=a.getBounding(),r=[d?r[0]+r[2]:r[0],e.canvasY-80],this.createDefaultNodeForSlot({nodeFrom:d?a:null,slotFrom:d?c:null,nodeTo:d?null:a,slotTo:d?null:c,position:r,nodeType:"AUTO",posAdd:[d?30:-30,130*-i],posSizeFix:[d?0:-1,0]}))}}else 3!=e.which&&!this.pointer_is_double||!this.allow_interaction||s||this.read_only||(a&&(Object.keys(this.selected_nodes).length&&(this.selected_nodes[a.id]||e.shiftKey||e.ctrlKey||e.metaKey)?this.selected_nodes[a.id]||this.selectNodes([a],!0):this.selectNodes([a])),this.processContextMenu(a,e));else if(e.ctrlKey&&(this.dragging_rectangle=new Float32Array(4),this.dragging_rectangle[0]=e.canvasX,this.dragging_rectangle[1]=e.canvasY,this.dragging_rectangle[2]=1,this.dragging_rectangle[3]=1,s=!0),E.alt_drag_do_clone_nodes&&e.altKey&&a&&this.allow_interaction&&!s&&!this.read_only&&(cloned=a.clone())&&(cloned.pos[0]+=5,cloned.pos[1]+=5,this.graph.add(cloned,!1,{doCalcSize:!1}),a=cloned,s=!0,l||(this.allow_dragnodes&&(this.graph.beforeChange(),this.node_dragged=a),this.selected_nodes[a.id]||this.processNodeSelected(a,e))),a&&this.allow_interaction&&!s&&!this.read_only){if(this.live_mode||a.flags.pinned||this.bringToFront(a),!this.connecting_node&&!a.flags.collapsed&&!this.live_mode)if(!s&&!1!==a.resizable&&z(e.canvasX,e.canvasY,a.pos[0]+a.size[0]-5,a.pos[1]+a.size[1]-5,10,10))this.graph.beforeChange(),this.resizing_node=a,this.canvas.style.cursor="se-resize",s=!0;else{if(a.outputs)for(var h=0,p=a.outputs.length;h<p;++h){var f=a.outputs[h],m=a.getConnectionPos(!1,h);if(z(e.canvasX,e.canvasY,m[0]-15,m[1],30,20)){this.connecting_node=a,this.connecting_output=f,this.connecting_output.slot_index=h,this.connecting_pos=a.getConnectionPos(!1,h),this.connecting_pos[1]+=10,this.connecting_slot=h,E.shift_click_do_break_link_from&&e.shiftKey&&a.disconnectOutput(h),o?a.onOutputDblClick&&a.onOutputDblClick(h,e):a.onOutputClick&&a.onOutputClick(h,e),s=!0;break}}if(a.inputs)for(h=0,p=a.inputs.length;h<p;++h){var g,v=a.inputs[h];m=a.getConnectionPos(!0,h),z(e.canvasX,e.canvasY,m[0]-15,m[1],30,20)&&(o?a.onInputDblClick&&a.onInputDblClick(h,e):a.onInputClick&&a.onInputClick(h,e),null!==v.link&&(g=this.graph.links[v.link],E.click_do_break_link_to&&(a.disconnectInput(h),s=this.dirty_bgcanvas=!0),(this.allow_reconnect_links||e.shiftKey)&&(E.click_do_break_link_to||a.disconnectInput(h),this.connecting_node=this.graph._nodes_by_id[g.origin_id],this.connecting_slot=g.origin_slot,this.connecting_output=this.connecting_node.outputs[this.connecting_slot],this.connecting_pos=this.connecting_node.getConnectionPos(!1,this.connecting_slot),this.connecting_pos[1]+=10,s=this.dirty_bgcanvas=!0)),s||(this.connecting_node=a,this.connecting_input=v,this.connecting_input.slot_index=h,this.connecting_pos=a.getConnectionPos(!0,h),this.connecting_pos[1]+=10,this.connecting_slot=h,s=this.dirty_bgcanvas=!0))}}s||(l=!1,r=[e.canvasX-a.pos[0],e.canvasY-a.pos[1]],(i=this.processNodeWidgets(a,this.graph_mouse,e))&&(l=!0,this.node_widget=[a,i]),o&&this.selected_nodes[a.id]&&(a.onDblClick&&a.onDblClick(e,r,this),this.processNodeDblClicked(a),l=!0),a.onMouseDown&&a.onMouseDown(e,r,this)?l=!0:(a.subgraph&&!a.skip_subgraph_button&&!a.flags.collapsed&&r[0]>a.size[0]-E.NODE_TITLE_HEIGHT&&r[1]<0&&(n=this,setTimeout((function(){n.openSubgraph(a.subgraph)}),10)),this.live_mode&&(l=!0)),l||(this.allow_dragnodes&&(this.graph.beforeChange(),this.node_dragged=a),this.selected_nodes[a.id]||this.processNodeSelected(a,e)),this.dirty_canvas=!0)}else if(!s){if(!this.read_only)for(h=0;h<this.visible_links.length;++h){var y=this.visible_links[h],b=y._pos;if(!(!b||e.canvasX<b[0]-4||e.canvasX>b[0]+4||e.canvasY<b[1]-4||e.canvasY>b[1]+4)){this.showLinkMenu(y,e),this.over_link_center=null;break}}i=this.graph.getGroupOnPos(e.canvasX,e.canvasY),this.graph.ins.onSetSelectedGroupForDown(i),this.selected_group=i,this.selected_group_resizing=!1,this.selected_group&&!this.read_only&&(e.ctrlKey&&(this.dragging_rectangle=null),j([e.canvasX,e.canvasY],[this.selected_group.pos[0]+this.selected_group.size[0],this.selected_group.pos[1]+this.selected_group.size[1]])*this.ds.scale<10?this.selected_group_resizing=!0:this.selected_group.recomputeInsideNodes()),o&&!this.read_only&&this.allow_searchbox&&(this.showSearchBox(e),e.preventDefault(),e.stopPropagation())}return this.last_mouse[0]=e.clientX,this.last_mouse[1]=e.clientY,this.last_mouseclick=E.getTime(),this.last_mouse_dragging=!0,this.graph.change(),t.document.activeElement&&("input"==t.document.activeElement.nodeName.toLowerCase()||"textarea"==t.document.activeElement.nodeName.toLowerCase())||e.preventDefault(),e.stopPropagation(),this.onMouseDown&&this.onMouseDown(e),!1}}}},C.prototype.processMouseMove=function(e){if(this.autoresize&&this.resize(),this.set_canvas_dirty_on_mouse_event&&(this.dirty_canvas=!0),this.graph){(C.active_canvas=this).adjustMouseEvent(e);var t,n,r=[e.clientX,e.clientY],i=(this.mouse[0]=r[0],this.mouse[1]=r[1],[r[0]-this.last_mouse[0],r[1]-this.last_mouse[1]]);if(this.last_mouse=r,this.graph_mouse[0]=e.canvasX,this.graph_mouse[1]=e.canvasY,this.block_click)return e.preventDefault(),!1;if(e.dragging=this.last_mouse_dragging,this.node_widget&&(this.processNodeWidgets(this.node_widget[0],this.graph_mouse,e,this.node_widget[1]),this.dirty_canvas=!0),this.dragging_rectangle)this.dragging_rectangle[2]=e.canvasX-this.dragging_rectangle[0],this.dragging_rectangle[3]=e.canvasY-this.dragging_rectangle[1],this.dirty_canvas=!0;else if(this.selected_group&&!this.read_only)this.selected_group_resizing?this.selected_group.size=[e.canvasX-this.selected_group.pos[0],e.canvasY-this.selected_group.pos[1]]:(r=this.graph.ins.getSelectedGroup(),console.log(r,"groups"),t=i[0]/this.ds.scale,n=i[1]/this.ds.scale,0===r.length&&this.selected_group.move(t,n,e.ctrlKey),r.map((function(r){r.move(t,n,e.ctrlKey)})),(this.selected_group._nodes.length||0<r.length)&&(this.dirty_canvas=!0)),this.dirty_bgcanvas=!0;else if(this.dragging_canvas)this.ds.offset[0]+=i[0]/this.ds.scale,this.ds.offset[1]+=i[1]/this.ds.scale,this.dirty_canvas=!0,this.dirty_bgcanvas=!0;else if(this.allow_interaction&&!this.read_only){this.connecting_node&&(this.dirty_canvas=!0);for(var a,s,o,l=this.graph.getNodeOnPos(e.canvasX,e.canvasY,this.visible_nodes),u=0,c=this.graph._nodes.length;u<c;++u)this.graph._nodes[u].mouseOver&&l!=this.graph._nodes[u]&&(this.graph._nodes[u].mouseOver=!1,this.node_over&&this.node_over.onMouseLeave&&this.node_over.onMouseLeave(e),this.node_over=null,this.dirty_canvas=!0);if(l)l.redraw_on_mouse&&(this.dirty_canvas=!0),l.mouseOver||(l.mouseOver=!0,this.node_over=l,this.dirty_canvas=!0,l.onMouseEnter&&l.onMouseEnter(e)),l.onMouseMove&&l.onMouseMove(e,[e.canvasX-l.pos[0],e.canvasY-l.pos[1]],this),this.connecting_node&&(this.connecting_output?(a=this._highlight_input||[0,0],this.isOverNodeBox(l,e.canvasX,e.canvasY)||(-1!=(o=this.isOverNodeInput(l,e.canvasX,e.canvasY,a))&&l.inputs[o]?(s=l.inputs[o].type,E.isValidConnection(this.connecting_output.type,s)&&(this._highlight_input=a,this._highlight_input[1]+=10,this._highlight_input_slot=l.inputs[o])):(this._highlight_input=null,this._highlight_input_slot=null))):this.connecting_input&&(a=this._highlight_output||[0,0],this.isOverNodeBox(l,e.canvasX,e.canvasY)||(-1!=(o=this.isOverNodeOutput(l,e.canvasX,e.canvasY,a))&&l.outputs[o]?(s=l.outputs[o].type,E.isValidConnection(this.connecting_input.type,s)&&(this._highlight_output=a,this._highlight_output[1]+=10)):this._highlight_output=null))),this.canvas&&(z(e.canvasX,e.canvasY,l.pos[0]+l.size[0]-5,l.pos[1]+l.size[1]-5,5,5)?this.canvas.style.cursor="se-resize":this.canvas.style.cursor="crosshair");else{var d=null;for(u=0;u<this.visible_links.length;++u){var h=this.visible_links[u],p=h._pos;if(!(!p||e.canvasX<p[0]-4||e.canvasX>p[0]+4||e.canvasY<p[1]-4||e.canvasY>p[1]+4)){d=h;break}}d!=this.over_link_center&&(this.over_link_center=d,this.dirty_canvas=!0),this.canvas&&(this.canvas.style.cursor="")}if(this.node_capturing_input&&this.node_capturing_input!=l&&this.node_capturing_input.onMouseMove&&this.node_capturing_input.onMouseMove(e,[e.canvasX-this.node_capturing_input.pos[0],e.canvasY-this.node_capturing_input.pos[1]],this),this.node_dragged&&!this.live_mode){for(var u in this.selected_nodes){var f=this.selected_nodes[u];f.pos[0]+=i[0]/this.ds.scale,f.pos[1]+=i[1]/this.ds.scale}this.dirty_canvas=!0,this.dirty_bgcanvas=!0}this.resizing_node&&!this.live_mode&&(r=[e.canvasX-this.resizing_node.pos[0],e.canvasY-this.resizing_node.pos[1]],o=this.resizing_node.computeSize(),r[0]=Math.max(o[0],r[0]),r[1]=Math.max(o[1],r[1]),this.resizing_node.setSize(r),this.canvas.style.cursor="se-resize",this.dirty_canvas=!0,this.dirty_bgcanvas=!0)}return e.preventDefault(),!1}},C.prototype.processMouseUp=function(e){var t=void 0===e.isPrimary||e.isPrimary;if(!t)return!1;if(this.set_canvas_dirty_on_mouse_event&&(this.dirty_canvas=!0),this.graph){var n,r=this.getCanvasWindow().document;if((C.active_canvas=this).options.skip_events||(E.pointerListenerRemove(r,"move",this._mousemove_callback,!0),E.pointerListenerAdd(this.canvas,"move",this._mousemove_callback,!0),E.pointerListenerRemove(r,"up",this._mouseup_callback,!0)),this.adjustMouseEvent(e),r=E.getTime(),e.click_time=r-this.last_mouseclick,this.last_mouse_dragging=!1,this.last_click_position=null,this.block_click&&(this.block_click=!1),1==e.which)if(this.node_widget&&this.processNodeWidgets(this.node_widget[0],this.graph_mouse,e),this.node_widget=null,this.selected_group&&(r=this.selected_group.pos[0]-Math.round(this.selected_group.pos[0]),s=this.selected_group.pos[1]-Math.round(this.selected_group.pos[1]),this.selected_group.move(r,s,e.ctrlKey),this.selected_group.pos[0]=Math.round(this.selected_group.pos[0]),this.selected_group.pos[1]=Math.round(this.selected_group.pos[1]),this.selected_group._nodes.length&&(this.dirty_canvas=!0),this.selected_group=null),this.selected_group_resizing=!1,r=this.graph.getNodeOnPos(e.canvasX,e.canvasY,this.visible_nodes),console.log(r,"node"),r||(s=this.graph.getGroupOnPos(e.canvasX,e.canvasY),this.graph.ins.onSetSelectedGroupForUp(s)),this.dragging_rectangle){if(this.graph){var i=this.graph._nodes,a=new Float32Array(4),s=Math.abs(this.dragging_rectangle[2]),o=Math.abs(this.dragging_rectangle[3]),l=this.dragging_rectangle[2]<0?this.dragging_rectangle[0]-s:this.dragging_rectangle[0],u=this.dragging_rectangle[3]<0?this.dragging_rectangle[1]-o:this.dragging_rectangle[1];if(this.dragging_rectangle[0]=l,this.dragging_rectangle[1]=u,this.dragging_rectangle[2]=s,this.dragging_rectangle[3]=o,!r||10<s&&10<o){for(var c=[],d=0;d<i.length;++d){var h=i[d];h.getBounding(a),V(this.dragging_rectangle,a)&&c.push(h)}c.length&&this.selectNodes(c,e.shiftKey)}else this.selectNodes([r],e.shiftKey||e.ctrlKey)}this.dragging_rectangle=null}else this.connecting_node?(this.dirty_canvas=!0,this.dirty_bgcanvas=!0,l=(this.connecting_output||this.connecting_input).type,r?this.connecting_output?-1!=(n=this.isOverNodeInput(r,e.canvasX,e.canvasY))?this.connecting_node.connect(this.connecting_slot,r,n):this.connecting_node.connectByType(this.connecting_slot,r,l):this.connecting_input&&(-1!=(n=this.isOverNodeOutput(r,e.canvasX,e.canvasY))?r.connect(n,this.connecting_node,this.connecting_slot):this.connecting_node.connectByTypeOutput(this.connecting_slot,r,l)):E.release_link_on_empty_shows_menu&&(e.shiftKey&&this.allow_searchbox?this.connecting_output?this.showSearchBox(e,{node_from:this.connecting_node,slot_from:this.connecting_output,type_filter_in:this.connecting_output.type}):this.connecting_input&&this.showSearchBox(e,{node_to:this.connecting_node,slot_from:this.connecting_input,type_filter_out:this.connecting_input.type}):this.connecting_output?this.showConnectionMenu({nodeFrom:this.connecting_node,slotFrom:this.connecting_output,e}):this.connecting_input&&this.showConnectionMenu({nodeTo:this.connecting_node,slotTo:this.connecting_input,e})),this.connecting_output=null,this.connecting_input=null,this.connecting_pos=null,this.connecting_node=null,this.connecting_slot=-1):this.resizing_node?(this.dirty_canvas=!0,this.dirty_bgcanvas=!0,this.graph.afterChange(this.resizing_node),this.resizing_node=null):this.node_dragged?((r=this.node_dragged)&&e.click_time<300&&z(e.canvasX,e.canvasY,r.pos[0],r.pos[1]-E.NODE_TITLE_HEIGHT,E.NODE_TITLE_HEIGHT,E.NODE_TITLE_HEIGHT)&&r.collapse(),this.dirty_canvas=!0,this.dirty_bgcanvas=!0,this.node_dragged.pos[0]=Math.round(this.node_dragged.pos[0]),this.node_dragged.pos[1]=Math.round(this.node_dragged.pos[1]),(this.graph.config.align_to_grid||this.align_to_grid)&&this.node_dragged.alignToGrid(),this.onNodeMoved&&this.onNodeMoved(this.node_dragged),this.graph.afterChange(this.node_dragged),this.node_dragged=null):(!(r=this.graph.getNodeOnPos(e.canvasX,e.canvasY,this.visible_nodes))&&e.click_time<300&&this.deselectAllNodes(),this.dirty_canvas=!0,this.dragging_canvas=!1,this.node_over&&this.node_over.onMouseUp&&this.node_over.onMouseUp(e,[e.canvasX-this.node_over.pos[0],e.canvasY-this.node_over.pos[1]],this),this.node_capturing_input&&this.node_capturing_input.onMouseUp&&this.node_capturing_input.onMouseUp(e,[e.canvasX-this.node_capturing_input.pos[0],e.canvasY-this.node_capturing_input.pos[1]]));else(2==e.which||3==e.which)&&(this.dirty_canvas=!0,this.dragging_canvas=!1);return t&&(this.pointer_is_down=!1,this.pointer_is_double=!1),this.graph.change(),e.stopPropagation(),e.preventDefault(),!1}},C.prototype.processMouseWheel=function(e){if(this.graph&&this.allow_dragcanvas){var t=null!=e.wheelDeltaY?e.wheelDeltaY:-60*e.detail,n=(this.adjustMouseEvent(e),e.clientX),r=e.clientY;if(!this.viewport||this.viewport&&n>=this.viewport[0]&&n<this.viewport[0]+this.viewport[2]&&r>=this.viewport[1]&&r<this.viewport[1]+this.viewport[3])return n=this.ds.scale,0<t?n*=1.1:t<0&&(n*=1/1.1),this.ds.changeScale(n,[e.clientX,e.clientY]),this.graph.change(),e.preventDefault(),!1}},C.prototype.isOverNodeBox=function(e,t,n){var r=E.NODE_TITLE_HEIGHT;return!!z(t,n,e.pos[0]+2,e.pos[1]+2-r,r-4,r-4)},C.prototype.isOverNodeInput=function(e,t,n,r){if(e.inputs)for(var i=0,a=e.inputs.length;i<a;++i){e.inputs[i];var s=e.getConnectionPos(!0,i);if(e.horizontal?z(t,n,s[0]-5,s[1]-10,10,20):z(t,n,s[0]-10,s[1]+5,40,10))return r&&(r[0]=s[0],r[1]=s[1]),i}return-1},C.prototype.isOverNodeOutput=function(e,t,n,r){if(e.outputs)for(var i=0,a=e.outputs.length;i<a;++i){e.outputs[i];var s=e.getConnectionPos(!1,i);if(e.horizontal?z(t,n,s[0]-5,s[1]-10,10,20):z(t,n,s[0]-10,s[1]+5,40,10))return r&&(r[0]=s[0],r[1]=s[1]),i}return-1},C.prototype.processKey=function(e){if(this.graph){var t=!1;if("input"!=e.target.localName){if("keydown"==e.type){if(32==e.keyCode&&(t=this.dragging_canvas=!0),27==e.keyCode&&(this.node_panel&&this.node_panel.close(),this.options_panel&&this.options_panel.close(),t=!0),65==e.keyCode&&e.ctrlKey&&(this.selectNodes(),t=!0),"KeyC"!=e.code||!e.metaKey&&!e.ctrlKey||e.shiftKey||this.selected_nodes&&(this.copyToClipboard(),t=!0),"KeyV"!=e.code||!e.metaKey&&!e.ctrlKey||e.shiftKey||this.pasteFromClipboard(),46!=e.keyCode&&8!=e.keyCode||"input"!=e.target.localName&&"textarea"!=e.target.localName&&(this.deleteSelectedNodes(),t=!0),this.selected_nodes)for(var n in this.selected_nodes)this.selected_nodes[n].onKeyDown&&this.selected_nodes[n].onKeyDown(e)}else if("keyup"==e.type&&(32==e.keyCode&&(this.dragging_canvas=!1),this.selected_nodes))for(var n in this.selected_nodes)this.selected_nodes[n].onKeyUp&&this.selected_nodes[n].onKeyUp(e);return this.graph.change(),t?(e.preventDefault(),e.stopImmediatePropagation(),!1):void 0}}},C.prototype.copyToClipboard=function(){var e={nodes:[],links:[]},t=0,n=[];for(r in this.selected_nodes)(i=this.selected_nodes[r])._relative_id=t,n.push(i),t+=1;for(var r=0;r<n.length;++r){var i,a=(i=n[r]).clone();if(a){if(e.nodes.push(a.serialize()),i.inputs&&i.inputs.length)for(var s=0;s<i.inputs.length;++s){var o,l=i.inputs[s];l&&null!=l.link&&(l=this.graph.links[l.link])&&(o=this.graph.getNodeById(l.origin_id))&&this.selected_nodes[o.id]&&e.links.push([o._relative_id,l.origin_slot,i._relative_id,l.target_slot])}}else console.warn("node type not found: "+i.type)}localStorage.setItem("litegrapheditor_clipboard",JSON.stringify(e))},C.prototype.pasteFromClipboard=function(){var e=localStorage.getItem("litegrapheditor_clipboard");if(e){this.graph.beforeChange();for(var t=JSON.parse(e),n=!1,r=!1,i=0;i<t.nodes.length;++i)n?(n[0]>t.nodes[i].pos[0]&&(n[0]=t.nodes[i].pos[0],r[0]=i),n[1]>t.nodes[i].pos[1]&&(n[1]=t.nodes[i].pos[1],r[1]=i)):(n=[t.nodes[i].pos[0],t.nodes[i].pos[1]],r=[i,i]);var a=[];for(i=0;i<t.nodes.length;++i){var s=t.nodes[i],o=E.createNode(s.type);o&&(o.configure(s),o.pos[0]+=this.graph_mouse[0]-n[0],o.pos[1]+=this.graph_mouse[1]-n[1],this.graph.add(o,{doProcessChange:!1}),a.push(o))}for(i=0;i<t.links.length;++i){var l=t.links[i],u=a[l[0]],c=a[l[2]];u&&c?u.connect(l[1],c,l[3]):console.warn("Warning, nodes missing on pasting")}this.selectNodes(a),this.graph.afterChange()}},C.prototype.processDrop=function(e){e.preventDefault(),this.adjustMouseEvent(e);var t=e.clientX,n=e.clientY;if(!this.viewport||this.viewport&&t>=this.viewport[0]&&t<this.viewport[0]+this.viewport[2]&&n>=this.viewport[1]&&n<this.viewport[1]+this.viewport[3]){t=[e.canvasX,e.canvasY];var r=this.graph?this.graph.getNodeOnPos(t[0],t[1]):null;if(!r)return n=null,void((n=this.onDropItem?this.onDropItem(event):n)||this.checkDropItem(e));if(r.onDropFile||r.onDropData){var i=e.dataTransfer.files;if(i&&i.length)for(var a=0;a<i.length;a++){var s,o,l=e.dataTransfer.files[0],u=l.name;C.getFileExtension(u),r.onDropFile&&r.onDropFile(l),r.onDropData&&((s=new FileReader).onload=function(e){e=e.target.result,r.onDropData(e,u,l)},"text"==(o=l.type.split("/")[0])||""==o?s.readAsText(l):"image"==o?s.readAsDataURL(l):s.readAsArrayBuffer(l))}}return!(!r.onDropItem||!r.onDropItem(event))||!!this.onDropItem&&this.onDropItem(event)}},C.prototype.checkDropItem=function(e){var t,n;e.dataTransfer.files.length&&(t=e.dataTransfer.files[0],n=C.getFileExtension(t.name).toLowerCase(),(n=E.node_types_by_file_extension[n])&&(this.graph.beforeChange(),(n=E.createNode(n.type)).pos=[e.canvasX,e.canvasY],this.graph.add(n),n.onDropFile&&n.onDropFile(t),this.graph.afterChange()))},C.prototype.processNodeDblClicked=function(e){this.onShowNodePanel&&this.onShowNodePanel(e),this.onNodeDblClicked&&this.onNodeDblClicked(e),e.onNodeDblClicked&&e.onNodeDblClicked(),this.setDirty(!0)},C.prototype.processNodeSelected=function(e,t){this.selectNode(e,t&&(t.shiftKey||t.ctrlKey)),this.onNodeSelected&&this.onNodeSelected(e)},C.prototype.selectNode=function(e,t){null==e?this.deselectAllNodes():this.selectNodes([e],t)},C.prototype.selectNodes=function(e,t){for(var n in t||this.deselectAllNodes(),e="string"==typeof(e=e||this.graph._nodes)?[e]:e){var r=e[n];if(!r.is_selected){if(!r.is_selected&&r.onSelected&&r.onSelected(),r.is_selected=!0,(this.selected_nodes[r.id]=r).inputs)for(var i=0;i<r.inputs.length;++i)this.highlighted_links[r.inputs[i].link]=!0;if(r.outputs)for(i=0;i<r.outputs.length;++i){var a=r.outputs[i];if(a.links)for(var s=0;s<a.links.length;++s)this.highlighted_links[a.links[s]]=!0}}}this.onSelectionChange&&this.onSelectionChange(this.selected_nodes),this.setDirty(!0)},C.prototype.deselectNode=function(e){if(e.is_selected){if(e.onDeselected&&e.onDeselected(),e.is_selected=!1,this.onNodeDeselected&&this.onNodeDeselected(e),e.inputs)for(var t=0;t<e.inputs.length;++t)delete this.highlighted_links[e.inputs[t].link];if(e.outputs)for(t=0;t<e.outputs.length;++t){var n=e.outputs[t];if(n.links)for(var r=0;r<n.links.length;++r)delete this.highlighted_links[n.links[r]]}}},C.prototype.deselectAllNodes=function(){if(this.graph){for(var e=this.graph._nodes,t=0,n=e.length;t<n;++t){var r=e[t];r.is_selected&&(r.onDeselected&&r.onDeselected(),r.is_selected=!1,this.onNodeDeselected&&this.onNodeDeselected(r))}this.selected_nodes={},this.current_node=null,this.highlighted_links={},this.onSelectionChange&&this.onSelectionChange(this.selected_nodes),this.setDirty(!0)}},C.prototype.deleteSelectedNodes=function(){for(var e in this.graph.beforeChange(),this.selected_nodes){var t,n,r,i;(e=this.selected_nodes[e]).block_delete||(e.inputs&&e.inputs.length&&e.outputs&&e.outputs.length&&E.isValidConnection(e.inputs[0].type,e.outputs[0].type)&&e.inputs[0].link&&e.outputs[0].links&&e.outputs[0].links.length&&(t=e.graph.links[e.inputs[0].link],n=e.graph.links[e.outputs[0].links[0]],r=e.getInputNode(0),i=e.getOutputNodes(0)[0],r&&i&&r.connect(t.origin_slot,i,n.target_slot)),this.graph.remove(e),this.onNodeDeselected&&this.onNodeDeselected(e))}this.selected_nodes={},this.current_node=null,this.highlighted_links={},this.setDirty(!0),this.graph.afterChange()},C.prototype.centerOnNode=function(e){this.ds.offset[0]=-e.pos[0]-.5*e.size[0]+.5*this.canvas.width/this.ds.scale,this.ds.offset[1]=-e.pos[1]-.5*e.size[1]+.5*this.canvas.height/this.ds.scale,this.setDirty(!0,!0)},C.prototype.adjustMouseEvent=function(e){var t,n,r=0;n=this.canvas?(t=this.canvas.getBoundingClientRect(),r=e.clientX-t.left,e.clientY-t.top):(r=e.clientX,e.clientY),this.last_mouse_position[0]=r,this.last_mouse_position[1]=n,e.canvasX=r/this.ds.scale-this.ds.offset[0],e.canvasY=n/this.ds.scale-this.ds.offset[1]},C.prototype.setZoom=function(e,t){this.ds.changeScale(e,t),this.dirty_canvas=!0,this.dirty_bgcanvas=!0},C.prototype.convertOffsetToCanvas=function(e,t){return this.ds.convertOffsetToCanvas(e,t)},C.prototype.convertCanvasToOffset=function(e,t){return this.ds.convertCanvasToOffset(e,t)},C.prototype.convertEventToCanvasOffset=function(e){var t=this.canvas.getBoundingClientRect();return this.convertCanvasToOffset([e.clientX-t.left,e.clientY-t.top])},C.prototype.bringToFront=function(e){var t=this.graph._nodes.indexOf(e);-1!=t&&(this.graph._nodes.splice(t,1),this.graph._nodes.push(e))},C.prototype.sendToBack=function(e){var t=this.graph._nodes.indexOf(e);-1!=t&&(this.graph._nodes.splice(t,1),this.graph._nodes.unshift(e))};var N=new Float32Array(4),L=(C.prototype.computeVisibleNodes=function(e,t){for(var n=t||[],r=n.length=0,i=(e=e||this.graph._nodes).length;r<i;++r){var a=e[r];(!this.live_mode||a.onDrawBackground||a.onDrawForeground)&&V(this.visible_area,a.getBounding(N))&&n.push(a)}return n},C.prototype.draw=function(e,t){var n;this.canvas&&0!=this.canvas.width&&0!=this.canvas.height&&(n=E.getTime(),this.render_time=.001*(n-this.last_draw_time),this.last_draw_time=n,this.graph&&this.ds.computeVisibleArea(this.viewport),(this.dirty_bgcanvas||t||this.always_render_background||this.graph&&this.graph._last_trigger_time&&n-this.graph._last_trigger_time<1e3)&&this.drawBackCanvas(),(this.dirty_canvas||e)&&this.drawFrontCanvas(),this.fps=this.render_time?1/this.render_time:0,this.frame+=1)},C.prototype.drawFrontCanvas=function(){this.dirty_canvas=!1,this.ctx||(this.ctx=this.bgcanvas.getContext("2d"));var e=this.ctx;if(e){var t=this.canvas,n=(e.start2D&&!this.viewport&&(e.start2D(),e.restore(),e.setTransform(1,0,0,1,0,0)),this.viewport||this.dirty_area);if(n&&(e.save(),e.beginPath(),e.rect(n[0],n[1],n[2],n[3]),e.clip()),this.clear_background&&(n?e.clearRect(n[0],n[1],n[2],n[3]):e.clearRect(0,0,t.width,t.height)),this.bgcanvas==this.canvas?this.drawBackCanvas():e.drawImage(this.bgcanvas,0,0),this.onRender&&this.onRender(t,e),this.show_info&&this.renderInfo(e,n?n[0]:0,n?n[1]:0),this.graph){e.save(),this.ds.toCanvasContext(e);for(var r,i,a,s,o=this.computeVisibleNodes(null,this.visible_nodes),l=0;l<o.length;++l){var u=o[l];e.save(),e.translate(u.pos[0],u.pos[1]),this.drawNode(u,e),e.restore()}this.render_execution_order&&this.drawExecutionOrder(e),!this.graph.config.links_ontop||this.live_mode||this.drawConnections(e),null!=this.connecting_pos&&(e.lineWidth=this.connections_width,r=(t=this.connecting_output||this.connecting_input).type,null==(i=t.dir)&&(i=this.connecting_output?this.connecting_node.horizontal?E.DOWN:E.RIGHT:this.connecting_node.horizontal?E.UP:E.LEFT),t=t.shape,s=M(r),this.renderLink(e,this.connecting_pos,[this.graph_mouse[0],this.graph_mouse[1]],null,!1,null,s,i,E.CENTER),e.beginPath(),r===E.EVENT||t===E.BOX_SHAPE?(S({ctx:e,width:14,x:this.connecting_pos[0]-6+.5,y:this.connecting_pos[1]-5+.5,state:!0}),e.fill(),e.beginPath(),S({ctx:e,width:14,x:this.graph_mouse[0]-6+.5,y:this.graph_mouse[1]-5+.5,state:!0})):t===E.ARROW_SHAPE?(e.moveTo(this.connecting_pos[0]+8,this.connecting_pos[1]+.5),e.lineTo(this.connecting_pos[0]-4,this.connecting_pos[1]+6+.5),e.lineTo(this.connecting_pos[0]-4,this.connecting_pos[1]-6+.5),e.closePath()):(e.arc(this.connecting_pos[0],this.connecting_pos[1],4,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(this.graph_mouse[0],this.graph_mouse[1],4,0,2*Math.PI)),e.fill(),e.fillStyle="#ffcc00",this._highlight_input&&(e.beginPath(),(a=this._highlight_input_slot.shape)===E.ARROW_SHAPE?(e.moveTo(this._highlight_input[0]+8,this._highlight_input[1]+.5),e.lineTo(this._highlight_input[0]-4,this._highlight_input[1]+6+.5),e.lineTo(this._highlight_input[0]-4,this._highlight_input[1]-6+.5),e.closePath()):e.arc(this._highlight_input[0],this._highlight_input[1],6,0,2*Math.PI),e.fill()),this._highlight_output&&(e.beginPath(),a===E.ARROW_SHAPE?(e.moveTo(this._highlight_output[0]+8,this._highlight_output[1]+.5),e.lineTo(this._highlight_output[0]-4,this._highlight_output[1]+6+.5),e.lineTo(this._highlight_output[0]-4,this._highlight_output[1]-6+.5),e.closePath()):e.arc(this._highlight_output[0],this._highlight_output[1],6,0,2*Math.PI),e.fill())),this.dragging_rectangle&&(e.strokeStyle="#FFF",e.strokeRect(this.dragging_rectangle[0],this.dragging_rectangle[1],this.dragging_rectangle[2],this.dragging_rectangle[3])),this.over_link_center&&this.render_link_tooltip?this.drawLinkTooltip(e,this.over_link_center):this.onDrawLinkTooltip&&this.onDrawLinkTooltip(e,null),this.onDrawForeground&&this.onDrawForeground(e,this.visible_rect),e.restore()}this._graph_stack&&this._graph_stack.length&&this.drawSubgraphPanel(e),this.onDrawOverlay&&this.onDrawOverlay(e),n&&e.restore(),e.finish2D&&e.finish2D()}},C.prototype.drawSubgraphPanel=function(e){var t=this.graph,n=t._subgraph_node;n?(this.drawSubgraphPanelLeft(t,n,e),this.drawSubgraphPanelRight(t,n,e)):console.warn("subgraph without subnode")},C.prototype.drawSubgraphPanelLeft=function(e,t,n){var r=t.inputs?t.inputs.length:0,i=Math.floor(1.6*E.NODE_SLOT_HEIGHT);if(n.fillStyle="#111",n.globalAlpha=.8,n.beginPath(),n.roundRect(10,10,200,(r+1)*i+50,[8]),n.fill(),n.globalAlpha=1,n.fillStyle="#888",n.font="14px Arial",n.textAlign="left",n.fillText("Graph Inputs",20,34),this.drawButton(180,20,20,20,"X","#151515"))this.closeSubgraph();else{var a=50;if(n.font="14px Arial",t.inputs)for(var s=0;s<t.inputs.length;++s){var o,l,u=t.inputs[s];u.not_subgraph_input||(this.drawButton(20,a+2,180,i-2)&&(o=t.constructor.input_node_type||"graph/input",this.graph.beforeChange(),(l=E.createNode(o))?(e.add(l),this.block_click=!1,this.last_click_position=null,this.selectNodes([l]),this.node_dragged=l,this.dragging_canvas=!1,l.setProperty("name",u.name),l.setProperty("type",u.type),this.node_dragged.pos[0]=this.graph_mouse[0]-5,this.node_dragged.pos[1]=this.graph_mouse[1]-5,this.graph.afterChange()):console.error("graph input node not found:",o)),n.fillStyle="#9C9",n.beginPath(),n.arc(184,a+.5*i,5,0,2*Math.PI),n.fill(),n.fillStyle="#AAA",n.fillText(u.name,30,a+.75*i),n.fillStyle="#777",n.fillText(u.type,130,a+.75*i),a+=i)}this.drawButton(20,a+2,180,i-2,"+","#151515","#222")&&this.showSubgraphPropertiesDialog(t)}},C.prototype.drawSubgraphPanelRight=function(e,t,n){var r=t.outputs?t.outputs.length:0,i=this.bgcanvas.width,a=Math.floor(1.6*E.NODE_SLOT_HEIGHT),s=(n.fillStyle="#111",n.globalAlpha=.8,n.beginPath(),n.roundRect(i-200-10,10,200,(r+1)*a+50,[8]),n.fill(),n.globalAlpha=1,n.fillStyle="#888",n.font="14px Arial",n.textAlign="left",r="Graph Outputs",n.measureText(r).width);if(n.fillText(r,i-s-20,34),this.drawButton(i-200,20,20,20,"X","#151515"))this.closeSubgraph();else{var o=50;if(n.font="14px Arial",t.outputs)for(var l=0;l<t.outputs.length;++l){var u,c,d=t.outputs[l];d.not_subgraph_input||(this.drawButton(i-200,o+2,180,a-2)&&(u=t.constructor.output_node_type||"graph/output",this.graph.beforeChange(),(c=E.createNode(u))?(e.add(c),this.block_click=!1,this.last_click_position=null,this.selectNodes([c]),this.node_dragged=c,this.dragging_canvas=!1,c.setProperty("name",d.name),c.setProperty("type",d.type),this.node_dragged.pos[0]=this.graph_mouse[0]-5,this.node_dragged.pos[1]=this.graph_mouse[1]-5,this.graph.afterChange()):console.error("graph input node not found:",u)),n.fillStyle="#9C9",n.beginPath(),n.arc(i-200+16,o+.5*a,5,0,2*Math.PI),n.fill(),n.fillStyle="#AAA",n.fillText(d.name,i-200+30,o+.75*a),n.fillStyle="#777",n.fillText(d.type,i-200+130,o+.75*a),o+=a)}this.drawButton(i-200,o+2,180,a-2,"+","#151515","#222")&&this.showSubgraphPropertiesDialogRight(t)}},C.prototype.drawButton=function(e,t,n,r,i,a,s,o){var l=this.ctx,u=(a=a||E.NODE_DEFAULT_COLOR,s=s||"#555",o=o||E.NODE_TEXT_COLOR,t+E.NODE_TITLE_HEIGHT+2),c=this.mouse,d=E.isInsideRectangle(c[0],c[1],e,u,n,r);return c=(c=this.last_click_position)&&E.isInsideRectangle(c[0],c[1],e,u,n,r),l.fillStyle=d?s:a,c&&(l.fillStyle="#AAA"),l.beginPath(),l.roundRect(e,t,n,r,[4]),l.fill(),null!=i&&i.constructor==String&&(l.fillStyle=o,l.textAlign="center",l.font=(.65*r|0)+"px Arial",l.fillText(i,e+.5*n,t+.75*r),l.textAlign="left"),u=c&&!this.block_click,c&&this.blockClick(),u},C.prototype.isAreaClicked=function(e,t,n,r,i){var a=this.mouse;return E.isInsideRectangle(a[0],a[1],e,t,n,r),e=(a=(a=this.last_click_position)&&E.isInsideRectangle(a[0],a[1],e,t,n,r))&&!this.block_click,a&&i&&this.blockClick(),e},C.prototype.renderInfo=function(e,t,n){t=t||10,n=n||this.canvas.height-80,e.save(),e.translate(t,n),e.font="10px Arial",e.fillStyle="#888",e.textAlign="left",this.graph?(e.fillText("T: "+this.graph.globaltime.toFixed(2)+"s",5,13),e.fillText("I: "+this.graph.iteration,5,26),e.fillText("N: "+this.graph._nodes.length+" ["+this.visible_nodes.length+"]",5,39),e.fillText("V: "+this.graph._version,5,52),e.fillText("FPS:"+this.fps.toFixed(2),5,65)):e.fillText("No graph selected",5,13),e.restore()},C.prototype.drawBackCanvas=function(){var e,t=this.bgcanvas,n=(t.width==this.canvas.width&&t.height==this.canvas.height||(t.width=this.canvas.width,t.height=this.canvas.height),this.bgctx||(this.bgctx=this.bgcanvas.getContext("2d")),this.bgctx),r=(n.start&&n.start(),this.viewport||[0,0,n.canvas.width,n.canvas.height]);if(this.clear_background&&n.clearRect(r[0],r[1],r[2],r[3]),this._graph_stack&&this._graph_stack.length){n.save(),this._graph_stack[this._graph_stack.length-1],r=this.graph._subgraph_node;for(var i=(n.strokeStyle=r.bgcolor,n.lineWidth=10,n.strokeRect(1,1,t.width-2,t.height-2),n.lineWidth=1,n.font="40px Arial",n.textAlign="center",n.fillStyle=r.bgcolor||"#AAA",""),a=1;a<this._graph_stack.length;++a)i+=this._graph_stack[a]._subgraph_node.getTitle()+" >> ";n.fillText(i+r.getTitle(),.5*t.width,40),n.restore()}r=!1,this.onRenderBackground&&(r=this.onRenderBackground(t,n)),this.viewport||(n.restore(),n.setTransform(1,0,0,1,0,0)),this.visible_links.length=0,this.graph&&(n.save(),this.ds.toCanvasContext(n),this.background_image&&.5<this.ds.scale&&!r&&(this.zoom_modify_alpha?n.globalAlpha=(1-.5/this.ds.scale)*this.editor_alpha:n.globalAlpha=this.editor_alpha,n.imageSmoothingEnabled=n.imageSmoothingEnabled=!1,this._bg_img&&this._bg_img.name==this.background_image||(this._bg_img=new Image,this._bg_img.name=this.background_image,this._bg_img.src=this.background_image,(e=this)._bg_img.onload=function(){e.draw(!0,!0)}),(r=null)==this._pattern&&0<this._bg_img.width?(r=n.createPattern(this._bg_img,"repeat"),this._pattern_img=this._bg_img,this._pattern=r):r=this._pattern,r&&(n.fillStyle=r,n.fillRect(this.visible_area[0],this.visible_area[1],this.visible_area[2],this.visible_area[3]),n.fillStyle="transparent"),n.globalAlpha=1,n.imageSmoothingEnabled=n.imageSmoothingEnabled=!0),this.graph._groups.length&&!this.live_mode&&this.drawGroups(t,n),this.onDrawBackground&&this.onDrawBackground(n,this.visible_area),this.onBackgroundRender&&(console.error("WARNING! onBackgroundRender deprecated, now is named onDrawBackground "),this.onBackgroundRender=null),this.render_canvas_border&&(n.strokeStyle="#235",n.strokeRect(0,0,t.width,t.height)),this.render_connections_shadows?(n.shadowColor="#000",n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=6):n.shadowColor="rgba(0,0,0,0)",this.live_mode||this.drawConnections(n),n.shadowColor="rgba(0,0,0,0)",n.restore()),n.finish&&n.finish(),this.dirty_bgcanvas=!1,this.dirty_canvas=!0},new Float32Array(2)),I=(C.prototype.drawNode=function(e,t){var n=(this.current_node=e).color||e.constructor.color||E.NODE_DEFAULT_COLOR,r=e.bgcolor||e.constructor.bgcolor||E.NODE_DEFAULT_BGCOLOR,i=(e.mouseOver,this.ds.scale<.6);if(this.live_mode)e.flags.collapsed||(t.shadowColor="transparent",e.onDrawForeground&&e.onDrawForeground(t,this,this.canvas));else{var a=this.editor_alpha;if(t.globalAlpha=a,this.render_shadows&&!i?(t.shadowColor=E.DEFAULT_SHADOW_COLOR,t.shadowOffsetX=E.DEFAULT_SHADOW_OFFSETX||2*this.ds.scale,t.shadowOffsetY=E.DEFAULT_SHADOW_OFFSETY||2*this.ds.scale,t.shadowBlur=E.DEFAULT_SHADOW_BLUR||3*this.ds.scale):t.shadowColor="transparent",!e.flags.collapsed||!e.onDrawCollapsed||1!=e.onDrawCollapsed(t,this)){var s,o=e._shape||E.BOX_SHAPE,l=L,u=(L.set(e.size),e.horizontal),c=(e.flags.collapsed&&(t.font=this.inner_text_font,null!=(s=e.getTitle?e.getTitle():e.title)&&(e._collapsed_width=Math.min(e.size[0],t.measureText(s).width+2*E.NODE_TITLE_HEIGHT),l[0]=e._collapsed_width,l[1]=0)),e.clip_area&&(t.save(),t.beginPath(),o==E.BOX_SHAPE?t.rect(0,0,l[0],l[1]):o==E.ROUND_SHAPE?t.roundRect(0,0,l[0],l[1],[10]):o==E.CIRCLE_SHAPE&&t.arc(.5*l[0],.5*l[1],.5*l[0],0,2*Math.PI),t.clip()),e.has_errors&&(r="red"),this.drawNodeShape(e,t,l,n,r,e.is_selected,e.mouseOver),t.shadowColor="transparent",e.onDrawForeground&&e.onDrawForeground(t,this,this.canvas),t.textAlign=u?"center":"left",t.font=this.inner_text_font,!i),d=this.connecting_output,h=this.connecting_input,p=(t.lineWidth=1,0),f=new Float32Array(2);if(e.flags.collapsed){if(this.render_collapsed_slots){var m,g,v=null,y=null;if(e.inputs)for(b=0;b<e.inputs.length;b++)if(null!=(D=e.inputs[b]).link){v=D;break}if(e.outputs)for(b=0;b<e.outputs.length;b++)(D=e.outputs[b]).links&&D.links.length&&(y=D);v&&(m=0,g=-.5*E.NODE_TITLE_HEIGHT,u&&(m=.5*e._collapsed_width,g=-E.NODE_TITLE_HEIGHT),t.fillStyle="#686",t.beginPath(),D.type===E.EVENT||D.shape===E.BOX_SHAPE?t.rect(m-7+.5,g-4,14,8):D.shape===E.ARROW_SHAPE?(t.moveTo(m+8,g),t.lineTo(m+-4,g-4),t.lineTo(m+-4,g+4),t.closePath()):t.arc(m,g,4,0,2*Math.PI),t.fill()),y&&(m=e._collapsed_width,g=-.5*E.NODE_TITLE_HEIGHT,u&&(m=.5*e._collapsed_width,g=0),t.fillStyle="#686",t.strokeStyle="black",t.beginPath(),D.type===E.EVENT||D.shape===E.BOX_SHAPE?t.rect(m-7+.5,g-4,14,8):D.shape===E.ARROW_SHAPE?(t.moveTo(m+6,g),t.lineTo(m-6,g-4),t.lineTo(m-6,g+4),t.closePath()):t.arc(m,g,4,0,2*Math.PI),t.fill())}}else{if(e.inputs)for(var b=0;b<e.inputs.length;b++){var x=(D=e.inputs[b]).type,w=D.shape;t.globalAlpha=a,this.connecting_output&&!E.isValidConnection(D.type,d.type)&&(t.globalAlpha=.4*a),t.fillStyle=null!=D.link?D.color_on||this.default_connection_color_byType[x]||this.default_connection_color.input_on:D.color_off||this.default_connection_color_byTypeOff[x]||this.default_connection_color_byType[x]||this.default_connection_color.input_off,(P=e.getConnectionPos(!0,b,f))[0]-=e.pos[0],P[1]-=e.pos[1],p<P[1]+.5*E.NODE_SLOT_HEIGHT&&(p=P[1]+.5*E.NODE_SLOT_HEIGHT),t.beginPath(),"array"==x&&(w=E.GRID_SHAPE);var _=!0;D.type===E.EVENT||D.shape===E.BOX_SHAPE?u?t.rect(P[0]-5+.5,P[1]-8+.5,E.MY_NODE_EVEMT_HEIGHT,E.MY_NODE_EVEMT_WIDTH):(t.strokeStyle=M(x),S({ctx:t,width:14,x:P[0]-6+.5,y:P[1]+5+.5,state:null!=D.link})):w===E.ARROW_SHAPE?(t.moveTo(P[0]+8,P[1]+.5),t.lineTo(P[0]-4,P[1]+6+.5),t.lineTo(P[0]-4,P[1]-6+.5),t.closePath()):w===E.GRID_SHAPE?(t.rect(P[0]-4,P[1]-4,2,2),t.rect(P[0]-1,P[1]-4,2,2),t.rect(P[0]+2,P[1]-4,2,2),t.rect(P[0]-4,P[1]-1,2,2),t.rect(P[0]-1,P[1]-1,2,2),t.rect(P[0]+2,P[1]-1,2,2),t.rect(P[0]-4,P[1]+2,2,2),t.rect(P[0]-1,P[1]+2,2,2),t.rect(P[0]+2,P[1]+2,2,2),_=!1):i?t.rect(P[0]-4,P[1]+4,8,8):(T({x:P[0]-3,y:P[1]+11,width:4,ctx:t,state:null!==D.link&&void 0!==D.link}),_=!1),t.fill(),c&&(k=null!=D.label?D.label:D.name)&&(t.fillStyle=E.NODE_TEXT_COLOR,u||D.dir==E.UP?t.fillText(k,P[0],P[1]-10):t.fillText(k,P[0]+10,P[1]+15))}if(t.textAlign=u?"center":"right",t.strokeStyle="black",e.outputs)for(b=0;b<e.outputs.length;b++){var D;x=(D=e.outputs[b]).type,w=D.shape,this.connecting_input&&!E.isValidConnection(x,h.type)&&(t.globalAlpha=.4*a),(P=e.getConnectionPos(!1,b,f))[0]-=e.pos[0],P[1]-=e.pos[1],p<P[1]+.5*E.NODE_SLOT_HEIGHT&&(p=P[1]+.5*E.NODE_SLOT_HEIGHT),t.fillStyle=D.links&&D.links.length?D.color_on||this.default_connection_color_byType[x]||this.default_connection_color.output_on:D.color_off||this.default_connection_color_byTypeOff[x]||this.default_connection_color_byType[x]||this.default_connection_color.output_off,t.beginPath(),"array"==x&&(w=E.GRID_SHAPE),_=!0;var P,k,O=0<(null==(O=D.links)?void 0:O.length);x===E.EVENT||w===E.BOX_SHAPE?u?t.rect(P[0]-5+.5,P[1]-8+.5,10,14):(t.strokeStyle=M(x),S({ctx:t,width:14,x:P[0]-6+.5+2,y:P[1]+5+.5,state:O}),_=!1):w===E.ARROW_SHAPE?(t.moveTo(P[0]+8,P[1]+.5),t.lineTo(P[0]-4,P[1]+6+.5),t.lineTo(P[0]-4,P[1]-6+.5),t.closePath()):w===E.GRID_SHAPE?(t.rect(P[0]-4,P[1]-4,2,2),t.rect(P[0]-1,P[1]-4,2,2),t.rect(P[0]+2,P[1]-4,2,2),t.rect(P[0]-4,P[1]-1,2,2),t.rect(P[0]-1,P[1]-1,2,2),t.rect(P[0]+2,P[1]-1,2,2),t.rect(P[0]-4,P[1]+2,2,2),t.rect(P[0]-1,P[1]+2,2,2),t.rect(P[0]+2,P[1]+2,2,2),_=!1):i?t.rect(P[0]-4,P[1]+4,8,8):(T({x:P[0],y:P[1]+10,width:4,ctx:t,state:O}),_=!1),t.fill(),!i&&_&&t.stroke(),c&&(k=null!=D.label?D.label:D.name)&&(t.fillStyle=E.NODE_TEXT_COLOR,u||D.dir==E.DOWN?t.fillText(k,P[0],P[1]-8):t.fillText(k,P[0]-10,P[1]+10+5))}t.textAlign="left",t.globalAlpha=1,e.widgets&&(s=p,(u||e.widgets_up)&&(s=2),null!=e.widgets_start_y&&(s=e.widgets_start_y),this.drawNodeWidgets(e,s,t,this.node_widget&&this.node_widget[0]==e?this.node_widget[1]:null))}null!=(o=e.afterDrawNode)&&o.call(e,t),t.beginPath(),e.drawMessage(t),e.clip_area&&t.restore(),t.globalAlpha=1}}},C.prototype.drawLinkTooltip=function(e,t){var n,r=t._pos;e.fillStyle="black",e.beginPath(),e.arc(r[0],r[1],3,0,2*Math.PI),e.fill(),null==t.data||this.onDrawLinkTooltip&&1==this.onDrawLinkTooltip(e,t,this)||(n=null)!=(n=(t=t.data).constructor===Number?t.toFixed(2):t.constructor===String?'"'+t+'"':t.constructor===Boolean?String(t):t.toToolTip?t.toToolTip():"["+t.constructor.name+"]")&&(n=n.substr(0,30),e.font="14px Courier New",t=e.measureText(n).width+20,e.shadowColor="black",e.shadowOffsetX=2,e.shadowOffsetY=2,e.shadowBlur=3,e.fillStyle="#454",e.beginPath(),e.roundRect(r[0]-.5*t,r[1]-15-24,t,24,[3]),e.moveTo(r[0]-10,r[1]-15),e.lineTo(r[0]+10,r[1]-15),e.lineTo(r[0],r[1]-5),e.fill(),e.shadowColor="transparent",e.textAlign="center",e.fillStyle="#CEC",e.fillText(n,r[0],r[1]-15-24*.3))},new Float32Array(4)),R=(C.prototype.drawNodeShape=function(e,t,n,r,i,a,s){t.strokeStyle=r,t.fillStyle=i,i=E.NODE_TITLE_HEIGHT;var o,l=this.ds.scale<.5,u=e._shape||e.constructor.shape||E.ROUND_SHAPE,c=e.constructor.title_mode,d=!0,h=((c==E.TRANSPARENT_TITLE||c==E.NO_TITLE?d=!1:c==E.AUTOHIDE_TITLE&&s&&(d=!0),s=I)[0]=0,s[1]=d?-i:0,s[2]=n[0]+1,s[3]=d?n[1]+i:n[1],t.globalAlpha);t.beginPath(),u==E.BOX_SHAPE||l?t.fillRect(s[0],s[1],s[2],s[3]):u==E.ROUND_SHAPE||u==E.CARD_SHAPE?t.roundRect(s[0],s[1],s[2],s[3],E.MY_NODE_OPEN_RADIUS):u==E.CIRCLE_SHAPE&&t.arc(.5*n[0],.5*n[1],.5*n[0],0,2*Math.PI),t.fill(),!e.flags.collapsed&&d&&(t.shadowColor="transparent",t.fillStyle="rgba(0,0,0,0.2)",t.fillRect(0,-1,s[2],2)),t.shadowColor="transparent",e.onDrawBackground&&e.onDrawBackground(t,this,this.canvas,this.graph_mouse),!d&&c!=E.TRANSPARENT_TITLE||(e.onDrawTitleBar?e.onDrawTitleBar(t,i,n,this.ds.scale,r):c!=E.TRANSPARENT_TITLE&&(e.constructor.title_color||this.render_title_colored)&&(d=e.constructor.title_color||r,e.flags.collapsed&&(t.shadowColor=E.DEFAULT_SHADOW_COLOR),this.use_gradients?((o=C.gradients[d])||((o=C.gradients[d]=t.createLinearGradient(0,0,400,0)).addColorStop(0,d),o.addColorStop(1,"#000")),t.fillStyle=o):t.fillStyle=d,t.beginPath(),u==E.BOX_SHAPE||l?t.rect(0,-i,n[0]+1,i):u!=E.ROUND_SHAPE&&u!=E.CARD_SHAPE||t.roundRect(0,-i,n[0]+1,i,e.flags.collapsed?E.MY_NODE_CLOSE_RADIUS:[E.MY_NODE_OPEN_RADIUS,E.MY_NODE_OPEN_RADIUS,0,0]),t.fill(),t.shadowColor="transparent"),o=!1,E.node_box_coloured_by_mode&&E.NODE_MODES_COLORS[e.mode]&&(o=E.NODE_MODES_COLORS[e.mode]),E.node_box_coloured_when_on&&(o=e.action_triggered?"#FFF":e.execute_triggered?"#AAA":o),e.onDrawTitleBox?e.onDrawTitleBox(t,i,n,this.ds.scale):u==E.ROUND_SHAPE||u==E.CIRCLE_SHAPE||u==E.CARD_SHAPE?(l&&(t.fillStyle="black",t.beginPath(),t.arc(.5*i,-.5*i,6,0,2*Math.PI),t.fill()),t.fillStyle=e.boxcolor||o||E.NODE_DEFAULT_BOXCOLOR,l?t.fillRect(.5*i-5,-.5*i-5,10,10):(t.beginPath(),t.arc(.5*i,-.5*i,5,0,2*Math.PI),t.fill())):(l&&(t.fillStyle="black",t.fillRect(.5*(i-10)-1,-.5*(i+10)-1,12,12)),t.fillStyle=e.boxcolor||o||E.NODE_DEFAULT_BOXCOLOR,t.fillRect(.5*(i-10),-.5*(i+10),10,10)),t.globalAlpha=h,e.onDrawTitleText&&e.onDrawTitleText(t,i,n,this.ds.scale,this.title_text_font,a),l||(t.font=this.title_text_font,(d=String(e.getTitle()))&&(t.fillStyle=a?E.NODE_SELECTED_TITLE_COLOR:e.constructor.title_text_color||this.node_title_color,e.flags.collapsed?(t.textAlign="left",t.measureText(d),t.fillText(d.substr(0,20),i,E.NODE_TITLE_TEXT_Y-i),t.textAlign="left"):(t.textAlign="left",t.fillText(d,i,E.NODE_TITLE_TEXT_Y-i)))),e.flags.collapsed||!e.subgraph||e.skip_subgraph_button||(o=E.NODE_TITLE_HEIGHT,h=e.size[0]-o,d=E.isInsideRectangle(this.graph_mouse[0]-e.pos[0],this.graph_mouse[1]-e.pos[1],2+h,2-o,o-4,o-4),t.fillStyle=d?"#888":"#555",u==E.BOX_SHAPE||l?t.fillRect(2+h,2-o,o-4,o-4):(t.beginPath(),t.roundRect(2+h,2-o,o-4,o-4,[4]),t.fill()),t.fillStyle="#333",t.beginPath(),t.moveTo(h+.2*o,.6*-o),t.lineTo(h+.8*o,.6*-o),t.lineTo(h+.5*o,.3*-o),t.fill()),e.onDrawTitle&&e.onDrawTitle(t)),a&&(e.onBounding&&e.onBounding(s),c==E.TRANSPARENT_TITLE&&(s[1]-=i,s[3]+=i),t.strokeStyle=E.MY_OUTLINE_COLOR,t.stroke(),t.lineWidth=1,t.globalAlpha=1,t.beginPath(),u==E.BOX_SHAPE?t.rect(-1+s[0],-1+s[1],2+s[2],2+s[3]):u==E.ROUND_SHAPE||u==E.CARD_SHAPE&&e.flags.collapsed?t.roundRect(-1+s[0],-1+s[1],2+s[2],2+s[3],e.flags.collapsed?E.MY_NODE_CLOSE_RADIUS:E.MY_NODE_OPEN_RADIUS):u==E.CARD_SHAPE?t.roundRect(-1+s[0],-1+s[1],2+s[2],2+s[3],[2*this.round_radius,2,2*this.round_radius,2]):u==E.CIRCLE_SHAPE&&t.arc(.5*n[0],.5*n[1],.5*n[0]+1,0,2*Math.PI),t.strokeStyle=E.NODE_BOX_OUTLINE_COLOR,t.stroke(),t.strokeStyle=r,t.globalAlpha=1),0<e.execute_triggered&&e.execute_triggered--,0<e.action_triggered&&e.action_triggered--},new Float32Array(4)),U=new Float32Array(4),B=new Float32Array(2),F=new Float32Array(2);function j(e,t){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function z(e,t,n,r,i,a){return n<e&&e<n+i&&r<t&&t<r+a}function V(e,t){var n=e[0]+e[2],r=e[1]+e[3],i=t[0]+t[2],a=t[1]+t[3];return!(e[0]>i||e[1]>a||n<t[0]||r<t[1])}function H(e,t){t=t||{},this.options=t;var n=this,r=(t.parentMenu&&(t.parentMenu.constructor!==this.constructor?(console.error("parentMenu must be of class ContextMenu, ignoring it"),t.parentMenu=null):(this.parentMenu=t.parentMenu,this.parentMenu.lock=!0,this.parentMenu.current_submenu=this)),null),i=("MouseEvent"!==(r=t.event?t.event.constructor.name:r)&&"CustomEvent"!==r&&"PointerEvent"!==r&&(console.error("Event passed to ContextMenu is not of type MouseEvent or CustomEvent. Ignoring it. ("+r+")"),t.event=null),document.createElement("div"));function a(e){var n=parseInt(i.style.top);return i.style.top=(n+e.deltaY*t.scroll_speed).toFixed()+"px",e.preventDefault(),!0}i.className="litegraph litecontextmenu litemenubar-panel",t.className&&(i.className+=" "+t.className),i.style.minWidth=100,i.style.minHeight=100,i.style.pointerEvents="none",setTimeout((function(){i.style.pointerEvents="auto"}),100),E.pointerListenerAdd(i,"up",(function(e){return e.preventDefault(),!0}),!0),i.addEventListener("contextmenu",(function(e){return 2!=e.button||e.preventDefault(),!1}),!0),E.pointerListenerAdd(i,"down",(function(e){if(2==e.button)return n.close(),e.preventDefault(),!0}),!0),t.scroll_speed||(t.scroll_speed=.1),i.addEventListener("wheel",a,!0),i.addEventListener("mousewheel",a,!0),this.root=i,t.title&&((r=document.createElement("div")).className="litemenu-title",r.innerHTML=t.title,i.appendChild(r));for(var s=0;s<e.length;s++){var o=e.constructor==Array?e[s]:s,l=(null!=o&&o.constructor!==String&&(o=void 0===o.content?String(o):o.content),e[s]);this.addItem(o,l,t)}E.pointerListenerAdd(i,"enter",(function(e){i.closing_timer&&clearTimeout(i.closing_timer)})),r=document,((r=(r=t.event?t.event.target.ownerDocument:r)||document).fullscreenElement||r.body).appendChild(i),r=t.left||0;var u,c,d=t.top||0;t.event&&(r=t.event.clientX-10,d=t.event.clientY-10,t.title&&(d-=20),t.parentMenu&&(r=(u=t.parentMenu.root.getBoundingClientRect()).left+u.width),u=document.body.getBoundingClientRect(),c=i.getBoundingClientRect(),0==u.height&&console.error("document.body height is 0. That is dangerous, set html,body { height: 100%; }"),u.width&&r>u.width-c.width-10&&(r=u.width-c.width-10),u.height&&d>u.height-c.height-10&&(d=u.height-c.height-10)),i.style.left=r+"px",i.style.top=d+"px",t.scale&&(i.style.transform="scale("+t.scale+")")}function W(e){this.points=e,this.selected=-1,this.nearest=-1,this.size=null,this.must_update=!0,this.margin=5}C.prototype.drawConnections=function(e){for(var t=E.getTime(),n=this.visible_area,r=(R[0]=n[0]-20,R[1]=n[1]-20,R[2]=n[2]+40,R[3]=n[3]+40,e.lineWidth=this.connections_width,e.fillStyle="#AAA",e.strokeStyle="#AAA",e.globalAlpha=this.editor_alpha,this.graph._nodes),i=0,a=r.length;i<a;++i){var s=r[i];if(s.inputs&&s.inputs.length)for(var o=0;o<s.inputs.length;++o){var l,u,c,d,h,p,f=s.inputs[o];f&&null!=f.link&&(l=f.link,(l=this.graph.links[l])&&null!=(h=this.graph.getNodeById(l.origin_id))&&(u=null,u=-1==(d=l.origin_slot)?[h.pos[0]+10,h.pos[1]+10]:h.getConnectionPos(!1,d,B),c=s.getConnectionPos(!0,o,F),U[0]=u[0],U[1]=u[1],U[2]=c[0]-u[0],U[3]=c[1]-u[1],U[2]<0&&(U[0]+=U[2],U[2]=Math.abs(U[2])),U[3]<0&&(U[1]+=U[3],U[3]=Math.abs(U[3])),V(U,R)&&(d=h.outputs[d],p=s.inputs[o],d&&p&&(d=d.dir||(h.horizontal?E.DOWN:E.RIGHT),h=p.dir||(s.horizontal?E.UP:E.LEFT),u[1]+=10,c[1]+=10,p=M(f.type),this.renderLink(e,u,c,l,!1,0,p,d,h),l&&l._last_time&&t-l._last_time<1e3&&(f=2-.002*(t-l._last_time),p=e.globalAlpha,e.globalAlpha=p*f,this.renderLink(e,u,c,l,!0,f,"white",d,h),e.globalAlpha=p)))))}}e.globalAlpha=1},C.prototype.renderLink=function(e,t,n,r,i,a,s,o,l,u){r&&this.visible_links.push(r),s=(s=!s&&r?r.color||C.link_type_colors[r.type]:s)||this.default_link_color,null!=r&&this.highlighted_links[r.id]&&(s="#FFF"),o=o||E.RIGHT,l=l||E.LEFT;var c=j(t,n);this.render_connections_border&&.6<this.ds.scale&&(e.lineWidth=this.connections_width+4),e.lineJoin="round",1<(u=u||1)&&(e.lineWidth=.5),e.beginPath();for(var d=0;d<u;d+=1){var h=5*(d-.5*(u-1));if(this.links_render_mode==E.SPLINE_LINK){e.moveTo(t[0],t[1]+h);var p=0,f=0,m=0,g=0;switch(o){case E.LEFT:p=-.25*c;break;case E.RIGHT:p=.25*c;break;case E.UP:f=-.25*c;break;case E.DOWN:f=.25*c}switch(l){case E.LEFT:m=-.25*c;break;case E.RIGHT:m=.25*c;break;case E.UP:g=-.25*c;break;case E.DOWN:g=.25*c}e.bezierCurveTo(t[0]+p,t[1]+f+h,n[0]+m,n[1]+g+h,n[0],n[1]+h)}else if(this.links_render_mode==E.LINEAR_LINK){switch(e.moveTo(t[0],t[1]+h),p=0,f=0,m=0,g=0,o){case E.LEFT:p=-1;break;case E.RIGHT:p=1;break;case E.UP:f=-1;break;case E.DOWN:f=1}switch(l){case E.LEFT:m=-1;break;case E.RIGHT:m=1;break;case E.UP:g=-1;break;case E.DOWN:g=1}e.lineTo(t[0]+15*p,t[1]+15*f+h),e.lineTo(n[0]+15*m,n[1]+15*g+h),e.lineTo(n[0],n[1]+h)}else{if(this.links_render_mode!=E.STRAIGHT_LINK)return;e.moveTo(t[0],t[1]),h=t[0];var v=t[1],y=n[0],b=n[1];o==E.RIGHT?h+=10:v+=10,l==E.LEFT?y-=10:b-=10,e.lineTo(h,v),e.lineTo(.5*(h+y),v),e.lineTo(.5*(h+y),b),e.lineTo(y,b),e.lineTo(n[0],n[1])}}this.render_connections_border&&.6<this.ds.scale&&!i&&(e.strokeStyle="rgba(0,0,0,0.5)",e.stroke()),e.lineWidth=this.connections_width,e.fillStyle=e.strokeStyle=s,e.stroke();var x,w,S,_,T=this.computeConnectionPoint(t,n,.5,o,l);if(r&&r._pos&&(r._pos[0]=T[0],r._pos[1]=T[1]),.6<=this.ds.scale&&this.highquality_render&&l!=E.CENTER&&(this.render_connection_arrows&&(i=this.computeConnectionPoint(t,n,.25,o,l),r=this.computeConnectionPoint(t,n,.26,o,l),x=this.computeConnectionPoint(t,n,.75,o,l),w=this.computeConnectionPoint(t,n,.76,o,l),S=0,_=this.render_curved_connections?(S=-Math.atan2(r[0]-i[0],r[1]-i[1]),-Math.atan2(w[0]-x[0],w[1]-x[1])):S=n[1]>t[1]?0:Math.PI,e.save(),e.translate(i[0],i[1]),e.rotate(S),e.beginPath(),e.moveTo(-5,-3),e.lineTo(0,7),e.lineTo(5,-3),e.fill(),e.restore(),e.save(),e.translate(x[0],x[1]),e.rotate(_),e.beginPath(),e.moveTo(-5,-3),e.lineTo(0,7),e.lineTo(5,-3),e.fill(),e.restore()),e.beginPath(),e.arc(T[0],T[1],5,0,2*Math.PI),e.fill()),a)for(e.fillStyle=s,d=0;d<5;++d){var M=(.001*E.getTime()+.2*d)%1;T=this.computeConnectionPoint(t,n,M,o,l),e.beginPath(),e.arc(T[0],T[1],5,0,2*Math.PI),e.fill()}},C.prototype.computeConnectionPoint=function(e,t,n,r,i){r=r||E.RIGHT,i=i||E.LEFT;var a=j(e,t),s=e,o=[e[0],e[1]],l=[t[0],t[1]];switch(e=t,r){case E.LEFT:o[0]+=-.25*a;break;case E.RIGHT:o[0]+=.25*a;break;case E.UP:o[1]+=-.25*a;break;case E.DOWN:o[1]+=.25*a}switch(i){case E.LEFT:l[0]+=-.25*a;break;case E.RIGHT:l[0]+=.25*a;break;case E.UP:l[1]+=-.25*a;break;case E.DOWN:l[1]+=.25*a}return t=(1-n)*(1-n)*(1-n),r=(1-n)*(1-n)*3*n,i=3*(1-n)*(n*n),n*=n*n,[t*s[0]+r*o[0]+i*l[0]+n*e[0],t*s[1]+r*o[1]+i*l[1]+n*e[1]]},C.prototype.drawExecutionOrder=function(e){e.shadowColor="transparent",e.globalAlpha=.25,e.textAlign="center",e.strokeStyle="white",e.globalAlpha=.75;for(var t=this.visible_nodes,n=0;n<t.length;++n){var r=t[n];e.fillStyle="black",e.fillRect(r.pos[0]-E.NODE_TITLE_HEIGHT,r.pos[1]-E.NODE_TITLE_HEIGHT,E.NODE_TITLE_HEIGHT,E.NODE_TITLE_HEIGHT),0==r.order&&e.strokeRect(r.pos[0]-E.NODE_TITLE_HEIGHT+.5,r.pos[1]-E.NODE_TITLE_HEIGHT+.5,E.NODE_TITLE_HEIGHT,E.NODE_TITLE_HEIGHT),e.fillStyle="#FFF",e.fillText(r.order,r.pos[0]+-.5*E.NODE_TITLE_HEIGHT,r.pos[1]-6)}e.globalAlpha=1},C.prototype.drawNodeWidgets=function(e,t,n,r){if(!e.widgets||!e.widgets.length)return 0;for(var i=e.size[0],a=e.widgets,s=(t+=2,E.NODE_WIDGET_HEIGHT),o=.5<this.ds.scale,l=(n.save(),n.globalAlpha=this.editor_alpha,E.WIDGET_OUTLINE_COLOR),u=E.WIDGET_BGCOLOR,c=E.WIDGET_TEXT_COLOR,d=E.WIDGET_SECONDARY_TEXT_COLOR,h=E.MY_NODE_CLOSE_RADIUS,p=0;p<a.length;++p){var f,m,g=a[p],v=t,y=(g.y&&(v=g.y),g.last_y=v,n.strokeStyle=l,n.fillStyle="#222",n.textAlign="left",g.disabled&&(n.globalAlpha*=.5),g.width||i);switch(g.type){case"button":g.clicked&&(n.fillStyle="#AAA",g.clicked=!1,this.dirty_canvas=!0),n.beginPath(),n.roundRect(15,v,y-30,s,h),n.fill(),o&&g.disabled,o&&(n.textAlign="center",n.fillStyle=c,n.fillText(g.name,.5*y,v+.7*s));break;case"toggle":n.textAlign="left",n.strokeStyle=l,n.fillStyle=u,n.beginPath(),o?n.roundRect(15,v,y-30,s,h):n.rect(15,v,y-30,s),n.fill(),o&&g.disabled,n.fillStyle=g.value?"#89A":"#333",n.beginPath(),_({ctx:n,x:y-30-.8*s,y:v+.5*s*.5,width:s,height:.5*s,state:g.value}),n.fill(),o&&(n.fillStyle=d,null!=g.name&&n.fillText(g.name,30,v+.7*s),n.fillStyle=g.value?c:d,n.textAlign="right",n.fillText(g.value?g.options.on||"true":g.options.off||"false",y-55,v+.7*s));break;case"slider":n.beginPath(),n.fillStyle=u,n.roundRect(15,v,y-30,s,8),n.fill();var b=g.options.max-g.options.min,x=(g.value-g.options.min)/b;n.fillStyle=r==g?"#89A":"#678",n.beginPath(),n.roundRect(15,v,x*(y-30),s,8),n.fill(),o&&!g.disabled&&g.marker&&(x=(g.marker-g.options.min)/b,n.fillStyle="#AA9",n.fillRect(15+x*(y-30),v,2,s)),o&&(n.textAlign="center",n.fillStyle=c,n.fillText(g.name+" "+Number(g.value).toFixed(3),.5*y,v+.7*s));break;case"number":case"combo":n.textAlign="left",n.strokeStyle=l,n.fillStyle=u,n.beginPath(),o?n.roundRect(15,v,y-30,s,h):n.rect(15,v,y-30,s),n.fill(),o&&(b=g.value,x=[],g.options.values&&(x=(x=g.options.values).constructor===Function?x():x)&&x.constructor!==Array&&(b=x[g.value]),m=x[x.length-1]===b,f=x[0]===b,g.disabled,n.fillStyle=c,g.disabled||(n.beginPath(),n.fillStyle=f?"rgb(119,119,136)":"rgb(218,226,238)",n.moveTo(102,v+7),n.lineTo(95,v+.5*s),n.lineTo(102,v+s-7),n.fill(),n.beginPath(),n.fillStyle=m?"rgb(119,119,136)":"rgb(218,226,238)",n.moveTo(y-15-12,v+7),n.lineTo(y-15-6,v+.5*s),n.lineTo(y-15-12,v+s-7),n.fill()),n.fillStyle=d,n.fillText(g.name,30,v+.7*s),n.fillStyle=c,n.textAlign="center",f=(y-120)/2+120-22.5,"number"==g.type?n.fillText(Number(g.value).toFixed(void 0!==g.options.precision?g.options.precision:3),f,v+.7*s):n.fillText(b,f,v+.7*s));break;case"string":case"text":n.textAlign="left",n.strokeStyle=l,n.fillStyle=u,n.beginPath(),o?n.roundRect(15,v,y-30,s,h):n.rect(15,v,y-30,s),n.fill(),o&&(g.disabled,n.save(),n.beginPath(),n.rect(15,v,y-30,s),n.clip(),n.fillStyle=d,null!=g.name&&n.fillText(g.name,30,v+.7*s),n.fillStyle=c,n.textAlign="right",16<=(m=String(g.value)).length&&(m="..."+m.slice(m.length-16)),n.fillText(m,y-30,v+.7*s),n.restore());break;default:g.draw&&g.draw(n,e,y,v,s)}t+=(g.computeSize?g.computeSize(y)[1]:s)+4,n.globalAlpha=this.editor_alpha}n.restore(),n.textAlign="left"},C.prototype.processNodeWidgets=function(e,t,n,r){if(!e.widgets||!e.widgets.length)return null;for(var i=t[0]-e.pos[0],a=t[1]-e.pos[1],s=e.size[0],o=this,l=this.getCanvasWindow(),u=0;u<e.widgets.length;++u){var c=e.widgets[u];if(c&&!c.disabled){var d=c.computeSize?c.computeSize(s)[1]:E.NODE_WIDGET_HEIGHT,h=c.width||s;if(c==r||!(i<6||h-12<i||a<c.last_y||a>c.last_y+d||void 0===c.last_y)){var p=c.value;switch(c.type){case"button":n.type===E.pointerevents_method+"down"&&(c.callback&&setTimeout((function(){c.callback(c,o,e,t,n)}),20),c.clicked=!0,this.dirty_canvas=!0);break;case"slider":c.options.max,c.options.min;var f=Math.clamp((i-15)/(h-30),0,1);c.value=c.options.min+(c.options.max-c.options.min)*f,console.log(c.value," w.value"),c.callback&&setTimeout((function(){b(c,c.value)}),20),this.dirty_canvas=!0;break;case"number":case"combo":var m,g,v,y;p=c.value,n.type==E.pointerevents_method+"move"&&"number"==c.type?(n.deltaX&&(c.value+=.1*n.deltaX*(c.options.step||1)),null!=c.options.min&&c.value<c.options.min&&(c.value=c.options.min),null!=c.options.max&&c.value>c.options.max&&(c.value=c.options.max)):n.type==E.pointerevents_method+"down"?((m=c.options.values)&&m.constructor===Function&&(m=c.options.values(c,e)),g=null,"number"!=c.type&&(g=m.constructor===Array?m:Object.keys(m)),y=80<i&&i<120?-1:h-40<i?1:0,"number"==c.type?(c.value+=.1*y*(c.options.step||1),null!=c.options.min&&c.value<c.options.min&&(c.value=c.options.min),null!=c.options.max&&c.value>c.options.max&&(c.value=c.options.max)):y?(f=-1,this.last_mouseclick=0,(f=(f=m.constructor===Object?g.indexOf(String(c.value))+y:g.indexOf(c.value)+y)>=g.length?g.length-1:f)<0&&(f=0),m.constructor===Array?c.value=m[f]:c.value=f):(v=m!=g?Object.values(m):m,new E.ContextMenu(v,{scale:Math.max(1,this.ds.scale),event:n,className:"dark",callback:function(e,t,n){return m!=g&&(e=v.indexOf(e)),this.value=e,b(this,e),!(o.dirty_canvas=!0)}.bind(c)},l))):n.type==E.pointerevents_method+"up"&&"number"==c.type&&(y=80<i&&i<120?-1:h-40<i?1:0,n.click_time<200&&0==y&&this.prompt("Value",c.value,function(e){this.value=Number(e),b(this,this.value)}.bind(c),n)),p!=c.value&&setTimeout(function(){b(this,this.value)}.bind(c),20),this.dirty_canvas=!0;break;case"toggle":n.type==E.pointerevents_method+"down"&&(c.value=!c.value,setTimeout((function(){b(c,c.value)}),20));break;case"string":case"text":n.type==E.pointerevents_method+"down"&&this.prompt("Value",c.value,function(e){this.value=e,b(this,e)}.bind(c),n,!!c.options&&c.options.multiline);break;default:c.mouse&&(this.dirty_canvas=c.mouse(n,[i,a],e))}return p!=c.value&&(e.onWidgetChanged&&e.onWidgetChanged(c.name,c.value,p,c),e.graph._version++),c}}}function b(r,i){r.value=i,r.options&&r.options.property&&void 0!==e.properties[r.options.property]&&e.setProperty(r.options.property,i),r.callback&&r.callback(r.value,o,e,t,n)}return null},C.prototype.drawGroups=function(e,t){if(this.graph){var n=this.graph._groups;t.save(),t.globalAlpha=.5*this.editor_alpha;for(var r=0;r<n.length;++r){var i,a,s,o=n[r],l=this.graph.ins.getSelectedGroup().find((function(e){return e.title===o.title}));V(this.visible_area,o._bounding)&&(t.fillStyle=o.color||"#335",l&&(t.fillStyle="#66CCFF"),t.strokeStyle=o.color||"#335",l=o._pos,i=o._size,t.globalAlpha=.25*this.editor_alpha,t.beginPath(),t.roundRect(l[0]+.5,l[1]+.5,i[0],i[1],E.MY_NODE_OPEN_RADIUS),t.fill(),t.globalAlpha=this.editor_alpha,t.stroke(),t.beginPath(),t.moveTo(l[0]+i[0]+1,l[1]+i[1]+1),t.lineTo(l[0]+i[0]-10,l[1]+i[1]+1),t.lineTo(l[0]+i[0]+1,l[1]+i[1]-10),t.fill(),a=o.font_size||E.DEFAULT_GROUP_FONT_SIZE,(s=this.ds.scale<=.5)&&(a*=6-this.ds.scale),t.font=a+"px Arial",t.textAlign="left",s=s?l[0]+i[0]/2-t.measureText(o.title).width/2:l[0]+4,t.fillText(o.title,s,l[1]+a))}t.restore()}},C.prototype.adjustNodesSize=function(){for(var e=this.graph._nodes,t=0;t<e.length;++t)e[t].size=e[t].computeSize();this.setDirty(!0,!0)},C.prototype.resize=function(e,t){var n;e||t||(e=(n=this.canvas.parentNode).offsetWidth,t=n.offsetHeight),this.canvas.width==e&&this.canvas.height==t||(this.canvas.width=e,this.canvas.height=t,this.bgcanvas.width=this.canvas.width,this.bgcanvas.height=this.canvas.height,this.setDirty(!0,!0))},C.prototype.switchLiveMode=function(e){if(!e)return this.live_mode=!this.live_mode,this.dirty_canvas=!0,void(this.dirty_bgcanvas=!0);var t=this,n=this.live_mode?1.1:.9,r=(this.live_mode&&(this.live_mode=!1,this.editor_alpha=.1),setInterval((function(){t.editor_alpha*=n,t.dirty_canvas=!0,t.dirty_bgcanvas=!0,n<1&&t.editor_alpha<.01&&(clearInterval(r),n<1&&(t.live_mode=!0)),1<n&&.99<t.editor_alpha&&(clearInterval(r),t.editor_alpha=1)}),1))},C.prototype.onNodeSelectionChange=function(e){},C.onGroupAdd=function(e,t,n){var r=C.active_canvas,i=(r.getCanvasWindow(),new O);i.pos=r.convertEventToCanvasOffset(n),r.graph.ins.onGroupAdd(i),r.graph.add(i)},C.onMenuAdd=function(e,t,n,r,i,a){var s=C.active_canvas,o=s.getCanvasWindow(),l=s.graph;if(l)return function e(t,r){var a=E.getNodeTypesCategories(s.filter||l.filter).filter((function(e){return e.startsWith(t)})),u=[];a.map((function(n){var r,i;n&&(i=new RegExp("^("+t+")"),n=n.replace(i,"").split("/")[0],r=""===t?n+"/":t+n+"/",-1!=(i=n).indexOf("::")&&(i=i.split("::")[1]),-1===u.findIndex((function(e){return e.value===r}))&&u.push({value:r,content:i,has_submenu:!0,callback:function(t,n,r,i){l.ins.setLastType(t.value),e(t.value,i)}}))})),E.getNodeTypesInCategory(t.slice(0,-1),s.filter||l.filter).map((function(e){e.skip_list||(e={value:e.type,content:e.title,has_submenu:!1,callback:function(e,t,n,r){r=r.getFirstEvent(),s.graph.beforeChange(),(e=E.createNode(e.value))&&(e.pos=s.convertEventToCanvasOffset(r),s.graph.add(e)),i&&i(e),null!=(r=s.graph)&&r.afterChange()}},u.push(e))})),new E.ContextMenu(u,{event:n,parentMenu:r},o)}(a||"",r),!1},C.onMenuCollapseAll=function(){},C.onMenuNodeEdit=function(){},C.showMenuNodeOptionalInputs=function(e,t,n,r,i){if(i){var a,s=this,o=C.active_canvas.getCanvasWindow(),l=(t=i.optional_inputs,[]);if(t=i.onGetInputs?i.onGetInputs():t)for(var u=0;u<t.length;u++){var c,d=t[u];d?(c=d[0],d[2]||(d[2]={}),d[2].label&&(c=d[2].label),d[2].removable=!0,c={content:c,value:d},d[1]==E.ACTION&&(c.className="event"),l.push(c)):l.push(null)}if(!i.onMenuNodeInputs||(a=i.onMenuNodeInputs(l))&&(l=a),l.length)return new E.ContextMenu(l,{event:n,callback:function(e,t,n){i&&(e.callback&&e.callback.call(s,i,e,t,n),e.value&&(i.graph.beforeChange(),i.addInput(e.value[0],e.value[1],e.value[2]),i.onNodeInputAdd&&i.onNodeInputAdd(e.value),i.setDirtyCanvas(!0,!0),i.graph.afterChange()))},parentMenu:r,node:i},o),!1;console.log("no input entries")}},C.showMenuNodeOptionalOutputs=function(e,t,n,r,i){if(i){var a,s=this,o=C.active_canvas.getCanvasWindow(),l=(t=i.optional_outputs,[]);if(t=i.onGetOutputs?i.onGetOutputs():t)for(var u=0;u<t.length;u++){var c,d=t[u];d?i.flags&&i.flags.skip_repeated_outputs&&-1!=i.findOutputSlot(d[0])||(c=d[0],d[2]||(d[2]={}),d[2].label&&(c=d[2].label),d[2].removable=!0,c={content:c,value:d},d[1]==E.EVENT&&(c.className="event"),l.push(c)):l.push(null)}if(this.onMenuNodeOutputs&&(l=this.onMenuNodeOutputs(l)),E.do_add_triggers_slots&&-1==i.findOutputSlot("onExecuted")&&l.push({content:"On Executed",value:["onExecuted",E.EVENT,{nameLocked:!0}],className:"event"}),!i.onMenuNodeOutputs||(a=i.onMenuNodeOutputs(l))&&(l=a),l.length)return new E.ContextMenu(l,{event:n,callback:function e(t,n,a){if(i&&(t.callback&&t.callback.call(s,i,t,n,a),t.value)){var o=t.value[1];if(o&&(o.constructor===Object||o.constructor===Array)){var l,u=[];for(l in o)u.push({content:l,value:o[l]});return new E.ContextMenu(u,{event:n,callback:e,parentMenu:r,node:i}),!1}i.graph.beforeChange(),i.addOutput(t.value[0],t.value[1],t.value[2]),i.onNodeOutputAdd&&i.onNodeOutputAdd(t.value),i.setDirtyCanvas(!0,!0),i.graph.afterChange()}},parentMenu:r,node:i},o),!1}},C.onShowMenuNodeProperties=function(e,t,n,r,i){if(i&&i.properties){var a,s=C.active_canvas,o=s.getCanvasWindow(),l=[];for(a in i.properties){"object"==w(e=void 0!==i.properties[a]?i.properties[a]:" ")&&(e=JSON.stringify(e));var u=i.getPropertyInfo(a);"enum"!=u.type&&"combo"!=u.type||(e=C.getPropertyPrintableValue(e,u.values)),e=C.decodeHTML(e),l.push({content:"<span class='property_name'>"+(u.label||a)+"</span><span class='property_value'>"+e+"</span>",value:a})}if(l.length)return new E.ContextMenu(l,{event:n,callback:function(e,t,n,r){var a;i&&(a=this.getBoundingClientRect(),s.showEditPropertyValue(i,e.value,{position:[a.left,a.top]}))},parentMenu:r,allow_html:!0,node:i},o),!1}},C.decodeHTML=function(e){var t=document.createElement("div");return t.innerText=e,t.innerHTML},C.onMenuResizeNode=function(e,t,n,r,i){if(i){var a=function(e){e.size=e.computeSize(),e.onResize&&e.onResize(e.size)},s=C.active_canvas;if(!s.selected_nodes||Object.keys(s.selected_nodes).length<=1)a(i);else for(var o in s.selected_nodes)a(s.selected_nodes[o]);i.setDirtyCanvas(!0,!0)}},C.prototype.showLinkMenu=function(e,t){var n=this,r=n.graph.getNodeById(e.origin_id),i=n.graph.getNodeById(e.target_id),a=!1,s=(r&&r.outputs&&r.outputs[e.origin_slot]&&(a=r.outputs[e.origin_slot].type),!1),o=(i&&i.outputs&&i.outputs[e.target_slot]&&(s=i.inputs[e.target_slot].type),new E.ContextMenu(["Add Node",null,"Delete",null],{event:t,title:null!=e.data?e.data.constructor.name:null,callback:function(t,l,u){switch(t){case"Add Node":C.onMenuAdd(null,null,u,o,(function(t){t.inputs&&t.inputs.length&&t.outputs&&t.outputs.length&&r.connectByType(e.origin_slot,t,a)&&(t.connectByType(e.target_slot,i,s),t.pos[0]-=.5*t.size[0])}));break;case"Delete":n.graph.removeLink(e.id)}}}));return!1},C.prototype.createDefaultNodeForSlot=function(e){e=e||{};var t=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,position:[],nodeType:null,posAdd:[0,0],posSizeFix:[0,0]},e),n=t.nodeFrom&&null!==t.slotFrom;if(e=!n&&t.nodeTo&&null!==t.slotTo,!n&&!e)return console.warn("No data passed to createDefaultNodeForSlot "+t.nodeFrom+" "+t.slotFrom+" "+t.nodeTo+" "+t.slotTo),!1;if(!t.nodeType)return console.warn("No type to createDefaultNodeForSlot"),!1;var r=n?t.nodeFrom:t.nodeTo,i=n?t.slotFrom:t.slotTo,a=!1;switch(w(i)){case"string":a=n?r.findOutputSlot(i,!1):r.findInputSlot(i,!1),i=(n?r.outputs:r.inputs)[i];break;case"object":a=n?r.findOutputSlot(i.name):r.findInputSlot(i.name);break;case"number":a=i,i=(n?r.outputs:r.inputs)[i];break;default:return console.warn("Cant get slot information "+i),!1}!1!==i&&!1!==a||console.warn("createDefaultNodeForSlot bad slotX "+i+" "+a);var s=i.type==E.EVENT?"_event_":i.type,o=n?E.slot_types_default_out:E.slot_types_default_in;if(o&&o[s]){if(i.link,nodeNewType=!1,"object"==w(o[s])||"array"==typeof o[s]){for(var l in o[s])if(t.nodeType==o[s][l]||"AUTO"==t.nodeType){nodeNewType=o[s][l];break}}else t.nodeType!=o[s]&&"AUTO"!=t.nodeType||(nodeNewType=o[s]);if(nodeNewType){var u=!1,c=("object"==("undefined"==typeof nodeNewType?"undefined":w(nodeNewType))&&nodeNewType.node&&(nodeNewType=(u=nodeNewType).node),E.createNode(nodeNewType));if(c){if(u){if(u.properties)for(var d in u.properties)c.addProperty(d,u.properties[d]);if(u.inputs)for(var d in c.inputs=[],u.inputs)c.addOutput(u.inputs[d][0],u.inputs[d][1]);if(u.outputs)for(var d in c.outputs=[],u.outputs)c.addOutput(u.outputs[d][0],u.outputs[d][1]);u.title&&(c.title=u.title),u.json&&c.configure(u.json)}return this.graph.add(c),c.pos=[t.position[0]+t.posAdd[0]+(t.posSizeFix[0]?t.posSizeFix[0]*c.size[0]:0),t.position[1]+t.posAdd[1]+(t.posSizeFix[1]?t.posSizeFix[1]*c.size[1]:0)],n?t.nodeFrom.connectByType(a,c,s):t.nodeTo.connectByTypeOutput(a,c,s),!0}console.log("failed creating "+nodeNewType)}}return!1},C.prototype.showConnectionMenu=function(e){e=e||{};var t=Object.assign({nodeFrom:null,slotFrom:null,nodeTo:null,slotTo:null,e:null},e),n=this,r=t.nodeFrom&&t.slotFrom;if(e=!r&&t.nodeTo&&t.slotTo,!r&&!e)return console.warn("No data passed to showConnectionMenu"),!1;var i=r?t.nodeFrom:t.nodeTo,a=r?t.slotFrom:t.slotTo,s=!1;switch(w(a)){case"string":s=r?i.findOutputSlot(a,!1):i.findInputSlot(a,!1),a=(r?i.outputs:i.inputs)[a];break;case"object":s=r?i.findOutputSlot(a.name):i.findInputSlot(a.name);break;case"number":s=a,a=(r?i.outputs:i.inputs)[a];break;default:return console.warn("Cant get slot information "+a),!1}var o=["Add Node",null],l=(n.allow_searchbox&&(o.push("Search"),o.push(null)),a.type==E.EVENT?"_event_":a.type),u=r?E.slot_types_default_out:E.slot_types_default_in;if(u&&u[l])if("object"==w(u[l])||"array"==typeof u[l])for(var c in u[l])o.push(u[l][c]);else o.push(u[l]);var d=new E.ContextMenu(o,{event:t.e,title:(a&&""!=a.name?a.name+(l?" | ":""):"")+(a&&l?l:""),callback:function(e,i,o){switch(e){case"Add Node":C.onMenuAdd(null,null,o,d,(function(e){r?t.nodeFrom.connectByType(s,e,l):t.nodeTo.connectByTypeOutput(s,e,l)}));break;case"Search":r?n.showSearchBox(o,{node_from:t.nodeFrom,slot_from:a,type_filter_in:l}):n.showSearchBox(o,{node_to:t.nodeTo,slot_from:a,type_filter_out:l});break;default:n.createDefaultNodeForSlot(Object.assign(t,{position:[t.e.canvasX,t.e.canvasY],nodeType:e}))}}});return!1},C.onShowPropertyEditor=function(e,t,n,r,i){var a=e.property||"title",s=i[a],o=document.createElement("div");o.is_modified=!1,o.className="graphdialog",o.innerHTML="<span class='name'></span><input autofocus type='text' class='value'/><button>OK</button>",o.close=function(){o.parentNode&&o.parentNode.removeChild(o)},o.querySelector(".name").innerText=a;var l=o.querySelector(".value");l&&(l.value=s,l.addEventListener("blur",(function(e){this.focus()})),l.addEventListener("keydown",(function(e){if(o.is_modified=!0,27==e.keyCode)o.close();else if(13==e.keyCode)p();else if(13!=e.keyCode&&"textarea"!=e.target.localName)return;e.preventDefault(),e.stopPropagation()})));var u=(s=C.active_canvas.canvas).getBoundingClientRect(),c=-20,d=-20;u&&(c-=u.left,d-=u.top),event?(o.style.left=event.clientX+c+"px",o.style.top=event.clientY+d+"px"):(o.style.left=.5*s.width+c+"px",o.style.top=.5*s.height+d+"px"),o.querySelector("button").addEventListener("click",p),s.parentNode.appendChild(o),l&&l.focus();var h=null;function p(){if(l){var t=l.value;"Number"==e.type?t=Number(t):"Boolean"==e.type&&(t=Boolean(t)),i[a]=t,o.parentNode&&o.parentNode.removeChild(o),i.setDirtyCanvas(!0,!0)}}o.addEventListener("mouseleave",(function(e){E.dialog_close_on_mouse_leave&&!o.is_modified&&E.dialog_close_on_mouse_leave&&(h=setTimeout(o.close,E.dialog_close_on_mouse_leave_delay))})),o.addEventListener("mouseenter",(function(e){E.dialog_close_on_mouse_leave&&h&&clearTimeout(h)}))},C.prototype.prompt=function(e,t,n,r,i){var a=this,s=(e=e||"",document.createElement("div"));s.is_modified=!1,s.className="graphdialog rounded",s.innerHTML=i?"<span class='name'></span> <textarea autofocus class='value'></textarea><button class='rounded'>OK</button>":"<span class='name'></span> <input autofocus type='text' class='value'/><button class='rounded'>OK</button>",s.close=function(){a.prompt_box=null,s.parentNode&&s.parentNode.removeChild(s)};var o=((i=C.active_canvas.canvas).parentNode.appendChild(s),1<this.ds.scale&&(s.style.transform="scale("+this.ds.scale+")"),null),l=!1,u=(E.pointerListenerAdd(s,"leave",(function(e){l||E.dialog_close_on_mouse_leave&&!s.is_modified&&E.dialog_close_on_mouse_leave&&(o=setTimeout(s.close,E.dialog_close_on_mouse_leave_delay))})),E.pointerListenerAdd(s,"enter",(function(e){E.dialog_close_on_mouse_leave&&o&&clearTimeout(o)})),(u=s.querySelectorAll("select"))&&u.forEach((function(e){e.addEventListener("click",(function(e){l++})),e.addEventListener("blur",(function(e){l=0})),e.addEventListener("change",(function(e){l=-1}))})),a.prompt_box&&a.prompt_box.close(),(a.prompt_box=s).querySelector(".name").innerText=e,s.querySelector(".value")),c=(u.value=t,u);return c.addEventListener("keydown",(function(e){if(s.is_modified=!0,27==e.keyCode)s.close();else{if(13!=e.keyCode||"textarea"==e.target.localName)return;n&&n(this.value),s.close()}e.preventDefault(),e.stopPropagation()})),s.querySelector("button").addEventListener("click",(function(e){n&&n(c.value),a.setDirty(!0),s.close()})),t=-20,u=-20,(e=i.getBoundingClientRect())&&(t-=e.left,u-=e.top),r?(s.style.left=r.clientX+t+"px",s.style.top=r.clientY+u+"px"):(s.style.left=.5*i.width+t+"px",s.style.top=.5*i.height+u+"px"),setTimeout((function(){c.focus()}),10),s},C.search_limit=-1,C.prototype.showSearchBox=function(e,t){var n,r,i,a,s={slot_from:null,node_from:null,node_to:null,do_type_filter:E.search_filter_enabled,type_filter_in:!1,type_filter_out:!1,show_general_if_none_on_typefilter:!0,show_general_after_typefiltered:!0,hide_on_mouse_leave:E.search_hide_on_mouse_leave,show_all_if_empty:!0,show_all_on_open:E.search_show_all_on_open},o=(t=Object.assign(s,t||{}),this),l=C.active_canvas,u=l.canvas,c=u.ownerDocument||document,d=document.createElement("div"),h=(d.className="litegraph litesearchbox graphdialog rounded",d.innerHTML="<span class='name'>搜索</span> <input autofocus type='text' class='value rounded'/>",t.do_type_filter&&(d.innerHTML+="<select class='slot_in_type_filter'><option value=''></option></select>",d.innerHTML+="<select class='slot_out_type_filter'><option value=''></option></select>"),d.innerHTML+="<div class='helper'></div>",c.fullscreenElement?c.fullscreenElement.appendChild(d):(c.body.appendChild(d),c.body.style.overflow="hidden"),t.do_type_filter&&(n=d.querySelector(".slot_in_type_filter"),r=d.querySelector(".slot_out_type_filter")),d.close=function(){o.search_box=null,this.blur(),u.focus(),c.body.style.overflow="",setTimeout((function(){o.canvas.focus()}),20),d.parentNode&&d.parentNode.removeChild(d)},1<this.ds.scale&&(d.style.transform="scale("+this.ds.scale+")"),t.hide_on_mouse_leave&&(i=!1,a=null,E.pointerListenerAdd(d,"enter",(function(e){a&&(clearTimeout(a),a=null)})),E.pointerListenerAdd(d,"leave",(function(e){i||(a=setTimeout((function(){d.close()}),500))})),t.do_type_filter&&(n.addEventListener("click",(function(e){i++})),n.addEventListener("blur",(function(e){i=0})),n.addEventListener("change",(function(e){i=-1})),r.addEventListener("click",(function(e){i++})),r.addEventListener("blur",(function(e){i=0})),r.addEventListener("change",(function(e){i=-1})))),o.search_box&&o.search_box.close(),(o.search_box=d).querySelector(".helper")),p=null,f=null,m=null,g=d.querySelector("input");if(g&&(g.addEventListener("blur",(function(e){this.focus()})),g.addEventListener("keydown",(function(e){if(38==e.keyCode)M(!1);else if(40==e.keyCode)M(!0);else if(27==e.keyCode)d.close();else{if(13!=e.keyCode)return f&&clearInterval(f),void(f=setTimeout(D,250));m?T(m.innerHTML):p?T(p):d.close()}return e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),!0}))),t.do_type_filter){if(n){var v=(b=E.slot_types_in).length;t.type_filter_in!=E.EVENT&&t.type_filter_in!=E.ACTION||(t.type_filter_in="_event_");for(var y=0;y<v;y++)(x=document.createElement("option")).value=b[y],x.innerHTML=b[y],n.appendChild(x),!1!==t.type_filter_in&&(t.type_filter_in+"").toLowerCase()==(b[y]+"").toLowerCase()&&(x.selected=!0);n.addEventListener("change",(function(){D()}))}if(r){var b,x;for(v=(b=E.slot_types_out).length,t.type_filter_out!=E.EVENT&&t.type_filter_out!=E.ACTION||(t.type_filter_out="_event_"),y=0;y<v;y++)(x=document.createElement("option")).value=b[y],x.innerHTML=b[y],r.appendChild(x),!1!==t.type_filter_out&&(t.type_filter_out+"").toLowerCase()==(b[y]+"").toLowerCase()&&(x.selected=!0);r.addEventListener("change",(function(){D()}))}}s=u.getBoundingClientRect();var S=(e?e.clientX:s.left+.5*s.width)-80,_=(e?e.clientY:s.top+.5*s.height)-20;function T(n){if(n)if(o.onSearchBoxSelection)o.onSearchBoxSelection(n,e,l);else{var r=E.searchbox_extras[n.toLowerCase()],i=(r&&(n=r.type),l.graph.beforeChange(),E.createNode(n));if(i&&(i.pos=l.convertEventToCanvasOffset(e),l.graph.add(i,!1)),r&&r.data){if(r.data.properties)for(var a in r.data.properties)i.addProperty(a,r.data.properties[a]);if(r.data.inputs)for(var a in i.inputs=[],r.data.inputs)i.addOutput(r.data.inputs[a][0],r.data.inputs[a][1]);if(r.data.outputs)for(var a in i.outputs=[],r.data.outputs)i.addOutput(r.data.outputs[a][0],r.data.outputs[a][1]);r.data.title&&(i.title=r.data.title),r.data.json&&i.configure(r.data.json)}if(t.node_from){var s=!1;switch(w(t.slot_from)){case"string":s=t.node_from.findOutputSlot(t.slot_from);break;case"object":-1==(s=t.slot_from.name?t.node_from.findOutputSlot(t.slot_from.name):-1)&&void 0!==t.slot_from.slot_index&&(s=t.slot_from.slot_index);break;case"number":s=t.slot_from;break;default:s=0}void 0!==w(t.node_from.outputs[s])&&!1!==s&&-1<s&&t.node_from.connectByType(s,i,t.node_from.outputs[s].type)}if(t.node_to){switch(s=!1,w(t.slot_from)){case"string":s=t.node_to.findInputSlot(t.slot_from);break;case"object":-1==(s=t.slot_from.name?t.node_to.findInputSlot(t.slot_from.name):-1)&&void 0!==t.slot_from.slot_index&&(s=t.slot_from.slot_index);break;case"number":s=t.slot_from;break;default:s=0}void 0!==w(t.node_to.inputs[s])&&!1!==s&&-1<s&&t.node_to.connectByTypeOutput(s,i,t.node_to.inputs[s].type)}l.graph.afterChange()}d.close()}function M(e){var t=m;m&&m.classList.remove("selected"),(m=m?(m=e?m.nextSibling:m.previousSibling)||t:e?h.childNodes[0]:h.childNodes[h.childNodes.length])&&(m.classList.add("selected"),m.scrollIntoView({block:"end",behavior:"smooth"}))}function D(){f=null;var e=g.value;if(p=null,h.innerHTML="",e||t.show_all_if_empty)if(o.onSearchBox){var n=o.onSearchBox(h,e,l);if(n)for(var r=0;r<n.length;++r)y(n[r])}else{var i,a,s=function(n,r){r=r||{},r=Object.assign({skipFilter:!1,inTypeOverride:!1,outTypeOverride:!1},r);var s=E.registered_node_types[n];if(c&&s.filter!=c)return!1;if((!t.show_all_if_empty||e)&&-1===n.toLowerCase().indexOf(e))return!1;if(t.do_type_filter&&!r.skipFilter){if(s=n,n=i.value,!1!==r.inTypeOverride&&(n=r.inTypeOverride),i&&n&&E.registered_slot_in_types[n]&&E.registered_slot_in_types[n].nodes){var o=E.registered_slot_in_types[n].nodes.includes(s);if(!1===o)return!1}if(n=a.value,!1!==r.outTypeOverride&&(n=r.outTypeOverride),a&&n&&E.registered_slot_out_types[n]&&E.registered_slot_out_types[n].nodes&&!1===(o=E.registered_slot_out_types[n].nodes.includes(s)))return!1}return!0},u=0,c=(e=e.toLowerCase(),l.filter||l.graph.filter);for(r in a=t.do_type_filter&&o.search_box?(i=o.search_box.querySelector(".slot_in_type_filter"),o.search_box.querySelector(".slot_out_type_filter")):i=!1,E.searchbox_extras){var d=E.searchbox_extras[r];if(t.show_all_if_empty&&!e||-1!==d.desc.toLowerCase().indexOf(e)){var m=E.registered_node_types[d.type];if((!m||m.filter==c)&&s(d.type)&&(y(d.desc,"searchbox_extra"),-1!==C.search_limit&&u++>C.search_limit))break}}var v=null;if(Array.prototype.filter)v=Object.keys(E.registered_node_types).filter(s);else for(var r in v=[],E.registered_node_types)s(r)&&v.push(r);for(r=0;r<v.length&&(y(v[r]),!(-1!==C.search_limit&&u++>C.search_limit));r++);if(t.show_general_after_typefiltered&&(i.value||a.value)){for(var r in filtered_extra=[],E.registered_node_types)s(r,{inTypeOverride:!(!i||!i.value)&&"*",outTypeOverride:!(!a||!a.value)&&"*"})&&filtered_extra.push(r);for(r=0;r<filtered_extra.length&&(y(filtered_extra[r],"generic_type"),!(-1!==C.search_limit&&u++>C.search_limit));r++);}if((i.value||a.value)&&0==h.childNodes.length&&t.show_general_if_none_on_typefilter){for(var r in filtered_extra=[],E.registered_node_types)s(r,{skipFilter:!0})&&filtered_extra.push(r);for(r=0;r<filtered_extra.length&&(y(filtered_extra[r],"not_in_filter"),!(-1!==C.search_limit&&u++>C.search_limit));r++);}}function y(e,t){var n=document.createElement("div");p=p||e,n.innerText=e,n.dataset.type=escape(e),n.className="litegraph lite-search-item",t&&(n.className+=" "+t),n.addEventListener("click",(function(e){T(unescape(this.dataset.type))})),h.appendChild(n)}}return d.style.left=S+"px",d.style.top=_+"px",e.layerY>s.height-200&&(h.style.maxHeight=s.height-e.layerY-20+"px"),g.focus(),t.show_all_on_open&&D(),d},C.prototype.showEditPropertyValue=function(e,t,n){if(e&&void 0!==e.properties[t]){n=n||{};var r=e.getPropertyInfo(t),i=r.type,a="";if("string"==i||"number"==i||"array"==i||"object"==i)a="<input autofocus type='text' class='value'/>";else if("enum"!=i&&"combo"!=i||!r.values){if("boolean"!=i&&"toggle"!=i)return void console.warn("unknown type: "+i);a="<input autofocus type='checkbox' class='value' "+(e.properties[t]?"checked":"")+"/>"}else{for(var s in a="<select autofocus type='text' class='value'>",r.values){var o=s;a+="<option value='"+(o=r.values.constructor===Array?r.values[s]:o)+"' "+(o==e.properties[t]?"selected":"")+">"+r.values[s]+"</option>"}a+="</select>"}var l=this.createDialog("<span class='name'>"+(r.label||t)+"</span>"+a+"<button>OK</button>",n),u=!1;return"enum"!=i&&"combo"!=i||!r.values?"boolean"==i||"toggle"==i?(u=l.querySelector("input"))&&u.addEventListener("click",(function(e){l.modified(),d(!!u.checked)})):(u=l.querySelector("input"))&&(u.addEventListener("blur",(function(e){this.focus()})),o=void 0!==e.properties[t]?e.properties[t]:"","string"!==i&&(o=JSON.stringify(o)),u.value=o,u.addEventListener("keydown",(function(e){if(27==e.keyCode)l.close();else if(13==e.keyCode)c();else if(13!=e.keyCode)return void l.modified();e.preventDefault(),e.stopPropagation()}))):(u=l.querySelector("select")).addEventListener("change",(function(e){l.modified(),d(e.target.value)})),u&&u.focus(),l.querySelector("button").addEventListener("click",c),l}function c(){d(u.value)}function d(a){r&&r.values&&r.values.constructor===Object&&null!=r.values[a]&&(a=r.values[a]),"number"==typeof e.properties[t]&&(a=Number(a)),"array"!=i&&"object"!=i||(a=JSON.parse(a)),e.properties[t]=a,e.graph&&e.graph._version++,e.onPropertyChanged&&e.onPropertyChanged(t,a),n.onclose&&n.onclose(),l.close(),e.setDirtyCanvas(!0,!0)}},C.prototype.createDialog=function(e,t){def_options={checkForInput:!1,closeOnLeave:!0,closeOnLeave_checkModified:!0},t=Object.assign(def_options,t||{});var n=document.createElement("div"),r=-20,i=-20,a=(n.className="graphdialog",n.innerHTML=e,n.is_modified=!1,(e=this.canvas.getBoundingClientRect())&&(r-=e.left,i-=e.top),t.position?(r+=t.position[0],i+=t.position[1]):t.event?(r+=t.event.clientX,i+=t.event.clientY):(r+=.5*this.canvas.width,i+=.5*this.canvas.height),n.style.left=r+"px",n.style.top=i+"px",this.canvas.parentNode.appendChild(n),t.checkForInput&&(e=[],(e=n.querySelectorAll("input"))&&e.forEach((function(e){e.addEventListener("keydown",(function(e){if(n.modified(),27==e.keyCode)n.close();else if(13!=e.keyCode)return;e.preventDefault(),e.stopPropagation()})),e.focus()}))),n.modified=function(){n.is_modified=!0},n.close=function(){n.parentNode&&n.parentNode.removeChild(n)},null),s=!1;return n.addEventListener("mouseleave",(function(e){s||(t.closeOnLeave||E.dialog_close_on_mouse_leave)&&!n.is_modified&&E.dialog_close_on_mouse_leave&&(a=setTimeout(n.close,E.dialog_close_on_mouse_leave_delay))})),n.addEventListener("mouseenter",(function(e){(t.closeOnLeave||E.dialog_close_on_mouse_leave)&&a&&clearTimeout(a)})),(r=n.querySelectorAll("select"))&&r.forEach((function(e){e.addEventListener("click",(function(e){s++})),e.addEventListener("blur",(function(e){s=0})),e.addEventListener("change",(function(e){s=-1}))})),n},C.prototype.createPanel=function(e,t){var n=(t=t||{}).window||window,r=document.createElement("div");return r.className="litegraph dialog",r.innerHTML="<div class='dialog-header'><span class='dialog-title'></span></div><div class='dialog-content'></div><div style='display:none;' class='dialog-alt-content'></div><div class='dialog-footer'></div>",r.header=r.querySelector(".dialog-header"),t.width&&(r.style.width=t.width+(t.width.constructor===Number?"px":"")),t.height&&(r.style.height=t.height+(t.height.constructor===Number?"px":"")),t.closable&&((t=document.createElement("span")).innerHTML="✕",t.classList.add("close"),t.addEventListener("click",(function(){r.close()})),r.header.appendChild(t)),r.title_element=r.querySelector(".dialog-title"),r.title_element.innerText=e,r.content=r.querySelector(".dialog-content"),r.alt_content=r.querySelector(".dialog-alt-content"),r.footer=r.querySelector(".dialog-footer"),r.close=function(){r.onClose&&"function"==typeof r.onClose&&r.onClose(),r.parentNode&&r.parentNode.removeChild(r),this.parentNode&&this.parentNode.removeChild(this)},r.toggleAltContent=function(e){var t;e=void 0!==e?(t=e?"block":"none",e?"none":"block"):(t="block"!=r.alt_content.style.display?"block":"none","block"!=r.alt_content.style.display?"none":"block"),r.alt_content.style.display=t,r.content.style.display=e},r.toggleFooterVisibility=function(e){e=void 0!==e?e?"block":"none":"block"!=r.footer.style.display?"block":"none",r.footer.style.display=e},r.clear=function(){this.content.innerHTML=""},r.addHTML=function(e,t,n){var i=document.createElement("div");return t&&(i.className=t),i.innerHTML=e,(n?r.footer:r.content).appendChild(i),i},r.addButton=function(e,t,n){var i=document.createElement("button");return i.innerText=e,i.options=n,i.classList.add("btn"),i.addEventListener("click",t),r.footer.appendChild(i),i},r.addSeparator=function(){var e=document.createElement("div");e.className="separator",r.content.appendChild(e)},r.addWidget=function(e,t,i,a,s){a=a||{};var o=String(i),l=("number"==(e=e.toLowerCase())&&(o=i.toFixed(3)),document.createElement("div")),u=(l.className="property",l.innerHTML="<span class='property_name'></span><span class='property_value'></span>",l.querySelector(".property_name").innerText=a.label||t,l.querySelector(".property_value"));function c(e,t){a.callback&&a.callback(e,t,a),s&&s(e,t,a)}return u.innerText=o,l.dataset.property=t,l.dataset.type=a.type||e,l.options=a,l.value=i,"code"==e?l.addEventListener("click",(function(e){r.inner_showCodePad(this.dataset.property)})):"boolean"==e?(l.classList.add("boolean"),i&&l.classList.add("bool-on"),l.addEventListener("click",(function(){var e=this.dataset.property;this.value=!this.value,this.classList.toggle("bool-on"),this.querySelector(".property_value").innerText=this.value?"true":"false",c(e,this.value)}))):"string"==e||"number"==e?(u.setAttribute("contenteditable",!0),u.addEventListener("keydown",(function(t){"Enter"!=t.code||"string"==e&&t.shiftKey||(t.preventDefault(),this.blur())})),u.addEventListener("blur",(function(){var e=this.innerText;c(this.parentNode.dataset.property,e="number"==this.parentNode.dataset.type?Number(e):e)}))):"enum"!=e&&"combo"!=e||(o=C.getPropertyPrintableValue(i,a.values),u.innerText=o,u.addEventListener("click",(function(e){var t=a.values||[],r=this.parentNode.dataset.property,i=this;new E.ContextMenu(t,{event:e,className:"dark",callback:function(e,t,n){return i.innerText=e,c(r,e),!1}},n)}))),r.content.appendChild(l),l},r.onOpen&&"function"==typeof r.onOpen&&r.onOpen(),r},C.getPropertyPrintableValue=function(e,t){if(!t)return String(e);if(t.constructor===Array)return String(e);if(t.constructor===Object){var n,r="";for(n in t)if(t[n]==e){r=n;break}return String(e)+" ("+r+")"}},C.prototype.closePanels=function(){var e=document.querySelector("#node-panel");e&&e.close(),(e=document.querySelector("#option-panel"))&&e.close()},C.prototype.showShowGraphOptionsPanel=function(e,t,n,r){if(this.constructor&&"HTMLDivElement"==this.constructor.name){if(!(t&&t.event&&t.event.target&&t.event.target.lgraphcanvas))return void console.warn("Canvas not found");var i=t.event.target.lgraphcanvas}else i=this;function a(e,t,n){n&&n.key&&(e=n.key),n.values&&(t=Object.values(n.values).indexOf(t)),i[e]=t}i.closePanels(),t=i.getCanvasWindow(),panel=i.createPanel("Options",{closable:!0,window:t,onOpen:function(){i.OPTIONPANEL_IS_OPEN=!0},onClose:function(){i.OPTIONPANEL_IS_OPEN=!1,i.options_panel=null}}),(i.options_panel=panel).id="option-panel",panel.classList.add("settings"),panel.content.innerHTML="";var s=E.availableCanvasOptions;for(pI in s.sort(),s){var o=s[pI];panel.addWidget("boolean",o,i[o],{key:o,on:"True",off:"False"},a)}i.links_render_mode,panel.addWidget("combo","Render mode",E.LINK_RENDER_MODES[i.links_render_mode],{key:"links_render_mode",values:E.LINK_RENDER_MODES},a),panel.addSeparator(),panel.footer.innerHTML="",i.canvas.parentNode.appendChild(panel)},C.prototype.showShowNodePanel=function(e){this.SELECTED_NODE=e,this.closePanels();var t=this.getCanvasWindow(),n=this;function r(){function t(t,r){switch(n.graph.beforeChange(e),t){case"Title":e.title=r;break;case"Mode":var i=Object.values(E.NODE_MODES).indexOf(r);0<=i&&E.NODE_MODES[i]?e.changeMode(i):console.warn("unexpected mode: "+r);break;case"Color":C.node_colors[r]?(e.color=C.node_colors[r].color,e.bgcolor=C.node_colors[r].bgcolor):console.warn("unexpected color: "+r);break;default:e.setProperty(t,r)}n.graph.afterChange(),n.dirty_canvas=!0}panel.content.innerHTML="",panel.addHTML("<span class='node_type'>"+e.type+"</span><span class='node_desc'>"+(e.constructor.desc||"")+"</span><span class='separator'></span>"),panel.addHTML("<h3>Properties</h3>"),panel.addWidget("string","Title",e.title,{},t),panel.addWidget("combo","Mode",E.NODE_MODES[e.mode],{values:E.NODE_MODES},t);var r,i="";for(r in void 0!==e.color&&(i=Object.keys(C.node_colors).filter((function(t){return C.node_colors[t].color==e.color}))),panel.addWidget("combo","Color",i,{values:Object.keys(C.node_colors)},t),e.properties){var a=e.properties[r],s=e.getPropertyInfo(r);s.type,e.onAddPropertyToPanel&&e.onAddPropertyToPanel(r,panel)||panel.addWidget(s.widget||s.type,r,a,s,t)}panel.addSeparator(),e.onShowCustomPanelInfo&&e.onShowCustomPanelInfo(panel),panel.footer.innerHTML="",panel.addButton("Delete",(function(){e.block_delete||(e.graph.remove(e),panel.close())})).classList.add("delete")}panel=this.createPanel(e.title||"",{closable:!0,window:t,onOpen:function(){n.NODEPANEL_IS_OPEN=!0},onClose:function(){n.NODEPANEL_IS_OPEN=!1,n.node_panel=null}}),(n.node_panel=panel).id="node-panel",panel.node=e,panel.classList.add("settings"),panel.inner_showCodePad=function(t){function n(){panel.toggleAltContent(!1),panel.toggleFooterVisibility(!0),i.parentNode.removeChild(i),panel.classList.add("settings"),panel.classList.remove("centered"),r()}panel.classList.remove("settings"),panel.classList.add("centered"),panel.alt_content.innerHTML="<textarea class='code'></textarea>";var i=panel.alt_content.querySelector("textarea"),a=(i.value=e.properties[t],i.addEventListener("keydown",(function(r){"Enter"==r.code&&r.ctrlKey&&(e.setProperty(t,i.value),n())})),panel.toggleAltContent(!0),panel.toggleFooterVisibility(!1),i.style.height="calc(100% - 40px)",panel.addButton("Assign",(function(){e.setProperty(t,i.value),n()})));(panel.alt_content.appendChild(a),a=panel.addButton("Close",n)).style.float="right",panel.alt_content.appendChild(a)},r(),this.canvas.parentNode.appendChild(panel)},C.prototype.showSubgraphPropertiesDialog=function(e){console.log("showing subgraph properties dialog");var t=this.canvas.parentNode.querySelector(".subgraph_dialog"),n=(t&&t.close(),this.createPanel("Subgraph Inputs",{closable:!0,width:500}));function r(){if(n.clear(),e.inputs)for(var t=0;t<e.inputs.length;++t){var i,a=e.inputs[t];a.not_subgraph_input||((i=n.addHTML("<button>✕</button> <span class='bullet_icon'></span><span class='name'></span><span class='type'></span>","subgraph_property")).dataset.name=a.name,i.dataset.slot=t,i.querySelector(".name").innerText=a.name,i.querySelector(".type").innerText=a.type,i.querySelector("button").addEventListener("click",(function(t){e.removeInput(Number(this.parentNode.dataset.slot)),r()})))}}return n.node=e,n.classList.add("subgraph_dialog"),n.addHTML(" + <span class='label'>Name</span><input class='name'/><span class='label'>Type</span><input class='type'></input><button>+</button>","subgraph_property extra",!0).querySelector("button").addEventListener("click",(function(t){var n=this.parentNode,i=n.querySelector(".name").value,a=n.querySelector(".type").value;i&&-1==e.findInputSlot(i)&&(e.addInput(i,a),n.querySelector(".name").value="",n.querySelector(".type").value="",r())})),r(),this.canvas.parentNode.appendChild(n),n},C.prototype.showSubgraphPropertiesDialogRight=function(e){var t=this.canvas.parentNode.querySelector(".subgraph_dialog"),n=(t&&t.close(),this.createPanel("Subgraph Outputs",{closable:!0,width:500}));function r(){if(n.clear(),e.outputs)for(var t=0;t<e.outputs.length;++t){var i,a=e.outputs[t];a.not_subgraph_output||((i=n.addHTML("<button>✕</button> <span class='bullet_icon'></span><span class='name'></span><span class='type'></span>","subgraph_property")).dataset.name=a.name,i.dataset.slot=t,i.querySelector(".name").innerText=a.name,i.querySelector(".type").innerText=a.type,i.querySelector("button").addEventListener("click",(function(t){e.removeOutput(Number(this.parentNode.dataset.slot)),r()})))}}function i(){var t=this.parentNode,n=t.querySelector(".name").value,i=t.querySelector(".type").value;n&&-1==e.findOutputSlot(n)&&(e.addOutput(n,i),t.querySelector(".name").value="",t.querySelector(".type").value="",r())}return n.node=e,n.classList.add("subgraph_dialog"),(t=n.addHTML(" + <span class='label'>Name</span><input class='name'/><span class='label'>Type</span><input class='type'></input><button>+</button>","subgraph_property extra",!0)).querySelector(".name").addEventListener("keydown",(function(e){13==e.keyCode&&i.apply(this)})),t.querySelector("button").addEventListener("click",(function(e){i.apply(this)})),r(),this.canvas.parentNode.appendChild(n),n},C.prototype.checkPanels=function(){if(this.canvas)for(var e=this.canvas.parentNode.querySelectorAll(".litegraph.dialog"),t=0;t<e.length;++t){var n=e[t];!n.node||n.node.graph&&n.graph==this.graph||n.close()}},C.onMenuNodeCollapse=function(e,t,n,r,i){function a(e){e.collapse()}i.graph.beforeChange();var s=C.active_canvas;if(!s.selected_nodes||Object.keys(s.selected_nodes).length<=1)a(i);else for(var o in s.selected_nodes)a(s.selected_nodes[o]);i.graph.afterChange()},C.onMenuNodePin=function(e,t,n,r,i){i.pin()},C.onMenuNodeMode=function(e,t,n,r,i){return new E.ContextMenu(E.NODE_MODES,{event:n,callback:function(e){if(i){var t=Object.values(E.NODE_MODES).indexOf(e),n=function(n){0<=t&&E.NODE_MODES[t]?n.changeMode(t):(console.warn("unexpected mode: "+e),n.changeMode(E.ALWAYS))},r=C.active_canvas;if(!r.selected_nodes||Object.keys(r.selected_nodes).length<=1)n(i);else for(var a in r.selected_nodes)n(r.selected_nodes[a])}},parentMenu:r,node:i}),!1},C.onMenuNodeColors=function(e,t,n,r,i){if(!i)throw"no node for color";var a,s=[];for(a in s.push({value:null,content:"<span style='display: block; padding-left: 4px;'>No color</span>"}),C.node_colors){var o=C.node_colors[a];e={value:a,content:"<span style='display: block; color: #999; padding-left: 4px; border-left: 8px solid "+o.color+"; background-color:"+o.bgcolor+"'>"+a+"</span>"},s.push(e)}return new E.ContextMenu(s,{event:n,callback:function(e){if(i){var t=e.value?C.node_colors[e.value]:null,n=function(e){t?e.constructor===O?e.color=t.groupcolor:(e.color=t.color,e.bgcolor=t.bgcolor):(delete e.color,delete e.bgcolor)},r=C.active_canvas;if(!r.selected_nodes||Object.keys(r.selected_nodes).length<=1)n(i);else for(var a in r.selected_nodes)n(r.selected_nodes[a]);i.setDirtyCanvas(!0,!0)}},parentMenu:r,node:i}),!1},C.onMenuNodeShapes=function(e,t,n,r,i){if(i)return new E.ContextMenu(E.VALID_SHAPES,{event:n,callback:function(e){if(i){i.graph.beforeChange();var t=function(t){t.shape=e},n=C.active_canvas;if(!n.selected_nodes||Object.keys(n.selected_nodes).length<=1)t(i);else for(var r in n.selected_nodes)t(n.selected_nodes[r]);i.graph.afterChange(),i.setDirtyCanvas(!0)}},parentMenu:r,node:i}),!1;throw"no node passed"},C.onMenuNodeRemove=function(e,t,n,r,i){var a;if(!i)throw"no node passed";function s(e){!1!==e.removable&&null!=o&&o.remove(e)}var o=i.graph,l=(null==o||null!=(a=o.beforeChange)&&a.call(o),C.active_canvas);if(!l.selected_nodes||Object.keys(l.selected_nodes).length<=1)s(i);else for(var u in l.selected_nodes)s(l.selected_nodes[u]);null!=o&&o.afterChange(),i.setDirtyCanvas(!0,!0)},C.onMenuNodeToSubgraph=function(e,t,n,r,i){var a,s,o=i.graph,l=C.active_canvas;l&&((a=Object.values(l.selected_nodes||{})).length||(a=[i]),(s=E.createNode("graph/subgraph")).pos=i.pos.concat(),o.add(s),s.buildFromNodes(a),l.deselectAllNodes(),i.setDirtyCanvas(!0,!0))},C.onMenuNodeClone=function(e,t,n,r,i){function a(e){var t;0!=e.clonable&&(t=e.clone())&&(t.pos=[e.pos[0]+15,e.pos[1]+15],e.graph.add(t),s[t.id]=t,o.push({node:e,clonedNode:t}))}i.graph.beforeChange();var s={},o=[],l=C.active_canvas;if(!l.selected_nodes||Object.keys(l.selected_nodes).length<=1)a(i);else for(var u in l.selected_nodes)a(l.selected_nodes[u]);Object.keys(s).length&&l.selectNodes(s),i.graph.afterChange(),i.setDirtyCanvas(!0,!0),i.graph.ins.onAfterClone(o)},C.node_colors={red:{color:"#322",bgcolor:"#533",groupcolor:"#A88"},brown:{color:"#332922",bgcolor:"#593930",groupcolor:"#b06634"},green:{color:"#232",bgcolor:"#353",groupcolor:"#8A8"},blue:{color:"#223",bgcolor:"#335",groupcolor:"#88A"},pale_blue:{color:"#2a363b",bgcolor:"#3f5159",groupcolor:"#3f789e"},cyan:{color:"#233",bgcolor:"#355",groupcolor:"#8AA"},purple:{color:"#323",bgcolor:"#535",groupcolor:"#a1309b"},yellow:{color:"#432",bgcolor:"#653",groupcolor:"#b58b2a"},black:{color:"#222",bgcolor:"#000",groupcolor:"#444"}},C.prototype.getCanvasMenuOptions=function(){var e,t=null;return this.getMenuOptions?t=this.getMenuOptions():(t=[{content:"Add Node",has_submenu:!0,callback:C.onMenuAdd},{content:"Add Group",callback:C.onGroupAdd}],this._graph_stack&&0<this._graph_stack.length&&t.push(null,{content:"Close subgraph",callback:this.closeSubgraph.bind(this)})),this.getExtraMenuOptions&&(e=this.getExtraMenuOptions(this,t))?t.concat(e):t},C.prototype.getNodeMenuOptions=function(e){var t,n=null;return e.getMenuOptions?n=e.getMenuOptions(this):(!(n=[{content:"Inputs",has_submenu:!0,disabled:!0,callback:C.showMenuNodeOptionalInputs},{content:"Outputs",has_submenu:!0,disabled:!0,callback:C.showMenuNodeOptionalOutputs},null,{content:"Properties",has_submenu:!0,callback:C.onShowMenuNodeProperties},null,{content:"Title",callback:C.onShowPropertyEditor},{content:"Mode",has_submenu:!0,callback:C.onMenuNodeMode}])!==e.resizable&&n.push({content:"Resize",callback:C.onMenuResizeNode}),n.push({content:"Collapse",callback:C.onMenuNodeCollapse},{content:"Pin",callback:C.onMenuNodePin},{content:"Colors",has_submenu:!0,callback:C.onMenuNodeColors},{content:"Shapes",has_submenu:!0,callback:C.onMenuNodeShapes},null)),e.onGetInputs&&(t=e.onGetInputs())&&t.length&&(n[0].disabled=!1),e.onGetOutputs&&(t=e.onGetOutputs())&&t.length&&(n[1].disabled=!1),e.getExtraMenuOptions&&(t=e.getExtraMenuOptions(this,n))&&(t.push(null),n=t.concat(n)),!1!==e.clonable&&n.push({content:"Clone",callback:C.onMenuNodeClone}),n.push(null,{content:"Remove",disabled:!(!1!==e.removable&&!e.block_delete),callback:C.onMenuNodeRemove}),e.graph&&e.graph.onGetNodeMenuOptions&&e.graph.onGetNodeMenuOptions(n,e),n},C.prototype.getGroupMenuOptions=function(e){return[{content:"Title",callback:C.onShowPropertyEditor},{content:"Color",has_submenu:!0,callback:C.onMenuNodeColors},{content:"Font size",property:"font_size",type:"Number",callback:C.onShowPropertyEditor},null,{content:"Remove",callback:C.onMenuNodeRemove}]},C.prototype.processContextMenu=function(e,t){var n=this,r=C.active_canvas,i=(r.getCanvasWindow(),null),a={event:t,callback:function(t,r,i){var a,s,o,l,u;t&&("Remove Slot"==t.content?(a=t.slot,e.graph.beforeChange(),a.input?e.removeInput(a.slot):a.output&&e.removeOutput(a.slot),e.graph.afterChange()):"Disconnect Links"==t.content?(a=t.slot,e.graph.beforeChange(),a.output?e.disconnectOutput(a.slot):a.input&&e.disconnectInput(a.slot),e.graph.afterChange()):"Rename Slot"==t.content&&(s=(a=t.slot).input?e.getInputInfo(a.slot):e.getOutputInfo(a.slot),o=n.createDialog("<span class='name'>Name</span><input autofocus type='text'/><button>OK</button>",r),(l=o.querySelector("input"))&&s&&(l.value=s.label||""),u=function(){e.graph.beforeChange(),l.value&&(s&&(s.label=l.value),n.setDirty(!0)),o.close(),e.graph.afterChange()},o.querySelector("button").addEventListener("click",u),l.addEventListener("keydown",(function(e){if(o.is_modified=!0,27==e.keyCode)o.close();else if(13==e.keyCode)u();else if(13!=e.keyCode&&"textarea"!=e.target.localName)return;e.preventDefault(),e.stopPropagation()})),l.focus()))},extra:e},s=(e&&(a.title=e.type),null);if(e&&(s=e.getSlotInPosition(t.canvasX,t.canvasY),C.active_node=e),s)i=[],e.getSlotMenuOptions?i=e.getSlotMenuOptions(s):(s&&s.output&&s.output.links&&s.output.links.length&&i.push({content:"Disconnect Links",slot:s}),(o=s.input||s.output).removable&&i.push(o.locked?"Cannot remove":{content:"Remove Slot",slot:s}),o.nameLocked||i.push({content:"Rename Slot",slot:s})),a.title=(s.input||s.output).type||"*",s.input&&s.input.type==E.ACTION&&(a.title="Action"),s.output&&s.output.type==E.EVENT&&(a.title="Event");else if(e)i=this.getNodeMenuOptions(e);else{i=this.getCanvasMenuOptions();var o=this.graph.getGroupOnPos(t.canvasX,t.canvasY);if(o)return void r.graph.ins.onContentMenu({event:t,group:o})}i&&r.graph.ins.onContentMenu({event:t,node:e})},"undefined"!=typeof window&&window.CanvasRenderingContext2D&&!window.CanvasRenderingContext2D.prototype.roundRect&&(window.CanvasRenderingContext2D.prototype.roundRect=function(e,t,n,r,i,a){var s=0,o=0,l=0,u=0;if(0===i)this.rect(e,t,n,r);else{if(void 0===a&&(a=i),null!=i&&i.constructor===Array)if(1==i.length)s=o=l=u=i[0];else if(2==i.length)s=u=i[0],o=l=i[1];else{if(4!=i.length)return;s=i[0],o=i[1],l=i[2],u=i[3]}else o=s=i||0,u=l=a||0;this.moveTo(e+s,t),this.lineTo(e+n-o,t),this.quadraticCurveTo(e+n,t,e+n,t+o),this.lineTo(e+n,t+r-u),this.quadraticCurveTo(e+n,t+r,e+n-u,t+r),this.lineTo(e+u,t+r),this.quadraticCurveTo(e,t+r,e,t+r-l),this.lineTo(e,t+l),this.quadraticCurveTo(e,t,e+s,t)}}),E.compareObjects=function(e,t){for(var n in e)if(e[n]!=t[n])return!1;return!0},E.distance=j,E.colorToString=function(e){return"rgba("+Math.round(255*e[0]).toFixed()+","+Math.round(255*e[1]).toFixed()+","+Math.round(255*e[2]).toFixed()+","+(4==e.length?e[3].toFixed(2):"1.0")+")"},E.isInsideRectangle=z,E.growBounding=function(e,t,n){t<e[0]?e[0]=t:t>e[2]&&(e[2]=t),n<e[1]?e[1]=n:n>e[3]&&(e[3]=n)},E.isInsideBounding=function(e,t){return!(e[0]<t[0][0]||e[1]<t[0][1]||e[0]>t[1][0]||e[1]>t[1][1])},E.overlapBounding=V,E.hex2num=function(e){e=(e="#"==e.charAt(0)?e.slice(1):e).toUpperCase();for(var t,n,r="0123456789ABCDEF",i=new Array(3),a=0,s=0;s<6;s+=2)t=r.indexOf(e.charAt(s)),n=r.indexOf(e.charAt(s+1)),i[a]=16*t+n,a++;return i},E.num2hex=function(e){for(var t,n,r="0123456789ABCDEF",i="#",a=0;a<3;a++)t=e[a]/16,n=e[a]%16,i+=r.charAt(t)+r.charAt(n);return i},H.prototype.addItem=function(e,t,n){var r=this,i=(n=n||{},document.createElement("div")),a=!(i.className="litemenu-entry base-button submenu");function s(e){var t=this.value,i=!0;if(r.current_submenu&&r.current_submenu.close(e),n.callback&&!0===n.callback.call(this,t,n,e,r,n.node)&&(i=!1),t&&(t.callback&&!n.ignore_item_callbacks&&!0!==t.disabled&&!0===t.callback.call(this,t,n,e,r,n.extra)&&(i=!1),t.submenu)){if(!t.submenu.options)throw"ContextMenu submenu needs options";new r.constructor(t.submenu.options,{callback:t.submenu.callback,event:e,parentMenu:r,ignore_item_callbacks:t.submenu.ignore_item_callbacks,title:t.submenu.title,extra:t.submenu.extra,autoopen:n.autoopen}),i=!1}i&&!r.lock&&r.close()}return null===t?i.classList.add("separator"):(i.innerHTML=t&&t.title?t.title:e,(i.value=t)&&(t.disabled&&(a=!0,i.classList.add("disabled")),(t.submenu||t.has_submenu)&&i.classList.add("has_submenu")),"function"==typeof t?(i.dataset.value=e,i.onclick_callback=t):i.dataset.value=t,t.className&&(i.className+=" "+t.className)),this.root.appendChild(i),a||i.addEventListener("click",s),n.autoopen&&E.pointerListenerAdd(i,"enter",(function(e){var t=this.value;t&&t.has_submenu&&s.call(this,e)})),i},H.prototype.close=function(e,t){this.root.parentNode&&this.root.parentNode.removeChild(this.root),this.parentMenu&&!t&&(this.parentMenu.lock=!1,this.parentMenu.current_submenu=null,void 0===e?this.parentMenu.close():e&&!H.isCursorOverElement(e,this.parentMenu.root)&&H.trigger(this.parentMenu.root,E.pointerevents_method+"leave",e)),this.current_submenu&&this.current_submenu.close(e,!0),this.root.closing_timer&&clearTimeout(this.root.closing_timer)},H.trigger=function(e,t,n,r){var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!0,!0,n),i.srcElement=r,e.dispatchEvent?e.dispatchEvent(i):e.__events&&e.__events.dispatchEvent(i),i},H.prototype.getTopMenu=function(){return this.options.parentMenu?this.options.parentMenu.getTopMenu():this},H.prototype.getFirstEvent=function(){return this.options.parentMenu?this.options.parentMenu.getFirstEvent():this.options.event},H.isCursorOverElement=function(e,t){var n=e.clientX;return e=e.clientY,!!(t=t.getBoundingClientRect())&&e>t.top&&e<t.top+t.height&&n>t.left&&n<t.left+t.width},E.ContextMenu=H,E.closeAllContextMenus=function(e){var t=(e=e||window).document.querySelectorAll(".litecontextmenu");if(t.length){for(var n=[],r=0;r<t.length;r++)n.push(t[r]);for(r=0;r<n.length;r++)n[r].close?n[r].close():n[r].parentNode&&n[r].parentNode.removeChild(n[r])}},E.extendClass=function(e,t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n]);if(t.prototype)for(var n in t.prototype)!t.prototype.hasOwnProperty(n)||e.prototype.hasOwnProperty(n)||(t.prototype.__lookupGetter__(n)?e.prototype.__defineGetter__(n,t.prototype.__lookupGetter__(n)):e.prototype[n]=t.prototype[n],t.prototype.__lookupSetter__(n)&&e.prototype.__defineSetter__(n,t.prototype.__lookupSetter__(n)))},W.sampleCurve=function(e,t){if(t){for(var n=0;n<t.length-1;++n){var r=t[n],i=t[n+1];if(!(i[0]<e)){var a=i[0]-r[0];return Math.abs(a)<1e-5?r[1]:(a=(e-r[0])/a,r[1]*(1-a)+i[1]*a)}}return 0}},W.prototype.draw=function(e,t,n,r,i,a){var s=this.points;if(s){var o=(this.size=t)[0]-2*this.margin,l=t[1]-2*this.margin;i=i||"#666",e.save(),e.translate(this.margin,this.margin),r&&(e.fillStyle="#111",e.fillRect(0,0,o,l),e.fillStyle="#222",e.fillRect(.5*o,0,1,l),e.strokeStyle="#333",e.strokeRect(0,0,o,l)),e.strokeStyle=i,a&&(e.globalAlpha=.5),e.beginPath();for(var u=0;u<s.length;++u){var c=s[u];e.lineTo(c[0]*o,(1-c[1])*l)}if(e.stroke(),e.globalAlpha=1,!a)for(u=0;u<s.length;++u)c=s[u],e.fillStyle=this.selected==u?"#FFF":this.nearest==u?"#DDD":"#AAA",e.beginPath(),e.arc(c[0]*o,(1-c[1])*l,2,0,2*Math.PI),e.fill();e.restore()}},W.prototype.onMouseDown=function(e,t){var n,r,i,a=this.points;if(a&&!(e[1]<0))return n=this.size[0]-2*this.margin,r=this.size[1]-2*this.margin,i=e[0]-this.margin,e=e[1]-this.margin,t=30/t.ds.scale,this.selected=this.getCloserPoint([i,e],t),-1==this.selected&&(a.push(t=[i/n,1-e/r]),a.sort((function(e,t){return e[0]-t[0]})),this.selected=a.indexOf(t),this.must_update=!0),-1!=this.selected||void 0},W.prototype.onMouseMove=function(e,t){var n=this.points;if(n){var r=this.selected;if(!(r<0)){var i=(e[0]-this.margin)/(this.size[0]-2*this.margin),a=(e[1]-this.margin)/(this.size[1]-2*this.margin),s=[e[0]-this.margin,e[1]-this.margin];if(t=30/t.ds.scale,this._nearest=this.getCloserPoint(s,t),s=n[r]){if(!(t=0==r||r==n.length-1)&&(e[0]<-10||e[0]>this.size[0]+10||e[1]<-10||e[1]>this.size[1]+10))return n.splice(r,1),void(this.selected=-1);s[0]=t?0==r?0:1:Math.clamp(i,0,1),s[1]=1-Math.clamp(a,0,1),n.sort((function(e,t){return e[0]-t[0]})),this.selected=n.indexOf(s),this.must_update=!0}}}},W.prototype.onMouseUp=function(e,t){return!(this.selected=-1)},W.prototype.getCloserPoint=function(e,t){var n=this.points;if(!n)return-1;t=t||30;for(var r=this.size[0]-2*this.margin,i=this.size[1]-2*this.margin,a=n.length,s=[0,0],o=1e6,l=-1,u=0;u<a;++u){var c=n[u];o<(s[0]=c[0]*r,s[1]=(1-c[1])*i,s[0],e[0],c=vec2.distance(e,s))||t<c||(l=u,o=c)}return l},E.CurveEditor=W,E.getParameterNames=function(e){return(e+"").replace(/[/][/].*$/gm,"").replace(/\s+/g,"").replace(/[/][*][^/*]*[*][/]/g,"").split("){",1)[0].replace(/^[^(]*[(]/,"").replace(/=[^,]+/g,"").split(",").filter(Boolean)},E.pointerListenerAdd=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(e&&e.addEventListener&&t&&"function"==typeof n){var i=E.pointerevents_method,a=t;if("pointer"==i&&!window.PointerEvent)switch(console.warn("sMethod=='pointer' && !window.PointerEvent"),console.log("Converting pointer["+a+"] : down move up cancel enter TO touchstart touchmove touchend, etc .."),a){case"down":i="touch",a="start";break;case"move":case"cancel":i="touch";break;case"up":i="touch",a="end";break;case"enter":console.log("debug: Should I send a move event?");break;default:console.warn("PointerEvent not available in this browser ? The event "+a+" would not be called")}switch(a){case"down":case"up":case"move":case"over":case"out":case"enter":e.addEventListener(i+a,n,r);case"leave":case"cancel":case"gotpointercapture":case"lostpointercapture":if("mouse"!=i)return e.addEventListener(i+a,n,r);default:return e.addEventListener(a,n,r)}}},E.pointerListenerRemove=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]&&arguments[3];if(e&&e.removeEventListener&&t&&"function"==typeof n)switch(t){case"down":case"up":case"move":case"over":case"out":case"enter":"pointer"!=E.pointerevents_method&&"mouse"!=E.pointerevents_method||e.removeEventListener(E.pointerevents_method+t,n,r);case"leave":case"cancel":case"gotpointercapture":case"lostpointercapture":if("pointer"==E.pointerevents_method)return e.removeEventListener(E.pointerevents_method+t,n,r);default:return e.removeEventListener(t,n,r)}},Math.clamp=function(e,t,n){return e<t?t:n<e?n:e},"undefined"==typeof window||window.requestAnimationFrame||(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)});var G=n(960),K=n(5124);class Z extends k{constructor(){super(...arguments),this.widgets_start_y=0,this.resizable=!1,this.widgetsMap={},this.baseHeight=30,this.isPromiseNode=!1,this.enable=!1,this.dataList=[],this.widgets=[],this.outPutMap={},this.inputMap={},this.addOutput=(e,t,n)=>{let r=t;var i={pos:n.pos};return"event"===t&&(r=-1),t=super.addOutput(e,r,i),this.outPutMap[e]=n,this.resetButtonWidgetPos(),this.autoSize(),t},this.execAfterTrigger=!0,this.message={show:!1,type:"error",data:"",addedSize:0,colorMap:{error:{color:"#FFAA95",bgc:"rgb(119,19,21)"},succees:{color:"#FFFFFF",bgc:"rgb(29,73,1)"},waring:{color:"#FFFFFF",bgc:"#A55906"}}},this._closeMessage=()=>{this.message.show=!1,this.size[1]-=this.message.addedSize,this.message.addedSize=0},this.closeMessage=(0,a.fnDebounce)(this._closeMessage,1e4),this.showError=e=>{this.message.show=!0,this.message.data=e,this.message.type="error",this.closeMessage()},this.showWaring=e=>{this.message.show=!0,this.message.data=e,this.message.type="waring",this.closeMessage()},this.showSuccees=e=>{this.message.show=!0,this.message.data=e,this.message.type="succees",this.closeMessage()},this.keepMessageShow=e=>{this.message.show=!0,this.message.data=e,this.message.type="succees"}}addToDataList(e){var t;this.dataList.push(Object.assign(Object.assign({},e),{id:this.id})),null!=(t=this.onAddToDataList)&&t.call(this,e)}addInput(e,t,n){let r=t;var i=Object.assign({},n);return"event"===t&&(r=-1),this.inputMap[e]=n,super.addInput(e,r,i)}addValue(e,t){super.addProperty(e,t)}_addWidget(e,t,n,r,i){return super.addWidget(e,t,n,r,i)}addWidget(e){let{type:t,label:n,value:r,get:i,set:a,options:s,key:o}=e;return r=r||(null!=s&&s.values?s.values[0]:""),e=this.getWidgetY(),this.widgetsMap[o]=super.addWidget(t,n,r,(e=>{null!=a&&a(e),this.setValue(o,e)}),Object.assign({values:(null==s?void 0:s.values)||i,callback:a,property:null!=s&&s.unSaved?"":o},s)),this.properties[o]=r,this.resetButtonWidgetPos(),this.setSize(),this.autoSize(),this.widgetsMap[o].y=e,this.widgetsMap[o]}setGraphSize(e,t){super.size=[e,t]}setValue(e,t){super.setProperty(e,t),this.setWidgetValue(e,t)}onValueChanged(e,t){}onPropertyChanged(e,t){this.processSavedData(e,t),this.onValueChanged(e,t)}setWidgetValue(e,t){this.widgetsMap[e]&&(this.widgetsMap[e].value=t)}getWidgetValue(e,t){return e=null==(e=this.widgetsMap[e])?void 0:e.value,this.getText(e,t)}getText(e,t){if(!e||null==t||!t.wordMap)return e;let n=e;return t.wordMap.map(((e,t)=>{n=(0,b.lp)(n,e,t)})),n}onResize(){this.inputs.map((e=>{e.getPos&&(e.size=e.getPos())})),this.outputs.map((e=>{e.getPos&&(e.size=e.getPos())})),this.reDraw()}reDraw(){var e;null!=(e=null==(e=this.graph)?void 0:e.list_of_graphcanvas)&&e.map((e=>{null!=e&&e.drawNode(this,e.ctx)}))}onSelected(){console.log(this,"this")}isLast(e){if(e)return!(e=this.getOutputNodes(e))||0===e.length;for(let e=0;e<this.outputs.length;e++){var t=this.getOutputNodes(e);if(t&&0!==t.length)return!1}return!0}onAfterExecuteNode(e){}exec(e){this.parms=e,this.onActionDone(e),this.log("执行完毕,进行下一个节点"),this.trigger(null,e),this.afterTrigger(e)}execSlot(e,t){this.parms=t,this.onActionDone(t),this.log("执行完毕,执行下一个节点插槽"),this.triggerSlot(e,t),this.afterTrigger(t)}isEndNode(e){if(!this.isLast())return!1;for(const t of e.peddingMap.toArray("value"))if(!t)return!1;return!0}getNodeName(){return this.title+"_"+this.id}afterTrigger(e,t){var n;if(e&&this.execAfterTrigger&&this.isEndNode(e)){const{lastTriggerMap:t,onlyTriggerLastKey:r,onlyTriggerType:i,onDones:a}=e;null!=a&&a.map(((e,t)=>{a.delete(e),null!=t&&t()})),r?null!=(n=t.get(r))&&n(e):i?t.toArray("key").map((n=>{var[r]=n.split("_");this.log(`执行尾调用:当前类型-${r},允许执行类型-`+i),r===i&&null!=(r=t.get(n))&&r(e)})):this.execParms(e,{ignore:!0})}}execParms(e,t){const n=e.lastTriggerMap,r=(t||{}).ignore;n.toArray("key").map((t=>{r&&e.ignorelastTriggers.includes(t)||n.get(t)(e)}))}onAdded(){var e;this.runScene||(this.runScene=this.graph.runScene,this.onBindGraph()),null!=(e=this.onAfterAdded)&&e.call(this)}setOutData(e,t){var n=this.outputs.findIndex((t=>t.name===e));return-1!==n&&this.setOutputData(n,t)}getDataByIdx(e,t){var n,r=this.getInputData(e);return r||(r=this.inputs[e],null==(n=null==(e=this.getInputNode(e))?void 0:e.creatOutData)?void 0:n.call(e,r.link,t))}getData(e,t){var n=this.inputs.findIndex((t=>t.name===e));if(-1!==n)return this.getDataByIdx(n,t||{parms:this.parms})}onTrigger(){}findOutNodeByLink(e){if(e=this.graph.links[e])return({origin_slot:e}=e),this.outputs[e]}creatOutData(e,t){return e=this.findOutNodeByLink(e),this.creatOutDataByNode(e,t)}creatOutDataByNode(e,t){return null==(e=this.outPutMap[null==e?void 0:e.name])?void 0:e.createData(t)}onInputLink(e){var t,n=e.targetSlot;n=this.inputs[n],null!=(t=null==(n=this.inputMap[n.name])?void 0:n.onLink)&&t.call(n,e)}onAfterInputLink(e){var t,n=e.slot;(n=this.inputs[n])&&null!=(t=null==(n=this.inputMap[n.name])?void 0:n.onAfterLink)&&t.call(n,e)}onOutputLink(e){var t;null!=(t=null==(e=this.inputs[e])?void 0:e.onLink)&&t.call(e)}onRemoved(){}onNodeInputAdd(){}onConnectInput(...e){var[e,t,n,r,i]=e;this.onInputLink({targetSlot:e,targetType:t,targetNode:n,target:r,slot:i})}onConnectOutput(){}onAction(e,t){var n;this.log("运行节点"),this.isPromiseNode&&"执行"===e&&this.bindRuning(!1,t),null!=(n=this.onPlay)&&n.call(this,e,t)}createOutputData(e){}stopOutNode(e){const t=[];let n;this.getAllOutNodes(t,e),t.map((e=>{e.parms&&(n=e.parms),e.onStop()})),n&&this.runScene.cb.graph.runtime.resetData.cb({data:n})}getAllNodeByLinks(e=new m.Z){if(!e.get(this.id))return e.set(this.id,this),this.inputs.map(((t,n)=>{const r=this.getInputNode(n);null!=r&&r.getAllNodeByLinks(e)})),this.outputs.map(((t,n)=>{const r=this.getOutputNodes(n);null!=r&&r.map((t=>t.getAllNodeByLinks(e)))})),e}getAllOutNodes(e=[],t){const n=[];if(this.outputs.map(((e,t)=>{n.push(...G.F6.toArr(this.getOutputNodes(t)))})),!t)return e.push(...n);n.map((n=>{n&&(e.push(n),n.getAllOutNodes(e,t))}))}getAllInputNodes(e=[],t){const n=[];if(this.inputs.map(((e,t)=>{n.push(...G.F6.toArr(this.getInputNode(t)))})),!t)return e.push(...n);n.map((n=>{n&&(e.push(n),n.getAllInputNodes(e,t))}))}onStop(e){this.dataList.length=0}onGraphStop(){this.message.show&&this._closeMessage()}delWidget(e){G.F6.toArr(e).map((e=>{G.F6.findThenDel(this.widgets,(t=>t.name===e)),this.setGraphSize(200,this.size[1]-this.baseHeight)}))}delWidgetByKey(e){G.F6.toArr(e).map((e=>{G.F6.findThenDel(this.widgets,(t=>(null==(t=t.options)?void 0:t.property)===e)),this.setGraphSize(200,this.size[1]-this.baseHeight)}))}createWidgetKey(e){return"widget_"+e}processSavedData(e,t){var n;e.includes("widget_")&&null!=(n=this.createWidgetByForSavedKey)&&n.call(this,e,t)}findWidget(e){return this.widgets.find((t=>t.options.property===e))}delValue(e){delete this.properties[e]}onConnectionsChange(...e){var[e,t,n,r,i]=e;1===e&&this.onAfterInputLink({type:e,slot:t,unknow:n,link:r,node:i})}setSize(){}autoSize(){var e=Math.max(this.inputs.length,this.outputs.length)*this.baseHeight;e+=this.widgets.length*this.baseHeight,super.size=[200,20+e]}getMaxSubNodeLength(){return Math.max(this.inputs.length,this.outputs.length)}getSubNodeY(e,t){let n=30*this.widgets.length+30*(this["input"===e?"inputs":"outputs"].length-(t?1:0));return n+=0<this.widgets.length&&!this.buttonWidget?15:10,this.buttonWidget&&(n-=30),n}resetButtonWidgetPos(){var e;this.buttonWidget&&(e=30*this.getMaxSubNodeLength()+30*(this.widgets.length-1)+10,this.buttonWidget.y=e)}getWidgetY(e){return 30*this.getMaxSubNodeLength()+30*(this.widgets.length-(e?1:0))+10+(this.buttonWidget?-30:0)}onActionDone(e){this.isPromiseNode&&this.bindRuning(!0,e)}bindRuning(e,t=this.parms){t&&(e?(t.peddingMap.delete(this.getNodeName()),this._closeMessage(),this.log("异步节点运行完毕")):(t.peddingMap.set(this.getNodeName(),e),this.showWaring("运行中"),this.log("异步节点运行中")))}linkInputToNode(e,t){}unLinkAll(){this.inputs.map(((e,t)=>{this.disconnectInput(t)})),this.outputs.map(((e,t)=>{this.disconnectOutput(t)}))}onNodeDblClicked(){this.graph.ins.setSelect(this.getAllLinkNodes(),!1)}getAllLinkNodes(){return this.getAllNodeByLinks().toArray("value")}onConfigure(e){this.onLoadProperties(e.properties),this.autoSize(),this.resetButtonWidgetPos(),this.resetSlotPos()}resetSlotPos(){}getSubNode(e,t){return"input"===e?this.inputs.find((e=>e.name===t.name)):"out"===e?this.outputs.find((e=>e.name===t.name)):"widget"===e?this.widgets.find((e=>e.name===t.name)):void 0}onInputAdded(e){this.resetButtonWidgetPos(),this.autoSize(),this.afterAdd("input",e)}onOutputAdded(e){this.resetButtonWidgetPos(),this.autoSize(),this.afterAdd("out",e)}onWidgetAdded(e){this.resetButtonWidgetPos(),this.autoSize(),this.afterAdd("widget",e)}afterAdd(e,t){"input"===e||"out"===e?t.pos=["input"===e?15:185,this.getSubNodeY(e,!0)]:t.y=this.getWidgetY(!0)}onBindGraph(){}drawMessage(e){var t;this.message.show&&(t=this.message.colorMap[this.message.type],this.message.addedSize<=10?(this.size[1]+=2.5,this.message.addedSize+=2.5):(e.fillStyle=t.bgc,this.drawRoundRect(e,10,0,this.size[1]-20,this.size[0],20),e.fill(),e.fillStyle=t.color,e.font="12px Arial",e.textAlign="left",e.fillText(this.message.data,10,this.size[1]-5)))}drawRoundRect(e,t,n,r,i,a){e.save(),a<2*(t=i<2*t?i/2:t)&&(t=a/2),e.beginPath(),e.moveTo(n+t,r),e.arcTo(n+i,r,n+i,r+a,0),e.arcTo(n+i,r+a,n,r+a,t),e.arcTo(n,r+a,n,r,t),e.arcTo(n,r,n+i,r,0),e.closePath(),e.clip(),e.fill(),e.restore()}hasSubNode(e,t){return void 0!==this["input"===e?"inputs":"outputs"].find((e=>e.name===t))}log(...e){this.graph.ins.debug&&console.log(this.title+" | ",...e," | ",this.id)}findOutNodeByName(e){var t=this.outputs.findIndex((t=>t.name===e));if(-1!==t)return this.getOutputNodes(t)}onLoadProperties(e){e&&(0,a.mapObj)(e,((e,t)=>{this.setWidgetValue(e,t)}))}rmOnlyTriggerType(e){if(e.onlyTriggerType&&e.onlyTriggerType===this.title){let t=0;e.lastTriggerMap.map((e=>{var[e]=e.split("_");this.title===e&&t++})),t<2&&(e.onlyTriggerType=void 0)}}getDataByType(e,t,n){return(null==(e=this.getData(e,n))?void 0:e.type)!==t||null==e?void 0:e.data}}Z.title_text_color="rgba(255, 255, 255, 0.6)";const q="rgb(55,130,55)",X="rgb(88,107,29)",Y="rgb(150,86,81)",Q="rgb(42,93,76)",J="rgb(39,83,122)",$="rgb(93,53,22)";class ee extends Z{constructor(){super(),this.title="获取执行状态",this.color=J,this.addInput("执行","event",{}),this.addOutput("开启时执行","event",{}),this.addOutput("关闭时执行","event",{}),this.addWidget({type:"text",value:"",label:"名称",key:"name"})}onPlay(e,t){var n=this.getWidgetValue("name",t),r=ee.stateMap[n];this.keepMessageShow(n+"="+r),r?this.execSlot(0,t):this.execSlot(1,t)}onConfigure(e){}onStop(){}}ee.title="获取执行状态",ee.stateMap=new Proxy({},{set:(e,t,n)=>(zn.callBack.data.setBoolean.cb({map:e,key:t,state:n}),e[t]=n,!0)});class te extends Z{constructor(){super(),this.title="数组",this.color=X,this.addInput("执行","event",{}),this.addOutput("依次触发","event",{}),this.addOutput("输出当前数据","string",{createData:()=>{var e={type:"models",data:this.nowModel?[this.nowModel]:[]};return this.getWidgetValue("wait")||this.execNode(this.parms),e}}),this.addbutton(),this.setSize()}addbutton(){this.buttonWidget=this._addWidget("button","添加数据","",(()=>{this.addWidget({type:"text",label:"数据"+this.widgets.length,value:"",key:this.createWidgetKey("data"+this.widgets.length)})}))}setSize(){this.setGraphSize(200,Math.max(24*this.widgets.length)+60)}createWidgetByForSavedKey(e,t){this.findWidget(e)||this.addWidget({type:"text",label:"数据"+this.widgets.length,value:t,key:this.createWidgetKey("data"+this.widgets.length)})}onPlay(e,t){(0,a.mapObj)(this.widgetsMap,((e,n,r)=>{n&&0!==n.length&&(t.outData={type:"string",data:n,index:r+1},this.triggerSlot(0,t))}))}execNode(e){}}te.title="数组";class ne extends Z{constructor(){super(),this.title="开始运行",this.color="rgb(200,150,150)",this.runData=fe.getRunData(this)}init(){this.addOutput("触发","event",{})}onPlay(e,t){null==this.parms&&(this.parms=t),this.resetData(),this.runData.runState=!0,this.exec(t||this.runData)}resetData(e=this.runData){fe.resetData(e)}onStop(){this.resetData()}}ne.title="开始运行",ne.title_text_color="rgb(0,0,0)";class re extends ne{constructor(){super(),this.title="开始自转",this.run=!1,this.addOutput("触发","event",{})}onStart(){this.run=!0}onPlay(){this.run&&(this.runData.runState=!0,this.exec(this.runData))}onStop(){this.run=!1}}re.title="开始自转";class ie extends ne{constructor(){super(),this.title="保存前",this.addOutput("触发","event",{})}}ie.title="保存前";class ae extends ne{constructor(){super(),this.title="自定义运行",this.addWidget({type:"text",label:"名称",value:"",key:"name"}),this.buttonWidget=super._addWidget("button","添加输入事件",null,(()=>{this.addInput("执行"+this.inputs.length,"event",{}),this.addOutput("触发"+this.inputs.length,"event",{})}))}}ae.title="自定义运行";class se extends ne{constructor(){super(),this.title="第一帧渲染完毕",this.addOutput("触发","event",{})}}se.title="第一帧渲染完毕";class oe extends ne{constructor(){super(),this.title="初始化完毕",this.addOutput("触发","event",{})}}oe.title="初始化完毕";class le extends ne{constructor(){super(),this.title="打断自转",this.run=!1,this.addOutput("触发","event",{})}onStart(){this.run=!0}onPlay(){this.run&&(this.runData.runState=!0,this.exec(this.runData))}onStop(){this.run=!1}}le.title="打断自转";class ue extends ne{constructor(){super(),this.title="鼠标按下",this.run=!1,this.addOutput("触发","event",{})}onStart(){this.run=!0}onPlay(){!this.run||ue.isDown||(ue.isDown=!0,this.runData.runState=!0,this.exec(this.runData))}onStop(){this.run=!1}}ue.title="鼠标按下",ue.isDown=!1;class ce extends ne{constructor(){super(),this.title="鼠标抬起",this.run=!1,this.addOutput("触发","event",{})}onStart(){this.run=!0}onPlay(){this.run&&ue.isDown&&(ue.isDown=!1,this.runData.runState=!0,this.exec(this.runData))}onStop(){this.run=!1}}ce.title="鼠标抬起";class de extends ne{constructor(){super(),this.title="开始运行",this.addOutput("触发","event",{})}onStart(){this.runData.runState=!0,this.exec(this.runData)}}de.title="开始运行";class he extends ne{constructor(){super(),this.title="关闭运行",this.addOutput("触发","event",{})}onPlay(){this.runData.runState=!0,this.exec(this.runData)}}he.title="关闭运行";class pe extends ne{constructor(){super(),this.title="调用自定义",this.getValues=()=>{const e=this.graph.findNodesByType("生命周期/自定义运行");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.addWidget({type:"combo",label:"事件名称",key:"name",get:this.getValues}),this.addInput("执行","event",{}),this.addOutput("回调","event",{})}onPlay(e,t){null==this.parms&&(this.parms=t);const n=this.getSelectedNode();if(n){const e=fe.getRunData(this,{getDone:!0});e.runState=!0,e.onDones.set(this.id,(()=>{this.exec(t)})),n.exec(e)}}getSelectedNode(){const e=this.graph.findNodesByType("生命周期/自定义运行");let t;return G.F6.filter(e.map((e=>{e.widgetsMap.name.value===this.getWidgetValue("name")&&(t=e)}))),t}}pe.title="调用自定义";class fe{static getRunData(e,t){return{runWay:(null==e?void 0:e.title)||"蓝图",lastTriggerMap:new m.Z,runState:!1,ignorelastTriggers:[],peddingMap:new m.Z,onDones:null!=t&&t.getDone?new m.Z:void 0}}static createDefRunData(e){const{ins:t,parms:n}=e,r=fe.getRunData(t,{getDone:!0});return r.runState=!0,r.onDones.set(t.id,(()=>{t.exec(n)})),r}triggerCustom(e,t){e.registerNodeType("生命周期/开始运行",de),e.registerNodeType("生命周期/关闭运行",he),e.registerNodeType("生命周期/保存前",ie),e.registerNodeType("生命周期/初始化完毕",oe),e.registerNodeType("生命周期/自定义运行",ae),e.registerNodeType("生命周期/调用自定义",pe),e.registerNodeType("生命周期/开始自转",re),e.registerNodeType("生命周期/打断自转",le),e.registerNodeType("生命周期/鼠标按下",ue),e.registerNodeType("生命周期/鼠标抬起",ce),e.registerNodeType("生命周期/第一帧渲染完毕",se),t.cb.graph.setState.add("graph-runtime",(({state:t})=>{t||e.runByType("生命周期/关闭运行")})),t.cb.exporter.gltf.before.add("graph-runtime",(()=>{e.runByType("生命周期/保存前")})),t.cb.load.modelAdded.add("graph-runtime",(()=>{e.runByType("生命周期/初始化完毕")})),e.runScene.cb.controls.autoRotate.resume.add("trigger-time",(()=>{e.runByType("生命周期/开始自转")})),e.runScene.cb.controls.autoRotate.pause.add("trigger-time",(()=>{e.runByType("生命周期/打断自转")})),e.runScene.cb.events.window.pointer.up.add("trigger-time",(()=>{e.runByType("生命周期/鼠标抬起")})),e.runScene.cb.events.pointer.down.add("trigger-time",(()=>{e.runByType("生命周期/鼠标按下")})),e.runScene.cb.renderEx.fristFrame.add("trigger-time",(()=>{e.runByType("生命周期/第一帧渲染完毕")})),fe.callBack.runCustom.add("graph-custom",(({name:e,onDone:n,type:r})=>{const i=t.graph,s=fe.getRunData();s.onDones=new m.Z;var o=(0,a.getId)();if(n&&s.onDones.set(o,n),s.runState=!0,"button"!==r)for(const t of[...i.getNodesByTypes("生命周期/自定义运行")])if(t.widgetsMap.name.value===e)return t.actionDo(null,s),t;if("custom"!==r)for(const t of[...i.getNodesByTypes("UI/按钮"),...i.getNodesByTypes("UI/移动端按钮组")])if(console.log("Log-- ",t.catchName,"node as any).catchName"),t.widgetsMap.name.value===e||t.catchName===e)return t.triggerButton(s),t})),fe.callBack.resetData.add("graph-custom",(e=>{fe.resetData(e.data)}))}static resetData(e){e.runState=!1,e.lastTriggerMap.clear(),e.ignorelastTriggers=[],e.peddingMap.clear(),e.peddingMap=new m.Z}}fe.callBack={runCustom:new d.Z,resetData:new d.Z};class me extends Z{constructor(){super(),this.title="文本数组",this.color=X,this.nowStr=void 0,this.index=0,this.playing=!1,this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{}),this.addOutput("依次触发","event",{}),this.addOutput("输出当前数据","string",{createData:()=>({type:"string",data:this.nowStr})}),this.addbutton()}addbutton(){this.buttonWidget=this._addWidget("button","添加数据","",(()=>{this.addWidget({type:"text",label:"数据"+this.widgets.length,value:"",key:this.createWidgetKey("data"+this.widgets.length)})}))}onPlay(e,t){this.parms=t,"执行"===e?(this.playing=!0,this.index=0,this.execNode(t)):"关闭"===e&&this.onStop()}execNode(e){var t=null==(t=this.getOutputNodes(1))?void 0:t[0];if(this.index+=1,this.nowStr=this.getWidgetValue(this.createWidgetKey("data"+this.index)),t&&this.nowStr){const t=fe.getRunData(this,{getDone:!0});t.runState=!0,this.triggerSlot(1,t),this.execNode(e)}else this.triggerSlot(0,e)}onStop(){this.playing=!1,this.index=0}onConfigure(e){(0,a.mapObj)(e.properties,((e,t)=>{e.includes("widget")&&this.addWidget({type:"text",label:"数据"+this.widgets.length,value:t,key:this.createWidgetKey("data"+this.widgets.length)})}))}}me.title="文本数组";class ge extends Z{constructor(){super(),this.title="修改文本",this.color=q,this.length=0,this.addInput("输入数据","string",{}),this.addOutput("输出数据","string",{createData:e=>({type:"string",data:this.createStr(e.parms)})}),this.addWidget({type:"text",label:"文本",value:"",key:"content"}),this.addWidget({type:"text",label:"输入前缀",value:"",key:"prefix"}),this.addWidget({type:"number",label:"删除前:",value:"",key:"rmPrefix",options:{step:10}}),this.addWidget({type:"text",label:"输入后缀",value:"",key:"back"}),this.addWidget({type:"number",label:"删除后:",value:"",key:"rmBack",options:{step:10}}),this.addWidget({type:"number",label:"步进",value:"",key:"step",options:{step:10}}),this.addWidget({type:"toggle",label:"校验数据",key:"valid",value:!0,options:{on:"开启",off:"关闭"}})}createStr(e){var t,n=this.getWidgetValue("prefix",e),r=this.getWidgetValue("back",e);if((e=this.getDataByType("输入数据","string",{parms:e})||this.getWidgetValue("content",e))||!this.getWidgetValue("valid"))return t=this.getWidgetValue("step"),n=n+(0,u.trimString)({str:e,before:this.getWidgetValue("rmPrefix")||0,after:this.getWidgetValue("rmBack")||0})+r+(t?++this.length*t+"":""),this.keepMessageShow("文本="+n),n}onStop(){this.length=0}}ge.title="修改文本";class ve extends Z{constructor(){super(),this.title="请求数据",this.addWidget({type:"text",label:"链接",key:"url",value:""}),this.addWidget({type:"combo",label:"请求类型",key:"type",value:"get",options:{values:["get","post"]}}),this.addOutput("输出数据","request-data",{createData:()=>{var e=this.widgetsMap.url.value,t=this.widgetsMap.type.value;if(e&&0!==e.length)try{return i()[t](e).then((e=>({type:"request-data",data:e.data})))}catch(e){return}}})}}ve.title="请求数据";class ye extends Z{constructor(){super(),this.title="设置文本替换",this.color=q,this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addWidget({type:"text",value:"",label:"名称",key:"name"}),this.addWidget({type:"text",value:"",label:"值",key:"value"}),this.addInput("输入动态值","string",{})}onPlay(e,t){var n=this.getData("输入动态值",{parms:t}),r=(t.wordMap||(t.wordMap=new m.Z),this.getWidgetValue("name"));n="string"===(null==n?void 0:n.type)?n.data:this.getWidgetValue("value"),t.wordMap.set(r,n),this.keepMessageShow(r+"="+n),this.exec(t)}onStop(){}}ye.title="设置文本替换",ye.stateMap={};class be extends Z{constructor(){super(),this.title="设置变量",this.color=$,this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addWidget({type:"text",value:"",label:"名称",key:"name"}),this.addWidget({type:"text",value:"",label:"值",key:"value"}),this.addInput("输入动态值","string",{})}onPlay(e,t){var n=this.getDataByType("输入动态值","string",{parms:t}),r=this.getWidgetValue("name",t);n=n||this.getWidgetValue("value",t),be.varMap[r]=n,this.keepMessageShow(r+"="+n),this.exec(t)}onStop(){be.varMap={}}}be.title="设置变量",be.varMap={};class xe extends Z{constructor(){super(),this.title="获取变量",this.color=$,this.addInput("执行","event",{}),this.addOutput("匹配回调","event",{}),this.addWidget({type:"text",value:"",label:"名称",key:"name"}),this.addWidget({type:"text",value:"",label:"值",key:"value"}),this.addInput("输入动态值","string",{})}onPlay(e,t){var n=this.getDataByType("输入动态值","string",{parms:t}),r=this.getWidgetValue("name",t);let i=!1;n=n||this.getWidgetValue("value",t);var a,s=be.varMap[r];let o=s;(0,u.isNull)(s)?(a=null==(a=null==t?void 0:t.wordMap)?void 0:a.get(r))===n&&(o=a,i=!0):s===n&&(i=!0),this.keepMessageShow(r+"="+o),i&&this.exec(t)}onStop(){}}xe.title="获取变量",xe.stateMap={};class we extends Z{constructor(){super(),this.title="获取变量",this.color=$,this.addWidget({type:"text",value:"",label:"名称",key:"name"}),this.addOutput("输出值","string",{createData:e=>({type:"string",data:be.varMap[this.getWidgetValue("name",e.parms)]})})}}we.title="获取变量",we.stateMap={};class Se extends Z{constructor(){super(),this.title="数值区间",this.onceTrigger=!1,this.addWidget({type:"slider",key:"num1",label:"数值1",value:0,options:{max:100,min:0}}),this.addWidget({type:"slider",key:"num2",label:"数值2",value:0,options:{max:100,min:0}}),this.addWidget({type:"toggle",key:"once",label:"执行一次",value:!0}),this.addInput("输入数值","number",{}),this.addOutput("触发","event",{})}onNumberChange(e,t){var n=this.getWidgetValue("num1",t),r=this.getWidgetValue("num2",t),i=Math.min(n,r);n=Math.max(n,r),i<=e&&n<=n&&(this.getWidgetValue("once",t)?this.onceTrigger||(this.onceTrigger=!0,this.exec(t)):this.exec(t))}onStop(){this.onceTrigger=!1}}Se.title="数值区间";class _e{triggerCustom(e){e.registerNodeType("数据/数值/区间",Se)}}class Te extends Z{constructor(){super(),this.title="获取执行状态表",this.stateLength=0,this.keyMap={},this.color=J,this.getValues=()=>{var e;const t=(null==(e=this.graph)?void 0:e.findNodesByType("数据/状态/设置"))||[];return G.F6.filter(t.map((e=>e.widgetsMap.name.value)))},this.addInput("执行","event",{}),this.addOutput("开启时执行","event",{}),this.addOutput("关闭时执行","event",{}),this.buttonWidget=super._addWidget("button","添加事件",null,(()=>{this.stateLength+=1;var e=this.createWidgetKey("name"+this.stateLength),t=this.createWidgetKey("data"+this.stateLength);this.addWidget({type:"combo",label:"状态名称"+this.stateLength,value:this.getValues()[0],key:e,options:{values:this.getValues()}}),this.addWidget({type:"toggle",label:"状态"+this.stateLength,value:!0,key:t}),this.keyMap[e]=t}))}onPlay(e,t){let n=!0;(0,a.mapObj)(this.properties,((e,r)=>{e.includes("name")&&ee.stateMap[r]!==this.getWidgetValue(this.keyMap[e],t)&&(n=!1)})),n?this.execSlot(0,t):this.execSlot(1,t)}onConfigure(e){new Array(Object.keys(e.properties).length/2).fill("").map(((t,n)=>{n+=1;var r=(this.stateLength+=1,this.createWidgetKey("name"+n)),i=this.createWidgetKey("data"+n),a=e.properties[r],s=e.properties[i];this.addWidget({type:"combo",label:"状态名称"+n,value:a,key:r,options:{values:this.getValues()}}),this.addWidget({type:"toggle",label:"状态"+n,value:s,key:i}),this.keyMap[r]=i}))}onStop(){}}Te.title="获取执行状态表";class Me extends Z{constructor(){super(),this.title="从文本获取执行状态表",this.stateLength=0,this.keyMap={},this.color=J,this.getValues=()=>{var e;const t=(null==(e=this.graph)?void 0:e.findNodesByType("数据/状态/设置"))||[];return G.F6.filter(t.map((e=>e.widgetsMap.name.value)))},this.addInput("执行","event",{}),this.addOutput("开启时执行","event",{}),this.addOutput("关闭时执行","event",{}),this.buttonWidget=super._addWidget("button","添加事件",null,(()=>{this.stateLength+=1;var e=this.createWidgetKey("name"+this.stateLength),t=this.createWidgetKey("data"+this.stateLength);this.addWidget({type:"text",label:"状态名称"+this.stateLength,value:"",key:e}),this.addWidget({type:"toggle",label:"状态"+this.stateLength,value:!0,key:t}),this.keyMap[e]=t}))}onPlay(e,t){let n=!0,r="";(0,a.mapObj)(this.properties,((e,i)=>{var a,s;e.includes("name")&&(a=this.getWidgetValue(e,t),s=ee.stateMap[a],r+=a+`=${s};`,s!==this.getWidgetValue(this.keyMap[e],t)&&(n=!1))})),this.keepMessageShow(r),n?this.execSlot(0,t):this.execSlot(1,t)}onConfigure(e){new Array(Object.keys(e.properties).length/2).fill("").map(((t,n)=>{n+=1;var r=(this.stateLength+=1,this.createWidgetKey("name"+n)),i=this.createWidgetKey("data"+n),a=e.properties[r],s=e.properties[i];this.addWidget({type:"text",label:"状态名称"+n,value:a,key:r,options:{values:this.getValues()}}),this.addWidget({type:"toggle",label:"状态"+n,value:s,key:i}),this.keyMap[r]=i}))}onStop(){}}Me.title="从文本获取执行状态表";class Ee extends Z{constructor(){super(),this.title="设置执行状态",this.color=J,this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addWidget({type:"text",value:"",label:"名称",key:"name"}),this.addWidget({type:"toggle",value:!0,label:"设置状态",key:"state"})}onPlay(e,t){var n=this.getWidgetValue("name",t),r=this.getWidgetValue("state");ee.stateMap[n]=r,this.exec(t),this.keepMessageShow(n+"="+r)}onConfigure(e){ee.stateMap[e.properties.name]=!1,this.setWidgetValue("state",e.properties.state)}}Ee.title="设置执行状态";class De{triggerCustom(e){e.registerNodeType("数据/状态/设置",Ee),e.registerNodeType("数据/状态/获取",ee),e.registerNodeType("数据/状态/获取表",Te),e.registerNodeType("数据/状态/从文本获取表",Me)}}class Pe{triggerCustom(e){e.registerNodeType("数据/请求",ve),e.registerNodeType("数据/数组/文本",me),e.registerNodeType("数据/数组/模型",te),e.registerNodeType("数据/文本",ge,!0),e.registerNodeType("数据/文本/修改",ge),e.registerNodeType("数据/文本/替换",ye),e.registerNodeType("数据/变量",ye,!0),e.registerNodeType("数据/变量/设置",be),e.registerNodeType("数据/变量/判断执行",xe),e.registerNodeType("数据/变量/获取",we),(new _e).triggerCustom(e),(new De).triggerCustom(e)}}class ke extends ne{constructor(){super(),this.title="鼠标移入事件",this.color="#A55906",this.length=3,this.catchWord=new m.Z,this.addInput("绑定事件","event",{}),this.addInput("输入模型","models",{}),this.addInput("输入运行事件","string-event",{}),this.addOutput("触发时执行","event",{}),this.addOutput("输出触发模型","models",{createData:e=>({type:"models",data:this.triggerModel?[this.triggerModel]:[]})}),this.addOutput("输出名称","string",{createData:()=>{var e;return{type:"string",data:null==(e=(this.triggerModel?[this.triggerModel]:[])[0])?void 0:e.name}}}),this.buttonWidget=super._addWidget("button","添加输入事件",null,(()=>{this.addInput("输入运行事件","string-event",{})}))}onPlay(e,t){var n=this.getData("输入模型",{parms:t});if(n){t.wordMap&&this.catchWord.copy(t.wordMap);const e=n.data;e&&0!==e.length&&(Ze.onRun({modelsDatas:e.map((e=>({model:e,data:e=>{this.triggerModel=e.model,this.runData.runState=!0,this.catchWord.size&&(this.runData.wordMap||(this.runData.wordMap=new m.Z),this.runData.wordMap.copy(this.catchWord)),this.exec(this.runData)}}))),type:"graph-fn",runScene:this.runScene,execType:this.eventName}),this.inputs.map(((t,n)=>{if("输入运行事件"===t.name){const t=this.inputs[n],r=this.getInputNode(n);r&&e.map((e=>{var n,i=r.creatOutData(t.link,{model:e});i&&(({type:i,data:n}=i),Ze.onRun({modelsDatas:[{model:e,data:n}],type:i,runScene:this.runScene,execType:this.eventName}))}))}})))}}onStop(){this.catchWord.clear(),Ze.onStop(),fe.resetData(this.runData)}}ke.title="鼠标移入事件",ke.title_text_color="rgba(255, 255, 255, 0.6)";class Oe extends ke{constructor(){super(...arguments),this.eventName="click",this.title="点击事件"}}Oe.title="点击事件";class Ae extends ke{constructor(){super(...arguments),this.eventName="hover",this.title="鼠标移入事件"}}Ae.title="鼠标移入事件";class Ce extends ke{constructor(){super(...arguments),this.eventName="mouseLeave",this.title="鼠标移出事件"}}Ce.title="鼠标移出事件";class Ne extends Z{constructor(){super(),this.title="鼠标滚动",this.onAfterAdded=()=>{this.runScene.assetsEx.engineDom.addEventListener("wheel",this.onWheel)},this.playing=!1,this.onWheel=()=>{this.playing&&this.exec(this.parms)},this.onPlay=(e,t)=>{this.parms=t,this.playing=!0},this.addInput("执行","event",{}),this.addOutput("滚动触发","event",{})}onStop(e){this.playing=!1}}Ne.title="鼠标滚动";class Le extends Z{constructor(){super(),this.title="绑定事件",this.addWidget({type:"text",label:"事件名称",key:"name",value:""}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}}Le.title="绑定事件";class Ie extends Z{constructor(){super(),this.title="事件触发",this.onPlay=(e,t)=>{},this.addWidget({type:"text",label:"事件名称",key:"name",value:""}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}}Ie.title="事件触发";var Re=n(6282);const Ue=Object.assign(Object.assign({Group:"空组",Box:"立方体",Plane:"片",Sphere:"球",Sprite:"精灵图",Reflector:"反射",VerticesRain:"雨雪粒子",Water:"水",BasicMaterial:"基础材质",FakeInterior:"假室内",Fresnel:"菲涅尔",Physical:"物理材质",Matcap:"材质捕获",TreeLeaf:"树材质",Weather:"雨雪材质",MixTexture:"多层贴图材质",AmbientLight:"环境光",RectAreaLight:"矩形光",DirectionalLight:"平行光",HemisphereLight:"半球光",PointLight:"点光源",SpotLight:"聚光灯",GroundProjected:"地面投影",NoToneMapping:"无色调映射",LinearToneMapping:"线性色调映射",ReinhardToneMapping:"Reinhard色调映射",CineonToneMapping:"cineon色调映射",ACESFilmicToneMapping:"ACES电影色调映射",CustomToneMapping:"自定义色调映射",def:"默认色彩空间",srgb:"标准色彩空间",SpriteMaterial:"精灵材质",SkyBox:"天空球材质","2DDom":"2D文档模型","3DSprite":"3D精灵模型","3DDom":"3D文档模型",MyMeshPhongMaterial:"光亮材质",MeshPhongMaterial:"光亮材质",MeshLambertMaterial:"Lambert材质",MyMeshLambertMaterial:"Lambert材质",camera:"摄像机",light:"灯光",model:"模型",material:"材质",scene:"场景",sky:"天空",texture:"贴图",line:"线",sprite:"精灵图",lock:"锁定",dynamic:"动态",mesh:"模型",group:"组","time-line":"时间线",rotation:"旋转",position:"位移",scale:"缩放",visible:"显/隐",glow:"辉光",outline:"外边框",repeat:"重复",opacity:"透明度",color:"颜色",speed:"速度",alpha:"透明度",start:"开始",end:"结束",normal:"法线"},Re.cs),{hover:"鼠标移入",click:"点击",mouseLeave:"鼠标移出"}),Be={},Fe=((0,a.mapObj)(Ue,((e,t)=>{Be[t]=e})),e=>Ue[e]||e),je=e=>e.map((e=>Ue[e]||e)),ze=e=>Be[e]||e;class Ve extends Z{constructor(){super(),this.title="切换锁定",this.types=je(["hover","click","mouseLeave"]),this.addWidget({type:"combo",label:"事件名称",key:"type",value:this.types[0],options:{values:this.types}}),this.addWidget({type:"toggle",label:"锁定状态",key:"lock",value:!1,options:{on:"锁定",off:"解锁"}}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}onPlay(e,t){this.runScene.events.model.setEventState(ze(this.getWidgetValue("type")),!this.getWidgetValue("lock")),this.exec(t)}}Ve.title="切换锁定";class He extends Z{constructor(){super(),this.title="随机事件",this.addInput("执行","event",{}),this.addOutput("触发事件1","event",{}),this.buttonWidget=super._addWidget("button","添加事件",null,(()=>{this.addInput("执行"+(this.outputs.length+1),"event",{}),this.addOutput("触发事件"+(this.outputs.length+1),"event",{})}))}onPlay(e,t){var n=this.outputs.length,r=Math.random();r=Math.ceil(r/(1/n))-1,this.parms=t,n<1+r||this.triggerSlot(r,t)}}He.title="随机事件";class We extends Z{constructor(){super(),this.title="模型移除选中事件",this.color="#A55906",this.onAfterAdded=()=>{this.runScene.cb.model.unFocus.on((e=>{this.graph.ins.getRunState()&&(this.catchModel=e,this.execNext(fe.getRunData(this)))}))},this.addOutput("触发","event",{}),this.addOutput("输出模型","models",{createData:()=>({type:"models",data:this.catchModel?[this.catchModel]:[]})}),this.addOutput("输出模型名称","string",{createData:()=>{var e;return{type:"string",data:null==(e=(this.catchModel?[this.catchModel]:[])[0])?void 0:e.name}}})}execNext(e){this.triggerSlot(0,e)}}We.title="模型移除选中事件";class Ge extends Z{constructor(){super(),this.title="模型选中事件",this.color="#A55906",this.onAfterAdded=()=>{this.runScene.cb.model.setSelect.on((e=>{e&&this.graph.ins.getRunState()&&(this.catchModel=e,this.execNext(fe.getRunData(this)))}))},this.addOutput("触发","event",{}),this.addOutput("输出模型","models",{createData:()=>({type:"models",data:this.catchModel?[this.catchModel]:[]})}),this.addOutput("输出模型名称","string",{createData:()=>{var e;return{type:"string",data:null==(e=(this.catchModel?[this.catchModel]:[])[0])?void 0:e.name}}})}execNext(e){this.triggerSlot(0,e)}}Ge.title="模型选中事件";class Ke extends Z{constructor(){super(),this.title="事件组",this.addWidget({type:"text",label:"事件组名称",key:"name",value:"",options:{}}),this.addInput("执行","event",{}),this.addOutput("触发事件1","event",{}),this.buttonWidget=super._addWidget("button","添加事件",null,(()=>{this.addInput("执行"+(this.outputs.length+1),"event",{}),this.addOutput("触发事件"+(this.outputs.length+1),"event",{})}))}onPlay(e,t){this.exec(t)}}Ke.title="事件组";class Ze{constructor(){this.onInited=e=>{e.runScene.cb.events.model.addOptions.cb({name:"graph-fn",map:{parse:e=>Promise.all(e.childs.map((t=>{t(e)})))}})}}triggerCustom(e){e.registerNodeType("事件/点击",Oe),e.registerNodeType("事件/鼠标移入",Ae),e.registerNodeType("事件/鼠标移出",Ce),e.registerNodeType("事件/鼠标滚动",Ne),e.registerNodeType("事件/事件组",Ke),e.registerNodeType("事件/随机事件",He),e.registerNodeType("事件/绑定",Le),e.registerNodeType("事件/触发",Ie),e.registerNodeType("事件/切换锁定",Ve),e.registerNodeType("事件/移除选中模型",We),e.registerNodeType("事件/选中模型",Ge),e.runScene.cb.inited.add("graph-event",(()=>{this.onInited(e)}))}static onRunParse(e,t){const{modelsDatas:n,type:r,runScene:i,execType:a}=e;n.map((({model:e,data:n})=>{"snapshot-event"===r?i.events.model[t?"set":"del"]({model:e,type:"snapshot",method:a,child:n}):"timeline-event"===r?i.events.model[t?"set":"del"]({model:e,type:"timeline",method:a,child:n}):"set-material-event"===r?i.events.model[t?"set":"del"]({model:e,type:"setMaterial",method:a,child:n}):"set-pp-event"===r?i.events.model[t?"set":"del"]({model:e,type:"setPp",method:a,child:n}):"set-model-event"===r?i.events.model[t?"set":"del"]({model:e,type:"setModel",method:a,child:n}):"graph-fn"===r&&i.events.model[t?"set":"del"]({model:e,type:"graph-fn",method:a,child:n})}))}static onRun(e){this.map.push(e),this.onRunParse(e,!0)}static onStop(){this.map.map((e=>this.onRunParse(e,!1))),this.map=[]}}Ze.map=[];class qe extends Z{constructor(){super(),this.title="运行帧动画",this.config=[{name:"循环",key:"loop",value:!1},{name:"末帧",key:"lastFrame",value:!1}],this.playData=void 0,this.isPromiseNode=!0,this.addWidget({type:"text",label:"动画名称",key:"name",value:""}),this.config.map((e=>{this.addWidget({type:"toggle",label:e.name,key:e.key,value:e.value,options:{on:"打开",off:"关闭"},set(t){e.value=t}})})),this.addInput("输入模型","models",{}),this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{})}onPlay(e,t){if("执行"===e){var n=this.getData("输入模型",{parms:t});if(!n)return[];if(n=n.data[0]){var r=this.widgetsMap.name.value;if(0!==r.length){this.playData={model:n,name:r};const e={};this.config[0].value?this.exec(t):e.onBeforeEnd=()=>{this.exec(t)},this.config.map((t=>{e[t.key]=t.value})),this.runScene.anima.play(n,r,e)}}}else"关闭"===e&&this.onStop()}onConfigure(){this.config[0].value=this.properties.loop,this.config[1].value=this.properties.lastFrame}onStop(){this.playData&&(this.runScene.anima.close(this.playData.model,this.playData.name||"",{lastFrame:!1,resetAction:!0}),this.runScene.anima.resetItemByName(this.playData.model,this.playData.name),this.playData=void 0)}}qe.title="运行帧动画";class Xe{triggerCustom(e){e.registerNodeType("帧动画/运行",qe)}}var Ye=n(2233);class Qe extends Z{constructor(){super(),this.title="修改材质",this.onPlay=(e,t)=>{this.triggerSlot(1,t),this.triggerSlot(2,t);const n=this.getData("输入模型",{parms:t}),r=this.runScene.uniqueEx.material.getByName(this.widgetsMap.name.value);n&&"models"===n.type&&r&&n.data.map((e=>{this.runScene.materialEx.resetMaterial(e,r,{addUndo:!1})})),this.exec(t)},this.addWidget({type:"text",label:"名称",key:"name",value:""}),this.addInput("输入模型","models",{}),this.addOutput("输出模型","models",{createData:e=>this.getData("输入模型",e)}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addOutput("输出修改前事件","string-event",{createData:({model:e})=>({type:"set-material-event",data:{type:"material-id",data:(0,Ye.Ki)(e.material)}})}),this.addOutput("输出修改后事件","string-event",{createData:()=>({type:"set-material-event",data:{type:"material-name",data:this.widgetsMap.name.value}})})}}Qe.title="修改材质";const Je=["BasicMaterial","SpriteMaterial","FakeInterior","Reflector","Fresnel","Physical","Matcap","TreeLeaf","Weather","MixTexture","SkyBox","MeshPhongMaterial","MyMeshLambertMaterial","MeshReflectorMaterial"];var $e=n(7013),et=n(135);class tt extends Z{constructor(){super(),this.title="修改材质类型",this.onPlay=(e,t)=>{const n=this.getData("输入模型",{parms:t});if(n&&"models"===n.type){const e=ze(this.getWidgetValue("type",t)),r={},i=(n.data.map((e=>{if(e.material&&(0,Ye.Ki)(e.material)){let t=r[(0,Ye.Ki)(e.material)];(t=t||(r[(0,Ye.Ki)(e.material)]={models:[],material:e.material})).models.push(e)}})),[]);(0,a.mapObj)(r,((t,n)=>{const{models:r,material:a}=n,s=$e.ZP.create(e,this.runScene);(0,et.mergeMaterialAll)(a,s),r.map((e=>{var t=e.material;this.runScene.uniqueEx.material.add(s,e,t),(t=this.runScene.materialEx.resetMaterial(e,s,{addUndo:!1}))&&i.push(...t)})),this.runScene.undoEx.addUndo(i)})),this.exec(t)}},this.addWidget({type:"combo",label:"类型",key:"type",value:Fe("BasicMaterial"),options:{values:je(Je)}}),this.addInput("输入模型","models",{}),this.addOutput("输出模型","models",{createData:e=>this.getData("输入模型",e)}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}}tt.title="修改材质类型";class nt{triggerCustom(e){e.registerNodeType("材质/修改",Qe),e.registerNodeType("材质/修改类型",tt)}}class rt extends Z{constructor(){super(...arguments),this.title="模型",this.color="rgb(6,91,165)"}}class it extends rt{constructor(){super(),this.title="获取标签模型",this.getNameValue=()=>{var e=(null==(e=null==this?void 0:this.graph)?void 0:e.runScene.tags.map.toArray("key"))||[];return this.widgetsMap.name.value||this.setValue("name",e[0]),e},this.setNameValue=e=>{this.setValue("名称",e)},this.onPlay=(e,t)=>{var n=this.getDataByType("输入标签名称","string",{parms:t})||this.widgetsMap.name.value;if(this.keepMessageShow(n),!(n=this.runScene.tags.map.get(n)))return this.runScene.optionsEx.log("暂无模型");this.triggerSlot(0,t)},this.addWidget({type:"combo",label:"标签名称",key:"name",get:this.getNameValue}),this.addInput("输入标签名称","string",{}),this.addOutput("输出模型","models",{createData:e=>{e=this.getDataByType("输入标签名称","string",e)||this.widgetsMap.name.value,console.log("Log-- ",e,"tagsName");const t=this.runScene.tags.map.get(e);return console.log("Log-- ",t,"modelIds"),this.keepMessageShow(e),t?(e=this.runScene.modelEx.getById(t.toArray()),console.log("Log-- ",e,"models"),{type:"models",data:e}):{type:"models",data:[]}}})}}it.title="获取标签模型";class at extends rt{constructor(){super(),this.title="获取选中模型",this.addOutput("输出模型","models",{createData:()=>({type:"models",data:G.F6.filter(this.widgets.map((e=>{var t=this.runScene.modelEx.getModel(e.value);return t||this.delValue(e.key),t})))})}),this.addbutton(),this.setSize()}addbutton(){this._addWidget("button","重新获取","",(()=>{this.widgets=[],this.properties={},this.addbutton(),this.createByModels()}))}createByModels(e=this.runScene.modelEx.getSelectedModels()){if(at.onCreateByModels)return at.onCreateByModels(this);e.map(((e,t)=>{e=e.name||e.type;var n=this.createWidgetKey("model"+t);this.addWidget({type:"text",label:"模型"+(t+1),key:n,value:e}),this.setValue(n,e)}))}setSize(){this.setGraphSize(200,Math.max(24*this.widgets.length)+60)}createWidgetByForSavedKey(e,t){this.findWidget(e)||this.addWidget({type:"text",label:"模型"+(this.widgets.length+1),key:e,value:t})}}at.title="获取选中模型";class st extends rt{constructor(){super(),this.title="显示模型列表",this.onDrawForeground=e=>{e.fillStyle=this.properties.color;var t=this.properties.value,n=(this.properties.glowSize?(e.shadowColor=this.properties.color,e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=this.properties.glowSize):e.shadowColor="transparent",this.properties.fontsize);if(e.textAlign=this.properties.align,e.font=n.toString()+"px "+this.properties.font,this.str="number"==typeof t?t.toFixed(this.properties.decimals):t,"string"==typeof this.str)for(var r=this.str.replace(/[\r\n]/g,"\\n").split("\\n"),i=0;i<r.length;i++)e.fillText(r[i],"left"==this.properties.align?15:this.size[0]-25,30+25*(i+1),this.size[0]);e.shadowColor="transparent",(this.last_ctx=e).textAlign="center"},this.properties={value:"",font:"Arial",fontsize:15,color:"#AAA",align:"left",glowSize:0,decimals:1},this.addInput("输入模型","models",{onLink:e=>{const{target:t,slot:n}=e;e=t.outputs[n];const r=t.creatOutDataByNode(e);r&&(this.properties.value="",r.data.map((e=>{this.properties.value+=e.name+"\n"})),this.baseHeight=Math.max(30*r.data.length,25)+10,this.autoSize())}}),this.autoSize()}onPropertyChanged(e,t){"value"===e&&(e=t.replace(/[\r\n]/g,"\\n").split("\\n"),this.baseHeight=Math.max(30*e.length,30)+10)}}st.title="显示模型列表";var ot=n(874),lt=n(9663);class ut extends rt{constructor(){super(),this.title="帧向量动画",this.keys=["x","y","z"],this.types=["position","rotation","scale"],this.modelsMap=new m.Z,this.playState=!1,this.onAfterAdded=()=>{this.runScene.cb.scene.validCloseUpdate.on((()=>!this.playState))},this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addWidget({type:"combo",label:"向量名称",key:"type",value:"",options:{values:this.types}}),this.keys.map((e=>{this.addWidget({type:"number",label:e,value:0,key:e,options:{step:.1}})})),this.addInput("输入模型","models",{})}onPlay(e,t){if("关闭"===e)this.onStop();else{const e=this.getData("输入模型",{parms:t});if(e&&0!==e.data.length){e.data.map((e=>{const t={};this.types.map((n=>{t[n]=(0,lt.ln)(e[n])})),this.modelsMap.set(e.name,{model:e,data:t})})),this.playState=!0,this.runScene.setUpdate();const t=this.keys.filter((e=>0!==this.widgetsMap[e].value)),n=this.widgetsMap.type.value;this.runScene.cb.render.add("model-vector_"+this.id,(()=>{e.data.map((e=>{const r=e[n];t.map((e=>{var t=(0,ot.le)(this.widgetsMap[e].value,0);0!==t&&(r[e]+=t)}))}))}))}}}onStop(){this.runScene.cb.render.delete("model-vector_"+this.id),this.modelsMap.map(((e,t)=>{const{model:n,data:r}=t;this.types.map((e=>{var t,i,a=r[e];a&&(({x:a,y:t,z:i}=a),n[e].set(a,t,i))}))})),this.modelsMap.clear(),this.playState=!1,this.runScene.setUpdate(!1)}}ut.title="帧向量动画";class ct extends rt{constructor(){super(),this.title="设置模型向量",this.keys=["x","y","z"],this.types=["position","rotation","scale"],this.modelsMap=new m.Z,this.playState=!1,this.onAfterAdded=()=>{this.runScene.cb.scene.validCloseUpdate.on((()=>!this.playState))},this.animaIns=null,this.catchModels=[],this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{}),this.addOutput("输出模型","models",{createData:()=>({type:"models",data:this.catchModels,subData:{modelVectorData:this.modelsMap}})}),this.addInput("输入模型","models",{}),this.addInput("输入数据","map",{}),this.addWidget({type:"combo",label:"向量名称",key:"type",value:"",options:{values:this.types}}),this.keys.map((e=>{this.addWidget({type:"toggle",label:"设置"+e+"轴",key:"enable"+e,value:!0}),this.addWidget({type:"number",label:e,value:0,key:e,options:{step:.1}})})),this.addWidget({type:"text",label:"时间",key:"time",value:1})}onPlay(e,t){if("关闭"===e)this.onStop();else{e={parms:t};const n=this.getDataByType("输入数据","map",e),r=this.getData("输入模型",e);if(r&&0!==r.data.length){this.onStop();const i={},a={},s=this.getWidgetValue("type",t)||"position";this.catchModels=r.data.map(((e,o)=>{var l;const u={},c=null==n?void 0:n[(0,Ye.Ki)(e)],d=e[s];return u[s]=(0,lt.ln)(d),this.keys.filter((e=>this.getWidgetValue("enable"+e,t))).map((e=>{var n=null==(n=null==c?void 0:c[s])?void 0:n[e],r=e+"_"+o,l=d[e];let u=(0,b.Ft)(n)?this.getWidgetValue(e,t)||0:n;l!==(u="rotation"===s?(0,lt.b3)(u):u)&&(i[r]=l,a[r]=u)})),null!=(l=r.subData)&&l.modelVectorData||this.modelsMap.set(e.name,{model:e,data:u}),e})),this.playState=!0,this.runScene.setUpdate(),0===Object.keys(i).length?this.exec(t):0===(e=this.getWidgetValue("time",t))?(this._setAnima(a,s),this.exec(t)):this.animaIns=(0,b.gY)(i,a,(0,ot.le)(e,1),(e=>{this.playState&&this._setAnima(e,s)}),(()=>{this.exec(t),this.playState=!1}))}}}_setAnima(e,t){(0,a.mapObj)(e,((e,n)=>{var[e,r]=e.split("_");const i=this.catchModels[r];i&&(i[t][e]=n)}))}onStop(){var e;null!=(e=this.animaIns)&&e.kill(),this.runScene.setUpdate(),this.modelsMap.map(((e,t)=>{const{model:n,data:r}=t;this.types.map((e=>{var t,i,a=r[e];a&&(({x:a,y:t,z:i}=a),n[e].set(a,t,i),"instanceHelper"===n.type&&n.update())}))})),this.catchModels=[],this.modelsMap.clear(),this.playState=!1,this.runScene.setUpdate(!1)}}ct.title="设置模型向量";class dt extends rt{constructor(){super(),this.title="设置单轴模型向量",this.keys=["x","y","z"],this.types=["position","rotation","scale"],this.modelsMap=new m.Z,this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addWidget({type:"combo",label:"向量名称",key:"type",value:"",options:{values:this.types}}),this.addWidget({type:"combo",label:"轴名称",key:"subType",value:"",options:{values:this.keys}}),this.addWidget({type:"number",label:"数值",key:"number",value:0}),this.addInput("输入模型","models",{})}onPlay(e,t){const n=this.getData("输入模型",{parms:t});n.data.length&&n.data.map((e=>{let n=this.getWidgetValue("number",t);var r=this.getWidgetValue("type",t)||"position";"rotation"===r&&(n=(0,lt.b3)(n)),e[r][this.getWidgetValue("subType",t)||"x"]=n})),this.exec(t)}}dt.title="设置单轴模型向量";class ht extends rt{constructor(){super(),this.title="修改父元素",this.models=[],this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入父模型","models",{}),this.addInput("输入模型","models",{}),this.addOutput("输出修改后模型","models",{createData:()=>({type:"models",data:this.models})})}onPlay(e,t){if(this.models=[],"执行"===e){const e=this.getData("输入模型",{parms:t}),n=this.getData("输入父模型",{parms:t});if(!e||!n)return;const r=[];e.data.map(((e,t)=>{(t=n.data[t])&&(e.parent?r.push(this.runScene.modelEx.setParent(e,t,!1)):r.push(...G.F6.toArr(this.runScene.modelEx.add(e,t))),this.models.push(e))})),this.runScene.undoEx.addUndo(r)}this.exec(t)}}ht.title="修改父元素";class pt extends rt{constructor(){super(),this.title="获取父模型",this.addInput("输入模型","models",{}),this.addOutput("输出父模型","models",{createData:e=>{const t=this.getData("输入模型",e),n=[];return null!=t&&t.data.map((e=>{n.push(e.parent)})),{type:"models",data:n}}})}}pt.title="获取父模型";class ft extends rt{constructor(){super(),this.title="从文本获取模型",this.addWidget({type:"text",label:"名称",key:"name"}),this.addInput("输入名称","string",{}),this.addOutput("输出模型","models",{createData:e=>{e=this.getDataByType("输入名称","string",e)||this.getWidgetValue("name",e.parms);var t=this.runScene.modelEx.getModel(e);return this.keepMessageShow(`模型名称=${e};是否存在=`+!(0,u.isNull)(t)),{type:"models",data:t?[t]:[]}}})}onPlay(e,t){var n;t.outData&&(({data:t,type:n}=t.outData),"string"===n&&(this.inputName=t))}}ft.title="从文本获取模型";var mt=n(3975);class gt extends rt{constructor(){super(),this.title="生成模型",this.addWidget({type:"combo",label:"类型",key:"type",options:{values:[...mt.c6]}}),this.addWidget({type:"toggle",label:"前缀",key:"prefix",options:{on:"输入名称为前缀",off:"无前缀"}}),this.addWidget({type:"text",label:"命名",key:"back"}),this.addWidget({type:"toggle",label:"坐标",key:"local",options:{on:"使用输入模型坐标",off:"默认坐标"}}),this.addInput("输入模型","models",{}),this.addOutput("输出生成的模型","models",{createData:e=>({type:"models",data:this.createModels(e)})})}getModel(){var e=this.widgetsMap.type.value;if(e)return this.runScene.modelEx.def.create(e)}createModels(e){const t=[],n=this.getData("输入模型",e);if(n)n.data.map((e=>{const n=this.getModel();var r;n&&(r=e.name,this.widgetsMap.prefix.value&&(n.name=r+this.widgetsMap.back.value,this.widgetsMap.local.value&&n.position.set(e.position.x,e.position.y,e.position.z),t.push(n)))}));else{const e=this.getModel();if(!e)return;e.name=this.widgetsMap.back.value,t.push(e)}return t}}gt.title="生成模型";class vt extends rt{constructor(){super(),this.title="获取缓存模型向量",this.addOutput("获取缓存","map",{createData:()=>({type:"map",data:vt.modelsMap})})}onStop(){vt.modelsMap={}}}vt.title="获取缓存模型向量",vt.modelsMap={};class yt extends rt{constructor(){super(),this.title="缓存模型向量",this.types=["position","rotation","scale"],this.catchMap={},this.addInput("缓存","event",{}),this.addOutput("缓存完毕","event",{}),this.addOutput("输出模型","models",{createData:e=>this.getData("输入模型",e)}),this.addOutput("输出缓存","map",{createData:()=>({type:"map",data:this.catchMap})}),this.addInput("输入模型","models",{})}onPlay(e,t){var n=this.getDataByType("输入模型","models",{parms:t});if(Array.isArray(n)&&n[0]){const e=n[0],t={};lt.xt.map((n=>{t[n]=(0,lt.ln)(e[n])})),this.catchMap[(0,Ye.Ki)(e)]=t,vt.modelsMap[(0,Ye.Ki)(e)]=t}this.exec(t)}onStop(){this.catchMap={}}}yt.title="缓存模型向量";class bt extends rt{constructor(){super(),this.title="加入场景",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入模型","models",{})}onPlay(e,t){if("执行"===e){const e=this.getData("输入模型",{parms:t});if(!e)return;const n=[];e.data.map((e=>{e.parent?n.push(this.runScene.modelEx.setParent(e,this.runScene.assetsEx.get().scene,!1)):n.push(...G.F6.toArr(this.runScene.modelEx.add(e,this.runScene.assetsEx.get().scene)))})),this.runScene.undoEx.addUndo(n)}this.exec(t)}}bt.title="加入场景";class xt extends rt{constructor(){super(),this.title="克隆模型",this.addWidget({type:"text",label:"模型名称",key:"name",value:""}),this.addWidget({type:"toggle",label:"前缀",key:"prefix",options:{on:"输入名称为前缀",off:"无前缀"}}),this.addWidget({type:"text",label:"命名",key:"back"}),this.addWidget({type:"toggle",label:"坐标",key:"local",options:{on:"使用输入模型坐标",off:"默认坐标"}}),this.addInput("输入模型","models",{}),this.addOutput("输出模型","models",{createData:e=>{const t=this.runScene.modelEx.getModel(this.widgetsMap.name.value);if(t){const n=this.getData("输入模型",e);if(n){const e=[];return n.data.map((n=>{const r=this.runScene.modelEx.clone(t,!1);var i;r&&(i=n.name,this.widgetsMap.prefix.value&&(r.name=i+this.widgetsMap.back.value,this.widgetsMap.local.value&&r.position.set(n.position.x,n.position.y,n.position.z),e.push(r)))})),{type:"models",data:e}}}}})}}xt.title="克隆模型";class wt extends rt{constructor(){super(),this.title="移除模型",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入模型","models",{})}onPlay(e,t){if("执行"===e){if(!(e=this.getData("输入模型",{parms:t})))return;this.runScene.modelEx.remove(e.data,!0)}this.exec(t)}}wt.title="移除模型";class St extends rt{constructor(){super(),this.title="选中模型",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入模型","models",{})}onPlay(e,t){if("执行"===e){if(!(e=this.getData("输入模型",{parms:t})))return;this.runScene.modelEx.select&&this.runScene.modelEx.selectNull(),this.runScene.multipSelector.clearAfterAdd(e.data,!1,!0)}this.exec(t)}}St.title="选中模型";class _t extends rt{constructor(){super(),this.title="切换模型属性",this.theButton=null,this.names=[{name:"显示/隐藏",label:"visible"},{name:"辉光",label:"glow"},{name:"轮廓光",label:"outline"}],this.onPlay=(e,t)=>{var n,r=this.getData("输入被修改模型",{parms:t});r&&(null!=(n=r.data)&&n.map((e=>{this.runScene.modelEx.setGlow(e,!!this.widgetsMap.glow.value),this.runScene.modelEx.setOutline(e,!!this.widgetsMap.outline.value)})),console.log("Log-- ",r.data,"model.data",this,this.widgetsMap.visible.value),this.runScene.modelEx.setNormal({model:r.data||[],info:"visible",val:!!this.widgetsMap.visible.value},!1)),this.exec(t)},this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.names.map((({name:e,label:t})=>{this.addWidget({type:"toggle",label:e,key:t,value:!1,set:e=>{this.widgetsMap[t].value=e},options:{on:"开启功能",off:"关闭功能"}})})),this.addInput("输入被修改模型","models",{}),this.addOutput("输出模型","models",{createData:e=>this.getData("输入被修改模型",e)}),this.addOutput("输出事件","string-event",{createData:e=>{const t={modelIds:[],data:{}},n=this.getData("输入被修改模型",e);if("models"===(null==n?void 0:n.type)&&0!==(null==n?void 0:n.data.length))return t.modelIds=n.data.map((e=>(0,Ye.Ki)(e))),this.widgets.map((e=>{e.value&&(t.data[e.options.property]="auto")})),{type:"set-model-event",data:t}}})}}_t.title="切换模型属性";class Tt extends rt{constructor(){super(),this.title="切换显示隐藏",this.theButton=null,this.onAfterAdded=()=>{const e=this.getData("输入模型");e&&0!==e.data.length&&(this.widgets=[],e.data.map((e=>{if(e){var t=e.name;const n=this.createWidgetKey(t);this.addWidget({type:"toggle",label:t,key:n,value:e.visible,set:e=>{this.widgetsMap[n].value=e},options:{on:"显示",off:"隐藏"}}),this.setValue(n,e.visible)}})))},this.onPlay=(e,t)=>{this.exec(t),this.triggerSlot(2,t);const n=this.getData("输入模型",{parms:t});n&&0!==n.data.length&&n.data.map((e=>{var t=this.properties[this.createWidgetKey(e.name)];void 0!==t&&this.runScene.modelEx.setNormal({model:e,info:"visible",val:t},!1)}))},this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入模型","models",{onAfterLink:()=>{this.onAfterAdded()}}),this.addOutput("输出模型","models",{createData:e=>this.getData("输入模型",e)}),this.addOutput("输出事件","string-event",{createData:e=>{const t={modelIds:[],data:{}},{type:n,data:r}=this.getData("输入模型",e)||{};if("models"===n&&0!==r.length)return t.modelIds=r.map((e=>(0,Ye.Ki)(e))),this.widgets.map((e=>{var n;e.value&&null!=(n=e.options)&&n.property&&(t.data[e.options.property]="auto")})),{type:"set-model-event",data:t}}})}createWidgetByForSavedKey(e,t){if(!this.findWidget(e)){const[,...n]=e.split("_");this.addWidget({type:"toggle",label:n.join("_"),key:e,value:t,set:t=>{this.widgetsMap[e].value=t},options:{on:"显示",off:"隐藏"}})}}}Tt.title="切换显示隐藏";class Mt extends rt{constructor(){super(),this.title="获取实时模型",this.addOutput("输出模型","models",{createData:()=>({type:"models",data:this.runScene.modelEx.getSelectedModels()})}),this.addOutput("输出选中模型名称","string",{createData:()=>{var e;return{type:"string",data:null==(e=this.runScene.modelEx.getSelectedModels()[0])?void 0:e.name}}})}}Mt.title="获取实时模型";var Et=n(272);class Dt extends rt{constructor(){super(),this.title="模型数据处理",this.isPromiseNode=!0,this.outMap={},this.createDate=e=>({type:"models",data:this.outMap[e]?this.runScene.modelEx.getModel(this.outMap[e].toArray()):[]}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入数据","request-data",{})}onPlay(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var e=yield this.getData("输入数据",{parms:t});t.runState&&(e&&(Array.isArray(e.data)?this.processData(e.data):Array.isArray(e.data.data)?this.processData(e.data.data):this.showError("数据不匹配")),this.exec(t))}))}processData(e){e.map((e=>{var{name:e,state:t}=e;const n="state:"+t;let r=this.outMap[n];r||(r=this.outMap[n]=new Et.Z,this.hasSubNode("out",n)?this.outPutMap[n]||(this.outPutMap[n]={createData:()=>this.createDate(n)}):this.addOutput(n,"models",{createData:()=>this.createDate(n)})),r.add(e)}))}}Dt.title="模型数据处理";var Pt=n(4230);class kt extends rt{constructor(){super(),this.title="线动画",this.savedData=new m.Z,this.models=[],this.percent=0,this.playing=!1,this.delayTriggerFn=()=>{this.playing&&this.bindAnima(!0)},this.onAnima=()=>{var e=this.widgetsMap.speed;e.value&&this.lineModel&&(this.percent+=e.value,e="正反向"===this.getWidgetValue("type",this.parms)?2:1,this.percent>=e?(this.exec(this.parms),this.onStop(),this.widgetsMap.loop.value&&this.onPlay("执行",this.parms)):(this.setWidgetValue("progress",this.percent/e*100),null!=(e=this.graph.ins._canvas)&&e.drawFrontCanvas(),this.setProgress(this.percent)))},this.runningNodeMap=new m.Z,this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入线模型","models",{}),this.addInput("输入动画模型","models",{}),this.addOutput("输出进度数值","number",{}),this.addWidget({type:"slider",key:"progress",label:"进度",value:0,options:{max:100,min:0},set:e=>{if(!this.playing){const t=e/100;1<t||this.setProgress(Number(t.toFixed(2)))}}}),this.addWidget({type:"number",key:"speed",label:"动画速度",value:.01}),this.addWidget({type:"combo",key:"type",label:"动画方向",options:{values:["正向","反向","正反向"]},value:"正向"}),this.addWidget({type:"toggle",key:"close",label:"闭合曲线",value:!1,set:()=>{this.onBeforePlay()}}),this.addWidget({type:"toggle",key:"world",label:"开启世界坐标",value:!1}),this.addWidget({type:"toggle",key:"loop",label:"开启循环",value:!1}),this.addWidget({type:"number",key:"delay",label:"延迟",value:1})}onPlay(e,t){this.onBeforePlay(t),this.parms=t,this.playing=!0,null!=(t=this.delayTrigger)&&t.call(this)}onBeforePlay(e){var t,n=this.getData("输入线模型",{parms:this.parms}),r=this.getData("输入动画模型",{parms:this.parms});0!==(null==n?void 0:n.data.length)&&0!==(null==r?void 0:r.data.length)&&(this.delayTrigger=(0,b.ZY)(this.delayTriggerFn,this.widgetsMap.delay.value||0),[n]=n.data,t=(0,lt.F)(n.geometry.attributes.position.array),t=(0,lt.kG)(t,{closed:this.widgetsMap.close.value}),this.lineModel=n,this.percent=0,this.curve=t.curve,this.models=r.data,this.models.map((e=>{this.savedData.set((0,Ye.Ki)(e),{position:e.position.clone(),rotation:e.rotation.clone()})})))}bindAnima(e){this.runScene.cb.render[e?"add":"delete"](this.getNodeName(),this.onAnima)}setProgress(e){this.lineModel||this.onBeforePlay();var t=this.getWidgetValue("type",this.parms);const n=this.findOutNodeByName("输出进度数值"),{speed:r,world:i}=(n&&n.map((t=>{t.onNumberChange(100*e,this.parms)})),this.widgetsMap),a=this.curve;let o,l,u=e,c="正向";if("正向"===t)c=t;else if("反向"===t)c=t;else if("正反向"===t)if(e<=1)c="正向";else{if(!(1<=e&&e<=2))return;c="反向",u=e-1}"正向"===c?(o=a.getPointAt(u).add(this.lineModel.getWorldPosition(new s.Vector3)),u+r.value<=1&&(l=a.getPointAt(u+r.value))):"反向"===c&&(o=a.getPointAt(1-u).add(this.lineModel.getWorldPosition(new s.Vector3)),0<1-u-r.value&&(l=a.getPointAt(1-u-r.value))),this.models.map((e=>{var t;i.value?(0,lt.$n)(e,o):e.position.copy(o),l&&((0,Pt.N)(e)?(t=this.runScene.modelEx.getSelectedModels()[0],e.lookAt(t?(0,lt.VU)(t,this.runScene.assetsEx.scene):this.runScene.assetsEx.controls.target)):e.lookAt(l))}))}onStop(){this.playing=!1,this.models.map((e=>{var t=this.savedData.get((0,Ye.Ki)(e));e.position.copy(t.position),e.rotation.copy(t.rotation)})),this.models=[],this.runScene.setUpdate(),this.savedData.clear(),this.bindAnima(!1)}}kt.title="线动画";class Ot extends rt{constructor(){super(),this.title="模型动画",this.frist={模型属性:{opts:["暂无"]},材质:{opts:["透明度"]}},this.models=[],this.fristKeys=Object.keys(this.frist),this.selectFn=this.fristKeys[0],this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addWidget({type:"combo",label:"主功能",key:"type",value:"",set:e=>{this.selectFn=e,this.widgetsMap.subType.options.values=this.frist[this.selectFn].opts},options:{values:this.fristKeys}}),this.addWidget({type:"combo",label:"子功能",key:"subType",value:"",options:{values:this.frist[this.selectFn].opts}}),this.addWidget({type:"number",label:"起始值",key:"begin",value:0}),this.addWidget({type:"number",label:"结束值",key:"end",value:1}),this.addWidget({type:"number",label:"动画时间",key:"time",value:1}),this.addInput("输入模型","models",{}),this.addOutput("输出模型","models",{createData:()=>({type:"models",data:this.models})})}onPlay(e,t){this.models=[];const n=this.getData("输入模型",{parms:t});if(n){this.models=n.data;var r=this.processAnima();if(r){const{begin:e,end:i,time:a,onUpdate:s}=r;return void(0,b.gY)(e,i,a,(e=>{s(e,n.data)}),(()=>{this.exec(t)}))}}this.exec(t)}onConfigure(e){var t;e&&(t=e.properties.type,(0,a.mapObj)(e.properties,((e,t)=>{this.setWidgetValue(e,t)})),t&&(this.selectFn=t))}processAnima(){var e=this.selectFn,t=this.getWidgetValue("subType",this.parms);if(e&&t){let n={begin:{},end:{},time:this.getWidgetValue("time",this.parms),onUpdate:()=>{}};return"材质"===e&&"透明度"===t&&(n.begin={opc:this.getWidgetValue("begin",this.parms)},n.end={opc:this.getWidgetValue("end",this.parms)},n.onUpdate=(e,t)=>{t.map((t=>{t.traverse((t=>{t.material&&(t.material.transparent||(t.material.transparent=!0),t.material.opacity=e.opc)}))}))}),n}}}Ot.title="模型动画";class At extends rt{constructor(){super(),this.title="模型距离相机位置",this.models=[],this.getTriggerMap=()=>({greater:!1,less:!1}),this.triggerMap=this.getTriggerMap(),this.addInput("执行","event",{}),this.addOutput("输出模型","models",{createData:()=>({type:"models",data:this.models})}),this.addWidget({type:"text",key:"distance",label:"触发距离",value:100}),this.addWidget({type:"text",key:"now",label:"当前距离",value:100}),this.addWidget({type:"toggle",key:"multi",label:"多次触发",value:!1,set:()=>{}}),this.addInput("输入模型","models",{}),this.addOutput("小于触发","event",{}),this.addOutput("大于触发","event",{})}onInputLink(){const e=this.getDistance();-1!==e&&this.setWidgetValue("now",e.toFixed(2))}onPlay(e,t){if(this.models=[],this.parms=t,"执行"===e){const r=this.getDistance();if(-1!==r){this.setWidgetValue("now",r.toFixed(2));let i=!1;r<=(0,ot.le)(this.getWidgetValue("distance",t),100)&&(i=!0),e=this.getWidgetValue("multi",t);let a=!1;var n=i?"less":"greater";(a=!(this.triggerMap[n]&&!e)||a)&&(this.triggerMap[n]=!0,this.triggerSlot(i?1:2,t))}}}onStop(e){this.triggerMap=this.getTriggerMap()}getDistance(){var e=this.getData("输入模型",{parms:this.parms});if(null==(t=null==e?void 0:e.data)||!t.length)return-1;this.models=[...e.data];var[t]=null==e?void 0:e.data;return(0,lt.Sp)(t.position,this.runScene.assetsEx.camera.position)}}At.title="模型距离相机位置";class Ct extends rt{constructor(){super(),this.title="插入新模型",this.clonedModel=[],this.addWidget({type:"combo",label:"插入位置",key:"local",value:"同级",options:{values:["同级","子级"]}}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入相关模型","models",{}),this.addInput("输入插入模型","models",{}),this.addOutput("输出新模型","models",{createData:()=>({type:"models",data:this.clonedModel})})}onPlay(e,t){var n=this.getData("输入插入模型",{parms:t});const r=this.getData("输入相关模型",{parms:t}),[i]=(null==n?void 0:n.data)||[];if(i&&0<(null==(n=null==r?void 0:r.data)?void 0:n.length)){const e=[],n=[];null!=r&&r.data.map((r=>{const a=this.runScene.modelEx.clone(i);n.push(a);var s=this.getWidgetValue("local",t),o="同级"===s?r.parent:r;"同级"===s&&a.position.copy(r.position),e.push(this.runScene.modelEx.add(a,o,{addUndo:!1,isClone:!0}))})),this.runScene.undoEx.addUndo(e),this.clonedModel=n}this.exec(t)}onStop(){this.clonedModel=[]}}Ct.title="插入新模型";class Nt extends rt{constructor(){super(),this.title="挨个执行",this.nowModel=void 0,this.catchModel=[],this.index=0,this.playing=!1,this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{}),this.addOutput("依次触发","event",{}),this.addOutput("输出当前模型","models",{createData:()=>{var e={type:"models",data:this.nowModel?[this.nowModel]:[]};return this.getWidgetValue("wait")||this.execNode(this.parms),e}}),this.addInput("输入模型","models",{}),this.addWidget({type:"toggle",label:"执行完毕触发",key:"wait",value:!0,options:{on:"开启",off:"关闭"}})}getModel(){return this.catchModel[this.index]}onPlay(e,t){var n;this.parms=t,"执行"===e?(this.playing=!0,this.index=0,(n=this.getData("输入模型",{parms:t}))&&(this.catchModel=n.data,this.execNode(t))):"关闭"===e&&this.onStop()}execNode(e){var t=null==(t=this.getOutputNodes(1))?void 0:t[0];if(this.nowModel=this.catchModel[this.index],this.index+=1,t&&this.nowModel){const t=fe.getRunData(this,{getDone:!0});t.runState=!0,this.getWidgetValue("wait")&&t.onDones.set(this.id,(()=>{this.playing&&this.execNode(e)})),this.triggerSlot(1,t)}else this.afterTrigger(e)}onStop(){this.playing=!1,this.catchModel=[],this.index=0}}Nt.title="挨个执行";class Lt extends rt{constructor(){super(),this.title="获取模型名称",this.addInput("输入模型","models",{}),this.addOutput("输出模型名称","string",{createData:e=>({type:"string",data:null==(e=null==(e=null==(e=this.getData("输入模型",e))?void 0:e.data)?void 0:e[0])?void 0:e.name})})}}Lt.title="获取模型名称";class It extends rt{constructor(){super(),this.title="搜索模型",this.onPlay=(e,t)=>{this.exec(t)},this.addWidget({type:"text",label:"包含文本",key:"name"}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入文本","string",{}),this.addOutput("输出模型","models",{createData:e=>(e=this.getDataByType("输入文本","string",e)||this.getWidgetValue("name",null==e?void 0:e.parms),console.log("Log-- ",e,"models"),e=this.runScene.sceneEx.searchModel(e),console.log("Log-- ",e,"models"),{type:"models",data:e})})}}It.title="搜索模型";class Rt{triggerOld(e){e.registerNodeType("模型/获取标签模型",it,!0),e.registerNodeType("模型/从文本获取模型",ft,!0),e.registerNodeType("模型/获取选中模型",at,!0),e.registerNodeType("模型/获取实时模型",Mt,!0),e.registerNodeType("模型/获取模型名称",Lt,!0),e.registerNodeType("模型/显示",st,!0),e.registerNodeType("模型/选中模型",St,!0),e.registerNodeType("模型/克隆模型",xt,!0),e.registerNodeType("模型/移除模型",wt,!0),e.registerNodeType("模型/生成模型",gt,!0),e.registerNodeType("模型/获取父元素",pt,!0),e.registerNodeType("模型/修改父元素",ht,!0),e.registerNodeType("模型/加入场景",bt,!0),e.registerNodeType("模型/向量/动画",ut,!0),e.registerNodeType("模型/向量/设置",ct,!0),e.registerNodeType("模型/向量/设置单轴",dt,!0),e.registerNodeType("模型/切换属性",_t,!0),e.registerNodeType("模型/切换显示隐藏",Tt,!0),e.registerNodeType("模型/数据处理",Dt,!0),e.registerNodeType("模型/线动画",kt,!0),e.registerNodeType("模型/模型动画",Ot,!0),e.registerNodeType("模型/相机距离",At,!0),e.registerNodeType("模型/从旧模型插入新模型",Ct,!0),e.registerNodeType("模型/挨个执行",Nt,!0)}triggerCustom(e){this.triggerOld(e),e.registerNodeType("模型/获取/获取标签模型",it),e.registerNodeType("模型/获取/从文本获取模型",ft),e.registerNodeType("模型/获取/获取选中模型",at),e.registerNodeType("模型/获取/获取实时模型",Mt),e.registerNodeType("模型/获取/获取模型名称",Lt),e.registerNodeType("模型/获取/搜索模型",It),e.registerNodeType("模型/获取/获取父元素",pt),e.registerNodeType("模型/修改/修改父元素",ht),e.registerNodeType("模型/修改/修改属性",_t),e.registerNodeType("模型/修改/修改显示隐藏",Tt),e.registerNodeType("模型/添加/加入场景",bt),e.registerNodeType("模型/添加/从旧模型插入新模型",Ct),e.registerNodeType("模型/显示",st),e.registerNodeType("模型/设置选中",St),e.registerNodeType("模型/克隆",xt),e.registerNodeType("模型/移除",wt),e.registerNodeType("模型/生成",gt),e.LiteGraph.NODE_NAME_MAP["模型/向量动画"]="模型/向量/动画",e.LiteGraph.NODE_NAME_MAP["模型/设置模型向量"]="模型/向量/设置",e.registerNodeType("模型/向量/向量动画",ut),e.registerNodeType("模型/向量/设置向量",ct),e.registerNodeType("模型/向量/设置单轴向量",dt),e.registerNodeType("模型/向量/缓存模型向量",yt),e.registerNodeType("模型/向量/获取缓存模型向量",vt),e.registerNodeType("模型/数据处理",Dt),e.registerNodeType("模型/线动画",kt),e.registerNodeType("模型/模型动画",Ot),e.registerNodeType("模型/相机距离",At),e.registerNodeType("模型/挨个执行",Nt)}}class Ut extends Z{constructor(){super(),this.title="添加到队列",this.getValues=()=>{const e=this.graph.findNodesByType("队列/生成队列");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.onPlay=(e,t)=>{const n=this.graph.findNodesByType("队列/生成队列").find((e=>e.widgetsMap.name.value===this.widgetsMap.name.value));n&&n.onAddToDataList({key:"队列",data:this,parms:t,opts:{isTop:this.getWidgetValue("frist",t)}})},this.addWidget({type:"combo",label:"队列名称",key:"name",get:this.getValues}),this.addWidget({type:"toggle",label:"添加到队首",key:"frist",value:!1}),this.addInput("执行","event",{}),this.addOutput("需要进入队列的节点","event",{})}}Ut.title="添加到队列";class Bt extends Z{constructor(){super(),this.title="打断队列",this.getValues=()=>{const e=this.graph.findNodesByType("队列/生成队列");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.onPlay=(e,t)=>{const n=this.graph.findNodesByType("队列/生成队列"),[r]=G.F6.filter(n.map((e=>e.widgetsMap.name.value===this.getWidgetValue("name",t)?e:null)));r&&r.break(),this.exec(t)},this.addWidget({type:"combo",label:"队列名称",key:"name",get:this.getValues}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}}Bt.title="打断队列";class Ft extends Z{constructor(){super(),this.title="队列",this.index=0,this.execed=!1,this.execAfterTrigger=!1,this.addWidget({type:"text",label:"队列名称",key:"name",value:""}),this.addInput("执行队列","event",{}),this.addInput("清除队列","event",{}),this.addOutput("队列执行完毕回调","event",{})}static onAdd(e){this.list.set(e.id+"",e)}onAddToDataList(e){var t,n;(n=(n=e.opts).isTop)&&0!==this.index&&0!==this.dataList.length&&this.index+1>=this.dataList.length?(n=this.dataList.slice(0,this.index+1),t=this.dataList.slice(this.index+1),this.dataList=[...n,Object.assign(Object.assign({},e),{id:e.data.id}),...t]):this.dataList.push(Object.assign(Object.assign({},e),{id:this.id})),this.execQueue(e.parms)}execQueue(e){const t=this.dataList[this.index];if(t){if(!this.execed){const n=this.getNodeName();e.lastTriggerMap.set(n,(e=>{this.index++,this.execed=!1,this.rmOnlyTriggerType(e),e.lastTriggerMap.delete(n),this.execQueue(e)})),this.execed=!0,t.data.exec(e)}}else this.exec(e)}onStop(){this.index=0,this.dataList.length=0,this.execed=!1}onPlay(e,t){"清除队列"===e?this.break(t):this.execQueue(t)}break(e){const t=[];this.dataList.map((e=>{e.data.getAllOutNodes(t,!0)})),t.map((e=>e.onStop()));var n=this.getNodeName();e.lastTriggerMap.delete(n),this.onStop()}}Ft.list=new m.Z,Ft.title="队列";class jt{triggerCustom(e){e.registerNodeType("队列/生成队列",Ft),e.registerNodeType("队列/打断队列",Bt),e.registerNodeType("队列/添加到队列",Ut)}}class zt extends Z{constructor(){super(),this.title="运行模式",this.types=["editor","running","desktop"],this.onPlay=(e,t)=>{(0,K.F)(this.runScene).mode===this.widgetsMap.type.value&&this.exec(t)},this.addWidget({type:"combo",label:"运行模式",key:"type",value:"editor",options:{values:this.types}}),this.addInput("执行","event",{}),this.addOutput("触发","event",{})}}zt.title="运行模式";class Vt extends Z{constructor(){super(),this.title="帧率控制",this.onAfterAdded=()=>{this.runScene.cb.clean.on(this.onStop)},this.now=0,this.playing=!1,this.onPlay=(e,t)=>{this.runScene.cb.renderEx.after.add("frame-controls",(e=>{this.onFrame(e,t)}))},this.scopeData=this.getScopeData(),this.onFrame=(e,t)=>{this.scopeData.now+=e.time,this.scopeData.length++,e=this.getWidgetValue("time",t),this.scopeData.now>=this.getWidgetValue("time",t)&&(this.scopeData.length/e<this.getWidgetValue("frame",t)&&this.execSlot(0,t),this.onStop())},this.onStop=()=>{this.scopeData=this.getScopeData(),this.runScene.cb.renderEx.after.delete("frame-controls")},this.addWidget({type:"text",label:"监听时间",key:"time",value:10}),this.addWidget({type:"text",label:"平均帧率",key:"frame",value:30}),this.addInput("执行","event",{}),this.addOutput("低于平均帧","event",{})}getScopeData(){return{now:0,length:0}}}Vt.title="帧率控制";class Ht extends Z{constructor(){super(),this.title="滚动控制",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addWidget({type:"toggle",label:"启用",key:"state",value:!0,options:{on:"开启滚动",off:"关闭滚动"}})}onPlay(e,t){this.runScene.assetsEx.controls.enableZoom=this.getWidgetValue("state",t),this.exec(t)}}Ht.title="滚动控制";class Wt{triggerCustom(e){e.registerNodeType("控制器/滚动控制",Ht,!0),e.registerNodeType("场景/控制器/滚动控制",Ht)}}class Gt extends Z{constructor(){super(),this.title="运行相机模板",this.getNameValue=()=>{var e=(null==(e=null==this?void 0:this.graph)?void 0:e.runScene.cameraEx.temp.toArray("key"))||[];return this.widgetsMap.name.value||this.setValue("name",e[0]),e},this.setNameValue=e=>{this.setValue("名称",e)},this.isPromiseNode=!0,this.addWidget({type:"text",label:"时间",key:"time",value:1}),this.addWidget({type:"combo",label:"名称",key:"name",get:this.getNameValue}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("关闭","event",{})}onPlay(e,t){if("执行"===e){var n=this.widgetsMap.name.value;if(!n||!this.graph.runScene.cameraEx.temp.get(n))return this.exec(t);var r=Number(this.widgetsMap.time.value);this.graph.runScene.cameraEx.setTemp(n,{time:isNaN(r)?1:r,onComplete:()=>{this.exec(t)}})}else"关闭"===e&&this.onStop()}onStop(){var e=this.widgetsMap.name.value;e&&this.graph.runScene.cameraEx.temp.get(e)&&this.graph.runScene.cameraEx.closeAnima()}}Gt.title="运行相机模板";class Kt extends Z{constructor(){super(),this.title="切换相机属性",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("前景图片","texture",{})}onPlay(e,t){"执行"===e&&((e=this.getData("前景图片",{parms:t}))&&e.data&&this.runScene.cameraEx.setBackgroundTexture(e.data),this.exec(t))}onStop(){}}Kt.title="切换相机属性";class Zt extends Z{constructor(){super(),this.title="关闭相机模板",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}onPlay(e,t){this.runScene.cameraEx.closeAnima(),this.exec(t)}}Zt.title="关闭相机模板";class qt{triggerCustom(e){e.registerNodeType("相机/触发模板",Gt,!0),e.registerNodeType("相机/关闭模板",Zt,!0),e.registerNodeType("相机/切换属性",Kt,!0),e.registerNodeType("场景/相机/触发相机模板",Gt),e.registerNodeType("场景/相机/关闭相机模板",Zt),e.registerNodeType("场景/相机/切换相机属性",Kt)}}var Xt=n(3379);class Yt extends Z{constructor(){super(),this.title="后处理事件",this.onPlay=(e,t)=>{this.triggerSlot(1,t),this.triggerSlot(2,t)},this.addWidget({type:"toggle",label:"辉光",key:"glow",value:!1,set:e=>{this.widgetsMap.glow.value=e},options:{on:"打开",off:"关闭"}}),this.addWidget({type:"toggle",label:"轮廓光",key:"outline",value:!1,set:e=>{this.widgetsMap.outline.value=e},options:{on:"打开",off:"关闭"}}),this.addInput("输入模型","models",{}),this.addOutput("输出模型","models",{createData:e=>this.getData("输入模型",e)}),this.addOutput("输出修改前事件","string-event",{createData:({model:e})=>({type:"set-pp-event",data:{glow:(0,c.isGLowModel)(e),outline:(0,Xt.S)(e)}})}),this.addOutput("输出修改后事件","string-event",{createData:()=>({type:"set-pp-event",data:{glow:this.widgetsMap.glow.value,outline:this.widgetsMap.outline.value}})})}}Yt.title="后处理事件";class Qt{triggerCustom(e){e.registerNodeType("后处理/获取事件",Yt,!0),e.registerNodeType("场景/后处理/获取事件",Yt)}}class Jt{triggerCustom(e){(new qt).triggerCustom(e),(new Wt).triggerCustom(e),(new Qt).triggerCustom(e),e.registerNodeType("场景/运行模式",zt),e.registerNodeType("场景/帧率控制",Vt)}}class $t extends Z{constructor(){super(),this.title="运行脚本",this.isPromiseNode=!0,this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{})}onPlay(e,t){"执行"===e?(this.graph.runScene.script.playAll(),this.exec(t)):"关闭"===e&&this.onStop()}onStop(){this.graph.runScene.script.closeAll()}}$t.title="运行脚本";class en extends Z{constructor(){super(),this.title="运行脚本",this.getNameValue=()=>{var e=(null==(e=null==this?void 0:this.graph)?void 0:e.runScene.script.lineAnima.map.toArray("value").map((e=>e.name)))||[];return this.widgetsMap.name.value||this.setValue("name",e[0]),e},this.addInput("执行","event",{}),this.addOutput("触发完毕回调","event",{}),this.addWidget({type:"combo",label:"名称",key:"name",get:this.getNameValue}),this.addInput("关闭","event",{})}onPlay(e,t){"执行"===e?(this.graph.runScene.script.lineAnima.playByName(this.getWidgetValue("name",t)),this.exec(t)):"关闭"===e&&this.onStop()}onStop(){this.graph.runScene.script.lineAnima.closeByName(this.getWidgetValue("name"))}}en.title="运行脚本";class tn{triggerCustom(e){e.registerNodeType("脚本/运行",$t),e.registerNodeType("脚本/线动画",en)}}var nn=n(1398);class rn extends Z{constructor(){super(),this.title="运行快照",this.onAfterAdded=()=>{this.runScene.cb.snapshot.setName.add(this.getNodeName(),(e=>{var{name:e,oldName:t}=e;this.getWidgetValue("name")===t&&this.setWidgetValue("name",e)}))},this.getNameValue=()=>{var e=(null==(e=null==this?void 0:this.graph)?void 0:e.runScene.snapshot.map.toArray("key"))||[];return this.widgetsMap.name.value||this.setValue("name",e[0]),e},this.setNameValue=e=>{this.setValue("名称",e)},this.isPromiseNode=!0,this.onPropertyChanged=(e,t)=>{},this.addWidget({type:"combo",label:"名称",key:"name",get:this.getNameValue}),this.addWidget({type:"text",label:"时间",key:"time",value:1}),nn.cI.map((e=>{this.addWidget({type:"toggle",label:Fe(e),key:e,value:!0,options:{on:"执行模块",off:"不执行该模块"}})})),this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入文本","string",{}),this.addOutput("输出事件","string-event",{createData:()=>({type:"snapshot-event",data:this.widgetsMap.name.value})})}onPlay(e,t){if("执行"===e){var n=this.getDataByType("输入文本","string",{parms:t})||this.widgetsMap.name.value;if(!n||!this.graph.runScene.snapshot.map.get(n))return this.exec(t);var r=Number(this.widgetsMap.time.value);this.graph.runScene.snapshot.set(n,{animaTime:isNaN(r)?-1:r,onDone:()=>{this.exec(t)},ignoreModules:nn.cI.filter((e=>!1===this.widgetsMap[e].value))})}else"关闭"===e&&this.onStop()}onStop(){var e,t=this.widgetsMap.name.value;t&&null!=(e=null==(e=this.graph)?void 0:e.runScene)&&e.snapshot.map.get(t)&&null!=(e=null==(e=this.graph)?void 0:e.runScene)&&e.snapshot.close(t)}}rn.title="运行快照";class an extends Z{constructor(){super(),this.title="关闭所有快照",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}onPlay(e,t){this.runScene.snapshot.closeAll(),this.exec(t)}}an.title="关闭所有快照";class sn{triggerCustom(e){e.registerNodeType("快照/运行",rn),e.registerNodeType("快照/关闭",an)}}class on extends Z{constructor(){super(),this.title="生成状态控制器",this.color=J,this.states=new m.Z,this.execStates=new m.Z,this.addWidget({type:"text",label:"名称",key:"name"}),this.addWidget({type:"toggle",label:"重复执行",key:"repeat",value:!1}),this.addInput("执行","event",{}),this.buttonWidget=super._addWidget("button","添加插槽",null,(()=>{var e=this.outputs.length+1;this.addOutput("插槽"+e,"event",{})}))}setStates(e,t){this.states.set(e,t)}execStateSlot(e,t){if(this.enable&&(this.getWidgetValue("repeat",t)||!this.execStates.get(e))){for(let t=0;t<e+1;t++)if(!this.states.get(t))return;this.execStates.set(e,!0),this.execSlot(e,t)}}creatwWidget(e,t){this.addWidget({type:"toggle",label:"执行事件"+this.widgets.length,value:t,key:this.createWidgetKey("data"+this.widgets.length),set:t=>{this.widgetsMap[e].value=t},options:{on:"执行",off:"关闭"}})}createWidgetByForSavedKey(e,t){this.findWidget(e)||this.creatwWidget(e,t)}onStop(){this.enable=!1,this.onClear()}onClear(){this.states.clear(),this.execStates.clear()}onPlay(e,t){this.enable=!0}}on.title="生成状态控制器";class ln extends Z{constructor(){super(),this.title="执行状态机",this.color=J,this.onAfterAdded=()=>{this.onAddSlot()},this.slotList=[],this.getValues=()=>{const e=this.graph.findNodesByType("状态控制器/生成");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.addWidget({type:"combo",label:"状态机名称",key:"name",get:this.getValues,set:()=>{this.onAddSlot()}}),this.addWidget({type:"combo",label:"被执行插槽",key:"slot",set:()=>{this.onAddSlot()},get:this.slotList}),this.addWidget({type:"toggle",label:"可执行状态",key:"state",value:!1,options:{on:"打开",off:"关闭"}}),this.addInput("执行事件","event",{})}onAddSlot(){const e=this.getSelectedNode();e&&(this.slotList.length=0,e.outputs.map(((e,t)=>{this.slotList.push(t+1)})))}getSelectedNode(){const e=this.graph.findNodesByType("状态控制器/生成");let t;return G.F6.filter(e.map((e=>{e.widgetsMap.name.value===this.getWidgetValue("name")&&(t=e)}))),t}onPlay(e,t){const n=this.getSelectedNode();var r=this.getWidgetValue("slot",t);if(n){if(0===r.length)return;if(r=Number(r),isNaN(r))return;r-=1,this.getWidgetValue("state",t)&&n.setStates(r,!0),n.execStateSlot(r,t)}this.isEndNode(t)&&this.afterTrigger(t)}}ln.title="执行状态机";class un extends Z{constructor(){super(),this.title="设置状态机",this.color=J,this.onAfterAdded=()=>{this.onAddSlot()},this.slotList=[],this.getValues=()=>{const e=this.graph.findNodesByType("状态控制器/生成");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.addWidget({type:"combo",label:"状态机名称",key:"name",get:this.getValues,set:()=>{this.onAddSlot()}}),this.addWidget({type:"combo",label:"设置插槽",key:"slot",set:()=>{this.onAddSlot()},get:this.slotList}),this.addWidget({type:"toggle",label:"状态",key:"state",value:!0,options:{on:"打开",off:"关闭"}}),this.setWidgetValue("state",!0),this.addInput("执行事件","event",{})}onAddSlot(){const e=this.getSelectedNode();e&&(this.slotList.length=0,e.outputs.map(((e,t)=>{this.slotList.push(t+1)})))}getSelectedNode(){const e=this.graph.findNodesByType("状态控制器/生成");let t;return G.F6.filter(e.map((e=>{e.widgetsMap.name.value===this.getWidgetValue("name")&&(t=e)}))),t}onPlay(e,t){const n=this.getSelectedNode();var r=this.getWidgetValue("slot",t);if(n){if(0===r.length)return;if(r=Number(r),isNaN(r))return;n.setStates(r-1,this.getWidgetValue("state",t))}this.isEndNode(t)&&this.afterTrigger(t)}}un.title="设置状态机";class cn extends Z{constructor(){super(),this.title="清除状态",this.color=J,this.getValues=()=>{const e=this.graph.findNodesByType("状态控制器/生成");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.onPlay=(e,t)=>{const n=this.getSelectedNode();n&&n.onClear(),this.exec(t)},this.addWidget({type:"combo",label:"状态机名称",key:"name",get:this.getValues}),this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}getSelectedNode(){const e=this.graph.findNodesByType("状态控制器/生成");let t;return G.F6.filter(e.map((e=>{e.widgetsMap.name.value===this.getWidgetValue("name")&&(t=e)}))),t}}cn.title="清除状态";class dn{triggerCustom(e){e.registerNodeType("状态控制器/生成",on),e.registerNodeType("状态控制器/执行",ln),e.registerNodeType("状态控制器/设置状态",un),e.registerNodeType("状态控制器/清除",cn)}}class hn extends Z{constructor(){super(),this.title="贴图节点",this.mergeImgHeight=!1,this.addOutput("输出贴图","texture",{createData:()=>({type:"texture",data:this.texture})})}setTexture(e){this.texture=e,this.properties.textureId=(0,Ye.Ki)(e)}afterDrawNode(e){var t,n,r;this.flags.collapsed||this.texture&&(t=this.texture.image,n=this.getSubNodeY("out",!1),r=180/(t.width/t.height),e.translate(10,n+r+E.NODE_TITLE_HEIGHT+10),e.scale(1,-1),e.drawImage(t,0,n,this.size[0]-20,r),this.mergeImgHeight||(this.size[1]+=r,this.mergeImgHeight=!0))}onPlay(e,t){}onStop(){}onBindGraph(){var e,t=this.properties.textureId;t&&((e=this.runScene.uniqueEx.texture.get(t))?this.setTexture(e):this.runScene.textureEx.setAwaitLoaded(t,(e=>{this.setTexture(e)})))}}hn.title="贴图节点";class pn extends Z{constructor(){super(),this.title="贴图脚本动画",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入贴图","texture",{}),this.addWidget({type:"number",value:-1,label:"uv移动X",key:"moveX"}),this.addWidget({type:"number",value:-1,label:"uv移动Y",key:"moveY"}),this.addWidget({type:"number",value:-1,label:"uv旋转",key:"rotate"})}onPlay(e,t){const n=this.getData("输入贴图",{parms:t});n&&n.data&&["moveX","moveY","rotate"].map((e=>{-1!==this.widgetsMap[e].value&&this.runScene.textureEx.setAnima({texture:n.data,type:e,val:this.widgetsMap[e].value})})),this.exec(t)}onStop(){}}pn.title="贴图脚本动画";var fn,mn,gn=n(9151);class vn extends Z{constructor(){super(),this.title="APNG贴图动画设置",this.tempTexture=null,this.addInput("执行","event",{}),this.addOutput("结束回调","event",{}),this.addInput("输入贴图","texture",{}),this.addWidget({type:"combo",value:gn.constTextureAnimaFrame[2],label:"帧率",key:"frame",options:{values:gn.constTextureAnimaFrame}}),this.addWidget({type:"toggle",value:!0,label:"循环",key:"loop"}),this.addWidget({type:"toggle",value:!0,label:"停在末帧",key:"end"})}onPlay(e,t){var n=this.getData("输入贴图",{parms:t});if(console.log("Log-- ",null==n?void 0:n.data,"textureMap?.data",gn.textureForAnima.is(n.data)),null!=n&&n.data&&gn.textureForAnima.is(n.data)){var r=this.getWidgetValue("frame",t),i=this.getWidgetValue("loop",t),a=this.getWidgetValue("end",t),s=n.data;const e=this.runScene.textureEx.getAnimaData(n.data);e&&(e.play=!0,e.index=0,e.loop=i,e.end=a,this.runScene.textureEx.setFrame(s,r)),this.tempTexture=s,this.exec(t)}else this.exec(t)}onStop(){var e;if(this.tempTexture){const t=this.runScene.textureEx.getAnimaData(this.tempTexture);t&&(t.play=!1!==(null==(e=gn.textureForAnima.get(this.tempTexture))?void 0:e.play)),this.tempTexture=void 0}}}vn.title="APNG贴图动画设置";class yn{triggerCustom(e){e.registerNodeType("贴图/节点",hn),e.registerNodeType("贴图/脚本动画",pn),e.registerNodeType("贴图/APNG动画",vn)}}class bn extends Z{constructor(){super(),this.title="时间线运行",this.getNameValue=()=>{var e=Object.keys((null==(e=null==this?void 0:this.graph)?void 0:e.runScene.timeLineEx.groupMap)||{});return this.widgetsMap.name.value||this.setWidgetValue("name",e[0]),e},this.setNameValue=e=>{this.setValue("名称",e)},this.isPromiseNode=!0,this.addWidget({type:"combo",label:"名称",key:"name",get:this.getNameValue}),this.addWidget({type:"toggle",label:"运行方向",key:"isReverse",value:!0,set:e=>{this.widgetsMap.isReverse.value=e},options:{on:"正向",off:"反向"}}),this.addWidget({type:"toggle",label:"关闭其他时间线",key:"closeAl",value:!1}),this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("结束回调","event",{}),this.addOutput("输出事件","string-event",{createData:()=>({type:"timeline-event",data:this.widgetsMap.name.value})}),this.addValue("名称","")}onPlay(e,t){if("执行"===e){var n=this.widgetsMap.name.value;if(!n||!this.graph.runScene.timeLineEx.groupMap[n]||this.graph.runScene.timeLineEx.groupMap[n].run)return this.exec(t);this.getWidgetValue("closeAll",t)&&(this.graph.findNodesByType("时间线/运行").map((e=>e.onStop(t))),this.runScene.timeLineEx.closeAll()),this.graph.runScene.timeLineEx.playGroup(n,{onlyReverse:!this.widgetsMap.isReverse.value,onOnceDone:()=>{this.exec(t)}})}else"关闭"===e&&this.onStop(t)}onStop(e){this.bindRuning(!0,e),(e=this.widgetsMap.name.value)&&this.graph.runScene.timeLineEx.groupMap[e]&&(this.graph.runScene.timeLineEx.closeGroup(e),this.graph.runScene.timeLineEx.resetGroup(e))}}bn.title="时间线运行";class xn extends Z{constructor(){super(),this.title="关闭所有时间线",this.addInput("执行","event",{}),this.addOutput("结束回调","event",{})}onPlay(e,t){this.graph.findNodesByType("时间线/运行").map((e=>e.onStop(t))),this.runScene.timeLineEx.closeAll(),this.exec(t)}}xn.title="关闭所有时间线";class wn{triggerCustom(e){e.registerNodeType("时间线/运行",bn),e.registerNodeType("时间线/关闭所有",xn)}}class Sn extends Z{constructor(){super(),this.title="关闭后续节点运行",this.addInput("执行","event",{}),this.addOutput("回调","event",{}),this.addInput("关闭后续节点","event",{})}onPlay(e,t){"执行"===e?(t.runState=!0,this.exec(t)):"关闭后续节点"===e&&(t.runState=!1,this.stopOutNode(!0))}}Sn.title="关闭后续节点运行";class _n extends Z{constructor(){super(),this.title="结束所有回调",this.addInput("执行","event",{}),this.addOutput("回调","event",{})}onPlay(e,t){this.parms=t,this.log("执行完毕,进行下一个节点"),this.execParms(t),this.trigger(null,t)}}_n.title="结束所有回调";class Tn extends Z{constructor(){super(),this.title="debug",this.addInput("执行","event",{}),this.addOutput("回调","event",{})}onPlay(e,t){"执行"===e&&this.exec(t)}}Tn.title="debug";class Mn extends Z{constructor(){super(),this.title="获取节点结束回调",this.addInput("执行","event",{}),this.addOutput("回调","event",{}),this.addOutput("后续节点执行完毕","event",{})}onPlay(e,t){(this.parms=t).lastTriggerMap.set("后续节点执行完毕",(()=>{t.onlyTriggerLastKey=void 0,t.lastTriggerMap.delete("后续节点执行完毕"),this.execSlot(1,t)})),t.onlyTriggerLastKey="后续节点执行完毕",this.execSlot(0,t)}}Mn.title="获取节点结束回调";class En extends Z{constructor(){super(),this.title="模块",this.color=Y,this.runData=fe.getRunData(this),this.addOutput("触发","event",{}),this.addWidget({type:"text",label:"名称",value:"",key:"name"})}onPlay(e,t){null==this.parms&&(this.parms=t),this.resetData(),this.runData.runState=!0,this.runData.wordMap=t.wordMap,this.exec(t||this.runData)}resetData(e=this.runData){fe.resetData(e)}}En.title="模块";class Dn extends Z{constructor(){super(),this.title="模块导入模型",this.color=Y,this.addInput("执行","event",{}),this.addInput("输入模型","models",{})}getModel(e){return this.getData("输入模型",e)}}Dn.title="模块导入模型";class Pn extends Z{constructor(){super(),this.title="模块导出模型",this.color=Y,this.addWidget({type:"combo",label:"节点名称",key:"name",value:"",options:{values:new Array(10).fill("").map(((e,t)=>"入参"+(t+1)))}}),this.addOutput("输出模型","models",{createData:e=>({type:"models",data:this.getModel(e)})})}getModel(e){var t;const n=null==(t=null==(t=e.parms)?void 0:t.inputMap)?void 0:t.get(this.getWidgetValue("name")),r=[];return null!=n&&n.map((({node:t})=>{t instanceof Dn&&(t=t.getModel(e))&&r.push(...t.data)})),r}}Pn.title="模块导出模型";class kn extends Z{constructor(){super(),this.title="调用模块",this.color=Y,this.getValues=()=>{const e=this.graph.findNodesByType("节点工具/模块/生成");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.nowTirggerNodeTitle=["设置文本替换"],this.catchMap=new m.Z,this.onStop=()=>{var e;null!=(e=this.graph)&&e.ins.clearSelected(),this.catchMap.map(((e,{nodes:t,func:n})=>{C.onMenuNodeRemove(null,null,null,null,n),t.map(((e,t)=>{C.onMenuNodeRemove(null,null,null,null,t)}))})),this.catchMap.clear()},this.addInput("触发模块","event",{}),this.addOutput("回调","event",{}),this.addWidget({type:"combo",label:"事件名称",key:"name",get:this.getValues}),this.buttonWidget=super._addWidget("button","添加入参",null,(()=>{this.addOutput("入参"+this.outputs.length,"event",{})}))}onPlay(e,t){null==this.parms&&(this.parms=t);var n=this.getSelectedNode();if(n){const e=fe.getRunData(this,{getDone:!0});e.runState=!0,e.wordMap||(e.wordMap=new m.Z),t.wordMap&&e.wordMap.copy(t.wordMap),console.log("Log-- ",t.wordMap,e.wordMap,"parms.wordMap"),e.onDones.set(this.id,(()=>{this.triggerSlot(0,t)})),this.outputs.map(((t,n)=>{const r=this.getOutputNodeAndLinks(n+1);var i;r&&0!==(i=G.F6.filter(r.map((t=>{var{node:t,link:r}=t;if(!this.nowTirggerNodeTitle.includes(t.title))return{runName:t.inputs[r.target_slot].name,node:t};this.triggerSlot(n+1,e)})))).length&&(e.inputMap||(e.inputMap=new m.Z),e.inputMap.set("入参"+(n+1),i))})),this.playNode(n,e)}}playNode(e,t){if(null!=(n=t.wordMap)&&n.size)t.wordMap.map(((n,r)=>{var i=this.catchMap.get(n+"_"+r);if(i)null!=(i=i.func)&&i.onAction("触发",t);else{const i=e.getAllNodeByLinks(),a=this.runScene.graph.cloneNode(i.toArray("value")),s=(a.map(((e,t)=>{t.pos[0]+=20,t.pos[1]+=20})),a.toArray("value").find((e=>"模块"===e.title)));null!=s&&s.onAction("触发",t),this.catchMap.set(n+"_"+r,{func:s,nodes:a})}}));else{var n="def"+this.id,r=this.catchMap.get(n);if(r)null!=(r=r.func)&&r.onAction("触发",t);else{const r=e.getAllNodeByLinks(),i=this.runScene.graph.cloneNode(r.toArray("value")),a=(i.map(((e,t)=>{t.pos[0]+=10,t.pos[1]+=10})),i.toArray("value").find((e=>"模块"===e.title)));null!=a&&a.onAction("触发",t),this.catchMap.set(n,{func:a,nodes:i})}}}getSelectedNode(){const e=this.graph.findNodesByType("节点工具/模块/生成");let t;return G.F6.filter(e.map((e=>{e.widgetsMap.name.value===this.getWidgetValue("name")&&(t=e)}))),t}}kn.title="调用模块";class On extends Z{constructor(){super(),this.title="调用模块入参",this.color=Y,this.addInput("执行","event",{}),this.addOutput("触发","event",{}),this.addWidget({type:"combo",label:"节点名称",key:"name",value:"",options:{values:new Array(10).fill("").map(((e,t)=>"入参"+(t+1)))}})}onPlay(e,t){var n;const r=null==(n=t.inputMap)?void 0:n.get(this.getWidgetValue("name")),i=fe.getRunData(this,{getDone:!0});i.runState=!0,i.wordMap=t.wordMap,i.onDones.set(this.id,(()=>{this.exec(t)})),null!=r&&r.map((({node:e,runName:t})=>{e.onAction(t,i)}))}}On.title="调用模块入参";class An extends ne{constructor(){super(),this.title="发送信息",this.addInput("执行","event",{}),this.addOutput("执行后回调","event",{}),this.addWidget({type:"text",label:"发送名称",value:"信息1",key:"name"})}onPlay(e,t){const n=this.graph.findNodesByType("节点工具/信息/接收").find((e=>e.getWidgetValue("name",t)===this.getWidgetValue("name",t)));n&&n.onAction("触发",t),this.runScene.cb.graph.tools.notice.cb({name:this.getWidgetValue("name",t)}),this.exec(t)}}An.title="发送信息";class Cn extends ne{constructor(){super(),this.title="接收信息",this.getValues=()=>{const e=this.graph.findNodesByType("节点工具/信息/发送");return G.F6.filter(e.map((e=>e.widgetsMap.name.value)))},this.addOutput("触发","event",{}),this.addWidget({type:"combo",label:"接收名称",key:"name",get:this.getValues})}onPlay(e,t){this.exec(t)}}Cn.title="接收信息";class Nn{triggerCustom(e){e.registerNodeType("节点工具/debug",Tn),e.registerNodeType("节点工具/关闭后续节点",Sn),e.registerNodeType("节点工具/结束所有回调",_n),e.registerNodeType("节点工具/获取节点执行完毕",Mn),e.registerNodeType("节点工具/模块/生成",En),e.registerNodeType("节点工具/模块/调用",kn),e.registerNodeType("节点工具/模块/调用入参节点",On),e.registerNodeType("节点工具/模块/导入模型",Dn),e.registerNodeType("节点工具/模块/导出模型",Pn),e.registerNodeType("节点工具/信息/接收",Cn),e.registerNodeType("节点工具/信息/发送",An)}}class Ln extends Z{constructor(){super(),this.title="循环",this.onEnd=()=>{},this._onEnd=e=>{this.parms&&!1!==e.runState&&(e.peddingMap.clear(),this.exec(e))},this.addWidget({type:"number",label:"间隔时间",key:"time",value:1,set:()=>{this.initOnEnd()},options:{step:1}}),this.addInput("执行","event",{}),this.addInput("关闭","event",{}),this.addOutput("循环开始","event",{}),this.initOnEnd()}onPlay(e,t){"执行"===e?(t.lastTriggerMap.set(this.getNodeName(),this.onEnd),this.parms=t,this.exec(t)):"关闭"===e&&(this.parms=void 0)}initOnEnd(){this.onEnd=(0,a.fnDebounce)(this._onEnd,1e3*this.widgetsMap.time.value)}onStop(){this.parms=void 0}onConnectOutput(){if(!this.isLast())return this.graph.ins.log("该节点只能链接一个节点","error"),!1}onValueChanged(){this.initOnEnd()}onConfigure(e){this.setWidgetValue("time",e.properties.time),this.initOnEnd()}static delLastTrigger(e){e.lastTriggerMap.delete("循环")}}Ln.title="循环";class In extends Z{constructor(){super(),this.title="延迟",this.addWidget({type:"number",label:"延迟时间",key:"time",value:1,set:e=>{this.initOnEnd(),this.setValue("time",e)},options:{step:1}}),this.addInput("执行","event",{}),this.addOutput("延迟结束回调","event",{}),this.initOnEnd()}onPlay(e,t){this.delayAction(t)}initOnEnd(){this.delayAction=(0,a.fnDebounce)((e=>{!1!==e.runState&&this.exec(e)}),1e3*this.widgetsMap.time.value)}onValueChanged(){this.initOnEnd()}onConfigure(e){null!=e&&e.properties&&(this.widgetsMap.time.value=(0,ot.le)(e.properties.time,1)),this.initOnEnd()}onConnectOutput(){if(!this.isLast())return this.graph.ins.log("该节点只能链接一个节点","error"),!1}}In.title="延迟";class Rn{triggerCustom(e){e.registerNodeType("触发方式/循环",Ln),e.registerNodeType("触发方式/延迟",In)}}class Un extends Z{constructor(){super(),this.title="测试按钮",this.color=Q,this.catchName="",this.catchWord=new m.Z,this.types=["editor","running","desktop","all"],this.outputs=[],this.addWidget({type:"text",label:"名称",key:"name",value:""}),this.addWidget({type:"combo",label:"生成环境",key:"type",value:"all",options:{values:this.types}}),this.setValue(this.createWidgetKey("名称"),""),this.addOutput("触发","event",{}),this.addInput("生成按钮","event",{}),this.addInput("移除按钮","event",{}),this.addInput("输入名称","string",{})}onPlay(e,t=this.parms){if(t&&(this.parms=t),"生成按钮"===e){var n=this.getData("输入名称");if(n=this.getText("string"===(null==n?void 0:n.type)&&n.data||this.getWidgetValue("name"),t),this.catchName=n,this.keepMessageShow("文本="+n),t.wordMap&&this.catchWord.copy(t.wordMap),console.log("Log-- ",this.catchWord,t.wordMap,"this.catchWord"),0<=n.length&&("all"===this.widgetsMap.type.value||(0,K.F)(this.runScene).mode===this.widgetsMap.type.value)){const e=Un.getParentDom(this.runScene);n=this.getDom(n,t),e.appendChild(n)}}else"移除按钮"===e&&this.onStop();this.afterTrigger(t)}click(){}getDom(e,t){if(this.dom)return this.dom.innerText=e,this.dom;const n=document.createElement("div");return n.innerText=e,n.style.backgroundColor="rgb(67, 68, 72)",n.style.padding="4px 10px",n.style.color="rgba(255,255,255,0.6)",n.style.borderRadius="3px",n.style.cursor="pointer",n.style.margin="0 3px 5px 3px",n.style.zIndex="10",n.style.gap="20px",n.classList.add("graph_button_parent_item"),n.addEventListener("pointerup",(e=>{e.stopPropagation()})),n.addEventListener("pointerdown",(e=>{e.stopPropagation(),this.triggerButton(t)})),this.dom=n}onStop(){var e;null!=(e=this.dom)&&e.remove(),this.catchName="",this.catchWord.clear()}triggerButton(e){const t=e||this.parms;console.log("Log-- ",this.catchWord,"this.catchWor"),this.catchWord&&(t.wordMap||(t.wordMap=new m.Z),t.wordMap.copy(this.catchWord)),console.log("Log-- ",t,"theParms"),zn.callBack.ui.button.cb({name:this.catchName||this.getWidgetValue("name",t)}),this.exec(t)}onRemoved(){var e;null!=(e=this.dom)&&e.remove()}}(fn=Un).title="测试按钮",Un.getParentDom=e=>{if(fn.parentDom)return fn.parentDom;const t=document.createElement("div");return t.classList.add("graph_button_parent"),e.assetsEx.engineDom.appendChild(t),t.style.position="absolute",t.style.left="editor"===(0,K.F)(e).mode?"100px":"10px",t.style.top="safari"===(0,b.ij)()?"50px":"10px",t.style.display="flex",t.style.flexWrap="wrap",t.style.justifyContent="flex-start",t.style.alignItems="center",fn.parentDom=t};class Bn extends Z{constructor(){super(),this.title="删除按钮",this.color=Q,this.types=["editor","running","desktop","all"],this.getValues=e=>{var t;const n=(null==(t=this.graph)?void 0:t.findNodesByType("UI/按钮"))||[];return G.F6.filter(n.map((e=>e.widgetsMap.name.value===this.getWidgetValue("name",this.parms)?e:void 0)))},this.outputs=[],this.addWidget({type:"text",label:"名称",key:"name",value:""}),this.addInput("触发","event",{})}onPlay(e,t=this.parms){const n=this.getValues(t);null!=n&&n.map((e=>{e.onStop(t)}))}}Bn.title="删除按钮";class Fn extends Z{constructor(){super(),this.title="测试按钮",this.color=Q,this.outputs=[],this.addWidget({type:"text",label:"名称",key:"name",value:""}),this.setValue(this.createWidgetKey("名称"),""),this.addOutput("触发","event",{}),this.addInput("生成按钮","event",{}),this.addInput("移除按钮","event",{}),this.addInput("输入名称","string",{})}onPlay(e,t){if(t&&(this.parms=t),"生成按钮"===e){var n=this.getData("输入名称");if(n=this.getText("string"===(null==n?void 0:n.type)&&n.data||this.getWidgetValue("name"),t),this.keepMessageShow("文本="+n),n&&0!==n.length){const e=Fn.getParentDom(this.runScene),r=this.getDom(n);e.appendChild(r),r.addEventListener("pointerup",(e=>{e.stopPropagation()})),r.addEventListener("pointerdown",(e=>{e.stopPropagation(),this.triggerButton(t)}))}}else"移除按钮"===e&&this.onStop()}getDom(e){if(this.dom)return this.dom.innerText=e,this.dom;const t=document.createElement("div");return t.innerText=e,t.style.padding="4px 10px",t.style.color="rgba(255,255,255,0.6)",t.style.borderRadius="3px",t.style.cursor="pointer",t.style.margin="0 3px",this.dom=t}onStop(){var e;null!=(e=this.dom)&&e.remove()}onRemoved(){var e;null!=(e=this.dom)&&e.remove()}triggerButton(e){this.exec(e||this.parms)}}(mn=Fn).title="测试按钮",Fn.isOpen=!1,Fn.getParentDom=e=>{if(mn.parentDom)return mn.parentDom;const t=document.createElement("div"),n=document.createElement("div"),r=(n.innerHTML='<svg t="1691562264274" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4756" data-darkreader-inline-fill="" width="200" height="200"><path d="M710.4 211.2l-57.6-57.6L294.4 512l358.4 358.4 57.6-57.6L409.6 512l300.8-300.8z" p-id="4757"></path></svg>',t.addEventListener("pointerdown",(e=>{e.stopPropagation(),mn.isOpen=!mn.isOpen,t.style.right=mn.isOpen?"10px":"-70px",n.style.transform=`rotateY(${mn.isOpen?180:0}deg)`})),t.classList.add("graph_mobile_button_parent"),e.assetsEx.engineDom.appendChild(t),document.createElement("div")),i=(r.classList.add("arrow"),r.appendChild(n),document.createElement("div"));return i.classList.add("content"),t.style.position="absolute",t.style.top="50%",t.style.display="flex",t.style.justifyContent="space-between",t.style.alignItems="center",t.appendChild(r),t.appendChild(i),mn.parentDom=i};class jn{triggerCustom(e){e.registerNodeType("UI/按钮",Un),e.registerNodeType("UI/删除按钮",Bn),e.registerNodeType("UI/移动端按钮组",Fn)}}class zn{constructor(e){this.loaded=!1,this.debug=!1,this.selectedGroup=new m.Z,this.LiteGraph=E,this.ignoreMenuMap={},this.runState=!1,this.bandKeys=["z","y","g","f"],this.userKeys=new m.Z({d:{callback:()=>{this.runScene.events.key.ctrl&&this.getSelecteds().map((e=>{C.onMenuNodeClone(null,null,null,null,e)}))},down:e=>{this.runScene.events.key.ctrl&&e.preventDefault()}},delete:{callback:()=>{this.getSelecteds().map((e=>{C.onMenuNodeRemove(null,null,null,null,e)}))}},f:{callback:()=>{var e=this.downSelectedGroup;e&&this.focus(e)}}}),this.setUserKeysState=e=>{this.userKeys.map((t=>{this.runScene.events.key.setUnExec({key:t,state:e,name:"graph"})})),this.bandKeys.map((t=>{this.runScene.events.key.setUnExec({key:t,state:e,name:"graph"})}))},E.NODE_TEXT_SIZE=13,E.NODE_SUBTEXT_SIZE=12,E.NODE_BOX_OUTLINE_COLOR="rgb(214,214,214)",E.DEFAULT_SHADOW_COLOR="rgba(0, 0, 0, 0.6)",E.LINEMAP={type:{colorMap:{models:"rgb(26,114,151)",string:"rgb(42,161,152)",events:"RGB(95,204,95)"}}},E.DEFAULT_SHADOW_OFFSETX=0,E.DEFAULT_SHADOW_OFFSETY=4,E.DEFAULT_SHADOW_BLUR=12,E.MY_OUTLINE_COLOR="#ffffff",E.MY_NODE_OPEN_RADIUS=12,E.MY_NODE_CLOSE_RADIUS=6,E.MY_NODE_EVEMT_HEIGHT=10,E.MY_NODE_EVEMT_WIDTH=10,E.NODE_WIDGET_HEIGHT=25,E.CONNECTING_LINK_COLOR="rgb(26,114,151)",E.EVENT_LINK_COLOR="RGB(95,204,95)",this._graph=new D,(this._graph.ins=this)._graph.runScene=e,this.runScene=e,this.triggerCustom(),this.initEvent(),this.runScene.cb.inited.add("graph",(()=>{var t;zn.callBack.inited.cb(),this.debug=(null==(t=(0,K.F)(e))?void 0:t.graph.debug)||"editor"===(0,K.F)(e).mode}))}onSetSelectedGroupForDown(e){e&&(this.downSelectedGroup=e)}onSetSelectedGroupForUp(e){e?this.runScene.events.key.ctrl&&(e.recomputeInsideNodes(),this.selectedGroup.set(e.title,e)):this.clearSelectedGroup()}clearSelectedGroup(){this.selectedGroup.clear()}getSelectedGroup(){return this.selectedGroup.toArray("value")}initEvent(){this.runScene.exporter.gltf.options.addOption({type:"graph",subType:"after",parse:e=>{e=JSON.parse(e),"editor"===(0,K.F)(this.runScene).mode?this.catchData=e:this.load(e)},process:()=>JSON.stringify(this.getJSON())}),this.runScene.cb.clean.add("graph",(()=>{this._graph.clear()})),this.runScene.cb.exporter.gltf.before.add("graph",(()=>{this.stop()})),window.addEventListener("resize",(()=>{this.resize()})),this.bindKeyEvent(),E.debug=!1}loadCatch(){this.catchData&&(this.load(this.catchData),this.catchData=void 0)}mounted(e){this._canvas=new C(e,this._graph),this.dom=e,this.runScene.cb.graph.mounted.cb({dom:e}),E.debug="editor"===(0,K.F)(this.runScene).mode}resize(e,t){if(this.dom&&this._canvas){let n,r;if(void 0!==e&&void 0!==t)n=Math.floor(e),r=Math.floor(t);else{const i=this.dom.parentNode;if(!i)return;var{width:e,height:t}=i.getBoundingClientRect();n=e||1e3,r=t||500}this.dom.width=n,this.dom.height=r,this._resize()}}triggerCustom(){return(new fe).triggerCustom(this,this.runScene),(new wn).triggerCustom(this),(new Ze).triggerCustom(this),(new Rt).triggerCustom(this),(new nt).triggerCustom(this),(new sn).triggerCustom(this),(new tn).triggerCustom(this),(new Rn).triggerCustom(this),(new Nn).triggerCustom(this),(new jn).triggerCustom(this),(new Jt).triggerCustom(this),(new Pe).triggerCustom(this),(new Xe).triggerCustom(this),(new yn).triggerCustom(this),(new jt).triggerCustom(this),(new dn).triggerCustom(this),this}registerNodeType(e,t,n){!0===n&&(this.ignoreMenuMap[e]=!0),E.registerNodeType(e,t)}getJSON(){if(this.catchData)return this.catchData;var e=this._graph.serialize()||{};return Object.assign(Object.assign({},e),{ds:{scale:null==(e=this._canvas)?void 0:e.ds.scale,offset:null==(e=this._canvas)?void 0:e.ds.offset}})}load(e){this.loadModule(e,{selelct:!1}),this.loaded||(this.loaded=!0,zn.callBack.loaded.cb())}run(){this.runState=!0,this._graph.start(),this.runData=this.getRunData(),zn.callBack.setState.cb({state:!0})}stop(){this.runState=!1,this._graph.stop(),this.runData=this.getRunData(),zn.callBack.setState.cb({state:!1})}getRunState(){return this.runState}log(e,t){this.runScene.optionsEx.log(e,"base",t)}clean(){this._graph.clear()}format(){this._graph.arrange()}runByType(e){return null==(e=this.getNodesByTypes(e))?void 0:e.map((e=>(e.actionDo(),e)))}getNodesByTypes(e){return this._graph.findNodesByType(e)}runCustom(e,t,n){return this.runScene.cb.graph.runtime.runCustom.cb({name:e,onDone:t,type:n})}setLastType(e){this.lastType=e}bindKeyEvent(){var e;this.runScene.cb.events.key.down.add("keyup",(({key:e,event:t})=>{this.runScene.events.key.ctrl&&"d"===e&&t.preventDefault(),null!=(e=this.userKeys.get(e.toLocaleLowerCase()))&&e.callback(t)})),this.runScene.cb.events.key.up.add("keydown",(({event:e,key:t})=>{var n;this.runScene.events.key.ctrl&&"d"===t&&e.preventDefault(),null!=(n=null==(t=this.userKeys.get(t.toLocaleLowerCase()))?void 0:t.down)&&n.call(t,e)})),null!=(e=this.dom)&&e.addEventListener("mousemove",(e=>{this.runScene.events.mouse.moveEvent=e}))}onContentMenu(e){var t;null!=(t=this.contentMenu)&&t.call(this,e)}bindContentMenu(e){this.contentMenu=e}getAllTypes(){const e={};return Object.keys(E.registered_node_types).map(((t,n)=>{this.ignoreMenuMap[t]||(e[t]=n)})),e}getEvent(){}getSelecteds(){var e;return(0,a.mapObj)(null==(e=this._canvas)?void 0:e.selected_nodes,((e,t)=>t))}clearSelected(){this._canvas.selected_nodes={}}onAfterClone(e){e.map((({node:e,clonedNode:t})=>{this.copyLink(e,t,!1)}))}copyLink(e,t,n){e.inputs.map((e=>{var n;if(null!==e.link&&(n=this._graph.links[e.link])){var{origin_id:n,origin_slot:r}=n;const i=this._graph.getNodeById(n);i&&i.connect(r,t,e.slot_index)}})),n&&e.outputs.map((e=>{e.links.map(((e,n)=>{var r;(e=this._graph.links[e])&&(({target_id:e,target_slot:r}=e),(e=this._graph.getNodeById(e))&&t.connect(n,e,r))}))}))}reCarete(e){const t=E.createNode(e.type);t&&(this.addNode(t),this.copyLink(e,t),t.pos=e.pos,this.removeNode(e))}addNode(e,t){null!=t&&t.useMouseLocal&&(e.pos=this.getMousePos()),this._graph.add(e)}removeNode(e){C.onMenuNodeRemove(null,null,null,null,e)}loadModule(e,t){const{links:n,nodes:r,ds:i}=e;var a,s;i&&this._canvas&&(({scale:a,offset:s}=i),this._canvas.ds.scale=a||1,s&&(this._canvas.ds.offset[0]=s[0],this._canvas.ds.offset[1]=s[1]));const o=this._graph.last_node_id,l=this.getMaxLinkId(),u=[1/0,1/0],c=new m.Z,d=(n.map(((e,t)=>{c.set(e[0],e),e[0]=l+t+1})),new m.Z);r.map(((e,t)=>{u[0]=Math.min(e.pos[0],u[0]),u[1]=Math.min(e.pos[1],u[1]);const{id:n,inputs:r,outputs:i}=e,a=o+t+1,s=(e.id=a,r.map((e=>{if(null!==e.link){const t=c.get(e.link);t&&(t[3]===n&&(t[3]=a),e.link=null)}})),i.map((e=>{null!==e.links&&e.links.map(((t,r)=>{const i=c.get(t);i&&(i[1]===n&&(i[1]=a),e.links[r]=[])}))})),this.createNode(e.type,e.title,{id:a}));s&&(s.configure(e,{keeyLink:!1}),this.addNode(s),d.set(a,s))})),n.map((e=>{var[,e,t,n,r]=e,n=d.get(n);const i=d.get(e);n&&i&&i.connect(t,n,r)}));let h=-1,p=-1;if(null!=t&&t.local&&(h=t.local[0]-u[0],p=t.local[1]-u[1]),e.groups)for(var f=0;f<e.groups.length;++f){var g=new O;-1!==h&&-1!==p&&(e.groups[f].bounding[0]+=h,e.groups[f].bounding[1]+=p),g.configure(e.groups[f]),this.addNode(g)}!1!==(null==t?void 0:t.selelct)&&this.setSelect(d.toArray("value"),!1),-1!==h&&-1!==p&&d.map(((e,t)=>{t.pos[0]+=h,t.pos[1]+=p}))}hasNode(){}createNode(e,t,n){return E.createNode(e,t,n)}setSelect(e,t){var n;null!=(n=this._canvas)&&n.selectNodes(G.F6.toArr(e),t)}getMaxLinkId(){return Number((Object.keys(this._graph.links).sort(((e,t)=>Number(t)-Number(e)))||[0])[0])}loadFile(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield(0,a.parseFile)(e,"text");(t=JSON.parse(t||""))&&this.parseJSON(t)}))}parseJSON(e,t){"graph"===e.type&&this.loadModule(e.data,t)}getFile(){return new File([JSON.stringify({type:"graph",version:"0.0.1",data:this.getJSON()})],"graph.json")}cloneNode(e,t){const n=e||this.getSelecteds(),r=new m.Z;return n.map((e=>{var t=e.clone();this._graph.add(t),r.set(e.id,t)})),n.map((e=>{const t=r.get(e.id);e.inputs.map((e=>{if(null!==e.link&&(e=this._graph.links[e.link])){var{origin_id:e,origin_slot:n,target_slot:i}=e;const a=r.get(e);a&&a.connect(n,t,i)}}))})),!1!==(null==t?void 0:t.selected)&&this.setSelect(r.toArray("value"),!1),r}cloneNodeForNode(){}cloneGroup(e,t){e.recomputeInsideNodes();const n=(new O).configure(e.serialize()),r=(n.pos=t,this.cloneNode(e._nodes)),i=(this._graph.add(n),e.pos),a=t;e._nodes.map((e=>{const t=r.get(e.id);t&&(t.pos=[a[0]+e.pos[0]-i[0],a[1]+e.pos[1]-i[1]])})),n.recomputeInsideNodes()}copyGroup(e){this.copyedGroup=e}pasteGroup(e){this.copyedGroup&&this.cloneGroup(this.copyedGroup,e)}getBoundingForNodes(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;return e.map((e=>{var[e,a,s,o]=e.getBounding([]);e<t&&(t=e),a<n&&(n=a),e+s>r&&(r=e+s),a+o>i&&(i=a+o)})),{x:t-20,y:n-20,width:r-t+40,height:i-n+40}}resetGroupSizeForNodes(e,t){t=this.getBoundingForNodes(t),e.pos[0]=t.x,e.pos[1]=t.y,e.size[0]=t.width,e.size[1]=t.height,null!=(e=this._canvas)&&e.drawBackCanvas()}onGroupAdd(e){var t=this.getSelecteds();0!==t.length&&this.resetGroupSizeForNodes(e,t)}getMousePos(e){return this._canvas.convertEventToCanvasOffset({clientX:(e||this.runScene.events.mouse.moveEvent).clientX-100,clientY:(e||this.runScene.events.mouse.moveEvent).clientY})}focus(e){const t={x:0,y:0},n={x:0,y:0};var r,i,a,s,o;e._nodes?(e.recomputeInsideNodes(),s=e._nodes,({x:s,y:o,width:i,height:r}=this.getBoundingForNodes(s)),i=((a=this.getContentData()).width-i)/2,a=(a.height-r)/2,t.x=this._canvas.ds.offset[0],t.y=this._canvas.ds.offset[1],n.x=i-s,n.y=a-o):([r,i]=e.pos,[s,a]=e.size,s=((o=this.getContentData()).width-s)/2,o=(o.height-a)/2,t.x=this._canvas.ds.offset[0],t.y=this._canvas.ds.offset[1],n.x=s-r,n.y=o-i,this.setSelect(e,!1)),(0,b.gY)(t,n,.3,(e=>{this._canvas.ds.offset[0]=e.x,this._canvas.ds.offset[1]=e.y,this._canvas.dirty_canvas=!0,this._canvas.dirty_bgcanvas=!0,this._resize()}),(()=>{this._canvas.dirty_canvas=!0,this._canvas.dirty_bgcanvas=!0,this._resize()}))}_resize(){this._canvas.ds.computeVisibleArea(this._canvas.viewport),this._canvas.drawFrontCanvas(),this._canvas.drawBackCanvas()}getContentData(){this._canvas.ds.computeVisibleArea(this._canvas.viewport);var[e,t,n,r]=this._canvas.ds.visible_area;return{x:e,y:t,width:n,height:r}}replaceStr(e){const{oldStr:t,newStr:n,nodes:r}=e;r.map((e=>{e.widgets.map((e=>{var r;"text"===e.type&&null!=(r=e.value)&&r.includes(t)&&(e.value=e.value.replace(t,n))}))}))}getRunData(e){return this.runData||{runWay:(null==e?void 0:e.title)||"蓝图",lastTriggerMap:new m.Z,runState:!1,ignorelastTriggers:[],peddingMap:new m.Z}}resetRunData(){this.runData=this.getRunData()}getGroups(){return this._graph._groups||[]}getNodes(){return this._graph._nodes||[]}searchNodeByStr(e){const t=e.toLocaleLowerCase(),n=[];return G.F6.filter(this.getNodes().map((e=>{var r;for(const i of e.widgets)if(null!=(r=i.value)&&r.toString().toLocaleLowerCase().includes(t))return void n.push(e)}))),n}searchGroupByStr(e){const t=e.toLocaleLowerCase(),n=[];return G.F6.filter(this.getGroups().map((e=>{e.title.toLocaleLowerCase().includes(t)&&n.push(e)}))),n}createRunData(){return fe.getRunData()}getStatesMap(){return ee.stateMap}}zn.callBack={mounted:new d.Z,loaded:new d.Z,runtime:fe.callBack,inited:new d.Z,setState:new d.Z,tools:{notice:new d.Z},ui:{button:new d.Z},data:{setBoolean:new d.Z}},Re=n(5330);var Vn=n(4380);const Hn=new s.Raycaster,Wn=new s.Vector3,Gn=new s.Vector3,Kn=new s.Quaternion,Zn={X:new s.Vector3(1,0,0),Y:new s.Vector3(0,1,0),Z:new s.Vector3(0,0,1)},qn={type:"change"},Xn={type:"mouseDown",mode:null},Yn={type:"objectChange"};class Qn extends Re.Ys{constructor(e,t,n){super(e,t),this.modelMap=new m.Z,this.draggingchanged=e=>{if(e.value)this.saveV3(this.modelMap.map(((e,t)=>t.model)));else{const t=$n[this.mode];e=G.F6.filter(this.v3Map.map(((e,n)=>{var r=n.model;if(n=n[t])return new Vn.Z({target:r,info:t,newV3:this.runScene.modelEx.cloneV3(r[t]),oldV3:n,runScene:this.runScene})}))),this.runScene.undoEx.addUndo(e)}},this.v3Map=new m.Z,this.saveV3=e=>{if(this.v3Map.clear(),this.mode){const t=$n[this.mode];e.map((e=>{const n={model:e};n[t]=e[t].clone(),this.v3Map.set((0,Ye.Ki)(e),n)}))}},this.updateMatrixWorld=()=>{var e=this.space;const t=this;if(1===this.modelMap.size||"local"===e)return super.updateMatrixWorld();this.modelMap.map(((e,n)=>{const r=n.model;r.updateMatrixWorld(),null!==r.parent&&(r.parent.matrixWorld.decompose(n._parentPosition,n._parentQuaternion,n._parentScale),r.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),n._parentQuaternionInv.copy(n._parentQuaternion).invert(),n._worldQuaternionInv.copy(n.worldQuaternion).invert())})),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(t)},this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.Vector2,this.runScene=n,this.deleteRedundantParts(),this.addEventListener("dragging-changed",this.draggingchanged)}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),this.parentDown(e))}parentDown(e){var t=this.space;const n=this;if(1===this.modelMap.size||"local"===t)return super.pointerDown(e);if(void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis){Hn.setFromCamera(e,this.camera);const t=Jn(n._plane,Hn,!0);t&&this.modelMap.map(((e,r)=>{r.model.updateMatrixWorld(),r.model.parent.updateMatrixWorld(),r._positionStart.copy(r.model.position),r._quaternionStart.copy(r.model.quaternion),r._scaleStart.copy(r.model.scale),r.model.matrixWorld.decompose(r.worldPositionStart,n.worldQuaternionStart,n._worldScaleStart),r.pointStart.copy(t.point).sub(r.worldPositionStart)})),n.dragging=!0,Xn.mode=n.mode,n.dispatchEvent(Xn)}}parentMove(e){const t=this,n=this.axis,r=this.mode;var i=this.object;let a=this.space;if(1===this.modelMap.size||"local"===a)return super.pointerMove(e);const s=this.modelMap.toArray("value");if("scale"===r?a="local":"E"!==n&&"XYZE"!==n&&"XYZ"!==n||(a="world"),void 0!==i&&null!==n&&!1!==this.dragging&&-1===e.button){Hn.setFromCamera(e,this.camera);const i=Jn(t._plane,Hn,!0);i&&(s.map((e=>{e.pointEnd.copy(i.point).sub(e.worldPositionStart);const s=e.model;if("translate"===r)e._offset.copy(e.pointEnd).sub(e.pointStart),"local"===a&&"XYZ"!==n&&e._offset.applyQuaternion(e._worldQuaternionInv),-1===n.indexOf("X")&&(e._offset.x=0),-1===n.indexOf("Y")&&(e._offset.y=0),-1===n.indexOf("Z")&&(e._offset.z=0),("local"===a&&"XYZ"!==n?e._offset.applyQuaternion(e._quaternionStart):e._offset.applyQuaternion(e._parentQuaternionInv)).divide(e._parentScale),s.position.copy(e._offset).add(e._positionStart),t.translationSnap&&("local"===a&&(s.position.applyQuaternion(Kn.copy(e._quaternionStart).invert()),-1!==n.search("X")&&(s.position.x=Math.round(s.position.x/t.translationSnap)*t.translationSnap),-1!==n.search("Y")&&(s.position.y=Math.round(s.position.y/t.translationSnap)*t.translationSnap),-1!==n.search("Z")&&(s.position.z=Math.round(s.position.z/t.translationSnap)*t.translationSnap),s.position.applyQuaternion(t._quaternionStart)),"world"===a&&(s.parent&&s.position.add(Wn.setFromMatrixPosition(s.parent.matrixWorld)),-1!==n.search("X")&&(s.position.x=Math.round(s.position.x/t.translationSnap)*t.translationSnap),-1!==n.search("Y")&&(s.position.y=Math.round(s.position.y/t.translationSnap)*t.translationSnap),-1!==n.search("Z")&&(s.position.z=Math.round(s.position.z/t.translationSnap)*t.translationSnap),s.parent&&s.position.sub(Wn.setFromMatrixPosition(s.parent.matrixWorld))));else if("scale"===r){if(-1!==n.search("XYZ")){let t=e.pointEnd.length()/e.pointStart.length();e.pointEnd.dot(e.pointStart)<0&&(t*=-1),Gn.set(t,t,t)}else Wn.copy(e.pointStart),Gn.copy(e.pointEnd),Wn.applyQuaternion(e._worldQuaternionInv),Gn.applyQuaternion(e._worldQuaternionInv),Gn.divide(Wn),-1===n.search("X")&&(Gn.x=1),-1===n.search("Y")&&(Gn.y=1),-1===n.search("Z")&&(Gn.z=1);s.scale.copy(e._scaleStart).multiply(Gn),t.scaleSnap&&(-1!==n.search("X")&&(s.scale.x=Math.round(s.scale.x/t.scaleSnap)*t.scaleSnap||t.scaleSnap),-1!==n.search("Y")&&(s.scale.y=Math.round(s.scale.y/t.scaleSnap)*t.scaleSnap||t.scaleSnap),-1!==n.search("Z")&&(s.scale.z=Math.round(s.scale.z/t.scaleSnap)*t.scaleSnap||t.scaleSnap))}else if("rotate"===r){e._offset.copy(e.pointEnd).sub(e.pointStart);var o=20/t.worldPosition.distanceTo(Wn.setFromMatrixPosition(t.camera.matrixWorld));if("E"===n?(t.rotationAxis.copy(t.eye),t.rotationAngle=e.pointEnd.angleTo(e.pointStart),t._startNorm.copy(e.pointStart).normalize(),t._endNorm.copy(e.pointEnd).normalize(),t.rotationAngle*=t._endNorm.cross(t._startNorm).dot(t.eye)<0?1:-1):"XYZE"===n?(t.rotationAxis.copy(e._offset).cross(t.eye).normalize(),t.rotationAngle=e._offset.dot(Wn.copy(t.rotationAxis).cross(t.eye))*o):"X"!==n&&"Y"!==n&&"Z"!==n||(t.rotationAxis.copy(Zn[n]),Wn.copy(Zn[n]),"local"===a&&Wn.applyQuaternion(e.worldQuaternion),t.rotationAngle=e._offset.dot(Wn.cross(t.eye).normalize())*o),t.rotationSnap&&(t.rotationAngle=Math.round(t.rotationAngle/t.rotationSnap)*t.rotationSnap),"local"===a&&"E"!==n&&"XYZE"!==n)s.quaternion.copy(e._quaternionStart),s.quaternion.multiply(Kn.setFromAxisAngle(t.rotationAxis,t.rotationAngle)).normalize();else{const n=e.model;t.rotationAxis.applyQuaternion(e._parentQuaternionInv),n.quaternion.copy(Kn.setFromAxisAngle(t.rotationAxis,t.rotationAngle)),n.quaternion.multiply(e._quaternionStart).normalize()}}})),this.dispatchEvent(qn),this.dispatchEvent(Yn))}}pointerMove(e){if(this.parentMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}addModel(e){this.modelMap.clear();const t=G.F6.toArr(e).filter((e=>!(0,Pt.N)(e)));t.map((e=>{this.modelMap.set((0,Ye.Ki)(e),{model:e,_positionStart:new s.Vector3,_quaternionStart:new s.Quaternion,_scaleStart:new s.Vector3,pointStart:new s.Vector3,worldPositionStart:new s.Vector3,_worldQuaternionInv:new s.Quaternion,pointEnd:new s.Vector3,_offset:new s.Vector3,_parentScale:new s.Vector3,_parentQuaternionInv:new s.Quaternion,_parentQuaternion:new s.Quaternion,_parentPosition:new s.Vector3,worldQuaternion:new s.Quaternion})})),this.attach((0,a.lastArrayEle)(t))}}function Jn(e,t,n){var r=t.intersectObject(e,!0);for(let e=0;e<r.length;e++)if(r[e].object.visible||n)return r[e];return!1}const $n={translate:"position",rotate:"rotation",scale:"scale"};class er{constructor(e){this.transControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.enable=!0,this.modelNewVal=new l.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.isMoveing=!1,this.inited=()=>{this.runScene.helperEx.setHelper(this.transControls,!0),this.runScene.cb.multipSelect.add.add("transContro",(()=>{this.runScene.events.key.ctrl&&(this.close(),this.removeFocus())})),this.runScene.cb.events.key.up.add("transContro",(({key:e})=>{"ctrl"!==e&&"control"!==e||!1!==this.transControls.enabled||(this.open(),this.addObjects(this.runScene.multipSelector.getSelectedList("value")))})),this.runScene.cb.multipSelect.add.add("transcontro",(()=>{this.focus()})),this.runScene.cb.model.setSelect.add("transcontro",this.focus)},this.focus=e=>{var t=this.runScene.modelEx.getSelectedModels();this.addObjects(e?[e]:t)},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t;if(this.isMoveing=e.value,this.transControls.enabled&&this.enable){er.callback.changed.cb(e);var n=this.runScene.assetsEx.get().controls,r=this.controlsMode;let i=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();i&&(i.onMatrixWorldNeedsUpdate=e.value,this.runScene.multipSelector.draggingchanged(e),null!=(t=i.onDragChanged)&&t.call(i),n.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(i[r]),this.isDraggingChange=!0):this.isDraggingChange=!1,this.runScene.assetsEx.get().controls.enabled=!e.value)}},(this.runScene=e).cb.inited.add("transContro",this.inited)}init(){const{camera:e,scene:t,engineDom:n}=this.runScene.assetsEx.get();this.transControls=new Qn(e,n,this.runScene),this.transControls.addEventListener("dragging-changed",this.draggingChanged),this.transControls.addEventListener("change",this.changing.bind(this)),this.transControls.name="helper",t.add(this.transControls),this.transControls.traverse((e=>{e.isHelper=!0,e.keepUpdate=!0})),this.close()}changeMode(e){this.controlsMode=e,this.transControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.transControls.setSize(e?this.transControls.size+.1:Math.max(this.transControls.size-.1,.1))}changeState(e){this.transControls.enabled=e}addObjects(e){0!==(e=e.filter((e=>!1===e.changeMatrixable?(this.close(),void this.removeFocus()):e))).length&&(this.openChild(),this.transControls.addModel(e))}openChild(){this.transControls.traverse((e=>{e.matrixAutoUpdate=!0,e.matrixWorldNeedsUpdate=!0,e.enabled=!0}))}addObject(e){if(!1===e.changeMatrixable)return this.close(),void this.removeFocus();this.openChild(),this.transControls.addModel(e)}removeFocus(){this.transControls.detach()}changeSpaceState(){this.transControls.setSpace("local"===this.transControls.space?"world":"local"),this.transControls.detach()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.transControls.setSpace(e);var t=this.runScene.modelEx.getSelectedModels();0!==t.length&&("local"===e?(e=t[0],this.runScene.modelEx.selectNull(),this.runScene.modelEx.setSelectByModel(e),this.addObject(e)):this.addObjects(t))}changing(e){var t;this.transControls.enabled&&this.enable&&((t=this.runScene.modelEx.select)&&(this.runScene.modelEx.onDraging(t),this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t),this.runScene.cb.model.setVector3.cb({type:"position",model:t})),this.runScene.multipSelector.transChange(),this.runScene.cb.tranControls.changing.cb(t))}close(){this.transControls.enabled=!1,this.transControls.traverse((e=>{e.matrixAutoUpdate=!1,e.matrixWorldNeedsUpdate=!1,e.enabled=!1}))}open(){this.transControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.transControls&&(this.transControls.removeEventListener("dragging-changed",this.draggingChanged),this.transControls.removeEventListener("change",this.changing),this.transControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.transControls))}}er.callback={changing:new d.Z,changed:new d.Z};const tr=er;class nr{constructor(e){this.list=new m.Z,this.add=e=>{"editor"===(0,K.F)(this.runScene).mode&&(this.list.has(e.id)&&(this.list.delete(e.id),this.runScene.cb.msg.del.cb({id:e.id})),this.list.set(e.id,e))},this.del=e=>{"editor"===(0,K.F)(this.runScene).mode&&this.list.delete(e.id)},this.clean=()=>{this.list.clear()},(this.runScene=e).cb.msg.add.add("msg-add",this.add),e.cb.msg.del.add("msg-del",this.del),e.cb.clean.add("msg",this.clean)}static getCallbackMap(){return{add:new d.Z,del:new d.Z}}}class rr{constructor(e){this.all=0,this.set=e=>{var{size:e,isAdd:t,type:n}=e;t?this.all+=e:this.all-=e,this.runScene.cb.msg.add.cb({tipType:"info",type:"size",id:"size",data:[{isAdd:t,now:e,all:this.all,subType:n}]})},(this.runScene=e).cb.unique.geometry.add.add("size-add",(({geometry:t})=>{this.set({size:e.uniqueEx.geometry.getSize(t),isAdd:!0,type:"geometry"})})),e.cb.texture.add.add("size-del",(e=>{this.set({size:(0,gn.getTextureSize)(e),isAdd:!0,type:"texture"})})),e.cb.texture.remove.add("size-del",(e=>{this.set({size:(0,gn.getTextureSize)(e),isAdd:!1,type:"texture"})}))}}rr.getCallBack=()=>({add:new d.Z,del:new d.Z});var ir=n(6006),ar=n(1549);class sr extends r.Z{constructor(){super(...arguments),this.resize=new d.Z,this.renderEx={before:new d.Z,setSize:new d.Z,after:new d.Z,fristFrame:new d.Z,setRenderPipe:new d.Z},this.assets={manager:{set:new d.Z}},this.size=rr.getCallBack(),this.onSizeChange=new d.Z,this.setSelectMaterial=new d.Z,this.setScene=new d.Z,this.reset=new d.Z,this.render=new d.Z,this.tick=new d.Z,this.controls={change:new d.Z,autoRotate:{pause:new d.Z,resume:new d.Z}},this.baseLog=new d.Z,this.inited=new d.Z,this.texture={add:new d.Z,remove:new d.Z,setMaterial:new d.Z,set:new d.Z,setInfo:new d.Z,setAnima:new d.Z,resize:new d.Z,multip:ir.Z.callBack,onLoaded:new d.Z},this.multipSelect={add:new d.Z},this.model={event:{onTrigger:new d.Z},parse:new d.Z,setVector3:new d.Z,multiSelect:{setEmpty:new d.Z},change:new d.Z,setChange:new d.Z,onChange:new d.Z,setSelect:new d.Z,click:new d.Z,add:new d.Z,validAddAndReplaceParent:new d.Z,remove:new d.Z,multipDrop:new d.Z,focus:new d.Z,unFocus:new d.Z,changeName:new d.Z,setOpen:new d.Z,setMainStatue:new d.Z,setVisible:new d.Z,setParent:new d.Z,setLayers:new d.Z,setOutline:new d.Z,clone:new d.Z,dispose:new d.Z,validRemove:new d.Z,bindCloneModel:new d.Z,onSetInfo:new d.Z},this.material={add:new d.Z,remove:new d.Z,dispose:new d.Z,setName:new d.Z},this.unique={model:{add:new d.Z,remove:new d.Z},material:{add:new d.Z,setTimecited:new d.Z},texture:{setTimecited:new d.Z},geometry:ar.ZP.getCallBack()},this.tranControls=tr.callback,this.undo={undo:new d.Z,redo:new d.Z,addUndos:new d.Z,addRedus:new d.Z,removeUndos:new d.Z,undoByIndex:new d.Z,reset:new d.Z,normal:{valid:new d.Z}},this.scene={save:new d.Z,saveNet:new d.Z,setEnvStrength:new d.Z,validCloseUpdate:new d.Z},this.timeLine={setProgress:new d.Z,onSetProgress:new d.Z,playGroup:new d.Z,setGroupMap:new d.Z,reset:new d.Z,closeGroup:new d.Z,onDone:new d.Z},this.events={key:{down:new d.Z,up:new d.Z},mouse:{move:new d.Z,down:new d.Z,up:new d.Z,wheel:new d.Z},pointer:{rightTrigger:new d.Z,down:new d.Z,up:new d.Z,move:new d.Z,trigger:new d.Z},window:{pointer:x.getCallback()},model:{addOptions:new d.Z}},this.pp={glow:{setData:new d.Z,setStatus:new d.Z},outline:{setData:new d.Z,setStatus:new d.Z},ao:{setData:new d.Z,setStatus:new d.Z},vignette:{setData:new d.Z,setStatus:new d.Z}},this.load={getJSON:new d.Z,progress:new d.Z,complete:new d.Z,modelAdded:new d.Z,loaded:new d.Z},this.exporter={gltf:{options:{add:new d.Z,afterParse:new d.Z},before:new d.Z,complete:new d.Z,sizeMap:new d.Z,assets:{bindTexture:new d.Z}}},this.loaderer={gltf:{loadNode:new d.Z,lazyLoadedTexture:new d.Z,loaded:new d.Z,modelLoaded:new d.Z,progress:new d.Z,getJSON:new d.Z,getArrayBuffer:new d.Z,complete:new d.Z,modelAdded:new d.Z,material:{load:new d.Z,afterParseNromal:new d.Z}}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new d.Z),e[t])}),this.tags={parseJSON:new d.Z,clear:new d.Z},this.snapshot={create:new d.Z,set:new d.Z,resetItem:new d.Z,rmItem:new d.Z,delete:new d.Z,getLength:new d.Z,getByType:new d.Z,parseJSON:new d.Z,setName:new d.Z,delUseless:new d.Z,beforeCreate:new d.Z,onDone:new d.Z},this.clean=new d.Z,this.objects={sky:{setState:new d.Z}},this.error=new d.Z,this.camera={set:new d.Z},this.msg=nr.getCallbackMap(),this.graph=zn.callBack,this.dispatch={scopedKeyEvent:new d.Z},this.setUpdate=new d.Z,this.anima=h.callback}}var or=n(8881);function lr(e){return(lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ur(e){return(ur=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cr(e,t){return(cr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var dr=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t){if(this instanceof n)return(e=function(e,t,n){t=ur(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],ur(e).constructor):t.apply(e,n))&&("object"===lr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n,[e,t])).screenSpacePanning=!1,e.mouseButtons={LEFT:or.MOUSE.PAN,MIDDLE:or.MOUSE.DOLLY,RIGHT:or.MOUSE.ROTATE},e.touches={ONE:or.TOUCH.PAN,TWO:or.TOUCH.DOLLY_ROTATE},e;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cr(t,e),t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(n(9219).z),hr=n(3736);const pr={autoRotate:!1,autoRotateSpeed:2,dampingFactor:.05,enableDamping:!1,enablePan:!0,enableRotate:!0,enableZoom:!0,maxAzimuthAngle:1/0,maxDistance:1/0,maxPolarAngle:Math.PI,minAzimuthAngle:-1/0,minDistance:0,minPolarAngle:0,panSpeed:1,rotateSpeed:1,screenSpacePanning:!1,zoomSpeed:1,target:{x:0,y:0,z:0},reverseMouse:!1,zoomFocus:!1};class fr{constructor(e){this.inited=()=>{const e=this.runScene.assetsEx.get().controls;e.addEventListener("change",this.change),e.addEventListener("start",(()=>{this.runScene.cb.controls.autoRotate.pause.cb(),this.isStart=!0})),e.addEventListener("end",(()=>{this.isStart=!1,this.onEnd()})),this.runScene.exporter.gltf.options.addOption({type:"controls",process:()=>{const t=(0,u.getDiff)(pr,e);return t.autoDelay=this.getAutoDelay(),t.reverseMouse=this.reverseMouse,e.zoomToCursor&&(t.zoomToCursor=e.zoomToCursor),JSON.stringify(t)},parse:e=>{e&&this.parse(JSON.parse(e))}})},this.onWheel=e=>{},this.change=e=>{this.runScene.cb.controls.change.cb(e)},this.parse=e=>{const t=this.runScene.assetsEx.get().controls;(0,a.mapObj)(e,((e,n)=>{"autoDelay"===e?this.setAutoDelay(n):"reverseMouse"===e?this.setReverseMouse(n):void 0!==n&&(G.YD.is(n)?t[e].set(n.x,n.y,n.z):t[e]=n,"zoomToCursor"===e&&this.setZoomFocus(n))})),t.update()},this.isStart=!1,this.autoDelay=0,this._autoDelayCallbackTimer=null,this.onEnd=()=>{0!==this.autoDelay&&(this.runScene.assetsEx.get().controls.autoRotate=!1,this._autoDelayCallback())},this.reverseMouse=!1,(this.runScene=e).cb.inited.add("controls",this.inited)}reset(){this.parse(pr)}create(e,t){return new dr(e,t)}static toJSON(e){return e.target}static setTarget(e,t,n){var{x:r,y:i,z:a}=t,{x:n,y:s,z:o}=n||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:n,y:s,z:o},{x:r,y:i,z:a},.5,(t=>{var{x:n,y:r,z:i}=t;e.target.set(n,r,i),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}clearAutoDelay(){delete this.runScene.assetsEx.get().camera.userData.autoDelay,this.autoDelay=0,this.clearAutoDelayCallback()}setAutoDelay(e){var t;0===e?this.clearAutoDelay():(this.onEnd(),t=this.runScene.assetsEx.get().camera,(0,hr.M)(t,"autoDelay",e),this.autoDelay=e,this._autoDelayCallback())}setAutoRotate(e){(this.runScene.assetsEx.get().controls.autoRotate=e)||this.clearAutoDelay()}clearAutoDelayCallback(){clearTimeout(this._autoDelayCallbackTimer)}_autoDelayCallback(){this._autoDelayCallbackTimer&&this.clearAutoDelayCallback(),this._autoDelayCallbackTimer=setTimeout((()=>{if(this.isStart)return this._autoDelayCallback();this.runScene.cb.controls.autoRotate.resume.cb(),this.setAutoRotate(!0)}),1e3*this.autoDelay)}closeAutoRotate(){this.setAutoRotate(!1),this.autoDelay=0}getAutoDelay(){var e=this.runScene.assetsEx.get().camera;return(0,hr.is)(e,"autoDelay")||0}setReverseMouse(e){this.reverseMouse=e;const t=this.runScene.assetsEx.get().controls;var[n,r]=e?[2,0]:[0,2];t.mouseButtons.LEFT=n,t.mouseButtons.RIGHT=r,t.touches.ONE=e?1:0,t.touches.TWO=e?3:2}setZoomFocus(e=!0){this.runScene.assetsEx.get().controls.zoomToCursor=e}}fr.setTargetData={anima:null,nowData:null};class mr{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new m.Z,this.specialKeyDebounce=()=>{this.ctrl=!1,this.shift=!1,this.alt=!1},this.fns={down:{s:e=>{this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene())},d:e=>{this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel())},escape:()=>{this.events.runScene.modelEx.selectNull()},alt:()=>{this.alt=!0,this.blurInput()},control:()=>{this.ctrl=!0,this.blurInput()},ctrl:()=>{this.ctrl=!0,this.blurInput()},shift:()=>{this.shift=!0,this.blurInput()},f11:()=>{this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize())},w:()=>{this.events.runScene.helperEx.transContro.changeMode("position")},e:()=>{this.events.runScene.helperEx.transContro.changeMode("rotation")},f:()=>{this.allFn.f_focusModel()},delete:()=>{this.events.runScene.helperEx.unfocus();const e=this.events.runScene.modelEx.getSelectedModels();this.events.runScene.sceneEx.remove(e.filter((e=>{if(!1!==e.isDeletable||0!==e.models.length)return e;this.events.runScene.optionsEx.log("该模型不可被删除","base","info")})))},z:e=>{e.preventDefault(),this.ctrl&&this.allFn.z_undo(e)},y:e=>{this.ctrl&&this.allFn.y_redo(e)},r:()=>{this.events.runScene.helperEx.transContro.changeMode("scale")}},up:{s:()=>{this.ctrl},alt:()=>{this.alt=!1,this.specialKeyDebounce()},control:()=>{this.ctrl=!1,this.specialKeyDebounce()},ctrl:()=>{this.ctrl=!1,this.specialKeyDebounce()},shift:()=>{this.shift=!1,this.specialKeyDebounce()}}},this.allFn={s_saveScene:()=>function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),this.events.runScene.cb.scene.saveNet.cb("")})),d_copyModel:()=>{var e=this.events.runScene.modelEx.select;if(e){this.events.runScene.modelEx.selectNull();var t=this.events.runScene.modelEx.clone(e,!1);t&&this.events.runScene.modelEx.add(t,e.parent,{isClone:!0,select:!0})}else{const e=this.events.runScene.multipSelector.getSelectedList("value");if(e.length){const n=G.F6.filter(e.map((e=>{const t=this.events.runScene.modelEx.clone(e,!1);return t&&(t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale)),{model:t,parent:e.parent}})));if(!n.length)return;t=n.map((({model:e,parent:t})=>this.events.runScene.modelEx.add(e,t,{addUndo:!1,isClone:!0}))),this.events.runScene.multipSelector.clearAfterAdd(n.map((e=>e.model)),!0),this.events.runScene.undoEx.addUndo(t)}}},f_focusModel:()=>{var e;(e=(e=this.events.runScene.modelEx.getSelectedModels())[this.events.runScene.multipSelector.focusIndex++]||e[0])&&this.events.runScene.modelEx.focus(e,{inputBoxHelper:this.events.runScene.multipSelector.boxHelperMap[e.uuid]})},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(this.events.addEvent({dom:window,name:"keydown",fn:this.keyDown.bind(this)}),this.events.addEvent({dom:window,name:"keyup",fn:this.keyUp.bind(this)}),this.events.addEvent({dom:window,name:"blur",fn:this.specialKeyDebounce}),this.events.runScene.cb.dispatch.scopedKeyEvent.add("event",(e=>{var t;e.key&&null!=(e=(t=this.fns.up)[e.key.toLocaleLowerCase()])&&e.call(t)})))}keyDown(e){var t,n;"INPUT"!==document.activeElement.nodeName&&(n=e.key.toLowerCase(),this.events.runScene.cb.events.key.down.cb({key:n,event:e}),this.unExec.get(n)||null!=(n=(t=this.fns.down)[n])&&n.call(t,e))}keyUp(e){var t,n;"INPUT"!==document.activeElement.nodeName&&(n=e.key.toLowerCase(),this.events.runScene.cb.events.key.up.cb({key:n,event:e}),this.unExec.get(n)||null!=(n=(t=this.fns.up)[n])&&n.call(t,e))}setUnExec(e){var{name:e,key:t,state:n}=e;let r=this.unExec.get(t);r||this.unExec.set(t,r=new m.Z),n?r.set(e,n):r.delete(e),0===r.size&&this.unExec.delete(t)}blurInput(){var e;"INPUT"===(null==(e=document.activeElement)?void 0:e.nodeName)&&document.activeElement.blur()}}class gr{constructor(e){this.options=new m.Z,this.enable=!0,this.lockData=new m.Z,this.foucedModel=new Et.Z,this.eventsState={click:!0,hover:!0,mouseLeave:!0},this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.hoverModel=new Et.Z,this.map={click:new m.Z,hover:new m.Z,mouseLeave:new m.Z},this.onClick=e=>{var t,n;this.enable&&this.eventsState.click&&(t=(0,Ye.Ki)(e))&&(n=this.map.click.get(t))&&this.triggerEvent({model:e,method:"click",saved:n,id:t})},this.onHover=e=>{var t,n;!this.eventsState.hover||(t=(0,Ye.Ki)(e))&&(n=this.map.hover.get(t))&&!this.foucedModel.has(t)&&(console.log("Log-- ",this.hovered,t,(0,Ye.Ki)(this.hovered),"his.hovered"),this.hovered&&t!==(0,Ye.Ki)(this.hovered)&&(this.onMouseLeaveByModel(this.hovered),this.hovered=void 0),this.events.runScene.optionsEx.log([e,"移入"],"detail"),this.triggerEvent({model:e,saved:n,method:"hover",id:t}),this.onFouce(t,e))},this.onMouseLeave=()=>{this.eventsState.mouseLeave&&this.events.runScene.modelEx.getById(this.foucedModel.toArray()).map((e=>{this.onMouseLeaveByModel(e)}))},this.events=e}setState(e){this.enable=e}setEventState(e,t){this.eventsState[e]=t}copy(e){this.copyData=e}paste(e){this.copyData&&e.map((e=>{var{method:t,child:n,type:r}=this.copyData;this.set({model:e,type:r,method:t,child:n})}))}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions),this.events.runScene.cb.unique.model.add.add("event-model",(({model:e})=>{var t;null!=(t=e.userData.events)&&t.map((t=>{var[t,n,r]=t.split("-");this.set({model:e,method:t,child:r,type:n})}))})),(new s.MeshBasicMaterial).color=new s.Color("#00ff00"),this.events.runScene.cb.events.pointer.move.add("get-hover-from-models",(0,a.fnDebounce)((e=>{if(0!==this.hoverModel.size&&this.enable){const r=new s.Raycaster;var{camera:t,renderer:n}=this.events.runScene.assetsEx.get(),{x:n,y:e}=this.events.mouse.getEventLocal(n.domElement,e),n=new s.Vector2(n,e);r.setFromCamera(n,t);const i=r.intersectObjects(G.F6.filter(this.hoverModel.toArray().map((e=>(0,lt.pn)(e)&&e))),!0);0===i.length?this.onMouseLeave():(e=i.filter((e=>null==(e=e.object)?void 0:e.visible)),this.onHover(this.toTruthModel(e[0])))}}),10)),this.events.runScene.cb.snapshot.setName.add("event-model",(({oldName:e,name:t})=>{(0,a.mapObj)(this.map,((n,r)=>{r.map(((r,i)=>{const a=i.get("snapshot");(i=this.events.runScene.modelEx.getById(r))&&a&&a.has(e)&&(this.del({model:i,type:"snapshot",child:e,method:n}),this.set({model:i,type:"snapshot",child:t,method:n}))}))}))}))}del(e){const{model:t,type:n,child:r,method:i}=e;var a=(0,Ye.Ki)(t);if(a){let s=this.map[i].get(a);if(s){let a=s.get(n);a&&("hover"===i&&this.hoverModel.delete(this.hoverModel.find((e=>(0,Ye.Ki)(e)===(0,Ye.Ki)(t)))),a.remove(r),this.bindDataForModel(e,!1))}}}delAll(e){const{model:t,type:n,name:r}=e,i=(0,Ye.Ki)(t);if(i){const e=[];(0,a.mapObj)(this.map,((a,s)=>{s.map(((s,o)=>{if(s===i){const i=o.get(n);null!=i&&i.has(r)&&(i.delete(r),e.push({model:t,type:n,method:a,child:r}))}}))})),e.map((e=>this.bindDataForModel(e,!1)))}}set(e){const{model:t,type:n,child:r,method:i}=e;var a=(0,Ye.Ki)(t);if(a){let s=this.map[i],o=s.get(a),l=(o||(o=new m.Z,s.set(a,o)),o.get(n));l||(l=new Et.Z,o.set(n,l)),"hover"!==i||this.hoverModel.find((e=>(0,Ye.Ki)(e)===(0,Ye.Ki)(t)))||this.hoverModel.add(t),l.add(r),this.bindDataForModel(e)}}bindDataForModel(e,t=!0){const{model:n,type:r,child:i,method:a}=e;let s=n.userData.events;s||(n.userData.events=s=[]);const o=a+"-"+r+"-"+i;-1===(e=s.findIndex((e=>e===o)))?t&&s.push(o):t||s.splice(e,1)}hasEvent(e){const{model:t,method:n,type:r,child:i}=e,a=[n,r,i].join("-");return!!t.userData.events&&-1!==t.userData.events.findIndex((e=>e===a))}validCanBeTrigger(e,t){return null==(e=this.lockData.get(e))||!e.has(t)}triggerEvent(e){console.log("Log-- ",e,"map");const{model:t,id:n,saved:r}=e;c.closeModelEvent.is(t)||(r.map(((e,r)=>{if(!this.validCanBeTrigger(n,e))return this.events.runScene.optionsEx.log("该目标正在执行中","base"),void this.setLock({id:n,type:e,isAdd:!1});if(t.isModelBase?t.isHide:!t.visible)return this.events.runScene.optionsEx.log("该目标已被隐藏","base"),void this.setLock({id:n,type:e,isAdd:!1});const i=this.options.get(e);i&&(this.setLock({id:n,type:e,isAdd:!0}),i.parse({model:t,childs:r.toArray()}).then((()=>{this.setLock({id:n,type:e,isAdd:!1})})))})),this.events.runScene.cb.model.event.onTrigger.cb(e))}getModelIdsByDta(e,t){const n=new Et.Z;return(0,a.mapObj)(this.map,((r,i)=>{i.map(((r,i)=>{const a=i.get(e);a&&a.has(t)&&n.add(r)}))})),n}hasLockByMethod(e){for(const t of Object.values(this.lockData.toArray("value")))if(t.has(e))return!0;return!1}setLock(e){var{id:e,type:t,isAdd:n}=e;let r=this.lockData.get(e);r||(r=new Et.Z,this.lockData.set(e,r)),n?r.add(t):r.delete(t)}onFouceAfter(){this.foucedModel.map((e=>{this.getLockStatus({id:e,methods:"hover"})||this.onMouseLeaveByModel(this.events.runScene.modelEx.getById(e))}))}onFouce(e,t){this.getLockStatus({id:e,methods:"hover"})||(this.hovered=t,this.onFouceAfter(),this.foucedModel.add(e))}getLockStatus(e){var{id:e,methods:t}=e;const n=this.lockData.get(e);return null==n?void 0:n.has(t)}onMouseLeaveByModel(e){var t,n;!e||(t=(0,Ye.Ki)(e))&&(this.foucedModel.delete(t),n=this.map.mouseLeave.get(t),console.log("Log-- ",this.map.mouseLeave,t,n,"saved"),n&&(this.events.runScene.optionsEx.log([e,"移出"],"detail"),this.triggerEvent({model:e,method:"mouseLeave",saved:n,id:t})))}toTruthModel(e){if(e)return"instanceModel"===e.object.type?e.object.getHelperById(e.instanceId):e.object}}function vr(e){return(vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yr(){yr=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function d(){}function h(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(p=f),h.prototype=c.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==vr(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.then(s,s):s()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var s=new v(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var s=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function br(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function xr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Sr(e,t,n){t&&wr(e.prototype,t),n&&wr(e,n),Object.defineProperty(e,"prototype",{writable:!1})}var _r={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},Tr=function(){function e(){xr(this,e),this.pluginCallbacks=[],this.register((function(e){return new Zr(e)})),this.register((function(e){return new qr(e)})),this.register((function(e){return new Qr(e)})),this.register((function(e){return new Jr(e)})),this.register((function(e){return new $r(e)})),this.register((function(e){return new ei(e)})),this.register((function(e){return new Xr(e)})),this.register((function(e){return new Yr(e)})),this.register((function(e){return new ti(e)})),this.register((function(e){return new ni(e)}))}return Sr(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){for(var i=new Kr,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),Mr=5120,Er=5121,Dr=5122,Pr=5123,kr=(Re=9728,9729),Or=9984,Ar=9985,Cr=9986,Nr=9987,Lr=33071,Ir=33648,Rr=10497,Ur="KHR_mesh_quantization",Br={},Fr=(Br[s.NearestFilter]=Re,Br[s.NearestMipmapNearestFilter]=Or,Br[s.NearestMipmapLinearFilter]=Cr,Br[s.LinearFilter]=kr,Br[s.LinearMipmapNearestFilter]=Ar,Br[s.LinearMipmapLinearFilter]=Nr,Br[s.ClampToEdgeWrapping]=Lr,Br[s.RepeatWrapping]=Rr,Br[s.MirroredRepeatWrapping]=Ir,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),jr=new s.Color;function zr(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function Vr(e){return 4*Math.ceil(e/4)}function Hr(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=Vr(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}function Wr(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function Gr(e,t){return void 0!==e.toBlob?new Promise((function(n){return e.toBlob(n,t)})):("image/jpeg"===t?n=.92:"image/webp"===t&&(n=.8),e.convertToBlob({type:t,quality:n}));var n}var Kr=function(){function e(){xr(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return Sr(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=yr().mark((function e(t,n){var r,i,a,s,o,l,u,c,d,h=arguments;return yr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=2<h.length&&void 0!==h[2]?h[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return a=(i=this).buffers,s=i.json,r=i.options,e.next=12,i.options.myOptions.helper.done(s);case 12:l=i.extensionsUsed,u=i.extensionsRequired,o=new Blob(a,{type:"application/octet-stream"}),l=Object.keys(l),u=Object.keys(u),0<l.length&&(s.extensionsUsed=l),0<u.length&&(s.extensionsRequired=u),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===r.binary?((c=new FileReader).readAsArrayBuffer(o),c.onloadend=function(){var e=Hr(c.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Hr((r=JSON.stringify(s),(new TextEncoder).encode(r).buffer),32)),i=new DataView(new ArrayBuffer(8)),a=(i.setUint32(0,r.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(a)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+i.byteLength+r.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([a,i,r,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(l),u.onloadend=function(){n(u.result)}}):s.buffers&&0<s.buffers.length?((d=new FileReader).readAsDataURL(o),d.onloadend=function(){var e=d.result;s.buffers[0].uri=e,n(s)}):n(s);case 21:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(e){br(a,r,i,s,o,"next",e)}function o(e){br(a,r,i,s,o,"throw",e)}s(void 0)}))},function(e,t){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var n=this.options,r=this.extensionsUsed;n.myOptions.helper.beforeSerializeUserData({userData:e.userData});try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(n)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,n=0,r=e.count;n<r;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),r=new s.Vector3,i=0,a=n.count;i<a;i++)r.fromBufferAttribute(n,i),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),n.setXYZ(i,r.x,r.y,r.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function n(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var r=e?e.image:null,i=t?t.image:null,a=Math.max(r?r.width:0,i?i.width:0),o=Math.max(r?r.height:0,i?i.height:0),l=Wr(),u=(l.width=a,l.height=o,l.getContext("2d")),c=(u.fillStyle="#00ffff",u.fillRect(0,0,a,o),u.getImageData(0,0,a,o));if(r){u.drawImage(r,0,0,a,o);for(var d=n(e),h=u.getImageData(0,0,a,o).data,p=2;p<h.length;p+=4)c.data[p]=256*d(h[p]/256)}if(i){u.drawImage(i,0,0,a,o);for(var f=n(t),m=u.getImageData(0,0,a,o).data,g=1;g<m.length;g+=4)c.data[g]=256*f(m[g]/256)}return u.putImageData(c,0,0),(r=(e||t).clone()).source=new s.Source(l),r.encoding=s.LinearEncoding,r}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){var a,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Mr:case Er:a=1;break;case Dr:case Pr:a=2;break;default:a=4}for(var l=Vr(r*e.itemSize*a),u=new DataView(new ArrayBuffer(l)),c=0,d=n;d<n+r;d++)for(var h=0;h<e.itemSize;h++){var p=void 0;4<e.itemSize?p=e.array[d*e.itemSize+h]:(0===h?p=e.getX(d):1===h?p=e.getY(d):2===h?p=e.getZ(d):3===h&&(p=e.getW(d)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?u.setFloat32(c,p,!0):5124===t?u.setInt32(c,p,!0):5125===t?u.setUint32(c,p,!0):t===Dr?u.setInt16(c,p,!0):t===Pr?u.setUint16(c,p,!0):t===Mr?u.setInt8(c,p):t===Er&&u.setUint8(c,p),c+=a}var f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==i&&(f.target=i),34962===i&&(f.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0,size:u.byteLength}}},{key:"processBufferViewImage",value:function(e){var t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=Hr(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r,i,a){var o=this.json;if(e.array.constructor===Float32Array)c=5126;else if(e.array.constructor===Int32Array)c=5124;else if(e.array.constructor===Uint32Array)c=5125;else if(e.array.constructor===Int16Array)c=Dr;else if(e.array.constructor===Uint16Array)c=Pr;else if(e.array.constructor===Int8Array)c=Mr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");c=Er}if(0===(r=void 0===r?e.count:r))return null;var l,u=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;i++)for(var a=0;a<e.itemSize;a++){var o=void 0;4<e.itemSize?o=e.array[i*e.itemSize+a]:(0===a?o=e.getX(i):1===a?o=e.getY(i):2===a?o=e.getZ(i):3===a&&(o=e.getW(i)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),r.min[a]=Math.min(r.min[a],o),r.max[a]=Math.max(r.max[a],o)}return r}(e,n=void 0===n?0:n,r),c=(n={bufferView:(void 0!==t&&(l=e===t.index?34963:34962),t=this.processBufferView(e,c,n,r,l)).id,byteOffset:t.byteOffset,componentType:c,count:r,max:u.max,min:u.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},null==i||null==(l=i.userData)?void 0:l.id);return c&&this.options.myOptions.helper.processGeometry({size:t.size,name:i.name,id:c,type:a}),!0===e.normalized&&(n.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(n)-1}},{key:"processImage",value:function(e,t,n,r){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,o=a.cache,l=a.json,u=a.options,c=a.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[n=i+":flipY/"+n.toString()])return o[n];l.images||(l.images=[]);var d={mimeType:i},h=Wr(),p=(h.width=Math.min(e.width,u.maxTextureSize),h.height=Math.min(e.height,u.maxTextureSize),h.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>u.maxTextureSize||e.height>u.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,h.width,h.height);return!0===u.binary?(null==r||null==(t=r.userData)?void 0:t.blob)instanceof Blob?c.push(new Promise((function(e){a.processBufferViewImage(r.userData.blob).then((function(t){d.bufferView=t,e()}))}))):c.push(Gr(h,i).then((function(e){return a.processBufferViewImage(e)})).then((function(e){d.bufferView=e}))):void 0!==h.toDataURL?d.uri=h.toDataURL(i):c.push(Gr(h,i).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){d.uri=e}))),p=l.images.push(d)-1,o[n]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Br[e.magFilter],minFilter:Br[e.minFilter],wrapS:Br[e.wrapS],wrapT:Br[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]),e.userData||(e.userData={});var r=("image/webp"===(i=(null==(i=e.userData)?void 0:i.mimeType)||"image/png")&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,i)}),i=(e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n.textures.push(r)-1);return t.textures.set(e,i),this.options.myOptions.helper.parseTexture({texture:e,textureDef:r}),i}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var r={pbrMetallicRoughness:{}},i=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:r,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),a=(zr(i,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(i=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(i)},this.applyTextureTransform(a,i),r.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(i={index:this.processTexture(e.map)},this.applyTextureTransform(i,e.map),r.pbrMetallicRoughness.baseColorTexture=i),e.emissive&&(a=e.emissive,0<Math.max(a.r,a.g,a.b)&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),r.emissiveTexture=i)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),r.normalTexture=a),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),r.occlusionTexture=i),e.transparent?r.alphaMode="BLEND":0<e.alphaTest&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)})),n.materials.push(r)-1);return t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,a=e.material.length;i<a;i++)r.push(e.material[i].uuid);else r.push(e.material.uuid);var o=r.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,u,c,d=e.geometry,h=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=d.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),d.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(u in d.attributes)"morph"!==u.slice(0,5)&&(l=d.attributes[u],u=v[u]||u.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(u)||(u="_"+u),t.attributes.has(this.getUID(l))?f[u]=t.attributes.get(this.getUID(l)):(b=null,c=l.array,"JOINTS_0"!==u||c instanceof Uint16Array||c instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new s.BufferAttribute(new Uint16Array(c),l.itemSize,l.normalized)),null!==(c=this.processAccessor(b||l,d,void 0,void 0,e,u))&&(u.startsWith("_")||this.detectMeshQuantization(u,l),f[u]=c,t.attributes.set(this.getUID(l),c))));if(void 0!==y&&d.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var _ in e.morphTargetDictionary)S[e.morphTargetDictionary[_]]=_;for(var T=0;T<e.morphTargetInfluences.length;++T){var M,E={},D=!1;for(M in d.morphAttributes)if("position"!==M&&"normal"!==M)D||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),D=!0);else{var P=d.morphAttributes[M][T],k=M.toUpperCase(),O=d.attributes[M];if(t.attributes.has(this.getUID(P,!0)))E[k]=t.attributes.get(this.getUID(P,!0));else{var A=P.clone();if(!d.morphTargetsRelative)for(var C=0,N=P.count;C<N;C++)for(var L=0;L<P.itemSize;L++)0===L&&A.setX(C,P.getX(C)-O.getX(C)),1===L&&A.setY(C,P.getY(C)-O.getY(C)),2===L&&A.setZ(C,P.getZ(C)-O.getZ(C)),3===L&&A.setW(C,P.getW(C)-O.getW(C));E[k]=this.processAccessor(A,d),t.attributes.set(this.getUID(O,!0),E[k])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===d.groups.length)return null;for(var I=y?e.material:[e.material],R=y?d.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,B=R.length;U<B;U++){var F={mode:h,attributes:f},j=(this.serializeUserData(d,F),0<g.length&&(F.targets=g),null!==d.index&&(j=this.getUID(d.index),void 0===R[U].start&&void 0===R[U].count||(j+=":"+R[U].start+":"+R[U].count),t.attributes.has(j)?F.indices=t.attributes.get(j):(F.indices=this.processAccessor(d.index,d,R[U].start,R[U].count),t.attributes.set(j,F.indices)),null===F.indices&&delete F.indices),this.processMaterial(I[R[U].materialIndex]));null!==j&&(F.material=j),m.push(F)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(o,y),y}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[Ur]){var n=void 0;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized"),t=e.split("_",1)[0],null!=(e=_r[t])&&e.includes(n)&&(this.extensionsUsed[Ur]=!0,this.extensionsRequired[Ur]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),r={type:n?"orthographic":"perspective"};return n?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,r=this.nodeMap,i=(n.animations||(n.animations=[]),(e=Tr.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],o=[],l=0;l<i.length;++l){var u=i[l],c=s.PropertyBinding.parseTrackName(u.name),d=s.PropertyBinding.findNode(t,c.nodeName),h=Fr[c.propertyName];if(!(d="bones"===c.objectName?!0===d.isSkinnedMesh?d.skeleton.getBoneByName(c.objectIndex):void 0:d)||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var p=void(h===Fr.morphTargetInfluences&&(c/=d.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(u.times,1)),output:this.processAccessor(new s.BufferAttribute(u.values,c)),interpolation:p}),a.push({sampler:o.length-1,target:{node:r.get(d),path:h}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:o,channels:a}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,r=t.nodes[n.get(e)],i=e.skeleton;if(void 0===i)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var o=[],l=new Float32Array(16*i.bones.length),u=new s.Matrix4,c=0;c<i.bones.length;++c){var d=i.bones[c];d=this.options.myOptions.helper.getNodeMapValueWithBone(d,n),o.push(d),u.copy(i.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:n.get(a)}),r.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,s=(r.nodes||(r.nodes=[]),{});if(e=i.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),i.trs?(n=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),zr(n,[0,0,0,1])||(s.rotation=n),zr(d,[0,0,0])||(s.translation=d),zr(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===zr(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(n=this.processMesh(e))&&(s.mesh=n):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];c.userData.isTemp||!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&o.push(c)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var d=r.nodes.push(s)-1;return a.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,s=e.children.length;a<s;a++){var o=e.children[a];o.userData.isTemp||!o.visible&&!1!==n.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new s.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,n,r=this.options,i=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),a=0;a<e.length;a++)e[a]instanceof s.Scene?this.processScene(e[a]):i.push(e[a]);1===i.length?(t=i[0],"model"===r.myOptions.helper.type&&((n=new s.Group).name="glb_model",n.add(t),t=n),this.processScene(t)):1<i.length&&this.processObjects(i);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<r.animations.length;++l)this.processAnimation(r.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),Zr=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Sr(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),qr=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Sr(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),Xr=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Yr=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(r=(n=this.writer).extensionsUsed,(i={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(a={index:n.processTexture(e.iridescenceMap)},n.applyTextureTransform(a,e.iridescenceMap),i.iridescenceTexture=a),i.iridescenceIor=e.iridescenceIOR,i.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(a={index:n.processTexture(e.iridescenceThicknessMap)},n.applyTextureTransform(a,e.iridescenceThicknessMap),i.iridescenceThicknessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Qr=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Jr=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_volume"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),$r=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_ior"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(n=this.writer.extensionsUsed,(r={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0)}}]),e}(),ei=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_specular"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(jr)||e.specularIntensityMap||e.specularColorTexture)&&(r=(n=this.writer).extensionsUsed,i={},e.specularIntensityMap&&(a={index:n.processTexture(e.specularIntensityMap)},n.applyTextureTransform(a,e.specularIntensityMap),i.specularTexture=a),e.specularColorMap&&(a={index:n.processTexture(e.specularColorMap)},n.applyTextureTransform(a,e.specularColorMap),i.specularColorTexture=a),i.specularFactor=e.specularIntensity,i.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ti=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!=e.sheen&&(r=(n=this.writer).extensionsUsed,i={},e.sheenRoughnessMap&&(a={index:n.processTexture(e.sheenRoughnessMap)},n.applyTextureTransform(a,e.sheenRoughnessMap),i.sheenRoughnessTexture=a),e.sheenColorMap&&(a={index:n.processTexture(e.sheenColorMap)},n.applyTextureTransform(a,e.sheenColorMap),i.sheenColorTexture=a),i.sheenRoughnessFactor=e.sheenRoughness,i.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ni=function(){function e(t){xr(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Sr(e,[{key:"writeMaterial",value:function(e,t){var n,r;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(n=this.writer.extensionsUsed,(r={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0)}}]),e}();function ri(e){return(ri="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ii(){ii=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function d(){}function h(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(p=f),h.prototype=c.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==ri(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.then(s,s):s()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",d.prototype=h),s(h,"constructor",d),d.displayName=s(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var s=new v(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var s=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function ai(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function si(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function li(e,t,n){t&&oi(e.prototype,t),n&&oi(e,n),Object.defineProperty(e,"prototype",{writable:!1})}Tr.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var o=0;o<r;o++)a[o]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),n=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*r),0),a.set(s.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],r={},i=e.tracks,a=0;a<i.length;++a){var o=i[a],l=s.PropertyBinding.parseTrackName(o.name),u=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)n.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var c=u.morphTargetInfluences.length,d=u.morphTargetDictionary[l.propertyIndex];if(void 0===d)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var h=void 0;if(void 0===r[u.uuid]){for(var p=new((h=o.clone()).ValueBufferType)(c*h.times.length),f=0;f<h.times.length;f++)p[f*c+d]=h.values[f];h.name=(l.nodeName||"")+".morphTargetInfluences",h.values=p,r[u.uuid]=h,n.push(h)}else{var m=o.createInterpolant(new o.ValueBufferType(1));h=r[u.uuid];for(var g=0;g<h.times.length;g++)h.values[g*c+d]=m.evaluate(h.times[g]);for(var v=0;v<o.times.length;v++){var y=this.insertKeyframe(h,o.times[v]);h.values[y*c+d]=o.values[v]}}}}return e.tracks=n,e}};var ui={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},ci=function(){function e(){si(this,e),this.pluginCallbacks=[],this.register((function(e){return new Mi(e)})),this.register((function(e){return new Ei(e)})),this.register((function(e){return new ki(e)})),this.register((function(e){return new Oi(e)})),this.register((function(e){return new Ai(e)})),this.register((function(e){return new Ci(e)})),this.register((function(e){return new Di(e)})),this.register((function(e){return new Pi(e)})),this.register((function(e){return new Ni(e)})),this.register((function(e){return new Li(e)}))}return li(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){for(var i=new Ti,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),di=5120,hi=5121,pi=5122,fi=5123,mi=(Re=9728,Or=9729,Cr=9984,kr=9985,Ar=9986,Nr=9987,Lr=33071,Rr=33648,Ir=10497,"KHR_mesh_quantization"),gi={},vi=(gi[or.NearestFilter]=Re,gi[or.NearestMipmapNearestFilter]=Cr,gi[or.NearestMipmapLinearFilter]=Ar,gi[or.LinearFilter]=Or,gi[or.LinearMipmapNearestFilter]=kr,gi[or.LinearMipmapLinearFilter]=Nr,gi[or.ClampToEdgeWrapping]=Lr,gi[or.RepeatWrapping]=Ir,gi[or.MirroredRepeatWrapping]=Rr,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),yi=new or.Color;function bi(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function xi(e){return 4*Math.ceil(e/4)}function wi(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=xi(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}function Si(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function _i(e,t){return void 0!==e.toBlob?new Promise((function(n){return e.toBlob(n,t)})):("image/jpeg"===t?n=.92:"image/webp"===t&&(n=.8),e.convertToBlob({type:t,quality:n}));var n}var Ti=function(){function e(){si(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return li(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=ii().mark((function e(t,n){var r,i,a,s,o,l,u,c=arguments;return ii().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=2<c.length&&void 0!==c[2]?c[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:a=(o=this).buffers,i=o.json,r=o.options,s=o.extensionsUsed,o=o.extensionsRequired,a=new Blob(a,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(i.extensionsUsed=s),0<o.length&&(i.extensionsRequired=o),i.buffers&&0<i.buffers.length&&(i.buffers[0].byteLength=a.size),!0===r.binary?((l=new FileReader).readAsArrayBuffer(a),l.onloadend=function(){var e=wi(l.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),wi((r=JSON.stringify(i),(new TextEncoder).encode(r).buffer),32)),a=new DataView(new ArrayBuffer(8)),s=(a.setUint32(0,r.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((u=new DataView(s)).setUint32(0,1179937895,!0),u.setUint32(4,2,!0),12+a.byteLength+r.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,o,!0),new Blob([s,a,r,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){n(c.result)}}):i.buffers&&0<i.buffers.length?((u=new FileReader).readAsDataURL(a),u.onloadend=function(){var e=u.result;i.buffers[0].uri=e,n(i)}):n(i);case 19:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(e){ai(a,r,i,s,o,"next",e)}function o(e){ai(a,r,i,s,o,"throw",e)}s(void 0)}))},function(e,t){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){var t,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(n)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new or.Vector3,n=0,r=e.count;n<r;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),r=new or.Vector3,i=0,a=n.count;i<a;i++)r.fromBufferAttribute(n,i),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),n.setXYZ(i,r.x,r.y,r.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;function n(e){return e.encoding===or.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var r=e?e.image:null,i=t?t.image:null,a=Math.max(r?r.width:0,i?i.width:0),s=Math.max(r?r.height:0,i?i.height:0),o=Si(),l=(o.width=a,o.height=s,o.getContext("2d")),u=(l.fillStyle="#00ffff",l.fillRect(0,0,a,s),l.getImageData(0,0,a,s));if(r){l.drawImage(r,0,0,a,s);for(var c=n(e),d=l.getImageData(0,0,a,s).data,h=2;h<d.length;h+=4)u.data[h]=256*c(d[h]/256)}if(i){l.drawImage(i,0,0,a,s);for(var p=n(t),f=l.getImageData(0,0,a,s).data,m=1;m<f.length;m+=4)u.data[m]=256*p(f[m]/256)}return l.putImageData(u,0,0),(r=(e||t).clone()).source=new or.Source(o),r.encoding=or.LinearEncoding,r}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){var a,s=this.json;switch(s.bufferViews||(s.bufferViews=[]),t){case di:case hi:a=1;break;case pi:case fi:a=2;break;default:a=4}for(var o=xi(r*e.itemSize*a),l=new DataView(new ArrayBuffer(o)),u=0,c=n;c<n+r;c++)for(var d=0;d<e.itemSize;d++){var h=void 0;4<e.itemSize?h=e.array[c*e.itemSize+d]:(0===d?h=e.getX(c):1===d?h=e.getY(c):2===d?h=e.getZ(c):3===d&&(h=e.getW(c)),!0===e.normalized&&(h=or.MathUtils.normalize(h,e.array))),5126===t?l.setFloat32(u,h,!0):5124===t?l.setInt32(u,h,!0):5125===t?l.setUint32(u,h,!0):t===pi?l.setInt16(u,h,!0):t===fi?l.setUint16(u,h,!0):t===di?l.setInt8(u,h):t===hi&&l.setUint8(u,h),u+=a}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:o};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=o,s.bufferViews.push(p),{id:s.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=wi(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){var i,a=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Int32Array)i=5124;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Int16Array)i=pi;else if(e.array.constructor===Uint16Array)i=fi;else if(e.array.constructor===Int8Array)i=di;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=hi}if(0===(r=void 0===r?e.count:r))return null;var s,o=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;i++)for(var a=0;a<e.itemSize;a++){var s=void 0;4<e.itemSize?s=e.array[i*e.itemSize+a]:(0===a?s=e.getX(i):1===a?s=e.getY(i):2===a?s=e.getZ(i):3===a&&(s=e.getW(i)),!0===e.normalized&&(s=or.MathUtils.normalize(s,e.array))),r.min[a]=Math.min(r.min[a],s),r.max[a]=Math.max(r.max[a],s)}return r}(e,n=void 0===n?0:n,r);return n={bufferView:(void 0!==t&&(s=e===t.index?34963:34962),t=this.processBufferView(e,i,n,r,s)).id,byteOffset:t.byteOffset,componentType:i,count:r,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(n.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(n)-1}},{key:"processImage",value:function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,a=i.cache,s=i.json,o=i.options,l=i.pending,u=(a.images.has(e)||a.images.set(e,{}),a=a.images.get(e),r+":flipY/"+n.toString());if(void 0!==a[u])return a[u];s.images||(s.images=[]);var c={mimeType:r},d=Si(),h=(d.width=Math.min(e.width,o.maxTextureSize),d.height=Math.min(e.height,o.maxTextureSize),d.getContext("2d"));if(!0===n&&(h.translate(0,d.height),h.scale(1,-1)),void 0!==e.data){t!==or.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>o.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var p=new Uint8ClampedArray(e.height*e.width*4),f=0;f<p.length;f+=4)p[f+0]=e.data[f+0],p[f+1]=e.data[f+1],p[f+2]=e.data[f+2],p[f+3]=e.data[f+3];h.putImageData(new ImageData(p,e.width,e.height),0,0)}else h.drawImage(e,0,0,d.width,d.height);return!0===o.binary?l.push(_i(d,r).then((function(e){return i.processBufferViewImage(e)})).then((function(e){c.bufferView=e}))):void 0!==d.toDataURL?c.uri=d.toDataURL(r):l.push(_i(d,r).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){c.uri=e}))),n=s.images.push(c)-1,a[u]=n}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:gi[e.magFilter],minFilter:gi[e.minFilter],wrapS:gi[e.wrapS],wrapT:gi[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n.textures.push(r)-1);return t.textures.set(e,i),i}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var r={pbrMetallicRoughness:{}},i=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),a=(bi(i,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(i=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(i)},this.applyTextureTransform(a,i),r.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(i={index:this.processTexture(e.map)},this.applyTextureTransform(i,e.map),r.pbrMetallicRoughness.baseColorTexture=i),e.emissive&&(a=e.emissive,0<Math.max(a.r,a.g,a.b)&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),r.emissiveTexture=i)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),r.normalTexture=a),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),r.occlusionTexture=i),e.transparent?r.alphaMode="BLEND":0<e.alphaTest&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===or.DoubleSide&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)})),n.materials.push(r)-1);return t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,a=e.material.length;i<a;i++)r.push(e.material[i].uuid);else r.push(e.material.uuid);var s=r.join(":");if(t.meshes.has(s))return t.meshes.get(s);var o,l,u,c=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,h={},p={},f=[],m=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},v=c.getAttribute("normal"),y=(void 0===v||this.isNormalizedNormalAttribute(v)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),c.setAttribute("normal",this.createNormalizedNormalAttribute(v))),null);for(l in c.attributes)"morph"!==l.slice(0,5)&&(o=c.attributes[l],l=g[l]||l.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(l)||(l="_"+l),t.attributes.has(this.getUID(o))?p[l]=t.attributes.get(this.getUID(o)):(y=null,u=o.array,"JOINTS_0"!==l||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new or.BufferAttribute(new Uint16Array(u),o.itemSize,o.normalized)),null!==(u=this.processAccessor(y||o,c))&&(l.startsWith("_")||this.detectMeshQuantization(l,o),p[l]=u,t.attributes.set(this.getUID(o),u))));if(void 0!==v&&c.setAttribute("normal",v),0===Object.keys(p).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var b=[],x=[],w={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)w[e.morphTargetDictionary[S]]=S;for(var _=0;_<e.morphTargetInfluences.length;++_){var T,M={},E=!1;for(T in c.morphAttributes)if("position"!==T&&"normal"!==T)E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);else{var D=c.morphAttributes[T][_],P=T.toUpperCase(),k=c.attributes[T];if(t.attributes.has(this.getUID(D,!0)))M[P]=t.attributes.get(this.getUID(D,!0));else{var O=D.clone();if(!c.morphTargetsRelative)for(var A=0,C=D.count;A<C;A++)for(var N=0;N<D.itemSize;N++)0===N&&O.setX(A,D.getX(A)-k.getX(A)),1===N&&O.setY(A,D.getY(A)-k.getY(A)),2===N&&O.setZ(A,D.getZ(A)-k.getZ(A)),3===N&&O.setW(A,D.getW(A)-k.getW(A));M[P]=this.processAccessor(O,c),t.attributes.set(this.getUID(k,!0),M[P])}}m.push(M),b.push(e.morphTargetInfluences[_]),void 0!==e.morphTargetDictionary&&x.push(w[_])}h.weights=b,0<x.length&&(h.extras={},h.extras.targetNames=x)}if((v=Array.isArray(e.material))&&0===c.groups.length)return null;for(var L=v?e.material:[e.material],I=v?c.groups:[{materialIndex:0,start:void 0,count:void 0}],R=0,U=I.length;R<U;R++){var B={mode:d,attributes:p},F=(this.serializeUserData(c,B),0<m.length&&(B.targets=m),null!==c.index&&(F=this.getUID(c.index),void 0===I[R].start&&void 0===I[R].count||(F+=":"+I[R].start+":"+I[R].count),t.attributes.has(F)?B.indices=t.attributes.get(F):(B.indices=this.processAccessor(c.index,c,I[R].start,I[R].count),t.attributes.set(F,B.indices)),null===B.indices&&delete B.indices),this.processMaterial(L[I[R].materialIndex]));null!==F&&(B.material=F),f.push(B)}return h.primitives=f,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,h)})),v=n.meshes.push(h)-1,t.meshes.set(s,v),v}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[mi]){var n=void 0;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized"),t=e.split("_",1)[0],null!=(e=ui[t])&&e.includes(n)&&(this.extensionsUsed[mi]=!0,this.extensionsRequired[mi]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),r={type:n?"orthographic":"perspective"};return n?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:or.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,r=this.nodeMap,i=(n.animations||(n.animations=[]),(e=ci.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],s=[],o=0;o<i.length;++o){var l=i[o],u=or.PropertyBinding.parseTrackName(l.name),c=or.PropertyBinding.findNode(t,u.nodeName),d=vi[u.propertyName];if(!(c="bones"===u.objectName?!0===c.isSkinnedMesh?c.skeleton.getBoneByName(u.objectIndex):void 0:c)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',l.name),null;u=l.values.length/l.times.length;var h=void(d===vi.morphTargetInfluences&&(u/=c.morphTargetInfluences.length));!0===l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(h="CUBICSPLINE",u/=3):h=l.getInterpolation()===or.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new or.BufferAttribute(l.times,1)),output:this.processAccessor(new or.BufferAttribute(l.values,u)),interpolation:h}),a.push({sampler:s.length-1,target:{node:r.get(c),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:a}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,r=t.nodes[n.get(e)],i=e.skeleton;if(void 0===i)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var s=[],o=new Float32Array(16*i.bones.length),l=new or.Matrix4,u=0;u<i.bones.length;++u)s.push(n.get(i.bones[u])),l.copy(i.boneInverses[u]),l.multiply(e.bindMatrix).toArray(o,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new or.BufferAttribute(o,16)),joints:s,skeleton:n.get(a)}),r.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,s=(r.nodes||(r.nodes=[]),{});if(i.trs?(n=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),bi(n,[0,0,0,1])||(s.rotation=n),bi(d,[0,0,0])||(s.translation=d),bi(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===bi(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(n=this.processMesh(e))&&(s.mesh=n):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&o.push(c)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var d=r.nodes.push(s)-1;return a.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,s=e.children.length;a<s;a++){var o=e.children[a];!o.visible&&!1!==n.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new or.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,n=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),r=0;r<e.length;r++)e[r]instanceof or.Scene?this.processScene(e[r]):n.push(e[r]);0<n.length&&this.processObjects(n);for(var i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(var a=0;a<t.animations.length;++a)this.processAnimation(t.animations[a],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),Mi=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_lights_punctual"}return li(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Ei=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_unlit"}return li(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),Di=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Pi=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(r=(n=this.writer).extensionsUsed,(i={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(a={index:n.processTexture(e.iridescenceMap)},n.applyTextureTransform(a,e.iridescenceMap),i.iridescenceTexture=a),i.iridescenceIor=e.iridescenceIOR,i.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(a={index:n.processTexture(e.iridescenceThicknessMap)},n.applyTextureTransform(a,e.iridescenceThicknessMap),i.iridescenceThicknessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ki=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_transmission"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Oi=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_volume"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Ai=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_ior"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(n=this.writer.extensionsUsed,(r={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0)}}]),e}(),Ci=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_specular"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(yi)||e.specularIntensityMap||e.specularColorTexture)&&(r=(n=this.writer).extensionsUsed,i={},e.specularIntensityMap&&(a={index:n.processTexture(e.specularIntensityMap)},n.applyTextureTransform(a,e.specularIntensityMap),i.specularTexture=a),e.specularColorMap&&(a={index:n.processTexture(e.specularColorMap)},n.applyTextureTransform(a,e.specularColorMap),i.specularColorTexture=a),i.specularFactor=e.specularIntensity,i.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Ni=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_sheen"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!=e.sheen&&(r=(n=this.writer).extensionsUsed,i={},e.sheenRoughnessMap&&(a={index:n.processTexture(e.sheenRoughnessMap)},n.applyTextureTransform(a,e.sheenRoughnessMap),i.sheenRoughnessTexture=a),e.sheenColorMap&&(a={index:n.processTexture(e.sheenColorMap)},n.applyTextureTransform(a,e.sheenColorMap),i.sheenColorTexture=a),i.sheenRoughnessFactor=e.sheenRoughness,i.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Li=function(){function e(t){si(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return li(e,[{key:"writeMaterial",value:function(e,t){var n,r;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(n=this.writer.extensionsUsed,(r={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0)}}]),e}();ci.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var o=0;o<r;o++)a[o]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),n=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*r),0),a.set(s.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],r={},i=e.tracks,a=0;a<i.length;++a){var s=i[a],o=or.PropertyBinding.parseTrackName(s.name),l=or.PropertyBinding.findNode(t,o.nodeName);if("morphTargetInfluences"!==o.propertyName||void 0===o.propertyIndex)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(or.InterpolateLinear)}var u=l.morphTargetInfluences.length,c=l.morphTargetDictionary[o.propertyIndex];if(void 0===c)throw new Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);var d=void 0;if(void 0===r[l.uuid]){for(var h=new((d=s.clone()).ValueBufferType)(u*d.times.length),p=0;p<d.times.length;p++)h[p*u+c]=d.values[p];d.name=(o.nodeName||"")+".morphTargetInfluences",d.values=h,r[l.uuid]=d,n.push(d)}else{var f=s.createInterpolant(new s.ValueBufferType(1));d=r[l.uuid];for(var m=0;m<d.times.length;m++)d.values[m*u+c]=f.evaluate(d.times[m]);for(var g=0;g<s.times.length;g++){var v=this.insertKeyframe(d,s.times[g]);d.values[v*u+c]=s.values[g]}}}}return e.tracks=n,e}},new m.Z;var Ii=n(4330),Ri=n(2037),Ui=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class Bi{constructor(e){this.materialMap={},this.textureMap={},this.savedMap={materialIds:new Et.Z},this.parseScenePeding=[],this.materialMapToJsonPending=[],this.geoDefMaterialMap=new m.Z;var{type:e,runScene:t,helper:n}=e;this.type=e,this.helper=n,this.runScene=t}parse(e){return Ui(this,void 0,void 0,(function*(){var t=this.createTextureGroup(e);this.helperModel=t,"scene"===this.type?this.parseSceneEx(t):"model"===this.type&&this.parseModelEx(e),this.parseModel(e),this.materialMapToJson(),"scene"===this.type&&(yield this.bindOtherTexture()),yield Promise.all(this.parseScenePeding),this.setMultipMaterial(t,Object.keys(this.textureMap))}))}bindOtherTexture(){return Ui(this,void 0,void 0,(function*(){const e=new m.Z;yield Promise.all(this.runScene.cb.exporter.gltf.assets.bindTexture.cb({map:e,opts:this.helper.opts})),e.map(((e,t)=>{this.parseTexture(t,!0)}))}))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,a.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>Ui(this,void 0,void 0,(function*(){var e=t.texture;(0,gn.isInvalidTexture)(e)||gn.unDelAbleTexture.is(e,this.runScene)&&this.parseTexture(e)}))))}parseModelEx(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),{timeLine:this.runScene.timeLineEx.getSavedByModel(e)})}parseSceneEx(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnUserMaterial(),this.parseUnDelAbleTexture(),this.helper.ex.savedMap=this.savedMap}parseUnUserMaterial(){this.runScene.uniqueEx.material.getUnUsers().map((({material:e,id:t})=>{if(this.runScene.assetsEx.manager.isUsed("material",t)){const n=(0,c.createDefModel)("Box");n.material=e,this.helperModel.add(n),this.savedMap.materialIds.add(t)}}))}_getBaseEx(e){var t=this.runScene.sceneEx.get(),n=this.runScene.optionsEx.exporterOptions.outTime,r=this.runScene.sceneEx.envStrength;return{version:{core:"0.1.34",editor:"0.0.2"},base64:(0,b.Ni)(String(n)),camera:Pt.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},hr.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:r,tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const n={},r=(0,et.createDefMaterial)(),i=[];var a=r.userData.id;const s=(0,c.createDefModel)("Box");if(s.material=r,e.add(s),n.materialId=a,e=this.runScene.pp.isUpdate,(0,gn.isTexture)(t.background)||(0,gn.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:a,environment:s}=t;this.runScene.pp.setUpdate(e),(0,gn.isTexture)(a)&&(a.userData.notCompress=!0,i.push({type:"map",texture:a}),303===(r.map=a).mapping&&(n.backgroundMapping=303)),(0,gn.isTexture)(s)&&(s.userData.notCompress=!0,i.push({type:"envMap",texture:s}),r.envMap=s)}return"editor"===this.runScene.optionsEx.options.mode&&this.runScene.cameraEx.backgroudData&&(t=(0,gn.createDefTexture)(),e=this.runScene.cameraEx.backgroudData,(0,gn.bindTextureBaseData)(t,this.runScene,e),i.push({type:"normalMap",texture:t})),this.materialMap[a]={normalMaterial:r,models:[],normal:{},textures:i},n}compressLocal(e){var{x:t,y:n,z:r}=e.position;0===t&&0===n&&0===r||(e.position.set(0,0,0),e.userData.local=t+","+n+","+r)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processModelMaterial(e),this._processModel(e)}))}_processModel(e){var t;(0,c.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,hr.M)(e,"animations",t));const{model:n,textures:r}=(null==(t=e.toNromal)?void 0:t.call(e,{runScene:this.runScene}))||this.runScene.modelEx.importAndExport.toNromal({type:Ri.Z.getType(e),model:e,runScene:this.runScene});null!=r&&r.map((e=>this.parseTexture(e))),n!==e&&(e.parent.add(n),e.parent.remove(e)),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(n)}_processModelMaterial(e){if(e.material)if((0,et.isMultiMaterial)(e.material)){const t=[];(0,et.getMaterials)(e.material).map((e=>{const n=this.runScene.modelEx.create("Box");var r=(0,Ye.Ki)(e);const i=this.materialMap[r];i&&(i.normalMaterial&&(n.material=i.normalMaterial),i.models.push(n)),t.push(r);var{material:a,normal:s,textures:o}=this.runScene.materialEx.isBaseMaterial(e)||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(n):this.runScene.materialEx.toNromal(e);n.material=a,e.userData.id=r,this.materialMap[r]={oldMaterial:e,normalMaterial:a,models:[n],normal:s,textures:o},this.helperModel.add(n)})),e.material=this.runScene.materialEx.defMaterial,(0,et.setMaterialIds)(e,t,!0)}else{(0,et.setMaterialIds)(e,[],!1);const r=this.materialMap[e.material.userData.id];if(r)return r.normalMaterial&&(e.material=r.normalMaterial),void r.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),n=e.material;const{material:i,normal:a,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=i,t=n.userData.id,i.userData.id=t,this.materialMap[t]={oldMaterial:n,normalMaterial:i,models:[e],normal:a,textures:s}}}materialMapToJson(){(0,a.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:n,normal:r}=t,i=t.userData.id;this.helper.ex.materialMap[i]||(this.helper.ex.materialMap[i]={normal:r,textures:{}},this.mergeAndRemoveTexture(n,t,this.materialMapToJsonPending))})),this.parseScenePeding.push((0,a.eachTriggerArray)(this.materialMapToJsonPending))}mergeSame(e){return Ui(this,void 0,void 0,(function*(){if(e.userData||(e.userData={}),(0,gn.isClonedTexture)(e))e=this.parseCloneTexture(e);else if((0,gn.isCubeTexture)(e)){var t=this.textureMap[e.userData.id];e=t?t.texture:yield this.parseCubeTexture(e)}else{const t=e.userData;for(const a in this.textureMap){var n=this.textureMap[a],{md5:r,texture:i}=n;if(t.md5===r&&e.mapping===i.mapping&&!(0,gn.isClonedTexture)(n.texture))return{isSame:!0,texture:e}}}const a=e.userData;return this.textureMap[e.userData.id]=Object.assign(Object.assign({},a),{texture:e}),{isSame:!1,texture:e}}))}parseTexture(e,t=!0){var{format:n,repeat:r,center:i,rotation:a,offset:s}=e;let o={format:n};t&&(o.format=n,3e3!==e.encoding&&(o.encoding=3001),this.runScene.modelEx.isNavieV2(r,1)||(({x:t,y:n}=r),o.repeat=t===n?t:r),this.runScene.modelEx.isNavieV2(i,0)||(({x:n,y:t}=i),o.center=n===t?n:i),this.runScene.modelEx.isNavieV2(s,0)||(({x:r,y:t}=s),o.offset=r===t?r:s),0!==a&&(o.rotation=a),e.flipY&&(o.flipY=1)),this.textureMap[e.userData.id]=Object.assign(Object.assign({},e.userData),{texture:e}),this.helper.ex.textureMap[e.userData.id]=o}parseCubeTexture(e){return new Promise((t=>Ui(this,void 0,void 0,(function*(){let n=(0,gn.getTextureForEmpty)();var r=Object.keys(e.userData.blobMap).map(((t,n)=>Ui(this,void 0,void 0,(function*(){var r=e.userData.blobMap[t],i=e.source.data[n];i=yield(0,gn.parseImageBitMapByBlob)(i);const o=new s.Texture(i);o.needsUpdate=!0,i=(0,a.getId)(),(0,gn.setMimeForTexture)(o,r.type),o.userData={id:i,blob:r,mimeType:r.type},e.userData.cubeMap||(e.userData.cubeMap={}),e.userData.cubeMap[t]=i,this.textureMap[i]=Object.assign(Object.assign({},o.userData),{texture:o}),this.helper.ex.textureMap[o.userData.id]={isHelper:!0,format:o.format}}))));yield Promise.all(r),e.userData.lightProbe&&(e.userData.lightProbeIntensity=e.userData.lightProbe.intensity),n.userData=Object.assign({},e.userData),t(n)}))))}mergeAndRemoveTexture(e,t,n){return Ui(this,void 0,void 0,(function*(){e.map((e=>{n.push((()=>Ui(this,void 0,void 0,(function*(){if(!(0,gn.isInvalidTexture)(e.texture)){var{type:n,texture:r}=e;this.runScene.uniqueEx.texture.add(r),t[n]=null;const i=(yield this.mergeSame(r)).texture;this.helper.ex.textureMap[i.userData.id]||this.parseTexture(i),"normalMap"!==n||i.userData.isNormalMap||(i.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[n]=i.userData.id}}))))}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:n}=e.image;const r=document.createElement("canvas");return r.width=e,r.height=n,t.source=new s.Source(r),t.userData.blob=new Blob([new ArrayBuffer(1)]),t}setMultipMaterial(e,t){const n=this.runScene.modelEx.create("Box"),r=(0,et.createDefMaterial)();n.material=r,e.add(n);for(const e of Ii.sG){if(!t.length)return;var i=t.pop();if(!i)return;r[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,et.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class Fi{constructor(e){this.typeSize={},this.map={model:new m.Z,texture:new m.Z},this.allSize=0;var{type:e,runScene:t,helper:n}=e;this.type=e,this.helper=n,this.runScene=t}add(e){var{type:e,data:t,key:n,size:r}=e;const i=this.map[e].get(n);i?i.size+=r:(this.map[e].set(n,t),this.allSize+=r,this.typeSize[e]=(this.typeSize[e]||0)+r)}toJSON(){const{model:e,texture:t}=this.map,n=[],r={name:"模型",all:0,data:[]},i=(r.data=G.F6.filter(e.map(((e,{name:t,size:n})=>{if(r.all+=n,!(n<1024))return{name:t,size:n}}))).sort(((e,t)=>t.size-e.size)),{name:"贴图",all:0,data:[]});return i.data=G.F6.filter(t.map(((e,{id:t,url:n,size:r})=>{if(i.all+=r,!(r<1024))return{name:t,url:n,size:r}}))).sort(((e,t)=>t.size-e.size)),n.push(r,i),n}}class ji extends r.Z{constructor(){super(...arguments),this.savedMap=new m.Z,this.clonedMap=new m.Z}getSameNode(e){return this.savedMap.find(((t,n)=>n.materialUuid===e.material.uuid&&n.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,n=(0,Ye.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,c.setClonedModel)(e,t.id),this.savedMap.set(n,{id:n,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,c.getClonedIdModel)(e),n=(0,Ye.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const r=this.clonedMap.get(t);r&&(r.ids.add(n),r.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,Ye.Ki)(e),r.newId=t),r.newId&&(r.newId!==n?(0,c.setClonedModel)(e,r.newId):(0,c.delClonedModel)(e)))}parseNode(e){(0,c.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class zi{constructor(){this.savedMap=new m.Z}getSameCount(e){return this.savedMap.filterData(((t,n)=>n.geometry.attributes.normal.count===e)).map((e=>e.val))}setSameNode(e,t){e.geometry=t}parseNode(e){}}class Vi{constructor(e){this.optionsConfigs={},this.addOption=e=>{var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e},(this.runScene=e).cb.exporter.gltf.options.add.add("ExporterGltfOptions",this.addOption)}getParse(e){return this.optionsConfigs[e]}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:n,type:r}=t;return{type:r,data:n(e)}}))}}class Hi{constructor(e){this.helperModels=[],this.mergeSameGeo=new zi,this.pending=[];var{type:e,runScene:t,model:n,msg:r,opts:i}=e,i=(this.runScene=t,this.type=e,this.opts=i,this.bindClondId=new ji(t),this.ex={materialMap:{},textureMap:{},type:e,msg:r},{helper:this,type:e,runScene:t});this.before=new Bi(i),this.size=new Fi(i),this.pending.push(this.before.parse(n))}parseNode(e){let{object:t,nodeDef:n}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,a.mapObj)(this.runScene.modelEx.defNodeMap,((e,r)=>{t[e]!==r&&(n[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,n.wireframe=!0),t}parseMaterial(e){const{material:t,materialDef:n}=e;n.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){let{texture:t,textureDef:n}=e;(0,gn.mergeDefUserData)(t.userData,n);var{blob:e,url:r,id:i,type:a,apngAnima:s}=t.userData,{width:i,height:r}=(e&&this.size.add({type:"texture",key:i,data:{id:i,url:r,size:e.size},size:e.size}),(0,gn.isClonedTexture)(t)&&(n.cloneSourceId=(0,gn.getCloneIdFromTexture)(t)),t.channel&&(n.channel=t.channel),s&&(n.apngAnima=s),a&&(n.type=a),(0,gn.getSizeByTexture)(t));n.size={w:i,h:r}}beforeSerializeUserData(e){const t=e.userData;t.tempData&&delete t.tempData,t.catchMap&&delete t.catchMap}processGeometry(e){this.size.add({type:"model",data:e,key:e.id,size:e.size})}getNodeMapValueWithBone(e,t){for(const n of t.keys())if(n.userData.id===e.userData.id)return t.get(n)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e}),this.runScene.cb.exporter.gltf.sizeMap.cb(this.size.toJSON())}}class Wi{constructor(e){this.map=new Et.Z,this.loadMap=new m.Z,this.exportMap=new m.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let n=this.loadMap.get(e);n||(n=new Et.Z,this.loadMap.set(e,n)),n.add(t)})),e.exportCallBacks.map(((e,t)=>{let n=this.exportMap.get(e);n||(n=new Et.Z,this.exportMap.set(e,n)),n.add(t)}))}loadCallback(e){const{type:t,json:n,data:r,config:i,core:a}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:n,data:r,config:i,core:a})))}}var Gi=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class Ki extends r.Z{constructor(e){super(e),this._gltf=new Tr,this._originGltf=new ci,this.options=new Vi(e),this.module=new Wi(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t,n,r){return Gi(this,void 0,void 0,(function*(){const i=new Hi({type:t,runScene:this.runScene,model:e,msg:n,opts:r});return yield Promise.all(i.pending),new Promise((t=>{this._gltf.parse(e,(e=>Gi(this,void 0,void 0,(function*(){var n=null!=(n=null==(n=null==r?void 0:r.config)?void 0:n.export)&&n.addVersion?yield this.addNormalToAb(e):e;t(n)}))),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:i,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Gi(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}model(e,t=!0){return Gi(this,void 0,void 0,(function*(){const n=G.F6.toArr(e||this.runScene.modelEx.getSelectedModels());if(0!==n.length){var r=(r=n[0]).name||r.type;const e=new s.Group;e.name="models",c.uselessGroup.set(e,!0),n.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var i=yield this.getArrayBuffer(e,"model");return t&&(0,a.downloadFile)(new Blob([i]),r+".lt"),i}}))}material(e){var t;return Gi(this,void 0,void 0,(function*(){if(n=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,c.createDefModel)("Group");let t=n;(t=n instanceof Array?t:[n]).map((t=>{const n=(0,c.createDefModel)("Box");n.material=t,e.add(n)}));var n=n.name||"material",r=yield this.getArrayBuffer(e,"material");(0,a.downloadFile)(new Blob([r]),n+".lt")}}))}scene(e=!0,t="scene",n){return Gi(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t,void 0,n);return e&&(0,a.downloadFile)(new Blob([r]),"linktwins.lt"),r}))}originModel(e){return Gi(this,void 0,void 0,(function*(){var t,n;e&&(t=e.name||e.type,n=yield this.getOriginArrayBuffer(e),(0,a.downloadFile)(new Blob([n]),t+".lt"))}))}addDecoderToAb(e,t){return Gi(this,void 0,void 0,(function*(){var n=(0,K.F)(this.runScene).decodePath,r=yield(0,b.sR)(n+"draco_wasm_wrapper.js");return n=yield(0,b.sR)(n+"draco_decoder.wasm"),r=this.addInfoToAb({data:{arrayBuffer:e},draco_wasm_wrapper:{arrayBuffer:r},draco_decoder:{arrayBuffer:n}}),!1!==t&&(0,a.downloadFile)(r,"scene.ltc"),r}))}addInfoToAb(e){const t=[],n={};let r=1e3;(0,a.mapObj)(e,((e,i)=>{t.push(i.arrayBuffer),i=i.arrayBuffer.byteLength+r,n[e]={begin:r,end:i},r=i}));var i=(e=JSON.stringify(n)).length;e=this.runScene.loaderer.getTextEncoder().encode(e);const s=JSON.stringify({v:b.Uf.encrypt("0.1"),l:i});return t.push(e),i=this.runScene.loaderer.getTextEncoder().encode(s.padStart(1e3," ")),t.unshift(i),new Blob(t)}addNormalToAb(e,t){return Gi(this,void 0,void 0,(function*(){var n=this.addInfoToAb({data:{arrayBuffer:e}});return null!=t&&t.toArrayBuffer?yield(0,a.parseFile)(n,"arrayBuffer"):n}))}}var Zi=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,n;return t=e,(n=[{key:"parse",value:function(e){var t="",n=0,r=0,i=0,a=new or.Vector3,s=new or.Color,o=new or.Vector3,l=new or.Vector2,u=[];return e.traverse((function(e){if(!0===e.isMesh){var c=e,d=0,h=0,p=0,f=c.geometry,m=new or.Matrix3,g=f.getAttribute("position"),v=f.getAttribute("normal"),y=f.getAttribute("uv"),b=f.getIndex();if(t+="o "+c.name+"\n",c.material&&c.material.name&&(t+="usemtl "+c.material.name+"\n"),void 0!==g)for(var x=0,w=g.count;x<w;x++,d++)a.fromBufferAttribute(g,x),a.applyMatrix4(c.matrixWorld),t+="v "+a.x+" "+a.y+" "+a.z+"\n";if(void 0!==y)for(var S=0,_=y.count;S<_;S++,p++)l.fromBufferAttribute(y,S),t+="vt "+l.x+" "+l.y+"\n";if(void 0!==v){m.getNormalMatrix(c.matrixWorld);for(var T=0,M=v.count;T<M;T++,h++)o.fromBufferAttribute(v,T),o.applyMatrix3(m).normalize(),t+="vn "+o.x+" "+o.y+" "+o.z+"\n"}if(null!==b)for(var E=0,D=b.count;E<D;E+=3){for(var P=0;P<3;P++){var k=b.getX(E+P)+1;u[P]=n+k+(v||y?"/"+(y?r+k:"")+(v?"/"+(i+k):""):"")}t+="f "+u.join(" ")+"\n"}else for(var O=0,A=g.count;O<A;O+=3){for(var C=0;C<3;C++){var N=O+C+1;u[C]=n+N+(v||y?"/"+(y?r+N:"")+(v?"/"+(i+N):""):"")}t+="f "+u.join(" ")+"\n"}n+=d,r+=p,i+=h}if(!0===e.isLine){var L=e,I=0,R=(f=L.geometry,L.type),U=f.getAttribute("position");if(t+="o "+L.name+"\n",void 0!==U)for(var B=0,F=U.count;B<F;B++,I++)a.fromBufferAttribute(U,B),a.applyMatrix4(L.matrixWorld),t+="v "+a.x+" "+a.y+" "+a.z+"\n";if("Line"===R){t+="l ";for(var j=1,z=U.count;j<=z;j++)t+=n+j+" ";t+="\n"}if("LineSegments"===R)for(var V=1,H=V+1,W=U.count;V<W;H=(V+=2)+1)t+="l "+(n+V)+" "+(n+H)+"\n";n+=I}if(!0===e.isPoints){var G=e,K=0,Z=(R=G.geometry).getAttribute("position"),q=R.getAttribute("color");if(t+="o "+G.name+"\n",void 0!==Z){for(var X=0,Y=Z.count;X<Y;X++,K++)a.fromBufferAttribute(Z,X),a.applyMatrix4(G.matrixWorld),t+="v "+a.x+" "+a.y+" "+a.z,void 0!==q&&(s.fromBufferAttribute(q,X).convertLinearToSRGB(),t+=" "+s.r+" "+s.g+" "+s.b),t+="\n";t+="p ";for(var Q=1,J=Z.count;Q<=J;Q++)t+=n+Q+" ";t+="\n"}n+=K}})),t}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();class qi extends r.Z{static getIns(){return this.ins||(this.ins=new Zi),this.ins}model(e){return qi.getIns().parse(e)}}class Xi extends r.Z{constructor(e){super(e),this.gltf=new Ki(e),this.obj=new qi(e)}json(e){(0,a.downloadFile)(new File([JSON.stringify(e)],e.type+".json"),e.type+".json")}}function Yi(e){return(Yi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qi(e){return(Qi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ji(e,t){return(Ji=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var $i=/^[og]\s*(.+)?/,ea=/^mtllib /,ta=/^usemtl /,na=/^usemap /,ra=/\s+/,ia=new or.Vector3,aa=new or.Vector3,sa=new or.Vector3,oa=new or.Vector3,la=new or.Vector3,ua=new or.Color;function ca(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var n=this._finalize(!1);return n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==n?n:this).smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var n=this.materials.length-1;0<=n;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone&&((e=n.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,n){var r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){var r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){var r=this.vertices,i=this.object.geometry.normals;ia.fromArray(r,e),aa.fromArray(r,t),sa.fromArray(r,n),la.subVectors(sa,aa),oa.subVectors(ia,aa),la.cross(oa),la.normalize(),i.push(la.x,la.y,la.z),i.push(la.x,la.y,la.z),i.push(la.x,la.y,la.z)},addColor:function(e,t,n){var r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){var r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,s,o,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),n=this.parseVertexIndex(n,u),this.addVertex(e,t,n),this.addColor(e,t,n),void 0!==s&&""!==s?(u=this.normals.length,e=this.parseNormalIndex(s,u),t=this.parseNormalIndex(o,u),n=this.parseNormalIndex(l,u),this.addNormal(e,t,n)):this.addFaceNormal(e,t,n),void 0!==r&&""!==r?(s=this.uvs.length,e=this.parseUVIndex(r,s),t=this.parseUVIndex(i,s),n=this.parseUVIndex(a,s),this.addUV(e,t,n),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,n=0,r=e.length;n<r;n++){var i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var n=this.vertices.length,r=this.uvs.length,i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],n));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return e.startObject("",!1),e}var da=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){if(this instanceof n)return(e=function(e,t,n){t=Qi(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],Qi(e).constructor):t.apply(e,n))&&("object"===Yi(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n,[e])).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ji(t,e),t=n,(e=[{key:"load",value:function(e,t,n,r){var i=this,a=new or.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{t(i.parse(n))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new ca,n=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),r=[],i=0,a=n.length;i<a;i++){var s=n[i].trimStart();if(0!==s.length){var o,l=s.charAt(0);if("#"!==l)if("v"===l){var u=s.split(ra);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(ua.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(ua.r,ua.g,ua.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===l){for(var c=s.slice(1).trim().split(ra),d=[],h=0,p=c.length;h<p;h++){var f=c[h];0<f.length&&(f=f.split("/"),d.push(f))}for(var m=d[0],g=1,v=d.length-1;g<v;g++){var y=d[g],b=d[g+1];t.addFace(m[0],y[0],b[0],m[1],y[1],b[1],m[2],y[2],b[2])}}else if("l"===l){var x=s.substring(1).trim().split(" "),w=[],S=[];if(-1===s.indexOf("/"))w=x;else for(var _=0,T=x.length;_<T;_++){var M=x[_].split("/");""!==M[0]&&w.push(M[0]),""!==M[1]&&S.push(M[1])}t.addLineGeometry(w,S)}else"p"===l?(o=s.slice(1).trim().split(" "),t.addPointGeometry(o)):null!==(r=$i.exec(s))?(o=(" "+r[0].slice(1).trim()).slice(1),t.startObject(o)):ta.test(s)?t.object.startMaterial(s.substring(7).trim(),t.materialLibraries):ea.test(s)?t.materialLibraries.push(s.substring(7).trim()):na.test(s)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===l?(1<(r=s.split(" ")).length?(l=r[1].trim().toLowerCase(),t.object.smooth="0"!==l&&"off"!==l):t.object.smooth=!0,(l=t.object.currentMaterial())&&(l.smooth=t.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"')}}t.finalize();var E,D=new or.Group;if(1==(D.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var P=0,k=t.objects.length;P<k;P++){var O=t.objects[P],A=O.geometry,C=O.materials,N="Line"===A.type,L="Points"===A.type,I=!1;if(0!==A.vertices.length){for(var R=new or.BufferGeometry,U=(R.setAttribute("position",new or.Float32BufferAttribute(A.vertices,3)),0<A.normals.length&&R.setAttribute("normal",new or.Float32BufferAttribute(A.normals,3)),0<A.colors.length&&(I=!0,R.setAttribute("color",new or.Float32BufferAttribute(A.colors,3))),!0===A.hasUVIndices&&R.setAttribute("uv",new or.Float32BufferAttribute(A.uvs,2)),[]),B=0,F=C.length;B<F;B++){var j,z=C[B],V=z.name+"_"+z.smooth+"_"+I,H=t.materials[V];null!==this.materials&&(H=this.materials.create(z.name),!N||!H||H instanceof or.LineBasicMaterial?!L||!H||H instanceof or.PointsMaterial||(j=new or.PointsMaterial({size:10,sizeAttenuation:!1}),or.Material.prototype.copy.call(j,H),j.color.copy(H.color),j.map=H.map,H=j):(j=new or.LineBasicMaterial,or.Material.prototype.copy.call(j,H),j.color.copy(H.color),H=j)),void 0===H&&((H=N?new or.LineBasicMaterial:L?new or.PointsMaterial({size:1,sizeAttenuation:!1}):new or.MeshPhongMaterial).name=z.name,H.flatShading=!z.smooth,H.vertexColors=I,t.materials[V]=H),U.push(H)}if(A=void 0,1<U.length){for(var W=0,G=C.length;W<G;W++){var K=C[W];R.addGroup(K.groupStart,K.groupCount,W)}A=new(N?or.LineSegments:L?or.Points:or.Mesh)(R,U)}else A=new(N?or.LineSegments:L?or.Points:or.Mesh)(R,U[0]);A.name=O.name,D.add(A)}}else 0<t.vertices.length&&(e=new or.PointsMaterial({size:1,sizeAttenuation:!1}),(E=new or.BufferGeometry).setAttribute("position",new or.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(E.setAttribute("color",new or.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),E=new or.Points(E,e),D.add(E));return D}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(or.Loader);Re=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(Re(""))}catch(n){Re=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var ha=Uint8Array,pa=Uint16Array,fa=Uint32Array,ma=new ha([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ga=new ha([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),va=new ha([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ya=(Cr=function(e,t){for(var n=new pa(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new fa(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},(Ar=Cr(ma,2))[0]),ba=(Or=Ar[1],(ya[28]=258,Or[258]=28,kr=Cr(ga,0))[0]),xa=(kr[1],new pa(32768)),wa=0;wa<32768;++wa){var Sa=(43690&wa)>>>1|(21845&wa)<<1;xa[wa]=((65280&(Sa=(61680&(Sa=(52428&Sa)>>>2|(13107&Sa)<<2))>>>4|(3855&Sa)<<4))>>>8|(255&Sa)<<8)>>>1}var _a=function(e,t,n){for(var r=e.length,i=0,a=new pa(t);i<r;++i)++a[e[i]-1];var s=new pa(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){var o=new pa(1<<t),l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],d=s[e[i]-1]++<<c,h=d|(1<<c)-1;d<=h;++d)o[xa[d]>>>l]=u}else for(o=new pa(r),i=0;i<r;++i)e[i]&&(o[i]=xa[s[e[i]-1]++]>>>15-e[i]);return o},Ta=new ha(288);for(wa=0;wa<144;++wa)Ta[wa]=8;for(wa=144;wa<256;++wa)Ta[wa]=9;for(wa=256;wa<280;++wa)Ta[wa]=7;for(wa=280;wa<288;++wa)Ta[wa]=8;var Ma=new ha(32);for(wa=0;wa<32;++wa)Ma[wa]=5;var Ea=_a(Ta,9,1),Da=_a(Ma,5,1),Pa=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ka=function(e,t,n){var r=t/8|0;return(e[r]|e[1+r]<<8)>>(7&t)&n},Oa=function(e,t){var n=t/8|0;return(e[n]|e[1+n]<<8|e[2+n]<<16)>>(7&t)},Aa=function(e){return(e/8|0)+(7&e&&1)};Nr=new ha(0),Lr="undefined"!=typeof TextDecoder&&new TextDecoder;try{Lr.decode(Nr,{stream:!0})}catch(n){}function Ca(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,s=Math.floor((i+a)/2);t<n[s]||t>=n[s+1];)t<n[s]?a=s:i=s,s=Math.floor((i+a)/2);return s}function Na(e,t,n,r){for(var i=[],a=[],s=[],o=i[0]=1;o<=n;++o){a[o]=t-r[e+1-o],s[o]=r[e+o]-t;for(var l=0,u=0;u<o;++u){var c=s[u+1],d=a[o-u],h=i[u]/(c+d);i[u]=l+c*h,l=d*h}i[o]=l}return i}function La(e,t,n,r,i){for(var a=i<e?i:e,s=[],o=Ca(e,r,t),l=function(e,t,n,r,i){for(var a=[],s=0;s<=n;++s)a[s]=0;for(var o=[],l=0;l<=r;++l)o[l]=a.slice(0);for(var u=[],c=0;c<=n;++c)u[c]=a.slice(0);u[0][0]=1;for(var d=a.slice(0),h=a.slice(0),p=1;p<=n;++p){d[p]=t-i[e+1-p],h[p]=i[e+p]-t;for(var f=0,m=0;m<p;++m){var g=h[m+1],v=d[p-m],y=(u[p][m]=g+v,u[m][p-1]/u[p][m]);u[m][p]=f+g*y,f=v*y}u[p][p]=f}for(var b=0;b<=n;++b)o[0][b]=u[b][n];for(var x=0;x<=n;++x){for(var w=0,S=1,_=[],T=0;T<=n;++T)_[T]=a.slice(0);for(var M=_[0][0]=1;M<=r;++M){var E=0,D=x-M,P=n-M;M<=x&&(_[S][0]=_[w][0]/u[1+P][D],E=_[S][0]*u[D][P]);for(var k=x-1<=P?M-1:n-x,O=-1<=D?1:-D;O<=k;++O)_[S][O]=(_[w][O]-_[w][O-1])/u[1+P][D+O],E+=_[S][O]*u[D+O][P];x<=P&&(_[S][M]=-_[w][M-1]/u[1+P][x],E+=_[S][M]*u[x][P]),o[M][x]=E;var A=w;w=S,S=A}}for(var C=n,N=1;N<=r;++N){for(var L=0;L<=n;++L)o[N][L]*=C;C*=n-N}return o}(o,r,e,a,t),u=[],c=0;c<n.length;++c){var d=n[c].clone(),h=d.w;d.x*=h,d.y*=h,d.z*=h,u[c]=d}for(var p=0;p<=a;++p){for(var f=u[o-e].clone().multiplyScalar(l[p][0]),m=1;m<=e;++m)f.add(u[o-e+m].clone().multiplyScalar(l[p][m]));s[p]=f}for(var g=a+1;g<=i+1;++g)s[g]=new or.Vector4(0,0,0);return s}function Ia(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var a=e[i];n[i]=new or.Vector3(a.x,a.y,a.z),r[i]=a.w}for(var s=[],o=0;o<t;++o){for(var l=n[o].clone(),u=1;u<=o;++u)l.sub(s[o-u].clone().multiplyScalar(function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;for(var i=1,a=2;a<=t;++a)i*=a;for(var s=2;s<=e-t;++s)i*=s;return n/i}(o,u)*r[u]));s[o]=l.divideScalar(r[0])}return s}function Ra(e){return(Ra="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ua(e){return(Ua=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ba(e,t){return(Ba=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fa,ja,za,Va=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t,r,i,a){var s;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(s=function(e,t,n){t=Ua(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,[],Ua(e).constructor):t.apply(e,n))&&("object"===Ra(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n)).degree=e,s.knots=t,s.controlPoints=[],s.startKnot=i||0,s.endKnot=a||s.knots.length-1;for(var o=0;o<r.length;++o){var l=r[o];s.controlPoints[o]=new or.Vector4(l.x,l.y,l.z,l.w)}return s}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ba(t,e),t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new or.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,n,r){for(var i=Ca(e,r,t),a=Na(i,r,e,t),s=new or.Vector4(0,0,0,0),o=0;o<=e;++o){var l=n[i-e+o],u=a[o],c=l.w*u;s.x+=l.x*c,s.y+=l.y*c,s.z+=l.z*c,s.w+=l.w*u}return s}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new or.Vector3,n=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Ia(La(n=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(n[1]).normalize(),t}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(or.Curve);function Ha(e){return(Ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ga(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ka(e,t,n){t&&Ga(e.prototype,t),n&&Ga(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function Za(e){return(Za=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function qa(e,t){return(qa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Xa=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){return Wa(this,n),function(e,t,n){t=Za(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],Za(e).constructor):t.apply(e,n))&&("object"===Ha(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n,[e])}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qa(t,e),Ka(n,[{key:"load",value:function(e,t,n,r){var i=this,a=""===i.path?s.LoaderUtils.extractUrlBase(e):i.path,o=new s.FileLoader(this.manager);o.setPath(i.path),o.setResponseType("arraybuffer"),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,(function(n){try{t(i.parse(n,a))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e,t,n){if(i="Kaydara FBX Binary \0",(r=e).byteLength>=i.length&&i===hs(r,0,i.length))Fa=(new es).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0,r=0;r<t.length;++r)if(function(t){var r=e[0];return e=e.slice(n+1),n++,r}()===t[r])return;return 1}(r=hs(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(rs(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+rs(r));Fa=(new $a).parse(r)}var r,i=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Ya(i,this.manager,n).parse(Fa)}}]),n}(s.Loader),Ya=function(){function e(t,n,r){Wa(this,e),this.textureLoader=t,this.manager=n,this.options=r}return Ka(e,[{key:"parse",value:function(){ja=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),n=(new Qa).parse(t);return this.parseScene(t,n,e),za}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Fa&&Fa.Connections.connections.forEach((function(t){var n=t[0],r=t[1],i=(t=t[2],e.has(n)||e.set(n,{parents:[],children:[]}),{ID:r,relationship:t});e.get(n).parents.push(i),e.has(r)||e.set(r,{parents:[],children:[]}),i={ID:n,relationship:t},e.get(r).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},n={};if("Video"in Fa.Objects){var r,i=Fa.Objects.Video;for(r in i){var a,s,o=i[r];t[parseInt(r)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,a="string"==typeof o.Content&&""!==o.Content,(s||a)&&(s=this.parseImage(i[r]),n[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==n[l]?t[e]=n[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof n?"data:"+t+";base64,"+n:(e=new Uint8Array(n),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Fa.Objects){var n,r=Fa.Objects.Texture;for(n in r){var i=this.parseTexture(r[n],e);t.set(parseInt(n),i)}}return t}},{key:"parseTexture",value:function(e,t){var n=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),r=e.WrapModeV;return n=void 0!==n?n.value:0,r=void 0!==r?r.value:0,t.wrapS=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(n=e.Scaling.value,t.repeat.x=n[0],t.repeat.y=n[1]),"Translation"in e&&(r=e.Translation.value,t.offset.x=r[0],t.offset.y=r[1]),t}},{key:"loadTexture",value:function(e,t){var n,r=this.textureLoader.path,i=ja.get(e.id).children;return i="tga"===(void 0!==i&&0<i.length&&void 0!==t[i[0].ID]&&(0!==(n=t[i[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(i=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new s.Texture):(i.setPath(this.textureLoader.path),i.load(n)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new s.Texture):this.textureLoader.load(n,this.options.onTextureLoaded,(function(){}),this.options.onTextureLoadError),this.textureLoader.setPath(r),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Fa.Objects){var n,r=Fa.Objects.Material;for(n in r){var i=this.parseMaterial(r[n],e);null!==i&&t.set(parseInt(n),i)}}return t}},{key:"parseMaterial",value:function(e,t){var n,r=e.id,i=e.attrName,a=e.ShadingModel;if("object"===Ha(a)&&(a=a.value),!ja.has(r))return null;switch(e=this.parseParameters(e,t,r),a.toLowerCase()){case"phong":n=new s.MeshPhongMaterial;break;case"lambert":n=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),n=new s.MeshPhongMaterial}return n.setValues(e),n.name=i,n}},{key:"parseParameters",value:function(e,t,n){var r={},i=(e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(r.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(r.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return ja.get(n).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=s.EquirectangularReflectionMapping,r.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Fa.Objects&&t in Fa.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ja.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Fa.Objects){var n,r=Fa.Objects.Deformer;for(n in r){var i,a=r[n],s=ja.get(parseInt(n));"Skin"===a.attrType?((i=this.parseSkeleton(s,r)).ID=n,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=s.parents[0].ID,e[n]=i):"BlendShape"===a.attrType&&((i={id:n}).rawTargets=this.parseMorphTargets(s,r),i.id=n,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];"Cluster"===r.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(r.TransformLink.a)},"Indexes"in r&&(e.indices=r.Indexes.a,e.weights=r.Weights.a),n.push(e))})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var n=[],r=0;r<e.children.length;r++){var i=e.children[r],a=t[i.ID],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=ja.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(s)}return n}},{key:"parseScene",value:function(e,t,n){za=new s.Group;var r=this.parseModels(e.skeletons,t,n),i=Fa.Objects.Model,a=this;r.forEach((function(e){var t=i[e.ID];a.setLookAtProperties(e,t),ja.get(e.ID).parents.forEach((function(t){void 0!==(t=r.get(t.ID))&&t.add(e)})),null===e.parent&&za.add(e)})),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),za.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=us(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),n=(new Ja).parse(),1===za.children.length&&za.children[0].isGroup&&(za.children[0].animations=n,za=za.children[0]),za.animations=n}},{key:"parseModels",value:function(e,t,n){var r,i=new Map,a=Fa.Objects.Model;for(r in a){var o=parseInt(r),l=a[r],u=ja.get(o),c=this.buildSkeleton(u,e,o,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,n);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new s.Bone;break;default:c=new s.Group}c.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=o}this.getTransformData(c,l),i.set(o,c)}return i}},{key:"buildSkeleton",value:function(e,t,n,r){var i=null;return e.parents.forEach((function(e){for(var a in t)!function(){var o=t[a];o.rawBones.forEach((function(t,a){var l;t.ID===e.ID&&(l=i,(i=new s.Bone).matrixWorld.copy(t.transformLink),i.name=r?s.PropertyBinding.sanitizeNodeName(r):"",i.ID=n,o.bones[a]=i,null!==l&&i.add(l))}))}()})),i}},{key:"createCamera",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=Fa.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new s.Object3D;else{var r=0,i=(void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(r=1),1),a=(void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3),1e3),o=(void 0!==n.FarPlane&&(a=n.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(o=n.AspectWidth.value,l=n.AspectHeight.value),o/l),c=45,d=(void 0!==n.FieldOfView&&(c=n.FieldOfView.value),n.FocalLength?n.FocalLength.value:null);switch(r){case 0:t=new s.PerspectiveCamera(c,u,i,a),null!==d&&t.setFocalLength(d);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,i,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+r+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=Fa.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new s.Object3D;else{e=void 0===n.LightType?0:n.LightType.value;var r=16777215,i=(void 0!==n.Color&&(r=(new s.Color).fromArray(n.Color.value)),void 0===n.Intensity?1:n.Intensity.value/100),a=(void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(i=0),0);switch(void 0!==n.FarAttenuationEnd&&(a=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(r,i,a,1);break;case 1:t=new s.DirectionalLight(r,i);break;case 2:var o=Math.PI/3,l=(void 0!==n.InnerAngle&&(o=s.MathUtils.degToRad(n.InnerAngle.value)),0);void 0!==n.OuterAngle&&(l=s.MathUtils.degToRad(n.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(r,i,a,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(r,i)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,n){var r,i=null,a=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&o.push(n.get(e.ID))})),1<o.length?a=o:0<o.length?a=o[0]:(a=new s.MeshPhongMaterial({color:13421772}),o.push(a)),"color"in i.attributes&&o.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(r=new s.SkinnedMesh(i,a)).normalizeSkinWeights():r=new s.Mesh(i,a),r}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,n){return t.has(n.ID)?t.get(n.ID):e}),null);var n=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,n)}},{key:"getTransformData",value:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?cs(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&ja.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Fa.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),za.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,n){var r,i=this.parsePoseNodes();for(r in e)!function(){var a=e[r];ja.get(parseInt(a.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,ja.get(e).parents.forEach((function(e){n.has(e.ID)&&n.get(e.ID).bind(new s.Skeleton(a.bones),i[e.ID])})))}))}()}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Fa.Objects){var t,n,r=Fa.Objects.Pose;for(t in r)"BindPose"===r[t].attrType&&0<r[t].NbPoseNodes&&(n=r[t].PoseNode,Array.isArray(n)?n.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[n.Node]=(new s.Matrix4).fromArray(n.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,n;"GlobalSettings"in Fa&&"AmbientColor"in Fa.GlobalSettings&&(n=(t=Fa.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===n&&0===e&&0===t||(n=new s.Color(n,e,t),za.add(new s.AmbientLight(n,1))))}}]),e}(),Qa=function(){function e(){Wa(this,e),this.negativeMaterialIndices=!1}return Ka(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Fa.Objects){var n,r=Fa.Objects.Geometry;for(n in r){var i=ja.get(parseInt(n));i=this.parseGeometry(i,r[n],e),t.set(parseInt(n),i)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}},{key:"parseGeometry",value:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,n){var r,i=n.skeletons,a=[],s=e.parents.map((function(e){return Fa.Objects.Model[e.ID]}));if(0!==s.length)return r=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&a.push(n.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=cs(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=us(s),this.genGeometry(t,r,a,e)}},{key:"genGeometry",value:function(e,t,n,r){var i,a,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new s.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(r),o.setAttribute("position",c),0<u.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(u.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(u.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(u.vertexWeights,4)),o.FBX_Deformer=t),0<u.normal.length&&(c=(new s.Matrix3).getNormalMatrix(r),(t=new s.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),o.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();o.setAttribute(n=0===t?"uv":n,new s.Float32BufferAttribute(u.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(i=u.materialIndex[0],a=0,u.materialIndex.forEach((function(e,t){e!==i&&(o.addGroup(a,t-a,i),i=e,a=t)})),0<o.groups.length&&(t=(c=o.groups[o.groups.length-1]).start+c.count)!==u.materialIndex.length&&o.addGroup(t,u.materialIndex.length-t,i),0===o.groups.length&&o.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(o,e,n,r),o}},{key:"parseGeoNode",value:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))})),n}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],s=[],o=[],l=[],u=[],c=[],d=this;return e.vertexIndices.forEach((function(h,p){var f,m,g,v,y=!1,b=(h<0&&(h^=-1,y=!0),[]),x=[];if(a.push(3*h,3*h+1,3*h+2),e.color&&(v=ss(p,n,h,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[h]&&e.weightTable[h].forEach((function(e){x.push(e.weight),b.push(e.id)})),4<x.length&&(i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0),m=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var n=e,r=b[t];g.forEach((function(e,t,i){e<n&&(i[t]=n,n=e,i=m[t],m[t]=r,r=i)}))})),b=m,x=g);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(v=ss(p,n,h,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=ss(p,n,h,e.material)[0])<0&&(d.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach((function(e,t){e=ss(p,n,h,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),r++,y&&(4<r&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),d.genFace(t,e,a,f,s,o,l,u,c,r),n++,r=0,a=[],s=[],o=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,n,r,i,a,s,o,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[3*u+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(u-1)]),e.vertexWeights.push(o[4*(u-1)+1]),e.vertexWeights.push(o[4*(u-1)+2]),e.vertexWeights.push(o[4*(u-1)+3]),e.vertexWeights.push(o[4*u]),e.vertexWeights.push(o[4*u+1]),e.vertexWeights.push(o[4*u+2]),e.vertexWeights.push(o[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(u-1)]),e.colors.push(a[3*(u-1)+1]),e.colors.push(a[3*(u-1)+2]),e.colors.push(a[3*u]),e.colors.push(a[3*u+1]),e.colors.push(a[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(s[n][0]),e.uvs[n].push(s[n][1]),e.uvs[n].push(s[n][2*(u-1)]),e.uvs[n].push(s[n][2*(u-1)+1]),e.uvs[n].push(s[n][2*u]),e.uvs[n].push(s[n][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,n,r){var i;0!==n.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,n.forEach((function(n){n.rawTargets.forEach((function(n){var a=Fa.Objects.Geometry[n.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,r,n.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,n,r,i){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var a=void 0!==n.Vertices?n.Vertices.a:[],o=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,u=new Float32Array(l),c=0;c<o.length;c++){var d=3*o[c];u[d]=a[3*c],u[1+d]=a[3*c+1],u[2+d]=a[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=i||n.attrName,t.applyMatrix4(r),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:2,buffer:e.UV.a,indices:r="IndexToDirect"===n?e.UVIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:4,buffer:e.Colors.a,indices:r="IndexToDirect"===n?e.ColorIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseNurbsGeometry",value:function(e){var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new s.BufferGeometry;for(var n=t-1,r=(t=e.KnotVector.a,[]),i=e.Points.a,a=0,o=i.length;a<o;a+=4)r.push((new s.Vector4).fromArray(i,a));if("Closed"===e.Form)r.push(r[0]);else if("Periodic"===e.Form)for(var l=n,u=t.length-1-l,c=0;c<n;++c)r.push(r[c]);return e=new Va(n,t,r,l,u).getPoints(12*r.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),Ja=function(){function e(){Wa(this,e)}return Ka(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t)n=t[n],n=this.addClip(n),e.push(n);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Fa.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Fa.Objects.AnimationCurveNode,n=new Map;for(e in t){var r=t[e];null!==r.attrName.match(/S|R|T|DeformPercent/)&&(r={id:r.id,attr:r.attrName,curves:{}},n.set(r.id,r))}return n}},{key:"parseAnimationCurves",value:function(e){var t,n=Fa.Objects.AnimationCurve;for(t in n){var r,i={id:n[t].id,times:n[t].KeyTime.a.map(is),values:n[t].KeyValueFloat.a},a=ja.get(i.id);void 0!==a&&(r=a.parents[0].ID,(a=a.parents[0].relationship).match(/X/)?e.get(r).curves.x=i:a.match(/Y/)?e.get(r).curves.y=i:a.match(/Z/)?e.get(r).curves.z=i:a.match(/d|DeformPercent/)&&e.has(r)&&(e.get(r).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,n=Fa.Objects.AnimationLayer,r=new Map;for(t in n)!function(){var n=[],i=ja.get(parseInt(t));void 0!==i&&(i.children.forEach((function(t,r){if(e.has(t.ID)){var i=e.get(t.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===n[r]){var a=ja.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var o=Fa.Objects.Model[a.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};za.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),n[r]=l}}n[r]&&(n[r][i.attr]=i)}else void 0!==i.curves.morph&&(void 0===n[r]&&(a=ja.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=ja.get(a).parents[0].ID,t=ja.get(t).parents[0].ID,t=ja.get(t).parents[0].ID,t={modelName:(t=Fa.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Fa.Objects.Deformer[a].attrName},n[r]=t),n[r][i.attr]=i)}})),r.set(parseInt(t),n))}();return r}},{key:"parseAnimStacks",value:function(e){var t,n=Fa.Objects.AnimationStack,r={};for(t in n){var i=(1<(i=ja.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(i[0].ID));r[t]={name:n[t].attrName,layer:i}}return r}},{key:"addClip",value:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],n=new s.Vector3,r=new s.Quaternion,i=new s.Vector3;return e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new s.Euler).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.T.curves,n,"position"))&&t.push(n),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(n=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(n),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale"))&&t.push(r),void 0!==e.DeformPercent&&void 0!==(n=this.generateMorphTrack(e))&&t.push(n),t}},{key:"generateVectorTrack",value:function(e,t,n,r){var i=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(i,t,n),new s.VectorKeyframeTrack(e+"."+r,i,t)}},{key:"generateRotationTrack",value:function(e,t,n,r,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,n),u=(void 0!==r&&((r=r.map(s.MathUtils.degToRad)).push(a),r=(new s.Euler).fromArray(r),r=(new s.Quaternion).setFromEuler(r)),void 0!==i&&((i=i.map(s.MathUtils.degToRad)).push(a),i=(new s.Euler).fromArray(i),i=(new s.Quaternion).setFromEuler(i).invert()),new s.Quaternion),c=new s.Euler,d=[],h=0;h<l.length;h+=3)c.set(l[h],l[h+1],l[h+2],a),u.setFromEuler(c),void 0!==r&&u.premultiply(r),void 0!==i&&u.multiply(i),u.toArray(d,h/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,d)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),r=za.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var n=1,r=t[0],i=1;i<t.length;i++){var a=t[i];a!==r&&(r=t[n]=a,n++)}t=t.slice(0,n)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,n){var r=n,i=[],a=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(a=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==a?(e=t.x.values[a],i.push(e),r[0]=e):i.push(r[0]),-1!==s?(e=t.y.values[s],i.push(e),r[1]=e):i.push(r[1]),-1!==o?(e=t.z.values[o],i.push(e),r[2]=e):i.push(r[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n;if(180<=(i=Math.abs(r))){for(var i,a=r/(i/=180),s=n+a,o=(r=e.times[t-1],(e.times[t]-r)/i),l=r+o,u=[],c=[];l<e.times[t];)u.push(l),l+=o,c.push(s),s+=a;e.times=ps(e.times,t,u),e.values=ps(e.values,t,c)}}}}]),e}(),$a=function(){function e(){Wa(this,e)}return Ka(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new ns,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i,a=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);a||s||(a=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),a?t.parseNodeBegin(e,a):s?t.parseNodeProperty(e,s,n[++r]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:n}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(n,r):n in i?("PoseNode"===n?i.PoseNode.push(r):void 0!==i[n].id&&(i[n]={},i[n][i[n].id]=i[n]),""!==t.id&&(i[n][t.id]=r)):"number"==typeof t.id?(i[n]={},i[n][t.id]=r):"Properties70"!==n&&(i[n]="PoseNode"===n?[r]:r),"number"==typeof t.id&&(r.id=t.id),""!==t.name&&(r.attrName=t.name),""!==t.type&&(r.attrType=t.type),this.pushStack(r)}},{key:"parseNodeAttr",value:function(e){var t=e[0],n=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),r="";return 1<e.length&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}},{key:"parseNodeProperty",value:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===r&&","===t&&(t=n.replace(/"/g,"").replace(/,$/,"").trim()),n=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,r,t);else{if("C"===r){e=t.split(",").slice(1);for(var i=parseInt(e[0]),a=(e=parseInt(e[1]),(a=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(r="connections",t=[i,e]),o=a,l=0,u=s.length,c=o.length;l<c;l++,u++)s[u]=o[l];void 0===n[r]&&(n[r]=[])}"Node"===r&&(n.id=t),r in n&&Array.isArray(n[r])?n[r].push(t):"a"!==r?n[r]=t:n.a=t,this.setCurrentProp(n,r),"a"===r&&","!==t.slice(-1)&&(n.a=ds(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=ds(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,n){n=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var r=n[0],i=n[1],a=n[2],s=n[3],o=n[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=ds(o)}this.getPrevNode()[r]={type:i,type2:a,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),r)}}]),e}(),es=function(){function e(){Wa(this,e)}return Ka(e,[{key:"parse",value:function(e){var t=new ts(e),n=(t.skip(23),t.getUint32());if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new ns;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var n={},r=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),a=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(a);if(0===r)return null;for(var o=[],l=0;l<i;l++)o.push(this.parseProperty(e));a=0<o.length?o[0]:"";var u=1<o.length?o[1]:"",c=2<o.length?o[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var d=this.parseNode(e,t);null!==d&&this.parseSubNode(s,n,d)}return n.propertyList=o,"number"==typeof a&&(n.id=a),""!==u&&(n.attrName=u),""!==c&&(n.attrType=c),""!==s&&(n.name=s),n}},{key:"parseSubNode",value:function(e,t,n){var r,i,a,s,o;!0===n.singleProperty?(i=n.propertyList[0],Array.isArray(i)?(t[n.name]=n).a=i:t[n.name]=i):"Connections"===e&&"C"===n.name?(r=[],n.propertyList.forEach((function(e,t){0!==t&&r.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(r)):"Properties70"===n.name?Object.keys(n).forEach((function(e){t[e]=n[e]})):"Properties70"===e&&"P"===n.name?(i=n.propertyList[0],e=n.propertyList[1],a=n.propertyList[2],s=n.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),o="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[i]={type:e,type2:a,flag:s,value:o}):void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}},{key:"parseProperty",value:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=e.getUint32(),r=e.getUint32(),i=e.getUint32();if(0===r)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}r=function(e,t){return function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new ha(0);function i(e){var n=t.length;n<e&&((n=new ha(Math.max(2*n,e))).set(t),t=n)}var a=!t||n,s=!n||n.i,o=(n=n||{},t=t||new ha(3*r),n.f||0),l=n.p||0,u=n.b||0,c=n.l,d=n.d,h=n.m,p=n.n,f=8*r;do{if(!c){n.f=o=ka(e,l,1);var m=ka(e,l+1,3);if(l+=3,!m){var g=e[(M=Aa(l)+4)-4]|e[M-3]<<8;if(r<(S=M+g)){if(s)throw"unexpected EOF";break}a&&i(u+g),t.set(e.subarray(M,S),u),n.b=u+=g,n.p=l=8*S;continue}if(1==m)c=Ea,d=Da,h=9,p=5;else{if(2!=m)throw"invalid block type";g=ka(e,l,31)+257;for(var v=ka(e,l+10,15)+4,y=g+ka(e,l+5,31)+1,b=(l+=14,new ha(y)),x=new ha(19),w=0;w<v;++w)x[va[w]]=ka(e,l+3*w,7);l+=3*v;var S,_=(1<<(S=Pa(x)))-1,T=_a(x,S,1);for(w=0;w<y;){var M,E=T[ka(e,l,_)];if(l+=15&E,(M=E>>>4)<16)b[w++]=M;else{var D=0,P=0;for(16==M?(P=3+ka(e,l,3),l+=2,D=b[w-1]):17==M?(P=3+ka(e,l,7),l+=3):18==M&&(P=11+ka(e,l,127),l+=7);P--;)b[w++]=D}}m=b.subarray(0,g);var k=b.subarray(g);h=Pa(m),p=Pa(k),c=_a(m,h,1),d=_a(k,p,1)}if(f<l){if(s)throw"unexpected EOF";break}}a&&i(u+131072);for(var O=(1<<h)-1,A=(1<<p)-1,C=l;;C=l){var N=(D=c[Oa(e,l)&O])>>>4;if(f<(l+=15&D)){if(s)throw"unexpected EOF";break}if(!D)throw"invalid length/literal";if(N<256)t[u++]=N;else{if(256==N){C=l,c=null;break}var L,I=N-254,R=(264<N&&(L=ma[w=N-257],I=ka(e,l,(1<<L)-1)+ya[w],l+=L),(N=d[Oa(e,l)&A])>>>4);if(!N)throw"invalid distance";if(l+=15&N,k=ba[R],3<R&&(L=ga[R],k+=Oa(e,l)&(1<<L)-1,l+=L),f<l){if(s)throw"unexpected EOF";break}a&&i(u+131072);for(var U=u+I;u<U;u+=4)t[u]=t[u-k],t[u+1]=t[u+1-k],t[u+2]=t[u+2-k],t[u+3]=t[u+3-k];u=U}}n.l=c,n.p=C,n.b=u,c&&(o=1,n.m=h,n.d=d,n.n=p)}while(!o);return u==t.length?t:function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof pa?pa:e instanceof fa?fa:ha)(n-(t=null==t||t<0?0:t));return r.set(e.subarray(t,n)),r}(t,0,u)}((function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),void 0)}(new Uint8Array(e.getArrayBuffer(i)));var a=new ts(r.buffer);switch(t){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),ts=function(){function e(t,n){Wa(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===n||n,this._textDecoder=new TextDecoder}return Ka(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){var t=this.offset,n=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=n.indexOf(0))&&(n=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(n)}}]),e}(),ns=function(){function e(){Wa(this,e)}return Ka(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function rs(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function is(e){return e/46186158e3}var as=[];function ss(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}for(var a=(i="IndexToDirect"===r.referenceType?r.indices[i]:i)*r.dataSize,s=a+r.dataSize,o=as,l=r.buffer,u=s,c=a,d=0;c<u;c++,d++)o[d]=l[c];return o}var os=new s.Euler,ls=new s.Vector3;function us(e){var t=new s.Matrix4,n=new s.Matrix4,r=new s.Matrix4,i=new s.Matrix4,a=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,u=new s.Matrix4,c=new s.Matrix4,d=new s.Matrix4,h=new s.Matrix4,p=new s.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(ls.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(os.fromArray(m))),e.rotation&&((m=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(os.fromArray(m))),e.postRotation&&((m=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),i.makeRotationFromEuler(os.fromArray(m)),i.invert()),e.scale&&a.scale(ls.fromArray(e.scale)),e.scalingOffset&&l.setPosition(ls.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(ls.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(ls.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(ls.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(h.copy(e.parentMatrix),d.copy(e.parentMatrixWorld)),n.clone().multiply(r).multiply(i)),g=(((e=new s.Matrix4).extractRotation(d),g=new s.Matrix4).copyPosition(d),g.clone().invert().multiply(d)),v=(g=e.clone().invert().multiply(g),a),y=new s.Matrix4;return 0===f?y.copy(e).multiply(m).multiply(g).multiply(v):1===f?y.copy(e).multiply(g).multiply(m).multiply(v):(f=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(h)).clone().invert(),h=g.clone().multiply(f),y.copy(e).multiply(m).multiply(h).multiply(v)),g=c.clone().invert(),f=o.clone().invert(),e=t.clone().multiply(u).multiply(c).multiply(n).multiply(r).multiply(i).multiply(g).multiply(l).multiply(o).multiply(a).multiply(f),m=(new s.Matrix4).copyPosition(e),h=d.clone().multiply(m),p.copyPosition(h),(e=p.clone().multiply(y)).premultiply(d.invert()),e}function cs(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function ds(e){return e.split(",").map((function(e){return parseFloat(e)}))}function hs(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,n))}function ps(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}var fs=n(3243),ms=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const gs=t.FBXLoader;class vs{constructor(e){this.parses={fbx:new gs,obj:new da,object:new s.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return ms(this,void 0,void 0,(function*(){let t;switch(this.getBack(e).toLowerCase()){case"ltc":t=this.ltc(e);break;case"gltf":case"glb":case"lt":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e);break;case"json":t=this.json(e);break;case"png":case"jpg":case"webp":case"hdr":t=this.img(e);break;case"mp4":t=this.video(e);break;case"cube":t=this.cube(e);break;case"apng":t=this.apng(e)}return t}))}video(e){return ms(this,void 0,void 0,(function*(){var t=URL.createObjectURL(e);const n=document.createElement("video");return n.src=t,{type:"texture",result:new s.VideoTexture(n)}}))}img(e){return ms(this,void 0,void 0,(function*(){return{type:"texture",result:yield this.runScene.textureEx.parse(e),file:e}}))}glb(e){return ms(this,void 0,void 0,(function*(){var t=yield(0,a.parseFile)(e,"arrayBuffer");return this.glbByData(t)}))}glbByData(e){return ms(this,void 0,void 0,(function*(){let t="model";var n=(yield this.runScene.loaderer.gltf.parse(e,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){t=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}})).models;return{type:t,result:n}}))}fbx(e){return ms(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,a.parseFile)(e,"arrayBuffer");this.runScene.materialEx.create();const n=this.parses.fbx.parse(t,"",{onTextureLoaded:e=>{this.runScene.textureEx.onLoaded(e)},onTextureLoadError(e){}});return n.traverse((e=>{e.material&&(0,et.getMaterials)(e.material).map((t=>{"Line"!==e.type&&("MeshPhongMaterial"===t.type||"MeshLambertMaterial"===t.type?this.runScene.materialEx.afterLoader(t):e.material=t)}))})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(n)]}}))}obj(e){return ms(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,a.parseFile)(e,"text"):e;const n=this.parses.obj.parse(t),r=this.runScene.materialEx.create();return n.traverse((e=>{e.material&&"Line"!==e.type&&(e.material=r)})),{type:"model",result:[this.runScene.sceneEx.cleanUnlessLevel(n)]}}))}json(e){return ms(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,a.parseFile)(e,"text"):e,n=JSON.parse(t);return"timeLine"===n.type?{type:"timeLine",result:n.data}:"timeLineData"===n.type?{type:"timeLineData",result:n.data}:"graph"===n.type?{type:"graph",result:n}:"camera"===n.type?{type:"camera",result:n}:{type:"model",result:[this.runScene.loaderer.json.parse(t)]}}))}ltc(e){return ms(this,void 0,void 0,(function*(){var t=yield e.arrayBuffer();return this.glbByData(t)}))}cube(e){return ms(this,void 0,void 0,(function*(){var t=yield this.runScene.textureEx.parse(e),n=(t=fs.LookupTexture.from(t),e.name.slice(0,e.name.lastIndexOf(".")));const r=this.runScene.ltPP.getPass("Lut");var i;return n="cube/"+n,r&&(r.enable||(yield r.setState(!0)),(i=r.assets.get(n))&&i.userData.blob?r.setAssets(n):(i=yield(0,b.a_)(e),(0,gn.setTextureBlob)(t,i),r.setAssets(n,t)),this.runScene.optionsEx.log("使用滤镜"+n+"成功","base")),{type:"texture-other",result:t}}))}apng(e){return ms(this,void 0,void 0,(function*(){return{type:"texture",result:yield this.runScene.textureEx.parse(e),file:e}}))}}class ys extends r.Z{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},n=()=>{const e=this.runScene.assetsEx.get().renderer;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&this.runScene.cb.controls.change.delete("global-config")},r=e=>{var t=this.runScene.render;const n=this.runScene.assetsEx.get().renderer;"tick"===e?n.setAnimationLoop(t):"controlsChange"===e&&this.runScene.cb.controls.change.add("global-config",t)};return e=>{this._lastRenderMode!==e&&(t(),n(),r(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}setState(e){const t=(0,K.F)(this.runScene);t.renderConfig.stop=!e,t.run=e,this.setEventState(e)}setEventState(e){(0,K.F)(this.runScene).renderConfig.event.trigger=e}}var bs=n(7626);class xs extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var n=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(n),this.targetPosition.multiplyScalar(this.radius).add(n),this.dummy.position.copy(n),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const n=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),n.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),n.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class ws{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.clean=()=>{this.unfocus()},this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=(e,t)=>(e=new s.BoxHelper(e,t),this.runScene.assetsEx.get().scene.add(e),this.setHelper(e,!0),e),this.runScene=e,this.boxHelper=this.getBoxHelper(new s.Group),"running"===this.runScene.optionsEx.options.mode?this.boxHelper.material.opacity=0:(this.runScene.cb.clean.add("EngineHelper",this.clean),this.transContro=new tr(e),this.viewHelper=new xs(e),this.grid=this.createGrid(),this.init(),this.setHelper(this.viewHelper,!0),this.setHelper(this.grid,!0))}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new l.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,n){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,n&&n(e)})),e}focus(e){"running"===this.runScene.optionsEx.options.mode||(0,c.isHelper)(e)||(!1===e.changeMatrixable?this.unfocus():((0,bs.RQ)(e)||(this.boxHelper.visible=!0,this.boxHelper.setFromObject(e)),this.focusModelId=this.runScene.uniqueEx.getId(e)))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}setState(e){this.runScene.modelEx.selectNull(),this.runScene.lightEx.setAllHelpers(e),this.runScene.helperEx.grid.visible=e}}class Ss extends class{constructor(e){this.map=new m.Z,this.options={map:new m.Z,add:(e,t)=>{if(this.options.map.has(e))throw TypeError("该类别已存在");this.options.map.set(e,t)},getSaved:e=>this.options.map.get(e)},this.runScene=e}add(e,t){if(this.map.has(e))return this.runScene.optionsEx.log("该条目已存在");this.map.set(e,t)}set(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=this.map.get(e);return t?(yield Promise.all((0,a.mapObj)(t,((e,t)=>{null!=(e=this.options.getSaved(e))&&e.set(t)}))),!0):Promise.resolve(!1)}))}del(e){return this.map.delete(e)}}{}var _s=n(2510);class Ts{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new m.Z,this.tempOldval=new l.Z.Vector3,this.focusIndex=0,this.runScene=e,this.runScene.cb.undo.undo.add("helperEx",(()=>{this.updateBoxHelper()})),this.runScene.cb.undo.redo.add("helperEx",(()=>{this.updateBoxHelper()})),e.cb.model.setSelect.add("helperEx",(()=>{this.focusIndex=0}))}updateBoxHelper(){(0,a.mapObj)(this.boxHelperMap,((e,t)=>{t.parent&&t.update(),this.runScene.modelEx.onDraging(t.object)}))}add(e,t=!1,n=!0,r){var i,o;if("array"===(0,a.getType)(e))return i=e.map((e=>this.add(e,t,n))),[o]=this.runScene.modelEx.getSelectedModels(),o&&this.add(o,!0,!0,!0),i;(0,c.isHelper)(e)||this.selectors[e.uuid]&&(this.remove(e),this.removeBoxHelper(e),!t)||(this.addBoxHelper(e,r&&new s.Color("0,127,0")),null!=(o=(this.selectors[e.uuid]=e).onSelect)&&o.call(e),this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),n&&this.runScene.helperEx.focus(e),this.runScene.cb.multipSelect.add.cb({model:e,selectIds:this.selectors}))}clearAfterAdd(e,t=!1,n=!0,r){this.runScene.modelEx.selectNull(),this.setEmpty(),this.add(e,t,n,r)}setInfo(e,t,n,r,i,a){"position"!==t&&(i=r,a=n);const s=this.getSelectedList("value");var{x:i,y:o,z:l}=i;const u=i-a.x,c=o-a.y,d=l-a.z,h=[new Vn.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(n),newV3:r,runScene:this.runScene}).execute()];s.map((n=>{if(n!==e){var{x:r,y:i,z:a}=n[t],r=r+=u,i=i+=c,a=a+=d;let e=n[t].clone();e.x=r,e.y=i,e.z=a,r=new Vn.Z({target:n,info:t,oldV3:this.runScene.modelEx.cloneV3(n[t]),newV3:e,runScene:this.runScene}).execute(),h.push(r),this.boxHelperMap[n.uuid].setFromObject(n)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(h)}draggingchanged(e){var t=this.runScene.assetsEx.get().controls;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value||t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1)}transChange(){this.isEmpty()||this.runScene.assetsEx.controls.enabled||(this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),this.updateBoxHelper())}saveV3(e){this.getSelectedList("value").map((t=>{var n=(0,Ye.Ki)(t);this.savedV3.set(n,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:n,model:r})=>new Vn.Z({target:r,info:t,newV3:this.runScene.modelEx.cloneV3(r[t]),oldV3:n,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:n,newV3:r,oldV3:i}=e,a=this.getSelectedList("value");var{x:e,y:s,z:o}=r;const l=e-i.x,u=s-i.y,c=o-i.z;t[n].copy(r),a.map((e=>{if(e!==t){var{x:r,y:i,z:a}=e[n],r=r+=l,i=i+=u,a=a+=c;let t=e[n].clone();t.x=r,t.y=i,t.z=a,e[n].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e,t){100<Object.keys(this.selectors).length||(t=this.runScene.helperEx.getBoxHelper(e,t),this.boxHelperMap[e.uuid]=t)}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),delete this.boxHelperMap[e.uuid],delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){const e=this.runScene.assetsEx.get().scene;Object.values(this.boxHelperMap).map((t=>{e.remove(t)})),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(Object.values(this.boxHelperMap).map((e=>{this.removeBoxHelper(e)})),this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.focusIndex=0,this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var n=[...this.getSelectedList("value")],r=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,lt.qg)(e));t.position.copy(r),this.runScene.cb.model.multipDrop.cb({models:n,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:n,back:r,rmBackLength:i,fullName:a,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===a.length){if(0!==n){if(n>l.length)return;l=l.substring(n)}if(0!==i){if(i>l.length)return;l=l.substring(0,l.length-i)}0<t.length&&(l=t+l),0<r.length&&(l+=r)}else l=a+(o+1)*s;return new _s.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[r]=t;var n=t.map((t=>{var n=t.position.clone();const i=("all"===e?r:t).position.clone();return"all"!==e&&(i[e]=r.position[e]),new Vn.Z({target:t,info:"position",oldV3:n,newV3:i,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(n)}}}class Ms{constructor(e){this.clean=()=>{},this.runScene=e,this.runScene.cb.clean.add("Objects",this.clean)}init(){}parseJSON(e){}}var Es=n(3639),Ds=n(1705),Ps=n(9432);function ks(e){return(ks="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Os(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function As(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Cs(e,t,n){t&&As(e.prototype,t),n&&As(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function Ns(e,t,n){t=Ls(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],Ls(e).constructor):t.apply(e,n))&&("object"===ks(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function Ls(e){return(Ls=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Is(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Rs(e,t)}function Rs(e,t){return(Rs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Us=function(){function e(t,n){var r;return Os(this,e),(r=Ns(this,e)).scene=t,r.camera=n,r.clear=!0,r.needsSwap=!1,r.inverse=!1,r}return Is(e,Ps.w),Cs(e,[{key:"render",value:function(e,t,n){var r,i,a=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),i=this.inverse?(r=0,1):(r=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.buffers.stencil.setFunc(a.ALWAYS,r,4294967295),s.buffers.stencil.setClear(i),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(a.EQUAL,1,4294967295),s.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),s.buffers.stencil.setLocked(!0)}}]),e}(),Bs=function(){function e(){var t;return Os(this,e),(t=Ns(this,e)).needsSwap=!1,t}return Is(e,Ps.w),Cs(e,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),e}();var Fs=function(){function e(t,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,this._pixelRatio=t.getPixelRatio(),void 0===n?(t=t.getSize(new or.Vector2),this._width=t.width,this._height=t.height,(n=new or.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:or.HalfFloatType})).texture.name="EffectComposer.rt1"):(this._width=n.width,this._height=n.height),this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new Ds.T(Es.C),this.copyPass.material.blending=or.NoBlending,this.clock=new or.Clock}var t,n;return t=e,(n=[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),n=!1,r=0,i=this.passes.length;r<i;r++){var a,s,o=this.passes[r];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap&&(n&&(a=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(a.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Us&&(o instanceof Us?n=!0:o instanceof Bs&&(n=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new or.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(n,r)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function js(e){return(js="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zs(e,t,n){t=Vs(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],Vs(e).constructor):t.apply(e,n))&&("object"===js(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function Vs(e){return(Vs=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Hs(e,t){return(Hs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ws=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null,s=this,o=n;if(s instanceof o)return(s=zs(this,n)).scene=e,s.camera=t,s.overrideMaterial=r,s.clearColor=i,s.clearAlpha=a,s.clear=!0,s.clearDepth=!1,s.needsSwap=!1,s._oldClearColor=new or.Color,s;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hs(t,e),t=n,(e=[{key:"render",value:function(e,t,n){var r,i,a=e.autoClear;e.autoClear=!1,null!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor)),null!==this.clearAlpha&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),1==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(Ps.w),Gs={name:"GammaCorrectionShader",uniforms:{tDiffuse:{value:null}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 tex = texture2D( tDiffuse, vUv );\n\n\t\t\tgl_FragColor = sRGBTransferOETF( tex );\n\n\t\t}"};class Ks extends or.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class Zs extends Ks{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const n=this.defines,r=this.modifiedDefines;null==t?e in n&&(e in r||(r[e]=n[e]),delete n[e]):n[e]!==t&&(e in r||(r[e]=e in n?n[e]:void 0),n[e]=t)}setTextureUniform(e,t){const n=this.uniforms,r=this.modifiedUniforms;e in r||(r[e]=n[e].value),n[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const n in e)void 0===e[n]?n in t&&(this.needsUpdate=!0):t[n]!==e[n]&&(this.needsUpdate=!0),delete e[n];const n=this.modifiedUniforms;var r=this.uniforms;for(const e in n)n[e]!==r[e].value&&(this.needsUpdate=!0),delete n[e]}}const qs=new WeakMap;class Xs{constructor(e){this._replacementMaterial=new Zs(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,n=!0){const r=this;function i(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!a.has(e)){const t=r.createMaterial(e);a.set(e,t)}const t=a.get(e);if(null!==t){let i=e.material;n?s.set(e,i):i=s.get(e),i||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),r.updateUniforms(e,i,t),t.finalize&&t.finalize(),e.material=t}}}const a=this._replacementMaterials,s=qs;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)e[t].traverse(i);else for(let t=0,n=e.length;t<n;t++)i(e[t]);else t?e.traverse(i):i(e)}reset(e,t){function n(e){e.isHelper||(r.has(e)?(e.material=r.get(e),r.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const r=qs;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)n(e[t]);else for(let t=0,r=e.length;t<r;t++)e[t].traverse(n);else t?e.traverse(n):n(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,n){var r=this._replacementMaterial.defines,i=t.defines;const a=n.defines;if(n.side=t.side,n.flatShading=t.flatShading,n.skinning=t.skinning,i){for(const e in i)n.setDefine(e,i[e]);for(const e in a)e in i?n.setDefine(e,i[e]):n.setDefine(e,r[e])}const s=n.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?n.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const r=s[e];e in t&&t[e]!==r.value&&(r.value&&r.value.isTexture||t[e]&&t[e].isTexture?n.setTextureUniform(e,t[e]):r.value=t[e])}var{overrideDefines:u,overrideUniforms:c}=this;for(const e in u)null===u[e]||void 0===u[e]?delete a[e]:a[e]!==u[e]&&(a[e]=u[e],n.needsUpdate=!0);for(const e in c)e in s&&(s[e].value=c[e].value)}dispose(){}}class Ys extends Xs{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,n){super.updateUniforms(e,t,n),n.setDefine("USE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("ALPHATEST",n.uniforms.alphaTest.value||void 0),n.setDefine("USE_ALPHAMAP",0!==n.defines.ALPHATEST&&n.uniforms.alphaMap.value?"":void 0),n.setDefine("USE_MAP",0!==n.defines.ALPHATEST&&n.uniforms.map.value?"":void 0),n.setDefine("USE_UV","USE_ALPHAMAP"in n.defines||"USE_MAP"in n.defines?"":void 0)}}class Qs extends Xs{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,n){super.updateUniforms(e,t,n),this.invertSide&&(n.side=n.side===s.FrontSide?s.BackSide:s.FrontSide),e=n.defines.ALPHATEST,0===n.uniforms.alphaTest.value?delete n.defines.ALPHATEST:n.defines.ALPHATEST=n.uniforms.alphaTest.value,e!==n.defines.ALPHATEST&&(n.needsUpdate=!0),e=n.defines.USE_ALPHAMAP,0!==n.defines.ALPHATEST&&n.uniforms.alphaMap.value?n.defines.USE_ALPHAMAP="":delete n.defines.USE_ALPHAMAP,e!==n.defines.USE_ALPHAMAP&&(n.needsUpdate=!0),e=n.defines.USE_MAP,0!==n.defines.ALPHATEST&&n.uniforms.map.value?n.defines.USE_MAP="":delete n.defines.USE_MAP,e!==n.defines.USE_MAP&&(n.needsUpdate=!0),e=n.defines.USE_UV,"USE_ALPHAMAP"in n.defines||"USE_MAP"in n.defines?n.defines.USE_UV="":delete n.defines.USE_UV,e!==n.defines.USE_UV&&(n.needsUpdate=!0)}}const Js={uniforms:{tex:{value:null},displayRoughness:{value:0}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float displayRoughness;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat roughness = texVal.a;\n\t\t\tvec3 packedNormal = texVal.xyz;\n\t\t\tvec3 unpackedNormal = ( packedNormal - 0.5 ) * 2.0;\n\t\t\tgl_FragColor = mix(\n\t\t\t\tvec4( unpackedNormal, 1.0 ),\n\t\t\t\tvec4( roughness, roughness, roughness, 1.0 ),\n\t\t\t\tdisplayRoughness\n\t\t\t);\n\n\t\t}\n\t"},$s={uniforms:{tex:{value:null}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float divide;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat depthVal = mod( - texVal.r, 1.0 );\n\t\t\tgl_FragColor = vec4( depthVal );\n\n\t\t}\n\t"},eo={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new or.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new or.Vector4},projInfo:{value:new or.Vector4},params:{value:new or.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},to={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new or.Vector2},aoSize:{value:new or.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new or.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class no{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:n}=this;let r=1/0,i=-1;for(let a=0,s=n.length;a<s;a++)0===n[a]&&(e=t[a])<r&&(r=e,i=a);return i}findCluster(){var e,{score:t,binaryPattern:n}=this;let r=-1/0,i=-1;for(let a=0,s=n.length;a<s;a++)1===n[a]&&(e=t[a])>r&&(r=e,i=a);return i}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),n=2*t+1;const s=new Float32Array(n*n);var r=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var i=(t+o)*n+e+t,a=e*e+o*o;s[i]=Math.pow(Math.E,-a/(2*r))}this.lookupTable=s,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:n}=this;t.fill(0);for(let t=0,a=e.length;t<a;t++){var r,i;0===e[t]?(r=~~(t/n),i=t-r*n,this.updateScore(i,r,1),e[t]=1):e[t]=0}}updateScore(e,t,n){const{size:r,score:i,lookupTable:a}=this;var s=this.radius,o=2*s+1;for(let c=-s;c<=s;c++)for(let d=-s;d<=s;d++){var l=a[(s+d)*o+c+s];let h=e+c,p=(h=h<0?r+h:h%r,t+d);var u=(p=p<0?r+p:p%r)*r+h;i[u]+=n*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class ro{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new no(1),this.savedSamples=new no(1)}generate(){const{samples:e,savedSamples:t,sigma:n,majorityPointsRatio:r,size:i}=this;e.resize(i),e.setSigma(n);var a=Math.floor(i*i*r),s=e.binaryPattern,o=s,l=a;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[u,c=Math.random]=[s,this.random];for(let e=u.length-1;0<e;e--){var d=~~((c()-1e-6)*e),h=u[e];u[e]=u[d],u[d]=h}for(let t=0,n=s.length;t<n;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),f=(e.removePointIndex(p),e.findVoid());if(p===f){e.addPointIndex(p);break}e.addPointIndex(f)}const m=new Uint32Array(i*i);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),m[v]=g,g--}var y=i*i;for(g=t.count;g<y/2;){var b=t.findVoid();t.addPointIndex(b),m[b]=g,g++}for(t.invert();g<y;){var x=t.findCluster();t.removePointIndex(x),m[x]=g,g++}return{data:m,maxValue:y}}}class io extends Ps.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:io.DEFAULT},this.renderTargetScale=1,this.enableJitter=!0,this.radiusJitter=0,this.rotationJitter=0,this.numSteps=8,this.numDirections=8,this.intensity=1,this.radius=2,this.directionOffset=0,this.stepOffset=0,this.blurMode=io.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new Qs,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Ys,this.gtaoQuad=new Ps.T(new s.ShaderMaterial(eo)),this.debugPackedQuad=new Ps.T(new s.ShaderMaterial(Js)),this.debugDepthQuad=new Ps.T(new s.ShaderMaterial($s)),this.compositeQuad=new Ps.T(new s.ShaderMaterial(to));const n=new ro,r=(n.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var i=n.generate(),a=i.data,o=i.maxValue;for(let t=0,n=a.length;t<n;t++)r[4*t+e]=a[t]/o*255}this.blueNoiseTex=new s.DataTexture(r,n.size,n.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var n=this.renderTargetScale,r=Math.floor(e*n);n=Math.floor(t*n),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(r,n)}render(e,t,n){t=this.renderToScreen?null:t;const{scene:r,camera:i,debug:a,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:u,gtaoQuad:c}=this,d=c.material;io.RendererState.copy(e,r);var h=()=>{io.RendererState.restore(e,r),f.reset(r,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(r.background=null,f.replace(r,!0,!0),e.setRenderTarget(p),e.setClearColor(io.BlackColor,0),e.clear(),e.render(r,i),a.display===io.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void h();const m=this._normalReplacement;var g=this._normalBuffer;if(m.replace(r,!0,!1),e.setRenderTarget(g),e.clear(),e.render(r,i),a.display===io.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.render(e),void h();this.numSteps!==d.defines.NUM_STEPS&&(d.defines.NUM_STEPS=this.numSteps,d.needsUpdate=!0),this.numDirections!==d.defines.NUM_DIRECTIONS&&(d.defines.NUM_DIRECTIONS=this.numDirections,d.needsUpdate=!0),this.radius.toFixed(16)!==d.defines.RADIUS&&(d.defines.RADIUS=this.radius.toFixed(16),d.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===d.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===d.defines.FALLOFF_END2&&this.enableFalloff===Boolean(d.defines.ENABLE_FALLOFF)||(d.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),d.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),d.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,d.needsUpdate=!0),this.rotationJitter!==d.defines.ENABLE_ROTATION_JITTER&&(d.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,d.needsUpdate=!0),this.radiusJitter!==d.defines.ENABLE_RADIUS_JITTER&&(d.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,d.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(d.defines.ENABLE_COLOR_BOUNCE)&&(d.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,d.needsUpdate=!0);var v=this._gtaoBuffer,y=Math.floor(v.texture.image.width),b=Math.floor(v.texture.image.height),x=i.projectionMatrix,w=s.MathUtils.DEG2RAD*i.fov;d.uniforms.params.value.set(this.directionOffset,this.stepOffset),d.uniforms.projInfo.value.set(2/(y*x.elements[0]),2/(b*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),d.uniforms.clipInfo.value.set(i.near,i.far,b/(2*Math.tan(.5*w))*.5,0),d.uniforms.normalBuffer.value=g.texture,d.uniforms.depthBuffer.value=p.texture,d.uniforms.colorBuffer.value=n.texture,d.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,d.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),d.uniforms.blueNoiseTex.value=this.blueNoiseTex,d.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),c.render(e);const S=u.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=n.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(n.width,n.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),a.display===io.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),a.display===io.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),u.render(e),h()}}io.NO_JITTER=0,io.RANDOM_JITTER=1,io.BLUENOISE_JITTER=2,io.DEFAULT=0,io.DEPTH=1,io.NORMAL=2,io.AO_SAMPLE=3,io.COLOR_SAMPLE=4,io.NO_BLUR=0,io.BOX_BLUR=1,io.CROSS_BLUR=2,io.DIAGONAL_BLUR=3,io.BlackColor=new s.Color(0),io.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background),this.renderTarget=null,this.overrideMaterial=null}};class ao{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new io(this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.gtaoPass)}setAOData(e,t){"rotationJitter"===e||"radiusJitter"===e?"NONE"===t?this.gtaoPass[e]=0:"RANDOM"===t?this.gtaoPass[e]=1:"BLUE_NOISE"===t&&(this.gtaoPass[e]=2):"blurMode"===e?"NO_BLUR"===t?this.gtaoPass[e]=0:"BOX_BLUR"===t?this.gtaoPass[e]=1:"CROSS_BLUR"===t?this.gtaoPass[e]=2:"DIAGONAL_BLUR"===t&&(this.gtaoPass[e]=3):this.gtaoPass[e]="ambientColor"===e?new Au.Color(t):t}dispose(){this.gtaoPass&&(this.gtaoPass.dispose(),this.gtaoPass=null)}enablePass(e){this.gtaoPass&&this.gtaoPass.enabled!==e&&(this.gtaoPass.enabled=e)}}var so={name:"LuminosityHighPassShader",shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new or.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function oo(e){return(oo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lo(e){return(lo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function uo(e,t){return(uo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var co=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t,r,i){var a;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(a=function(e,t,n){t=lo(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,[],lo(e).constructor):t.apply(e,n))&&("object"===oo(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n)).strength=void 0!==t?t:1,a.radius=r,a.threshold=i,a.resolution=void 0!==e?new or.Vector2(e.x,e.y):new or.Vector2(256,256),a.clearColor=new or.Color(0,0,0),a.renderTargetsHorizontal=[],a.renderTargetsVertical=[],a.nMips=5;var s=Math.round(a.resolution.x/2),o=Math.round(a.resolution.y/2);a.renderTargetBright=new or.WebGLRenderTarget(s,o,{type:or.HalfFloatType}),a.renderTargetBright.texture.name="UnrealBloomPass.bright",a.renderTargetBright.texture.generateMipmaps=!1;for(var l=0;l<a.nMips;l++){var u;((u=new or.WebGLRenderTarget(s,o,{type:or.HalfFloatType})).texture.name="UnrealBloomPass.h"+l,u.texture.generateMipmaps=!1,a.renderTargetsHorizontal.push(u),u=new or.WebGLRenderTarget(s,o,{type:or.HalfFloatType})).texture.name="UnrealBloomPass.v"+l,u.texture.generateMipmaps=!1,a.renderTargetsVertical.push(u),s=Math.round(s/2),o=Math.round(o/2)}r=so;for(var c=(a.highPassUniforms=or.UniformsUtils.clone(r.uniforms),a.highPassUniforms.luminosityThreshold.value=i,a.highPassUniforms.smoothWidth.value=.01,a.materialHighPassFilter=new or.ShaderMaterial({uniforms:a.highPassUniforms,vertexShader:r.vertexShader,fragmentShader:r.fragmentShader}),a.separableBlurMaterials=[],[3,5,7,9,11]),d=(s=Math.round(a.resolution.x/2),o=Math.round(a.resolution.y/2),0);d<a.nMips;d++)a.separableBlurMaterials.push(a.getSeperableBlurMaterial(c[d])),a.separableBlurMaterials[d].uniforms.invSize.value=new or.Vector2(1/s,1/o),s=Math.round(s/2),o=Math.round(o/2);return a.compositeMaterial=a.getCompositeMaterial(a.nMips),a.compositeMaterial.uniforms.blurTexture1.value=a.renderTargetsVertical[0].texture,a.compositeMaterial.uniforms.blurTexture2.value=a.renderTargetsVertical[1].texture,a.compositeMaterial.uniforms.blurTexture3.value=a.renderTargetsVertical[2].texture,a.compositeMaterial.uniforms.blurTexture4.value=a.renderTargetsVertical[3].texture,a.compositeMaterial.uniforms.blurTexture5.value=a.renderTargetsVertical[4].texture,a.compositeMaterial.uniforms.bloomStrength.value=t,a.compositeMaterial.uniforms.bloomRadius.value=.1,a.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],a.bloomTintColors=[new or.Vector3(1,1,1),new or.Vector3(1,1,1),new or.Vector3(1,1,1),new or.Vector3(1,1,1),new or.Vector3(1,1,1)],a.compositeMaterial.uniforms.bloomTintColors.value=a.bloomTintColors,e=Es.C,a.copyUniforms=or.UniformsUtils.clone(e.uniforms),a.blendMaterial=new or.ShaderMaterial({uniforms:a.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:or.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),a.enabled=!0,a.needsSwap=!1,a._oldClearColor=new or.Color,a.oldClearAlpha=1,a.basic=new or.MeshBasicMaterial,a.fsQuad=new Ps.T(null),a}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&uo(t,e),t=n,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(var n=0;n<this.separableBlurMaterials.length;n++)this.separableBlurMaterials[n].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(n,r),this.renderTargetsVertical[i].setSize(n,r),this.separableBlurMaterials[i].uniforms.invSize.value=new or.Vector2(1/n,1/r),n=Math.round(n/2),r=Math.round(r/2)}},{key:"render",value:function(e,t,r,i,a){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),a&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){for(var t=[],n=0;n<e;n++)t.push(.39894*Math.exp(-.5*n*n/(e*e))/e);return new or.ShaderMaterial({defines:{KERNEL_RADIUS:e},uniforms:{colorTexture:{value:null},invSize:{value:new or.Vector2(.5,.5)},direction:{value:new or.Vector2(.5,.5)},gaussianCoefficients:{value:t}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new or.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(Ps.w);co.BlurDirectionX=new or.Vector2(1,0),co.BlurDirectionY=new or.Vector2(0,1);class ho extends Ps.w{constructor(e,t,n){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==n?n:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Ps.T(this.material)}render(e,t,n){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class po extends Ps.w{constructor(e,t,n,r,i){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,n){var r=e.autoClear;let i,a;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),this.scene.background=this.sceneBg,e.autoClear=r}}const fo={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class mo{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomRenderPass?(this.bloomRenderPass.scene=this.mtuPP.mainScene,this.bloomRenderPass.camera=this.mtuPP.mainCamera):(this.bloomRenderPass=new po(this.mtuPP.mainScene,this.mtuPP.mainCamera),this.bloomRenderPass.layerIndex=this.mtuPP.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1),this.bloomPass?this.bloomPass.setSize(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y):this.bloomPass=new co(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mixingPass||(this.mixingPass=new ho(fo,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new Ds.T(Es.C),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.mtuPP.effectComposer.addPass(this.effectCopy),this.mtuPP.effectComposer.addPass(this.bloomRenderPass),this.mtuPP.effectComposer.addPass(this.bloomPass),this.mtuPP.effectComposer.addPass(this.mixingPass)}setGlowData(e,t){this.bloomPass[e]=t}dispose(){this.bloomRenderPass=null,this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=null}setSceneBg(){this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.mtuPP.sceneBackground)}enablePass(e){this.bloomRenderPass&&this.bloomRenderPass.enabled!==e&&(this.bloomRenderPass.enabled=e,this.bloomPass.enabled=e,this.mixingPass.enabled=e,this.effectCopy.enabled=e)}}const go="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",vo="\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n gl_FragColor = (texture2D(baseTexture, vUv) + vec4(1.0) * texture2D(bloomTexture, vUv));\n }\n ";class yo{constructor(e){this.mtuPP=e,this.bloomLayer=new Au.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new Au.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new Au.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new co(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new Ds.T(new Au.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:go,fragmentShader:vo,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new Au.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new Fs(this.mtuPP.renderer,e),this.finalComposer.addPass(this.mtuPP.renderPass),this.finalComposer.addPass(this.finalPass)}renderBloom(e){var t;this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.BLACK_COLOR),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.BLACK_COLOR),e?(this.mtuPP.mainScene.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.mtuPP.effectComposer.render(),this.mtuPP.mainScene.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(this.mtuPP.mainCamera.layers.set(this.mtuPP.BLOOM_SCENE),this.mtuPP.effectComposer.render(),this.mtuPP.mainCamera.layers.set(this.mtuPP.ENTIRE_SCENE)),this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.sceneFogColor),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.sceneBackground)}render(){this.renderBloom(!0),this.finalComposer.render()}setGlowData(e,t){this.bloomPass[e]=t}setSize(e,t){this.finalComposer&&this.finalComposer.setSize(e,t)}dispose(){this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.finalPass=null,this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}enablePass(e){this.bloomPass&&this.bloomPass.enabled!==e&&(this.bloomPass.enabled=e,this.finalPass.enabled=e)}}class bo{constructor(e){this.outlineModelLength=new Set,this.modelMap=new m.Z,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:n,change:r}=this.runScene.cb.model;r.add("pp-set-glow",(e=>{const{model:t,type:n,val:r}=e;"visible"===n&&(t.traverse((e=>{(0,c.isGLowModel)(e)&&this.modelMap.set((0,Ye.Ki)(e),r)})),this.afterGLowModelSet())})),e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelMap.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),n.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.modelMap.set(e.userData.id,e.visible),this.afterGLowModelSet()}glowRemove(e){this.modelMap.delete(e.userData.id),this.afterGLowModelSet()}afterGLowModelSet(){var e=0<this.modelMap.size&&this.modelMap.find(((e,t)=>!0===t))||!1;this.runScene.pp.params.glow.isBloom!==e&&(this.runScene.cb.pp.glow.setStatus.cb(e),this.runScene.pp.params.glow.isBloom=e)}initOutline(){const{setOutline:e,add:t,remove:n}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),n.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var xo={name:"VignetteShader",uniforms:{tDiffuse:{value:null},offset:{value:1},darkness:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float offset;\n\t\tuniform float darkness;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t// Eskil's vignette\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\n\t\t\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\n\n\t\t}"};const wo={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}}},So={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}}},_o={isUpdate:{type:"boolean",val:!0,isUpdate:!1,setIsUpdate:!0,shortKey:"isUpdate",get:e=>e.isUpdate,set:e=>{const{target:t,end:n}=e;t.isUpdate=n}}};class To{constructor(e){this.params=this.getDefaultParams(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"setPp",map:{parse:e=>{const t=e.model;return Promise.all(e.childs.map((e=>{var{glow:e,outline:n}=e;this.runScene.modelEx.setGlow(t,e),this.runScene.modelEx.setOutline(t,n)})))}}})},this.update=()=>{var e,t=(0,K.F)(this.runScene);this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&!0!==(null==(e=t.renderConfig)?void 0:e.stop)&&(!t.renderConfig.native&&(this.params.glow.isBloom||this.params.outline.isOutline||this.params.ao.isAO||this.params.vignette.isVignette)?(this.vignettePass.enabled=this.params.vignette.isVignette,this.mtAO&&this.mtAO.enablePass(this.params.ao.isAO),this.mtOutline&&this.mtOutline.enablePass(this.params.outline.isOutline),this.isChrome&&this.mtuGlow?(this.mtuGlow.enablePass(this.params.glow.isBloom),this.effectComposer.render()):this.isSafari&&this.threeGlow&&(this.threeGlow.enablePass(this.params.glow.isBloom),this.threeGlow.render())):this.renderer.render(this.mainScene,this.mainCamera))},this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new Au.Color(0),this.runScene=e,this.info=new bo(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new Au.Vector2,this.sceneFogColor=null,this.sceneBackground=null,this.isUpdate=!0,this.runScene.exporter.gltf.options.addOption({type:"post-processing",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.fromJSON(e)}}),this.runScene.cb.clean.add("pp",this.clean),e.cb.render.add("pp",this.update),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new Au.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,gn.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)})),this.runScene.snapshot.bind({name:"glow",target:this.params.glow,def:wo}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:So}),this.runScene.snapshot.bind({name:"mtPp",target:this,def:_o,set:t=>{e.cb.renderEx.setRenderPipe.cb()}}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:_o,set:e=>{const t=e.snapshot.data.get("ao");t&&(nn.LV.set({def:_o,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,a.mapObj)(_o,((e,n)=>{var{type:n,val:r,shortKey:i}=n;"other"===n&&(n=i||e,this.setAOData(e,void 0!==t[n]?t[n]:r))}))})))}}),e.cb.inited.add("pp",this.onInited)}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,b.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:n}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=n,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new Fs(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new Ws(this.mainScene,this.mainCamera),this.gammaPass=new Ds.T(Gs),this.vignettePass=new Ds.T(xo),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass),this.effectComposer.addPass(this.gammaPass)}getNewRenderTarget(e){const t=new Au.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new Au.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=Au.UnsignedIntType,t.depthTexture.format=Au.DepthFormat,t.texture.format=Au.RGBAFormat,t}ppOutline(){this.mtOutline=new Xt.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new mo(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new yo(this))}ppAO(){this.mtAO=new ao(this)}onRenderEncodingChanged(e){this.gammaPass.enabled="def"!==e}toJSON(){const e={};var{pp:t,glow:n,outline:r,ao:i,vignette:a}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},n),e.outlineParams=Object.assign({},r),e.aoParams=Object.assign({},i),e.vignetteParams=Object.assign({},a),e.isUpdate=this.isUpdate,JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:n,aoParams:r,vignetteParams:i,isUpdate:a}=e;!1===a&&(this.isUpdate=!1),e&&(a=e.samples,this.params.pp.samples=a,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.params.glow)),n&&this.mtOutline&&(this.params.outline.isOutline=n.isOutline,this.setOutlineData("edgeStrength",n.edgeStrength),this.setOutlineData("edgeGlow",n.edgeGlow),this.setOutlineData("edgeThickness",n.edgeThickness),this.setOutlineData("pulsePeriod",n.pulsePeriod),this.setOutlineData("visibleEdgeColor",n.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",n.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),r&&this.mtAO&&(this.params.ao.isAO=r.isAO,this.setAOData("directionOffset",r.directionOffset),this.setAOData("stepOffset",r.stepOffset),this.setAOData("rotationJitter",r.rotationJitter),this.setAOData("radiusJitter",r.radiusJitter),this.setAOData("numSteps",r.numSteps),this.setAOData("numDirections",r.numDirections),this.setAOData("intensity",r.intensity),this.setAOData("radius",r.radius),this.setAOData("enableFalloff",r.enableFalloff),this.setAOData("falloffStart",r.falloffStart),this.setAOData("falloffEnd",r.falloffEnd),this.setAOData("renderTargetScale",r.renderTargetScale),this.setAOData("blurMode",r.blurMode),this.setAOData("blurIterations",r.blurIterations),this.setAOData("blurStride",r.blurStride),this.setAOData("ambientColor",r.ambientColor),this.setAOData("ambientIntensity",r.ambientIntensity),this.setAOData("lightBounceIntensity",r.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),i&&this.vignettePass&&(this.params.vignette.isVignette=i.isVignette,this.setVignetteData("offset",i.offset),this.setVignetteData("darkness",i.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}setSize(e,t){this.rtSize.x=e,this.rtSize.y=t,this.effectComposer&&this.effectComposer.setSize(e,t),this.isChrome&&this.mtuGlow||this.isSafari&&this.threeGlow&&this.threeGlow.setSize(e,t)}reset(){this.runScene.pp.dispose(),this.runScene.pp.init()}dispose(){this.isChrome&&this.mtuGlow?this.mtuGlow.dispose():this.isSafari&&this.threeGlow&&this.threeGlow.dispose(),this.mtOutline&&this.mtOutline.dispose(),this.renderPass=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}setPPData(e,t){this.params.pp[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))}setGlowData(e,t){this.params.glow[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.params.outline[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.params.ao[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.params.vignette[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}setState(e){this.isUpdate=e}}var Mo=n(3228),Eo=n(713);class Do extends r.Z{constructor(e){super(e),this.map=new m.Z,this.playLimit=new b.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var n=(0,Ye.Ki)(t);0===Object.keys(e||{}).length?this.map.has(n)&&this.map.delete(n):this.map.set(n,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:n}=e;var{moveX:e,moveY:r,rotate:i}=n;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),r&&(t.offset.y+=r),i&&(t.rotation+=i)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1e3/e*.001,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let n=0,r=0,i=0;t.userData.scriptTextre&&(n=(e=t.userData.scriptTextre).offsetX,r=e.offsetY,i=e.rotation,delete t.userData.scriptTextre),t.offset.x=n,t.offset.y=r,t.rotation=i})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class Po{constructor(e){this.map=new m.Z,this.parse=e=>{const t=e.model;this.getState(t)?this.map.set((0,Ye.Ki)(t),{model:t,oldRotate:t.rotation.toArray()}):(this.close(t),this.map.delete((0,Ye.Ki)(t)))},this.render=()=>{var e=this.runScene.assetsEx.get().camera;const{x:t,y:n,z:r}=e.position;this.map.map(((e,{model:i})=>{i.lookAt(t,n,r)}))},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lookat",this.parse),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookAt",(()=>{this.closeAll()}))}setState(e,t){t?(0,hr.M)(e,"lookAt",!0):delete e.userData.lookAt,this.parse({model:e})}getState(e){return!0===(0,hr.is)(e,"lookAt")}close(e){var t=this.map.get((0,Ye.Ki)(e));t&&e.rotation.fromArray(t.oldRotate)}closeAll(){this.map.map(((e,{model:t,oldRotate:n})=>{t.rotation.fromArray(n)}))}}class ko{constructor(e){this.map=new m.Z,this.dataMap=new m.Z,this.parseModel=e=>{var t=(0,Ye.Ki)(e);if(t){const n=this.awaitMap.get(t);n&&(n.map((t=>{let n=this.dataMap.get(t);n&&n.models.push({model:e})})),this.awaitMap.delete(t))}},this.loadedComplete=()=>{this.parseModel(this.runScene.assetsEx.get().camera)},this.clean=()=>{this.map.clear(),this.awaitMap.clear(),this.dataMap.clear()},this.awaitMap=new m.Z,this.parseJSON=e=>{(0,a.mapObj)(e,((e,t)=>{t.locals=t.locals.map((e=>new s.Vector3(e.x,e.y,e.z)));const n=t.modelIds;t.modelIds=new Et.Z,this.map.set(e,t),n.map((e=>{t.modelIds.add(e);let n=this.awaitMap.get(e);var r;n||(r=new Et.Z,this.awaitMap.set(e,r),n=r),n.add(t.id)})),this.addDataByMap(t)}))},this.render=()=>{},this.runScene=e,this.bindEvent()}bindEvent(){this.runScene.cb.unique.model.add.add("script-lineAnima",(({model:e})=>{this.parseModel(e)})),this.runScene.cb.render.add("script-lookat",this.render),this.runScene.cb.exporter.gltf.before.add("script-lookat",(()=>{this.closeAll()})),this.runScene.cb.clean.add("script-lookat",this.clean),this.runScene.cb.loaderer.gltf.complete.add("script-lookat",this.loadedComplete),this.runScene.cb.load.complete.add("script-lookat",this.loadedComplete)}addDataByMap(e){e.loadTrigger&&this.dataMap.set(e.id,this.getData(e))}add(e){this.map.set(e.id,e),this.addDataByMap(e)}toJSON(){return this.map}getData(e){return{models:[],curve:(0,lt.kG)(e.locals,{closed:e.closed}).curve,run:!1,timer:void 0,delay:e.delay,delayed:!1,speed:e.speed,loop:e.loop,randomTime:e.randomTime}}getOldLocal(e){return{oldPostion:e.position.clone(),oldRotation:e.rotation.clone()}}del(e){this.map.delete(e)}set(e,t){const n=this.dataMap.get(e);var r,i,a,s,o;n&&(r=this.map.get(e),({speed:i,loop:a,delay:s,closed:o}=t),this.map.set(e,t),n.speed=i,n.loop=a,n.delay=s,o!==r.closed&&(n.curve=(0,lt.kG)(t.locals,{closed:o}).curve))}use(e,t){const n=this.map.get(e);if(n&&n.modelIds.size!==(n.modelIds.add((0,Ye.Ki)(t)),n.modelIds.size)){const n=this.dataMap.get(e);n&&n.models.push(Object.assign({model:t},this.getOldLocal(t)))}}unUse(e,t){const n=(0,Ye.Ki)(t);if(n){e.modelIds.delete(n);const r=this.dataMap.get(e.id);!r||-1!==(t=r.models.findIndex((e=>(0,Ye.Ki)(e.model)===n)))&&r.models.splice(t,1)}}playAll(){this.dataMap.map(((e,t)=>{this.playByData(t)}))}playByData(e){e.run=!0,e.models.map((e=>{var t=e.model,{oldPostion:t,oldRotation:n}=this.getOldLocal(t);e.oldPostion=t,e.oldRotation=n,e.pgs=0})),this.onPlayBefore(e)}play(e){!this.map.get(e)||(e=this.dataMap.get(e))&&this.playByData(e)}playByName(e){var t=this.map.find(((t,n)=>n.name===e));!t||(t=this.dataMap.get(t.id))&&this.playByData(t)}onPlayBefore(e){var{delayed:t,delay:n}=e;t||(e.timer&&clearTimeout(e.timer),e.timer=setTimeout((()=>{e.delayed=!0}),1e3*n))}closeByData(e){const t=e.models;e.run&&(e.run=!1,t.map((e=>{const{model:t,oldPostion:n,oldRotation:r}=e;void 0!==n&&t.position.copy(n),void 0!==r&&t.rotation.copy(r)})),this.runScene.setUpdate())}close(e){(e=this.dataMap.get(e))&&this.closeByData(e)}closeByName(e){var t=this.map.find(((t,n)=>n.name===e));(t=this.dataMap.get(null==t?void 0:t.id))&&this.closeByData(t)}closeAll(){this.dataMap.map((e=>{this.close(e)}))}getLocalsByModels(e){const[t]=e;var n;return"Line"===t.type?(t.matrixWorldNeedsUpdate=!0,n=t.geometry.attributes.position.applyMatrix4(t.matrixWorld),(0,lt.F)(n.array)):e.map((e=>(0,lt.VU)(e,this.runScene.assetsEx.scene)))}}class Oo{constructor(e){this.map=new m.Z,this.allAnima=[],this.runScene=e}play(e,t){var n;0!==e.children.length&&(n=(0,Ye.Ki)(e))&&(this.map.set(n,{model:e}),this.bindChildMap(e),this.render(e,t))}bindChildMap(e){if(0!==e.children.length){var t=(0,Ye.Ki)(e);const n=this.map.get(t),r=(n.yMap={},new m.Z);n.childMap=r,e.children.map((e=>{var t,i=(0,Ye.Ki)(e);i&&(t=e.position.y,n.yMap||(n.yMap={}),n.yMap[t]||(n.yMap[t]=[]),n.yMap[t].push(e),r.set(i,{child:e,oldPosition:e.position.clone()}))}))}}render(e,t){e=(0,Ye.Ki)(e);const n=this.map.get(e),{size:r,time:i}=t;Object.keys(n.yMap).sort(((e,t)=>Number.parseInt(e)-Number.parseInt(t))).map(((e,t)=>{n.yMap[e].map((e=>{var{x:a,y:s,z:o}=(0,lt.VU)(e,this.runScene.assetsEx.scene),l=0<a?1:-1,u=0<o?1:-1,a=(l=Math.random()*r*l,u=Math.random()*r*u,e.position.set(a+l,s,o+u),{x:e.position.x,y:e.position.y,z:e.position.z}),s={x:(l=n.childMap.get((0,Ye.Ki)(e)).oldPosition).x,y:l.y,z:l.z},o=(0,b.gY)(a,Object.assign(Object.assign({},s),{delay:t*i,onStart:()=>{e.visible=!0}}),2,(t=>{var{x:t,y:n,z:r}=t;e.position.set(t,n,r)}));this.allAnima.push(o)}))}))}}class Ao extends r.Z{constructor(e){super(e),this.runAll=!1,this.inited=()=>{this.runScene.cb.exporter.gltf.before.add("script",(()=>{this.closeAll()})),this.runScene.exporter.gltf.options.addOption({type:"script",parse:e=>{var t;e&&(({lineAnima:e,frame:t}=JSON.parse(e)),this.lineAnima.parseJSON(e),(0,b.Ft)(t)||-1!==this.runScene.optionsEx.options.renderConfig.scriptFrame||this.setFrame(t))},process:()=>{var e=this.runScene.optionsEx.options.renderConfig.scriptFrame;const t={lineAnima:this.lineAnima.toJSON()};return-1!==e&&(t.frame=e),JSON.stringify(t)}})},this.texture=new Do(e),this.lookAt=new Po(e),this.lineAnima=new ko(e),this.boom=new Oo(e),e.cb.inited.add("texture",this.inited)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll(),this.lineAnima.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll(),this.lineAnima.closeAll())}setFrame(e){this.runScene.optionsEx.options.renderConfig.scriptFrame=e,this.closeAll(),this.playAll()}}class Co{constructor(e){this.map=new m.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean),this.runScene.cb.model.remove.add("Tags",(({model:e})=>{const t=(0,Ye.Ki)(e);t&&this.map.map(((e,n)=>{n.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||(this.map.set(e,new Et.Z),Co.callback.changed.cb())}rename(e,t){const n=this.get(e);n&&(this.addId(t,n.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,b.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,Ye.Ki)(t))}reflash(e){const t=this.map.get(e);if(t){let e=[];t.forEach((t=>{this.runScene.modelEx.getById(t)||e.push(t)})),e.map((e=>t.remove(e)))}}removeModel(e,t){if(this.map.has(e))return(0,b.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,Ye.Ki)(t))}remove(e){this.map.delete(e),Co.callback.changed.cb()}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb(),Co.callback.changed.cb()}toJSON(){const e={};return this.map.map(((t,n)=>{e[t]=[...n.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,a.mapObj)(e,((e,n)=>{t[e]=new Et.Z(n)})),this.map=m.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}Co.callback={changed:new d.Z};class No{constructor(e,t){this.showTransform=!1,this.data={},this.uuid="",this.usedIds=new Et.Z,this.getAnimaByModelData=(()=>{const e=(e,t,n,r)=>{const i={},s={};if(e=No.isNotNow(e)?this.getAllData():e,(0,a.mapObj)(r,((n,r)=>{var o=r.get?r.get({runScene:this.runScene,target:e}):e[n];void 0!==o&&("number"===(r=r.type)?(i[n]=t[n],s[n]=o):"color"===r?(0,a.mapObj)(o,((e,r)=>{var a=n+e;i[a]=t[n][e],s[a]=r})):"V3"!==r&&"V2"!==r||(0,a.mapObj)(o,((e,r)=>{var a=n+e;i[a]=t[n][e],s[a]=r})))})),!(0,a.emptyObj)(i))return{begin:i,end:s}},t={color(e){const{animaData:t,defType:n}=e,r={};return(0,a.mapObj)(t,(e=>{var i;-1!==e.indexOf(n)&&n.includes(n)&&(i=e.substring(n.length),r[i]=t[e])})),r},v3(e){const{animaData:t,defType:n}=e,r={};return(0,a.mapObj)(t,(e=>{var i;-1!==e.indexOf(n)&&n.includes(n)&&(i=e.substring(n.length),r[i]=t[e])})),r}},n=e=>{const{defOptions:n,data:r,target:i}=e;(0,a.mapObj)(n,((e,n)=>{var a,s,o,l=n.type,u=r[e];"number"===l?n.set?n.set({target:i,data:u,type:e}):i[e]=u:"color"===l?(u=t.color({animaData:r,defType:e}))&&(({r:a,g:s,b:o}=u),n.set?n.set({target:i,data:u,type:e}):i[e].setRGB(a,s,o)):"V3"===l||"V2"===l?(u=t.v3({animaData:r,defType:e}))&&(({x:a,y:s,z:o}=u),n.set?n.set({target:i,data:u,type:e}):i[e].set(a,s,o)):"boolean"===l&&(i[e]=r)}))};return t=>{const{map:r,model:i,group:a,reverse:s,defOptions:o,inputData:l}=t,c=Object.keys(r).sort(((e,t)=>s?Number(t)-Number(e):Number(e)-Number(t)));let d=0;return c.map((t=>{var s=r[String(t)],c=Math.abs(Number(t)-d);d=Number(t),t=c/a.time*a.speed;{const{model:r,data:d,time:h,group:p,defOptions:f}=c={model:i,data:s,time:0==t?.001:t,group:a,defOptions:o,inputData:l};return()=>{let t;return{promise:new Promise((i=>{var a=e(d,r,0,f);if(!a)return i(0);const{begin:s,end:o}=a;return t=(0,u.anima)(s,o,h,(e=>{n({target:r,defOptions:f,data:e})}),(()=>{n({target:r,data:o,defOptions:f}),i(0)}))})),anima:t}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t,copyId:n}=this;return n?{copyId:n,type:t}:{data:e,type:t}}addData(e,t,n=!1){return 1e3<=Number(e)&&(e="1000.00"),Number(e)<=0&&(e="0.00"),e=Number(e).toFixed(2),n?this.data[e]=this.getAllData():(n=this.getData(t),(0,u.isNull)(n)||(this.data[e]={[t]:n})),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,n=!1,r){const i={};return(0,a.mapObj)(e,(a=>{var s=n?"notNow":No.getValByType(t,a,e,r);(0,u.isNull)(s)||(i[a]=s)})),i}static getValByType(e,t,n,r){const{type:i,get:a}=n[t];if(n=a?a({runScene:r,target:e}):e[t],!(0,u.isNull)(n))return"number"===i?n:"color"===i?(({r,g:e,b:t}=n),{r,g:e,b:t}):"V3"===i?(0,u.v3ToMap)(n):"V2"===i?(0,u.v2ToMap)(n):n}static SetTargetByData(e){const{baseType:t,data:n,defType:r,target:i,tools:a}=e;var s,o;"number"===t?a.set?a.set({target:i,data:n,type:r}):i[r]=n:"color"===t?(({r:e,g:o,b:s}=n),a.set?a.set({target:i,data:n,type:r}):i[r].setRGB(e,o,s)):"V3"===t?(({x:e,y:o,z:s}=n),a.set?a.set({target:i,data:n,type:r}):i[r].set(e,o,s)):"V2"===t&&(({x:e,y:o}=n),a.set?a.set({target:i,data:n,type:r}):i[r].set(e,o))}getAllData(e=!1){return No.getAllDefValByType(this.defOptions,this.target,e,this.runScene)}getData(e){return No.getValByType(this.target,e,this.defOptions,this.runScene)}static getTarget(e,t){}getAnima(e){var{group:e,reverse:t,inputData:n}=e;return this.getAnimaByModelData({map:this.data,model:this.target,group:e,reverse:t,defOptions:this.defOptions,inputData:n})}setTargetByBetween(e,t,n){No.setTargetByBetween(e,t,n,this.defOptions,this.target)}clone(e){var{data:t,type:n}=this;const r=new(0,Bo[n])(e);return r.data=t,r}reset(){(0,a.mapObj)(this.defOptions,((e,t)=>{var n=No.getValByType(this.beginData,e,this.defOptions,this.runScene);n&&No.SetTargetByData({baseType:t.type,data:n,target:this.target,defType:e,tools:t})}))}remove(){if(0!==this.usedIds.size){let e;this.usedIds.map((t=>{const n=this.runScene.timeLineEx.getInsByUuid(t);n&&(e?(n.copyId=e.uuid,e.usedIds.add(n.uuid)):delete(e=n).copyId)}))}delete this.target.userData.isTimeLineUsed}setByTime(e){let t;for(const n in this.data)if(Number(n)===e){t=this.data[n];break}t&&(0,a.mapObj)(this.defOptions,((e,n)=>{var r=No.getValByType(t,e,this.defOptions,this.runScene);r&&No.SetTargetByData({baseType:n.type,data:r,target:this.target,defType:e,tools:n})}))}}No.setTargetByBetween=(()=>{const e=(e,t,n)=>e!==t?(t-e)*n+e:e;return(t,n,r,i,s)=>{(0,a.mapObj)(i,((i,a)=>{var o,l,u,c,d,h,p,f,m,g=a.type;void 0!==t[i]&&void 0!==n[i]&&No.SetTargetByData({baseType:g,data:(o=t[i],l=n[i],u=r,"number"===g?e(o,l,u):"color"===g?(({r:h,g:c,b:m}=o),({r:f,g:p,b:d}=l),{r:e(h,f,u),g:e(c,p,u),b:e(m,d,u)}):"V3"===g?(({x:h,y:f,z:c}=o),({x:p,y:m,z:d}=l),{x:e(h,p,u),y:e(f,m,u),z:e(c,d,u)}):"V2"===g?(({x:h,y:p}=o),({x:f,y:m}=l),{x:e(h,f,u),y:e(p,m,u)}):"boolean"===g?l:void 0),defType:i,target:s,tools:a})}))}})();const Lo=No;Ir=class extends Lo{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:s}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==s?(s-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:s,target:o}=t,{position:n,scale:l,rotation:u,target:c}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&l&&(({x:t,y:n,z:i}=e(a,l,r)),this.target.scale.set(t,n,i)),s&&u&&(({x:a,y:l,z:t}=e(s,u,r)),this.target.rotation.set(a,l,t)),o&&c&&(({x:n,y:i,z:s}=e(o,c,r)),this.controls.target.set(n,i,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:s,target:o}=Lo.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},s?{rx:i.x,ry:i.y,rz:i.z}:{},o?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},n.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},a?{sx:a.x,sy:a.y,sz:a.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=t=>{const{model:n,data:r,time:i,group:a}=t;return()=>{let t;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,n,a);return t=(0,u.anima)(o,l,i,(e=>{var{px:e,py:t,pz:i,sx:a,sy:s,sz:o,rx:l,ry:u,rz:c,tx:d,ty:h,tz:p}=e;r.position&&n.position.set(e,t,i),r.scale&&n.scale.set(a,s,o),r.rotation&&n.rotation.set(l,u,c),r.target&&this.controls.target.set(d,h,p)}),s)})),anima:t}}};return e=>{const{map:n,model:r,group:i,reverse:s,inputData:o}=e;let l=s?i.time:0;const u=Object.keys(n).sort(((e,t)=>s?Number(t)-Number(e):Number(e)-Number(t)));e=(0,a.lastArrayEle)(u);var c=s?"0.00":String(i.time);return e!==c&&(n[c]=Object.assign({},e),u.push(c)),u.map((e=>{var a=n[String(e)],u=.001*((u=s?l-e:e-l)<=0?.001:u)*i.speed;return l=e,t({model:r,data:a,time:u,group:i,defOptions:this.defOptions,inputData:o})}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.resetBeginData()}setSelect(e){this.runScene.modelEx.setSelectByModel(e)}resetBeginData(){this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:n,rotation:r}=this.target;return{position:e?"notNow":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(n),rotation:e?"notNow":(0,u.v3ToMap)(r),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:n,rotation:r}=this.target;let i;if("position"===e)i=(0,u.v3ToMap)(t);else if("scale"===e)i=(0,u.v3ToMap)(n);else if("rotation"===e)i=(0,u.v3ToMap)(r);else{if("target"!==e)throw TypeError("输入值不存在");i=(0,u.v3ToMap)(this.controls.target)}return i}getAnima(e){var{group:e,reverse:t,inputData:n}=e;return this.getAnimaByModelData({map:this.data,model:this.target,group:e,reverse:t,defOptions:this.defOptions,inputData:n})}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:n,target:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(n.x,n.y,n.z),this.controls.target.set(r.x,r.y,r.z)}},Rr=class extends Lo{constructor(e,t){super(e,t),this.type="lineMaterial",this.defOptions={opacity:{type:"number"},color:{type:"color"}},this.resetBeginData()}resetBeginData(){this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}setSelect(e){this.runScene.materialEx.setSelect(e)}},Re=class extends Lo{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},visible:{type:"boolean",get:e=>e.target.visible}},this.setTargetByBetween=(()=>{const e=(e,t,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:s}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==s?(s-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:s,visible:o}=t,{position:n,scale:l,rotation:u}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i),this.runScene.cb.model.setVector3.cb({type:"position",model:this.target})),a&&l&&(({x:t,y:n,z:i}=e(a,l,r)),this.target.scale.set(t,n,i)),s&&u&&(({x:a,y:l,z:t}=e(s,u,r)),this.target.rotation.set(a,l,t)),void 0!==o&&o!==this.target.visible&&(this.target.visible=o)}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:s}=Lo.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},s?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},n.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},a?{sx:a.x,sy:a.y,sz:a.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}},t=t=>{const{model:n,data:r,time:i,group:a}=t;return()=>{let t;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,n,a);return t=(0,u.anima)(o,l,i,(e=>{var{px:e,py:t,pz:i,sx:a,sy:s,sz:o,rx:l,ry:u,rz:c}=e;r.position&&(n.position.set(e,t,i),this.runScene.cb.model.setVector3.cb({type:"position",model:this.target})),r.scale&&n.scale.set(a,s,o),r.rotation&&n.rotation.set(l,u,c)}),(()=>{void 0!==r.visible&&(n.visible=r.visible),s(0)}))})),anima:t}}};return e=>{const{map:n,model:r,group:i,reverse:a,inputData:s}=e;let o=a?i.time:0,l=1e3,u=-1;const c=Object.keys(n).sort(((e,t)=>(t=Number(t),e=Number(e),l=Math.min(l,t,e),u=Math.max(u,t,e),a?t-e:e-t)));return c.map((e=>{var l=n[String(e)],u=.001*((u=a?o-e:e-o)<=0?.001:u)*i.speed;return o=e,t({model:r,data:l,time:u,group:i,defOptions:this.defOptions,inputData:s})}))}})(),this.resetBeginData()}resetBeginData(){this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e){var{group:e,reverse:t,inputData:n}=e;return this.getAnimaByModelData({map:this.data,model:this.target,group:e,reverse:t,defOptions:this.defOptions,inputData:n})}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:n,visible:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.runScene.cb.model.setVector3.cb({type:"position",model:this.target}),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(n.x,n.y,n.z),void 0!==r&&(this.target.visible=r)}setSelect(e){this.runScene.modelEx.selectNull(),this.runScene.modelEx.setSelectByModel(e)}},Ar=class extends Lo{constructor(e,t){super(e,t),this.type="texture",this.defOptions={center:{type:"V2"},repeat:{type:"V2"},offset:{type:"V2"},rotation:{type:"number"}},this.name="贴图",this.resetBeginData()}resetBeginData(){this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.texture.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}setSelect(e){this.runScene.textureEx.multip.setSelect(e)}};class Io extends r.Z{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:n}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&n.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new m.Z({complete:this.after,mountModule:this.mount}),exportCallBacks:new m.Z};this.runScene.exporter.gltf.module.bind(e)}}var Ro=n(7201);class Uo extends class{constructor(e){this.selected=new m.Z,this.callback={add:new d.Z,del:new d.Z,clear:new d.Z},(this.runScene=e).cb.events.window.pointer.up.add("multi-select",(()=>{this.clear(!1)}))}clear(e){var t=this.selected.toArray("value")[0];this.selected.clear(),!e&&t&&this.add(t),this.callback.clear.cb()}del(e){var t=this.getStrByTarget(e);t&&(this.selected.delete(t),this.callback.del.cb(e))}add(e,t){t&&this.clear(!0),G.F6.toArr(e).map((e=>{var t=this.getStrByTarget(e);if(t)return this.selected.has(t)?this.del(e):void this.selected.set(t,e)})),this.callback.add.cb(e)}setSelect(e,t){if(this.runScene.events.key.shift&&t)if(0<this.selected.size){const s=(0,a.lastArrayEle)(this.selected.toArray("value"));var n,r,i=t.findIndex((e=>this.getStrByTarget(s)===this.getStrByTarget(e)));-1!==i&&-1!==(n=t.findIndex((t=>this.getStrByTarget(e)===this.getStrByTarget(t))))&&(r=Math.max(i,n),i=Math.min(i,n),this.add(t.splice(i,r+1),!0))}else this.add(e);else this.runScene.events.key.ctrl||this.clear(!0),this.add(e)}has(e){return this.selected.has(this.getStrByTarget(e))}getSelected(){return this.selected.toArray("value")[0]}}{getStrByTarget(e){return e.uuid}}const Bo={model:Re,camera:Ir,material:Rr,lineMaterial:Rr,texture:Ar};var Fo=n(6651);class jo{constructor(e){this.map=e,this.init()}init(){const{runScene:e,name:t,getDiff:n,set:r}=this.map;e.cb.snapshot.create.add(t,(e=>{var r=n(e);0!==(0,Ro.objLength)(r)&&e.data.set(t,r)})),e.cb.snapshot.set.add(t,(e=>{var n=e.snapshot.data.get(t);n&&r({data:n,map:e})}))}}var zo=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class Vo{constructor(e,t){this.created=!1,this.enable=!1,this.index=1,this.added=!1,this.id=(0,a.getId)(),this.afterLoadedCreate=!0,this.loaded=()=>{var e;this.savedJSON&&this.savedJSON.enable&&(this.setState(!0),this.parseJSON(this.savedJSON),this.savedJSON=void 0),null!=(e=this.onLoaded)&&e.call(this)},this.setSize=e=>{e=e||this.runScene.renderEx.size,this.effect&&(this.effect.setSize(e.width,e.height),this.effect.width=e.width,this.effect.height=e.height)},this.onAfterModelSeting=!1,this.onAfterModelSet=(e,t)=>zo(this,void 0,void 0,(function*(){var n;if(!this.onAfterModelSeting&&(this.onAfterModelSeting=!0,void 0===this.customEnable)){const r=0<e.length;r&&t&&(this.created||(yield this.setState(!0))),this.enable=r,null!=(n=this.pass)&&n.map((e=>{e.enabled=r})),this.onAfterModelSeting=!1}})),this.runScene=e,this.pp=t,null!=(t=this.init)&&t.call(this),null!=(t=this.onInited)&&t.call(this),e.cb.renderEx.setSize.on(this.setSize),e.cb.load.loaded.on(this.loaded),e.cb.loaderer.gltf.loaded.on(this.loaded)}static parse(e){const{data:t,runScene:n,type:r}=e;n.ltPP.getPass(r).parseJSON(t)}init(){this.runScene.cb.clean.add(this.name,(()=>{this.clean()})),this.bindSnapshot()}bindSnapshot(){}setState(e){var t;return zo(this,void 0,void 0,(function*(){this.enable!==e&&(this.enable=e,yield this.beforeCreate(),this.created&&!this.pass||(null!=(t=this.onSetState)&&t.call(this,e),this.pass&&(this.pass.map((t=>{t.enabled=e,this.pp.composer[e?"addPass":"removePass"](t,this.index)})),null!=(t=this.onAfterSetState)&&t.call(this,e),this.setCustomEnable(e))))}))}toJSON(){const e={enable:this.enable};(0,a.mapObj)(Object.assign(Object.assign({},this.config),Go),((t,n)=>{var r;this.effect?e[t]=null==(r=n.get)?void 0:r.call(n,this):this.savedJSON&&(e[t]=this.savedJSON[t])}));var t=(null==(t=this.onToJSON)?void 0:t.call(this))||{};return{type:this.name,data:Object.assign(Object.assign({},e),t)}}parseJSONByMap(e){return zo(this,void 0,void 0,(function*(){e&&(e.enable?(yield this.runScene.ltPP.setModuleState(this.name,!0),this._parseJSON(e)):this.savedJSON=e)}))}_parseJSON(e){this.effect&&(0,a.mapObj)(e,((e,t)=>{var n;null!=(n=null==(e=this.config[e]||Go[e])?void 0:e.set)&&n.call(e,{target:this,end:t,begin:t})}))}parseJSON(e){var t;this.parseJSONByMap(e),null!=(t=this.onParseJSON)&&t.call(this,e),this.setSize()}getDiff(){const e={};return(0,a.mapObj)(this.config,((t,n)=>{var r=null==(r=n.get)?void 0:r.call(n,this);n.val!==r&&(e[n.shortKey||t]=r)})),e}setDiff(e){var{data:e,map:t}=e;this.effect&&nn.LV.set({def:this.config,data:e,runScene:this.runScene,map:t,target:this})}setCustomEnable(e){this.enable=e,this.customEnable=e}beforeCreate(){var e;return zo(this,void 0,void 0,(function*(){var t;this.created||(this.created=!0,t=yield Promise.all(G.F6.toArr(this.create())),this.pass=t,null!=(e=this.onCreatedEffect)&&e.call(this),this.savedJSON&&(this.parseJSONByMap(this.savedJSON),this.savedJSON=void 0),this.setSize())}))}reset(){(0,a.mapObj)(this.config,((e,t)=>{var n;this.effect&&null!=(n=t.set)&&n.call(t,{target:this,end:t.val,begin:t.val})}))}clean(){this.added=!1,this.setState(!1),this.reset(),this.customEnable=void 0}}Vo.needInit=!0;const Ho={SKIP:9,SET:30,ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},Wo={},Go=((0,a.mapObj)(Ho,((e,t)=>{Wo[t]=e})),{mixMode:{name:"混合模式",type:"select",val:"empty",now:"empty",opts:Object.keys(Ho),shortKey:"mixMode",get:e=>(e=e.effect.blendMode.blendFunction,Wo[e]),setIsUpdate:!0,isUpdate:!1,set:e=>{var t=Ho[e.end];e.target.effect&&(e.target.effect.blendMode.blendFunction=t)}},opacity:{name:"透明度",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:0,max:1,shortKey:"opacity",get:e=>e.effect.blendMode.opacity.value,set:e=>{const{end:t,target:n}=e;e.target.effect&&(n.effect.blendMode.opacity.value=t)}}}),Ko={brightness:{name:"亮度",setIsUpdate:!0,isUpdate:!1,type:"number",val:0,now:0,min:-1,max:1,shortKey:"brightness",get:e=>e.effect.brightness,set:e=>{e.target.effect.brightness=e.end}},contrast:{name:"对比度",setIsUpdate:!0,isUpdate:!1,type:"number",val:0,now:0,min:-1,max:1,shortKey:"contrast",get:e=>e.effect.contrast,set:e=>{e.target.effect.contrast=e.end}}};class Zo extends Vo{constructor(){super(...arguments),this.name="BrightnessContrast",this.config=Ko,this.index=5}create(){var e=this.runScene.assetsEx.get().camera;return this.effect=new fs.BrightnessContrastEffect({contrast:0}),new fs.EffectPass(e,this.effect)}}Zo.config=Ko;const qo={resolution:{name:"分辨率",type:"select",val:240,now:240,opts:[240,360,480,720,1080],shortKey:"resolution",get:e=>e.effect.resolution.height,setIsUpdate:!0,isUpdate:!1,set:e=>{e.target.effect.resolution.height=e.end}},focus:{name:"焦点",type:"number",min:0,max:1,val:.001,now:.001,get:e=>e.effect.cocMaterial.uniforms.focusDistance.value,setIsUpdate:!0,isUpdate:!1,set:e=>{e.target.effect.cocMaterial.uniforms.focusDistance.value=e.end}},worldFocusRange:{name:"焦平面",type:"number",min:0,max:1,val:1e-4,now:1e-4,get:e=>e.effect.cocMaterial.uniforms.focalLength.value,setIsUpdate:!0,isUpdate:!1,set:e=>{e.target.effect.cocMaterial.uniforms.focalLength.value=e.end}},bokehScale:{name:"光圈",type:"number",min:0,max:7,val:.1,now:.1,get:e=>e.effect.bokehScale,setIsUpdate:!0,isUpdate:!1,set:e=>{e.target.effect.bokehScale=e.end}}};class Xo extends Vo{constructor(){super(...arguments),this.name="DOF",this.config=qo,this.index=3}create(){var e=this.runScene.assetsEx.get().camera,t=this.effect=new fs.DepthOfFieldEffect(e,{kernelSize:fs.KernelSize.MEDIUM,worldFocusDistance:2,worldFocusRange:5,bokehScale:3,resolutionScale:.75});return new fs.EffectPass(e,t)}}Xo.config=qo;const Yo={hue:{name:"色调",setIsUpdate:!0,isUpdate:!1,type:"number",val:0,now:0,min:0,max:2*Math.PI,shortKey:"hue",get:e=>e.effect.hue,set:e=>{e.target.effect.hue=e.end}},saturation:{name:"饱和度",setIsUpdate:!0,isUpdate:!1,type:"number",val:0,now:0,min:-1,max:1,shortKey:"saturation",get:e=>e.effect.saturation,set:e=>{e.target.effect.saturation=e.end}}};class Qo extends Vo{constructor(){super(...arguments),this.name="HueSaturation",this.config=Yo,this.index=3}create(){var e=this.runScene.assetsEx.get().camera;return this.effect=new fs.HueSaturationEffect,new fs.EffectPass(e,this.effect)}}Qo.config=Yo;var Jo=n(158),$o=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const el=new Map([["png/filmic1","png/filmic1.png"],["cube/cinematic","cube/presetpro-cinematic.cube"],["cube/django-25","cube/django-25.cube"],["cube/lava","cube/lava.cube"],["cube/AC","cube/AC.cube"],["cube/LN","cube/LN.cube"]]),tl={mode:{name:"模式",type:"select",val:"empty",now:"empty",opts:[...el.keys()],shortKey:"mode",get:e=>e.mode,setIsUpdate:!0,isUpdate:!1,set:e=>e.target.setAssets(e.end)}};class nl extends Vo{constructor(e,t){super(e,t),this.name="Lut",this.config=tl,this.baseUrl="./assets/image/textures/luts/",this.mode="png/filmic1",this.assets=new m.Z,this.index=8,this.runScene=e,this.pp=t,gn.textureTypeId.getAll({runScene:this.runScene,type:"lut-texture"}).map((e=>this.parseSavedLut(e)))}parseSavedLut(e){const t=fs.LookupTexture.from(e.texture);t.userData=Object.assign({},e.texture.userData),(0,gn.setTextureSize)(t),e.texture=t,this.assets.set(e.subType,e.texture),this.bindLuts(e.subType),(0,gn.disposeTexture)(e.texture),this.runScene.uniqueEx.texture.replace(t)}bindLuts(e){el.get(e)||(el.set(e,e),tl.mode.opts=[...el.keys()])}onInited(){this.runScene.cb.exporter.gltf.assets.bindTexture.add(this.name,(({map:e})=>$o(this,void 0,void 0,(function*(){if(this.enable)return Promise.all(this.assets.map(((t,n)=>$o(this,void 0,void 0,(function*(){var r,i;!gn.unDelAbleTexture.is(n,this.runScene)&&this.mode!==t||(r=gn.textureTypeId.set({texture:n,type:"lut-texture",subType:t}),(i=n.userData.blob||(yield(0,b.sR)(this.getUrl(t),"blob")))&&((0,gn.setTextureBlob)(n,i),n.userData.type=this.getType(t),e.set(r,n)))})))))})))),this.runScene.cb.texture.onLoaded.add("lut",(e=>{var t;null!=(t=e.opts)&&t.isScene&&this.parseSaved(e)}))}parseSaved(e){var t=gn.textureTypeId.get(e);t&&"lut-texture"===t.type&&this.parseSavedLut(Object.assign(Object.assign({},e),t))}onToJSON(){return{type:"Lut",data:{mode:this.mode}}}onParseJSON(e){var t;e&&(t=e.data.mode,this.mode=t,delete e.mode)}getType(e){return e.split("/")[0]}setAssets(e,t){return $o(this,void 0,void 0,(function*(){if(this.effect){const n=t||(yield this.getAssets(e)),r=(this.mode=e,t&&((0,Ye.Ki)(t)||gn.textureTypeId.set({texture:t,type:"lut-texture",subType:e}),this.assets.set(e,t)),el.get(e)||(el.set(e,e),tl.mode.opts=[...el.keys()]),this.runScene.assetsEx.get()).renderer;r.capabilities.isWebGL2?(null===r.getContext().getExtension("OES_texture_float_linear")&&n.convertToUint8(),this.effect.lut=n):this.effect.lut=n.convertToUint8().toDataTexture()}else this.mode=e}))}create(){return $o(this,void 0,void 0,(function*(){var e=this.runScene.assetsEx.get().camera;return this.effect=yield this.getEffect(),new fs.EffectPass(e,this.effect)}))}onCreatedEffect(){this.savedJSON&&this.parseJSONByMap(this.savedJSON),this.setAssets(this.mode),delete this.savedJSON}getAssets(e){return $o(this,void 0,void 0,(function*(){let t=this.assets.get(e);if(!t&&"editor"===(0,Jo.FW)(this.runScene).mode){let n=yield this.getTexture(e);n?gn.textureAssets.set(n,!0):(this.mode="png/filmic1",n=yield this.getTexture(this.mode)),t=fs.LookupTexture.from(n),this.assets.set(e,t)}return gn.textureTypeId.set({texture:t,type:"lut-texture",subType:e}),gn.textureAssets.set(t,!0),t}))}static parse(e){const{data:t,runScene:n,type:r}=e;n.ltPP.getPass(r).onParseJSON(t)}getUrl(e){if(e=el.get(e))return((0,Jo.FW)(this.runScene).ltPp.lut.baseUrl||this.baseUrl)+e}getTexture(e){if(e=this.getUrl(e))return this.runScene.loaderer.getTexture(e)}getEffect(){return $o(this,void 0,void 0,(function*(){const e=yield this.getAssets(this.mode);return this.runScene.assetsEx.get().renderer.capabilities.isWebGL2?new fs.LUT3DEffect(e):new fs.LUT3DEffect(e.convertToUint8().toDataTexture())}))}onCreateSnapshot(e){var t=this.assets.get(this.mode);t&&this.runScene.textureEx.snapshot.setUnDel(t,!0,e)}}nl.config=tl;const rl={blurriness:{name:"模糊强度",setIsUpdate:!0,isUpdate:!1,type:"select",val:1,now:1,opts:Object.values(fs.KernelSize),shortKey:"blurriness",get:e=>e.effect.blurPass.blurMaterial.kernelSize,set:e=>{const t=e.target.effect;t.blurPass.enabled=0<e.end,t.blurPass.blurMaterial.kernelSize=e.end}},density:{name:"密度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"density",get:e=>e.effect.godRaysMaterial.uniforms.density.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.density.value=t}},decay:{name:"衰减",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"decay",get:e=>e.effect.godRaysMaterial.uniforms.decay.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.decay.value=t}},weight:{name:"重量",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"weight",get:e=>e.effect.godRaysMaterial.uniforms.weight.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.weight.value=t}},exposure:{name:"强度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"exposure",get:e=>e.effect.godRaysMaterial.uniforms.exposure.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.exposure.value=t}},clampMax:{name:"扩散度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"clampMax",get:e=>e.effect.godRaysMaterial.uniforms.clampMax.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.clampMax.value=t}},samples:{name:"采样值",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:1,max:200,shortKey:"samples",get:e=>e.effect.samples||1,set:e=>{const{end:t,target:n}=e;n.effect&&(n.effect.samples=t)}},color:{name:"颜色",setIsUpdate:!0,isUpdate:!1,type:"color_str",val:"#FFFFFF",now:"#FFFFFF",shortKey:"color",get:e=>(0,lt.J6)(e.sun.material.color),set:e=>{const{end:t,target:n}=e;n.sun.material.color.setStyle(t)}},position:{name:"位置",setIsUpdate:!0,isUpdate:!1,type:"v3",val:{x:0,y:0,z:0},now:{x:0,y:0,z:0},shortKey:"position",get:e=>e.sun.position,set:e=>{const{end:t,target:n}=e;var{x:e,y:r,z:i}=t;n.sun.position.set(e,r,i)}},scale:{name:"缩放",setIsUpdate:!0,isUpdate:!1,type:"v3",val:{x:0,y:0,z:0},now:{x:0,y:0,z:0},shortKey:"scale",get:e=>e.sun.scale,set:e=>{const{end:t,target:n}=e;var{x:e,y:r,z:i}=t;n.sun.scale.set(e,r,i)}},fog:{name:"雾",setIsUpdate:!0,isUpdate:!1,type:"boolean",val:!1,now:!1,shortKey:"fog",get:e=>e.sun.material.fog,set:e=>{const{end:t,target:n}=e;n.sun.material.fog=t}}};class il extends Vo{constructor(){super(...arguments),this.name="Sun",this.defColor=16768426,this.config=rl}getDefPosition(){return new s.Vector3(0,.06,-1).multiplyScalar(1e3)}create(){var e=this.runScene.assetsEx.get().camera,t=new s.MeshBasicMaterial({color:this.defColor,transparent:!0,fog:!1});const n=new s.Mesh(new s.IcosahedronGeometry(1,3),t);return n.position.copy(this.getDefPosition()),n.scale.setScalar(40),n.updateMatrix(),n.frustumCulled=!1,n.visible=!1,c.helperModel.set(n),this.runScene.modelEx.add(n),this.effect=new fs.GodRaysEffect(e,n),this.sun=n,new fs.EffectPass(e,this.effect)}onSetState(e){this.sun&&(this.sun.visible=e)}}il.config=rl;const al={blurriness:{name:"模糊强度",setIsUpdate:!0,isUpdate:!1,type:"select",val:1,now:1,opts:Object.values(fs.KernelSize),shortKey:"blurriness",get:e=>e.effect.blurPass.blurMaterial.kernelSize,set:e=>{const t=e.target.effect;t.blurPass.enabled=0<e.end,t.blurPass.blurMaterial.kernelSize=e.end}},density:{name:"密度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"density",get:e=>e.effect.godRaysMaterial.uniforms.density.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.density.value=t}},decay:{name:"衰减",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"decay",get:e=>e.effect.godRaysMaterial.uniforms.decay.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.decay.value=t}},weight:{name:"重量",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"weight",get:e=>e.effect.godRaysMaterial.uniforms.weight.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.weight.value=t}},exposure:{name:"强度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"exposure",get:e=>e.effect.godRaysMaterial.uniforms.exposure.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.exposure.value=t}},clampMax:{name:"扩散度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:1,shortKey:"clampMax",get:e=>e.effect.godRaysMaterial.uniforms.clampMax.value,set:e=>{const{end:t,target:n}=e;n.effect.godRaysMaterial.uniforms.clampMax.value=t}},samples:{name:"采样值",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:1,max:200,shortKey:"samples",get:e=>e.effect.samples||1,set:e=>{const{end:t,target:n}=e;n.effect&&(n.effect.samples=t)}},color:{name:"颜色",setIsUpdate:!0,isUpdate:!1,type:"color_str",val:"#FFFFFF",now:"#FFFFFF",shortKey:"color",get:e=>(0,lt.J6)(e.sun.material.color),set:e=>{const{end:t,target:n}=e;n.sun.material.color.setStyle(t)}},position:{name:"位置",setIsUpdate:!0,isUpdate:!1,type:"v3",val:{x:0,y:0,z:0},now:{x:0,y:0,z:0},shortKey:"position",get:e=>e.sun.position,set:e=>{const{end:t,target:n}=e;var{x:e,y:r,z:i}=t;n.sun.position.set(e,r,i)}},scale:{name:"缩放",setIsUpdate:!0,isUpdate:!1,type:"v3",val:{x:0,y:0,z:0},now:{x:0,y:0,z:0},shortKey:"scale",get:e=>e.sun.scale,set:e=>{const{end:t,target:n}=e;var{x:e,y:r,z:i}=t;n.sun.scale.set(e,r,i)}},fog:{name:"雾",setIsUpdate:!0,isUpdate:!1,type:"boolean",val:!1,now:!1,shortKey:"fog",get:e=>e.sun.material.fog,set:e=>{const{end:t,target:n}=e;n.sun.material.fog=t}}};class sl extends il{constructor(){super(...arguments),this.defColor="#6FD6FF",this.name="Moon",this.config=al}getDefPosition(){return new s.Vector3(0,.06,-1).multiplyScalar(500)}}sl.config=al;const ol={resolution:{name:"分辨率",type:"select",val:240,now:240,opts:[240,360,480,720,1080],shortKey:"resolution",get:e=>e.effect.resolution.height,setIsUpdate:!0,isUpdate:!1,set:e=>{e.target.effect.resolution.height=e.end}},multisampling:{name:"多重采样",type:"select",val:0,now:0,opts:[0,2,4],shortKey:"multisampling",get:e=>e.effect.multisampling,setIsUpdate:!0,isUpdate:!1,set:e=>{e.target.effect.multisampling=e.end}},blurriness:{name:"模糊强度",setIsUpdate:!0,isUpdate:!1,type:"select",val:1,now:1,opts:Object.values(fs.KernelSize),shortKey:"blurriness",get:e=>e.effect.blurPass.blurMaterial.kernelSize,set:e=>{const t=e.target.effect;t.blurPass.enabled=0<e.end,t.blurPass.blurMaterial.kernelSize=e.end}},strength:{name:"强度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:10,shortKey:"strength",get:e=>e.effect.uniforms.get("edgeStrength").value,set:e=>{const{end:t,target:n}=e;n.effect.uniforms.get("edgeStrength").value=t}},speed:{name:"闪烁速度",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:0,max:2,shortKey:"speed",get:e=>e.effect.pulseSpeed,set:e=>{const{end:t,target:n}=e;n.effect.pulseSpeed=t}},color:{name:"颜色",setIsUpdate:!0,isUpdate:!1,type:"color_str",val:"#FFFFFF",now:"#FFFFFF",shortKey:"color",get:e=>(0,lt.J6)(e.effect.visibleEdgeColor),set:e=>{e.target.effect.visibleEdgeColor.setStyle(e.end)}},hideColor:{name:"遮挡颜色",setIsUpdate:!0,isUpdate:!1,type:"color_str",val:"#000000",now:"#000000",shortKey:"hideColor",get:e=>(0,lt.J6)(e.effect.hiddenEdgeColor),set:e=>{e.target.effect.hiddenEdgeColor.setStyle(e.end)}},xRay:{name:"穿透",setIsUpdate:!0,isUpdate:!1,type:"boolean",val:!0,now:!0,shortKey:"xRay",get:e=>e.effect.xRay,set:e=>{const{end:t,target:n}=e;n.effect.xRay=t}}};class ll extends Vo{constructor(){super(...arguments),this.name="Outline",this.config=ol,this.afterLoadedCreate=!1,this.index=2,this.catchModels=[],this._setModel=(0,a.fnDebounce)((()=>{this.catchModels.splice(0).map((e=>{const{model:t,state:n}=e;this.effect&&(n?this.effect.selection.add(t):0<this.effect.selection.size&&Et.Z.accurateDel({set:this.effect.selection,fn:e=>e.uuid===t.uuid})),this.onAfterModelSet([...this.effect.selection],n)}))}),50)}onInited(){this.runScene.cb.model.setOutline.on((({model:e,val:t})=>{this.setModel({model:e,state:t})}))}create(){var e,{camera:t,scene:e}=this.runScene.assetsEx.get();return this.effect=new fs.OutlineEffect(e,t,{blendFunction:fs.BlendFunction.SCREEN}),new fs.EffectPass(t,this.effect)}setModel(e){this.catchModels.push(e),this.effect?this._setModel():this.runScene.ltPP.setModuleState("Outline",!0).then((()=>{this._setModel()}))}}function ul(e){return(ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cl(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)),r}function dl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cl(Object(n),!0).forEach((function(t){hl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function hl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pl(){return(pl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=xl(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function fl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e,t)||Tl(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ml(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function vl(e,t,n){return t&&gl(e.prototype,t),n&&gl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yl(e,t,n){t=xl(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],xl(e).constructor):t.apply(e,n))&&("object"===ul(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return bl(r)}function bl(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xl(e){return(xl=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Sl(e,t)}function Sl(e,t){return(Sl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _l(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Tl(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Tl(e,t){if(e){if("string"==typeof e)return Ml(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ml(e,t):void 0}}function Ml(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function El(e){for(var t=[e],n=[];0!==t.length;){var r,i=t.shift(),a=(i.material&&n.push(i),_l(i.children));try{for(a.s();!(r=a.n()).done;){var s=r.value;s.visible&&t.push(s)}}catch(e){a.e(e)}finally{a.f()}}return n}function Dl(e,t,n,r,i){i?t[n]!==e[n]&&(e[n]=t[n],e.uniforms[n].value=t[n],t[n]?(e.defines[r]="","USE_NORMALMAP"===r&&(e.defines.TANGENTSPACE_NORMALMAP="")):delete e.defines[r],e.needsUpdate=!0):void 0!==e[n]&&(e[n]=void 0,e.uniforms[n].value=void 0,delete e.defines[r],e.needsUpdate=!0)}ll.config=ol,ll.needInit=!0;var Pl=/#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 kl(e){return e.replace(Pl,Ol)}function Ol(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Al(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:e.material;return t.visible&&t.depthWrite&&t.depthTest&&(!t.transparent||0<t.opacity)&&!Nl(e)}function Cl(e,t){var n,r=_l(Ll);try{for(r.s();!(n=r.n()).done;){var i=n.value;t[i]=e[i]}}catch(e){r.e(e)}finally{r.f()}}var Nl=function(e){return null==(e=e.material.fragmentShader)?void 0:e.includes("float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );")},Ll=["vertexTangent","vertexColors","vertexAlphas","vertexUvs","uvsVertexOnly","supportsVertexTextures","instancing","instancingColor","side","flatShading","skinning","doubleSided","flipSided"],Il="#define GLSLIFY 1\nvarying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",Rl=function(){function e(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1;return ml(this,e),(t=yl(this,e,["CopyPass"])).needsSwap=!1,t.renderTarget=new or.WebGLMultipleRenderTargets(1,1,1,{depthBuffer:!1}),t.setTextureCount(n),t}return wl(e,fs.Pass),vl(e,[{key:"setTextureCount",value:function(e){for(var t,n="",r="",i=0;i<e;i++)n+="\n\t\t\t\tuniform sampler2D inputTexture".concat(i,";\n\t\t\t\tlayout(location = ").concat(i,") out vec4 gOutput").concat(i,";\n\t\t\t"),r+="gOutput".concat(i," = textureLod(inputTexture").concat(i,", vUv, 0.);");null!=(t=this.fullscreenMaterial)&&t.dispose(),this.fullscreenMaterial=new or.ShaderMaterial({fragmentShader:"\n varying vec2 vUv;\n\t\t\t\n\t\t\t".concat(n,"\n\n void main() {\n\t\t\t\t").concat(r,"\n }\n "),vertexShader:Il,glslVersion:or.GLSL3,blending:or.NoBlending,depthWrite:!1,depthTest:!1,toneMapped:!1});for(var a,s=0;s<e;s++)this.fullscreenMaterial.uniforms["inputTexture"+s]=new or.Uniform(null),s>=this.renderTarget.texture.length&&((a=this.renderTarget.texture[0].clone()).isRenderTargetTexture=!0,this.renderTarget.texture.push(a))}},{key:"setSize",value:function(e,t){this.renderTarget.setSize(e,t)}},{key:"render",value:function(e){e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}]),e}(),Ul=function(){function e(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",r=(ml(this,e),"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D velocityTexture;uniform sampler2D depthTexture;uniform sampler2D lastDepthTexture;uniform float blend;uniform float neighborhoodClampIntensity;uniform bool constantBlend;uniform bool fullAccumulate;uniform vec2 invTexSize;uniform mat4 projectionMatrix;uniform mat4 projectionMatrixInverse;uniform mat4 cameraMatrixWorld;uniform vec3 cameraPos;uniform mat4 prevViewMatrix;uniform mat4 prevCameraMatrixWorld;uniform mat4 prevProjectionMatrix;uniform mat4 prevProjectionMatrixInverse;uniform bool reset;uniform float delta;\n#define EPSILON 0.00001\n#include <packing>\n#include <reproject>\nvoid main(){getDepthAndDilatedUVOffset(depthTexture,vUv,depth,dilatedDepth,depthTexel);if(dot(depthTexel.rgb,depthTexel.rgb)==0.0){\n#ifdef neighborhoodClamp\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){gOutput[i]=textureLod(inputTexture[i],vUv,0.0);}\n#pragma unroll_loop_end\n#else\ndiscard;\n#endif\nreturn;}vec2 dilatedUv=vUv+dilatedUvOffset;edgeStrength=computeEdgeStrength(depth,invTexSize);vec4 inputTexel[textureCount];vec4 accumulatedTexel[textureCount];bool textureSampledThisFrame[textureCount];\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){inputTexel[i]=textureLod(inputTexture[i],vUv,0.0);doColorTransform[i]=luminance(inputTexel[i].rgb)>0.0;textureSampledThisFrame[i]=inputTexel[i].r>=0.;if(textureSampledThisFrame[i]){transformColor(inputTexel[i].rgb);}else{inputTexel[i].rgb=vec3(0.0);}texIndex++;}\n#pragma unroll_loop_end\ntexIndex=0;velocityTexel=textureLod(velocityTexture,vUv,0.0);didMove=dot(velocityTexel.xy,velocityTexel.xy)>0.000000001;\n#ifdef dilation\nvec2 octahedronEncodedNormal=textureLod(velocityTexture,dilatedUv,0.0).ba;\n#else\nvec2 octahedronEncodedNormal=velocityTexel.ba;\n#endif\nvec3 worldNormal=Decode(octahedronEncodedNormal);vec3 worldPos=screenSpaceToWorldSpace(vUv,depth,cameraMatrixWorld,projectionMatrixInverse);vec2 reprojectedUvDiffuse=vec2(-10.0);vec2 reprojectedUvSpecular[textureCount];vec2 reprojectedUv;bool reprojectHitPoint;\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){reprojectHitPoint=reprojectSpecular[i]&&inputTexel[i].a>0.0;if(reprojectHitPoint){reprojectedUvSpecular[i]=getReprojectedUV(depth,worldPos,worldNormal,inputTexel[i].a);}else{reprojectedUvSpecular[i]=vec2(-1.0);}if(reprojectedUvDiffuse.x==-10.0&&reprojectedUvSpecular[i].x<0.0){reprojectedUvDiffuse=getReprojectedUV(depth,worldPos,worldNormal,0.0);}reprojectedUv=reprojectedUvSpecular[i].x>=0.0 ? reprojectedUvSpecular[i]: reprojectedUvDiffuse;if(reprojectedUv.x<0.0){accumulatedTexel[i]=vec4(inputTexel[i].rgb,0.0);}else{accumulatedTexel[i]=sampleReprojectedTexture(accumulatedTexture[i],reprojectedUv);transformColor(accumulatedTexel[i].rgb);if(textureSampledThisFrame[i]){accumulatedTexel[i].a++;if(neighborhoodClamp[i]){vec3 clampedColor=accumulatedTexel[i].rgb;clampNeighborhood(inputTexture[i],clampedColor,inputTexel[i].rgb);accumulatedTexel[i].rgb=mix(accumulatedTexel[i].rgb,clampedColor,neighborhoodClampIntensity);}}else{inputTexel[i].rgb=accumulatedTexel[i].rgb;}}texIndex++;}\n#pragma unroll_loop_end\ntexIndex=0;float m=1.-delta/(1./60.);float fpsAdjustedBlend=blend+max(0.,(1.-blend)*m);float maxValue=(fullAccumulate&&!didMove)? 1.0 : fpsAdjustedBlend;vec3 outputColor;float temporalReprojectMix;\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){if(constantBlend){temporalReprojectMix=accumulatedTexel[i].a==0.0 ? 0.0 : fpsAdjustedBlend;}else{temporalReprojectMix=fpsAdjustedBlend;if(reset)accumulatedTexel[i].a=0.0;temporalReprojectMix=min(1.-1./(accumulatedTexel[i].a+1.0),maxValue);}outputColor=mix(inputTexel[i].rgb,accumulatedTexel[i].rgb,temporalReprojectMix);undoColorTransform(outputColor);gOutput[i]=vec4(outputColor,accumulatedTexel[i].a);texIndex++;}\n#pragma unroll_loop_end\n#ifdef useTemporalReprojectCustomComposeShader\ntemporalReprojectCustomComposeShader\n#endif\n}".replace("#include <reproject>","#define GLSLIFY 1\nvec4 velocityTexel;float dilatedDepth;vec2 dilatedUvOffset;int texIndex;bool didMove;vec4 depthTexel;float depth;float edgeStrength;\n#define luminance(a) dot(vec3(0.2125, 0.7154, 0.0721), a)\nvec3 screenSpaceToWorldSpace(const vec2 uv,const float depth,mat4 curMatrixWorld,const mat4 projMatrixInverse){vec4 ndc=vec4((uv.x-0.5)*2.0,(uv.y-0.5)*2.0,(depth-0.5)*2.0,1.0);vec4 clip=projMatrixInverse*ndc;vec4 view=curMatrixWorld*(clip/clip.w);return view.xyz;}vec2 viewSpaceToScreenSpace(const vec3 position,const mat4 projMatrix){vec4 projectedCoord=projMatrix*vec4(position,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;return projectedCoord.xy;}bool doColorTransform[textureCount];\n#ifdef logTransform\nvoid transformColor(inout vec3 color){if(!doColorTransform[texIndex])return;float lum=luminance(color);float diff=min(1.0,lum-0.99);if(diff>0.0){color=vec3(diff*0.1);return;}color=log(max(color,vec3(EPSILON)));}void undoColorTransform(inout vec3 color){if(!doColorTransform[texIndex])return;color=exp(color);}\n#else\n#define transformColor\n#define undoColorTransform\n#endif\nvoid getNeighborhoodAABB(const sampler2D tex,inout vec3 minNeighborColor,inout vec3 maxNeighborColor){for(int x=-neighborhoodClampRadius;x<=neighborhoodClampRadius;x++){for(int y=-neighborhoodClampRadius;y<=neighborhoodClampRadius;y++){if(x!=0||y!=0){vec2 offset=vec2(x,y)*invTexSize;vec2 neighborUv=vUv+offset;vec4 neighborTexel=textureLod(tex,neighborUv,0.0);transformColor(neighborTexel.rgb);minNeighborColor=min(neighborTexel.rgb,minNeighborColor);maxNeighborColor=max(neighborTexel.rgb,maxNeighborColor);}}}}void clampNeighborhood(const sampler2D tex,inout vec3 color,const vec3 inputColor){vec3 minNeighborColor=inputColor;vec3 maxNeighborColor=inputColor;getNeighborhoodAABB(tex,minNeighborColor,maxNeighborColor);color=clamp(color,minNeighborColor,maxNeighborColor);}\n#ifdef dilation\nvoid getDilatedDepthUVOffset(const sampler2D tex,const vec2 centerUv,out float depth,out float dilatedDepth,out vec4 closestDepthTexel){float closestDepth=0.0;for(int x=-1;x<=1;x++){for(int y=-1;y<=1;y++){vec2 offset=vec2(x,y)*invTexSize;vec2 neighborUv=centerUv+offset;vec4 neighborDepthTexel=textureLod(tex,neighborUv,0.0);float neighborDepth=unpackRGBAToDepth(neighborDepthTexel);if(x==0&&y==0)depth=neighborDepth;if(neighborDepth>closestDepth){closestDepth=neighborDepth;closestDepthTexel=neighborDepthTexel;dilatedUvOffset=offset;}}}dilatedDepth=closestDepth;}\n#endif\nvoid getDepthAndDilatedUVOffset(sampler2D depthTex,vec2 uv,out float depth,out float dilatedDepth,out vec4 depthTexel){\n#ifdef dilation\ngetDilatedDepthUVOffset(depthTex,uv,depth,dilatedDepth,depthTexel);\n#else\ndepthTexel=textureLod(depthTex,uv,0.);depth=unpackRGBAToDepth(depthTexel);dilatedDepth=depth;\n#endif\n}bool planeDistanceDisocclusionCheck(const vec3 worldPos,const vec3 lastWorldPos,const vec3 worldNormal,const float worldDistFactor){if(abs(dot(worldNormal,worldPos))==0.0)return false;vec3 toCurrent=worldPos-lastWorldPos;float distToPlane=abs(dot(toCurrent,worldNormal));return distToPlane>depthDistance*worldDistFactor;}bool worldDistanceDisocclusionCheck(const vec3 worldPos,const vec3 lastWorldPos,const float worldDistFactor){return distance(worldPos,lastWorldPos)>worldDistance*worldDistFactor;}bool validateReprojectedUV(const vec2 reprojectedUv,const vec3 worldPos,const vec3 worldNormal){if(reprojectedUv.x>1.0||reprojectedUv.x<0.0||reprojectedUv.y>1.0||reprojectedUv.y<0.0)return false;vec3 dilatedWorldPos=worldPos;vec3 lastWorldPos;float dilatedLastDepth,lastDepth;vec4 lastDepthTexel;vec2 dilatedReprojectedUv;\n#ifdef dilation\ndilatedWorldPos=screenSpaceToWorldSpace(vUv+dilatedUvOffset,dilatedDepth,cameraMatrixWorld,projectionMatrixInverse);getDepthAndDilatedUVOffset(lastDepthTexture,reprojectedUv,lastDepth,dilatedLastDepth,lastDepthTexel);dilatedReprojectedUv=reprojectedUv+dilatedUvOffset;\n#else\nlastDepthTexel=textureLod(lastDepthTexture,reprojectedUv,0.);lastDepth=unpackRGBAToDepth(lastDepthTexel);dilatedLastDepth=lastDepth;dilatedReprojectedUv=reprojectedUv;\n#endif\nlastWorldPos=screenSpaceToWorldSpace(dilatedReprojectedUv,dilatedLastDepth,prevCameraMatrixWorld,prevProjectionMatrixInverse);float worldDistFactor=clamp((50.0+distance(dilatedWorldPos,cameraPos))/100.,0.25,1.);if(worldDistanceDisocclusionCheck(dilatedWorldPos,lastWorldPos,worldDistFactor))return false;return!planeDistanceDisocclusionCheck(dilatedWorldPos,lastWorldPos,worldNormal,worldDistFactor);}vec2 reprojectHitPoint(const vec3 rayOrig,const float rayLength,const float depth){vec3 cameraRay=normalize(rayOrig-cameraPos);float cameraRayLength=distance(rayOrig,cameraPos);vec3 parallaxHitPoint=cameraPos+cameraRay*(cameraRayLength+rayLength);vec4 reprojectedParallaxHitPoint=prevViewMatrix*vec4(parallaxHitPoint,1.0);vec2 hitPointUv=viewSpaceToScreenSpace(reprojectedParallaxHitPoint.xyz,prevProjectionMatrix);return hitPointUv;}vec2 getReprojectedUV(const float depth,const vec3 worldPos,const vec3 worldNormal,const float rayLength){if(rayLength!=0.0){vec2 reprojectedUv=reprojectHitPoint(worldPos,rayLength,depth);if(validateReprojectedUV(reprojectedUv,worldPos,worldNormal)){return reprojectedUv;}return vec2(-1.);}vec2 reprojectedUv=vUv-velocityTexel.rg;if(validateReprojectedUV(reprojectedUv,worldPos,worldNormal)){return reprojectedUv;}return vec2(-1.);}vec4 SampleTextureCatmullRom(const sampler2D tex,const vec2 uv,const vec2 texSize){vec2 samplePos=uv*texSize;vec2 texPos1=floor(samplePos-0.5f)+0.5f;vec2 f=samplePos-texPos1;vec2 w0=f*(-0.5f+f*(1.0f-0.5f*f));vec2 w1=1.0f+f*f*(-2.5f+1.5f*f);vec2 w2=f*(0.5f+f*(2.0f-1.5f*f));vec2 w3=f*f*(-0.5f+0.5f*f);vec2 w12=w1+w2;vec2 offset12=w2/(w1+w2);vec2 texPos0=texPos1-1.;vec2 texPos3=texPos1+2.;vec2 texPos12=texPos1+offset12;texPos0/=texSize;texPos3/=texSize;texPos12/=texSize;vec4 result=vec4(0.0);result+=textureLod(tex,vec2(texPos0.x,texPos0.y),0.0f)*w0.x*w0.y;result+=textureLod(tex,vec2(texPos12.x,texPos0.y),0.0f)*w12.x*w0.y;result+=textureLod(tex,vec2(texPos3.x,texPos0.y),0.0f)*w3.x*w0.y;result+=textureLod(tex,vec2(texPos0.x,texPos12.y),0.0f)*w0.x*w12.y;result+=textureLod(tex,vec2(texPos12.x,texPos12.y),0.0f)*w12.x*w12.y;result+=textureLod(tex,vec2(texPos3.x,texPos12.y),0.0f)*w3.x*w12.y;result+=textureLod(tex,vec2(texPos0.x,texPos3.y),0.0f)*w0.x*w3.y;result+=textureLod(tex,vec2(texPos12.x,texPos3.y),0.0f)*w12.x*w3.y;result+=textureLod(tex,vec2(texPos3.x,texPos3.y),0.0f)*w3.x*w3.y;result=max(result,vec4(0.));return result;}vec2 sampleBlocky(vec2 p){vec2 d=vec2(dFdx(p.x),dFdy(p.y))/invTexSize;p/=invTexSize;vec2 fA=p-0.5*d,iA=floor(fA);vec2 fB=p+0.5*d,iB=floor(fB);return(iA+(iB-iA)*(fB-iB)/d+0.5)*invTexSize;}float computeEdgeStrength(float unpackedDepth,vec2 texelSize){float depthX=unpackRGBAToDepth(textureLod(depthTexture,vUv+vec2(texelSize.x,0.0),0.0))-unpackRGBAToDepth(textureLod(depthTexture,vUv-vec2(texelSize.x,0.0),0.0));float depthY=unpackRGBAToDepth(textureLod(depthTexture,vUv+vec2(0.0,texelSize.y),0.0))-unpackRGBAToDepth(textureLod(depthTexture,vUv-vec2(0.0,texelSize.y),0.0));float gradientMagnitude=sqrt(depthX*depthX+depthY*depthY);float edgeStrength=min(100000.*gradientMagnitude/(unpackedDepth+0.001),1.);return edgeStrength*edgeStrength;}float computeEdgeStrengthFast(float unpackedDepth){float depthX=dFdx(unpackedDepth);float depthY=dFdy(unpackedDepth);float edgeStrength=depthX*depthX+depthY*depthY;return min(1.,pow(pow(edgeStrength,0.25)*500.,4.));}vec4 sampleReprojectedTexture(const sampler2D tex,const vec2 reprojectedUv){vec4 catmull=SampleTextureCatmullRom(tex,reprojectedUv,1.0/invTexSize);vec4 blocky=SampleTextureCatmullRom(tex,sampleBlocky(reprojectedUv),1.0/invTexSize);vec4 reprojectedTexel=mix(catmull,blocky,edgeStrength);reprojectedTexel.a=min(catmull.a,blocky.a);return reprojectedTexel;}vec2 OctWrap(vec2 v){vec2 w=1.0-abs(v.yx);if(v.x<0.0)w.x=-w.x;if(v.y<0.0)w.y=-w.y;return w;}vec2 Encode(vec3 n){n/=(abs(n.x)+abs(n.y)+abs(n.z));n.xy=n.z>0.0 ? n.xy : OctWrap(n.xy);n.xy=n.xy*0.5+0.5;return n.xy;}vec3 Decode(vec2 f){f=f*2.0-1.0;vec3 n=vec3(f.x,f.y,1.0-abs(f.x)-abs(f.y));float t=max(-n.z,0.0);n.x+=n.x>=0.0 ?-t : t;n.y+=n.y>=0.0 ?-t : t;return normalize(n);}")),i=("string"==typeof n&&(r=r.replace("temporalReprojectCustomComposeShader",n)),""),a=0;a<t;a++)i+="\n\t\t\t\tuniform sampler2D inputTexture".concat(a,";\n\t\t\t\tuniform sampler2D accumulatedTexture").concat(a,";\n\n\t\t\t\tlayout(location = ").concat(a,") out vec4 gOutput").concat(a,";\n\t\t\t");var s,o=_l((r=kl(r=i+r.replaceAll("textureCount",t))).matchAll(/inputTexture\[\s*[0-9]+\s*]/g));try{for(o.s();!(s=o.n()).done;){var l=fl(s.value,1)[0],u=l.replace(/[^0-9]/g,"");r=r.replace(l,"inputTexture"+u)}}catch(t){o.e(t)}finally{o.f()}var c,d=_l(r.matchAll(/accumulatedTexture\[\s*[0-9]+\s*]/g));try{for(d.s();!(c=d.n()).done;){var h=fl(c.value,1)[0],p=h.replace(/[^0-9]/g,"");r=r.replace(h,"accumulatedTexture"+p)}}catch(t){d.e(t)}finally{d.f()}var f,m=_l(r.matchAll(/gOutput\[\s*[0-9]+\s*]/g));try{for(m.s();!(f=m.n()).done;){var g=fl(f.value,1)[0],v=g.replace(/[^0-9]/g,"");r=r.replace(g,"gOutput"+v)}}catch(t){m.e(t)}finally{m.f()}for(var y=yl(this,e,[{type:"TemporalReprojectMaterial",uniforms:{velocityTexture:new or.Uniform(null),depthTexture:new or.Uniform(null),lastDepthTexture:new or.Uniform(null),blend:new or.Uniform(0),neighborhoodClampIntensity:new or.Uniform(0),constantBlend:new or.Uniform(!1),fullAccumulate:new or.Uniform(!1),reset:new or.Uniform(!1),delta:new or.Uniform(0),invTexSize:new or.Uniform(new or.Vector2),projectionMatrix:new or.Uniform(new or.Matrix4),projectionMatrixInverse:new or.Uniform(new or.Matrix4),cameraMatrixWorld:new or.Uniform(new or.Matrix4),viewMatrix:new or.Uniform(new or.Matrix4),prevViewMatrix:new or.Uniform(new or.Matrix4),prevCameraMatrixWorld:new or.Uniform(new or.Matrix4),prevProjectionMatrix:new or.Uniform(new or.Matrix4),prevProjectionMatrixInverse:new or.Uniform(new or.Matrix4),cameraPos:new or.Uniform(new or.Vector3)},vertexShader:Il,fragmentShader:r,blending:or.NoBlending,depthWrite:!1,depthTest:!1,toneMapped:!1,glslVersion:or.GLSL3}]),b=0;b<t;b++)y.uniforms["inputTexture"+b]=new or.Uniform(null),y.uniforms["accumulatedTexture"+b]=new or.Uniform(null);return"string"==typeof n&&(y.defines.useTemporalReprojectCustomComposeShader=""),y}return wl(e,or.ShaderMaterial),vl(e)}(),Bl=1.1127756842787055,Fl={blend:.9,dilation:!1,constantBlend:!1,fullAccumulate:!1,neighborhoodClamp:!1,neighborhoodClampRadius:1,neighborhoodClampIntensity:1,logTransform:!1,depthDistance:.25,worldDistance:.375,reprojectSpecular:!1,temporalReprojectCustomComposeShader:null,renderTarget:null},jl=new or.Matrix4,zl=new or.Matrix4,Vl=function(){function e(t,n,r){var i,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:Fl;ml(this,e),(i=yl(this,e,["TemporalReprojectPass"])).needsSwap=!1,i.clock=new or.Clock,i.r2Sequence=[],i.pointsIndex=0,i.lastCameraTransform={position:new or.Vector3,quaternion:new or.Quaternion},i._scene=t,i._camera=n,i.textureCount=a,s=dl(dl({},Fl),s),i.renderTarget=new or.WebGLMultipleRenderTargets(1,1,a,{minFilter:or.LinearFilter,magFilter:or.LinearFilter,type:or.HalfFloatType,depthBuffer:!1}),i.renderTarget.texture.map((function(e,t){return e.name="TemporalReprojectPass.accumulatedTexture"+t})),i.fullscreenMaterial=new Ul(a,s.temporalReprojectCustomComposeShader),i.fullscreenMaterial.defines.textureCount=a,s.dilation&&(i.fullscreenMaterial.defines.dilation=""),s.neighborhoodClamp&&(i.fullscreenMaterial.defines.neighborhoodClamp=""),s.logTransform&&(i.fullscreenMaterial.defines.logTransform=""),i.fullscreenMaterial.defines.neighborhoodClampRadius=parseInt(s.neighborhoodClampRadius),i.fullscreenMaterial.defines.depthDistance=s.depthDistance.toPrecision(5),i.fullscreenMaterial.defines.worldDistance=s.worldDistance.toPrecision(5),i.fullscreenMaterial.uniforms.blend.value=s.blend,i.fullscreenMaterial.uniforms.constantBlend.value=s.constantBlend,i.fullscreenMaterial.uniforms.fullAccumulate.value=s.fullAccumulate,i.fullscreenMaterial.uniforms.neighborhoodClampIntensity.value=s.neighborhoodClampIntensity,i.fullscreenMaterial.uniforms.projectionMatrix.value=n.projectionMatrix.clone(),i.fullscreenMaterial.uniforms.projectionMatrixInverse.value=n.projectionMatrixInverse.clone(),i.fullscreenMaterial.uniforms.cameraMatrixWorld.value=n.matrixWorld,i.fullscreenMaterial.uniforms.viewMatrix.value=n.matrixWorldInverse,i.fullscreenMaterial.uniforms.cameraPos.value=n.position,i.fullscreenMaterial.uniforms.prevViewMatrix.value=n.matrixWorldInverse.clone(),i.fullscreenMaterial.uniforms.prevCameraMatrixWorld.value=n.matrixWorld.clone(),i.fullscreenMaterial.uniforms.prevProjectionMatrix.value=n.projectionMatrix.clone(),i.fullscreenMaterial.uniforms.prevProjectionMatrixInverse.value=n.projectionMatrixInverse.clone(),i.copyPass=new Rl(a);for(var o=0;o<a;o++){var l=i.copyPass.renderTarget.texture[o];l.type=or.HalfFloatType,l.minFilter=or.LinearFilter,l.magFilter=or.LinearFilter,l.needsUpdate=!0}i.fullscreenMaterial.uniforms.velocityTexture.value=r.texture,i.fullscreenMaterial.uniforms.depthTexture.value=r.depthTexture;for(var u=0,c=["reprojectSpecular","neighborhoodClamp"];u<c.length;u++){var d=c[u],h=s[d];"array"!=typeof h&&(h=Array(a).fill(h)),i.fullscreenMaterial.defines[d]="bool[](".concat(h.join(", "),")")}return i.options=s,i.velocityDepthNormalPass=r,i}return wl(e,fs.Pass),vl(e,[{key:"setTextures",value:function(e){Array.isArray(e)||(e=[e]);for(var t=0;t<e.length;t++){var n=e[t];this.fullscreenMaterial.uniforms["inputTexture"+t]=new or.Uniform(n)}}},{key:"dispose",value:function(){pl(xl(e.prototype),"dispose",this).call(this),this.renderTarget.dispose(),this.copyPass.dispose(),this.fullscreenMaterial.dispose()}},{key:"setSize",value:function(e,t){this.renderTarget.setSize(e,t),this.copyPass.setSize(e,t),this.fullscreenMaterial.uniforms.invTexSize.value.set(1/e,1/t)}},{key:"texture",get:function(){return this.renderTarget.texture[0]}},{key:"reset",value:function(){this.fullscreenMaterial.uniforms.reset.value=!0}},{key:"render",value:function(e){var t=Math.min(.1,this.clock.getDelta());this.fullscreenMaterial.uniforms.delta.value=t,jl.copy(this._camera.projectionMatrix),zl.copy(this._camera.projectionMatrixInverse),this._camera.view&&(this._camera.view.enabled=!1),this._camera.updateProjectionMatrix(),this.fullscreenMaterial.uniforms.projectionMatrix.value.copy(this._camera.projectionMatrix),this.fullscreenMaterial.uniforms.projectionMatrixInverse.value.copy(this._camera.projectionMatrixInverse),this.fullscreenMaterial.uniforms.lastDepthTexture.value=this.velocityDepthNormalPass.lastDepthTexture,this._camera.view&&(this._camera.view.enabled=!0),this._camera.projectionMatrix.copy(jl),this._camera.projectionMatrixInverse.copy(zl),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),this.fullscreenMaterial.uniforms.reset.value=!1;for(var n=0;n<this.textureCount;n++)this.copyPass.fullscreenMaterial.uniforms["inputTexture"+n].value=this.renderTarget.texture[n],this.fullscreenMaterial.uniforms["accumulatedTexture"+n].value=this.copyPass.renderTarget.texture[n];this.copyPass.render(e),this.fullscreenMaterial.uniforms.prevCameraMatrixWorld.value.copy(this._camera.matrixWorld),this.fullscreenMaterial.uniforms.prevViewMatrix.value.copy(this._camera.matrixWorldInverse),this.fullscreenMaterial.uniforms.prevProjectionMatrix.value.copy(this.fullscreenMaterial.uniforms.projectionMatrix.value),this.fullscreenMaterial.uniforms.prevProjectionMatrixInverse.value.copy(this.fullscreenMaterial.uniforms.projectionMatrixInverse.value)}},{key:"jitter",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=(this.unjitter(),0===this.r2Sequence.length&&(this.r2Sequence=function(e){for(var t=[],n=0;n<256;n++)t.push([(Bl+.7548776662466927*n)%1,(Bl+.5698402909980532*n)%1]);return t}().map((function(e){return[(e=fl(e,2))[0]-.5,e[1]-.5]}))),this.pointsIndex=(this.pointsIndex+1)%this.r2Sequence.length,fl(this.r2Sequence[this.pointsIndex],2)),n=t[0],r=(t=t[1],(i=this.renderTarget).width),i=i.height;this._camera.setViewOffset&&this._camera.setViewOffset(r,i,n*e,t*e,r,i)}},{key:"unjitter",value:function(){this._camera.clearViewOffset&&this._camera.clearViewOffset()}}]),e}(),Hl={blend:.8,constantBlend:!0,dilation:!0,logTransform:!1,neighborhoodClampRadius:2,depthDistance:10,worldDistance:5,neighborhoodClamp:!0},Wl=function(){function e(t,n,r){var i,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Hl;return ml(this,e),(i=yl(this,e,["TRAAEffect","#define GLSLIFY 1\nuniform sampler2D inputTexture;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 accumulatedTexel=textureLod(inputTexture,vUv,0.);outputColor=vec4(accumulatedTexel.rgb,1.);}",{type:"FinalTRAAEffectMaterial",uniforms:new Map([["inputTexture",new or.Uniform(null)]])}]))._scene=t,i._camera=n,a=dl(dl({},Hl),a),i.temporalReprojectPass=new Vl(t,n,r,1,a),i.uniforms.get("inputTexture").value=i.temporalReprojectPass.texture,i.setSize(a.width,a.height),i}return wl(e,fs.Effect),vl(e,[{key:"setSize",value:function(e,t){this.temporalReprojectPass.setSize(e,t)}},{key:"dispose",value:function(){pl(xl(e.prototype),"dispose",this).call(this),this.temporalReprojectPass.dispose()}},{key:"update",value:function(e,t){var n=this;this.temporalReprojectPass.unjitter(),this.unjitteredProjectionMatrix=this._camera.projectionMatrix.clone(),this._camera.projectionMatrix.copy(this.unjitteredProjectionMatrix);var r,i=_l(El(this._scene).filter((function(e){return Nl(e)})));try{for(i.s();!(r=i.n()).done;)!function(){var t=r.value;if(null!=(t=e.properties.get(t.material))&&t.programs){var i,a=Array.from(t.programs.values())[0].getUniforms();a._patchedProjectionMatrix||(i=a.setValue.bind(a),a._oldSetValue=i,a.setValue=function(e,t,r){"projectionMatrix"===t&&(r=n.unjitteredProjectionMatrix);for(var a=arguments.length,s=new Array(3<a?a-3:0),o=3;o<a;o++)s[o-3]=arguments[o];i.apply(void 0,[e,t,r].concat(s))},a._patchedProjectionMatrix=!0),cancelAnimationFrame(a._destroyPatchRAF),cancelAnimationFrame(a._destroyPatchRAF2),a._destroyPatchRAF=requestAnimationFrame((function(){a._destroyPatchRAF2=requestAnimationFrame((function(){a.setValue=a._oldSetValue,delete a._oldSetValue,delete a._patchedProjectionMatrix}))}))}}()}catch(t){i.e(t)}finally{i.f()}this.temporalReprojectPass.fullscreenMaterial.uniforms.inputTexture0.value=t.texture,this.temporalReprojectPass.jitter(),this.temporalReprojectPass.render(e)}}]),e}(),Gl=(Wl.DefaultOptions=Hl,{moment:!1,depth:!1,normal:!1,roughness:!1,diffuse:!0,roughnessDependent:!1,basicVariance:5e-4,denoiseCustomComposeShader:"",denoiseCustomComposeShaderFunctions:""}),Kl=[["moment","","useMoment"],["depth","depthPhi","useDepth"],["normal","normalPhi","useNormal"],["roughness","roughnessPhi","useRoughness"]],Zl=function(){function e(t){var n,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Gl;return ml(this,e),(n=yl(this,e,["DenoisePass"])).iterations=1,Array.isArray(r)||(r=[r]),i=dl(dl({},Gl),i),n.options=i,n.fullscreenMaterial=new or.ShaderMaterial({fragmentShader:"",vertexShader:Il,uniforms:{depthTexture:new or.Uniform(null),normalTexture:new or.Uniform(null),momentTexture:new or.Uniform(null),invTexSize:new or.Uniform(new or.Vector2),horizontal:new or.Uniform(!0),blurHorizontal:new or.Uniform(!0),denoiseKernel:new or.Uniform(1),denoiseDiffuse:new or.Uniform(1),denoise:new or.Uniform([0]),depthPhi:new or.Uniform(1),normalPhi:new or.Uniform(1),roughnessPhi:new or.Uniform(1),stepSize:new or.Uniform(1),isFirstIteration:new or.Uniform(!1),isLastIteration:new or.Uniform(!1),viewMatrix:new or.Uniform(t.matrixWorldInverse),projectionMatrix:new or.Uniform(t.projectionMatrix),cameraMatrixWorld:new or.Uniform(t.matrixWorld),projectionMatrixInverse:new or.Uniform(t.projectionMatrixInverse)},glslVersion:or.GLSL3,blending:or.NoBlending,depthWrite:!1,depthTest:!1,toneMapped:!1}),t={type:or.HalfFloatType,depthBuffer:!1},n.renderTargetA=new or.WebGLMultipleRenderTargets(1,1,r.length,t),n.renderTargetB=new or.WebGLMultipleRenderTargets(1,1,r.length,t),"boolean"==typeof i.roughnessDependent&&(i.roughnessDependent=Array(r.length).fill(i.roughnessDependent)),n.fullscreenMaterial.defines.roughnessDependent="bool[](".concat(i.roughnessDependent.join(", "),")"),"number"==typeof i.basicVariance&&(i.basicVariance=Array(r.length).fill(i.basicVariance)),n.fullscreenMaterial.defines.basicVariance="float[](".concat(i.basicVariance.map((function(e){return e.toPrecision(5)})).join(", "),")"),n.setTextures(r),n}return wl(e,fs.Pass),vl(e,[{key:"setTextures",value:function(e){Array.isArray(e)||(e=[e]),this.textures=e;for(var t="",n="",r=0;r<this.textures.length;r++)t=(t+="layout(location = ".concat(r,") out vec4 gTexture").concat(r,";\n"))+"uniform sampler2D inputTexture".concat(r,";\n"),n+="gTexture".concat(r," = vec4(denoisedColor[").concat(r,"], sumVariance[").concat(r,"]);\n");var i,a=_l((l=kl(l=t+"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D depthTexture;uniform sampler2D normalTexture;uniform sampler2D momentTexture;uniform vec2 invTexSize;uniform bool horizontal;uniform bool blurHorizontal;uniform float denoise[textureCount];uniform float depthPhi;uniform float normalPhi;uniform float roughnessPhi;uniform float denoiseKernel;uniform float stepSize;uniform mat4 projectionMatrixInverse;uniform mat4 projectionMatrix;uniform mat4 cameraMatrixWorld;uniform bool isFirstIteration;uniform bool isLastIteration;\n#include <packing>\n#define EPSILON 0.00001\n#define M_PI 3.1415926535897932384626433832795\n#define PI M_PI\n#define luminance(a) dot(a, vec3(0.2125, 0.7154, 0.0721))\n#include <denoiseCustomComposeShaderFunctions>\nvec3 screenSpaceToWorldSpace(const vec2 uv,const float depth,const mat4 curMatrixWorld){vec4 ndc=vec4((uv.x-0.5)*2.0,(uv.y-0.5)*2.0,(depth-0.5)*2.0,1.0);vec4 clip=projectionMatrixInverse*ndc;vec4 view=curMatrixWorld*(clip/clip.w);return view.xyz;}float distToPlane(const vec3 worldPos,const vec3 neighborWorldPos,const vec3 worldNormal){vec3 toCurrent=worldPos-neighborWorldPos;float distToPlane=abs(dot(toCurrent,worldNormal));return distToPlane;}float getDisocclusionBoostVariance(float visibleFrames){\n#ifdef useTemporalReprojectTextures\nreturn max(0.,-pow(visibleFrames,2.0)+50.0);\n#else\nreturn 0.;\n#endif\n}void tap(const vec2 neighborVec,const vec2 pixelStepOffset,const vec3 normal,const float depth,const float roughness,const vec3 worldPos,const float luma[textureCount],const float colorPhi[textureCount],inout vec3 denoisedColor[textureCount],inout float totalWeight[textureCount],inout float sumVariance[textureCount],inout float variance[textureCount]){vec2 fullNeighborUv=neighborVec*pixelStepOffset;vec2 neighborUvNearest=vUv+fullNeighborUv;vec2 bilinearOffset=neighborVec.y>0. ? invTexSize :-invTexSize;vec2 neighborUv=vUv+fullNeighborUv+bilinearOffset*0.5;vec2 neighborUvRoughness=vUv+fullNeighborUv*(roughness<0.15 ? roughness/0.15 : 1.)+bilinearOffset*0.5;float basicWeight=1.0;\n#ifdef useDepth\nvec4 neighborDepthTexel=textureLod(depthTexture,neighborUvNearest,0.);\n#ifdef RGBA_DEPTH_PACKING\nfloat neighborDepth=unpackRGBAToDepth(neighborDepthTexel);\n#else\nfloat neighborDepth=neighborDepthTexel.r;\n#endif\nvec3 neighborWorldPos=screenSpaceToWorldSpace(neighborUvNearest,neighborDepth,cameraMatrixWorld);\n#ifdef useNormal\nfloat depthDiff=1.-distToPlane(worldPos,neighborWorldPos,normal);\n#else\nfloat depthDiff=1.-abs(depth-neighborDepth);\n#endif\nfloat depthSimilarity=max(depthDiff/depthPhi,0.);basicWeight*=depthSimilarity;\n#endif\n#if defined(useNormal) || defined(useRoughness)\nvec4 neighborNormalTexel=textureLod(normalTexture,neighborUvNearest,0.);\n#endif\n#ifdef useNormal\nvec3 neighborNormal=neighborNormalTexel.xyz;float normalDiff=dot(neighborNormal,normal);float normalSimilarity=pow(max(0.,normalDiff),normalPhi);basicWeight*=normalSimilarity;\n#endif\n#ifdef useRoughness\nfloat neighborRoughness=neighborNormalTexel.a;neighborRoughness*=neighborRoughness;float roughnessDiff=abs(roughness-neighborRoughness);float roughnessSimilarity=exp(-roughnessDiff*roughnessPhi);basicWeight*=roughnessSimilarity;\n#endif\nvec4 neighborInputTexel[textureCount];vec3 neighborColor;float neighborLuma,lumaDiff,lumaSimilarity,disocclusionBoost;float weight[textureCount];\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){neighborInputTexel[i]=textureLod(inputTexture[i],roughnessDependent[i]? neighborUvRoughness : neighborUv,0.);neighborColor=neighborInputTexel[i].rgb;neighborLuma=luminance(neighborColor);lumaDiff=abs(luma[i]-neighborLuma);lumaSimilarity=max(1.0-lumaDiff/colorPhi[i],0.0);weight[i]=min(basicWeight*lumaSimilarity,1.0);disocclusionBoost=variance[i]/1000.;weight[i]=mix(weight[i],1.,disocclusionBoost);denoisedColor[i]+=neighborColor*weight[i];totalWeight[i]+=weight[i];}\n#pragma unroll_loop_end\nif(isFirstIteration){\n#ifdef useMoment\nvec4 neighborMoment=textureLod(momentTexture,neighborUvNearest,0.);neighborInputTexel[0].a=neighborMoment.g-neighborMoment.r*neighborMoment.r;\n#if momentTextureCount > 1\nneighborInputTexel[1].a=neighborMoment.a-neighborMoment.b*neighborMoment.b;\n#endif\n#else\nfor(int i=0;i<textureCount;i++){neighborInputTexel[i].a=getDisocclusionBoostVariance(neighborInputTexel[i].a);}\n#endif\n}\n#pragma unroll_loop_start\nfor(int i=0;i<momentTextureCount;i++){\n#ifndef useMoment\nif(isFirstIteration)neighborInputTexel[i].a=1.0;\n#endif\nsumVariance[i]+=weight[i]*weight[i]*neighborInputTexel[i].a;}\n#pragma unroll_loop_end\n}void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.);if(depthTexel.r>0.9999||dot(depthTexel.rgb,depthTexel.rgb)==0.){discard;return;}vec3 worldPos;float depth;\n#ifdef useDepth\n#ifdef RGBA_DEPTH_PACKING\ndepth=unpackRGBAToDepth(depthTexel);\n#else\ndepth=depthTexel.r;\n#endif\nworldPos=screenSpaceToWorldSpace(vUv,depth,cameraMatrixWorld);\n#endif\nvec3 normal;float roughness;\n#ifdef useNormal\nvec4 normalTexel=textureLod(normalTexture,vUv,0.);normal=normalTexel.xyz;\n#endif\n#ifdef useRoughness\nroughness=normalTexel.a;roughness*=roughness;\n#endif\nvec3 denoisedColor[textureCount];float sumVariance[textureCount];float variance[textureCount];\n#ifdef doDenoise\nvec4 texel[textureCount];float luma[textureCount];float totalWeight[textureCount];float colorPhi[textureCount];\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){totalWeight[i]=1.0;texel[i]=textureLod(inputTexture[i],vUv,0.);denoisedColor[i]=texel[i].rgb;luma[i]=luminance(texel[i].rgb);}\n#pragma unroll_loop_end\nif(isFirstIteration){\n#ifdef useMoment\nvec4 moment=textureLod(momentTexture,vUv,0.);texel[0].a=max(0.0,moment.g-moment.r*moment.r);\n#if momentTextureCount > 1\ntexel[1].a=max(0.0,moment.a-moment.b*moment.b);\n#endif\n#else\nfor(int i=0;i<textureCount;i++){texel[i].a=getDisocclusionBoostVariance(texel[i].a);}\n#endif\n}\n#pragma unroll_loop_start\nfor(int i=0;i<momentTextureCount;i++){variance[i]=min(1000.,texel[i].a);sumVariance[i]=texel[i].a;if(roughnessDependent[i]){colorPhi[i]=denoise[i]*sqrt(basicVariance[i]*roughness+sumVariance[i]);}else{colorPhi[i]=denoise[i]*sqrt(basicVariance[i]+sumVariance[i]);}}\n#pragma unroll_loop_end\nvec2 pixelStepOffset=invTexSize*stepSize;if(blurHorizontal){for(float i=-denoiseKernel;i<=denoiseKernel;i++){if(i!=0.){vec2 neighborVec=horizontal ? vec2(i,0.): vec2(0.,i);tap(neighborVec,pixelStepOffset,normal,depth,roughness,worldPos,luma,colorPhi,denoisedColor,totalWeight,sumVariance,variance);}}}else{for(float i=-denoiseKernel;i<=denoiseKernel;i++){if(i!=0.){vec2 neighborVec=horizontal ? vec2(-i,-i): vec2(i,-i);tap(neighborVec,pixelStepOffset,normal,depth,roughness,worldPos,luma,colorPhi,denoisedColor,totalWeight,sumVariance,variance);}}}\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){sumVariance[i]/=totalWeight[i]*totalWeight[i];denoisedColor[i]/=totalWeight[i];}\n#pragma unroll_loop_end\n#else\n#pragma unroll_loop_start\nfor(int i=0;i<textureCount;i++){denoisedColor[i]=textureLod(inputTexture[i],vUv,0.).rgb;}\n#pragma unroll_loop_end\n#endif\nif(isLastIteration){\n#include <denoiseCustomComposeShader>\n}\n#include <outputShader>\n}".replace("#include <denoiseCustomComposeShaderFunctions>",this.options.denoiseCustomComposeShaderFunctions).replace("#include <denoiseCustomComposeShader>",this.options.denoiseCustomComposeShader).replace("#include <outputShader>",n).replaceAll("textureCount",this.textures.length).replaceAll("momentTextureCount",Math.min(this.textures.length,2)))).matchAll(/inputTexture\[\s*[0-9]+\s*]/g));try{for(a.s();!(i=a.n()).done;)var s=fl(i.value,1)[0],o=s.replace(/[^0-9]/g,""),l=l.replace(s,"inputTexture"+o)}catch(e){a.e(e)}finally{a.f()}delete this.fullscreenMaterial.defines.useTemporalReprojectTextures;for(var u=0;u<e.length;u++){var c=e[u];this.fullscreenMaterial.uniforms["inputTexture"+u]=new or.Uniform(c),c.name.includes("TemporalReprojectPass.accumulatedTexture")&&(this.fullscreenMaterial.defines.useTemporalReprojectTextures="")}this.fullscreenMaterial.fragmentShader=l,this.fullscreenMaterial.needsUpdate=!0}},{key:"setDepthTexture",value:function(e){((this.fullscreenMaterial.uniforms.depthTexture.value=e).type===or.UnsignedByteType?or.RGBADepthPacking:or.BasicDepthPacking)===or.RGBADepthPacking?this.fullscreenMaterial.defines.RGBA_DEPTH_PACKING="":delete this.fullscreenMaterial.defines.RGBA_DEPTH_PACKING,this.options.depth=!0}},{key:"setNormalTexture",value:function(e){var t=void 0!==(t=(1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}).useRoughnessInAlphaChannel)&&t;this.fullscreenMaterial.uniforms.normalTexture.value=e,this.options.normal=!0,this.options.roughness=t}},{key:"setMomentTexture",value:function(e){this.fullscreenMaterial.uniforms.momentTexture.value=e,this.options.moment=!0}},{key:"setSize",value:function(e,t){this.renderTargetA.setSize(e,t),this.renderTargetB.setSize(e,t),this.fullscreenMaterial.uniforms.invTexSize.value.set(1/e,1/t)}},{key:"dispose",value:function(){pl(xl(e.prototype),"dispose",this).call(this),this.renderTargetA.dispose(),this.renderTargetB.dispose()}},{key:"keepEdgeStoppingDefinesUpdated",value:function(){var e,t=_l(Kl);try{for(t.s();!(e=t.n()).done;){var n,r=fl(e.value,3),i=r[0],a=r[1],s=r[2],o=this.options[i]&&(""===a||.001<(null==(n=this.fullscreenMaterial.uniforms[a])?void 0:n.value));o!==s in this.fullscreenMaterial.defines&&(o?this.fullscreenMaterial.defines[s]="":delete this.fullscreenMaterial.defines[s],this.fullscreenMaterial.needsUpdate=!0)}}catch(e){t.e(e)}finally{t.f()}}},{key:"render",value:function(e){this.keepEdgeStoppingDefinesUpdated();var t=this.fullscreenMaterial.uniforms.denoiseKernel.value;if(0<this.iterations){"doDenoise"in this.fullscreenMaterial.defines||(this.fullscreenMaterial.defines.doDenoise="",this.fullscreenMaterial.needsUpdate=!0);for(var n=0;n<2*this.iterations;n++){for(var r=n%2==0,i=Math.pow(2,~~(n/2)),a=Math.log2(i)%2==0,s=(this.fullscreenMaterial.uniforms.horizontal.value=r,this.fullscreenMaterial.uniforms.blurHorizontal.value=a,this.fullscreenMaterial.uniforms.stepSize.value=i,this.fullscreenMaterial.uniforms.isFirstIteration.value=0===n,this.fullscreenMaterial.uniforms.isLastIteration.value=n===2*this.iterations-1,a=r?this.renderTargetA:this.renderTargetB,0);s<this.textures.length;s++)this.fullscreenMaterial.uniforms["inputTexture"+s].value=(r?0===n?this.textures:this.renderTargetB.texture:this.renderTargetA.texture)[s];e.setRenderTarget(a),e.render(this.scene,this.camera)}}else"doDenoise"in this.fullscreenMaterial.defines&&(delete this.fullscreenMaterial.defines.doDenoise,this.fullscreenMaterial.needsUpdate=!0),e.setRenderTarget(this.renderTargetB),e.render(this.scene,this.camera),this.fullscreenMaterial.uniforms.denoiseKernel.value=t;for(var o=0;o<this.textures.length;o++)this.fullscreenMaterial.uniforms["inputTexture"+o].value=this.textures[o]}},{key:"texture",get:function(){return this.renderTargetB.texture[0]}}]),e}(),ql={fullAccumulate:!0,temporalReprojectCustomComposeShader:"#define GLSLIFY 1\nvec4 moment;if(!reset&&reprojectedUvDiffuse.x>=0.0){vec4 historyMoment=sampleReprojectedTexture(lastMomentTexture,reprojectedUvDiffuse);moment.r=luminance(gOutput[0].rgb);moment.g=moment.r*moment.r;\n#if textureCount > 1\nmoment.b=luminance(gOutput[1].rgb);moment.a=moment.b*moment.b;\n#endif\ngMoment=mix(moment,historyMoment,0.8);}else{moment.rg=vec2(0.,1000.);moment.ba=vec2(0.,1000.);gMoment=moment;return;}"},Xl=function(){function e(t,n,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:ql;return ml(this,e),(t=yl(this,e,[t,n,r,i,dl(dl({},ql),a)])).momentTexture=t.renderTarget.texture[0].clone(),t.momentTexture.isRenderTargetTexture=!0,t.momentTexture.type=or.FloatType,t.momentTexture.minFilter=or.NearestFilter,t.momentTexture.magFilter=or.NearestFilter,t.momentTexture.needsUpdate=!0,t.renderTarget.texture.push(t.momentTexture),n="\n\t\tlayout(location = ".concat(i,") out vec4 gMoment;\n\n\t\tuniform sampler2D lastMomentTexture;\n\t\t"),t.fullscreenMaterial.fragmentShader=n+t.fullscreenMaterial.fragmentShader,t.fullscreenMaterial.uniforms=dl(dl({},t.fullscreenMaterial.uniforms),{lastMomentTexture:new or.Uniform(null)}),r=i+1,(t.copyPass.setTextureCount(r),t.copyPass.fullscreenMaterial.uniforms["inputTexture"+(r-1)].value=t.momentTexture,a=t.copyPass.renderTarget.texture[r-1]).type=or.FloatType,a.minFilter=or.LinearFilter,a.magFilter=or.LinearFilter,a.needsUpdate=!0,t.fullscreenMaterial.uniforms.lastMomentTexture.value=a,t.fullscreenMaterial.defines.momentTextureCount=Math.min(2,i),t}return wl(e,Vl),vl(e)}(),Yl=function(){function e(t,n,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{};ml(this,e),this.svgfTemporalReprojectPass=new Xl(t,n,r,i,a),t=this.svgfTemporalReprojectPass.renderTarget.texture.slice(0,i),this.denoisePass=new Zl(n,t,a),this.denoisePass.setMomentTexture(this.svgfTemporalReprojectPass.momentTexture),this.setNonJitteredDepthTexture(r.depthTexture)}return vl(e,[{key:"texture",get:function(){return this.denoisePass.texture}},{key:"setGBuffers",value:function(e,t){this.setJitteredGBuffers(e,t),this.setNonJitteredGBuffers(e,t)}},{key:"setJitteredGBuffers",value:function(e,t){var n=void 0!==(n=(2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).useRoughnessInAlphaChannel)&&n;this.denoisePass.setDepthTexture(e),this.denoisePass.setNormalTexture(t,{useRoughnessInAlphaChannel:n})}},{key:"setNonJitteredDepthTexture",value:function(e){this.svgfTemporalReprojectPass.fullscreenMaterial.uniforms.depthTexture.value=e}},{key:"setVelocityTexture",value:function(e){this.svgfTemporalReprojectPass.fullscreenMaterial.uniforms.velocityTexture.value=e}},{key:"setSize",value:function(e,t){this.denoisePass.setSize(e,t),this.svgfTemporalReprojectPass.setSize(e,t)}},{key:"dispose",value:function(){this.denoisePass.dispose(),this.svgfTemporalReprojectPass.dispose()}},{key:"render",value:function(e){this.svgfTemporalReprojectPass.render(e),this.denoisePass.render(e)}}]),e}(),Ql=function(){function e(){var t;return ml(this,e),(t=yl(this,e,["CubeToEquirectEnvPass"])).renderTarget=new or.WebGLRenderTarget(1,1,{depthBuffer:!1,type:or.FloatType}),t.fullscreenMaterial=new or.ShaderMaterial({fragmentShader:"\n varying vec2 vUv;\n\t\t\tuniform samplerCube cubeMap;\n\n\t\t\t#define M_PI 3.1415926535897932384626433832795\n\t\t\t\n\t\t\t// source: https://github.com/spite/CubemapToEquirectangular/blob/master/src/CubemapToEquirectangular.js\n void main() {\n\t\t\t\tfloat longitude = vUv.x * 2. * M_PI - M_PI + M_PI / 2.;\n\t\t\t\tfloat latitude = vUv.y * M_PI;\n\n\t\t\t\tvec3 dir = vec3(\n\t\t\t\t\t- sin( longitude ) * sin( latitude ),\n\t\t\t\t\tcos( latitude ),\n\t\t\t\t\t- cos( longitude ) * sin( latitude )\n\t\t\t\t);\n\n\t\t\t\tdir.y = -dir.y;\n\n\t\t\t\tgl_FragColor = textureCube( cubeMap, dir );\n }\n ",vertexShader:Il,uniforms:{cubeMap:{value:null}},blending:or.NoBlending,depthWrite:!1,depthTest:!1,toneMapped:!1}),t}return wl(e,fs.Pass),vl(e,[{key:"dispose",value:function(){this.renderTarget.dispose()}},{key:"generateEquirectEnvMap",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:4096,a=(null===n&&null===r&&(a=t.source.data[0].width,n=Math.pow(2,Math.ceil(Math.log2(2*a*Math.pow(3,.5)))),r=Math.pow(2,Math.ceil(Math.log2(a*Math.pow(3,.5))))),i<n&&(r=(n=i)/2),this.renderTarget.setSize(n,r),this.fullscreenMaterial.uniforms.cubeMap.value=t,this.renderTarget);return e.setRenderTarget(a),e.render(this.scene,this.camera),i=new Float32Array(n*r*4),(e.readRenderTargetPixels(a,0,0,n,r,i),t=new or.DataTexture(i,n,r,or.RGBAFormat,or.FloatType)).wrapS=or.ClampToEdgeWrapping,t.wrapT=or.ClampToEdgeWrapping,t.minFilter=or.LinearMipMapLinearFilter,t.magFilter=or.LinearMipMapLinearFilter,t.needsUpdate=!0,t.mapping=or.EquirectangularReflectionMapping,t}}]),e}(),Jl=function(){function e(){var t;return ml(this,e),(t=yl(this,e,[{type:"MRTMaterial",defines:{USE_UV:"",TEMPORAL_RESOLVE:""},uniforms:{color:new or.Uniform(new or.Color),emissive:new or.Uniform(new or.Color),map:new or.Uniform(null),roughnessMap:new or.Uniform(null),metalnessMap:new or.Uniform(null),emissiveMap:new or.Uniform(null),alphaMap:new or.Uniform(null),normalMap:new or.Uniform(null),normalScale:new or.Uniform(new or.Vector2(1,1)),roughness:new or.Uniform(0),metalness:new or.Uniform(0),emissiveIntensity:new or.Uniform(0),uvTransform:new or.Uniform(new or.Matrix3),boneTexture:new or.Uniform(null),blueNoiseTexture:new or.Uniform(null),blueNoiseRepeat:new or.Uniform(new or.Vector2(1,1)),texSize:new or.Uniform(new or.Vector2(1,1)),frame:new or.Uniform(0)},vertexShader:"\n varying vec2 vHighPrecisionZW;\n\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n \n #include <common>\n #include <uv_pars_vertex>\n #include <displacementmap_pars_vertex>\n #include <normal_pars_vertex>\n #include <morphtarget_pars_vertex>\n #include <logdepthbuf_pars_vertex>\n #include <clipping_planes_pars_vertex>\n #include <skinning_pars_vertex>\n #include <color_pars_vertex>\n\n varying vec2 screenUv;\n\n void main() {\n #include <uv_vertex>\n \n #include <skinbase_vertex>\n #include <beginnormal_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n\n #include <morphnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n\n #include <skinning_vertex>\n\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n #include <color_vertex>\n \n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n vViewPosition = - mvPosition.xyz;\n #endif\n\n screenUv = gl_Position.xy * 0.5 + 0.5;\n\n vHighPrecisionZW = gl_Position.zw;\n }\n ",fragmentShader:"\n #define NORMAL\n #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n varying vec3 vViewPosition;\n #endif\n #include <packing>\n #include <uv_pars_fragment>\n #include <normal_pars_fragment>\n #include <bumpmap_pars_fragment>\n #include <normalmap_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n #include <color_pars_fragment>\n #include <alphamap_pars_fragment>\n \n layout(location = 0) out vec4 gDepth;\n layout(location = 1) out vec4 gNormal;\n layout(location = 2) out vec4 gDiffuse;\n layout(location = 3) out vec4 gEmissive;\n\n #include <map_pars_fragment>\n uniform vec3 color;\n\n varying vec2 vHighPrecisionZW;\n\n #include <metalnessmap_pars_fragment>\n uniform float metalness;\n\n #include <roughnessmap_pars_fragment>\n uniform float roughness;\n\n #include <emissivemap_pars_fragment>\n uniform vec3 emissive;\n uniform float emissiveIntensity;\n\n#ifdef USE_ALPHAMAP\n uniform sampler2D blueNoiseTexture;\n uniform vec2 blueNoiseRepeat;\n uniform vec2 texSize;\n uniform int frame;\n\n varying vec2 screenUv;\n\n const float g = 1.6180339887498948482;\n const float a1 = 1.0 / g;\n\n // reference: https://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/\n float r1(float n) {\n // 7th harmonious number\n return fract(1.1127756842787055 + a1 * n);\n }\n\n const vec4 hn = vec4(0.618033988749895, 0.3247179572447458, 0.2207440846057596, 0.1673039782614187);\n\n vec4 sampleBlueNoise(vec2 uv, int seed) {\n vec2 size = uv * texSize;\n vec2 blueNoiseSize = texSize / blueNoiseRepeat;\n float blueNoiseIndex = floor(floor(size.y / blueNoiseSize.y) * blueNoiseRepeat.x) + floor(size.x / blueNoiseSize.x);\n\n // get the offset of this pixel's blue noise tile\n int blueNoiseTileOffset = int(r1(blueNoiseIndex + 1.0) * 65536.);\n\n vec2 blueNoiseUv = uv * blueNoiseRepeat;\n\n // fetch blue noise for this pixel\n vec4 blueNoise = textureLod(blueNoiseTexture, blueNoiseUv, 0.);\n\n // animate blue noise\n blueNoise = fract(blueNoise + hn * float(seed + blueNoiseTileOffset));\n\n blueNoise.r = (blueNoise.r > 0.5 ? 1.0 - blueNoise.r : blueNoise.r) * 2.0;\n blueNoise.g = (blueNoise.g > 0.5 ? 1.0 - blueNoise.g : blueNoise.g) * 2.0;\n blueNoise.b = (blueNoise.b > 0.5 ? 1.0 - blueNoise.b : blueNoise.b) * 2.0;\n blueNoise.a = (blueNoise.a > 0.5 ? 1.0 - blueNoise.a : blueNoise.a) * 2.0;\n\n return blueNoise;\n }\n#endif\n\n void main() {\n // !todo: properly implement alpha hashing\n // #ifdef USE_ALPHAMAP\n // float alpha = textureLod( alphaMap, vUv, 0. ).g;\n\n // float alphaThreshold = sampleBlueNoise(screenUv, frame).a;\n // if(alpha < alphaThreshold){\n // discard;\n // return;\n // }metalnessnor\n // #endif\n\n //! todo: find better solution\n #define vMapUv vUv\n #define vMetalnessMapUv vUv\n #define vRoughnessMapUv vUv\n #define vNormalMapUv vUv\n #define vEmissiveMapUv vUv\n\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n\n float roughnessFactor = roughness;\n bool isDeselected = roughness > 10.0e9;\n \n if(isDeselected){\n roughnessFactor = 1.;\n gNormal = vec4(0.);\n }else{\n #ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = textureLod( roughnessMap, vUv, 0. );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n\n // roughness of 1.0 is reserved for deselected meshes\n roughnessFactor = min(0.99, roughnessFactor);\n\n vec3 worldNormal = normalize((vec4(normal, 1.) * viewMatrix).xyz);\n gNormal = vec4( worldNormal, roughnessFactor );\n }\n \n\n if(isDeselected){\n discard;\n return;\n }\n\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n vec4 depthColor = packDepthToRGBA( fragCoordZ );\n gDepth = depthColor;\n\n #include <metalnessmap_fragment>\n\n vec4 diffuseColor = vec4(color, metalnessFactor);\n\n #include <map_fragment>\n #include <color_fragment>\n\n gDiffuse = diffuseColor;\n\n vec3 totalEmissiveRadiance = emissive * emissiveIntensity;\n #include <emissivemap_fragment>\n \n gEmissive = vec4(totalEmissiveRadiance, 0.);\n }\n ",glslVersion:or.GLSL3,toneMapped:!1,alphaTest:!1,fog:!1,lights:!1}])).normalMapType=or.TangentSpaceNormalMap,t.normalScale=new or.Vector2(1,1),t}return wl(e,or.ShaderMaterial),vl(e)}(),$l="#define GLSLIFY 1\nconst float g=1.6180339887498948482;const float a1=1.0/g;float r1(float n){return fract(1.1127756842787055+a1*n);}const vec4 hn=vec4(0.618033988749895,0.3247179572447458,0.2207440846057596,0.1673039782614187);vec4 sampleBlueNoise(sampler2D texture,int seed,vec2 repeat,vec2 texSize){vec2 size=vUv*texSize;vec2 blueNoiseSize=texSize/repeat;float blueNoiseIndex=floor(floor(size.y/blueNoiseSize.y)*repeat.x)+floor(size.x/blueNoiseSize.x);vec2 blueNoiseUv=vUv*repeat;vec4 blueNoise=textureLod(texture,blueNoiseUv,0.);if(seed!=0){blueNoise=fract(blueNoise+hn*float(seed));blueNoise.r=(blueNoise.r>0.5 ? 1.0-blueNoise.r : blueNoise.r)*2.0;blueNoise.g=(blueNoise.g>0.5 ? 1.0-blueNoise.g : blueNoise.g)*2.0;blueNoise.b=(blueNoise.b>0.5 ? 1.0-blueNoise.b : blueNoise.b)*2.0;blueNoise.a=(blueNoise.a>0.5 ? 1.0-blueNoise.a : blueNoise.a)*2.0;}return blueNoise;}",eu=(Or=new Blob(["onmessage = "+function(e){var t,n,r=(e=e.data).width,i=e.height,a=e.isFloatType,s=e.flipY,o=e.data,l=function(){for(var e=new ArrayBuffer(4),t=new Float32Array(e),n=(e=new Uint32Array(e),new Uint32Array(512)),r=new Uint32Array(512),i=0;i<256;++i){var a=i-127;a<-27?(n[i]=0,n[256|i]=32768,r[i]=24,r[256|i]=24):a<-14?(n[i]=1024>>-a-14,n[256|i]=1024>>-a-14|32768,r[i]=-a-1,r[256|i]=-a-1):a<=15?(n[i]=15+a<<10,n[256|i]=15+a<<10|32768,r[i]=13,r[256|i]=13):a<128?(n[i]=31744,n[256|i]=64512,r[i]=24,r[256|i]=24):(n[i]=31744,n[256|i]=64512,r[i]=13,r[256|i]=13)}for(var s=new Uint32Array(2048),o=new Uint32Array(64),l=new Uint32Array(64),u=1;u<1024;++u){for(var c=u<<13,d=0;0==(8388608&c);)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[u]=c|d}for(var h=1024;h<2048;++h)s[h]=939524096+(h-1024<<13);for(var p=1;p<31;++p)o[p]=p<<23;o[31]=1199570944,o[32]=2147483648;for(var f=33;f<63;++f)o[f]=2147483648+(f-32<<23);o[63]=3347054592;for(var m=1;m<64;++m)32!==m&&(l[m]=1024);return{floatView:t,uint32View:e,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:l}}();function u(e,t){for(var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=n,i=n+(3<arguments.length&&void 0!==arguments[3]?arguments[3]:e.length)-1;r<i;){var a=r+i>>1;e[a]<t?r=1+a:i=a}return r-n}if(!a){var c,d=new Float32Array(o.length);for(c in o)d[c]=(n=(t=o[c])>>10,l.uint32View[0]=l.mantissaTable[l.offsetTable[n]+(1023&t)]+l.exponentTable[n],l.floatView[0]);o=d}e=new Float32Array(i);var h=new Float32Array(r*i);r=function(e,t,n,r,i,a){if(r)for(var s=0,o=n-1;s<=o;s++)for(var l=0,c=4*t;l<c;l+=4){var d=s*c+l,h=(o-s)*c+l;e[h]=e[d],e[h+1]=e[d+1],e[h+2]=e[d+2],e[h+3]=e[d+3]}for(var p=new Float32Array(t*n),f=new Float32Array(t*n),m=new Float32Array(n),g=new Float32Array(n),v=0,y=0,b=0;b<n;b++){for(var x=0,w=0;w<t;w++){var S=b*t+w,_=.2126*e[4*S+0]+.7152*e[4*S+1]+.0722*e[4*S+2];x+=_,v+=_,p[S]=_,f[S]=x}if(0!==x)for(var T=b*t,M=b*t+t;T<M;T++)p[T]/=x,f[T]/=x;y+=x,m[b]=x,g[b]=y}if(0!==y)for(var E=0,D=m.length;E<D;E++)m[E]/=y,g[E]/=y;for(var P=0;P<n;P++){var k=u(g,(P+1)/n);i[P]=(k+.5)/n}for(var O=0;O<n;O++)for(var A=0;A<t;A++){var C=O*t+A,N=u(f,(A+1)/t,O*t,t);a[C]=(N+.5)/t}return v}(o,r,i,s,e,h),a?postMessage({totalSumValue:r,marginalDataArray:e,conditionalDataArray:h}):postMessage({data:o,totalSumValue:r,marginalDataArray:e,conditionalDataArray:h})}],{type:"application/javascript"}),URL.createObjectURL(Or)),tu=function(){function e(){ml(this,e);var t=new or.DataTexture(new Float32Array([1,1,1,1]),1,1),n=(t.type=or.FloatType,t.format=or.RGBAFormat,t.minFilter=or.LinearFilter,t.magFilter=or.LinearFilter,t.wrapS=or.RepeatWrapping,t.wrapT=or.RepeatWrapping,t.generateMipmaps=!1,t.needsUpdate=!0,new or.DataTexture(new Float32Array([0,1]),1,2)),r=(n.type=or.FloatType,n.format=or.RedFormat,n.minFilter=or.LinearFilter,n.magFilter=or.LinearFilter,n.generateMipmaps=!1,n.needsUpdate=!0,new or.DataTexture(new Float32Array([0,0,1,1]),2,2));r.type=or.FloatType,r.format=or.RedFormat,r.minFilter=or.LinearFilter,r.magFilter=or.LinearFilter,r.generateMipmaps=!1,r.needsUpdate=!0,this.map=t,this.marginalWeights=n,this.conditionalWeights=r,this.totalSumWhole=1,this.totalSumDecimal=0,this.size=new or.Vector2}return vl(e,[{key:"dispose",value:function(){this.marginalWeights.dispose(),this.conditionalWeights.dispose(),this.map.dispose()}},{key:"updateFrom",value:function(e){var t=this,n=(e=e.clone()).image,r=n.width,i=n.height,a=n.data,s=e.type;return this.size.set(r,i),new Promise((function(n){var o;null!=(o=t.worker)&&o.terminate(),t.worker=new Worker(eu),t.worker.postMessage({width:r,height:i,isFloatType:s===or.FloatType,flipY:e.flipY,data:a}),t.worker.onmessage=function(a){var s=(a=a.data).data,o=a.totalSumValue,l=a.marginalDataArray,u=(a=a.conditionalDataArray,t.dispose(),t.marginalWeights),c=t.conditionalWeights;u=o-(u.image={width:i,height:1,data:l},u.needsUpdate=!0,c.image={width:r,height:i,data:a},c.needsUpdate=!0,l=~~o),t.totalSumWhole=l,t.totalSumDecimal=u,s&&(e.source=new or.Source(dl({},e.image)),e.image={width:r,height:i,data:s},e.type=or.FloatType),t.map=e,t.worker=null,n(e)}}))}}]),e}(),nu=function(){function e(){return ml(this,e),yl(this,e,[{type:"SSGIMaterial",uniforms:hl(hl(hl({directLightTexture:new or.Uniform(null),accumulatedTexture:new or.Uniform(null),normalTexture:new or.Uniform(null),depthTexture:new or.Uniform(null),diffuseTexture:new or.Uniform(null),emissiveTexture:new or.Uniform(null),velocityTexture:new or.Uniform(null),blueNoiseTexture:new or.Uniform(null),backSideDepthTexture:new or.Uniform(null),projectionMatrix:new or.Uniform(new or.Matrix4),inverseProjectionMatrix:new or.Uniform(new or.Matrix4),cameraMatrixWorld:new or.Uniform(new or.Matrix4),viewMatrix:new or.Uniform(new or.Matrix4),cameraNear:new or.Uniform(0),cameraFar:new or.Uniform(0),rayDistance:new or.Uniform(0),thickness:new or.Uniform(0),frame:new or.Uniform(0),envBlur:new or.Uniform(0),maxRoughness:new or.Uniform(0),maxEnvMapMipLevel:new or.Uniform(0),envMapInfo:{value:new tu},envMapPosition:new or.Uniform(new or.Vector3),envMapSize:new or.Uniform(new or.Vector3)},"viewMatrix",new or.Uniform(new or.Matrix4)),"texSize",new or.Uniform(new or.Vector2)),"blueNoiseRepeat",new or.Uniform(new or.Vector2)),defines:{steps:20,refineSteps:5,spp:1,directLightMultiplier:1,CUBEUV_TEXEL_WIDTH:0,CUBEUV_TEXEL_HEIGHT:0,CUBEUV_MAX_MIP:0,vWorldPosition:"worldPos"},fragmentShader:"#define GLSLIFY 1\n#if !defined(diffuseOnly) && !defined(specularOnly)\nlayout(location=0)out vec4 gDiffuse;layout(location=1)out vec4 gSpecular;\n#else\n#ifdef diffuseOnly\nlayout(location=0)out vec4 gDiffuse;\n#else\nlayout(location=0)out vec4 gSpecular;\n#endif\n#endif\nvarying vec2 vUv;uniform sampler2D directLightTexture;uniform sampler2D accumulatedTexture;uniform sampler2D normalTexture;uniform sampler2D depthTexture;uniform sampler2D diffuseTexture;uniform sampler2D emissiveTexture;uniform sampler2D blueNoiseTexture;uniform sampler2D velocityTexture;\n#ifdef autoThickness\nuniform sampler2D backSideDepthTexture;\n#endif\nuniform mat4 projectionMatrix;uniform mat4 inverseProjectionMatrix;uniform mat4 cameraMatrixWorld;uniform float cameraNear;uniform float cameraFar;uniform float maxEnvMapMipLevel;uniform float rayDistance;uniform float maxRoughness;uniform float thickness;uniform float envBlur;uniform int frame;uniform vec2 texSize;uniform vec2 blueNoiseRepeat;struct EquirectHdrInfo{sampler2D marginalWeights;sampler2D conditionalWeights;sampler2D map;vec2 size;float totalSumWhole;float totalSumDecimal;};uniform EquirectHdrInfo envMapInfo;\n#define INVALID_RAY_COORDS vec2(-1.0);\n#define EPSILON 0.00001\n#define ONE_MINUS_EPSILON 1.0 - EPSILON\nfloat nearMinusFar;float nearMulFar;float farMinusNear;vec2 invTexSize;\n#include <packing>\n#include <sampleBlueNoise>\n#include <ssgi_utils>\nvec2 RayMarch(inout vec3 dir,inout vec3 hitPos);vec2 BinarySearch(inout vec3 dir,inout vec3 hitPos);float fastGetViewZ(const float depth);vec3 doSample(const vec3 viewPos,const vec3 viewDir,const vec3 viewNormal,const vec3 worldPosition,const float metalness,const float roughness,const bool isDiffuseSample,const bool isEnvMisSample,const float NoV,const float NoL,const float NoH,const float LoH,const float VoH,const vec2 random,inout vec3 l,inout vec3 hitPos,out bool isMissedRay,out vec3 brdf,out float pdf);void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.0);if(dot(depthTexel.rgb,depthTexel.rgb)==0.){discard;return;}vec4 normalTexel=textureLod(normalTexture,vUv,0.0);float roughness=normalTexel.a;if(roughness==1.0||roughness>maxRoughness){discard;return;}invTexSize=1./texSize;roughness=clamp(roughness*roughness,0.0001,1.0);nearMinusFar=cameraNear-cameraFar;nearMulFar=cameraNear*cameraFar;farMinusNear=cameraFar-cameraNear;float unpackedDepth=unpackRGBAToDepth(depthTexel);float depth=fastGetViewZ(unpackedDepth);vec3 viewPos=getViewPosition(depth);vec3 viewDir=normalize(viewPos);vec3 worldNormal=normalTexel.xyz;vec3 viewNormal=normalize((vec4(worldNormal,0.)*cameraMatrixWorld).xyz);vec3 worldPos=vec4(vec4(viewPos,1.)*viewMatrix).xyz;vec4 diffuseTexel=textureLod(diffuseTexture,vUv,0.);vec3 diffuse=diffuseTexel.rgb;float metalness=diffuseTexel.a;vec3 n=viewNormal;vec3 v=-viewDir;float NoV=max(EPSILON,dot(n,v));vec3 V=(vec4(v,0.)*viewMatrix).xyz;vec3 N=worldNormal;vec4 blueNoise;vec3 H,l,h,F,T,B,envMisDir,gi;vec3 diffuseGI,specularGI,brdf,hitPos;Onb(N,T,B);V=ToLocal(T,B,N,V);vec3 f0=mix(vec3(0.04),diffuse,metalness);float NoL,NoH,LoH,VoH,diffW,specW,invW,pdf,envPdf,diffuseSamples,specularSamples,envMisProbability,envMisMultiplier;bool isDiffuseSample,isEnvMisSample,isMissedRay;int sampleCounter=0;\n#pragma unroll_loop_start\nfor(int i=0;i<spp;i++){blueNoise=sampleBlueNoise(blueNoiseTexture,frame+sampleCounter++,blueNoiseRepeat,texSize);H=SampleGGXVNDF(V,roughness,roughness,blueNoise.r,blueNoise.g);if(H.z<0.0)H=-H;l=normalize(reflect(-V,H));l=ToWorld(T,B,N,l);l=(vec4(l,0.)*cameraMatrixWorld).xyz;l=normalize(l);h=normalize(v+l);NoL=clamp(dot(n,l),EPSILON,ONE_MINUS_EPSILON);NoH=clamp(dot(n,h),EPSILON,ONE_MINUS_EPSILON);LoH=clamp(dot(l,h),EPSILON,ONE_MINUS_EPSILON);VoH=clamp(dot(v,h),EPSILON,ONE_MINUS_EPSILON);\n#if !defined(diffuseOnly) && !defined(specularOnly)\nF=F_Schlick(f0,VoH);diffW=(1.-metalness)*luminance(diffuse);specW=luminance(F);diffW=max(diffW,EPSILON);specW=max(specW,EPSILON);invW=1./(diffW+specW);diffW*=invW;specW*=invW;isDiffuseSample=blueNoise.b<diffW;\n#else\n#ifdef diffuseOnly\nisDiffuseSample=true;\n#else\nisDiffuseSample=false;\n#endif\n#endif\nenvMisDir=vec3(0.0);\n#ifdef importanceSampling\nenvPdf=sampleEquirectProbability(envMapInfo,blueNoise.rg,envMisDir);envMisDir=normalize((vec4(envMisDir,0.)*cameraMatrixWorld).xyz);envMisProbability=0.25+dot(envMisDir,viewNormal)*0.5;isEnvMisSample=blueNoise.a<envMisProbability;envMisMultiplier=1./(1.-envMisProbability);if(isEnvMisSample){envPdf/=1.-envMisProbability;}else{envPdf=0.0001;}\n#else\nenvPdf=0.0;envMisMultiplier=1.;\n#endif\nif(isDiffuseSample){if(isEnvMisSample){l=envMisDir;}else{l=cosineSampleHemisphere(viewNormal,blueNoise.rg);}h=normalize(v+l);NoL=clamp(dot(n,l),EPSILON,ONE_MINUS_EPSILON);NoH=clamp(dot(n,h),EPSILON,ONE_MINUS_EPSILON);LoH=clamp(dot(l,h),EPSILON,ONE_MINUS_EPSILON);VoH=clamp(dot(v,h),EPSILON,ONE_MINUS_EPSILON);gi=doSample(viewPos,viewDir,viewNormal,worldPos,metalness,roughness,isDiffuseSample,isEnvMisSample,NoV,NoL,NoH,LoH,VoH,blueNoise.rg,l,hitPos,isMissedRay,brdf,pdf);gi*=brdf;if(isEnvMisSample){gi*=misHeuristic(envPdf,pdf);gi/=envPdf;}else{gi/=pdf;gi*=envMisMultiplier;}diffuseSamples++;diffuseGI=mix(diffuseGI,gi,1./diffuseSamples);}else{isEnvMisSample=isEnvMisSample&&roughness>=0.025;if(isEnvMisSample){l=envMisDir;h=normalize(v+l);NoL=clamp(dot(n,l),EPSILON,ONE_MINUS_EPSILON);NoH=clamp(dot(n,h),EPSILON,ONE_MINUS_EPSILON);LoH=clamp(dot(l,h),EPSILON,ONE_MINUS_EPSILON);VoH=clamp(dot(v,h),EPSILON,ONE_MINUS_EPSILON);}gi=doSample(viewPos,viewDir,viewNormal,worldPos,metalness,roughness,isDiffuseSample,isEnvMisSample,NoV,NoL,NoH,LoH,VoH,blueNoise.rg,l,hitPos,isMissedRay,brdf,pdf);gi*=brdf;if(isEnvMisSample){gi*=misHeuristic(envPdf,pdf);gi/=envPdf;}else{gi/=pdf;gi*=envMisMultiplier;}specularSamples++;specularGI=mix(specularGI,gi,1./specularSamples);}}\n#pragma unroll_loop_end\nroughness=sqrt(roughness);\n#ifndef specularOnly\nif(diffuseSamples==0.0)diffuseGI=vec3(-1.0);gDiffuse=vec4(diffuseGI,roughness);\n#endif\n#ifndef diffuseOnly\nfloat rayLength=0.0;if(!isMissedRay&&roughness<0.375&&getCurvature(viewNormal,depth)<0.0005){vec3 hitPosWS=(vec4(hitPos,1.)*viewMatrix).xyz;rayLength=distance(worldPos,hitPosWS);}if(specularSamples==0.0)specularGI=vec3(-1.0);gSpecular=vec4(specularGI,rayLength);\n#endif\n}vec3 doSample(const vec3 viewPos,const vec3 viewDir,const vec3 viewNormal,const vec3 worldPosition,const float metalness,const float roughness,const bool isDiffuseSample,const bool isEnvMisSample,const float NoV,const float NoL,const float NoH,const float LoH,const float VoH,const vec2 random,inout vec3 l,inout vec3 hitPos,out bool isMissedRay,out vec3 brdf,out float pdf){float cosTheta=max(0.0,dot(viewNormal,l));if(isDiffuseSample){vec3 diffuseBrdf=vec3(evalDisneyDiffuse(NoL,NoV,LoH,roughness,metalness));pdf=NoL/M_PI;pdf=max(EPSILON,pdf);brdf=diffuseBrdf;}else{vec3 specularBrdf=evalDisneySpecular(roughness,NoH,NoV,NoL);pdf=GGXVNDFPdf(NoH,NoV,roughness);pdf=max(EPSILON,pdf);brdf=specularBrdf;}brdf*=cosTheta;hitPos=viewPos;\n#if steps == 0\nhitPos+=l;vec2 coords=viewSpaceToScreenSpace(hitPos);\n#else\nvec2 coords=RayMarch(l,hitPos);\n#endif\nbool allowMissedRays=false;\n#ifdef missedRays\nallowMissedRays=true;\n#endif\nisMissedRay=coords.x==-1.0;vec3 envMapSample=vec3(0.);if(isMissedRay||allowMissedRays){\n#ifdef USE_ENVMAP\nvec3 reflectedWS=normalize((vec4(l,0.)*viewMatrix).xyz);\n#ifdef BOX_PROJECTED_ENV_MAP\nreflectedWS=parallaxCorrectNormal(reflectedWS.xyz,envMapSize,envMapPosition,worldPosition);reflectedWS=normalize(reflectedWS.xyz);\n#endif\nfloat mip=envBlur*maxEnvMapMipLevel;if(!isDiffuseSample&&roughness<0.15)mip*=roughness/0.15;envMapSample=sampleEquirectEnvMapColor(reflectedWS,envMapInfo.map,mip);float maxEnvLum=isEnvMisSample ? 50.0 : 5.0;if(maxEnvLum!=0.0){float envLum=luminance(envMapSample);if(envLum>maxEnvLum){envMapSample*=maxEnvLum/envLum;}}return envMapSample;\n#else\nreturn vec3(0.0);\n#endif\n}vec4 velocity=textureLod(velocityTexture,coords.xy,0.0);vec2 reprojectedUv=coords.xy-velocity.xy;vec3 SSGI;if(reprojectedUv.x>=0.0&&reprojectedUv.x<=1.0&&reprojectedUv.y>=0.0&&reprojectedUv.y<=1.0){vec4 emissiveTexel=textureLod(emissiveTexture,coords.xy,0.);vec3 emissiveColor=emissiveTexel.rgb*10.;vec3 reprojectedGI=getTexel(accumulatedTexture,reprojectedUv,0.).rgb;SSGI=reprojectedGI+emissiveColor;\n#ifdef useDirectLight\nSSGI+=textureLod(directLightTexture,coords.xy,0.).rgb*directLightMultiplier;\n#endif\n}else{SSGI=textureLod(directLightTexture,vUv,0.).rgb;}if(allowMissedRays){float ssgiLum=luminance(SSGI);float envLum=luminance(envMapSample);if(envLum>ssgiLum)SSGI=envMapSample;}return SSGI;}vec2 RayMarch(inout vec3 dir,inout vec3 hitPos){float rayHitDepthDifference;dir*=rayDistance/float(steps);vec2 uv;for(int i=1;i<steps;i++){float m=exp(pow(float(i)/4.0,0.05))-2.0;hitPos+=dir*min(m,1.);if(hitPos.z>0.0)return INVALID_RAY_COORDS;uv=viewSpaceToScreenSpace(hitPos);\n#ifndef missedRays\nif(uv.x<0.||uv.y<0.||uv.x>1.||uv.y>1.)return INVALID_RAY_COORDS;\n#endif\nfloat unpackedDepth=unpackRGBAToDepth(textureLod(depthTexture,uv,0.0));float depth=fastGetViewZ(unpackedDepth);\n#ifdef autoThickness\nfloat unpackedBackSideDepth=unpackRGBAToDepth(textureLod(backSideDepthTexture,uv,0.0));float backSideDepth=fastGetViewZ(unpackedBackSideDepth);float currentThickness=max(abs(depth-backSideDepth),thickness);\n#else\nfloat currentThickness=thickness;\n#endif\nrayHitDepthDifference=depth-hitPos.z;if(rayHitDepthDifference>=0.0&&rayHitDepthDifference<currentThickness){\n#if refineSteps == 0\nreturn uv;\n#else\nreturn BinarySearch(dir,hitPos);\n#endif\n}}\n#ifndef missedRays\nreturn INVALID_RAY_COORDS;\n#endif\nreturn uv;}vec2 BinarySearch(inout vec3 dir,inout vec3 hitPos){float rayHitDepthDifference;vec2 uv;dir*=0.5;hitPos-=dir;for(int i=0;i<refineSteps;i++){uv=viewSpaceToScreenSpace(hitPos);float unpackedDepth=unpackRGBAToDepth(textureLod(depthTexture,uv,0.0));float depth=fastGetViewZ(unpackedDepth);rayHitDepthDifference=depth-hitPos.z;dir*=0.5;hitPos+=rayHitDepthDifference>0.0 ?-dir : dir;}uv=viewSpaceToScreenSpace(hitPos);return uv;}float fastGetViewZ(const float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn nearMulFar/(farMinusNear*depth-cameraFar);\n#else\nreturn depth*nearMinusFar-cameraNear;\n#endif\n}".replace("#include <ssgi_utils>","#define GLSLIFY 1\n#define PI M_PI\n#define luminance(a) dot(vec3(0.2125, 0.7154, 0.0721), a)\nvec4 getTexel(const sampler2D tex,vec2 p,const float mip){p=p/invTexSize+0.5;vec2 i=floor(p);vec2 f=p-i;f=f*f*f*(f*(f*6.0-15.0)+10.0);p=i+f;p=(p-0.5)*invTexSize;return textureLod(tex,p,mip);}float getViewZ(const float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}\n#ifdef PERSPECTIVE_CAMERA\nvec3 getViewPosition(const float depth){float clipW=projectionMatrix[2][3]*depth+projectionMatrix[3][3];vec4 clipPosition=vec4((vec3(vUv,depth)-0.5)*2.0,1.0);clipPosition*=clipW;return(inverseProjectionMatrix*clipPosition).xyz;}\n#else\nvec3 getViewPosition(const float depth){float z=getViewZ(depth);vec4 clipPosition=vec4(vUv*2.0-1.0,z,1.0);clipPosition*=clipPosition.z;return(inverseProjectionMatrix*clipPosition).xyz;}\n#endif\nvec2 viewSpaceToScreenSpace(const vec3 position){vec4 projectedCoord=projectionMatrix*vec4(position,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=projectedCoord.xy*0.5+0.5;return projectedCoord.xy;}\n#ifdef BOX_PROJECTED_ENV_MAP\nuniform vec3 envMapSize;uniform vec3 envMapPosition;vec3 parallaxCorrectNormal(const vec3 v,const vec3 cubeSize,const vec3 cubePos,const vec3 worldPosition){vec3 nDir=normalize(v);vec3 rbmax=(.5*cubeSize+cubePos-worldPosition)/nDir;vec3 rbmin=(-.5*cubeSize+cubePos-worldPosition)/nDir;vec3 rbminmax;rbminmax.x=(nDir.x>0.)? rbmax.x : rbmin.x;rbminmax.y=(nDir.y>0.)? rbmax.y : rbmin.y;rbminmax.z=(nDir.z>0.)? rbmax.z : rbmin.z;float correction=min(min(rbminmax.x,rbminmax.y),rbminmax.z);vec3 boxIntersection=worldPosition+nDir*correction;return boxIntersection-cubePos;}\n#endif\n#define M_PI 3.1415926535897932384626433832795\nvec2 equirectDirectionToUv(const vec3 direction){vec2 uv=vec2(atan(direction.z,direction.x),acos(direction.y));uv/=vec2(2.0*M_PI,M_PI);uv.x+=0.5;uv.y=1.0-uv.y;return uv;}vec3 equirectUvToDirection(vec2 uv){uv.x-=0.5;uv.y=1.0-uv.y;float theta=uv.x*2.0*PI;float phi=uv.y*PI;float sinPhi=sin(phi);return vec3(sinPhi*cos(theta),cos(phi),sinPhi*sin(theta));}vec3 sampleEquirectEnvMapColor(const vec3 direction,const sampler2D map,const float lod){return getTexel(map,equirectDirectionToUv(direction),lod).rgb;}mat3 getBasisFromNormal(const vec3 normal){vec3 other;if(abs(normal.x)>0.5){other=vec3(0.0,1.0,0.0);}else{other=vec3(1.0,0.0,0.0);}vec3 ortho=normalize(cross(normal,other));vec3 ortho2=normalize(cross(normal,ortho));return mat3(ortho2,ortho,normal);}vec3 F_Schlick(const vec3 f0,const float theta){return f0+(1.-f0)*pow(1.0-theta,5.);}float F_Schlick(const float f0,const float f90,const float theta){return f0+(f90-f0)*pow(1.0-theta,5.0);}float D_GTR(const float roughness,const float NoH,const float k){float a2=pow(roughness,2.);return a2/(PI*pow((NoH*NoH)*(a2*a2-1.)+1.,k));}float SmithG(const float NDotV,const float alphaG){float a=alphaG*alphaG;float b=NDotV*NDotV;return(2.0*NDotV)/(NDotV+sqrt(a+b-a*b));}float GGXVNDFPdf(const float NoH,const float NoV,const float roughness){float D=D_GTR(roughness,NoH,2.);float G1=SmithG(NoV,roughness*roughness);return(D*G1)/max(0.00001,4.0f*NoV);}float GeometryTerm(const float NoL,const float NoV,const float roughness){float a2=roughness*roughness;float G1=SmithG(NoV,a2);float G2=SmithG(NoL,a2);return G1*G2;}float evalDisneyDiffuse(const float NoL,const float NoV,const float LoH,const float roughness,const float metalness){float FD90=0.5+2.*roughness*pow(LoH,2.);float a=F_Schlick(1.,FD90,NoL);float b=F_Schlick(1.,FD90,NoV);return(a*b/PI)*(1.-metalness);}vec3 evalDisneySpecular(const float roughness,const float NoH,const float NoV,const float NoL){float D=D_GTR(roughness,NoH,2.);float G=GeometryTerm(NoL,NoV,pow(0.5+roughness*.5,2.));vec3 spec=vec3(D*G/(4.*NoL*NoV));return spec;}vec3 SampleGGXVNDF(const vec3 V,const float ax,const float ay,const float r1,const float r2){vec3 Vh=normalize(vec3(ax*V.x,ay*V.y,V.z));float lensq=Vh.x*Vh.x+Vh.y*Vh.y;vec3 T1=lensq>0. ? vec3(-Vh.y,Vh.x,0.)*inversesqrt(lensq): vec3(1.,0.,0.);vec3 T2=cross(Vh,T1);float r=sqrt(r1);float phi=2.0*PI*r2;float t1=r*cos(phi);float t2=r*sin(phi);float s=0.5*(1.0+Vh.z);t2=(1.0-s)*sqrt(1.0-t1*t1)+s*t2;vec3 Nh=t1*T1+t2*T2+sqrt(max(0.0,1.0-t1*t1-t2*t2))*Vh;return normalize(vec3(ax*Nh.x,ay*Nh.y,max(0.0,Nh.z)));}void Onb(const vec3 N,inout vec3 T,inout vec3 B){vec3 up=abs(N.z)<0.9999999 ? vec3(0,0,1): vec3(1,0,0);T=normalize(cross(up,N));B=cross(N,T);}vec3 ToLocal(const vec3 X,const vec3 Y,const vec3 Z,const vec3 V){return vec3(dot(V,X),dot(V,Y),dot(V,Z));}vec3 ToWorld(const vec3 X,const vec3 Y,const vec3 Z,const vec3 V){return V.x*X+V.y*Y+V.z*Z;}vec3 cosineSampleHemisphere(const vec3 n,const vec2 u){float r=sqrt(u.x);float theta=2.0*PI*u.y;vec3 b=normalize(cross(n,vec3(0.0,1.0,1.0)));vec3 t=cross(b,n);return normalize(r*sin(theta)*b+sqrt(1.0-u.x)*n+r*cos(theta)*t);}float equirectDirectionPdf(vec3 direction){vec2 uv=equirectDirectionToUv(direction);float theta=uv.y*PI;float sinTheta=sin(theta);if(sinTheta==0.0){return 0.0;}return 1.0/(2.0*PI*PI*sinTheta);}float sampleEquirectProbability(EquirectHdrInfo info,vec2 r,out vec3 direction){float v=textureLod(info.marginalWeights,vec2(r.x,0.0),0.).x;float u=textureLod(info.conditionalWeights,vec2(r.y,v),0.).x;vec2 uv=vec2(u,v);vec3 derivedDirection=equirectUvToDirection(uv);direction=derivedDirection;vec3 color=texture(info.map,uv).rgb;float totalSum=info.totalSumWhole+info.totalSumDecimal;float lum=luminance(color);float pdf=lum/totalSum;return info.size.x*info.size.y*pdf;}float misHeuristic(float a,float b){float aa=a*a;float bb=b*b;return aa/(aa+bb);}float getCurvature(const vec3 n,const float depth){vec3 dx=dFdx(n);vec3 dy=dFdy(n);vec3 xneg=n-dx;vec3 xpos=n+dx;vec3 yneg=n-dy;vec3 ypos=n+dy;float curvature=(cross(xneg,xpos).y-cross(yneg,ypos).x)*4.0/depth;return curvature;}").replace("#include <sampleBlueNoise>",$l),vertexShader:Il,blending:or.NoBlending,depthWrite:!1,depthTest:!1,toneMapped:!1,glslVersion:or.GLSL3}])}return wl(e,or.ShaderMaterial),vl(e)}(),ru=new or.Color(0),iu=new or.MeshDepthMaterial({depthPacking:or.RGBADepthPacking,side:or.BackSide}),au=function(){function e(t,n){var r;return ml(this,e),(r=yl(this,e,["BackSideDepthPass"]))._scene=t,r._camera=n,r.renderTarget=new or.WebGLRenderTarget(1,1,{minFilter:or.NearestFilter,magFilter:or.NearestFilter}),r}return wl(e,fs.Pass),vl(e,[{key:"setSize",value:function(e,t){this.renderTarget.setSize(e,t)}},{key:"dispose",value:function(){pl(xl(e.prototype),"dispose",this).call(this),this.renderTarget.dispose()}},{key:"render",value:function(e){var t=this._scene.background;this._scene.background=ru,this._scene.overrideMaterial=iu,e.setRenderTarget(this.renderTarget),e.render(this._scene,this._camera),this._scene.background=t,this._scene.overrideMaterial=null}}]),e}(),su="data:image/png;base64,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",ou=new or.Color(0),lu=function(){function e(t,n){ml(this,e),(r=yl(this,e,["SSGIPass"])).needsSwap=!1,r.defaultFragmentShader="",r.frame=0,r.cachedMaterials=new WeakMap,r.visibleMeshes=[],r.ssgiEffect=t,r._scene=t._scene,r._camera=t._camera,r.fullscreenMaterial=new nu,r.defaultFragmentShader=r.fullscreenMaterial.fragmentShader;var r,i=n.diffuseOnly||n.specularOnly?1:2;return r.renderTarget=new or.WebGLMultipleRenderTargets(1,1,i,{type:or.HalfFloatType,depthBuffer:!1}),r.fullscreenMaterial.uniforms.cameraMatrixWorld.value=r._camera.matrixWorld,r.fullscreenMaterial.uniforms.viewMatrix.value=r._camera.matrixWorldInverse,r.fullscreenMaterial.uniforms.projectionMatrix.value=r._camera.projectionMatrix,r.fullscreenMaterial.uniforms.inverseProjectionMatrix.value=r._camera.projectionMatrixInverse,t._camera.isPerspectiveCamera&&(r.fullscreenMaterial.defines.PERSPECTIVE_CAMERA=""),n.diffuseOnly&&(r.fullscreenMaterial.defines.diffuseOnly=""),n.specularOnly&&(r.fullscreenMaterial.defines.specularOnly=""),r.initMRTRenderTarget(),r}return wl(e,fs.Pass),vl(e,[{key:"initialize",value:function(t){for(var n,r=this,i=arguments.length,a=new Array(1<i?i-1:0),s=1;s<i;s++)a[s-1]=arguments[s];(n=pl(xl(e.prototype),"initialize",this)).call.apply(n,[this,t].concat(a)),(new or.TextureLoader).load(su,(function(e){e.minFilter=or.NearestFilter,e.magFilter=or.NearestFilter,e.wrapS=or.RepeatWrapping,e.wrapT=or.RepeatWrapping,e.colorSpace=or.NoColorSpace,r.fullscreenMaterial.uniforms.blueNoiseTexture.value=e}))}},{key:"texture",get:function(){return this.renderTarget.texture[0]}},{key:"specularTexture",get:function(){var e="specularOnly"in this.fullscreenMaterial.defines?0:1;return this.renderTarget.texture[e]}},{key:"initMRTRenderTarget",value:function(){this.gBuffersRenderTarget=new or.WebGLMultipleRenderTargets(1,1,4,{minFilter:or.NearestFilter,magFilter:or.NearestFilter}),this.gBuffersRenderTarget.depthTexture=new or.DepthTexture(1,1),this.gBuffersRenderTarget.depthTexture.type=or.FloatType,this.backSideDepthPass=new au(this._scene,this._camera),this.depthTexture=this.gBuffersRenderTarget.texture[0],this.normalTexture=this.gBuffersRenderTarget.texture[1],this.diffuseTexture=this.gBuffersRenderTarget.texture[2],this.emissiveTexture=this.gBuffersRenderTarget.texture[3],this.diffuseTexture.minFilter=or.LinearFilter,this.diffuseTexture.magFilter=or.LinearFilter,this.diffuseTexture.colorSpace=or.SRGBColorSpace,this.diffuseTexture.needsUpdate=!0,this.emissiveTexture.minFilter=or.LinearFilter,this.emissiveTexture.magFilter=or.LinearFilter,this.emissiveTexture.type=or.HalfFloatType,this.emissiveTexture.needsUpdate=!0,this.normalTexture.type=or.HalfFloatType,this.normalTexture.needsUpdate=!0,this.fullscreenMaterial.uniforms.normalTexture.value=this.normalTexture,this.fullscreenMaterial.uniforms.depthTexture.value=this.depthTexture,this.fullscreenMaterial.uniforms.diffuseTexture.value=this.diffuseTexture,this.fullscreenMaterial.uniforms.emissiveTexture.value=this.emissiveTexture,this.fullscreenMaterial.uniforms.backSideDepthTexture.value=this.backSideDepthPass.renderTarget.texture}},{key:"setSize",value:function(e,t){this.renderTarget.setSize(e*this.ssgiEffect.resolutionScale,t*this.ssgiEffect.resolutionScale),this.gBuffersRenderTarget.setSize(e,t),this.backSideDepthPass.setSize(e,t),this.fullscreenMaterial.uniforms.texSize.value.set(this.renderTarget.width,this.renderTarget.height)}},{key:"dispose",value:function(){pl(xl(e.prototype),"dispose",this).call(this),this.renderTarget.dispose(),this.gBuffersRenderTarget.dispose(),this.backSideDepthPass.dispose(),this.fullscreenMaterial.dispose(),this.normalTexture=null,this.depthTexture=null,this.diffuseTexture=null,this.emissiveTexture=null}},{key:"setMRTMaterialInScene",value:function(){var e,t=this,n=(this.visibleMeshes=El(this._scene),_l(this.visibleMeshes));try{var r,i,a,s;for(n.s();!(e=n.n()).done;)!function(){var n,o,l=e.value,u=l.material,c=(d=fl(t.cachedMaterials.get(l)||[],2))[0],d=d[1];u!==c&&(d&&d.dispose(),d=new Jl,Cl(u,d),d.uniforms.normalScale.value=u.normalScale,null!=(s=l.skeleton)&&s.boneTexture&&(d.defines.USE_SKINNING="",d.defines.BONE_TEXTURE="",d.uniforms.boneTexture.value=l.skeleton.boneTexture,d.needsUpdate=!0),(c=Object.keys(u).find((function(e){return(e=u[e])instanceof or.Texture&&e.matrix})))&&(d.uniforms.uvTransform.value=u[c].matrix),t.cachedMaterials.set(l,[u,d])),u.emissive&&(d.uniforms.emissive.value=u.emissive),u.color&&(d.uniforms.color.value=u.color),Dl(d,u,"normalMap","USE_NORMALMAP",!0),Dl(d,u,"roughnessMap","USE_ROUGHNESSMAP",!0),Dl(d,u,"metalnessMap","USE_\tMETALNESSMAP",!0),Dl(d,u,"map","USE_MAP",!0),Dl(d,u,"emissiveMap","USE_EMISSIVEMAP",!0),Dl(d,u,"alphaMap","USE_ALPHAMAP",!0),(c=t.fullscreenMaterial.uniforms.blueNoiseTexture.value)&&(n=(o=c.source.data).width,o=o.height,d.uniforms.blueNoiseTexture.value=c,d.uniforms.blueNoiseRepeat.value.set(t.renderTarget.width/n,t.renderTarget.height/o)),d.uniforms.texSize.value.set(t.renderTarget.width,t.renderTarget.height),d.uniforms.frame.value=t.frame,l.visible=Al(l,u),c=null!=(r=u.roughness)?r:1,d.uniforms.roughness.value=0===t.ssgiEffect.selection.size||t.ssgiEffect.selection.has(l)?c:1e11,d.uniforms.metalness.value=null!=(i=l.material.metalness)?i:0,d.uniforms.emissiveIntensity.value=null!=(a=l.material.emissiveIntensity)?a:0,l.material=d}()}catch(e){n.e(e)}finally{n.f()}}},{key:"unsetMRTMaterialInScene",value:function(){var e,t=_l(this.visibleMeshes);try{for(t.s();!(e=t.n()).done;){var n=e.value;n.visible=!0;var r=fl(this.cachedMaterials.get(n),1)[0];n.material=r}}catch(e){t.e(e)}finally{t.f()}}},{key:"render",value:function(e){this.frame=(this.frame+this.ssgiEffect.spp)%65536;var t,n=this._scene.background,r=(this._scene.background=ou,this.setMRTMaterialInScene(),e.setRenderTarget(this.gBuffersRenderTarget),e.render(this._scene,this._camera),this.unsetMRTMaterialInScene(),this.ssgiEffect.autoThickness&&this.backSideDepthPass.render(e),this.fullscreenMaterial.uniforms.frame.value=this.frame,this.fullscreenMaterial.uniforms.cameraNear.value=this._camera.near,this.fullscreenMaterial.uniforms.cameraFar.value=this._camera.far,this.fullscreenMaterial.uniforms.viewMatrix.value.copy(this._camera.matrixWorldInverse),this.fullscreenMaterial.uniforms.accumulatedTexture.value=this.ssgiEffect.svgf.denoisePass.texture,this.fullscreenMaterial.uniforms.blueNoiseTexture.value);r&&(t=(r=r.source.data).width,r=r.height,this.fullscreenMaterial.uniforms.blueNoiseRepeat.value.set(this.renderTarget.width/t,this.renderTarget.height/r)),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera),this._scene.background=n}}]),e}(),uu={distance:10,thickness:10,autoThickness:!1,maxRoughness:1,blend:.9,denoiseIterations:1,denoiseKernel:2,denoiseDiffuse:10,denoiseSpecular:10,depthPhi:2,normalPhi:50,roughnessPhi:1,envBlur:.5,importanceSampling:!0,directLightMultiplier:1,steps:20,refineSteps:5,spp:1,resolutionScale:1,missedRays:!1},cu=fs.RenderPass.prototype.render,du=function(){if(or.ShaderChunk.envmap_physical_pars_fragment.includes("iblIrradianceDisabled")||(or.ShaderChunk.envmap_physical_pars_fragment=or.ShaderChunk.envmap_physical_pars_fragment.replace("vec3 getIBLIrradiance( const in vec3 normal ) {","\n\t\t\tuniform bool iblIrradianceDisabled;\n\t\t\n\t\t\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t\t if(iblIrradianceDisabled) return vec3(0.);\n\t\t\t")),"iblIrradianceDisabled"in or.ShaderLib.physical.uniforms)return or.ShaderLib.physical.uniforms.iblIrradianceDisabled;var e={value:!1},t=(or.ShaderLib.physical.uniforms.iblIrradianceDisabled=e,or.UniformsUtils.clone);return or.UniformsUtils.clone=function(n){var r=t(n);return"iblIrradianceDisabled"in n&&(r.iblIrradianceDisabled=e),r},e}(),hu=function(){if(or.ShaderChunk.envmap_physical_pars_fragment.includes("iblRadianceDisabled")||(or.ShaderChunk.envmap_physical_pars_fragment=or.ShaderChunk.envmap_physical_pars_fragment.replace("vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {","\n\t\tuniform bool iblRadianceDisabled;\n\t\n\t\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t if(iblRadianceDisabled) return vec3(0.);\n\t\t")),"iblRadianceDisabled"in or.ShaderLib.physical.uniforms)return or.ShaderLib.physical.uniforms.iblRadianceDisabled;var e={value:!1},t=(or.ShaderLib.physical.uniforms.iblRadianceDisabled=e,or.UniformsUtils.clone);return or.UniformsUtils.clone=function(n){var r=t(n);return"iblRadianceDisabled"in n&&(r.iblRadianceDisabled=e),r},e}();Cr=function(){function e(t,n,r){var i,a,s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:uu;if(ml(this,e),s=dl(dl({},uu),s),(i=yl(this,e,["SSGIEffect","#define GLSLIFY 1\nuniform sampler2D inputTexture;uniform sampler2D sceneTexture;uniform sampler2D depthTexture;uniform int toneMapping;\n#include <tonemapping_pars_fragment>\n#pragma tonemapping_pars_fragment\nvoid mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 depthTexel=textureLod(depthTexture,uv,0.);vec3 ssgiClr;if(dot(depthTexel.rgb,depthTexel.rgb)==0.){ssgiClr=textureLod(sceneTexture,uv,0.).rgb;}else{ssgiClr=textureLod(inputTexture,uv,0.).rgb;switch(toneMapping){case 1:ssgiClr=LinearToneMapping(ssgiClr);break;case 2:ssgiClr=ReinhardToneMapping(ssgiClr);break;case 3:ssgiClr=OptimizedCineonToneMapping(ssgiClr);break;case 4:ssgiClr=ACESFilmicToneMapping(ssgiClr);break;case 5:ssgiClr=CustomToneMapping(ssgiClr);break;}ssgiClr*=toneMappingExposure;}outputColor=vec4(ssgiClr,1.0);}",{type:"FinalSSGIMaterial",uniforms:new Map([["inputTexture",new or.Uniform(null)],["sceneTexture",new or.Uniform(null)],["depthTexture",new or.Uniform(null)],["toneMapping",new or.Uniform(or.NoToneMapping)]])}])).selection=new fs.Selection,i.isUsingRenderPass=!0,!(n instanceof or.PerspectiveCamera))throw new Error(i.constructor.name+" doesn't support cameras of type '"+n.constructor.name+"' yet. Only cameras of type 'PerspectiveCamera' are supported.");i._scene=t,i._camera=n,s.diffuseOnly?(s.reprojectSpecular=!(a="ssdgi"),s.roughnessDependent=!1,s.basicVariance=25e-5,s.neighborhoodClamp=!1):s.specularOnly?(a="ssr",s.reprojectSpecular=!0,s.roughnessDependent=!0,s.basicVariance=25e-5,s.neighborhoodClamp=!0):(s.reprojectSpecular=[!(a="ssgi"),!0],s.neighborhoodClamp=[!1,!0],s.roughnessDependent=[!1,!0],s.basicVariance=[25e-5,25e-5]),s.neighborhoodClampRadius=2,s.neighborhoodClampIntensity=.5;var o=s.diffuseOnly||s.specularOnly?1:2,l=(s=dl(dl({},s),{denoiseCustomComposeShader:"#define GLSLIFY 1\nvec3 viewNormal=(vec4(normal,0.)*cameraMatrixWorld).xyz;roughness*=roughness;vec3 viewPos=getViewPosition(depth);vec3 viewDir=normalize(viewPos);vec3 T,B;vec3 n=viewNormal;vec3 v=viewDir;vec3 V=(vec4(v,0.)*viewMatrix).xyz;vec3 N=normal;Onb(N,T,B);V=ToLocal(T,B,N,V);vec3 H=SampleGGXVNDF(V,roughness,roughness,0.25,0.25);if(H.z<0.0)H=-H;vec3 l=normalize(reflect(-V,H));l=ToWorld(T,B,N,l);l=(vec4(l,1.)*cameraMatrixWorld).xyz;l=normalize(l);if(dot(viewNormal,l)<0.)l=-l;vec3 h=normalize(v+l);float VoH=max(EPSILON,dot(v,h));VoH=pow(VoH,0.875);vec4 diffuseTexel=textureLod(diffuseTexture,vUv,0.);vec3 diffuse=diffuseTexel.rgb;float metalness=diffuseTexel.a;vec3 f0=mix(vec3(0.04),diffuse,metalness);vec3 F=F_Schlick(f0,VoH);vec3 directLight=textureLod(directLightTexture,vUv,0.).rgb;\n#ifdef ssgi\nvec3 diffuseLightingColor=denoisedColor[0];vec3 diffuseComponent=diffuse*(1.-metalness)*(1.-F)*diffuseLightingColor;vec3 specularLightingColor=denoisedColor[1];vec3 specularComponent=specularLightingColor*F;denoisedColor[0]=diffuseComponent+specularComponent;\n#endif\n#ifdef ssdgi\nvec3 diffuseLightingColor=denoisedColor[0];vec3 diffuseComponent=diffuse*(1.-metalness)*(1.-F)*diffuseLightingColor;denoisedColor[0]=diffuseComponent;\n#endif\n#ifdef ssr\nvec3 specularLightingColor=denoisedColor[0];vec3 specularComponent=specularLightingColor*F;denoisedColor[0]=specularComponent;\n#endif\n#ifdef useDirectLight\ndenoisedColor[0]+=directLight;\n#endif\n",denoiseCustomComposeShaderFunctions:"#define GLSLIFY 1\nuniform sampler2D diffuseTexture;uniform sampler2D directLightTexture;vec3 getViewPosition(const float depth){float clipW=projectionMatrix[2][3]*depth+projectionMatrix[3][3];vec4 clipPosition=vec4((vec3(vUv,depth)-0.5)*2.0,1.0);clipPosition*=clipW;return(projectionMatrixInverse*clipPosition).xyz;}vec3 F_Schlick(const vec3 f0,const float theta){return f0+(1.-f0)*pow(1.0-theta,5.);}vec3 SampleGGXVNDF(const vec3 V,const float ax,const float ay,const float r1,const float r2){vec3 Vh=normalize(vec3(ax*V.x,ay*V.y,V.z));float lensq=Vh.x*Vh.x+Vh.y*Vh.y;vec3 T1=lensq>0. ? vec3(-Vh.y,Vh.x,0.)*inversesqrt(lensq): vec3(1.,0.,0.);vec3 T2=cross(Vh,T1);float r=sqrt(r1);float phi=2.0*PI*r2;float t1=r*cos(phi);float t2=r*sin(phi);float s=0.5*(1.0+Vh.z);t2=(1.0-s)*sqrt(1.0-t1*t1)+s*t2;vec3 Nh=t1*T1+t2*T2+sqrt(max(0.0,1.0-t1*t1-t2*t2))*Vh;return normalize(vec3(ax*Nh.x,ay*Nh.y,max(0.0,Nh.z)));}void Onb(const vec3 N,inout vec3 T,inout vec3 B){vec3 up=abs(N.z)<0.9999999 ? vec3(0,0,1): vec3(1,0,0);T=normalize(cross(up,N));B=cross(N,T);}vec3 ToLocal(const vec3 X,const vec3 Y,const vec3 Z,const vec3 V){return vec3(dot(V,X),dot(V,Y),dot(V,Z));}vec3 ToWorld(const vec3 X,const vec3 Y,const vec3 Z,const vec3 V){return V.x*X+V.y*Y+V.z*Z;}"}),i.svgf=new Yl(t,n,r,o,s),"ssgi"===a?i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.fragmentShader=i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.fragmentShader.replace("accumulatedTexel[ 1 ].rgb = clampedColor;","\n\t\t\t\t\t\tfloat roughness = inputTexel[ 0 ].a;\n\t\t\t\t\t\taccumulatedTexel[ 1 ].rgb = mix(accumulatedTexel[ 1 ].rgb, clampedColor, 1. - sqrt(roughness));\n\t\t\t\t\t\t"):"ssr"===a&&(i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.fragmentShader=i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.fragmentShader.replace("accumulatedTexel[ 0 ].rgb = clampedColor;","\n\t\t\t\t\taccumulatedTexel[ 0 ].rgb = mix(accumulatedTexel[ 0 ].rgb, clampedColor, 0.5);\n\t\t\t\t\t")),i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.needsUpdate=!0,i.ssgiPass=new lu(bl(i),s),s.diffuseOnly?i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.uniforms.inputTexture0.value=i.ssgiPass.texture:s.specularOnly?i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.uniforms.inputTexture0.value=i.ssgiPass.specularTexture:(i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.uniforms.inputTexture0.value=i.ssgiPass.texture,i.svgf.svgfTemporalReprojectPass.fullscreenMaterial.uniforms.inputTexture1.value=i.ssgiPass.specularTexture),i.svgf.setJitteredGBuffers(i.ssgiPass.depthTexture,i.ssgiPass.normalTexture,{useRoughnessInAlphaChannel:!0}),i.svgf.denoisePass.fullscreenMaterial.uniforms=dl(dl({},i.svgf.denoisePass.fullscreenMaterial.uniforms),{diffuseTexture:new or.Uniform(null),directLightTexture:new or.Uniform(null)}),i.svgf.denoisePass.fullscreenMaterial.defines[a]="",i.svgf.denoisePass.fullscreenMaterial.uniforms.diffuseTexture.value=i.ssgiPass.diffuseTexture,i.lastSize={width:s.width,height:s.height,resolutionScale:s.resolutionScale},i.sceneRenderTarget=new or.WebGLRenderTarget(1,1,{colorSpace:or.SRGBColorSpace}),i.renderPass=new fs.RenderPass(i._scene,i._camera),i.renderPass.renderToScreen=!1,i.setSize(s.width,s.height),bl(i)),u=i.renderPass;return fs.RenderPass.prototype.render=function(){var e;this!==u&&(e=l.isUsingRenderPass,l.isUsingRenderPass=!0,e!=l.isUsingRenderPass&&l.updateUsingRenderPass());for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];cu.call.apply(cu,[this].concat(n))},i.makeOptionsReactive(s),i}return wl(e,fs.Effect),vl(e,[{key:"updateUsingRenderPass",value:function(){this.isUsingRenderPass?(this.ssgiPass.fullscreenMaterial.defines.useDirectLight="",this.svgf.denoisePass.fullscreenMaterial.defines.useDirectLight=""):(delete this.ssgiPass.fullscreenMaterial.defines.useDirectLight,delete this.svgf.denoisePass.fullscreenMaterial.defines.useDirectLight),this.ssgiPass.fullscreenMaterial.needsUpdate=!0,this.svgf.denoisePass.fullscreenMaterial.needsUpdate=!0}},{key:"makeOptionsReactive",value:function(e){for(var t=this,n=!1,r=this.ssgiPass.fullscreenMaterial.uniforms,i=Object.keys(r),a=this.svgf.svgfTemporalReprojectPass,s=0,o=Object.keys(e);s<o.length;s++)!function(){var l=o[s];Object.defineProperty(t,l,{get:function(){return e[l]},set:function(t){if(e[l]!==t||!n)switch(e[l]=t,l){case"denoiseIterations":this.svgf.denoisePass.iterations=t;break;case"denoiseDiffuse":this.svgf.denoisePass.fullscreenMaterial.uniforms.denoise.value[0]=t;break;case"denoiseSpecular":this.svgf.denoisePass.fullscreenMaterial.uniforms.denoise.value[1]=t;break;case"denoiseKernel":case"depthPhi":case"normalPhi":case"roughnessPhi":this.svgf.denoisePass.fullscreenMaterial.uniforms[l].value=t;break;case"resolutionScale":this.setSize(this.lastSize.width,this.lastSize.height),a.reset();break;case"spp":this.ssgiPass.fullscreenMaterial.fragmentShader=this.ssgiPass.defaultFragmentShader.replaceAll("spp",t),1!==t&&(this.ssgiPass.fullscreenMaterial.fragmentShader=kl(this.ssgiPass.fullscreenMaterial.fragmentShader.replace("#pragma unroll_loop_start","").replace("#pragma unroll_loop_end",""))),this.ssgiPass.fullscreenMaterial.needsUpdate=n,a.reset();break;case"steps":case"refineSteps":this.ssgiPass.fullscreenMaterial.defines[l]=parseInt(t),this.ssgiPass.fullscreenMaterial.needsUpdate=n,a.reset();break;case"directLightMultiplier":this.ssgiPass.fullscreenMaterial.defines[l]=t.toPrecision(5),this.ssgiPass.fullscreenMaterial.needsUpdate=n,a.reset();break;case"importanceSampling":case"missedRays":case"autoThickness":t?this.ssgiPass.fullscreenMaterial.defines[l]="":delete this.ssgiPass.fullscreenMaterial.defines[l],this.ssgiPass.fullscreenMaterial.needsUpdate=n,a.reset();break;case"blend":this.svgf.svgfTemporalReprojectPass.fullscreenMaterial.uniforms[l].value=t,a.reset();break;case"distance":r.rayDistance.value=t,a.reset();break;default:i.includes(l)&&(r[l].value=t,a.reset())}}}),t[l]=e[l]}();n=!0}},{key:"initialize",value:function(t){for(var n,r=arguments.length,i=new Array(1<r?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];(n=pl(xl(e.prototype),"initialize",this)).call.apply(n,[this,t].concat(i)),(n=this.ssgiPass).initialize.apply(n,[t].concat(i))}},{key:"setSize",value:function(e,t){var n;void 0===e&&void 0===t||!(2<arguments.length&&void 0!==arguments[2]&&arguments[2])&&e===this.lastSize.width&&t===this.lastSize.height&&this.resolutionScale===this.lastSize.resolutionScale||(this.ssgiPass.setSize(e,t),this.svgf.setSize(e,t),this.sceneRenderTarget.setSize(e,t),null!=(n=this.cubeToEquirectEnvPass)&&n.setSize(e,t),this.lastSize={width:e,height:t,resolutionScale:this.resolutionScale})}},{key:"dispose",value:function(){var t;pl(xl(e.prototype),"dispose",this).call(this),this.ssgiPass.dispose(),this.svgf.dispose(),null!=(t=this.cubeToEquirectEnvPass)&&t.dispose(),fs.RenderPass.prototype.render=cu}},{key:"keepEnvMapUpdated",value:function(e){var t,n,r=this.ssgiPass.fullscreenMaterial,i=this._scene.environment;i?r.uniforms.envMapInfo.value.mapUuid!==i.uuid&&(i.isCubeTexture&&(this.cubeToEquirectEnvPass||(this.cubeToEquirectEnvPass=new Ql),(i=this.cubeToEquirectEnvPass.generateEquirectEnvMap(e,i)).uuid=this._scene.environment.uuid),i.generateMipmaps||(i.generateMipmaps=!0,i.minFilter=or.LinearMipMapLinearFilter,i.magFilter=or.LinearMipMapLinearFilter,i.needsUpdate=!0),r.uniforms.envMapInfo.value.mapUuid=i.uuid,n=(t=(t=i).image).width,t=t.height,n=Math.floor(Math.log2(Math.max(n,t)))+1,r.uniforms.maxEnvMapMipLevel.value=n,r.uniforms.envMapInfo.value.map=i,r.defines.USE_ENVMAP="",delete r.defines.importanceSampling,this.importanceSampling?r.uniforms.envMapInfo.value.updateFrom(i,e).then((function(){r.defines.importanceSampling="",r.needsUpdate=!0})):r.uniforms.envMapInfo.value.map=i,this.svgf.svgfTemporalReprojectPass.reset(),r.needsUpdate=!0):"USE_ENVMAP"in r.defines&&(delete r.defines.USE_ENVMAP,delete r.defines.importanceSampling,r.needsUpdate=!0)}},{key:"update",value:function(e,t){var n=this,r=(this.keepEnvMapUpdated(e),t=this.isUsingRenderPass?t:this.sceneRenderTarget,[]);if(!this.isUsingRenderPass){var i,a=[],s=_l(El(this._scene));try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.isScene)return;o.visible=!Al(o),(o.visible?r:a).push(o)}}catch(e){s.e(e)}finally{s.f()}this.renderPass.render(e,this.sceneRenderTarget);for(var l=0,u=a;l<u.length;l++)u[l].visible=!0;var c,d=_l(r);try{for(d.s();!(c=d.n()).done;)c.value.visible=!1}catch(e){d.e(e)}finally{d.f()}}this.ssgiPass.fullscreenMaterial.uniforms.directLightTexture.value=t.texture,this.svgf.denoisePass.fullscreenMaterial.uniforms.directLightTexture.value=t.texture,this.ssgiPass.render(e),this.svgf.render(e),this.uniforms.get("inputTexture").value=this.svgf.texture,this.uniforms.get("sceneTexture").value=t.texture,this.uniforms.get("depthTexture").value=this.ssgiPass.depthTexture,this.uniforms.get("toneMapping").value=e.toneMapping;for(var h=0,p=r;h<p.length;h++)p[h].visible=!0;t=!this.diffuseOnly&&!this.specularOnly,du.value=t||!0===this.diffuseOnly,hu.value=t||1==this.specularOnly,cancelAnimationFrame(this.rAF2),cancelAnimationFrame(this.rAF),cancelAnimationFrame(this.usingRenderPassRAF),this.rAF=requestAnimationFrame((function(){n.rAF2=requestAnimationFrame((function(){du.value=!1,hu.value=!1}))})),this.usingRenderPassRAF=requestAnimationFrame((function(){var e=n.isUsingRenderPass;n.isUsingRenderPass=!1,e!=n.isUsingRenderPass&&n.updateUsingRenderPass()}))}}]),e}(),Cr.DefaultOptions=uu,"\n#define MAX_BONES 64\n \n".concat(or.ShaderChunk.skinning_pars_vertex,"\n").concat("\n\t\t#ifdef USE_SKINNING\n\t\t#ifdef BONE_TEXTURE\n\t\t\tuniform sampler2D prevBoneTexture;\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tfloat j = i * 4.0;\n\t\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\t\ty = dy * ( y + 0.5 );\n\t\t\t\tvec4 v1 = textureLod( prevBoneTexture, vec2( dx * ( x + 0.5 ), y ), 0. );\n\t\t\t\tvec4 v2 = textureLod( prevBoneTexture, vec2( dx * ( x + 1.5 ), y ), 0. );\n\t\t\t\tvec4 v3 = textureLod( prevBoneTexture, vec2( dx * ( x + 2.5 ), y ), 0. );\n\t\t\t\tvec4 v4 = textureLod( prevBoneTexture, vec2( dx * ( x + 3.5 ), y ), 0. );\n\t\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#else\n\t\t\tuniform mat4 prevBoneMatrices[ MAX_BONES ];\n\t\t\tmat4 getPrevBoneMatrix( const in float i ) {\n\t\t\t\tmat4 bone = prevBoneMatrices[ int(i) ];\n\t\t\t\treturn bone;\n\t\t\t}\n\t\t#endif\n\t\t#endif\n","\n\nuniform mat4 velocityMatrix;\nuniform mat4 prevVelocityMatrix;\nvarying vec4 prevPosition;\nvarying vec4 newPosition;\n\n#ifdef renderDepth\nvarying vec2 vHighPrecisionZW;\n#endif\n"),"\n// Get the current vertex position\ntransformed = vec3( position );\n".concat(or.ShaderChunk.skinning_vertex,"\nnewPosition = velocityMatrix * vec4( transformed, 1.0 );\n\n// Get the previous vertex position\ntransformed = vec3( position );\n").concat(or.ShaderChunk.skinbase_vertex.replace(/mat4 /g,"").replace(/getBoneMatrix/g,"getPrevBoneMatrix"),"\n").concat(or.ShaderChunk.skinning_vertex.replace(/vec4 /g,""),"\nprevPosition = prevVelocityMatrix * vec4( transformed, 1.0 );\n\ngl_Position = newPosition;\n\n#ifdef renderDepth\nvHighPrecisionZW = gl_Position.zw;\n#endif\n"),new or.Matrix4,new or.Matrix4,new or.Vector2,new or.Matrix3,new or.Color(0),new or.Vector2,new or.Matrix4,new or.Matrix4;var pu="#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D inputTexture;uniform sampler2D depthTexture;uniform sampler2D normalTexture;uniform mat4 projectionMatrixInverse;uniform mat4 cameraMatrixWorld;uniform float lumaPhi;uniform float depthPhi;uniform float normalPhi;uniform sampler2D blueNoiseTexture;uniform vec2 blueNoiseRepeat;uniform int index;uniform vec2 resolution;\n#include <common>\n#include <sampleBlueNoise>\nvec3 getWorldPos(float depth,vec2 coord){float z=depth*2.0-1.0;vec4 clipSpacePosition=vec4(coord*2.0-1.0,z,1.0);vec4 viewSpacePosition=projectionMatrixInverse*clipSpacePosition;vec4 worldSpacePosition=cameraMatrixWorld*viewSpacePosition;worldSpacePosition.xyz/=worldSpacePosition.w;return worldSpacePosition.xyz;}\n#define luminance(a) dot(vec3(0.2125, 0.7154, 0.0721), a)\nvec3 getNormal(vec2 uv,vec4 texel){\n#ifdef NORMAL_IN_RGB\nreturn texel.rgb;\n#else\nreturn normalize(textureLod(normalTexture,uv,0.).xyz*2.0-1.0);\n#endif\n}float distToPlane(const vec3 worldPos,const vec3 neighborWorldPos,const vec3 worldNormal){vec3 toCurrent=worldPos-neighborWorldPos;float distToPlane=abs(dot(toCurrent,worldNormal));return distToPlane;}void main(){vec4 depthTexel=textureLod(depthTexture,vUv,0.);if(depthTexel.r==1.0||dot(depthTexel.rgb,depthTexel.rgb)==0.){discard;return;}vec4 texel=textureLod(inputTexture,vUv,0.0);vec3 normal=getNormal(vUv,texel);\n#ifdef NORMAL_IN_RGB\nfloat denoised=texel.a;float center=texel.a;\n#else\nvec3 denoised=texel.rgb;float center=texel.rgb;\n#endif\nfloat depth=depthTexel.x;vec3 worldPos=getWorldPos(depth,vUv);float totalWeight=1.0;vec4 blueNoise=sampleBlueNoise(blueNoiseTexture,0,blueNoiseRepeat,resolution);float angle=blueNoise[index];float s=sin(angle),c=cos(angle);mat2 rotationMatrix=mat2(c,-s,s,c);for(int i=0;i<samples;i++){vec2 offset=rotationMatrix*poissonDisk[i];vec2 neighborUv=vUv+offset;vec4 neighborTexel=textureLod(inputTexture,neighborUv,0.0);vec3 neighborNormal=getNormal(neighborUv,neighborTexel);float neighborColor=neighborTexel.a;float sampleDepth=textureLod(depthTexture,neighborUv,0.0).x;vec3 worldPosSample=getWorldPos(sampleDepth,neighborUv);float tangentPlaneDist=abs(dot(worldPos-worldPosSample,normal));float normalDiff=dot(normal,neighborNormal);float normalSimilarity=pow(max(normalDiff,0.),normalPhi);\n#ifdef NORMAL_IN_RGB\nfloat lumaDiff=abs(neighborColor-center);\n#else\nfloat lumaDiff=abs(luminance(neighborColor)-luminance(center));\n#endif\nfloat lumaSimilarity=max(1.0-lumaDiff/lumaPhi,0.0);float depthDiff=1.-distToPlane(worldPos,worldPosSample,normal);float depthSimilarity=max(depthDiff/depthPhi,0.);float w=lumaSimilarity*depthSimilarity*normalSimilarity;denoised+=w*neighborColor;totalWeight+=w;}if(totalWeight>0.)denoised/=totalWeight;\n#ifdef NORMAL_IN_RGB\ngl_FragColor=vec4(normal,denoised);\n#else\ngl_FragColor=vec4(denoised,1.);\n#endif\n}".replace("#include <sampleBlueNoise>",$l),fu={iterations:1,radius:8,rings:5.625,lumaPhi:10,depthPhi:2,normalPhi:3.25,samples:16,normalTexture:null},mu=function(){function e(t,n,r){for(var i,a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:fu,s=(ml(this,e),(i=yl(this,e,["PoissionBlurPass"])).iterations=fu.iterations,i.index=0,a=dl(dl({},fu),a),i.inputTexture=n,i.fullscreenMaterial=new or.ShaderMaterial({fragmentShader:pu,vertexShader:Il,uniforms:{depthTexture:{value:null},inputTexture:{value:null},projectionMatrixInverse:{value:new or.Matrix4},cameraMatrixWorld:{value:new or.Matrix4},lumaPhi:{value:5},depthPhi:{value:5},normalPhi:{value:5},resolution:{value:new or.Vector2},blueNoiseTexture:{value:null},index:{value:0},blueNoiseRepeat:{value:new or.Vector2}}}),n={type:or.HalfFloatType,depthBuffer:!1},(i.renderTargetA=new or.WebGLRenderTarget(1,1,n),i.renderTargetB=new or.WebGLRenderTarget(1,1,n),n=i.fullscreenMaterial.uniforms).inputTexture.value=i.inputTexture,n.depthTexture.value=r,n.projectionMatrixInverse.value=t.projectionMatrixInverse,n.cameraMatrixWorld.value=t.matrixWorld,n.depthPhi.value=a.depthPhi,n.normalPhi.value=a.normalPhi,a.normalTexture?n.normalTexture.value=a.normalTexture:i.fullscreenMaterial.defines.NORMAL_IN_RGB="",0),o=["radius","rings","samples"];s<o.length;s++)!function(){var e=o[s];Object.defineProperty(bl(i),e,{get:function(){return a[e]},set:function(t){a[e]=t,i.setSize(i.renderTargetA.width,i.renderTargetA.height)}})}();return(new or.TextureLoader).load(su,(function(e){e.minFilter=or.NearestFilter,e.magFilter=or.NearestFilter,e.wrapS=or.RepeatWrapping,e.wrapT=or.RepeatWrapping,e.colorSpace=or.NoColorSpace,i.fullscreenMaterial.uniforms.blueNoiseTexture.value=e})),i}return wl(e,fs.Pass),vl(e,[{key:"setSize",value:function(e,t){this.renderTargetA.setSize(e,t),this.renderTargetB.setSize(e,t),this.fullscreenMaterial.uniforms.resolution.value.set(e,t),e=function(e,t,n,r){for(var i=2*Math.PI*t/e,a=t=1/e,s=[],o=t,l=0,u=0;u<e;u++){var c=new or.Vector2(Math.cos(l),Math.sin(l)).multiplyScalar(Math.pow(o,.75)).multiply(r).multiplyScalar(n);s.push(c),o+=a,l+=i}return s}(this.samples,this.rings,this.radius,new or.Vector2(1/e,1/t)),t="const int samples = ".concat(this.samples,";\n"),e=function(e){for(var t=e.length,n="const vec2 poissonDisk[samples] = vec2[samples](\n",r=0;r<t;r++){var i=e[r];n+=" vec2(".concat(i.x,", ").concat(i.y,")"),r<t-1&&(n+=","),n+="\n"}return n+");"}(e),this.fullscreenMaterial.fragmentShader=t+e+"\n"+pu,this.fullscreenMaterial.needsUpdate=!0}},{key:"texture",get:function(){return this.renderTargetB.texture}},{key:"render",value:function(e){this.fullscreenMaterial.uniforms.index.value=0;var t,n=this.fullscreenMaterial.uniforms.blueNoiseTexture.value;n&&(t=(n=n.source.data).width,n=n.height,this.fullscreenMaterial.uniforms.blueNoiseRepeat.value.set(this.renderTargetA.width/t,this.renderTargetA.height/n));for(var r=0;r<2*this.iterations;r++){var i=r%2==0,a=i?this.renderTargetB:this.renderTargetA;this.fullscreenMaterial.uniforms.inputTexture.value=0===r?this.inputTexture:a.texture,a=i?this.renderTargetA:this.renderTargetB,e.setRenderTarget(a),e.render(this.scene,this.camera),this.fullscreenMaterial.uniforms.index.value=(this.fullscreenMaterial.uniforms.index.value+1)%4}}}]),e}(),gu=(mu.DefaultOptions=fu,function(){function e(t,n,r){var i;return ml(this,e),(i=yl(this,e))._camera=t,i._scene=n,i.renderTarget=new or.WebGLRenderTarget(1,1,{type:or.HalfFloatType,depthBuffer:!1}),t=r.replace("#include <sampleBlueNoise>",$l),i.fullscreenMaterial=new or.ShaderMaterial({fragmentShader:t,vertexShader:Il,uniforms:{depthTexture:{value:null},normalTexture:{value:null},cameraNear:{value:0},cameraFar:{value:0},viewMatrix:{value:i._camera.matrixWorldInverse},projectionViewMatrix:{value:new or.Matrix4},projectionMatrixInverse:{value:i._camera.projectionMatrixInverse},cameraMatrixWorld:{value:i._camera.matrixWorld},texSize:{value:new or.Vector2},blueNoiseTexture:{value:null},blueNoiseRepeat:{value:new or.Vector2},aoDistance:{value:0},distancePower:{value:0},bias:{value:0},thickness:{value:0},power:{value:0},frame:{value:0}},blending:or.NoBlending,depthWrite:!1,depthTest:!1,toneMapped:!1}),(new or.TextureLoader).load(su,(function(e){e.minFilter=or.NearestFilter,e.magFilter=or.NearestFilter,e.wrapS=or.RepeatWrapping,e.wrapT=or.RepeatWrapping,e.colorSpace=or.NoColorSpace,i.fullscreenMaterial.uniforms.blueNoiseTexture.value=e})),i}return wl(e,fs.Pass),vl(e,[{key:"texture",get:function(){return this.renderTarget.texture}},{key:"setSize",value:function(e,t){this.renderTarget.setSize(e,t),this.fullscreenMaterial.uniforms.texSize.value.set(this.renderTarget.width,this.renderTarget.height)}},{key:"render",value:function(e){var t,n=+this.fullscreenMaterial.defines.spp;this.fullscreenMaterial.uniforms.frame.value=(this.fullscreenMaterial.uniforms.frame.value+n)%65536,this.fullscreenMaterial.uniforms.cameraNear.value=this._camera.near,this.fullscreenMaterial.uniforms.cameraFar.value=this._camera.far,this.fullscreenMaterial.uniforms.projectionViewMatrix.value.multiplyMatrices(this._camera.projectionMatrix,this._camera.matrixWorldInverse),(n=this.fullscreenMaterial.uniforms.blueNoiseTexture.value)&&(t=(n=n.source.data).width,n=n.height,this.fullscreenMaterial.uniforms.blueNoiseRepeat.value.set(this.renderTarget.width/t,this.renderTarget.height/n)),e.setRenderTarget(this.renderTarget),e.render(this.scene,this.camera)}}]),e}());"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D depthTexture;uniform mat4 projectionViewMatrix;uniform int frame;uniform sampler2D blueNoiseTexture;uniform vec2 blueNoiseRepeat;uniform vec2 texSize;uniform float aoDistance;uniform float distancePower;uniform float bias;uniform float thickness;\n#include <packing>\n#include <hbao_utils>\nfloat getOcclusion(const vec3 cameraPosition,const vec3 worldPos,const vec3 worldNormal,const float depth,const int seed,inout float totalWeight){vec4 blueNoise=sampleBlueNoise(blueNoiseTexture,seed,blueNoiseRepeat,texSize);vec3 sampleWorldDir=cosineSampleHemisphere(worldNormal,blueNoise.rg);vec3 sampleWorldPos=worldPos+aoDistance*pow(blueNoise.b,distancePower+1.0)*sampleWorldDir;vec4 sampleUv=projectionViewMatrix*vec4(sampleWorldPos,1.);sampleUv.xy/=sampleUv.w;sampleUv.xy=sampleUv.xy*0.5+0.5;float sampleDepth=textureLod(depthTexture,sampleUv.xy,0.0).r;float deltaDepth=depth-sampleDepth;float d=distance(sampleWorldPos,cameraPosition);deltaDepth*=0.001*d*d;float th=thickness*0.01;float theta=dot(worldNormal,sampleWorldDir);totalWeight+=theta;if(deltaDepth<th){float horizon=sampleDepth+deltaDepth*bias*1000.;float occlusion=max(0.0,horizon-depth)*theta;float m=max(0.,1.-deltaDepth/th);occlusion=10.*occlusion*m/d;occlusion=sqrt(occlusion);return occlusion;}return 0.;}void main(){float depth=textureLod(depthTexture,vUv,0.0).r;if(depth==1.0){discard;return;}vec4 cameraPosition=cameraMatrixWorld*vec4(0.0,0.0,0.0,1.0);vec3 worldPos=getWorldPos(depth,vUv);vec3 worldNormal=getWorldNormal(vUv);float ao=0.0,totalWeight=0.0;for(int i=0;i<spp;i++){int seed=i;\n#ifdef animatedNoise\nseed+=frame;\n#endif\nfloat occlusion=getOcclusion(cameraPosition.xyz,worldPos,worldNormal,depth,seed,totalWeight);ao+=occlusion;}if(totalWeight>0.)ao/=totalWeight;ao=clamp(1.-ao,0.,1.);gl_FragColor=vec4(worldNormal,ao);}".replace("#include <hbao_utils>","#define GLSLIFY 1\n#include <sampleBlueNoise>\nuniform sampler2D normalTexture;uniform float cameraNear;uniform float cameraFar;uniform mat4 projectionMatrixInverse;uniform mat4 cameraMatrixWorld;float getViewZ(const float depth){\n#ifdef PERSPECTIVE_CAMERA\nreturn perspectiveDepthToViewZ(depth,cameraNear,cameraFar);\n#else\nreturn orthographicDepthToViewZ(depth,cameraNear,cameraFar);\n#endif\n}vec3 getWorldPos(const float depth,const vec2 coord){float z=depth*2.0-1.0;vec4 clipSpacePosition=vec4(coord*2.0-1.0,z,1.0);vec4 viewSpacePosition=projectionMatrixInverse*clipSpacePosition;vec4 worldSpacePosition=cameraMatrixWorld*viewSpacePosition;worldSpacePosition.xyz/=worldSpacePosition.w;return worldSpacePosition.xyz;}vec3 slerp(const vec3 a,const vec3 b,const float t){float cosAngle=dot(a,b);float angle=acos(cosAngle);if(abs(angle)<0.001){return mix(a,b,t);}float sinAngle=sin(angle);float t1=sin((1.0-t)*angle)/sinAngle;float t2=sin(t*angle)/sinAngle;return(a*t1)+(b*t2);}vec3 computeWorldNormal(){vec2 size=vec2(textureSize(depthTexture,0));ivec2 p=ivec2(vUv*size);float c0=texelFetch(depthTexture,p,0).x;float l2=texelFetch(depthTexture,p-ivec2(2,0),0).x;float l1=texelFetch(depthTexture,p-ivec2(1,0),0).x;float r1=texelFetch(depthTexture,p+ivec2(1,0),0).x;float r2=texelFetch(depthTexture,p+ivec2(2,0),0).x;float b2=texelFetch(depthTexture,p-ivec2(0,2),0).x;float b1=texelFetch(depthTexture,p-ivec2(0,1),0).x;float t1=texelFetch(depthTexture,p+ivec2(0,1),0).x;float t2=texelFetch(depthTexture,p+ivec2(0,2),0).x;float dl=abs((2.0*l1-l2)-c0);float dr=abs((2.0*r1-r2)-c0);float db=abs((2.0*b1-b2)-c0);float dt=abs((2.0*t1-t2)-c0);vec3 ce=getWorldPos(c0,vUv).xyz;vec3 dpdx=(dl<dr)? ce-getWorldPos(l1,(vUv-vec2(1.0/size.x,0.0))).xyz:-ce+getWorldPos(r1,(vUv+vec2(1.0/size.x,0.0))).xyz;vec3 dpdy=(db<dt)? ce-getWorldPos(b1,(vUv-vec2(0.0,1.0/size.y))).xyz:-ce+getWorldPos(t1,(vUv+vec2(0.0,1.0/size.y))).xyz;return normalize(cross(dpdx,dpdy));}vec3 getWorldNormal(const vec2 uv){\n#ifdef useNormalTexture\nvec3 worldNormal=unpackRGBToNormal(textureLod(normalTexture,uv,0.).rgb);worldNormal=(vec4(worldNormal,1.)*viewMatrix).xyz;return normalize(worldNormal);\n#else\nreturn computeWorldNormal();\n#endif\n}\n#define PI 3.14159265358979323846264338327950288\nvec3 cosineSampleHemisphere(const vec3 n,const vec2 u){float r=sqrt(u.x);float theta=2.0*PI*u.y;vec3 b=normalize(cross(n,vec3(0.0,1.0,1.0)));vec3 t=cross(b,n);return normalize(r*sin(theta)*b+sqrt(1.0-u.x)*n+r*cos(theta)*t);}");var vu=dl({resolutionScale:1,spp:8,distance:2,distancePower:1,power:2,bias:40,thickness:.075,color:new or.Color("black"),useNormalPass:!1,velocityDepthNormalPass:null,normalTexture:null},mu.DefaultOptions),yu=function(){function e(t,n,r,i){var a,s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:vu;return ml(this,e),(a=yl(this,e,["AOEffect","#define GLSLIFY 1\nuniform sampler2D inputTexture;uniform sampler2D depthTexture;uniform float power;uniform vec3 color;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){float unpackedDepth=textureLod(depthTexture,uv,0.).r;float ao=unpackedDepth>0.9999 ? 1.0 : textureLod(inputTexture,uv,0.0).a;ao=pow(ao,power);vec3 aoColor=mix(color,vec3(1.),ao);aoColor*=inputColor.rgb;outputColor=vec4(aoColor,inputColor.a);}",{type:"FinalAOMaterial",uniforms:new Map([["inputTexture",new or.Uniform(null)],["depthTexture",new or.Uniform(null)],["power",new or.Uniform(0)],["color",new or.Uniform(new or.Color("black"))]])}])).lastSize={width:0,height:0,resolutionScale:0},a.composer=t,a.aoPass=i,s=dl(dl({},vu),s),a.options=s,a.scene=r,t.depthTexture||t.createDepthTexture(),a.aoPass.fullscreenMaterial.uniforms.depthTexture.value=t.depthTexture,a.uniforms.get("depthTexture").value=t.depthTexture,(s.useNormalPass||s.normalTexture)&&(s.useNormalPass&&(a.normalPass=new fs.NormalPass(r,n)),r=null!=(i=s.normalTexture)?i:a.normalPass.texture,a.aoPass.fullscreenMaterial.uniforms.normalTexture.value=r,a.aoPass.fullscreenMaterial.defines.useNormalTexture=""),a.poissionDenoisePass=new mu(n,a.aoPass.texture,t.depthTexture),a.makeOptionsReactive(s),a}return wl(e,fs.Effect),vl(e,[{key:"makeOptionsReactive",value:function(e){for(var t=this,n=0,r=Object.keys(e);n<r.length;n++)!function(){var i=r[n];Object.defineProperty(t,i,{get:function(){return e[i]},set:function(t){if(null!=t)switch(e[i]=t,i){case"spp":this.aoPass.fullscreenMaterial.defines.spp=t.toFixed(0),this.aoPass.fullscreenMaterial.needsUpdate=!0;break;case"distance":this.aoPass.fullscreenMaterial.uniforms.aoDistance.value=t;break;case"resolutionScale":this.setSize(this.lastSize.width,this.lastSize.height);break;case"power":this.uniforms.get("power").value=t;break;case"color":this.uniforms.get("color").value.copy(new or.Color(t));break;case"iterations":case"radius":case"rings":case"samples":this.poissionDenoisePass[i]=t;break;case"lumaPhi":case"depthPhi":case"normalPhi":this.poissionDenoisePass.fullscreenMaterial.uniforms[i].value=Math.max(t,1e-4);break;default:i in this.aoPass.fullscreenMaterial.uniforms&&(this.aoPass.fullscreenMaterial.uniforms[i].value=t)}},configurable:!0}),t[i]=e[i]}()}},{key:"setSize",value:function(e,t){var n;void 0===e||void 0===t||e===this.lastSize.width&&t===this.lastSize.height&&this.resolutionScale===this.lastSize.resolutionScale||(null!=(n=this.normalPass)&&n.setSize(e,t),this.aoPass.setSize(e*this.resolutionScale,t*this.resolutionScale),this.poissionDenoisePass.setSize(e,t),this.lastSize={width:e,height:t,resolutionScale:this.resolutionScale})}},{key:"update",value:function(e,t,n){null!=(r=this.options)&&null!=(i=r.renderBefore)&&i.call(r,this.scene);var r,i=this.composer.passes.some((function(e){return e.enabled&&!e.skipRendering&&(null==(e=e.effects)?void 0:e.some((function(e){return e instanceof Wl})))}));!i||"animatedNoise"in this.aoPass.fullscreenMaterial.defines?!i&&"animatedNoise"in this.aoPass.fullscreenMaterial.defines&&(delete this.aoPass.fullscreenMaterial.defines.animatedNoise,this.aoPass.fullscreenMaterial.needsUpdate=!0):(this.aoPass.fullscreenMaterial.defines.animatedNoise="",this.aoPass.fullscreenMaterial.needsUpdate=!0),0<this.iterations?this.uniforms.get("inputTexture").value=this.poissionDenoisePass.texture:this.uniforms.get("inputTexture").value=this.aoPass.texture,null!=(r=this.normalPass)&&r.render(e),this.aoPass.render(e),this.poissionDenoisePass.render(e)}}]),e}();yu.DefaultOptions=vu;var bu=function(){function e(t,n){return ml(this,e),yl(this,e,[t,n,"#define GLSLIFY 1\nvarying vec2 vUv;uniform sampler2D depthTexture;uniform sampler2D normalTexture;uniform mat4 projectionViewMatrix;uniform mat4 cameraMatrixWorld;uniform sampler2D blueNoiseTexture;uniform vec2 blueNoiseRepeat;uniform vec2 texSize;uniform mat4 projectionMatrixInverse;uniform float aoDistance;uniform float distancePower;uniform float cameraNear;uniform float cameraFar;uniform int frame;uniform vec3[spp]samples;uniform float[spp]samplesR;\n#include <common>\n#include <packing>\n#include <sampleBlueNoise>\nvec3 getWorldPos(const float depth,const vec2 coord){float z=depth*2.0-1.0;vec4 clipSpacePosition=vec4(coord*2.0-1.0,z,1.0);vec4 viewSpacePosition=projectionMatrixInverse*clipSpacePosition;vec4 worldSpacePosition=cameraMatrixWorld*viewSpacePosition;worldSpacePosition.xyz/=worldSpacePosition.w;return worldSpacePosition.xyz;}vec3 computeNormal(vec3 worldPos,vec2 vUv){vec2 size=vec2(textureSize(depthTexture,0));ivec2 p=ivec2(vUv*size);float c0=texelFetch(depthTexture,p,0).x;float l2=texelFetch(depthTexture,p-ivec2(2,0),0).x;float l1=texelFetch(depthTexture,p-ivec2(1,0),0).x;float r1=texelFetch(depthTexture,p+ivec2(1,0),0).x;float r2=texelFetch(depthTexture,p+ivec2(2,0),0).x;float b2=texelFetch(depthTexture,p-ivec2(0,2),0).x;float b1=texelFetch(depthTexture,p-ivec2(0,1),0).x;float t1=texelFetch(depthTexture,p+ivec2(0,1),0).x;float t2=texelFetch(depthTexture,p+ivec2(0,2),0).x;float dl=abs((2.0*l1-l2)-c0);float dr=abs((2.0*r1-r2)-c0);float db=abs((2.0*b1-b2)-c0);float dt=abs((2.0*t1-t2)-c0);vec3 ce=getWorldPos(c0,vUv).xyz;vec3 dpdx=(dl<dr)? ce-getWorldPos(l1,(vUv-vec2(1.0/size.x,0.0))).xyz:-ce+getWorldPos(r1,(vUv+vec2(1.0/size.x,0.0))).xyz;vec3 dpdy=(db<dt)? ce-getWorldPos(b1,(vUv-vec2(0.0,1.0/size.y))).xyz:-ce+getWorldPos(t1,(vUv+vec2(0.0,1.0/size.y))).xyz;return normalize(cross(dpdx,dpdy));}highp float linearize_depth(highp float d,highp float zNear,highp float zFar){highp float z_n=2.0*d-1.0;return 2.0*zNear*zFar/(zFar+zNear-z_n*(zFar-zNear));}void main(){float depth=textureLod(depthTexture,vUv,0.).x;if(depth==1.0){discard;return;}vec3 worldPos=getWorldPos(depth,vUv);vec3 normal=computeNormal(worldPos,vUv);\n#ifdef animatedNoise\nint seed=frame;\n#else\nint seed=0;\n#endif\nvec4 noise=sampleBlueNoise(blueNoiseTexture,seed,blueNoiseRepeat,texSize);vec3 randomVec=normalize(noise.rgb*2.0-1.0);vec3 tangent=normalize(randomVec-normal*dot(randomVec,normal));vec3 bitangent=cross(normal,tangent);mat3 tbn=mat3(tangent,bitangent,normal);float occluded=0.0;float totalWeight=0.0;vec3 samplePos;float sppF=float(spp);for(float i=0.0;i<sppF;i++){vec3 sampleDirection=tbn*samples[int(i)];if(dot(sampleDirection,normal)<0.0)sampleDirection*=-1.0;float moveAmt=samplesR[int(mod(i+noise.a*sppF,sppF))];samplePos=worldPos+aoDistance*moveAmt*sampleDirection;vec4 offset=projectionViewMatrix*vec4(samplePos,1.0);offset.xyz/=offset.w;offset.xyz=offset.xyz*0.5+0.5;float sampleDepth=textureLod(depthTexture,offset.xy,0.0).x;float distSample=linearize_depth(sampleDepth,cameraNear,cameraFar);float distWorld=linearize_depth(offset.z,cameraNear,cameraFar);float rangeCheck=smoothstep(0.0,1.0,aoDistance/(aoDistance*abs(distSample-distWorld)));rangeCheck=pow(rangeCheck,distancePower);float weight=dot(sampleDirection,normal);occluded+=rangeCheck*weight*(distSample<distWorld ? 1.0 : 0.0);totalWeight+=weight;}float occ=clamp(1.0-occluded/totalWeight,0.0,1.0);gl_FragColor=vec4(normal,occ);}"])}return wl(e,gu),vl(e)}(),xu=function(){function e(t,n,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},a=(ml(this,e),e.DefaultOptions=dl(dl({},yu.DefaultOptions),{spp:16,distance:1,distancePower:.25,power:2}),i=dl(dl({},e.DefaultOptions),i),new bu(n,r));return yl(this,e,[t,n,r,a,i])}return wl(e,yu),vl(e,[{key:"makeOptionsReactive",value:function(t){for(var n=this,r=(pl(xl(e.prototype),"makeOptionsReactive",this).call(this,t),function(){var e=a[i];Object.defineProperty(n,e,{get:function(){return t[e]},set:function(n){if(null!=n&&(t[e]=n,"spp"===e)){this.aoPass.fullscreenMaterial.defines.spp=n.toFixed(0);for(var r=function(e){for(var t=[],n=Math.PI*(3-Math.sqrt(5)),r=2/e,i=0;i<e;i++){var a=i*r-1+r/2,s=Math.sqrt(1-a*a),o=i*n;t.push(new or.Vector3(Math.cos(o)*s,a,Math.sin(o)*s))}return t}(n),i=[],a=0;a<n;a++)i.push((a+1)/n);this.aoPass.fullscreenMaterial.uniforms.samples={value:r},this.aoPass.fullscreenMaterial.uniforms.samplesR={value:i},this.aoPass.fullscreenMaterial.needsUpdate=!0}},configurable:!0})}),i=0,a=["spp"];i<a.length;i++)r();this.spp=t.spp}}]),e}(),wu=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const Su={resolution:{name:"resolution",setIsUpdate:!0,isUpdate:!1,type:"number",val:.25,now:.25,min:.25,max:1,shortKey:"resolution",get:e=>e.effect.resolutionScale,set:e=>{const{end:t,target:n}=e;n.effect.resolutionScale=t}},samples:{name:"samples",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:1,max:32,step:1,shortKey:"samples",get:e=>e.effect.samples,set:e=>{const{end:t,target:n}=e;n.effect.samples=t}},rings:{name:"rings",setIsUpdate:!0,isUpdate:!1,type:"number",val:5.625,now:5.625,min:1,max:16,shortKey:"rings",get:e=>e.effect.rings,set:e=>{const{end:t,target:n}=e;n.effect.rings=t}},lumaPhi:{name:"lumaPhi",setIsUpdate:!0,isUpdate:!1,type:"number",val:10,now:10,min:0,max:100,shortKey:"lumaPhi",get:e=>e.effect.lumaPhi,set:e=>{const{end:t,target:n}=e;n.effect.lumaPhi=t}},normalPhi:{name:"normalPhi",setIsUpdate:!0,isUpdate:!1,type:"number",val:3.25,now:3.25,min:0,max:100,shortKey:"normalPhi",get:e=>e.effect.normalPhi,set:e=>{const{end:t,target:n}=e;n.effect.normalPhi=t}},radius:{name:"radius",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:0,max:100,shortKey:"radius",get:e=>e.effect.radius,set:e=>{const{end:t,target:n}=e;n.effect.radius=t}},bias:{name:"bias",setIsUpdate:!0,isUpdate:!1,type:"number",val:.001,now:.001,min:0,max:1,shortKey:"bias",get:e=>e.effect.bias,set:e=>{const{end:t,target:n}=e;n.effect.bias=t}},intensity:{name:"intensity",setIsUpdate:!0,isUpdate:!1,type:"number",val:.02,now:.02,min:0,max:1,shortKey:"intensity",get:e=>e.effect.iterations,set:e=>{const{end:t,target:n}=e;n.effect.iterations=t}},thickness:{name:"thickness",setIsUpdate:!0,isUpdate:!1,type:"number",val:.075,now:.075,min:0,max:10,shortKey:"thickness",get:e=>e.effect.thickness,set:e=>{const{end:t,target:n}=e;n.effect.thickness=t}},spp:{name:"spp",setIsUpdate:!0,isUpdate:!1,type:"number",val:16,now:16,min:0,max:100,shortKey:"spp",get:e=>e.effect.spp,set:e=>{const{end:t,target:n}=e;n.effect.spp=t}},power:{name:"power",setIsUpdate:!0,isUpdate:!1,type:"number",val:2,now:2,min:0,max:10,shortKey:"power",get:e=>e.effect.power,set:e=>{const{end:t,target:n}=e;n.effect.power=t}},depthPhi:{name:"depthPhi",setIsUpdate:!0,isUpdate:!1,type:"number",val:2,now:2,min:0,max:10,shortKey:"depthPhi",get:e=>e.effect.depthPhi,set:e=>{const{end:t,target:n}=e;n.effect.depthPhi=t}},distance:{name:"distance",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:0,max:10,shortKey:"distance",get:e=>e.effect.distance,set:e=>{const{end:t,target:n}=e;n.effect.distance=t}},distancePower:{name:"distancePower",setIsUpdate:!0,isUpdate:!1,type:"number",val:.25,now:.25,min:0,max:10,shortKey:"distancePower",get:e=>e.effect.distancePower,set:e=>{const{end:t,target:n}=e;n.effect.distancePower=t}},color:{name:"颜色",setIsUpdate:!0,isUpdate:!1,type:"color_str",val:"#FFFFFF",now:"#FFFFFF",shortKey:"color",get:e=>e.effect.color?(0,lt.J6)(e.effect.color):"#000000",set:e=>{const{end:t,target:n}=e;n.effect.color="#000000"===t?null:(new s.Color).setStyle(t).convertSRGBToLinear()}}};class _u extends Vo{constructor(){super(...arguments),this.name="SSAO",this.config=Su,this.onLoadedCreate=!0,this.index=1,this.onChangeCatchData={},this.isLoaded=!1}onInited(){const e=()=>wu(this,void 0,void 0,(function*(){this.isLoaded=!0,this.onChangeCatchData&&this._parseJSON(this.onChangeCatchData)}));this.runScene.cb.loaderer.gltf.loaded.on(e),this.runScene.cb.load.loaded.on(e),ku.callback.onSetState.on((t=>wu(this,void 0,void 0,(function*(){"SSAO"!==t.type&&!t.state&&this.enable&&e()}))))}onLoaded(){return wu(this,void 0,void 0,(function*(){this.isLoaded=!0}))}reCarete(){return wu(this,void 0,void 0,(function*(){this.pass=[yield this.create()]}))}create(){return new Promise((e=>{this.runScene.renderEx.shadowManager.trigged?e(this._create()):this.runScene.cb.renderEx.fristFrame.on((()=>{e(this._create())}))}))}_create(){var e=this.runScene.assetsEx.get().camera,t=this.runScene.assetsEx.get().scene,n=this.runScene.ltPP.composer;return n=new xu(n,e,t),this.effect=n,new fs.EffectPass(e,n)}onParseJSON(e){this.onChangeCatchData=e}}_u.config=Su;const Tu={intensity:{name:"强度",type:"number",val:1,now:1,shortKey:"intensity",min:0,max:20,get:e=>e.effect.intensity,setIsUpdate:!0,isUpdate:!1,set:e=>{const{end:t,target:n}=e;n.effect.intensity=t}},radius:{name:"半径",setIsUpdate:!0,isUpdate:!1,type:"number",val:.85,now:.85,min:0,max:5,shortKey:"radius",get:e=>e.effect.mipmapBlurPass.radius,set:e=>{const{end:t,target:n}=e;n.effect.mipmapBlurPass.radius=t}},threshold:{name:"亮度阈值",setIsUpdate:!0,isUpdate:!1,type:"number",val:0,now:0,min:0,max:1,shortKey:"threshold",get:e=>e.effect.luminanceMaterial.threshold,set:e=>{const{end:t,target:n}=e;n.effect.luminanceMaterial.threshold=t}},smoothing:{name:"亮度平滑",setIsUpdate:!0,isUpdate:!1,type:"number",val:.025,now:.025,min:0,max:2,shortKey:"smoothing",get:e=>e.effect.luminanceMaterial.smoothing,set:e=>{const{end:t,target:n}=e;n.effect.luminanceMaterial.smoothing=t}},luminanceEenabled:{name:"亮度过滤",setIsUpdate:!0,isUpdate:!1,type:"boolean",val:!0,now:!0,shortKey:"luminanceEenabled",get:e=>e.effect.luminancePass.enabled,set:e=>{const{end:t,target:n}=e;n.effect.luminancePass.enabled=t}},inverted:{name:"反向选择",setIsUpdate:!0,isUpdate:!1,type:"boolean",val:!1,now:!1,shortKey:"inverted",get:e=>e.effect.inverted,set:e=>{const{end:t,target:n}=e;n.effect.inverted=t}},ignoreBackground:{name:"忽略背景",setIsUpdate:!0,isUpdate:!1,type:"boolean",val:!0,now:!0,shortKey:"ignoreBackground",get:e=>e.effect.ignoreBackground,set:e=>{const{end:t,target:n}=e;n.effect.ignoreBackground=t}},kernelSize:{name:"大小",setIsUpdate:!0,isUpdate:!1,type:"select",val:4,now:4,shortKey:"kernelSize",opts:Object.values(fs.KernelSize),get:e=>e.effect.kernelSize,set:e=>{const{end:t,target:n}=e;n.effect.kernelSize=t}}};class Mu extends Vo{constructor(){super(...arguments),this.name="SelectiveBloom",this.config=Tu,this.afterLoadedCreate=!1,this.index=2,this.awaitModels=new m.Z,this.catchModels=[],this._setModel=(0,a.fnDebounce)((()=>{this.catchModels.splice(0).map((e=>{const{model:t,state:n}=e;this.effect&&(n?this.effect.selection.add(t):0<this.effect.selection.size&&Et.Z.accurateDel({set:this.effect.selection,fn:e=>e.uuid===t.uuid})),this.onAfterModelSet([...this.effect.selection],n)}))}),50)}onInited(){var e=()=>function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.enable&&(yield this.setState(!1),yield this.setState(!0))}));this.runScene.cb.loaderer.gltf.loaded.on(e),this.runScene.cb.load.loaded.on(e)}create(){var e,{camera:t,scene:e}=this.runScene.assetsEx.get();return this.effect=new fs.SelectiveBloomEffect(e,t),new fs.EffectPass(t,this.effect)}setModel(e){this.catchModels.push(e),this.effect?this._setModel():this.runScene.ltPP.setModuleState("SelectiveBloom",!0).then((()=>{this._setModel()}))}}Mu.config=Tu,Mu.needInit=!0;const Eu={mode:{name:"模式",type:"select",val:"ACES_FILMIC",now:"ACES_FILMIC",opts:Object.keys(fs.ToneMappingMode),shortKey:"mode",get:e=>{var t=e.effect;for(const e in fs.ToneMappingMode)if(fs.ToneMappingMode[e]===t.mode)return e},setIsUpdate:!0,isUpdate:!1,set:e=>{var t=fs.ToneMappingMode[e.end];e.target.effect.mode=t}},strength:{name:"强度",setIsUpdate:!0,isUpdate:!1,type:"number",val:1,now:1,min:0,max:2,shortKey:"strength",get:e=>e.runScene.ltPP.composer.getRenderer().toneMappingExposure,set:e=>{e.target.runScene.ltPP.composer.getRenderer().toneMappingExposure=e.end}},middleGrey:{name:"中灰色",setIsUpdate:!0,isUpdate:!1,type:"number",val:.001,now:.001,min:0,max:1,shortKey:"middleGrey",get:e=>e.effect.middleGrey,set:e=>{e.target.effect.middleGrey=e.end}},point:{name:"白点",setIsUpdate:!0,isUpdate:!1,type:"number",val:.01,now:.01,min:2,max:32,shortKey:"point",get:e=>e.effect.whitePoint,set:e=>{e.target.effect.whitePoint=e.end}}};class Du extends Vo{constructor(){super(...arguments),this.name="ToneMapping",this.config=Eu,this.index=4}create(){var e=this.runScene.assetsEx.get().camera;return this.effect=new fs.ToneMappingEffect({resolution:256,whitePoint:16,middleGrey:.6,minLuminance:.01,averageLuminance:.01,adaptationRate:1}),new fs.EffectPass(e,this.effect)}}Du.config=Eu;var Pu=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class ku{constructor(e){this.name="LtPostProcessing",this.ignores=[],this.inited=()=>{var e=this.runScene.assetsEx.get().renderer;e=new fs.EffectComposer(e,{multisampling:e.capabilities.maxSamples,frameBufferType:s.HalfFloatType}),this.composer=e,this.initRenderPass(),this.setSize(this.runScene.renderEx.size),(0,a.mapObj)(ku.needsInit,((e,t)=>{t.needInit&&this.setModuleState(e,!1)}))},this.isRender=!1,this.render=()=>{var e,t=(0,K.F)(this.runScene);this.isRender&&!0!==(null==(e=t.renderConfig)?void 0:e.stop)&&(t.renderConfig.native?(({scene:e,camera:t}=this.runScene.assetsEx.get()),this.runScene.assetsEx.renderer.render(e,t)):null!=(e=this.composer)&&e.render())},this.allPassMap=new m.Z,this.parseModel=e=>{const{data:t,model:n}=e;t.pp&&(0,a.mapObj)(t.pp,((e,t)=>{t&&this.setModel({model:n,type:e,state:t})}))},this.setSize=e=>{var t,{width:e,height:n}=e;null!=(t=this.composer)&&t.setSize(e,n)},this.runScene=e,this._snapshot=new jo({name:this.name,runScene:e,getDiff:e=>{const t={core:{isRender:this.isRender},modules:{}};return this.allPassMap.map(((n,r)=>{r.effect&&(t.modules[n]=Object.assign({enable:r.enable},r.getDiff()),null!=(n=r.onCreateSnapshot)&&n.call(r,e.name))})),t},set:({map:t,data:n})=>{var{core:n,modules:r}=n;r&&(0,a.mapObj)(r,((e,n)=>Pu(this,void 0,void 0,(function*(){const r=this.allPassMap.get(e);r&&n.enable&&r.setDiff({data:n,map:t})})))),n&&e.cb.renderEx.setRenderPipe.cb()}}),this.runScene.cb.inited.add(this.name,this.inited),e.cb.render.add(this.name,this.render),e.cb.model.parse.add(this.name,this.parseModel),e.cb.renderEx.setSize.add(this.name,this.setSize),e.exporter.gltf.options.addOption({type:this.name,subType:"after",parse:t=>{var n;t&&(({core:t,modules:n}=JSON.parse(t)),t&&(t=t.isRender)&&(this.isRender=!0),n&&(0,a.mapObj)(n,((t,n)=>Pu(this,void 0,void 0,(function*(){this.ignores.includes(t)||ku.map[t].parse({data:n,runScene:e,type:t})})))))},process:e=>{const t={core:{isRender:this.isRender},modules:{}};return this.allPassMap.map(((e,n)=>{n=n.toJSON().data,t.modules[e]=n})),JSON.stringify(t)}}),e.cb.clean.add(this.name,(()=>{this.composer.removeAllPasses(),this.initRenderPass()}))}initRenderPass(){var{scene:e,camera:t}=this.runScene.assetsEx.get(),e=new fs.RenderPass(e,t);this.composer.addPass(e,0)}setState(e){this.isRender=e}getPass(e){let t=this.allPassMap.get(e);if(!t){const n=ku.map[e];if(!n)return;t=new n(this.runScene,this),this.allPassMap.set(e,t)}return t}setModuleState(e,t){return Pu(this,void 0,void 0,(function*(){const n=this.getPass(e);n&&(yield n.setState(t),ku.callback.onSetState.cb({type:e,state:t}))}))}setModel(e){var t,n=e.type;(n=this.getPass(n))&&(null!=(t=n.setModel)&&t.call(n,e),this.bindDataForModel(e))}bindDataForModel(e){const{model:t,state:n,type:r}=e;let i=t.userData.pp;i||(t.userData.pp=i={}),i[r]=n}hasModel(e){var{model:e,type:t}=e;return null==(e=null==(e=null==e?void 0:e.userData)?void 0:e.pp)?void 0:e[t]}getPassState(e){return(null==(e=this.allPassMap.get(e))?void 0:e.enable)||!1}}ku.map={SelectiveBloom:Mu,Outline:ll,ToneMapping:Du,BrightnessContrast:Zo,HueSaturation:Qo,Sun:il,Moon:sl,Lut:nl,DOF:Xo,SSAO:_u},ku.needsInit={SelectiveBloom:Mu,Outline:ll},ku.callback={onSetState:new d.Z};class Ou{constructor(){this.list={},this.$emit=this.emit,this.$on=this.on}on(e,t){this.list[e]=t}emit(...e){if(void 0!==this.list[e[0]])return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)));console.log("请先挂载在使用")}off(e){this.list[e]&&delete this.list[e]}}const Au=l.Z,Cu=class{constructor(e){this._clock=new s.Clock,this.cb=new sr(this),this.script=new Ao(this),this.uniqueEx=new Ye.ZP(this),this.fileEx=new vs(this),this.snapshot=new nn.ZP(this),this.undoEx=new Fo.ZP(this),this.textureEx=new gn.default(this),this.controlsEx=new fr(this),this.assetsEx=new v(this),this.renderEx=new Mo.ZP(this),this.events=new class{constructor(e){this.key=new mr(this),this.mouse=new x(this),this.model=new gr(this),this.addEvent=e=>{const{dom:t,name:n,fn:r}=e,i=(0,K.F)(this.runScene).renderConfig;t.addEventListener(n,(e=>{!i.event.trigger||i.event.ignores.includes(n)||r(e)}))},this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),this.addEvent({dom:window,name:"resize",fn:()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}})}}(this),this.multipSelector=new Ts(this),this.helperEx=null,this.materialEx=new et.default(this),this.cameraEx=new Pt.Z(this),this.sceneEx=new hr.ZP(this),this.modelEx=new c.default(this),this.loaderer=new o.Z(this),this.exporter=new Xi(this),this.lightEx=new bs.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.idMap=new m.Z,this.animaMap={},this.groupMap={},this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"timeline",map:{parse:e=>Promise.all(e.childs.map((e=>this.playGroup(e))))}})},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var n,r,i=((e,t)=>{let n=-1,r=1e3;const i=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==i.length&&(i.map(((e,i)=>{e=Number(e),0<(e=t-e)&&e<r&&(r=e,n=i)})),-1!==n)){var a=i[n],s=i[n+1],o=e[a];if(e=e[s],o&&e){var l=Object.values(o)[0],u=Object.values(e)[0];if("notNow"!==l&&"notNow"!==u)return{left:o,right:e,progress:(t-Number(a))/(Number(s)-Number(a))}}}})(e.data,t);i&&(({left:i,right:n,progress:r}=i),e.setTargetByBetween(i,n,r))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new Io(e),this.multi=new Uo(e),this.initSnapshot(),e.cb.inited.add("timeline",this.onInited),this.runScene.cb.scene.validCloseUpdate.add("timeline",(()=>0===Object.keys(this.animaMap).length))}initSnapshot(){const e="time-line";let t={};this.runScene.cb.snapshot.beforeCreate.add(e,(()=>{(0,a.mapObj)(this.groupMap,((e,n)=>{t[e]=n.run,n.run&&(this.closeGroup(e),this.toLeft(n))}))})),this.runScene.cb.snapshot.create.add(e,(n=>{0!==(0,Ro.objLength)(t)&&((0,a.mapObj)(t,((e,t)=>{t&&this.playGroup(e)})),n.data.set(e,(0,b.Cl)(t)))})),this.runScene.cb.snapshot.delUseless.add(e,(t=>{(0,a.mapObj)(t,((t,n)=>{const r=n.data[e];r&&((0,a.mapObj)(r,(e=>{this.groupMap[e]||delete r[e]})),0===(0,Ro.objLength)(r)&&delete n.data[e])}))})),this.runScene.cb.snapshot.set.add(e,(t=>{const n=t.snapshot.data.get(e);n&&!t.ignoreModules.includes(e)&&t.data.completedCbs.push((()=>{(0,a.mapObj)(n,((e,t)=>{this[t?"playGroup":"closeGroup"](e),t||this.resetGroup(e)}))}))})),this.runScene.cb.snapshot.getLength.add(e,(t=>{var n=t.data.data.get(e);n&&(t.inputData[e]=Object.keys(n).length)})),this.runScene.cb.snapshot.getByType.add(e,(({})=>{})),this.runScene.cb.snapshot.resetItem.add(e,(({targets:t,type:n,datas:r})=>{n===e&&t.map((t=>{const{run:n,name:i}=t;r.map((t=>{const r=t.data;let a=r.get(e);(a=a||{})[i]=n,r.set(e,a)}))}))})),this.runScene.cb.snapshot.parseJSON.add(e,(t=>{t.map(((t,n)=>n.data.get(e)))}))}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,n;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:n}=this.timerMap[e]),t&&clearInterval(t),n&&clearInterval(n)),this.groupMap[e].run=!1;const r=this.animaMap[e];r&&r.length&&r.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const n=this.animaMap[e];n&&n.length&&n.map((n=>{const{controls:r,promise:i}=n;r.run=!0,i.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,n;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:n}=this.timerMap[e]),t&&clearInterval(t),n&&clearInterval(n)),this.groupMap[e]&&(this.groupMap[e].run=!1),this.runScene.cb.timeLine.closeGroup.cb(e);const r=this.animaMap[e];r&&r.length&&r.map((e=>{e.controls.clean=!0})),delete this.animaMap[e]}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb({pgs:0,groupName:e}),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,a.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}getSavedByModel(e){const t=[],n=(e.children.map((e=>e.traverse((e=>{t.push((0,Ye.Ki)(e))})))),{});return(0,a.mapObj)(this.groupMap,((e,r)=>{for(const i in r.data)t.includes(i)&&(n[e]||(n[e]=Object.assign(Object.assign({},r),{data:{}})),n[e].data[i]=r.data[i]);r.run=!1})),n}parseSavedGroupMapForTargetMap(e,t,n){const r=[];Object.keys(e).map((i=>{const s=e[i],o={};(0,a.mapObj)(s.data,((e,n)=>{var{type:n,data:i,copyId:a}=n;const s=Bo[n];if(n=t[e]){const t=new s(n,this.runScene);t.data=i,o[e]=t,a&&r.push({ins:t,id:a}),this.idMap.set(e,t)}})),s.data=o,!n&&this.groupMap[i]?this.groupMap[i].data=Object.assign(Object.assign({},this.groupMap[i].data),s.data):this.groupMap[i]=s,this.runScene.cb.timeLine.setGroupMap.cb({group:this.groupMap[i],groupName:i})}))}parseSavedGroupMap(e){const t=[];Object.keys(e).map((n=>{const r=e[n],i={};(0,a.mapObj)(r.data,((e,n)=>{var{type:n,data:r,copyId:a}=n;const s=Bo[n];if(n=s.getTarget(e,this.runScene)){const o=new s(n,this.runScene);o.data=r,i[e]=o,a&&t.push({ins:o,id:a}),o.data?this.idMap.set(e,o):o.data={}}})),r.data=i,this.groupMap[n]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:n})})),t.map((({ins:e,id:t})=>{let n=this.idMap.get(t);n?(e.data=n.data,e.copyId=t,n.usedIds.add(e.uuid)):e.data={}}))}playGroup(e,t){const n=(0,b.Gm)({onlyReverse:!1},t).onlyReverse,r=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(r&&!r.run){this.runScene.cb.timeLine.playGroup.cb({groupName:e}),r.run=!0;const i=Object.keys(r.data);let s=0;const o={promises:[],allTime:s=n?r.time*r.speed:r.time*r.speed*(r.reverse?2:1),pgs:e=>{}},l=i.map((e=>{const t=r.data[e];if(n)return t.getAnima({group:r,reverse:!0,inputData:o});const i=t.getAnima({group:r,inputData:o});return r.reverse&&(e=t.getAnima({group:r,reverse:!0,inputData:o}),i.push(...e)),i}));l.push([()=>{let n;return{promise:new Promise((i=>{n=(0,b.gY)({pgs:0},{pgs:1},.001*s,(t=>{this.groupMap[e].run&&this.runScene.cb.timeLine.setProgress.cb({pgs:t.pgs,groupName:e})}),(()=>{var n;if(r.run){if(r.run=!1,r.loop)return null!=(n=null==t?void 0:t.onOnceDone)&&n.call(t),this.playGroup(e);null!=(n=null==t?void 0:t.onDone)&&n.call(t),null!=(n=null==t?void 0:t.onOnceDone)&&n.call(t),this.runScene.cb.timeLine.onDone.cb(),i(0)}}))})),anima:n}}]),this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=l.map((e=>(0,a.eachTriggerArrGetControls)(e)))}}setInsForIdMap(e){this.idMap.set(e.uuid,e)}getInsByUuid(e){return this.idMap.get(e)}toLeft(e){Object.values(e.data).map((e=>{var t=Object.values(e.data);t[0]&&e.setTargetByBetween(t[0],t[1]||t[0],0)}))}toRight(e){Object.values(e.data).map((e=>{var t=Object.values(e.data).reverse();t[0]&&e.setTargetByBetween(t[0],t[1]||t[0],100)}))}closeAll(){(0,a.mapObj)(this.groupMap,((e,t)=>{t.run&&(this.closeGroup(e),this.resetGroup(e))}))}}(this),this.anima=new h(this),this.tags=new Co(this),this.globalConfig=new ys(this),this.pp=new To(this),this.objects=new Ms(this),this.code=new Eo.Z(this),this.custom={},this.msg=new nr(this),this.size=new rr(this),this.run=new Ss(this),this.graph=new zn(this),this.ltPP=new ku(this),this.inited=!1,this.isExporter=!1,this._renderLimit=new b.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx.get(),{scene:n,camera:r,controls:i}=this.assetsEx.get();this.cb.render.cb(),null!=t&&t.render(n,r),null!=e&&e.render(n,r),"tick"===this.optionsEx.options.renderConfig.mode&&i.update(),this.cb.renderEx.after.cb({time:this._clock.getDelta()})},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const n=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){n()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new K.Z(this,e)}initLibs(e){if(!this.inited){this.optionsEx.init(e),this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new ws(this);const{camera:t,controls:n}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),n.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb()}}init(e){return this.initLibs(e),this}load(e){const{path:t,dom:n,loadConfig:r}=e;return this.init(n),this.loadScene(t,r).then((({models:e})=>{var t,n;0!==(null==e?void 0:e.length)&&(this.modelEx.add(e,void 0,{isScene:!0}),this.cb.load.modelAdded.cb({models:e}),null!=(t=null==(n=null==r?void 0:r.callBack)?void 0:n.loaded)&&t.call(n),null!=(n=(t=this.cb.load.loaded).cb)&&n.call(t,{models:e}))})),this}loadScene(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:n,progress:r,complete:a}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:{getJSON:e=>{var r,i;null!=(i=null==(r=null==t?void 0:t.callBack)?void 0:r.getJSON)&&i.call(r,e),n.cb(e)},progress:e=>{var n,i;null!=(i=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&i.call(n,e),r.cb(e)},complete:e=>{var n,r;null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.complete)&&r.call(n,e),a.cb(e),this.render()}},triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield i().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let n=t/e;1<(n=n<0?0:n)&&(n=1),t=Number(n.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,a.getId)(),t),this}setSize(e,t){const{render2:n,render3:r}=this.assetsEx.get(),i=this.assetsEx.get().renderer;this.cameraEx.setSize(),r&&r.setSize(e,t),n&&n.setSize(e,t),i.setSize(e,t,!0),i.setPixelRatio(this.renderEx.pixelRatio),this.assetsEx.engineDom.style.width=e+"px",this.assetsEx.engineDom.style.height=t+"px",this.pp.setSize(e,t)}clean(){this.cb.clean.cb()}get(e){return this.modelEx.getModel(G.F6.toArr(e))}updateFrame(){this.cb.render.cb()}setUpdate(e=!0,t="model"){this.cb.setUpdate.cb({state:e,mode:t})}updateShadow(){this.renderEx.shadowManager.render()}}},3736:(e,t,n)=>{n.d(t,{ZP:()=>T,bv:()=>k,is:()=>P,UE:()=>D,qh:()=>O,M:()=>M});var r=n(6001),i=n(5521),a=n(135),s=n(3924),o=n(3228),l=n(1794),u=n(2233),c=n(5124);class d{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,n,r,i,a,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:n,controls:r,tags:i,envStrength:a,objects:s}=e.asset.ex),void 0!==a&&this.runScene.sceneEx.setEnvStrength(a),this.parse.camera(t,o),e&&this.parse.light(e,o,l),this.parse.controls(r,o),o.module.tags&&this.runScene.tags.parseJSON(i||{}),this.parse.options(n,"before"),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:n,data:r,config:i}=e;if("scene"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:a}=r;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...a.animations]}this.parse.options(n.asset.ex.options,"after"),t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(n,i,t),t.models.push(...e)}},controls:(e,t)=>{var n;t.module.controls&&e&&(({x:t,y:e,z:n}=e),this.runScene.assetsEx.controls.target.set(t,e,n),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let c=e;e.temp&&(c=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:n,fov:r,name:i,userData:a,rotation:s}=this.runScene.loaderer.object.parse(c);const d=this.runScene.assetsEx.get().camera;var o=(0,u.Ki)(d);d.position.copy(t),d.far=e,d.near=n,d.fov=r,d.name=i,d.updateProjectionMatrix(),d.userData.id=a.id,this.runScene.uniqueEx.model.add(d,{oldId:o}),this.runScene.uniqueEx.model.nameMap.PerspectiveCamera=a.id,d.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,n)=>{if(t.module.light){const t=[];e.map((e=>{var n=e.type;t.push(...this.runScene.lightEx.lightExMap[n].parseJSON(e))})),n.models.push(...t)}},scene:(e,t,n)=>{if(t.module.sceneConfig){const u=this.runScene.sceneEx.get();t=n.module.get("material").data.materialIns;var{materialId:n,backgroundMapping:e,backgroundColor:r,fog:a,backgroundIntensity:s,backgroundBlurriness:o,cssBgc:l}=e.asset.ex.sceneEx;if(n&&(n=null==(t=t[n])?void 0:t.material)){const{map:t,envMap:r,normalMap:i}=n;i&&(0,c.F)(this.runScene).camera.showBackground&&this.runScene.cameraEx.setBackgroundTexture(i),t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0,void 0!==o&&(u.backgroundIntensity=o),void 0!==s&&(u.backgroundIntensity=s)),r&&this.runScene.sceneEx.setEnv(r)}if(l&&this.runScene.sceneEx.setCssBgc(l),r&&this.runScene.sceneEx.setBackground(new i.Color("#"+r)),a){const{color:e,far:t,near:n,show:r}=a,s=new i.Fog(e.includes("#")?e:"#"+e,n,t);!1===r?this.runScene.sceneEx.oldFog=s:u.fog=s,s.show=r,this.runScene.cb.setScene.cb({scene:u,type:"fog",val:s})}this.runScene.cb.setScene.cb({scene:u,type:"any",val:"any"})}},options:(e,t="before")=>{e.map((e=>{var{type:e,data:n}=e;const r=this.runScene.exporter.gltf.options.getParse(e);r.subType?r.subType===t&&null!=r&&r.parse(n,t):"after"!==t&&null!=r&&r.parse(n,t)})),this.runScene.cb.exporter.gltf.options.afterParse.cb()}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=n(7201),p=n(9151),f=n(9663),m=n(6272);class g{constructor(e){this.create=e=>{var t=this.getDiff();0!==(0,h.objLength)(t)&&e.data.set("scene",t)},this.set=e=>{const t=e.snapshot.data.get("scene");if(t&&!e.ignoreModules.includes("scene")){const{fog:u,bgc:c,env:d,bgcm:h,envS:g,tm:v,oe:y,tme:b,cssBgc:x}=t,{scene:w,renderer:S}=this.runScene.assetsEx.get(),{animas:_,completedCbs:T}=e.data;var n,r,s,o,l;if(e=w.background,this.runScene.sceneEx.setEnvStrength(void 0!==g?g:1),void 0!==v&&(S.toneMapping=v),void 0!==y&&this.runScene.renderEx.setEncoding(3e3===y?"def":"srgb"),void 0!==b&&(S.toneMappingExposure=b),c){const{type:t,data:n}=c;if("color"===t)(0,m.Ft)(e)||(0,a.isColor)(e)?this.runScene.sceneEx.setBackground(new i.Color(n)):(0,p.isTexture)(e)&&T.push((()=>{this.runScene.sceneEx.setBackground(new i.Color(n))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(c.data);e&&(0,p.setTextureMapping)(e,303===h?"repeat":"normal"),T.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else x&&this.runScene.sceneEx.setCssBgc(x);T.push((()=>{w.environment=this.runScene.uniqueEx.texture.get(null==d?void 0:d.data)})),w.fog&&u&&(({color:e,near:n,far:r}=u),({color:l,near:s,far:o}=w.fog),e!==(l=(0,f.J6)(l))&&_.push({target:w,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==n&&_.push({target:w,label:["fog","near"],begin:s,end:n,type:"number",isUpdate:!0}),o!==r&&_.push({target:w,label:["fog","far"],begin:o,end:r,type:"number",isUpdate:!0})),T.push((()=>{w.fog=u?D(u):null})),T.push((()=>{this.runScene.cb.setScene.cb({scene:this.runScene.assetsEx.get().scene,type:"any",val:"any"})}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){let e={};var t,n=((n=this.runScene.sceneEx.getJson("fog"))&&(e.fog=n),this.runScene.sceneEx.getJson("background")),{scene:r,renderer:t}=this.runScene.assetsEx.get();return void 0!==(e.tm=t.toneMapping,e.oe=t.outputEncoding,e.tme=t.toneMappingExposure,e.cssBgc=this.runScene.sceneEx.cssBgc,n&&"texture"===(e.bgc=n).type&&303===r.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),n=this.runScene.sceneEx.getEnvStrength())&&1!==n&&(e.envS=n),e}}var v=n(3735),y=n(2510),b=n(7169),x=n(272),w=n(158),S=n(960),_=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class T{constructor(e){this.updateCbMap={open:new x.Z,onlyRender:new x.Z},this.autoOpenUpdate=()=>{var e=this.get();e&&(this.setUpdate(e,!0),this.staticMode&&this.autoCloseUpdate(e))},this.autoCloseUpdate=(0,r.fnDebounce)((e=>{this.setUpdate(e,!1)}),100),this.oldFog=null,this.staticMode=!0,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.clean=()=>{this.cleanSceneInfo(this.get()),this.cleanNormal(),this.clearCssBgc()},this.envStrength=1,this.runScene=e,this.exportAndImport=new d(e),this.snapshot=new g(e),this.runScene.cb.clean.add("EngineScene",this.clean),this.updateCbMap.open.add(this.runScene.cb.tranControls.changing),this.updateCbMap.open.add(this.runScene.cb.undo.addRedus),this.updateCbMap.open.add(this.runScene.cb.undo.addUndos),this.updateCbMap.open.add(this.runScene.cb.undo.undo),this.updateCbMap.open.add(this.runScene.cb.undo.redo),this.updateCbMap.open.add(this.runScene.cb.timeLine.onSetProgress),this.updateCbMap.open.add(this.runScene.cb.timeLine.playGroup),this.updateCbMap.open.add(this.runScene.cb.snapshot.set),this.updateCbMap.open.add(this.runScene.cb.renderEx.fristFrame),this.updateCbMap.open.add(this.runScene.cb.loaderer.gltf.modelAdded),this.updateCbMap.open.add(this.runScene.cb.load.modelAdded),this.updateCbMap.open.add(this.runScene.cb.model.setVisible),this.updateCbMap.open.add(this.runScene.cb.anima.play),this.updateCbMap.open.add(this.runScene.cb.anima.close),this.updateCbMap.onlyRender.add(this.runScene.cb.events.mouse.wheel),this.runScene.cb.setUpdate.on((({state:e})=>{var t=this.get();t&&(e?this.autoOpenUpdate():this.autoCloseUpdate(t))}))}setUpdateMatrix(e){this.staticMode=!e,this.autoOpenUpdate()}init(){this.exportAndImport.init(),this.updateCbMap.open.map((e=>{(0,w.FW)(this.runScene).renderConfig.static&&this.staticMode&&e.add("EngineScene",this.autoOpenUpdate),e.add("EngineScene",this.runScene.renderEx.shadowManager.render)})),this.updateCbMap.onlyRender.map((e=>{(0,w.FW)(this.runScene).renderConfig.static&&this.staticMode&&e.add("EngineScene",this.autoOpenUpdate)}))}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}setStatic(e){this.staticMode=e}get(){return this.runScene.assetsEx.get().scene}getNromal(){return this.get().children.filter((e=>this.isNromal(e)))}isNromal(e){return e.isNormal?e.isNormal():!this.runScene.helperEx.isHelper(e)}getEnvStrength(){return this.envStrength}setUpdate(e,t){if((0,w.FW)(this.runScene).renderConfig.static&&!t&&this.staticMode)for(const e of this.runScene.cb.scene.validCloseUpdate.cb())if(!e)return}remove(e){if(e){const t=[];return this.runScene.helperEx.unfocus(),S.F6.toArr(e).map((e=>{for(const t of this.runScene.cb.model.validRemove.cb({model:e})||[])if(!t)return;for(const n in this.removeMap){const{valid:i,remove:a}=this.removeMap[n];if(i(e))return t.push(...(0,r.multiArrToArr)(a(e)))}t.push(new b.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){var t=e.slice(0,1);let n=[];if(":"!==t&&":"!==t)return this.runScene.uniqueEx.model.findModelWithName(e);{const[t,r]=e.slice(1).split("=");return t?this.runScene.uniqueEx.model.find((({model:e,type:n})=>"lock"===t?s.lockModel.isLock(e):"dynamic"===t?s.dynamicModel.isDynamic(e):"type"===t?r===n:void 0)):n}}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){this.runScene.isExporter=!0;const e=this.get(),t=new i.Group,n=e.children.filter((e=>{var t=!!e.isModelBase&&e.isHelper();return!this.runScene.helperEx.isHelper(e)&&s.normalModel.is(e)&&!0!==t}));return n.map((e=>{const n=e.clone();(0,s.withAnima)(e)&&(n.animations=[...e.animations]),t.add(n)})),this.runScene.helperEx.setHelper(t),this.runScene.isExporter=!1,this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return _(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e));var n=this.get(),r=((0,p.isTexture)(e)&&(e.userData.isBackgroud=!0,this.runScene.cb.texture.setMaterial.cb({target:this.runScene.assetsEx.scene,targetType:"scene",type:"background",val:e,oldVal:(0,p.isTexture)(n.background)?n.background:null})),new y.Z({target:n,info:"background",newVal:e,oldVal:n.background,runScene:this.runScene,cb:e=>{}}).execute());return t&&this.runScene.undoEx.addUndo(r),this.runScene.cb.setScene.cb({scene:n,type:"background",val:n.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.sH)(e),t.dispose(),this.runScene.pp.dispose(),i.Cache.clear()}render(){}create(){var e=new i.Scene;return this.setUpdate(e,!1),(0,u.x)(e,(0,r.getId)()),e}setEnv(e){return _(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.get().scene,n=t.environment;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e,{isEnv:!0})),e instanceof File&&(r=yield this.runScene.textureEx.parse(e,{isEnv:!0})),null!=e&&e.isTexture&&(r=this.runScene.textureEx.getSameTexture(e.userData.md5,e)||this.runScene.textureEx.clone(e),this.runScene.cb.texture.setMaterial.cb({target:this.runScene.assetsEx.scene,targetType:"scene",type:"env",val:r,oldVal:n})),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:n,val:r}=e;e=new y.Z({target:e,info:n,oldVal:e[n],newVal:r,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx.get();this.cubeRT||(this.cubeRT=new i.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new i.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new i.Mesh(new i.SphereGeometry(15,32,16),new i.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}set(e,t){"background"===e?this.setBackground(t):"env"===e&&this.setEnv(t)}setFogShow(e){var t=this.runScene.assetsEx.get().scene,{show:e,color:n}=e;if(e){let e=this.oldFog||new i.Fog(n||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.get().scene,{type:e,val:n,cb:r}=e;t=new v.Z({target:t,typeList:["fog",e],newVal:n,cb:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t,n){n=(n||{}).type,e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:i,height:a}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const s=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.helperEx.setState(!1),this.runScene.cb.resize.cb({width:e,height:t}),this.runScene.updateFrame(),e=s.toDataURL(n||"image/png",1),t=(0,r.base64ToFile)(e,"screenShot.png"),this.runScene.helperEx.setState(!0),this.runScene.cb.resize.cb({width:i,height:a}),this.runScene.updateFrame(),t}getJson(e){let t;var n=this.runScene.assetsEx.get().scene;if("fog"===e){var r=n.fog;r&&(t=E(r,null!==n.fog))}else if("background"===e){if(!n.background)return;t={type:(r=(0,a.isColor)(n.background))?"color":"texture",data:(r?f.J6:u.Ki)(n.background)}}else if("environment"===e){if(!n.environment)return;t={type:"texture",data:(0,u.Ki)(n.environment)}}return t}static toJSON(e,t){const n={};let r=!1,i=e.fog;return i?r=!0:i=t.sceneEx.oldFog,i&&(n.fog=E(i,r)),(0,a.isColor)(e.background)?n.backgroundColor=e.background.getHexString():(0,p.isTexture)(e.background)&&(e.backgroundIntensity&&(n.backgroundIntensity=e.backgroundIntensity),e.backgroundBlurriness&&(n.backgroundBlurriness=e.backgroundBlurriness)),t.sceneEx.cssBgc&&(n.cssBgc=t.sceneEx.cssBgc),t.sceneEx.staticMode||(n.staticMode=0),n}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}setCssBgc(e){this.setBackground(null);var{color1:e,color2:t,deg:n,percent:r}=e,i=`linear-gradient(${n}deg,${e}, ${r}%,${t} )`;this.cssBgc={color1:e,color2:t,percent:r,deg:n},this.runScene.assetsEx.renderer.domElement.style.background=i}clearCssBgc(){this.cssBgc=void 0,this.runScene.assetsEx.renderer.domElement.style.background=""}}const M=(e,t,n)=>{e.userData[t]=n},E=(e,t)=>{var{color:e,far:n,near:r}=e;return{color:(0,f.J6)(e),show:t,far:n,near:r}},D=e=>{var{color:e,far:t,near:n}=e;return new i.Fog(e,n,t)},P=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",k=(e,t)=>{delete e.userData[t]},O=e=>{M(e,"id",(0,r.getId)())}},1398:(e,t,n)=>{n.d(t,{LV:()=>m,ZP:()=>f,cI:()=>h});var r=n(6001),i=(t=n(7995),n(960)),a=n(1794),s=n(7201),o=n(5124),l=n(9151),u=n(2233),c=n(5317),d=n(9663);const h=["light","material","model","sky","scene","texture","time-line"],p=["number","color","color_obj","color_str","v2","v3"];class f{constructor(e){this.map=new a.Z,this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"snapshot",map:{parse:e=>Promise.all(e.childs.map((e=>new Promise((t=>{this.set(e,{onDone:()=>{t(0)}})})))))}}),this.runScene.run.options.add("snapshot",{set:e=>Promise.all(e.map((e=>this.set(e))))})},this.playing=new a.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>{const e={};(0,r.mapObj)(this.map.toJSON(),((t,n)=>{var{name:n,time:r,data:i}=n;e[t]={name:n,time:r,data:i}}));var t=JSON.stringify(e);return t=JSON.parse(t),this.runScene.cb.snapshot.delUseless.cb(t),JSON.stringify(t)},this.parseJSON=e=>{const t=a.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=a.Z.formJSON(t.data)})),this.map=t,this.runScene.cb.snapshot.parseJSON.cb(this.map)},this.clean=()=>{this.map.clear(),f.callback.changed.cb()},this.trans={set:(e,t)=>{var n,r,i,a,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(i=(0,d.sS)(e.begin),n=(0,d.sS)(e.end),a=o+"_"+t+"_r",s=o+"_"+t+"_g",r=o+"_"+t+"_b",l.begin.push({type:a,data:i.r}),l.begin.push({type:s,data:i.g}),l.begin.push({type:r,data:i.b}),l.end.push({type:a,data:n.r}),l.end.push({type:s,data:n.g}),l.end.push({type:r,data:n.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(i=o+"_"+t+"_x",a=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:i,data:e.begin.x}),l.begin.push({type:a,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:i,data:e.end.x}),l.end.push({type:a,data:e.end.y})),l},getKey(e){let t=[];var{unique:n,type:r}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===r||"v3"===r?(t.push(e+"_"+n+"_x"),t.push(e+"_"+n+"_y"),t.push(e+"_"+n+"_z")):"color"===r||"color_obj"===r||"color_str"===r?(t.push(e+"_"+n+"_r"),t.push(e+"_"+n+"_g"),t.push(e+"_"+n+"_b")):"number"===r&&t.push(e+"_"+n),t},update:(e,t)=>{var n;const i=this.trans.getKey(e);let a=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,r.lastArrayEle)(e.label),a=(0,r.objLastMap)(e.target,e.label)),t[i[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},i.map((e=>{var[,,n]=e.split("_");e=t[e]/255,o[n]=e}))):"color_str"===e.type?o="#"+i.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},i.map((e=>{var[,,n]=e.split("_");o[n]=t[e]})));var u={target:a,data:o,type:l,runScene:this.runScene};null!=(n=e.onUpdate)&&n.call(e,u),null!=(n=e.onAnimaUpdate)&&n.call(e,u)},exec:(e,t)=>{var n;const i=this.trans.getKey(e);let a=e.target,s=e.label;e.label instanceof Array&&(s=(0,r.lastArrayEle)(e.label),a=(0,r.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?i.map((e=>{var[,,n]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[s][n]=e})):"number"===e.type?a[s]=t[i[0]]:"v2"!==e.type&&"v3"!==e.type||i.map((e=>{var[,,n]=e.split("_");a[s][n]=t[e]}));var o={target:a,data:e,type:e.type,runScene:this.runScene};null!=(n=e.onAnimaUpdate)&&n.call(e,o)}},this.getLengthByName=e=>{var t;if(e=this.map.get(e))return t={},this.runScene.cb.snapshot.getLength.cb({data:e,inputData:t}),t},this.runScene=e}init(){this.runScene.exporter.gltf.options.addOption({type:"snapshot",process:this.toJSON,parse:this.parseJSON}),this.runScene.cb.clean.add("snapshrot",this.clean),this.runScene.cb.inited.add("snapshot",this.onInited),this.runScene.cb.scene.validCloseUpdate.add("snapshot",(()=>0===this.playing.size)),f.callback.changed.add("snapshot",(e=>{e&&(this.bindBlob(e.name),f.callback.changed.cb())})),this.runScene.cb.exporter.gltf.assets.bindTexture.add("snapshot",(({map:e,opts:t})=>{if(!1!==(null==(t=null==(t=null==(t=null==t?void 0:t.config)?void 0:t.export)?void 0:t.snapshot)?void 0:t.screenshot)&&"editor"===(0,o.F)(this.runScene).mode)return this.map.map(((t,n)=>{var r;n.blob&&(r=(0,l.getTextureForEmpty)(),(0,l.setTextureBlob)(r,n.blob),(0,l.setTextureToSave)(r),n=l.textureTypeId.set({texture:r,type:"snapshot-texture",subType:n.name}),e.set(n,r))})),Promise.resolve()})),this.runScene.cb.texture.onLoaded.add("snapshot",(e=>{var t;if(t=l.textureTypeId.get(e)){var{type:t,subType:n}=t;if("snapshot-texture"===t){const t=this.map.get(n);t&&(t.blob=e.texture.userData.blob,t.url=URL.createObjectURL(t.blob),l.textureAssets.set(e.texture,!0),f.callback.changed.cb())}}}))}bindBlob(e,t){var n=this.runScene.renderEx.getDomSize();n=this.runScene.sceneEx.sreenShotDefFile(.5*n.width,.5*n.height,{type:"image/webp"});const r=t||this.map.get(e);r&&(t=URL.createObjectURL(n),r.blob=n,r.url=t)}create(e){this.runScene.cb.snapshot.beforeCreate.cb();var{name:e,time:t}=e,t=(this.map.get(e)&&this.del(e),{name:e,time:t,data:new a.Z});return this.bindBlob(e,t),this.runScene.cb.snapshot.create.cb(t),t}resetItem(e){const{targets:t,names:n,type:r}=e;e=n.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:r})}rmItem(e){const{targets:t,names:n,type:r}=e;e=n.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.rmItem.cb({targets:t,datas:e,type:r})}add(e){var t=this.create(e);return this.map.set(e.name,t),f.callback.changed.cb(),t}addByType(e){var{name:t,time:n,targets:r,type:i}=e,t={name:t,time:n,data:new a.Z};return this.runScene.cb.snapshot.getByType.cb({type:i,data:t,targets:r}),this.map.set(e.name,t),t}set(e,t){return new Promise((n=>{var r=this.map.get(e);const{animaTime:i,isLinear:a,onDone:s,ignoreModules:o}=Object.assign({animaTime:-1,ignoreModules:[]},t);if(!r)return n();const l={animas:[],completedCbs:[]};if(this.runScene.cb.snapshot.set.cb({snapshot:r,data:l,ignoreModules:o}),0===l.animas.length)return 0===l.completedCbs.length||l.completedCbs.map((e=>e())),n(null==s?void 0:s());this.anima(e,l,{animaTime:-1===i?r.time:i,isLinear:a,onDone:()=>{n(null==s?void 0:s())}})}))}del(e){var t=this.map.get(e);t&&(this.runScene.cb.snapshot.delete.cb({name:e,data:t}),f.callback.changed.cb())}anima(e,t,n){var i;if(this.runScene.modelEx.selectNull(),null==(i=this.playing.get(e))||!i.animaIns){const i=new a.Z,s={},o={},{animaTime:l,isLinear:u,onDone:d}=n,h={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:n,end:r}=this.trans.set(e,t);n.map((e=>s[e.type]=e.data)),r.map((e=>o[e.type]=e.data)),i.set(t,Object.assign({unique:t},e))})),h.animaIns=(0,c.anima)(s,Object.assign(Object.assign({},o),{ease:u?"none":"easeOut"}),l,(e=>{(0,r.mapObj)(e,(t=>{var[,t]=t.split("_");(t=i.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{h.data.completedCbs.map((e=>e())),this.close(e),this.runScene.cb.snapshot.onDone.cb(),null!=d&&d()})),this.playing.set(e,h)}}close(e){var t;const n=this.playing.get(e);return!!n&&(null!=(t=n.animaIns)&&t.kill(),n.animaIns=null,this.playing.delete(e),!0)}closeAll(){this.playing.map(((e,t)=>{var n;t&&null!=(n=t.animaIns)&&n.kill(),t.animaIns=null})),this.playing.clear()}parseNromal(e,t){const{animas:n,completedCbs:i}=t.data,{target:a,type:s,begin:o,end:l,set:u,label:d,onUpdate:h,isUpdate:f,setIsUpdate:m,onAnimaUpdate:g}=e;if((0,c.isDef)(o,l))if(p.includes(s))n.push({target:a,type:s,begin:o,end:l,label:d,isUpdate:!1!==f&&void 0===h,onAnimaUpdate:g,onUpdate:(null!=h?h:m)?e=>{null!=u&&u(Object.assign(Object.assign({},e),{begin:e.data,end:e.data}))}:void 0,set:u});else if(u)u({target:a,begin:o,end:l});else{let e=a,t=d;d instanceof Array&&(e=(0,r.objLastMap)(a,d),t=(0,r.lastArrayEle)(d)),"texture"===s?e[t]=l:i.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:n,target:r,create:i,set:a}=e;this.runScene.cb.snapshot.create.add(t,i||(e=>{var i=m.getDiff(n,r);0!==(0,s.objLength)(i)&&e.data.set(t,i)})),this.runScene.cb.snapshot.set.add(t,a||(e=>{var i=e.snapshot.data.get(t);i&&m.set({def:n,runScene:this.runScene,data:i,target:r,map:e})}))}}f.callback={changed:new t.Z};const m={toNormal(e){var t,{type:e,val:n}=e;let r=n;return"color"===e?r=(0,d.Lv)(n):"color_obj"===e?r=n:"color_str"===e?r=(0,c.MyHextoRgb)(n,!0):"texture"===e?(0,l.isTexture)(n)&&(r=(0,u.Ki)(n)):"v3"!==e&&"v2"!==e||(({x:e,y:n,z:t}=n),r={x:e,y:n,z:t}),r},parse(e){const{type:t,val:n,runScene:r}=e;let a=n;return"color"===t?a=i.YD.is(n)?n:(0,c.HextoRgb)(n,!0):"color_obj"===t?a=n:"color_str"===t&&(a=i.YD.is(n)?n:(0,c.HextoRgb)(n,!0)),"texture"===t&&null!==n?r.uniqueEx.texture.get(n):a},getDiff(e,t){let n={};return(0,r.mapObj)(e,((e,i)=>{const{label:a,get:s}=i;let o=t[e];s?o=s(t):a&&(o=(0,r.objLastMap)(t,a)[(0,r.lastArrayEle)(a)]),n[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),n),((t,n)=>{var{shortKey:r,type:i}=e[t];return{k:r||t,v:m.toNormal({type:i,val:n})}}))},set(e){const{def:t,data:n,target:i,runScene:a,map:s}=e;(0,r.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:d,label:h,onUpdate:p,get:f,set:g,isUpdate:v,setIsUpdate:y,onAnimaUpdate:b}=t;t=null!=u?u:e;let x=i,w=e;h&&(x=(0,r.objLastMap)(i,h),w=(0,r.lastArrayEle)(h)),e=m.toNormal({type:o,val:f?f(x):x[w]}),t=m.parse({type:o,val:void 0!==n[t]?n[t]:l,runScene:a}),(0,c.isDef)(e,t)&&(null!=d&&d({target:x,begin:e,end:t}),a.snapshot.parseNromal({target:x,label:w,type:o,set:g,begin:e,end:t,onUpdate:p,isUpdate:v,setIsUpdate:y,onAnimaUpdate:b},s))}))}}},9151:(e,t,n)=>{n.r(t),n.d(t,{bindTextureBaseData:()=>F,constTextureAnimaFrame:()=>Ae,createDefTexture:()=>ge,createImgBItMapForArrayBuffer:()=>be,createImgBItMapForBlob:()=>xe,createScreenForTexture:()=>Se,cubeTextureStrs:()=>ce,defExportTextureUserData:()=>D,default:()=>k,disposeTexture:()=>I,getBlobByTexture:()=>j,getCloneIdFromTexture:()=>Q,getImageBitMapOptions:()=>W,getImageDomByUrl:()=>se,getMd5ForTexture:()=>ue,getMimeByTexture:()=>C,getSizeByTexture:()=>q,getTextureForEmpty:()=>De,getTextureGm:()=>Me,getTextureGmByRatio:()=>Te,getTextureGpuMemory:()=>L,getTextureMinFilter:()=>ne,getTextureSize:()=>_e,getTextureType:()=>he,getTextureUrl:()=>Ee,getTexturesGpuMemory:()=>N,getUrlByTexture:()=>K,helperTexture:()=>pe,initTexture:()=>z,isClonedTexture:()=>Y,isCubeTexture:()=>le,isInvalidTexture:()=>oe,isTexture:()=>X,loadTexture:()=>G,mergeDefUserData:()=>P,parseImageBitMapByBlob:()=>H,setMimeForTexture:()=>A,setTextureBlob:()=>R,setTextureCloneId:()=>J,setTextureEncodeing:()=>de,setTextureImageForBase64:()=>ye,setTextureImageForBlob:()=>we,setTextureMapping:()=>Z,setTextureMinFilter:()=>te,setTextureSize:()=>U,setTextureToSave:()=>Pe,setTextureUrl:()=>B,textureAssets:()=>me,textureForAnima:()=>fe,textureNameMap:()=>O,textureToBase64:()=>ve,textureTypeId:()=>Oe,textureTypeIds:()=>ke,unDelAbleRefStr:()=>ie,unDelAbleStr:()=>re,unDelAbleTexture:()=>ae,updateTexture:()=>$,updateTextureForMigFilter:()=>ee});var r=n(6001),i=n(5521),a=n(8881);function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function")}var t,n;return t=e,n=[{key:"fromCubeTexture",value:function(e){for(var t=0,n=new a.Vector3,r=new a.Vector3,i=new a.Color,s=[0,0,0,0,0,0,0,0,0],o=new a.SphericalHarmonics3,u=o.coefficients,c=0;c<6;c++)for(var d,h,p=(h=e.image[c]).width,f=h.height,m=(((d=document.createElement("canvas")).width=p,d.height=f,d=d.getContext("2d")).drawImage(h,0,0,p,f),h=d.getImageData(0,0,p,f)).data,g=h.width,v=2/g,y=0,b=m.length;y<b;y+=4){i.setRGB(m[y]/255,m[y+1]/255,m[y+2]/255),l(i,e.colorSpace);var x=((S=y/4)%g+.5)*v-1,w=1-(Math.floor(S/g)+.5)*v;switch(c){case 0:n.set(-1,w,-x);break;case 1:n.set(1,w,x);break;case 2:n.set(-x,1,-w);break;case 3:n.set(-x,-1,w);break;case 4:n.set(-x,w,1);break;case 5:n.set(x,w,-1)}var S=n.lengthSq(),_=4/(Math.sqrt(S)*S);t+=_,r.copy(n).normalize(),a.SphericalHarmonics3.getBasisAt(r,s);for(var T=0;T<9;T++)u[T].x+=s[T]*i.r*_,u[T].y+=s[T]*i.g*_,u[T].z+=s[T]*i.b*_}for(var M=4*Math.PI/t,E=0;E<9;E++)u[E].x*=M,u[E].y*=M,u[E].z*=M;return new a.LightProbe(o)}},{key:"fromCubeRenderTarget",value:function(e,t){for(var n=0,r=new a.Vector3,i=new a.Vector3,s=new a.Color,o=[0,0,0,0,0,0,0,0,0],u=new a.SphericalHarmonics3,c=u.coefficients,d=t.texture.type,h=0;h<6;h++){var p=t.width,f=new(d===a.HalfFloatType?Uint16Array:Uint8Array)(p*p*4);e.readRenderTargetPixels(t,0,0,p,p,f,h);for(var m=2/p,g=0,v=f.length;g<v;g+=4){var y=void 0,b=void 0,x=d===a.HalfFloatType?(y=a.DataUtils.fromHalfFloat(f[g]),b=a.DataUtils.fromHalfFloat(f[g+1]),a.DataUtils.fromHalfFloat(f[g+2])):(y=f[g]/255,b=f[g+1]/255,f[g+2]/255),w=(s.setRGB(y,b,x),l(s,t.texture.colorSpace),((y=g/4)%p+.5)*m-1),S=1-(Math.floor(y/p)+.5)*m;switch(h){case 0:r.set(1,S,-w);break;case 1:r.set(-1,S,w);break;case 2:r.set(w,1,-S);break;case 3:r.set(w,-1,S);break;case 4:r.set(w,S,1);break;case 5:r.set(-w,S,-1)}b=r.lengthSq();var _=4/(Math.sqrt(b)*b);n+=_,i.copy(r).normalize(),a.SphericalHarmonics3.getBasisAt(i,o);for(var T=0;T<9;T++)c[T].x+=o[T]*s.r*_,c[T].y+=o[T]*s.g*_,c[T].z+=o[T]*s.b*_}}for(var M=4*Math.PI/n,E=0;E<9;E++)c[E].x*=M,c[E].y*=M,c[E].z*=M;return new a.LightProbe(u)}}],n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function l(e,t){switch(t){case a.SRGBColorSpace:e.convertSRGBToLinear();break;case a.LinearSRGBColorSpace:case a.NoColorSpace:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}}var u=n(768),c=n(960),d=n(1794),h=n(5247),p=n(135),f=n(3736),m=n(9430),g=n(2233),v=n(5317);class y{constructor(e){this.onDel=e=>{(e=(0,g.Ki)(e))&&this.runScene.cb.msg.del.cb({id:e})},this.onAdd=e=>{const t=(0,g.Ki)(e);if(t){const n=this.getEffectType(e);n&&this.runScene.cb.msg.add.cb({tipType:"info",type:"texture",id:t,data:n.map((e=>({subType:e,id:t})))})}},this.runScene=e,this.init()}init(){this.runScene.cb.texture.add.add("texture-msg",this.onAdd),this.runScene.cb.texture.remove.add("texture-msg",this.onDel)}getEffectType(e){let t=[];var{size:e,blob:n,gm:r}=e.userData;return n&&1024e3<n.size&&t.push("overSize"),e?(({width:n,height:e}=e),3686400<n*e&&t.push("overSolution")):14745600<r&&t.push("overSolution"),0<t.length?t:void 0}}var b=n(6006),x=n(1398),w=n(7201);const S={repeat:{type:"v2",val:{x:1,y:1},shortKey:"re"},offset:{type:"v2",val:{x:0,y:0},shortKey:"of"},rotation:{type:"number",val:0,shortKey:"ro"},center:{type:"v2",val:{x:0,y:0},shortKey:"ce"}};class _{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:n}=e;(e=t.data.get("texture"))&&(0,r.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,n)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:n,name:r}=t;let i=n.get("texture");i||(i={},n.set("texture",i)),e.targets.map((e=>{var t=(0,g.Ki)(e);t&&(i[t]=this.getItem(e,r))}))}))},this.setUnDel=(e,t,n)=>{if(t){if(ae.is(e))return}else if(ae.getRef(e)!=="snapshot_"+n)return;ae.set(e,t,"snapshot_"+n)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const n=x.LV.getDiff(S,e);return(t=this.runScene.script.texture.get(e))&&(n.uvScript=Object.assign({},t)),n},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:n})=>{var r=(0,g.Ki)(n);r&&(t[r]=this.getItem(n,e))})),t},this.create=e=>{var t=this.getDiff(e.name);0!==(0,w.objLength)(t)&&e.data.set("texture",t)},this.set=e=>{var t=e.snapshot.data.get("texture");t&&!e.ignoreModules.includes("texture")&&(0,r.mapObj)(t,((t,n)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(x.LV.set({def:S,data:n,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(n.uvScript,t),this.runScene.script.texture.set(n.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),e.cb.snapshot.delUseless.add("texture",(t=>{(0,r.mapObj)(t,((t,n)=>{const i=n.data.texture;i&&((0,r.mapObj)(i,(t=>{0<e.uniqueEx.texture.getTimeCitedLength(t)||delete i[t]})),0===(0,w.objLength)(i)&&delete n.data.texture)}))})),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.getLength.add("texture",(e=>{var t=e.data.data.get("texture");t&&(e.inputData.texture=Object.keys(t).length)})),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var T={};const M=T;T.toRGBA8=function(e){var t=e.width,n=e.height;if(null==e.tabs.acTL)return[T.toRGBA8.decodeImage(e.data,t,n,e).buffer];for(var r=[],i=(null==e.frames[0].data&&(e.frames[0].data=e.data),t*n*4),a=new Uint8Array(i),s=new Uint8Array(i),o=new Uint8Array(i),l=0;l<e.frames.length;l++){var u=e.frames[l],c=u.rect.x,d=u.rect.y,h=u.rect.width,p=u.rect.height,f=T.toRGBA8.decodeImage(u.data,h,p,e);if(0!=l)for(var m=0;m<i;m++)o[m]=a[m];if(0==u.blend?T._copyTile(f,h,p,a,t,n,c,d,0):1==u.blend&&T._copyTile(f,h,p,a,t,n,c,d,1),r.push(a.buffer.slice(0)),0!=u.dispose)if(1==u.dispose)T._copyTile(s,h,p,a,t,n,c,d,0);else if(2==u.dispose)for(m=0;m<i;m++)a[m]=o[m]}return r},T.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,a=T.decode._getBPP(r),s=Math.ceil(t*a/8),o=new Uint8Array(4*i),l=new Uint32Array(o.buffer),u=(a=r.ctype,r.depth),c=T._bin.readUshort;if(Date.now(),6==a){var d=i<<2;if(8==u)for(var h=0;h<d;h+=4)o[h]=e[h],o[h+1]=e[h+1],o[h+2]=e[h+2],o[h+3]=e[h+3];if(16==u)for(h=0;h<d;h++)o[h]=e[h<<1]}else if(2==a){var p=r.tabs.tRNS;if(null==p){if(8==u)for(h=0;h<i;h++){var f=3*h;l[h]=255<<24|e[f+2]<<16|e[f+1]<<8|e[f]}if(16==u)for(h=0;h<i;h++)f=6*h,l[h]=255<<24|e[f+4]<<16|e[f+2]<<8|e[f]}else{var m=p[0],g=p[1],v=p[2];if(8==u)for(h=0;h<i;h++){var y=h<<2;f=3*h,l[h]=255<<24|e[f+2]<<16|e[f+1]<<8|e[f],e[f]==m&&e[f+1]==g&&e[f+2]==v&&(o[y+3]=0)}if(16==u)for(h=0;h<i;h++)y=h<<2,f=6*h,l[h]=255<<24|e[f+4]<<16|e[f+2]<<8|e[f],c(e,f)==m&&c(e,f+2)==g&&c(e,f+4)==v&&(o[y+3]=0)}}else if(3==a){var b=r.tabs.PLTE,x=r.tabs.tRNS,w=x?x.length:0;if(1==u)for(var S=0;S<n;S++){var _=S*s,M=S*t;for(h=0;h<t;h++){y=M+h<<2;var E=3*(D=e[_+(h>>3)]>>7-((7&h)<<0)&1);o[y]=b[E],o[y+1]=b[E+1],o[y+2]=b[E+2],o[y+3]=D<w?x[D]:255}}if(2==u)for(S=0;S<n;S++)for(_=S*s,M=S*t,h=0;h<t;h++)y=M+h<<2,E=3*(D=e[_+(h>>2)]>>6-((3&h)<<1)&3),o[y]=b[E],o[y+1]=b[E+1],o[y+2]=b[E+2],o[y+3]=D<w?x[D]:255;if(4==u)for(S=0;S<n;S++)for(_=S*s,M=S*t,h=0;h<t;h++)y=M+h<<2,E=3*(D=e[_+(h>>1)]>>4-((1&h)<<2)&15),o[y]=b[E],o[y+1]=b[E+1],o[y+2]=b[E+2],o[y+3]=D<w?x[D]:255;if(8==u)for(h=0;h<i;h++){var D;y=h<<2,E=3*(D=e[h]),o[y]=b[E],o[y+1]=b[E+1],o[y+2]=b[E+2],o[y+3]=D<w?x[D]:255}}else if(4==a){if(8==u)for(h=0;h<i;h++){y=h<<2;var P=e[k=h<<1];o[y]=P,o[y+1]=P,o[y+2]=P,o[y+3]=e[k+1]}if(16==u)for(h=0;h<i;h++){var k;y=h<<2,P=e[k=h<<2],o[y]=P,o[y+1]=P,o[y+2]=P,o[y+3]=e[k+2]}}else if(0==a)for(m=r.tabs.tRNS||-1,S=0;S<n;S++){var O=S*s,A=S*t;if(1==u)for(var C=0;C<t;C++){var N=(P=255*(e[O+(C>>>3)]>>>7-(7&C)&1))==255*m?0:255;l[A+C]=N<<24|P<<16|P<<8|P}else if(2==u)for(C=0;C<t;C++)N=(P=85*(e[O+(C>>>2)]>>>6-((3&C)<<1)&3))==85*m?0:255,l[A+C]=N<<24|P<<16|P<<8|P;else if(4==u)for(C=0;C<t;C++)N=(P=17*(e[O+(C>>>1)]>>>4-((1&C)<<2)&15))==17*m?0:255,l[A+C]=N<<24|P<<16|P<<8|P;else if(8==u)for(C=0;C<t;C++)N=(P=e[O+C])==m?0:255,l[A+C]=N<<24|P<<16|P<<8|P;else if(16==u)for(C=0;C<t;C++)P=e[O+(C<<1)],N=c(e,O+(C<<1))==m?0:255,l[A+C]=N<<24|P<<16|P<<8|P}return o},T.decode=function(e){for(var t,n=new Uint8Array(e),r=8,i=T._bin,a=i.readUshort,s=i.readUint,o={tabs:{},frames:[]},l=new Uint8Array(n.length),u=0,c=0,d=[137,80,78,71,13,10,26,10],h=0;h<8;h++)if(n[h]!=d[h])throw"The input is not a PNG file!";for(;r<n.length;){var p=i.readUint(n,r),f=(r+=4,i.readASCII(n,r,4));if(r+=4,"IHDR"==f)T.decode._IHDR(n,r,o);else if("CgBI"==f)o.tabs[f]=n.slice(r,r+4);else if("IDAT"==f){for(h=0;h<p;h++)l[u+h]=n[r+h];u+=p}else if("acTL"==f)o.tabs[f]={num_frames:s(n,r),num_plays:s(n,r+4)},t=new Uint8Array(n.length);else if("fcTL"==f){0!=c&&((m=o.frames[o.frames.length-1]).data=T.decode._decompress(o,t.slice(0,c),m.rect.width,m.rect.height),c=0);var m,g={x:s(n,r+12),y:s(n,r+16),width:s(n,r+4),height:s(n,r+8)},v=a(n,r+22);v=a(n,r+20)/(0==v?100:v),g={rect:g,delay:Math.round(1e3*v),dispose:n[r+24],blend:n[r+25]},o.frames.push(g)}else if("fdAT"==f){for(h=0;h<p-4;h++)t[c+h]=n[r+h+4];c+=p-4}else if("pHYs"==f)o.tabs[f]=[i.readUint(n,r),i.readUint(n,r+4),n[r+8]];else if("cHRM"==f)for(o.tabs[f]=[],h=0;h<8;h++)o.tabs[f].push(i.readUint(n,r+4*h));else if("tEXt"==f||"zTXt"==f){null==o.tabs[f]&&(o.tabs[f]={});var y=i.nextZero(n,r),b=i.readASCII(n,r,y-r),x=r+p-y-1;w="tEXt"==f?i.readASCII(n,y+1,x):(S=T.decode._inflate(n.slice(y+2,y+2+x)),i.readUTF8(S,0,S.length)),o.tabs[f][b]=w}else if("iTXt"==f){var w,S;null==o.tabs[f]&&(o.tabs[f]={}),y=0,v=r,y=i.nextZero(n,v),b=i.readASCII(n,v,y-v),g=n[v=y+1],n[v+1],v+=2,y=i.nextZero(n,v),i.readASCII(n,v,y-v),y=i.nextZero(n,v=y+1),i.readUTF8(n,v,y-v),x=p-((v=y+1)-r),w=0==g?i.readUTF8(n,v,x):(S=T.decode._inflate(n.slice(v,v+x)),i.readUTF8(S,0,S.length)),o.tabs[f][b]=w}else if("PLTE"==f)o.tabs[f]=i.readBytes(n,r,p);else if("hIST"==f){var _=o.tabs.PLTE.length/3;for(o.tabs[f]=[],h=0;h<_;h++)o.tabs[f].push(a(n,r+2*h))}else if("tRNS"==f)3==o.ctype?o.tabs[f]=i.readBytes(n,r,p):0==o.ctype?o.tabs[f]=a(n,r):2==o.ctype&&(o.tabs[f]=[a(n,r),a(n,r+2),a(n,r+4)]);else if("gAMA"==f)o.tabs[f]=i.readUint(n,r)/1e5;else if("sRGB"==f)o.tabs[f]=n[r];else if("bKGD"==f)0==o.ctype||4==o.ctype?o.tabs[f]=[a(n,r)]:2==o.ctype||6==o.ctype?o.tabs[f]=[a(n,r),a(n,r+2),a(n,r+4)]:3==o.ctype&&(o.tabs[f]=n[r]);else if("IEND"==f)break;r+=p,i.readUint(n,r),r+=4}return 0!=c&&((m=o.frames[o.frames.length-1]).data=T.decode._decompress(o,t.slice(0,c),m.rect.width,m.rect.height)),o.data=T.decode._decompress(o,l,o.width,o.height),delete o.compress,delete o.interlace,delete o.filter,o},T.decode._decompress=function(e,t,n,r){Date.now();var i=T.decode._getBPP(e);return i=Math.ceil(n*i/8),i=new Uint8Array((i+1+e.interlace)*r),t=e.tabs.CgBI?T.inflateRaw(t,i):T.decode._inflate(t,i),Date.now(),0==e.interlace?t=T.decode._filterZero(t,e,0,n,r):1==e.interlace&&(t=T.decode._readInterlace(t,e)),t},T.decode._inflate=function(e,t){return T.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t)},T.inflateRaw=function(){var e,t,n={H:{}};n.H.N=function(e,t){var r=Uint8Array,i=0,a=0,s=0,o=0,l=0;if(3==e[0]&&0==e[1])return t||new r(0);var u=n.H,c=u.b,d=u.e,h=u.R,p=u.n,f=u.A,m=u.Z,g=u.m,v=null==t;for(v&&(t=new r(e.length>>>2<<5));0==i;)if(i=c(e,l,1),E=c(e,l+1,2),l+=3,0==E){0!=(7&l)&&(l+=8-(7&l));var y=e[(b=4+(l>>>3))-4]|e[b-3]<<8;(t=v?n.H.W(t,o+y):t).set(new r(e.buffer,e.byteOffset+b,y),o),l=b+y<<3,o+=y}else{if(v&&(t=n.H.W(t,o+(1<<17))),1==E&&(T=g.J,M=g.h,a=511,s=31),2==E){for(var b=d(e,l,5)+257,x=(y=d(e,l+5,5)+1,d(e,l+10,4)+4),w=(l+=14,1),S=0;S<38;S+=2)g.Q[S]=0,g.Q[S+1]=0;for(S=0;S<x;S++){var _=d(e,l+3*S,3);w<(g.Q[1+(g.X[S]<<1)]=_)&&(w=_)}l+=3*x,p(g.Q,w),f(g.Q,w,g.u);var T=g.w,M=g.d,E=(l=h(g.u,(1<<w)-1,b+y,e,l,g.v),u.V(g.v,0,b,g.C)),D=(a=(1<<E)-1,u.V(g.v,b,y,g.D));s=(1<<D)-1,p(g.C,E),f(g.C,E,T),p(g.D,D),f(g.D,D,M)}for(;;)if(0==(l+=15&(k=T[m(e,l)&a]),(k>>>=4)>>>8))t[o++]=k;else{if(256==k)break;var P=o+k-254,k=(264<k&&(P=o+((k=g.q[k-257])>>>3)+d(e,l,7&k),l+=7&k),M[m(e,l)&s]);l+=15&k;var O=((k=g.c[k>>>4])>>>4)+c(e,l,15&k);for(l+=15&k;o<P;)t[o]=t[o++-O],t[o]=t[o++-O],t[o]=t[o++-O],t[o]=t[o++-O];o=P}}return t.length==o?t:t.slice(0,o)},n.H.W=function(e,t){var n=e.length;return t<=n?e:((t=new Uint8Array(n<<1)).set(e,0),t)},n.H.R=function(e,t,r,i,a,s){for(var o=n.H.e,l=n.H.Z,u=0;u<r;){var c;if(a+=15&(c=e[l(i,a)&t]),(c>>>=4)<=15)s[u]=c,u++;else for(var d=0,h=0,p=(16==c?(h=3+o(i,a,2),a+=2,d=s[u-1]):17==c?(h=3+o(i,a,3),a+=3):18==c&&(h=11+o(i,a,7),a+=7),u+h);u<p;)s[u]=d,u++}return a},n.H.V=function(e,t,n,r){for(var i=0,a=0,s=r.length>>>1;a<n;){var o=e[a+t];r[a<<1]=0,i<(r[1+(a<<1)]=o)&&(i=o),a++}for(;a<s;)r[a<<1]=0,r[1+(a<<1)]=0,a++;return i},n.H.n=function(e,t){for(var r,i,a,s=n.H.m,o=e.length,l=s.j,u=0;u<=t;u++)l[u]=0;for(u=1;u<o;u+=2)l[e[u]]++;var c=s.K,d=0;for(l[0]=0,r=1;r<=t;r++)d=d+l[r-1]<<1,c[r]=d;for(i=0;i<o;i+=2)0!=(a=e[i+1])&&(e[i]=c[a],c[a]++)},n.H.A=function(e,t,r){for(var i=e.length,a=n.H.m.r,s=0;s<i;s+=2)if(0!=e[s+1])for(var o=s>>1<<4|(l=e[s+1]),l=t-l,u=e[s]<<l,c=u+(1<<l);u!=c;)r[a[u]>>>15-t]=o,u++},n.H.l=function(e,t){for(var r=n.H.m.r,i=15-t,a=0;a<e.length;a+=2){var s=e[a]<<t-e[a+1];e[a]=r[s]>>>i}},n.H.M=function(e,t,n){var r=t>>>3;e[r]|=n<<=7&t,e[1+r]|=n>>>8},n.H.I=function(e,t,n){var r=t>>>3;e[r]|=n<<=7&t,e[1+r]|=n>>>8,e[2+r]|=n>>>16},n.H.e=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<n)-1},n.H.b=function(e,t,n){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<n)-1},n.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},n.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},n.H.m=(e=Uint16Array,t=Uint32Array,{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)});for(var r=n.H.m,i=0;i<32768;i++){var a=i;r.r[i]=((a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8)>>>16|a<<16)>>>17}function s(e,t,n){for(;0!=t--;)e.push(0,n)}for(i=0;i<32;i++)r.q[i]=r.S[i]<<3|r.T[i],r.c[i]=r.p[i]<<4|r.z[i];return s(r._,144,8),s(r._,112,9),s(r._,24,7),s(r._,8,8),n.H.n(r._,9),n.H.A(r._,9,r.J),n.H.l(r._,9),s(r.$,32,5),n.H.n(r.$,5),n.H.A(r.$,5,r.h),n.H.l(r.$,5),s(r.Q,19,0),s(r.C,286,0),s(r.D,30,0),s(r.v,320,0),n.H.N}(),T.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=T.decode._getBPP(t),a=i>>3,s=Math.ceil(n*i/8),o=new Uint8Array(r*s),l=0,u=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],h=[8,8,4,4,2,2,1],p=0;p<7;){for(var f=d[p],m=h[p],g=0,v=0,y=u[p];y<r;)y+=f,v++;for(var b=c[p];b<n;)b+=m,g++;for(var x=Math.ceil(g*i/8),w=(T.decode._filterZero(e,t,l,g,v),0),S=u[p];S<r;){for(var _,M=c[p],E=l+w*x<<3;M<n;){if(1==i&&(_=e[E>>3],o[S*s+(M>>3)]|=(_=_>>7-(7&E)&1)<<7-((7&M)<<0)),2==i&&(_=e[E>>3],o[S*s+(M>>2)]|=(_=_>>6-(7&E)&3)<<6-((3&M)<<1)),4==i&&(_=e[E>>3],o[S*s+(M>>1)]|=(_=_>>4-(7&E)&15)<<4-((1&M)<<2)),8<=i)for(var D=S*s+M*a,P=0;P<a;P++)o[D+P]=e[(E>>3)+P];E+=i,M+=m}w++,S+=f}g*v!=0&&(l+=v*(1+x)),p+=1}return o},T.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},T.decode._filterZero=function(e,t,n,r,i){var a,s,o=T.decode._getBPP(t),l=Math.ceil(r*o/8),u=T.decode._paeth,c=(o=Math.ceil(o/8),e[n]),d=0;if(1<c&&(e[n]=[0,0,1][c-2]),3==c)for(d=o;d<l;d++)e[d+1]=e[d+1]+(e[d+1-o]>>>1)&255;for(var h=0;h<i;h++)if((d=0)==(c=e[(s=(a=n+h*l)+h+1)-1]))for(;d<l;d++)e[a+d]=e[s+d];else if(1==c){for(;d<o;d++)e[a+d]=e[s+d];for(;d<l;d++)e[a+d]=e[s+d]+e[a+d-o]}else if(2==c)for(;d<l;d++)e[a+d]=e[s+d]+e[a+d-l];else if(3==c){for(;d<o;d++)e[a+d]=e[s+d]+(e[a+d-l]>>>1);for(;d<l;d++)e[a+d]=e[s+d]+(e[a+d-l]+e[a+d-o]>>>1)}else{for(;d<o;d++)e[a+d]=e[s+d]+u(0,e[a+d-l],0);for(;d<l;d++)e[a+d]=e[s+d]+u(e[a+d-o],e[a+d-l],e[a+d-o-l])}return e},T.decode._paeth=function(e,t,n){var r=(a=e+t-n)-e,i=a-t,a=a-n;return r*r<=i*i&&r*r<=a*a?e:i*i<=a*a?t:n},T.decode._IHDR=function(e,t,n){var r=T._bin;n.width=r.readUint(e,t),n.height=r.readUint(e,t+=4),n.depth=e[t+=4],n.ctype=e[++t],n.compress=e[++t],n.filter=e[++t],n.interlace=e[++t],t++},T._bin={nextZero:function(e,t){for(;0!=e[t];)t++;return t},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,n){e[t]=n>>8&255,e[t+1]=255&n},readUint:function(e,t){return 16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=255&n},readASCII:function(e,t,n){for(var r="",i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII:function(e,t,n){for(var r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},readBytes:function(e,t,n){for(var r=[],i=0;i<n;i++)r.push(e[t+i]);return r},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,n){for(var r,i="",a=0;a<n;a++)i+="%"+T._bin.pad(e[t+a].toString(16));try{r=decodeURIComponent(i)}catch(r){return T._bin.readASCII(e,t,n)}return r}},T._copyTile=function(e,t,n,r,i,a,s,o,l){for(var u=Math.min(t,i),c=Math.min(n,a),d=0,h=0,p=0;p<c;p++)for(var f=0;f<u;f++)if(h=0<=s&&0<=o?(d=p*t+f<<2,(o+p)*i+s+f<<2):(d=(-o+p)*t-s+f<<2,p*i+f<<2),0==l)r[h]=e[d],r[h+1]=e[d+1],r[h+2]=e[d+2],r[h+3]=e[d+3];else if(1==l){var m=e[d+3]*(1/255),g=e[d]*m,v=e[d+1]*m,y=e[d+2]*m,b=r[h+3]*(1/255),x=r[h]*b,w=r[h+1]*b,S=r[h+2]*b,_=1-m,T=m+b*_,M=0==T?0:1/T;r[h+3]=255*T,r[h+0]=(g+x*_)*M,r[h+1]=(v+w*_)*M,r[h+2]=(y+S*_)*M}else if(2==l)m=e[d+3],g=e[d],v=e[d+1],y=e[d+2],b=r[h+3],x=r[h],w=r[h+1],S=r[h+2],m==b&&g==x&&v==w&&y==S?(r[h]=0,r[h+1]=0,r[h+2]=0,r[h+3]=0):(r[h]=g,r[h+1]=v,r[h+2]=y,r[h+3]=m);else if(3==l&&(m=e[d+3],g=e[d],v=e[d+1],y=e[d+2],b=r[h+3],x=r[h],w=r[h+1],S=r[h+2],(m!=b||g!=x||v!=w||y!=S)&&m<220&&20<b))return!1;return!0},T.encode=function(e,t,n,r,i,a,s){return e=T.encode.compress(e,t,n,r=null==r?0:r,[!1,!1,!1,0,s=null!=s&&s,!1]),T.encode.compressPNG(e,-1),T.encode._main(e,t,n,i,a)},T.encodeLL=function(e,t,n,r,i,a,s,o){for(var l={ctype:0+(1==r?0:2)+(0==i?0:4),depth:a,frames:[]},u=(Date.now(),(r+i)*a),c=u*t,d=0;d<e.length;d++)l.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[d]),blend:0,dispose:1,bpp:Math.ceil(u/8),bpl:Math.ceil(c/8)});return T.encode.compressPNG(l,0,!0),T.encode._main(l,t,n,s,o)},T.encode._main=function(e,t,n,r,i){var a=T.crc.crc,s=T._bin.writeUint,o=T._bin.writeUshort,l=T._bin.writeASCII,u=8,c=1<e.frames.length,d=!1,h=33+(c?20:0);if(null!=(i=null==i?{}:i).sRGB&&(h+=13),null!=i.pHYs&&(h+=21),3==e.ctype){for(var p=e.plte.length,f=0;f<p;f++)e.plte[f]>>>24!=255&&(d=!0);h+=8+3*p+4+(d?+p+8+4:0)}for(var m=0;m<e.frames.length;m++)c&&(h+=38),h+=(_=e.frames[m]).cimg.length+12,0!=m&&(h+=4);h+=12;var g=new Uint8Array(h),v=[137,80,78,71,13,10,26,10];for(f=0;f<8;f++)g[f]=v[f];if(s(g,u,13),l(g,u+=4,"IHDR"),s(g,u+=4,t),s(g,u+=4,n),g[u+=4]=e.depth,g[++u]=e.ctype,g[++u]=0,g[++u]=0,g[++u]=0,s(g,++u,a(g,u-17,17)),u+=4,null!=i.sRGB&&(s(g,u,1),l(g,u+=4,"sRGB"),g[u+=4]=i.sRGB,s(g,++u,a(g,u-5,5)),u+=4),null!=i.pHYs&&(s(g,u,9),l(g,u+=4,"pHYs"),s(g,u+=4,i.pHYs[0]),s(g,u+=4,i.pHYs[1]),g[u+=4]=i.pHYs[2],s(g,++u,a(g,u-13,13)),u+=4),c&&(s(g,u,8),l(g,u+=4,"acTL"),s(g,u+=4,e.frames.length),s(g,u+=4,null!=i.loop?i.loop:0),s(g,u+=4,a(g,u-12,12)),u+=4),3==e.ctype){for(s(g,u,3*(p=e.plte.length)),l(g,u+=4,"PLTE"),u+=4,f=0;f<p;f++){var y=3*f,b=e.plte[f],x=b>>>8&255,w=b>>>16&255;g[u+y+0]=255&b,g[u+y+1]=x,g[u+y+2]=w}if(s(g,u+=3*p,a(g,u-3*p-4,3*p+4)),u+=4,d){for(s(g,u,p),l(g,u+=4,"tRNS"),u+=4,f=0;f<p;f++)g[u+f]=e.plte[f]>>>24&255;s(g,u+=p,a(g,u-p-4,p+4)),u+=4}}var S=0;for(m=0;m<e.frames.length;m++){var _=e.frames[m],M=(c&&(s(g,u,26),l(g,u+=4,"fcTL"),s(g,u+=4,S++),s(g,u+=4,_.rect.width),s(g,u+=4,_.rect.height),s(g,u+=4,_.rect.x),s(g,u+=4,_.rect.y),o(g,u+=4,r[m]),o(g,u+=2,1e3),g[u+=2]=_.dispose,g[++u]=_.blend,s(g,++u,a(g,u-30,30)),u+=4),_.cimg),E=(s(g,u,(p=M.length)+(0==m?0:4)),u+=4);l(g,u,0==m?"IDAT":"fdAT"),u+=4,0!=m&&(s(g,u,S++),u+=4),g.set(M,u),s(g,u+=p,a(g,E,u-E)),u+=4}return s(g,u,0),l(g,u+=4,"IEND"),s(g,u+=4,a(g,u-4,4)),u+=4,g.buffer},T.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r],a=(i.rect.width,i.rect.height),s=new Uint8Array(a*i.bpl+a);i.cimg=T.encode._filterZero(i.img,a,i.bpp,i.bpl,s,t,n)}},T.encode.compress=function(e,t,n,r,i){for(var a=i[0],s=i[1],o=i[2],l=i[3],u=i[4],c=i[5],d=6,h=8,p=255,f=0;f<e.length;f++)for(var m=new Uint8Array(e[f]),g=m.length,v=0;v<g;v+=4)p&=m[v+3];var y=255!=p,b=T.encode.framize(e,t,n,a,s,o),x={},w=[],S=[];if(0!=r){var _=[];for(v=0;v<b.length;v++)_.push(b[v].img.buffer);i=T.encode.concatRGBA(_);var M=T.quantize(i,r);for(v=0;v<M.plte.length;v++)w.push(M.plte[v].est.rgba);var E=0;for(v=0;v<b.length;v++){var D=(O=b[v]).img.length,P=new Uint8Array(M.inds.buffer,E>>2,D>>2),k=(S.push(P),new Uint8Array(M.abuf,E,D));c&&T.encode.dither(O.img,O.rect.width,O.rect.height,w,k,P),O.img.set(k),E+=D}}else for(f=0;f<b.length;f++){var O=b[f],A=new Uint32Array(O.img.buffer),C=O.rect.width;for(g=A.length,P=new Uint8Array(g),S.push(P),v=0;v<g;v++){var N=A[v];if(0!=v&&N==A[v-1])P[v]=P[v-1];else if(C<v&&N==A[v-C])P[v]=P[v-C];else{var L=x[N];if(null==L&&(x[N]=L=w.length,w.push(N),300<=w.length))break;P[v]=L}}}var I=w.length;for(I<=256&&0==u&&(h=I<=2?1:I<=4?2:I<=16?4:8,h=Math.max(h,l)),f=0;f<b.length;f++){(O=b[f]).rect.x,O.rect.y,C=O.rect.width;var R=O.rect.height,U=O.img,B=(new Uint32Array(U.buffer),4*C),F=4;if(I<=256&&0==u){B=Math.ceil(h*C/8);for(var j=new Uint8Array(B*R),z=S[f],V=0;V<R;V++){v=V*B;var H=V*C;if(8==h)for(var W=0;W<C;W++)j[v+W]=z[H+W];else if(4==h)for(W=0;W<C;W++)j[v+(W>>1)]|=z[H+W]<<4-4*(1&W);else if(2==h)for(W=0;W<C;W++)j[v+(W>>2)]|=z[H+W]<<6-2*(3&W);else if(1==h)for(W=0;W<C;W++)j[v+(W>>3)]|=z[H+W]<<7-(7&W)}U=j,d=3,F=1}else if(0==y&&1==b.length){j=new Uint8Array(C*R*3);var G=C*R;for(v=0;v<G;v++){var K=3*v,Z=4*v;j[K]=U[Z],j[1+K]=U[1+Z],j[2+K]=U[2+Z]}U=j,d=2,B=(F=3)*C}O.img=U,O.bpl=B,O.bpp=F}return{ctype:d,depth:h,plte:w,frames:b}},T.encode.framize=function(e,t,n,r,i,a){for(var s,o,l,u,c=[],d=0;d<e.length;d++){var h,p=new Uint8Array(e[d]),f=new Uint32Array(p.buffer),m=0,g=0,v=t,y=n,b=r?1:0;if(0!=d){for(var x=a||r||1==d||0!=c[d-2].dispose?1:2,w=0,S=1e9,_=0;_<x;_++){for(var M=new Uint8Array(e[d-1-_]),E=new Uint32Array(e[d-1-_]),D=t,P=n,k=-1,O=-1,A=0;A<n;A++)for(var C=0;C<t;C++)f[I=A*t+C]!=E[I]&&(C<D&&(D=C),k<C&&(k=C),A<P&&(P=A),O<A&&(O=A));-1==k&&(D=P=k=O=0),i&&(1==(1&D)&&D--,1==(1&P)&&P--);var N=(k-D+1)*(O-P+1);N<S&&(S=N,w=_,v=k-(m=D)+1,y=O-(g=P)+1)}M=new Uint8Array(e[d-1-w]),1==w&&(c[d-1].dispose=2),h=new Uint8Array(v*y*4),T._copyTile(M,t,n,h,v,y,-m,-g,0),1==(b=T._copyTile(p,t,n,h,v,y,-m,-g,3)?1:0)?T.encode._prepareDiff(p,t,n,h,{x:m,y:g,width:v,height:y}):T._copyTile(p,t,n,h,v,y,-m,-g,0)}else h=p.slice(0);c.push({rect:{x:m,y:g,width:v,height:y},img:h,blend:b,dispose:0})}if(r)for(d=0;d<c.length;d++)1!=(L=c[d]).blend&&(s=L.rect,o=c[d-1].rect,u={x:u=Math.min(s.x,o.x),y:l=Math.min(s.y,o.y),width:Math.max(s.x+s.width,o.x+o.width)-u,height:Math.max(s.y+s.height,o.y+o.height)-l},d-(c[d-1].dispose=1)!=0&&T.encode._updateFrame(e,t,n,c,d-1,u,i),T.encode._updateFrame(e,t,n,c,d,u,i));var L;if(1!=e.length)for(var I=0;I<c.length;I++)(L=c[I]).rect.width,L.rect.height;return c},T.encode._updateFrame=function(e,t,n,r,i,a,s){for(var o=Uint8Array,l=Uint32Array,u=new o(e[i-1]),c=new l(e[i-1]),d=i+1<e.length?new o(e[i+1]):null,h=new l((o=new o(e[i])).buffer),p=t,f=n,m=-1,g=-1,v=0;v<a.height;v++)for(var y=0;y<a.width;y++){var b=a.x+y,x=a.y+v,w=x*t+b,S=h[w];0!=S&&(0!=r[i-1].dispose||c[w]!=S||null!=d&&0==d[4*w+3])&&(b<p&&(p=b),m<b&&(m=b),x<f&&(f=x),g<x&&(g=x))}-1==m&&(p=f=m=g=0),s&&(1==(1&p)&&p--,1==(1&f)&&f--),(e=r[i]).rect=a={x:p,y:f,width:m-p+1,height:g-f+1},e.blend=1,e.img=new Uint8Array(a.width*a.height*4),0==r[i-1].dispose?(T._copyTile(u,t,n,e.img,a.width,a.height,-a.x,-a.y,0),T.encode._prepareDiff(o,t,n,e.img,a)):T._copyTile(o,t,n,e.img,a.width,a.height,-a.x,-a.y,0)},T.encode._prepareDiff=function(e,t,n,r,i){T._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},T.encode._filterZero=function(e,t,n,r,i,a,s){for(var o,l=[],u=[0,1,2,3,4],c=(-1!=a?u=[a]:(5e5<t*r||1==n)&&(u=[0]),s&&(o={level:0}),1e7<i.length&&null!=UZIP?UZIP:pako),d=(Date.now(),0);d<u.length;d++){for(var h=0;h<t;h++)T.encode._filterLine(i,e,h,r,n,u[d]);l.push(c.deflate(i,o))}var p,f=1e9;for(d=0;d<l.length;d++)l[d].length<f&&(f=l[p=d].length);return l[p]},T.encode._filterLine=function(e,t,n,r,i,a){var s=n*r,o=s+n,l=T.decode._paeth;if(e[o]=a,o++,0==a)if(r<500)for(var u=0;u<r;u++)e[o+u]=t[s+u];else e.set(new Uint8Array(t.buffer,s,r),o);else if(1==a){for(u=0;u<i;u++)e[o+u]=t[s+u];for(u=i;u<r;u++)e[o+u]=t[s+u]-t[s+u-i]+256&255}else if(0==n){for(u=0;u<i;u++)e[o+u]=t[s+u];if(2==a)for(u=i;u<r;u++)e[o+u]=t[s+u];if(3==a)for(u=i;u<r;u++)e[o+u]=t[s+u]-(t[s+u-i]>>1)+256&255;if(4==a)for(u=i;u<r;u++)e[o+u]=t[s+u]-l(t[s+u-i],0,0)+256&255}else{if(2==a)for(u=0;u<r;u++)e[o+u]=t[s+u]+256-t[s+u-r]&255;if(3==a){for(u=0;u<i;u++)e[o+u]=t[s+u]+256-(t[s+u-r]>>1)&255;for(u=i;u<r;u++)e[o+u]=t[s+u]+256-(t[s+u-r]+t[s+u-i]>>1)&255}if(4==a){for(u=0;u<i;u++)e[o+u]=t[s+u]+256-l(0,t[s+u-r],0)&255;for(u=i;u<r;u++)e[o+u]=t[s+u]+256-l(t[s+u-i],t[s+u-r],t[s+u-i-r])&255}}},T.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)1&n?n=3988292384^n>>>1:n>>>=1;e[t]=n}return e}(),update:function(e,t,n,r){for(var i=0;i<r;i++)e=T.crc.table[255&(e^t[n+i])]^e>>>8;return e},crc:function(e,t,n){return 4294967295^T.crc.update(4294967295,e,t,n)}},T.quantize=function(e,t){var n=new Uint8Array(e),r=(e=n.slice(0),new Uint32Array(e.buffer)),i=(t=T.quantize.getKDtree(e,t))[0],a=(t=t[1],T.quantize.planeDst),s=n.length,o=new Uint8Array(s>>2);if(n.length<2e7)for(var l=0;l<s;l+=4){var u=n[l]*(1/255),c=n[l+1]*(1/255),d=n[l+2]*(1/255),h=n[l+3]*(1/255),p=T.quantize.getNearest(i,u,c,d,h);o[l>>2]=p.ind,r[l>>2]=p.est.rgba}else for(l=0;l<s;l+=4){for(u=n[l]*(1/255),c=n[l+1]*(1/255),d=n[l+2]*(1/255),h=n[l+3]*(1/255),p=i;p.left;)p=a(p.est,u,c,d,h)<=0?p.left:p.right;o[l>>2]=p.ind,r[l>>2]=p.est.rgba}return{abuf:e.buffer,inds:o,plte:t}},T.quantize.getKDtree=function(e,t,n){null==n&&(n=1e-4);for(var r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null},a=(i.bst=T.quantize.stats(e,i.i0,i.i1),i.est=T.quantize.estats(i.bst),[i]);a.length<t;){for(var s=0,o=0,l=0;l<a.length;l++)a[l].est.L>s&&(s=a[l].est.L,o=l);if(s<n)break;var u=a[o],c=T.quantize.splitPixels(e,r,u.i0,u.i1,u.est.e,u.est.eMq255);if(u.i0>=c||u.i1<=c)u.est.L=0;else{var d={i0:u.i0,i1:c,bst:null,est:null,tdst:0,left:null,right:null},h=(d.bst=T.quantize.stats(e,d.i0,d.i1),d.est=T.quantize.estats(d.bst),{i0:c,i1:u.i1,bst:null,est:null,tdst:0,left:null,right:null});for(h.bst={R:[],m:[],N:u.bst.N-d.bst.N},l=0;l<16;l++)h.bst.R[l]=u.bst.R[l]-d.bst.R[l];for(l=0;l<4;l++)h.bst.m[l]=u.bst.m[l]-d.bst.m[l];h.est=T.quantize.estats(h.bst),u.left=d,u.right=h,a[o]=d,a.push(h)}}for(a.sort((function(e,t){return t.bst.N-e.bst.N})),l=0;l<a.length;l++)a[l].ind=l;return[i,a]},T.quantize.getNearest=function(e,t,n,r,i){if(null==e.left)return e.tdst=T.quantize.dist(e.est.q,t,n,r,i),e;var a=T.quantize.planeDst(e.est,t,n,r,i),s=e.left,o=e.right;return(0<a&&(s=e.right,o=e.left),e=T.quantize.getNearest(s,t,n,r,i)).tdst<=a*a?e:(s=T.quantize.getNearest(o,t,n,r,i)).tdst<e.tdst?s:e},T.quantize.planeDst=function(e,t,n,r,i){var a=e.e;return a[0]*t+a[1]*n+a[2]*r+a[3]*i-e.eMq},T.quantize.dist=function(e,t,n,r,i){return(t-=e[0])*t+(n-=e[1])*n+(r-=e[2])*r+(i-=e[3])*i},T.quantize.splitPixels=function(e,t,n,r,i,a){var s=T.quantize.vecDot;for(r-=4;n<r;){for(;s(e,n,i)<=a;)n+=4;for(;s(e,r,i)>a;)r-=4;if(r<=n)break;var o=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=o,n+=4,r-=4}for(;s(e,n,i)>a;)n-=4;return n+4},T.quantize.vecDot=function(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]},T.quantize.stats=function(e,t,n){for(var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],a=n-t>>2,s=t;s<n;s+=4){var o=e[s]*(1/255),l=e[s+1]*(1/255),u=e[s+2]*(1/255),c=e[s+3]*(1/255);i[0]+=o,i[1]+=l,i[2]+=u,i[3]+=c,r[0]+=o*o,r[1]+=o*l,r[2]+=o*u,r[3]+=o*c,r[5]+=l*l,r[6]+=l*u,r[7]+=l*c,r[10]+=u*u,r[11]+=u*c,r[15]+=c*c}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m:i,N:a}},T.quantize.estats=function(e){var t,n=e.R,r=e.m,i=(e=e.N,r[0]),a=r[1],s=r[2],o=(r=r[3],0==e?0:1/e),l=n=[n[0]-i*i*o,n[1]-i*a*o,n[2]-i*s*o,n[3]-i*r*o,n[4]-a*i*o,n[5]-a*a*o,n[6]-a*s*o,n[7]-a*r*o,n[8]-s*i*o,n[9]-s*a*o,n[10]-s*s*o,n[11]-s*r*o,n[12]-r*i*o,n[13]-r*a*o,n[14]-r*s*o,n[15]-r*r*o],u=T.M4,c=[Math.random(),Math.random(),Math.random(),Math.random()],d=0;if(0!=e)for(var h=0;h<16&&(c=u.multVec(l,c),t=Math.sqrt(u.dot(c,c)),c=u.sml(1/t,c),!(0!=h&&Math.abs(t-d)<1e-9));h++)d=t;return{Cov:n,q:e=[i*o,a*o,s*o,r*o],e:c,L:d,eMq255:u.dot(u.sml(255,e),c),eMq:u.dot(c,e),rgba:(Math.round(255*e[3])<<24|Math.round(255*e[2])<<16|Math.round(255*e[1])<<8|Math.round(255*e[0])<<0)>>>0}},T.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}},T.encode.concatRGBA=function(e){for(var t=0,n=0;n<e.length;n++)t+=e[n].byteLength;var r=new Uint8Array(t),i=0;for(n=0;n<e.length;n++){for(var a=new Uint8Array(e[n]),s=a.length,o=0;o<s;o+=4){var l=a[o],u=a[o+1],c=a[o+2],d=a[o+3];0==d&&(l=u=c=0),r[i+o]=l,r[i+o+1]=u,r[i+o+2]=c,r[i+o+3]=d}i+=s}return r.buffer},T.encode.dither=function(e,t,n,r,i,a){function s(e,t,n,r){t[n]+=e[0]*r>>4,t[n+1]+=e[1]*r>>4,t[n+2]+=e[2]*r>>4,t[n+3]+=e[3]*r>>4}function o(e){return Math.max(0,Math.min(255,e))}function l(e,t){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i+(e=e[3]-t[3])*e}for(var u=r.length,c=[],d=[],h=0;h<u;h++){var p=r[h];c.push([p>>>0&255,p>>>8&255,p>>>16&255,p>>>24&255])}for(h=0;h<u;h++){for(var f=4294967295,m=0,g=0;g<u;g++){var v=l(c[h],c[g]);g!=h&&v<f&&(f=v,m=g)}var y=Math.sqrt(f)/2;d[h]=~~(y*y)}for(var b=new Uint32Array(i.buffer),x=new Int16Array(t*n*4),w=0;w<n;w++)for(var S=0;S<t;S++){var _=[o(e[h=4*(w*t+S)]+x[h]),o(e[h+1]+x[h+1]),o(e[h+2]+x[h+2]),o(e[h+3]+x[h+3])],T=(m=0,16777215);for(g=0;g<u;g++){var M=l(_,c[g]);M<T&&(T=M,m=g)}var E=c[m];E=[_[0]-E[0],_[1]-E[1],_[2]-E[2],_[3]-E[3]],S!=t-1&&s(E,x,h+4,7),w!=n-1&&(0!=S&&s(E,x,h+4*t-4,3),s(E,x,h+4*t,5),S!=t-1&&s(E,x,h+4*t+4,1)),a[h>>2]=m,b[h>>2]=r[m]}};var E=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const D={md5:void 0,format:void 0,size:void 0,uvScript:void 0,unDelAble:void 0,unDelAbleRef:void 0,id:void 0,cloneSourceId:void 0,minFilter:void 0,isHdr:void 0,cubeMap:void 0,isHelper:void 0,blobMap:void 0,lightProbeIntensity:void 0},P=(e,t)=>{(0,r.mapObj)(D,((n,r)=>{var i=e[n];i!==r&&(t[n]=i)}))};class k{constructor(e){this.animaMap={},this.anima=()=>{(0,r.mapObj)(this.playLimitMap,((e,t)=>{t.limit.update({cb:()=>{var t;null!=(t=this.animaMap[e])&&t.map(((e,t)=>{const{ctx:n,index:r,maxLength:i,texture:a,imageDatas:s,play:o,loop:l,end:u}=t;!1!==o&&(n.putImageData(s[r],0,0),a.needsUpdate=!0,t.index+=1,t.index>=i&&(!1===l&&(!1===u&&(t.index=0,n.putImageData(s[r],0,0),a.needsUpdate=!0),t.play=!1),t.index=0))}))},cbRate:1e3/Number(e)*.001,now:t.clock.getDelta()})}))},this.defEncoding=h.Z.LinearEncoding,this.allTextures=new Set,this.awaitLoader=new d.Z,this.rgbeLoader=new u.x,this.hdrBack=["hdr","pic"],this.lutBack=["cube","3dl"],this.animaBack=["apng"],this.inited=()=>{this.runScene.cb.exporter.gltf.options.add.cb({type:"texture",parse:e=>{e&&(e=JSON.parse(e),(0,r.mapObj)(e,((e,t)=>{this[e]=t})))},process:()=>{const e={};return this.defEncoding!==h.Z.LinearEncoding&&(e.defEncoding=this.defEncoding),JSON.stringify(e)}})},this.cubeLoader=new i.CubeTextureLoader,this.setAnima=e=>{const{texture:t,type:n,val:r}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===r?delete i[n]:i[n]=r,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:i})},this.awaitOuterToImgBitMapMap=new d.Z,this.playLimitMap={},this.runScene=e,this.snapshot=new _(e),this.msg=new y(e),this.multip=new b.Z(e),this.runScene.cb.inited.add("texture",this.inited),e.cb.render.on(this.anima)}load(e,t){return E(this,void 0,void 0,(function*(){var n=yield(0,v.urlToBlob)(e);return this.parse(n,t)}))}getAnimaData(e){var t=fe.getFrame(e);return null==(t=this.animaMap[t])?void 0:t.get((0,g.Ki)(e))}setApngAnima(e){var{texture:e,type:t,data:n}=e;const r=(this.getAnimaData(e)[t]=n,fe.get(e));"play"===t&&(r.play=n)}setAwaitLoaded(e,t){let n=this.awaitLoader.get(e);n||(n=[],this.awaitLoader.set(e,n)),n.push(t)}onLoaded(e,t){return E(this,void 0,void 0,(function*(){var n=(0,g.Ki)(e);let r=this.awaitLoader.get(n);r&&(null!=t&&t.isGlb||(yield this.runScene.textureEx.afterLoad(e)),r.map((t=>t(e)))),this.runScene.cb.texture.onLoaded.cb({texture:e,opts:t})}))}parseByFile(e,t){return E(this,void 0,void 0,(function*(){let n,r;r=yield(0,v.fileToBlob)(e);const i=e.name.toLocaleLowerCase();return(0,v.isVideoFile)(i)||(this.hdrBack.includes(i.substring(i.lastIndexOf(".")+1))?(n=yield this.parseHdr(r)).userData.isHdr=!0:n=this.lutBack.includes(i.substring(i.lastIndexOf(".")+1))?yield this.parseLutByBlob(r,i):this.animaBack.includes(i.substring(i.lastIndexOf(".")+1))?yield this.parseApng(r):yield G(r,t)),{texture:n,blob:r}}))}parseLutByBlob(e,t){return E(this,void 0,void 0,(function*(){var n=yield e.text();return/.3dl$/im.test(t)?this.runScene.loaderer.lut3dlLoader.parse(n):/.cube$/im.test(t)?this.runScene.loaderer.lutCubeLoader.parse(n):void 0}))}parse(e,t){return E(this,void 0,void 0,(function*(){var n,r=(t=(0,v.mergeObject)({flipY:!0,isEnv:!1},t)).isEnv;let i,a;return X(e)?e:(e instanceof Array?a=6===e.length?(i=yield this.praseCubeByFiles(e),yield(0,v.fileToBlob)(e[0])):(n=e[0],i=(n=yield this.parseByFile(n,t)).texture,n.blob):e instanceof File?(i=(n=yield this.parseByFile(e,t)).texture,a=n.blob):i=i||(yield G(t.url||e,t)),r&&Z(i),this.afterLoad(i,a))}))}praseCubeByFiles(e){return E(this,void 0,void 0,(function*(){const t={};if(6!==e.length)throw TypeError("立方体纹理加载时,必须包含六张贴图");const n=[];var r=e.map((e=>E(this,void 0,void 0,(function*(){var r=ce.findIndex((t=>e.name.includes(t)));if(-1===r)throw TypeError("立方体纹理加载时,文件名必须包含方位信息");var i=URL.createObjectURL(e);t[ce[r]]=yield(0,v.fileToBlob)(e),n[r]=i}))));yield Promise.all(r);const i=yield this.cubeLoader.loadAsync(n);return i.encoding=h.Z.sRGBEncoding,i.userData.blobMap=t,i}))}praseCubeByBlobMap(e){return E(this,void 0,void 0,(function*(){const t=yield this.cubeLoader.loadAsync(ce.map((t=>URL.createObjectURL(e[t]))));return t.encoding=h.Z.sRGBEncoding,t.userData.blobMap=e,t}))}createLightProbe(){}setLightProbeForCube(e,t,n){var r=e.userData.lightProbe;if(t){if(!r){const t=new i.LightProbe;return t.copy(o.fromCubeTexture(e)),void 0!==n&&(t.intensity=n),e.userData.lightProbe=t,this.runScene.helperEx.setHelper(t,!0),this.runScene.modelEx.add(t,void 0,{addToTree:!1,addUndo:!1,isClone:!1}),t}}else r&&(this.runScene.modelEx.remove(e.userData.lightProbe,!1),delete e.userData.lightProbe)}parseHdr(e){return E(this,void 0,void 0,(function*(){const t=yield this.rgbeLoader.loadAsync(URL.createObjectURL(e));return t.userData.md5=(0,v.getMd5)(t.source.data.data),t.encoding=h.Z.LinearEncoding,t}))}clone(e){const t=e.clone();return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,r.getId)(),cloneSourceId:(0,g.Ki)(e)}),(0,f.bv)(t,"minFilter"),F(t,this.runScene),this.getSameAndAddtoAll(t)}getDef(e){return e=new i.Texture(e),F(e,this.runScene),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))||(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return E(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield F(e,this.runScene,t))}))}getSameTexture(e,t){if(!Y(t))for(const r in this.runScene.uniqueEx.texture.map){var n=this.runScene.uniqueEx.texture.get(r);if(n.userData.md5===e)return n.mapping===t.mapping?n:void 0}}initTextureAndAddtoAll(e){return E(this,void 0,void 0,(function*(){return z(e),F(e,this.runScene),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,v.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t,n){return E(this,void 0,void 0,(function*(){var i=(n||{}).addUndo;let a;a=X(t)?t:t?yield this.parse(t):null;var s=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(s){const e=[];return yield Promise.all((0,r.mapObj)(s,((t,{datas:n,type:r})=>{if("scene"===r)n.map((e=>this.runScene.sceneEx.set(e,a)));else{const r=this.runScene.uniqueEx.material.get(t);if(r)return Promise.all(n.map((t=>E(this,void 0,void 0,(function*(){e.push(yield this.runScene.materialEx.setTexture({material:r,type:t,newVal:a,getUndo:!0},!1))})))))}}))),i&&this.runScene.undoEx.addUndo(e),e}}))}remove(e){return E(this,void 0,void 0,(function*(){const t=[],n=[];yield Promise.all(c.F6.toArr(e).map((e=>E(this,void 0,void 0,(function*(){const i=(0,g.Ki)(e);var a=this.runScene.uniqueEx.texture.map[i];if(a){a=a.targets,(0,r.mapObj)(a,((e,{datas:t})=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{n.push(this.runScene.materialEx.setTexture({material:r,type:e,newVal:null,getUndo:!0},!1))})),(0,p.updateMaterial)(r))})),yield Promise.all(n).then((e=>{t.push(...e)}));const s=this.runScene.uniqueEx.texture.map[i];t.push(new m.Z({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new m.Z({undo:()=>{this.runScene.uniqueEx.texture.map[i]=s},redo:()=>{delete this.runScene.uniqueEx.texture.map[i]}}).execute())}}))))),this.runScene.undoEx.addUndo(t)}))}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),le(e)&&this.setLightProbeForCube(e,!1),I(e)}reverseImageBitMapTexture(e){return E(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:n}=yield(0,v.reverseImageBitMap)(e.image);const a=new i.Texture(n);return a.needsUpdate=!0,n=this.runScene.uniqueEx.texture.map[e.userData.id],(0,r.mapObj)(n.targets,((t,{datas:n})=>{const r=this.runScene.uniqueEx.material.get(t);n.forEach((t=>{this.runScene.materialEx.setTexture({material:r,type:t,newVal:e},!1)}))})),z(a),yield F(a,this.runScene),this.runScene.cb.texture.add.cb(a),this.delete(e),(0,v.disposeCanvas)(t),a}))}setUnDelAble(e,t,n="custom",r){ae.set(e,t,n,r),this.runScene.cb.texture.set.cb({type:ie,texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,g.Ki)(e)){const n=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,r.mapObj)(e.targets,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&n.push(...t.models.toArray())})),0!==n.length))return t&&this.runScene.multipSelector.add(n,!0),n}}getUsedMaterial(e){if((e=(0,g.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,r.mapObj)(e.targets,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}setMinFilter(e){this.runScene.uniqueEx.texture.getAll().map((({texture:t})=>{te(t,e)}))}getSize(e){let t=0;return e.userData.blobMap?(0,r.mapObj)(e.userData.blobMap,((e,n)=>t+=n.size)):t+=e.userData.blob.size,t}setEncoding(e){const t="def"===e?h.Z.LinearEncoding:h.Z.sRGBEncoding;this.defEncoding=t,this.runScene.uniqueEx.texture.getAll().map((e=>{const n=e.texture;n.encoding=t,n.needsUpdate=!0}))}getAllBase64ByType(e){const t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:e,base64:n})=>E(this,void 0,void 0,(function*(){var r,i=(0,g.Ki)(e);!i||(r=e.image)instanceof ImageBitmap&&(t[i]=n||(0,v.imgBitMapToBase64)(r))})))),t}createByImg(e,t){return e=new i.Texture(e),this.afterLoad(e,t)}bindDataForTexture(e,t){t.repeat.copy(e.repeat),t.offset.copy(e.offset),t.center.copy(e.center),t.rotation=e.rotation,(0,r.mapObj)(e.userData.uvScript||{},((e,n)=>{this.setAnima({texture:t,type:e,val:n})})),te(t,ne(e)),t.encoding=e.encoding}toStandard(e){return E(this,void 0,void 0,(function*(){var t=e.source.data;return t?(t instanceof ImageBitmap||(yield this.otherToImgBitMap(e)),{valid:!0}):{valid:!1}}))}otherToImgBitMap(e){var t=(0,g.Ki)(e);return this.awaitOuterToImgBitMapMap.has(t)?e:(this.awaitOuterToImgBitMapMap.set(t,!0),this._imgToImgBitMap(e))}_imgToImgBitMap(e){return E(this,void 0,void 0,(function*(){var t=e.source.data;if(t.localName&&"img"===t.localName){if(!(t=t.src))return;if(!(t=yield(0,v.blobUrlToBlob)(t)))return;if(!(t=yield xe(t)))return;e.source.data=t}return e}))}parseApng(e,t){return E(this,void 0,void 0,(function*(){var n=yield(0,r.parseFile)(e,"arrayBuffer"),a=M.decode(n),s=M.toRGBA8(a);const o=document.createElement("canvas");var l=s.length;const u=o.getContext("2d");u.canvas.height=a.height,n=new i.CanvasTexture(u.canvas),u.canvas.width=a.width;const c=[];for(let e=0;e<l;e++){var h=new ImageData(new Uint8ClampedArray(s[e]),a.width,a.height);u.putImageData(h,0,0),c.push(h)}(0,g.x)(n,null==t?void 0:t.id),fe.set(n,!0,t);var p=(null==t?void 0:t.frame)||fe.getFrame(n);let f=this.animaMap[p];f=f||(this.animaMap[p]=new d.Z);var m=!1!==(null==t?void 0:t.play);return f.set((0,g.Ki)(n),{texture:n,imageDatas:c,ctx:u,index:0,maxLength:l,play:m}),console.log("Log-- ",f,"frameMap"),this.playLimitMap[p]||(this.playLimitMap[p]={clock:new i.Clock,limit:new v.LimitCb}),n}))}setFrame(e,t){if(fe.is(e)){var n=fe.getFrame(e),r=(0,g.Ki)(e),a=null==(a=this.animaMap[n])?void 0:a.get(r);if(a){this.animaMap[n].delete(r);let s=this.animaMap[t];s=s||(this.animaMap[t]=new d.Z),fe.setFrame(e,t),s.set(r,a),this.playLimitMap[t]||(this.playLimitMap[t]={clock:new i.Clock,limit:new v.LimitCb})}}}}const O={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},A=(e,t)=>{let n="image/jpeg"===t?1022:1023;return e.format=n,e},C=e=>1023===e.format?"image/png":"image/jpeg",N=e=>{let t=0;return e.map((e=>t+=L(e))),t},L=(e,t)=>{if(e.userData.gm&&!t)return e.userData.gm;let n=0,r=e.source.data;return(r=e.source.data instanceof Array?r:[e.source.data]).map((e=>{var{width:e,height:t}=e||{width:0,height:0};n+=e*t*4*1.33})),n},I=e=>{var t,n;e&&(t=e.image,n=e.userData.url,t instanceof ImageBitmap?(0,v.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,v.disposeCanvas)(t),URL.revokeObjectURL(n),e.dispose())},R=(e,t)=>{e.userData.blob=t,e.userData.mimeType=t.type},U=e=>{e.image&&(e.userData.gm=L(e,!0),e.userData.size={width:e.image.width,height:e.image.height})},B=(e,t)=>{e.userData.isHdr?e.userData.url=Se(e):e.userData.url=URL.createObjectURL(t)},F=(e,t,n)=>E(void 0,void 0,void 0,(function*(){e.userData.isHdr&&(e.flipY=!0);var t=(0,v.isBlob)(e.userData.blob)?e.userData.blob:null,{md5:r,url:i}=(t=n||t||(yield j(e)),R(e,t),e.userData);return r||(e.userData.md5=yield ue(e)),i||B(e,t),e.userData.gm=L(e),e.needsUpdate=!0,e})),j=e=>(0,v.isBlob)(e.userData.blob)?e.userData.blob:(0,v.imgBitMapToBlob)(e.image),z=e=>{if(!e.userData.isHdr&&!e.isCubeTexture)return e.magFilter=1006,e.wrapS=h.Z.RepeatWrapping,e.wrapT=h.Z.RepeatWrapping,3001!==e.encoding&&(e.encoding=3e3),e.version=3,e.userData.flipY?e.flipY=!0:e.flipY=!1,e.flipY=!0,"nearest"!==ne(e)&&(e.minFilter=h.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},V={resizeQuality:"pixelated"},H=(e,t)=>{const n=Object.assign({},V);return null!=t&&t.flipY&&(n.imageOrientation="flipY"),createImageBitmap(e,n)},W=e=>{const t={resizeQuality:"pixelated"};return null!=e&&e.flipY&&(t.imageOrientation="flipY"),t},G=(e,t)=>E(void 0,void 0,void 0,(function*(){var n=yield H(yield se(e instanceof Blob?URL.createObjectURL(e):e),t);const r=new i.Texture(n);return r.needsUpdate=!0,r})),K=e=>null==(e=e.userData)?void 0:e.url,Z=(e,t="repeat")=>(e.mapping="repeat"===t?h.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),q=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},X=e=>null==e?void 0:e.isTexture,Y=e=>void 0!==e.userData.cloneSourceId,Q=e=>e.userData.cloneSourceId,J=(e,t)=>{e.userData.cloneSourceId=t},$=e=>{e.needsUpdate=!0},ee=(e,t)=>{const n={};c.F6.toArr(e).map((e=>{var t=e.minFilter;n[(0,g.Ki)(e)]={oldMig:t,texture:e},te(e,t===h.Z.LinearMipmapLinearFilter?"nearest":"linear"),setTimeout((()=>{}))})),setTimeout((()=>{(0,r.mapObj)(n,((e,t)=>{var{oldMig:t,texture:n}=t;te(n,t===h.Z.LinearMipmapLinearFilter?"linear":"nearest")})),null!=t&&t()}),500)},te=(e,t)=>{e.minFilter=h.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,f.M)(e,"minFilter",t),$(e)},ne=e=>(0,f.is)(e,"minFilter")||"linear",re="unDelAble",ie="unDelAbleRef",ae={is(e,t){return!!(0,f.is)(e,ie)&&(!t||this.isLink(e,t))},getRef:e=>(0,f.is)(e,ie),set(e,t,n,r){if(t)(0,f.M)(e,ie,n);else{let t=!1;(t=!(!r&&(0,f.is)(e,ie)!==n)||t)&&(delete e.userData[re],delete e.userData[ie])}},isLink(e,t){const n=ae.getRef(e);var[e,r]=n.split("_");return!("snapshot"===e&&!t.snapshot.map.get(r))}},se=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},oe=e=>{var t;return!!pe.is(e)||0===(null==(t=e.userData.blob)?void 0:t.size)||void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height)},le=e=>e.isCubeTexture||!1,ue=e=>E(void 0,void 0,void 0,(function*(){var t;return le(e)?(t=(yield Promise.all(ce.map((t=>E(void 0,void 0,void 0,(function*(){return(0,v.getMd5)(yield e.userData.blobMap[t].arrayBuffer())})))))).reduce(((e,t)=>e+t)),(0,v.getMd5)(t)):(0,v.getMd5)(yield e.userData.blob.arrayBuffer())})),ce=["px","nx","py","ny","pz","nz"],de=(e,t)=>{e.encoding="def"===t?h.Z.LinearEncoding:h.Z.sRGBEncoding,e.needsUpdate=!0},he=e=>e.userData.isHdr?"hdr":e.isCubeTexture?"cube":"normal",pe={is:e=>(0,f.is)(e,"isHelper"),set(e,t){t?(0,f.M)(e,"isHelper",!0):delete e.userData.isHelper}},fe={is:e=>(0,f.is)(e,"isAnima")||void 0!==(0,f.is)(e,"apngAnima"),get:e=>(0,f.is)(e,"apngAnima"),set(e,t,n){t?(0,f.M)(e,"apngAnima",{play:void 0===(null==n?void 0:n.play)||(null==n?void 0:n.play),frame:void 0!==(null==n?void 0:n.frame)?null==n?void 0:n.frame:Ae[2]}):delete e.userData.apngAnima},setFrame(e,t){(0,f.is)(e,"apngAnima").frame=t},getFrame(e){var t;return(null==(t=(0,f.is)(e,"apngAnima"))?void 0:t.frame)||(0,f.is)(e,"frame")||"25"}},me={is:e=>(0,f.is)(e,"isAssets"),set(e,t){t?(0,f.M)(e,"isAssets",!0):delete e.userData.isAssets}},ge=()=>new h.Z.Texture(new Image(1,1)),ve=e=>{if((e=e.image)instanceof ImageBitmap)return(0,v.imgBitMapToBase64)(e)},ye=(e,t)=>E(void 0,void 0,void 0,(function*(){we(e,(0,v.base64ToBlob)(t))})),be=e=>xe(new Blob([e])),xe=e=>createImageBitmap(e,Object.assign(Object.assign({},V),{imageOrientation:"flipY"})),we=(e,t)=>E(void 0,void 0,void 0,(function*(){var n=yield createImageBitmap(t,Object.assign(Object.assign({},V),{imageOrientation:"flipY"}));e.image=n,U(e),R(e,t),B(e,t)})),Se=(()=>{const e=new i.Scene,t=new i.PerspectiveCamera,n=new i.WebGLRenderer;return new h.z(t,n.domElement),e.add(t),r=>{var{width:i,height:a}=r.source.data;return n.setSize(i,a),e.background=r,n.render(e,t),n.domElement.toDataURL("image/webp")}})(),_e=e=>(null==(e=null==(e=e.userData)?void 0:e.blob)?void 0:e.size)||0,Te=(e,t)=>{var{width:e,height:n}=e.image;return e*t*n*t*4*1.33},Me=(e,t)=>{let n=0;return c.F6.toArr(e).map((e=>{n+=Te(e,t||1)})),n},Ee=e=>(0,f.is)(e,"url"),De=()=>new i.Texture(new Image(1,1)),Pe=e=>{(0,f.M)(e,"type","onlySave")},ke=["snapshot-texture","lut-texture"],Oe={set:e=>{var{texture:e,type:t,subType:n}=e,t=t+"_"+n;return(0,g.x)(e,t),t},get(e){const t=(0,g.Ki)(e.texture);var[e,n]=t.split("_");if(ke.includes(e))return{type:e,subType:n}},getAll:e=>c.F6.filter((0,r.mapObj)(e.runScene.uniqueEx.texture.map,((t,n)=>{var r=Oe.get(n);if(r)return r.type===e.type?Object.assign({texture:n.texture},r):void 0})))},Ae=["6","12","25","60"]},6006:(e,t,n)=>{n.d(t,{Z:()=>s}),t=n(7995);var r=n(960),i=n(1794),a=n(2233);class s{constructor(e){this.map=new i.Z,(this.runScene=e).cb.events.window.pointer.up.add("core-texture",(()=>{this.clear()}))}add(e,t){t&&this.clear(),r.F6.toArr(e).map((e=>{var t=(0,a.Ki)(e);if(t){if(this.map.has(t))return this.del(e);s.callBack.add.cb({texture:e}),this.map.set(t,e)}}))}del(e){var t=(0,a.Ki)(e);t&&(this.map.delete(t),s.callBack.del.cb({texture:e}))}clear(){this.map.clear(),s.callBack.clear.cb()}setSelect(e){this.runScene.events.key.ctrl?this.add(e):(this.clear(),this.selected=e,s.callBack.setSelect.cb({texture:e}))}}s.callBack={setSelect:new t.Z,add:new t.Z,del:new t.Z,clear:new t.Z}},6651:(e,t,n)=>{n.d(t,{ZP:()=>i,d9:()=>a});var r=n(960);class i{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e),this.runScene.cb.undo.undo.cb({data:e}))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){0!==r.F6.toArr(e).length&&(this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e))}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e),this.runScene.cb.undo.redo.cb({data:e}))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var a=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=a(e[t]),r[t]=n);return r}}},4852:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends n(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene,isScene:this.isScene})}execute(){return this.redo(),this}}},4773:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(7626);class i{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:n,addTree:r,isClone:i,runScene:a,isScene:s}=e;this.runScene=a,this.model=e,this.parent=t,!1===r&&(this.addTree=r),!0===i&&(this.isClone=i),n&&(this.cb=n),this.isScene=s}remove(e){const{model:t,parent:n,addTree:r,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),n.remove(t),r&&i.uniqueEx.model.remove(t),r&&i.cb.model.remove.cb({model:t,parent:n}),i.uniqueEx.material.addModel(t,void 0,t.material),i.modelEx.onDelete(t),this.cb(t,"remove")}add(e){const{model:t,parent:n,addTree:i,isClone:a,runScene:s,isScene:o}=e;n.add(t),i&&s.uniqueEx.model.add(t),i&&s.cb.model.add.cb({model:t,parent:n,isClone:a,isScene:o}),s.modelEx.onAdd(t),s.uniqueEx.material.addModel(t,t.material),(0,r.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)})),this.cb(t,"add")}}},4616:(e,t,n)=>{n.d(t,{Z:()=>r});class r{}},9430:(e,t,n)=>{n.d(t,{Z:()=>i});class r extends n(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const i=r},3735:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(6001);class i extends n(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,e.executeFn&&(this.executeFn=e.executeFn),this.old=(0,r.objLastMap)(e.target,this.typeList)[(0,r.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,r.objLastMap)(this.target,this.typeList);var n=t[(0,r.lastArrayEle)(this.typeList)];this.executeFn?this.executeFn({typeList:this.typeList,target:this.target,val:e,oldVal:n}):t[(0,r.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t,{typeList:this.typeList,target:this.target,val:e,oldVal:n})}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const a=i},2510:(e,t,n)=>{n.d(t,{Z:()=>a}),t=n(4616);var r=n(960);class i extends t.Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=(e,t,n,r)=>{};var{target:e,info:t,oldVal:n,newVal:r,runScene:i,cb:a,executeCb:s}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,a&&(this.cb=a),s&&(this.executeCb=s)}_execute(e,t){var{target:n,info:i}=this,n={target:n,info:i,val:e,type:t},a=this.runScene.cb.undo.normal.valid.cb(n);if(r.F6.isTrues(a)){if(this.executeCb)return this.executeCb(n);a=this.target.name,this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(n=this.runScene.uniqueEx.model.parseName(this.target),this.runScene.cb.model.changeName.cb({model:this.target,name:e=n||e,oldName:a})):"material"===this.info?(n=e===this.newVal?this.oldVal:this.newVal,this.runScene.uniqueEx.material.addModel(this.target,e,n)):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target,t,e,i)}}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,"undo")}redo(){this._execute(this.newVal,"redo")}}const a=i},7169:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends n(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,n)=>{n.d(t,{Z:()=>i});class r extends n(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";const{target:t,info:n,newV3:r,oldV3:i,runScene:a,cb:s}=e;this.target=t,this.info=n,this.runScene=a,this.newV3=r,this.cb=s,this.oldV3=i||t[n].clone(),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target)),this._theCb()}_execute(e){this.target.updateWorldMatrix(!0,!0),this.runScene.cb.model.setVector3.cb({type:this.info,model:this.target}),this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.helperEx.focus(this.target),this.runScene.modelEx.updateV3()),this.target.updateWorldMatrix(!0,!0),null!=(e=this.cb)&&e.call(this)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3),this._theCb()}_theCb(){this.runScene.modelEx.setInfo({model:this.target,type:"v3",data:{isDelay:!1}})}redo(){this._execute(this.newV3),this._theCb()}}const i=r},2233:(e,t,n)=>{n.d(t,{ZP:()=>y,Ki:()=>b,oe:()=>x,x:()=>w});var r=n(6001),i=n(272),a=n(135),s=n(9457),o=n(960);class l{constructor(e){this.map={},this.removes=[],this.getUnUsers=()=>o.F6.filter((0,r.mapObj)(this.map,((e,{material:t,models:n})=>0===n.size?{id:e,material:t}:null))),this.unique=e}add(e,t,n){(0,a.getMaterials)(e).map((e=>{if(null!=e&&e.userData&&!a.materialIgnore.is(e)){let a=e.userData.id;if(a||(a=(0,r.getId)(),e.userData.id=a),this.map[a]){if(this.map[a].material.name!==e.name){const t=(0,r.getId)();e.userData.id=t,this.map[t]={material:e,models:new i.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[a]={material:e,models:new i.Z},this.unique.runScene.cb.unique.material.add.cb(e),"MeshPhongMaterial"===e.type&&s.Z.afterload(e,this.unique.runScene);t?this.addModel(t,e,n):this.unique.runScene.cb.unique.material.setTimecited.cb({material:e,length:this.map[a].models.size})}}))}addModel(e,t,n){if(!n||!t||b(n)!==b(t)){if(null!=t&&t.userData){var r=b(t);const n=this.map[r];n&&(n.models.add(e),this.unique.runScene.cb.unique.material.setTimecited.cb({material:t,length:n.models.size}))}if(n){const t=this.map[b(n)];t&&((r=t.models.find((t=>b(t)===b(e))))&&t.models.delete(r),this.unique.runScene.cb.unique.material.setTimecited.cb({material:n,length:t.models.size}))}}}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,r.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}isUsed(e){return!!(e=this.map[e])&&0<e.models.size}clearUnUsed(){this.getUnUsers().map((({material:e})=>{this.unique.runScene.materialEx.remove(e)}))}getByName(e){for(const n of Object.values(this.map)){var t=n.material;if(t.name===e)return t}}}var u=n(7626),c=n(3924),d=n(3379),h=n(6272),p=n(158);class f extends n(8716).Z{constructor(e){super(e),this.nameMap={},this.map={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),r.type.isNumber(e)?Number.parseInt(e):-1)},t=(n,r,i)=>{var a=(t=>{if(-1===e(t))return t;var n=t.lastIndexOf("_");return-1===n?t:t.slice(0,n)})(n)+"_"+r++;return this.nameMap[a]&&this.nameMap[a]!==i?t(n,r,i):a},n=["PerspectiveCamera"];return r=>{if(n.includes(r.type))return r.name=r.type;let i=r.name;i=i||r.type;var a=this.unique.getId(r);if(!this.nameMap[i])return this.nameMap[i]=a,i;var s=this.nameMap[i];return this.unique.model.get(s)===r?i:(s=e(i),s=t(i,s=-1===s?0:s,a),this.nameMap[s]=this.unique.getId(r),s!==i&&this.unique.runScene.cb.model.changeName.cb({model:r,name:s,oldName:r.name}),r.name=s)}})(),this.getByFilterRules=e=>{const{type:t,func:n}=e;return this.find((({model:e,type:r})=>{if(t.includes(r)){for(const t of n){if("lock"===t)return c.lockModel.isLock(e,!1);if("dynamic"===t)return c.dynamicModel.isDynamic(e);if("glow"===t)return(0,c.isGLowModel)(e);if("outline"===t)return(0,d.S)(e)}return!0}}))},this.geometry=new class extends h.JD{constructor(){super(...arguments),this.map={}}onModelAdd(e){var{}=e}}(this),e.runScene.cb.model.changeName.on((({oldName:e,model:t})=>{this.nameMap[e]===b(t)&&delete this.nameMap[e]}))}onAdd(e){this.geometry.onModelAdd(e)}add(e,t){var{reset:n,hasReset:i,oldId:a}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,c.isHelper)(e)){a&&delete this.map[a];let s=e.userData.id;if(s&&!n||(s=(0,r.getId)(),e.userData.id=s),this.map[s]){if(e.name||(e.name=e.type),this.nameMap[e.name]&&this.parseName(e),!(i||(0,p.An)(this.unique.runScene)&&(0,p.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[s].model.name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[s].model.name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));s=(0,r.getId)(),e.userData.id=s}return this.unique.runScene.cb.unique.model.add.cb({model:e}),this.map[s]={model:e,type:(0,c.getModelType)(e)},this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,u.RQ)(e)||(0,c.isHelper)(e)?(this.onAdd(e),s):this.add(e.children,t)}}get(e){return null==(e=this.map[e])?void 0:e.model}getModelsWithIds(e){return e.map((e=>this.get(e))).filter((e=>e))}getByName(e){return this.nameMap[e]}getIdByNames(e){return e.map((e=>this.getByName(e))).filter((e=>e))}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{var t;null!=(t=e.onDelete)&&t.call(e),this.unique.runScene.cb.unique.model.remove.cb({model:e,parent:e.parent}),delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const n=t.toLowerCase();return n===(t=e.toLowerCase())||-1!==n.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}getModelsByType(e){return o.F6.filter((0,r.mapObj)(this.map,((t,{model:n,type:r})=>r===e&&null!==n.parent?n:null)))}has(e){return!!this.map[e]}find(e){return o.F6.filter((0,r.mapObj)(this.map,((t,n)=>{if(e(n))return n.model})))}}var m=n(7013);class g{constructor(e){this.map={},this.onSetMaterial=e=>{var{target:e,type:t,oldVal:n,val:r,targetType:i}=e;n!==r&&(n&&(this.unlinkMaterial({target:e,type:t,texture:n}),this.unique.runScene.cb.unique.texture.setTimecited.cb({texture:n,length:Object.keys((null==(n=this.map[b(n)])?void 0:n.targets)||{}).length})),r&&(this.linkMaterial(r,{target:e,type:t,targetType:i}),this.unique.runScene.cb.unique.texture.setTimecited.cb({texture:r,length:Object.keys((null==(n=this.map[b(r)])?void 0:n.targets)||{}).length})))},this.setForSavedData=e=>{},this.unique=e,this.unique.runScene.cb.texture.setMaterial.add("unique-texture",this.onSetMaterial)}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,r.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,targets:{}},t)}}getLength(){return Object.keys(this.map).length}unlinkMaterial(e){var t,{target:e,type:n,texture:r}=e;if(r){r=r.userData.id||this.add(r),e=b(e);const i=null==(t=this.map[r].targets[e])?void 0:t.datas;i&&(i.delete(n),0===i.size&&delete this.map[r].targets[e])}}linkMaterial(e,t){var n=e.userData.id||this.add(e),{target:t,type:r,targetType:a}=t;this.map[n]||(this.map[n]={targets:{},texture:e}),e=b(t),this.map[n].targets[e]||(this.map[n].targets[e]={type:a,datas:new i.Z});const s=this.map[n].targets[e].datas;s.add(r),"material"===a&&this.unique.runScene.cb.unique.material.setTimecited.cb({material:t,length:s.size})}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.targets}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,r.mapObj)(t.targets,((e,{datas:t,type:n})=>{if("scene"===n)t.map((e=>{this.unique.runScene.sceneEx.set(e,null)}));else{const n=this.unique.runScene.uniqueEx.material.get(e);n&&t.forEach((e=>{m.ZP.setTexture({material:n,type:e,texture:null})||(n[e]=null)}))}})),delete this.map[e.userData.id])}dispose(){(0,r.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(e){return o.F6.filter((0,r.mapObj)(this.map,((t,n)=>void 0===e?n:(t=0<this.getTimeCitedLength(t),e?t&&n:!t&&n))))}clearUnUsed(){this.getAll(!1).map((({texture:e})=>{this.unique.runScene.textureEx.remove(e)}))}getTimeCitedLength(e){return(e=this.map[e])?Object.keys(e.targets).length:0}replace(e,t){t=t||b(e);const n=this.map[t];n&&(t=n.texture,n.texture=e,this.unique.runScene.cb.texture.remove.cb(t),this.unique.runScene.cb.texture.add.cb(e))}}var v=n(1549);class y{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new f(this),this.material=new l(this),this.texture=new g(this),this.geometry=new v.ZP(this),this.runScene.cb.clean.add("EngineModel",this.clean)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const b=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",x=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||void 0,w=(e,t)=>{if(e.userData)return e.userData.id=t||(0,r.getId)(),e.userData.id}},8716:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(6001);class i{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,r.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}},1549:(e,t,n)=>{n.d(t,{ZP:()=>c});var r=n(6001),i=n(7995),a=n(960),s=n(1794),o=n(272),l=n(2233),u=(t=n(8716),n(9663));class c extends t.Z{constructor(e){super(e),this.map=new s.Z,this.uuidMap=new s.Z,this.sameMap=new s.Z,this.onModelRemove=e=>{const t=this.map.get((0,l.Ki)(e.model.geometry));t&&t.models.remove((0,l.Ki)(e.model))},this.onModelAdd=e=>{var t=(e=e.model).geometry;if(t&&d(t)){var n=null!=(n=(0,l.oe)(t))?n:(0,l.x)(t),r=t.uuid,i=(this.uuidMap.set(r,{id:n}),r=a.F6.toArr(e.material)[0],this.isSame({geometry:t,material:r}));if(i){var c=(0,l.Ki)(i.geometry);let a=this.sameMap.get(c),d=(a||(a=new s.Z,this.sameMap.set(c,a)),a.get(n));d||(d={models:new o.Z,size:(0,u.pO)(t),isSame:!0,geometry:t,material:r,id:n},a.set(n,d)),d.models.add((0,l.Ki)(e))}let d=this.map.get(n);return d||(d={models:new o.Z,size:(0,u.pO)(t),isSame:void 0!==i,geometry:t,material:r,id:n,isLock:t.userData.lock},this.map.set(n,d)),d.models.add((0,l.Ki)(e)),this.unique.runScene.cb.unique.geometry.add.cb(d),d}},this.clean=()=>{this.map.clear(),this.uuidMap.clear(),this.sameMap.clear()},this.init()}init(){this.unique.runScene.cb.unique.model.add.add("unique-geometry",this.onModelAdd),this.unique.runScene.cb.unique.model.remove.add("unique-geometry",this.onModelRemove),this.unique.runScene.cb.clean.add("unique-geometry",this.clean)}isSame(e){const{geometry:t,material:n}=e;return this.map.toArray("value").find((e=>{if(t.uuid!==e.geometry.uuid&&!e.isSame&&(0,l.Ki)(n)===(0,l.Ki)(e.material)){e=d(e.geometry);var r=d(t);if(e&&r)return e.length===r.length}}))}getModelsById(e){const t=this.map.get(e);if(t)return this.unique.runScene.modelEx.getById(t.models.toArray())}getSize(e){let t=0;return(0,r.mapObj)(e.attributes,((e,n)=>{n=n.array,t+=(null==n?void 0:n.byteLength)||0})),t}replaceForModel(e){var{models:e,geometry:t}=e;const n=this.map.get((0,l.Ki)(t));h(e).map((e=>{var t=e.geometry;let r=this.map.get((0,l.Ki)(t));(r||(this.onModelAdd(e),r=this.map.get((0,l.Ki)(t))))&&(r.models.delete((0,l.Ki)(e)),n&&n.models.add((0,l.Ki)(e)))}))}getSameMapToMapModel(){const e={};return this.sameMap.map(((t,n)=>{const r=new o.Z,i=this.map.get(t);i&&r.add(i.models.toArray()),n.map(((e,{models:t})=>{r.add(t.toArray())})),r.size<2||(e[t]=r)})),e}processSame(e){e=e.stateMap;const t=[];(0,r.mapObj)(e,((e,{children:n})=>{let i={};const a=this.sameMap.get(e);if(a){(0,r.mapObj)(n,((e,{state:t,id:n})=>{void 0===i[n]&&(i[n]=t)}));const s=[],o=(a.map(((e,t)=>{!1===i[e]?this.map.set(e,t):s.push(...t.models.toArray())})),this.map.get(e));t.push({baseModels:this.unique.runScene.modelEx.getById(o.models.toArray()),mergeModels:this.unique.runScene.modelEx.getById(s)})}})),t.map((({baseModels:e,mergeModels:t})=>{e.length<1||0===t.length||this.unique.runScene.modelEx.setClonedModels(e[0],[...e,...t])}))}clearSame(){this.sameMap.clear()}setLock(e,t){(e.isLock=t)?e.geometry.userData.lock=t:delete e.geometry.userData.lock}reCenter(e,t){a.F6.toArr(e).map((e=>{var n;0!==(null==(e=this.getModelsById((0,l.Ki)(e)))?void 0:e.length)&&([n]=e,this.unique.runScene.modelEx.setCenter(n,Object.assign({sameGeoModels:e},t)))}))}get(e){return this.map.get(e)}getInstanceModel(e){var{geometry:e,material:t}=e;return null==(e=this.get((0,l.Ki)(e)).materialInstanceModelMap)?void 0:e[(0,l.Ki)(t)].instanceModel}}c.getCallBack=()=>({add:new i.Z,del:new i.Z});const d=e=>null==(e=null==(e=null==e?void 0:e.attributes)?void 0:e.position)?void 0:e.array,h=e=>a.F6.filter(a.F6.toArr(e).map((e=>d(null==e?void 0:e.geometry)?e:void 0)))},5317:(e,t,n)=>{n.r(t),n.d(t,{HextoRgb:()=>i.I8,LimitCb:()=>i.cM,MyHextoRgb:()=>i.Dn,addElesFromIndexToArr:()=>i.Rn,addV3:()=>a.Af,angleToNum:()=>a.Zv,anima:()=>i.gY,arrayBufferToBase64:()=>i.sM,arrayBufferToBlobUr:()=>i.oo,arrayToVector3:()=>a.F,base64ToArrayBuffer:()=>i.RG,base64ToBlob:()=>i.Jr,bitMapToCanvas:()=>r.Rd,blobToFile:()=>i.hl,blobUrlToBlob:()=>i.gi,bufferToArrayBuffer:()=>i.cO,canvasToBlob:()=>i._c,changeModelOpc:()=>a.Hg,changeModelOpcs:()=>a.Z7,clone:()=>i.d9,cloneObj:()=>i.Cl,closeNum:()=>i.nx,colorToRgb:()=>a.sS,compressImgToUrl:()=>r.jH,constGeometryAttrs:()=>a.qP,constV3ForModel:()=>a.xt,deepFindParentByUuid:()=>a.Q3,deepMergeObject:()=>i.U,delayTrigger:()=>i.ZY,disposeCanvas:()=>r.eZ,disposeImageBitMap:()=>r.oZ,domTo2Dui:()=>a.UZ,domTo3DSprite:()=>a.YG,domTo3Dui:()=>a.ol,fileAndBlobToCanvas:()=>i.OE,fileToBlob:()=>i.a_,filterFiles:()=>i.Rz,fromCode:()=>i.Ne,getArrIndexByItem:()=>i.B1,getBetweenByV3:()=>a.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>a.Gm,getCenter:()=>a.qg,getClock:()=>a.aM,getColorByHex:()=>a.e9,getColorByHexStr:()=>a.ZD,getCurve:()=>a.kG,getDate:()=>i._3,getDefAndType:()=>a.ZE,getDiff:()=>i.ad,getDistance:()=>a.Sp,getDomChildrenByDom:()=>h,getEmptyImageData:()=>r.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getGeometryInfo:()=>a.l2,getGroupCenter:()=>a.uG,getHexByColor:()=>a.J6,getIdxInParent:()=>o,getImg:()=>r.Pk,getImgByHdrTexture:()=>a.p1,getImgPixels:()=>r.BW,getImgPixels1:()=>r.Cm,getLine2:()=>a.SI,getLutTable:()=>i.HT,getMacro:()=>i.Ls,getMapByRgb:()=>i.fh,getMd5:()=>i.ZM,getModelByType:()=>a.Py,getModelMap:()=>a.yT,getNamesByNum:()=>i.nR,getOptions:()=>s.FW,getPointByProgress:()=>a.Mq,getProgress:()=>i.xC,getProxy:()=>i.Gy,getRGBByHex:()=>a.OR,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>r.xK,getSameGeometry:()=>a.bq,getSizeForGeometry:()=>a.pO,getSizeForGeometryAttr:()=>a.ff,getThreeType:()=>a.ii,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>s.te,getUserAgent:()=>i.ij,getV3Bt:()=>a.ou,getVideoTexture:()=>a.hX,getWorldLocal:()=>a.VU,hslToRgb:()=>r.ve,imageToBlob:()=>r.$N,imgArrayBufferToBlobUrl:()=>r.lU,imgBitMapToBase64:()=>r.s4,imgBitMapToBlob:()=>r.gW,imgBitMapToBlobAndBase64:()=>r.v1,isAudioFile:()=>i.TN,isBlob:()=>i.Lj,isDef:()=>i.Xq,isEditor:()=>s.hz,isEmpty:()=>i.xb,isNull:()=>i.Ft,isRunning:()=>s.An,isSameGeometry:()=>a.Uy,isSameV3:()=>a.lg,isVideoFile:()=>i.NU,isVisible:()=>a.pn,longestCommonPrefix:()=>i.GG,mapDom:()=>d,mapObjToObj:()=>i.Ko,mergeObject:()=>i.Gm,percentageStrToNum:()=>i.zz,privateClass:()=>i.JD,removeLastDot:()=>i.dx,removeUnLess:()=>a.hs,replaceText:()=>i.lp,resetCenter:()=>a.cm,reverseImageBitMap:()=>r.Fs,reverseImg:()=>r.rx,reverseTextureForImageBit:()=>a._r,rgbToHex:()=>a.vq,rgbToHsl:()=>r.lC,rgbToStr:()=>a.$W,rgbToStyle:()=>i.ut,rgbaToRgb:()=>a.Di,rmArrEle:()=>i.J9,rmPartOfString:()=>i.h3,rmSpecialStr:()=>i.xX,sameArr:()=>i.F1,sameV3:()=>a.x$,setDisplayForDom:()=>p,setParentVisible:()=>a.FT,setVal:()=>a.Y6,setWorldPosition:()=>a.$n,shadertoyToThree:()=>a.ys,sleep:()=>i._v,strCompress:()=>i.Uf,strToNum:()=>i.LC,tColorToRgb:()=>a.Lv,textureToThreeD:()=>a.vp,theKey:()=>i.rv,toCode:()=>i.Ni,toFormatRotationValue:()=>a.sy,toInt:()=>i.Hq,toTimeString:()=>i.U9,toTrueRotationValue:()=>a.b3,transByte:()=>i.iM,trimString:()=>i.gK,typeAnima:()=>c,urlToBlob:()=>i.pX,urlToCanvas:()=>i.o4,v2ToMap:()=>a.b7,v3ToMap:()=>a.ln,v3Types:()=>a.td,validType:()=>i.lG,vector:()=>a.xr});var r=n(5137),i=n(6272),a=n(9663),s=n(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:n}=e;return[...e.children].slice(t,n+1)};var u=n(5521);const c=(e,t,n)=>{const{}=n||{},r={},a={};e.map(((e,t)=>{const{begin:n,end:s,type:o,label:l}=e,c="_"+o+"_"+l+"_"+String(t);if("color"===o&&n instanceof u.Color&&s instanceof u.Color){const e=(0,i.I8)("#"+n.getHexString(),!0),t=(0,i.I8)("#"+s.getHexString(),!0);["r","g","b"].map((n=>{var i=n+c;r[i]=e[n],a[i]=t[n]}))}"number"===o&&(r[e=l+c]=n,a[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+c;r[t]=n[e],a[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+c;r[t]=n[e],a[t]=s[e]}))}))},d=(c([{begin:new u.Color(.5,.5,.5),end:new u.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new u.Vector3(1,1,1),end:new u.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new u.Vector2(1,1),end:new u.Vector2(2,2),label:"c",type:"vector2"}],1),(e,t)=>[...e.childNodes].map((e=>t(e)))),h=(e,t)=>t?[...e.childNodes]:[...e.children],p=(e,t)=>{var n;t=t?"block":"none",(null==(n=e.style)?void 0:n.display)!==t&&(e.style.display=t)}},5137:(e,t,n)=>{n.d(t,{$N:()=>u,BW:()=>m,Cm:()=>f,Fs:()=>w,Pk:()=>b,Rd:()=>g,eZ:()=>S,gW:()=>l,jH:()=>p,lC:()=>v,lU:()=>h,mH:()=>T,oZ:()=>_,rx:()=>c,s4:()=>o,v1:()=>d,ve:()=>y,xK:()=>x});var r=n(5247),i=n(9151),a=n(6272),s=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const o=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>s(void 0,void 0,void 0,(function*(){if(!e)return new Blob([]);const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((n=>{e(n),t.remove()}))}))})),u=e=>s(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),c=e=>{const t=document.createElement("canvas"),n=(t.width=e.width,t.height=e.height,t.getContext("2d"));n.translate(0,t.height),n.scale(1,-1),n.drawImage(e,0,0,t.width,t.height)},d=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d")),a=(0,i.getMimeByTexture)(e);return r.drawImage(t,0,0,n.width,n.height),new Promise((e=>{n.toBlob((t=>{e({blob:t,base64:n.toDataURL(a)})}),a)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),p=(e,t)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=e.width,n.height=e.height,r.drawImage(e,0,0,e.width,e.height),new Promise((e=>{n.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},f=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:n}=e;const{ctx:i,canvas:s}=yield(0,a.OE)(URL.createObjectURL(n.userData.blob),{width:t.width,height:t.height});for(var o=i.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,u=o.data.length;l<u;l+=4){var c=(h=v(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,d=h[1]/100,h=h[2]/100;c=y(c,d,h),o.data[l]=c[0],o.data[l+1]=c[1],o.data[l+2]=c[2]}return i.putImageData(o,0,0),new r.Z.Texture(s)})),m=e=>{for(var t=(e=e.bitmap).width,n=e.height,r=g(e).ctx.getImageData(0,0,t,n).data,i=[],a=0;a<r/4;a+=1)i.push(r.slice(4*a,4*(a+1)))},g=e=>{const t=document.createElement("canvas"),n=t.getContext("2d");return n.drawImage(e,0,0,e.width,e.height),{ctx:n,canvas:t}},v=(e,t,n)=>{e/=255,t/=255,n/=255;var r,i=Math.max(e,t,n),a=Math.min(e,t,n),s=(i+a)/2;if(i==a)r=l=0;else{var o=i-a,l=.5<s?o/(2-i-a):o/(i+a);switch(i){case e:r=(t-n)/o+(t<n?6:0);break;case t:r=(n-e)/o+2;break;case n:r=(e-t)/o+4}r/=6}return[100*r,100*l,100*s]},y=(e,t,n)=>{var r,i,a,s;return 0==t?i=a=s=n:(i=(r=function(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e})(t=2*n-(n=n<.5?n*(1+t):n+t-n*t),n,e+1/3),a=r(t,n,e),s=r(t,n,e-1/3)),[255*i,255*a,255*s]},b=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},x=(e,t,n)=>{const r=(0,a.Gm)({base64Type:"webp"},n).base64Type;return new Promise(((n,i)=>{"blob"===t?e.toBlob((e=>{(e?n:i)(e)})):"base64"===t&&n(e.toDataURL("image/"+r))}))},w=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:n}=e;const r=document.createElement("canvas"),i=(r.width=t,r.height=n,r.getContext("2d"));if(i)return i.translate(0,n),i.scale(1,-1),i.drawImage(e,0,0,t,n),{imageBitMap:yield createImageBitmap(i.getImageData(0,0,t,n)),canvas:r}})),S=e=>{e.remove()},_=e=>{e.close()},T=e=>{var{width:e,height:t}=e;const n=document.createElement("canvas");return(n.width=e,n.height=t,n.getContext("2d")).drawImage(new Image,0,0),n}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Cl:()=>cloneObj,Dn:()=>MyHextoRgb,F1:()=>sameArr,Ft:()=>isNull,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,Gy:()=>getProxy,HT:()=>getLutTable,Hq:()=>toInt,I8:()=>HextoRgb,J9:()=>rmArrEle,JD:()=>privateClass,Jr:()=>base64ToBlob,Ko:()=>mapObjToObj,LC:()=>strToNum,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,NU:()=>isVideoFile,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,TN:()=>isAudioFile,U:()=>deepMergeObject,U9:()=>toTimeString,Uf:()=>strCompress,Xq:()=>isDef,ZM:()=>getMd5,ZY:()=>delayTrigger,_3:()=>getDate,_c:()=>canvasToBlob,_v:()=>sleep,a_:()=>fileToBlob,ad:()=>getDiff,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,dx:()=>removeLastDot,fh:()=>getMapByRgb,gK:()=>trimString,gY:()=>anima,gi:()=>blobUrlToBlob,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,ij:()=>getUserAgent,kk:()=>getFilesFromFileList,lG:()=>validType,lp:()=>replaceText,mr:()=>getRandomColor,nR:()=>getNamesByNum,nx:()=>closeNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,rv:()=>theKey,sM:()=>arrayBufferToBase64,sR:()=>getRes,ut:()=>rgbToStyle,xC:()=>getProgress,xX:()=>rmSpecialStr,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer,zz:()=>percentageStrToNum});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(960),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const anima=(e,t,n,r,i)=>{let a=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(a,n,t).eventCallback("onUpdate",(e=>null==r?void 0:r(a))).eventCallback("onComplete",(e=>{null!=i&&i(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var n=t.length;const r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var n=new Uint8Array(e);for(let e=0,r=n.byteLength;e<r;e++)t+=String.fromCharCode(n[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),n=t[0].match(/:(.*?);/)[1],r=atob(t[1]),i=r.length,a=new Uint8Array(i);for(;i--;)a[i]=r.charCodeAt(i);return new Blob([a],{type:n})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const n=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=n.indexOf("."),"00"==n.substr(e+1,2)?n.substring(0,e)+n.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:n}=t;let r=new Image,i=(r.src=e,r.width=t,r.height=n,document.createElement("canvas")),a=(i.width=t,i.height=n,i.getContext("2d"));return new Promise((e=>{r.onload=function(){a.drawImage(r,0,0,i.width,i.height),e({canvas:i,ctx:a})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,n)=>e.files.item(n))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t,n)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer",onDownloadProgress(e){var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),null!=n&&n(e)}}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let n=setTimeout((()=>(null!==n&&clearTimeout(n),n=null,e())),t)},cloneObj=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=e[t],r[t]=n);return r},getNamesByNum=(e,t,n=1,r)=>new Array(t).fill("").map(((t,i)=>e+(i+n)+(r||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((n,r)=>{let i=t[n];void 0!==i&&("Object"===getType(r)&&"Object"===getType(i)&&(i=deepMergeObject(r,i)),e[n]=i)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,n=!1)=>{let r=e/t;return n&&(r*=100),Number(r.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d"));return r.drawImage(t,0,0),{img:t,canvas:n,ctx:r}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;++r)n[r]=e[r];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},theKey="gltf-version-2.0",toCode=e=>{for(var t,n,r=theKey.length,i=theKey.split(""),a="",s=0;s<e.length;s++)a+=i[((n=((n=e.charCodeAt(s))-(t=n%r))/r)-(n%=r))/r%r]+i[n]+i[t];return a},fromCode=str=>{for(var st=theKey.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=theKey.indexOf(str.charAt(d)),d++,b2=theKey.indexOf(str.charAt(d)),d++,b3=theKey.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let r=0;r<e.length;r++){var n=e.item(r);t.push(n)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t,n)=>{var r=e.findIndex((e=>n?e[n]===t[n]:e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,n)=>(t=Array.isArray(t)?t:[t],e.splice(n,0,...t)),sameArr=(e,t,n)=>{if("fill"===n){for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var r=e.length;const i=Math.floor(r/n),a=new Array(n).fill("").map(((e,t)=>(t+1)*i));a.push(0),a.push(r-1);for(const n of a)if(e[n]!==t[n])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:n,cbRate:r}=e;this.timer+=n,this.timer>r&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],n="",r=1;r<e.length;r++){for(var i=0;i<=e[r].length;i++){if(t[i]!=e[r][i]){t=n;break}n+=t[i]}n=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var n;return"number"===t?(n=Number(e),!isNaN(n)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)&&_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(t)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.isDef(e,t):e!==t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const n={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var r=rgbArr[e],i=t[e];if(!i)return;i=strToNum(i),n[r]=i}return n};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var n="#",r=1;r<4;r+=1)n+=e.slice(r,r+1).concat(e.slice(r,r+1));e=n}var i,a,s=[];for(r=1;r<7;r+=2)s.push(parseInt("0x"+e.slice(r,r+2)));return t?([t,i,a]=s,{r:t,g:i,b:a}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,n=0)=>{const r={};return t?((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,n)=>{var i=t[e];isDef(n,i)&&(r[e]=i)})),r):e};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,n,r,i,a,s]=e.split(""),n=(e=parseInt("0x"+e+n),parseInt("0x"+r+i)),r=parseInt("0x"+a+s);return t?{r:e,g:n,b:r}:"RGB("+e+","+n+","+r+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")},percentageStrToNum=e=>(e=Number(e.replace(/%/,"")),isNaN(e)?-1:.01*e),toInt=e=>parseInt(String(e)),closeNum=(e,t,n)=>e<t+n&&t-n<e,strCompress={encrypt:e=>{if(""==e)return"";let t=theKey;if(e=encodeURIComponent(e),""==(t=encodeURIComponent(t))||t.length<=0)return"";for(var n="",r=0,i=t.length;r<i;r+=1)n+=t.charCodeAt(r).toString();var a=Math.floor(n.length/5),s=parseInt(n.charAt(a)+n.charAt(2*a)+n.charAt(3*a)+n.charAt(4*a)+n.charAt(5*a)),o=Math.ceil(t.length/2),l=Math.pow(2,31)-1;if(s<2)return"";var u=Math.round(1e9*Math.random())%1e8;for(n+=u;10<n.length;)n=(parseInt(n.substring(0,10))+parseInt(n.substring(10,n.length))).toString();n=(s*n+o)%l;var c="",d="";for(r=0,i=e.length;r<i;r+=1)d+=(c=parseInt(String(e.charCodeAt(r)^Math.floor(n/l*255))))<16?"0"+c.toString(16):c.toString(16),n=(s*n+o)%l;for(u=u.toString(16);u.length<8;)u="0"+u;return d+u},decrypt:e=>{if(""==e)return"";let t=theKey;if(t=encodeURIComponent(t),null==e||e.length<8)return"";if(null==t||t.length<=0)return"";for(var n="",r=0,i=t.length;r<i;r+=1)n+=t.charCodeAt(r).toString();var a=Math.floor(n.length/5),s=parseInt(n.charAt(a)+n.charAt(2*a)+n.charAt(3*a)+n.charAt(4*a)+n.charAt(5*a)),o=Math.round(t.length/2),l=Math.pow(2,31)-1;for(a=parseInt(e.substring(e.length-8,e.length),16),e=e.substring(0,e.length-8),n+=a;10<n.length;)n=(parseInt(n.substring(0,10))+parseInt(n.substring(10,n.length))).toString();n=(s*n+o)%l;var u,c="";for(r=0,i=e.length;r<i;r+=2)u=parseInt(String(parseInt(e.substring(r,r+2),16)^Math.floor(n/l*255))),c+=String.fromCharCode(u),n=(s*n+o)%l;return decodeURIComponent(c)}},removeLastDot=e=>{const t=e.split(".");return 1<t.length&&t.pop(),t.join(".")},getProxy=e=>new Proxy(e,{set:(e,t,n)=>(e[t]=n,console.log(e,t,n,"a,b,c"),!0)}),blobUrlToBlob=e=>new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="blob",r.onload=function(){var e;200===this.status?(e=this.response,t(e)):n(this.status)},r.send()})),isNull=e=>null==e,delayTrigger=(e,t)=>{let n;return()=>{n&&clearTimeout(n),n=setTimeout(e,1e3*t)}};class privateClass{constructor(e){this.parent=e}}const mapObjToObj=()=>{},rgbToStyle=e=>{e=(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,t)=>t));let t=(e[0]<<16|e[1]<<8|e[2]).toString(16);return"#"+(t.length<6?"0"+new Array(6-t.length).join("0")+t:t)},clone=e=>{},sleep=e=>new Promise((t=>{setTimeout(t,e)})),isVideoFile=e=>(e=e.substring(e.lastIndexOf(".")).toLowerCase().trim(),[".mp4",".mov",".avi",".mkv",".flv",".wmv",".webm"].includes(e)),isAudioFile=e=>(e=e.substring(e.lastIndexOf(".")).toLowerCase().trim(),[".mp3",".wav",".aac",".ogg",".flac",".m4a"].includes(e)),getLutTable=e=>axios__WEBPACK_IMPORTED_MODULE_1___default()(e,{method:"GET"}).then((e=>{var t,n,r=e.data.split("\n");let i=0,a=-1;const s=[],o=[];for(let e=0;e<r.length;e++){const o=r[e];o.includes("LUT_3D_SIZE")?i=+o.replace("LUT_3D_SIZE",""):o&&!/[a-z]/i.test(o)&&(-1===a&&(a=e),t=e-a,n=o.split(" ").map((e=>Number(e))),s[Math.floor(t/i)]||(s[Math.floor(t/i)]=[]),s[Math.floor(t/i)].push(n))}for(let e=0;e<s.length;e++){var l=s[e];o[Math.floor(e/i)]||(o[Math.floor(e/i)]=[]),o[Math.floor(e/i)].push(l)}return{table:o,size:i}})).catch((e=>{console.error(e)})),rmSpecialStr=e=>e.replace(/[^a-zA-Z0-9]/g,""),getUserAgent=()=>-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")?"safari":"chrome",replaceText=(e,t,n)=>null!=e&&e.replace?e.replace(new RegExp(t,"g"),n):e,trimString=e=>{const{str:t,before:n,after:r}=e;return t.length<n+r?t:t.slice(n,t.length-r)}},158:(e,t,n)=>{n.d(t,{An:()=>a,FW:()=>s,hz:()=>i,te:()=>r});const r=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},9663:(e,t,n)=>{n.d(t,{Af:()=>it,Zv:()=>me,F:()=>pe,Hg:()=>oe,Z7:()=>le,sS:()=>De,qP:()=>Je,xt:()=>Qe,Q3:()=>Ie,UZ:()=>ae,YG:()=>se,ol:()=>ie,A2:()=>ye,Gm:()=>ve,qg:()=>Ce,aM:()=>be,e9:()=>xe,ZD:()=>we,kG:()=>he,ZE:()=>Ge,Sp:()=>re,l2:()=>ot,uG:()=>nt,J6:()=>Se,p1:()=>Ve,SI:()=>fe,Py:()=>Le,yT:()=>ge,Mq:()=>Ze,OR:()=>_e,bq:()=>Ye,pO:()=>$e,ff:()=>et,ii:()=>We,ou:()=>rt,hX:()=>de,VU:()=>te,Uy:()=>tt,lg:()=>st,pn:()=>Ue,hs:()=>ce,cm:()=>Be,_r:()=>He,vq:()=>ke,$W:()=>Me,Di:()=>Pe,x$:()=>Te,FT:()=>Re,Y6:()=>Ke,$n:()=>qe,ys:()=>Xe,Lv:()=>Ee,vp:()=>ue,sy:()=>lt,b3:()=>ut,b7:()=>Ae,ln:()=>Oe,td:()=>at,xr:()=>ne});var r=n(6001),i=n(5521),a=n(8881);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=new a.Box3,c=new a.Vector3,d=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(){var e;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(e=function(e,t,n){t=o(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,[],o(e).constructor):t.apply(e,n))&&("object"===s(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new a.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new a.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e),t=n,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new a.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new a.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new a.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new a.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new a.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new a.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new a.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new a.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),u.setFromBufferAttribute(t),this.boundingBox.union(u))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new a.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var n=this.boundingSphere.center,r=(this.boundingBox.getCenter(n),0),i=0,s=e.count;i<s;i++)c.fromBufferAttribute(e,i),r=Math.max(r,n.distanceToSquared(c)),c.fromBufferAttribute(t,i),r=Math.max(r,n.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}a.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new a.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},a.ShaderLib.line={uniforms:a.UniformsUtils.merge([a.UniformsLib.common,a.UniformsLib.fog,a.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){var t;if(this instanceof n)return(t=function(e,t,n){t=p(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n,[{type:"LineMaterial",uniforms:a.UniformsUtils.clone(a.ShaderLib.line.uniforms),vertexShader:a.ShaderLib.line.vertexShader,fragmentShader:a.ShaderLib.line.fragmentShader,clipping:!0}])).isLineMaterial=!0,t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e),t=n,(e=[{key:"color",get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},{key:"worldUnits",get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},{key:"linewidth",get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}},{key:"dashed",get:function(){return"USE_DASH"in this.defines},set:function(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},{key:"dashScale",get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},{key:"dashSize",get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},{key:"dashOffset",get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},{key:"gapSize",get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},{key:"opacity",get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms&&(this.uniforms.opacity.value=e)}},{key:"resolution",get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},{key:"alphaToCoverage",get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.ShaderMaterial);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t,n){t=y(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],y(e).constructor):t.apply(e,n))&&("object"===g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x,w,S=new a.Vector3,_=new a.Vector3,T=new a.Vector4,M=new a.Vector4,E=new a.Vector4,D=new a.Vector3,P=new a.Matrix4,k=new a.Line3,O=new a.Vector3,A=new a.Box3,C=new a.Sphere,N=new a.Vector4;function L(e,t,n){return N.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),N.multiplyScalar(1/N.w),N.x=w/n.width,N.y=w/n.height,N.applyMatrix4(e.projectionMatrixInverse),N.multiplyScalar(1/N.w),Math.abs(Math.max(N.x,N.y))}var I=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new d,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),r=this,i=n;if(r instanceof i)return(r=v(this,n,[e,t])).isLineSegments2=!0,r.type="LineSegments2",r;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e),t=n,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,r=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)S.fromBufferAttribute(t,i),_.fromBufferAttribute(n,i),r[s]=0===s?0:r[s-1],r[s+1]=r[s]+S.distanceTo(_);var l=new a.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var n=this.material.worldUnits,r=e.camera,i=(null!==r||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),s=(x=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(w=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),C.copy(s.boundingSphere).applyMatrix4(e),i=n?.5*w:L(r,Math.max(r.near,C.distanceToPoint(x.origin)),o.resolution),C.radius+=i,!1!==x.intersectsSphere(C)&&(null===s.boundingBox&&s.computeBoundingBox(),A.copy(s.boundingBox).applyMatrix4(e),i=n?.5*w:L(r,Math.max(r.near,A.distanceToPoint(x.origin)),o.resolution),A.expandByScalar(i),!1!==x.intersectsBox(A)))if(n)for(var l=this,u=t,c=l.matrixWorld,d=(s=l.geometry).attributes.instanceStart,h=s.attributes.instanceEnd,p=0,f=Math.min(s.instanceCount,d.count);p<f;p++){k.start.fromBufferAttribute(d,p),k.end.fromBufferAttribute(h,p),k.applyMatrix4(c);var m=new a.Vector3,g=new a.Vector3;x.distanceSqToSegment(k.start,k.end,g,m),g.distanceTo(m)<.5*w&&u.push({point:g,pointOnLine:m,distance:x.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv1:null})}else{var v=this,y=t,b=(e=r).projectionMatrix,S=v.material.resolution,_=v.matrixWorld,N=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,R=(o=Math.min(o.instanceCount,N.count),-e.near);x.at(1,E),E.w=1,E.applyMatrix4(e.matrixWorldInverse),E.applyMatrix4(b),E.multiplyScalar(1/E.w),E.x*=S.x/2,E.y*=S.y/2,E.z=0,D.copy(E),P.multiplyMatrices(e.matrixWorldInverse,_);for(var U,B,F,j,z=0,V=o;z<V;z++)T.fromBufferAttribute(N,z),M.fromBufferAttribute(I,z),T.w=1,M.w=1,T.applyMatrix4(P),M.applyMatrix4(P),T.z>R&&M.z>R||(T.z>R?(U=T.z-M.z,U=(T.z-R)/U,T.lerp(M,U)):M.z>R&&(U=M.z-T.z,B=(M.z-R)/U,M.lerp(T,B)),T.applyMatrix4(b),M.applyMatrix4(b),T.multiplyScalar(1/T.w),M.multiplyScalar(1/M.w),T.x*=S.x/2,T.y*=S.y/2,M.x*=S.x/2,M.y*=S.y/2,k.start.copy(T),k.start.z=0,k.end.copy(M),k.end.z=0,B=k.closestPointToPointParameter(D,!0),k.at(B,O),F=-1<=(F=a.MathUtils.lerp(T.z,M.z,B))&&F<=1,j=D.distanceTo(O)<.5*w,F&&j&&(k.start.fromBufferAttribute(N,z),k.end.fromBufferAttribute(I,z),k.start.applyMatrix4(_),k.end.applyMatrix4(_),F=new a.Vector3,j=new a.Vector3,x.distanceSqToSegment(k.start,k.end,j,F),y.push({point:j,pointOnLine:F,distance:x.origin.distanceTo(j),object:v,face:null,faceIndex:z,uv:null,uv1:null})))}}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(a.Mesh);function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var j=function(){var e=n,t=d;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");function n(){var e;if(this instanceof n)return(e=function(e,t,n){t=B(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,[],B(e).constructor):t.apply(e,n))&&("object"===R(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t),e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return U(B(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return U(B(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function z(e){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function V(e,t,n){t=H(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],H(e).constructor):t.apply(e,n))&&("object"===z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function W(e,t){return(W=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var G=function(){var e=n,t=I;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new j,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),r=this,i=n;if(r instanceof i)return(r=V(this,n,[e,t])).isLine2=!0,r.type="Line2",r;throw new TypeError("Cannot call a class as a function")}return e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&W(e,t),e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),K=n(9278),Z=n(1897),q=n(960),X=(t=n(5247),n(135)),Y=n(6272);const Q={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new i.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "};var J=n(874),$=n(2233);const ee=t.Z,te=(e,t)=>(t.updateMatrixWorld(!0),t=new ee.Vector3,e.getWorldPosition(t),t),ne={parse(e){var{x:e,y:t,z:n}=e;return void 0===n?new i.Vector2(e,t):new i.Vector3(e,t,n)},toJSON(e){var{x:e,y:t,z:n}=e;return null==n?{x:e,y:t}:{x:e,y:t,z:n}}},re=(e,t)=>e.distanceTo(t),ie=e=>new Z.cp(e),ae=e=>new K.j(e),se=e=>new Z.P7(e),oe=(e,t=.5,n=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),n)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},le=(e,t,n)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>le(e,t,n))):oe(e,t,n)},ue=e=>(e.mapping=i.EquirectangularReflectionMapping,e),ce=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},de=(e,t)=>{let n=document.createElement("video");return n.style="position:absolute;top:0;left:0;z-index:1000000;",n.src=e,n.loop="loop",n.muted="muted",n.play(),t.appendChild(n),new i.VideoTexture(n)},he=(e,t)=>{let n=new i.CatmullRomCurve3(e,(null==t?void 0:t.closed)||!1),r=new i.BufferGeometry;e=n.getSpacedPoints(100),r.setFromPoints(e),e=new i.LineBasicMaterial({color:26214});let a=new i.Line(r,e);return a.visible=(null==t?void 0:t.showLine)||!1,{line:a,curve:n}},pe=e=>{let t=0;const n=[],r={},a={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=r),n.push(new i.Vector3(s,o,l))),r[a[t]]=e,t++})),n},fe=e=>{var{pointArray:e,material:t,lineWidth:n,colorArray:r}=e;const a=new j,s=(a.setPositions(e),t||new m({transparent:!0,side:i.DoubleSide,linewidth:n||5,vertexColors:!0})),o=(a.setColors(r||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new G(a,s));return o.name="gw",o.computeLineDistances(),o},me=e=>3.1415926*e/180,ge=(e,t="name",n)=>{const r={};return e.traverse((e=>{"id"===t?r[e.userData.id]=e:r[e[t]]=e,null!=n&&n(e)})),r},ve=(e,t,n,r,i,a)=>({cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}),ye=(e,t)=>{var{x:e,y:n,z:r}=e,{x:t,y:i,z:a}=t;return{x:e-t,y:n-i,z:r-a}},be=()=>new ee.Clock,xe=e=>{var{r:e,g:t,b:n}=(0,Y.fh)((0,Y.I8)(e.includes("#")?e:"#"+e));return new ee.Color(e,t,n)},we=e=>new ee.Color(e.includes("#")?e:"#"+e),Se=e=>"#"+e.getHexString(),_e=e=>e.r?e:(0,Y.fh)((0,Y.I8)(e.includes("#")?e:"#"+e)),Te=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,Me=e=>{const{r:t,g:n,b:r}=e;return"rgb("+[t,n,r].map((e=>1<e?e:255*e)).join(",")+")"},Ee=e=>{var{r:e,g:t,b:n}=e;return{r:e,g:t,b:n}},De=e=>{let t=e;return(0,X.isColor)(e)?t=Ee(e):q.YD.is(e)||(t=(0,Y.I8)(e,!0)),t},Pe=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",ke=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Pe(e),/^(rgb|RGB)/.test(e)){for(var t="#",n=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),r=0;r<n.length;r++){var i=Number(n[r]).toString(16);"0"===i&&(i+=i),t+=i}return t}return String(e)},Oe=e=>{var{x:e,y:t,z:n}=e;return{x:e,y:t,z:n}},Ae=e=>{var{x:e,y:t}=e;return{x:e,y:t}},Ce=e=>(new i.Box3).expandByObject(e).getCenter(e),Ne={water(e){var t=new ee.PlaneGeometry(256,256,127,127);const n=new i.ShaderMaterial({name:"WaterMaterial",uniforms:Q.uniforms,vertexShader:Q.vertexShader,fragmentShader:Q.fragmentShader}),r=new i.Mesh(t,n),a=(r.rotateX(-.5*Math.PI),new i.Clock);return setInterval((()=>{n.uniforms.uTime.value+=a.getDelta(),n.uniforms.uCamPosition.value=e.position}),16.6),r}},Le=(e,t)=>{let n,r;switch(e){case"Group":n=new ee.Group;break;case"Box":r=new ee.BoxGeometry(1,1,1,1,1,1),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Circle":r=new ee.CircleGeometry(1,8,0,2*Math.PI),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Cylinder":r=new ee.CylinderGeometry(1,1,1,8,1,!1,0,2*Math.PI),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Dodecahedron":r=new ee.DodecahedronGeometry(1,0),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Icosahedron":r=new ee.IcosahedronGeometry(1,0),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Lathe":var a=[new ee.Vector2(0,0),new ee.Vector2(.4,0),new ee.Vector2(.35,.05),new ee.Vector2(.1,.075),new ee.Vector2(.08,.1),new ee.Vector2(.08,.4),new ee.Vector2(.1,.42),new ee.Vector2(.14,.48),new ee.Vector2(.2,.5),new ee.Vector2(.25,.54),new ee.Vector2(.3,1.2)];r=new ee.LatheGeometry(a,12,0,2*Math.PI),n=new ee.Mesh(r,new ee.MeshStandardMaterial({side:ee.DoubleSide}));break;case"Octahedron":r=new ee.OctahedronGeometry(1,0),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Plane":r=new ee.PlaneGeometry(1,1,1,1),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Ring":r=new ee.RingGeometry(.5,1,8,1,0,2*Math.PI),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Sphere":r=new ee.SphereGeometry(1,35,35,0,2*Math.PI,0,Math.PI),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Sprite":n=new ee.Sprite(new ee.SpriteMaterial);break;case"Tetrahedron":r=new ee.TetrahedronGeometry(1,0),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Torus":r=new ee.TorusGeometry(1,.4,8,6,2*Math.PI),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"TorusKnot":r=new ee.TorusKnotGeometry(1,.4,64,8,2,3),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"Tube":a=new ee.CatmullRomCurve3([new ee.Vector3(2,2,-2),new ee.Vector3(2,-2,-.6666666666666667),new ee.Vector3(-2,-2,.6666666666666667),new ee.Vector3(-2,2,2)]),r=new ee.TubeGeometry(a,64,1,8,!1),n=new ee.Mesh(r,new ee.MeshStandardMaterial);break;case"water":n=Ne.water(t?t.camera:{position:new i.Vector3})}if(n)return n.name=e,n},Ie=(()=>{const e=(t,n)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===n?t:e(t,n));return(t,n)=>{if(t&&n)return e(t,n)}})(),Re=(()=>{const e=(t,n)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==n&&(t.parent.visible=n),e(t.parent,n)):null;return(t,n)=>t?e(t,n):null})(),Ue=(e,t)=>{var n=(t||{}).ignoreSelf;return"Scene"===e.type||(n?(t.ignoreSelf=!1,!!e.parent&&Ue(e.parent,t)):!(void 0!==e.isHide?e.isHide:!e.visible)&&!!e.parent&&Ue(e.parent,t))},Be=(e,t=!1)=>{var[n,r,a]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:u,y:c,z:d}=e.position,u=new i.Vector3(u-(s-n),c-(o-r),d-(l-a));return t&&e.position.copy(u),u};let Fe,je,ze;const Ve=e=>{void 0===Fe&&((Fe=new ee.WebGLRenderer).outputEncoding=ee.sRGBEncoding,je=new ee.Scene,ze=new ee.OrthographicCamera(-1,1,1,-1,0,1));var t=e.image,n=new ee.PlaneGeometry(2,2);return e=new ee.MeshBasicMaterial({map:e}),n=new ee.Mesh(n,e),je.add(n),Fe.setSize(t.width,t.height,!1),Fe.render(je,ze),Fe.domElement},He=e=>function(e,t,n,r){return new(n=n||Promise)((function(e,t){function i(e){try{s(r.next(e))}catch(e){t(e)}}function a(e){try{s(r.throw(e))}catch(e){t(e)}}function s(t){var r;t.done?e(t.value):((r=t.value)instanceof n?r:new n((function(e){e(r)}))).then(i,a)}s((r=r.apply(undefined,[])).next())}))}(0,0,void 0,(function*(){})),We=e=>{var t=typeof e;let n="null";return null===e?"null":void 0===e?"undefined":(e.isColor?n="color":e.isTexture?n="texture":e.isVector2?n="vector2":e.isVector3?n="vector3":Array.isArray(e)?n="array":(0,r.isNumber)(e)?n="number":"string"==t?n="string":"boolean"==t?n="boolean":"object"==t&&(n=null===t?"null":Array.isArray(t)?"array":"object"),n)},Ge=(e,t)=>{var n,r,i,a,s,o,l=We(e);return"null"===l||"number"===l||"string"===l||"boolean"===l||"array"===l||"undefined"===l?(0,Y.Xq)(e,t):"color"===l?e.getHexString()!==(null==t?void 0:t.getHexString()):"texture"===l?(0,$.Ki)(e)!==(0,$.Ki)(t):"vector2"===l||"vector3"===l?(({x:n,y:r,z:i}=e),({x:a,y:s,z:o}=t),n!==a||r!==s||i!==o):"object"===l?(0,Y.Xq)(e,t):void 0},Ke=e=>{const{target:t,val:n,type:r}=e;"null"===(e=We(n))||"number"===e||"string"===e||"boolean"===e||"undefined"===e||"texture"===e?t[r]=n:"color"===e||"vector2"===e||"vector3"===e?t[r].copy(n):"object"===e?t[r]=Object.assign({},n):"array"===e&&(t[r]=[...n])},Ze=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n,z:e.z+(t.z-e.z)*n}),qe=(e,t)=>{const n=e.getWorldPosition(new i.Vector3);t=t.clone().add(n.negate()),e.position.add(t)},Xe=e=>e.replaceAll("mainImage( out vec4 fragColor, in vec2 fragCoord )","main()").replaceAll("fragCoord","gl_FragCoord").replaceAll("fragColor","gl_FragColor"),Ye=(e,t,n)=>{for(const r of t)if(tt(e,r,n))return r},Qe=["position","rotation","scale"],Je=["color","normal","position","uv","uv2"],$e=e=>{let t=0;return Je.map((n=>t+=et(e,n))),t},et=(e,t)=>(null==(t=null==(e=e.attributes[t])?void 0:e.array)?void 0:t.buffer.byteLength)||0,tt=(e,t,n)=>{let r=e.userData.tempData,i=(r=r||(e.userData.tempData={}),t.userData.tempData);i=i||(t.userData.tempData={});for(const a of Je){const s=t.attributes[a],o=e.attributes[a];if([s,o].every((e=>!(0,Y.Ft)(e)))){if(s.array.length!==o.array.length)return;let e=!1;if(-1===n){let t=i[a],n=(t=t||(i[a]=JSON.stringify(s.array)),r[a]);n=n||(r[a]=JSON.stringify(o.array)),e=t.length===n.length&&t===n}else e=(0,Y.F1)([...s.array],[...o.array],o.array.length>(0,J.le)(n,2e3)?(0,J.le)(n,2e3):"fill");return e}if(![s,o].every((e=>(0,Y.Ft)(e))))return}},nt=(e,t)=>{let n=new i.Vector3;const r=t||e.children;if(0!==r.length)return r.forEach((e=>{"instanceHelper"===e.type&&(e.setGeometry(!0),e.updateMatrix());const t=(new i.Box3).setFromObject(e);"instanceHelper"===e.type&&(e.setGeometry(!1),e.update()),n.add(t.getCenter(new i.Vector3))})),n.divideScalar(r.length),n},rt=(e,t)=>({x:e.x-t.x,y:e.y-t.y,z:e.z-t.z}),it=(e,t)=>new i.Vector3(e.x+t.x,e.y+t.y,e.z+t.z),at=["x","y","z"],st=(e,t)=>{for(const n of at)if(e[n]!==t[n])return!1;return!0},ot=e=>{if(!e)return{count:0,triangles:0};var t=e.attributes.position;return e=e.index,t&&t.count?{count:t.count,triangles:e?e.count/3:t.count/3}:{count:0,triangles:0}},lt=e=>e/3.14*180,ut=e=>3.14*e/180},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},3243:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3243__},5521:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__5521__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},9219:(e,t,n)=>{n.d(t,{z:()=>m});var r=n(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t,n){t=s(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],s(e).constructor):t.apply(e,n))&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return o(r)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u={type:"change"},c={type:"start"},d={type:"end"},h=new r.Ray,p=new r.Plane,f=Math.cos(70*r.MathUtils.DEG2RAD),m=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t){var i,s,l,m,g,v,y,b;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(i=a(this,n)).object=e,i.domElement=t,i.domElement.style.touchAction="none",i.enabled=!0,i.target=new r.Vector3,i.cursor=new r.Vector3,i.minDistance=0,i.maxDistance=1/0,i.minZoom=0,i.maxZoom=1/0,i.minTargetRadius=0,i.maxTargetRadius=1/0,i.minPolarAngle=0,i.maxPolarAngle=Math.PI,i.minAzimuthAngle=-1/0,i.maxAzimuthAngle=1/0,i.enableDamping=!1,i.dampingFactor=.05,i.enableZoom=!0,i.zoomSpeed=1,i.enableRotate=!0,i.rotateSpeed=1,i.enablePan=!0,i.panSpeed=1,i.screenSpacePanning=!0,i.keyPanSpeed=7,i.zoomToCursor=!1,i.autoRotate=!1,i.autoRotateSpeed=2,i.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},i.mouseButtons={LEFT:r.MOUSE.ROTATE,MIDDLE:r.MOUSE.DOLLY,RIGHT:r.MOUSE.PAN},i.touches={ONE:r.TOUCH.ROTATE,TWO:r.TOUCH.DOLLY_PAN},i.target0=i.target.clone(),i.position0=i.object.position.clone(),i.zoom0=i.object.zoom,i._domElementKeyEvents=null,i.getPolarAngle=function(){return T.phi},i.getAzimuthalAngle=function(){return T.theta},i.getDistance=function(){return this.object.position.distanceTo(this.target)},i.listenToKeyEvents=function(e){e.addEventListener("keydown",ge),this._domElementKeyEvents=e},i.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",ge),this._domElementKeyEvents=null},i.saveState=function(){x.target0.copy(x.target),x.position0.copy(x.object.position),x.zoom0=x.object.zoom},i.reset=function(){x.target.copy(x.target0),x.object.position.copy(x.position0),x.object.zoom=x.zoom0,x.object.updateProjectionMatrix(),x.dispatchEvent(u),x.update(),S=w.NONE},i.update=(s=new r.Vector3,l=(new r.Quaternion).setFromUnitVectors(e.up,new r.Vector3(0,1,0)),m=l.clone().invert(),g=new r.Vector3,v=new r.Quaternion,y=new r.Vector3,b=2*Math.PI,function(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,i=x.object.position,a=(s.copy(i).sub(x.target),s.applyQuaternion(l),T.setFromVector3(s),x.autoRotate&&S===w.NONE&&W(null!==n?2*Math.PI/60*x.autoRotateSpeed*n:2*Math.PI/60/60*x.autoRotateSpeed),x.enableDamping?(T.theta+=M.theta*x.dampingFactor,T.phi+=M.phi*x.dampingFactor):(T.theta+=M.theta,T.phi+=M.phi),n=x.minAzimuthAngle,x.maxAzimuthAngle);return isFinite(n)&&isFinite(a)&&(n<-Math.PI?n+=b:n>Math.PI&&(n-=b),a<-Math.PI?a+=b:a>Math.PI&&(a-=b),T.theta=n<=a?Math.max(n,Math.min(a,T.theta)):T.theta>(n+a)/2?Math.max(n,T.theta):Math.min(a,T.theta)),T.phi=Math.max(x.minPolarAngle,Math.min(x.maxPolarAngle,T.phi)),T.makeSafe(),!0===x.enableDamping?x.target.addScaledVector(D,x.dampingFactor):x.target.add(D),x.target.sub(x.cursor),x.target.clampLength(x.minTargetRadius,x.maxTargetRadius),x.target.add(x.cursor),n=!1,x.zoomToCursor&&F||x.object.isOrthographicCamera?T.radius=te(T.radius):(a=T.radius,T.radius=te(T.radius*E),n=a!=T.radius),s.setFromSpherical(T),s.applyQuaternion(m),i.copy(x.target).add(s),x.object.lookAt(x.target),!0===x.enableDamping?(M.theta*=1-x.dampingFactor,M.phi*=1-x.dampingFactor,D.multiplyScalar(1-x.dampingFactor)):(M.set(0,0,0),D.set(0,0,0)),x.zoomToCursor&&F?(a=null,x.object.isPerspectiveCamera?(i=(i=s.length())-(a=te(i*E)),x.object.position.addScaledVector(U,i),x.object.updateMatrixWorld(),n=!!i):x.object.isOrthographicCamera?((i=new r.Vector3(B.x,B.y,0)).unproject(x.object),t=x.object.zoom,x.object.zoom=Math.max(x.minZoom,Math.min(x.maxZoom,x.object.zoom/E)),x.object.updateProjectionMatrix(),n=t!==x.object.zoom,(t=new r.Vector3(B.x,B.y,0)).unproject(x.object),x.object.position.sub(t).add(i),x.object.updateMatrixWorld(),a=s.length()):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),x.zoomToCursor=!1),null!==a&&(this.screenSpacePanning?x.target.set(0,0,-1).transformDirection(x.object.matrix).multiplyScalar(a).add(x.object.position):(h.origin.copy(x.object.position),h.direction.set(0,0,-1).transformDirection(x.object.matrix),Math.abs(x.object.up.dot(h.direction))<f?e.lookAt(x.target):(p.setFromNormalAndCoplanarPoint(x.object.up,x.target),h.intersectPlane(p,x.target))))):x.object.isOrthographicCamera&&(t=x.object.zoom,x.object.zoom=Math.max(x.minZoom,Math.min(x.maxZoom,x.object.zoom/E)),t!==x.object.zoom&&(x.object.updateProjectionMatrix(),n=!0)),F=!(E=1),!!(n||g.distanceToSquared(x.object.position)>_||8*(1-v.dot(x.object.quaternion))>_||y.distanceToSquared(x.target)>_)&&(x.dispatchEvent(u),g.copy(x.object.position),v.copy(x.object.quaternion),y.copy(x.target),!0)}),i.dispose=function(){x.domElement.removeEventListener("contextmenu",ye),x.domElement.removeEventListener("pointerdown",ce),x.domElement.removeEventListener("pointercancel",he),x.domElement.removeEventListener("wheel",pe),x.domElement.removeEventListener("pointermove",de),x.domElement.removeEventListener("pointerup",he),x.domElement.getRootNode().removeEventListener("keydown",fe,{capture:!0}),null!==x._domElementKeyEvents&&(x._domElementKeyEvents.removeEventListener("keydown",ge),x._domElementKeyEvents=null)};var x=o(i),w={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},S=w.NONE,_=1e-6,T=new r.Spherical,M=new r.Spherical,E=1,D=new r.Vector3,P=new r.Vector2,k=new r.Vector2,O=new r.Vector2,A=new r.Vector2,C=new r.Vector2,N=new r.Vector2,L=new r.Vector2,I=new r.Vector2,R=new r.Vector2,U=new r.Vector3,B=new r.Vector2,F=!1,j=[],z={},V=!1;function H(e){return e=Math.abs(.01*e),Math.pow(.95,x.zoomSpeed*e)}function W(e){M.theta-=e}function G(e){M.phi-=e}K=new r.Vector3;var K,Z,q,X=function(e,t){K.setFromMatrixColumn(t,0),K.multiplyScalar(-e),D.add(K)},Y=(Z=new r.Vector3,function(e,t){!0===x.screenSpacePanning?Z.setFromMatrixColumn(t,1):(Z.setFromMatrixColumn(t,0),Z.crossVectors(x.object.up,Z)),Z.multiplyScalar(e),D.add(Z)}),Q=(q=new r.Vector3,function(e,t){var n,r=x.domElement;x.object.isPerspectiveCamera?(n=x.object.position,q.copy(n).sub(x.target),n=q.length(),n*=Math.tan(x.object.fov/2*Math.PI/180),X(2*e*n/r.clientHeight,x.object.matrix),Y(2*t*n/r.clientHeight,x.object.matrix)):x.object.isOrthographicCamera?(X(e*(x.object.right-x.object.left)/x.object.zoom/r.clientWidth,x.object.matrix),Y(t*(x.object.top-x.object.bottom)/x.object.zoom/r.clientHeight,x.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),x.enablePan=!1)});function J(e){x.object.isPerspectiveCamera||x.object.isOrthographicCamera?E/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),x.enableZoom=!1)}function $(e){x.object.isPerspectiveCamera||x.object.isOrthographicCamera?E*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),x.enableZoom=!1)}function ee(e,t){var n,r;x.zoomToCursor&&(F=!0,n=e-(e=x.domElement.getBoundingClientRect()).left,t-=e.top,r=e.width,e=e.height,B.x=n/r*2-1,B.y=-t/e*2+1,U.set(B.x,B.y,1).unproject(x.object).sub(x.object.position).normalize())}function te(e){return Math.max(x.minDistance,Math.min(x.maxDistance,e))}function ne(e){P.set(e.clientX,e.clientY)}function re(e){A.set(e.clientX,e.clientY)}function ie(e){var t,n;1===j.length?P.set(e.pageX,e.pageY):(t=xe(e),n=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),P.set(n,e))}function ae(e){var t,n;1===j.length?A.set(e.pageX,e.pageY):(t=xe(e),n=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),A.set(n,e))}function se(e){var t=xe(e),n=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(n*n+e*e),L.set(0,t)}function oe(e){1==j.length?k.set(e.pageX,e.pageY):(n=xe(e),t=.5*(e.pageX+n.x),e=.5*(e.pageY+n.y),k.set(t,e)),O.subVectors(k,P).multiplyScalar(x.rotateSpeed);var t,n=x.domElement;W(2*Math.PI*O.x/n.clientHeight),G(2*Math.PI*O.y/n.clientHeight),P.copy(k)}function le(e){var t,n;1===j.length?C.set(e.pageX,e.pageY):(t=xe(e),n=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),C.set(n,e)),N.subVectors(C,A).multiplyScalar(x.panSpeed),Q(N.x,N.y),A.copy(C)}function ue(e){var t=xe(e),n=e.pageX-t.x,r=e.pageY-t.y;n=Math.sqrt(n*n+r*r),I.set(0,n),R.set(0,Math.pow(I.y/L.y,x.zoomSpeed)),J(R.y),L.copy(I),ee(.5*(e.pageX+t.x),.5*(e.pageY+t.y))}function ce(e){if(!1!==x.enabled&&(0===j.length&&(x.domElement.setPointerCapture(e.pointerId),x.domElement.addEventListener("pointermove",de),x.domElement.addEventListener("pointerup",he)),!function(e){for(var t=0;t<j.length;t++)if(j[t]==e.pointerId)return 1}(e)))if(j.push(e.pointerId),"touch"===e.pointerType)ve(e);else{var t,n=e;switch(n.button){case 0:t=x.mouseButtons.LEFT;break;case 1:t=x.mouseButtons.MIDDLE;break;case 2:t=x.mouseButtons.RIGHT;break;default:t=-1}switch(t){case r.MOUSE.DOLLY:if(!1===x.enableZoom)return;!function(e){ee(e.clientX,e.clientX),L.set(e.clientX,e.clientY)}(n),S=w.DOLLY;break;case r.MOUSE.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===x.enablePan)return;re(n),S=w.PAN}else{if(!1===x.enableRotate)return;ne(n),S=w.ROTATE}break;case r.MOUSE.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===x.enableRotate)return;ne(n),S=w.ROTATE}else{if(!1===x.enablePan)return;re(n),S=w.PAN}break;default:S=w.NONE}S!==w.NONE&&x.dispatchEvent(c)}}function de(e){if(!1!==x.enabled)if("touch"===e.pointerType){var t=e;switch(be(t),S){case w.TOUCH_ROTATE:if(!1===x.enableRotate)return;oe(t),x.update();break;case w.TOUCH_PAN:if(!1===x.enablePan)return;le(t),x.update();break;case w.TOUCH_DOLLY_PAN:if(!1===x.enableZoom&&!1===x.enablePan)return;!function(e){x.enableZoom&&ue(e),x.enablePan&&le(e)}(t),x.update();break;case w.TOUCH_DOLLY_ROTATE:if(!1===x.enableZoom&&!1===x.enableRotate)return;!function(e){x.enableZoom&&ue(e),x.enableRotate&&oe(e)}(t),x.update();break;default:S=w.NONE}}else{var n=e;switch(S){case w.ROTATE:if(!1===x.enableRotate)return;!function(e){k.set(e.clientX,e.clientY),O.subVectors(k,P).multiplyScalar(x.rotateSpeed),e=x.domElement,W(2*Math.PI*O.x/e.clientHeight),G(2*Math.PI*O.y/e.clientHeight),P.copy(k),x.update()}(n);break;case w.DOLLY:if(!1===x.enableZoom)return;!function(e){I.set(e.clientX,e.clientY),R.subVectors(I,L),0<R.y?J(H(R.y)):R.y<0&&$(H(R.y)),L.copy(I),x.update()}(n);break;case w.PAN:if(!1===x.enablePan)return;!function(e){C.set(e.clientX,e.clientY),N.subVectors(C,A).multiplyScalar(x.panSpeed),Q(N.x,N.y),A.copy(C),x.update()}(n)}}}function he(e){switch(function(e){delete z[e.pointerId];for(var t=0;t<j.length;t++)if(j[t]==e.pointerId)return j.splice(t,1)}(e),j.length){case 0:x.domElement.releasePointerCapture(e.pointerId),x.domElement.removeEventListener("pointermove",de),x.domElement.removeEventListener("pointerup",he),x.dispatchEvent(d),S=w.NONE;break;case 1:var t=j[0],n=z[t];ve({pointerId:t,pageX:n.x,pageY:n.y})}}function pe(e){!1!==x.enabled&&!1!==x.enableZoom&&S===w.NONE&&(e.preventDefault(),x.dispatchEvent(c),ee((e=function(e){var t=e.deltaMode,n={clientX:e.clientX,clientY:e.clientY,deltaY:e.deltaY};switch(t){case 1:n.deltaY*=16;break;case 2:n.deltaY*=100}return e.ctrlKey&&!V&&(n.deltaY*=10),n}(e)).clientX,e.clientY),e.deltaY<0?$(H(e.deltaY)):0<e.deltaY&&J(H(e.deltaY)),x.update(),x.dispatchEvent(d))}function fe(e){"Control"===e.key&&(V=!0,x.domElement.getRootNode().addEventListener("keyup",me,{passive:!0,capture:!0}))}function me(e){"Control"===e.key&&(V=!1,x.domElement.getRootNode().removeEventListener("keyup",me,{passive:!0,capture:!0}))}function ge(e){if(!1!==x.enabled&&!1!==x.enablePan){var t=e,n=!1;switch(t.code){case x.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?G(2*Math.PI*x.rotateSpeed/x.domElement.clientHeight):Q(0,x.keyPanSpeed),n=!0;break;case x.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?G(-2*Math.PI*x.rotateSpeed/x.domElement.clientHeight):Q(0,-x.keyPanSpeed),n=!0;break;case x.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?W(2*Math.PI*x.rotateSpeed/x.domElement.clientHeight):Q(x.keyPanSpeed,0),n=!0;break;case x.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?W(-2*Math.PI*x.rotateSpeed/x.domElement.clientHeight):Q(-x.keyPanSpeed,0),n=!0}n&&(t.preventDefault(),x.update())}}function ve(e){switch(be(e),j.length){case 1:switch(x.touches.ONE){case r.TOUCH.ROTATE:if(!1===x.enableRotate)return;ie(e),S=w.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(!1===x.enablePan)return;ae(e),S=w.TOUCH_PAN;break;default:S=w.NONE}break;case 2:switch(x.touches.TWO){case r.TOUCH.DOLLY_PAN:if(!1===x.enableZoom&&!1===x.enablePan)return;t=e,x.enableZoom&&se(t),x.enablePan&&ae(t),S=w.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(!1===x.enableZoom&&!1===x.enableRotate)return;t=e,x.enableZoom&&se(t),x.enableRotate&&ie(t),S=w.TOUCH_DOLLY_ROTATE;break;default:S=w.NONE}break;default:S=w.NONE}var t;S!==w.NONE&&x.dispatchEvent(c)}function ye(e){!1!==x.enabled&&e.preventDefault()}function be(e){var t=z[e.pointerId];void 0===t&&(t=new r.Vector2,z[e.pointerId]=t),t.set(e.pageX,e.pageY)}function xe(e){return e=e.pointerId===j[0]?j[1]:j[0],z[e]}return x.domElement.addEventListener("contextmenu",ye),x.domElement.addEventListener("pointerdown",ce),x.domElement.addEventListener("pointercancel",he),x.domElement.addEventListener("wheel",pe,{passive:!1}),x.domElement.getRootNode().addEventListener("keydown",fe,{passive:!0,capture:!0}),i.update(),i}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e),t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(r.EventDispatcher)},5330:(e,t,n)=>{n.d(t,{Ys:()=>_});var r=n(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function l(e,t,n){t=d(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return u(r)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=new r.Raycaster,m=new r.Vector3,g=new r.Vector3,v=new r.Quaternion,y={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},b={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},_=function(){function e(t,n){a(this,e),i=l(this,e),void 0===n&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),n=document),i.isTransformControls=!0,i.visible=!1,i.domElement=n,i.domElement.style.touchAction="none";var i,s=new F,o=(i._gizmo=s,i.add(s),new j),c=(i._plane=o,i.add(o),u(i));function d(e,t){var n=t;Object.defineProperty(c,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=t,o[e]=t,s[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(b))}}),c[e]=t,o[e]=t,s[e]=t}d("camera",t),d("object",void 0),d("enabled",!0),d("axis",null),d("mode","translate"),d("translationSnap",null),d("rotationSnap",null),d("scaleSnap",null),d("space","world"),d("size",1),d("dragging",!1),d("showX",!0),d("showY",!0),d("showZ",!0),n=new r.Vector3,t=new r.Vector3;var h=new r.Quaternion,p=new r.Quaternion,f=new r.Vector3,m=new r.Quaternion,g=new r.Vector3,v=new r.Vector3,y=new r.Vector3,x=new r.Vector3;return d("worldPosition",n),d("worldPositionStart",t),d("worldQuaternion",h),d("worldQuaternionStart",p),d("cameraPosition",f),d("cameraQuaternion",m),d("pointStart",g),d("pointEnd",v),d("rotationAxis",y),d("rotationAngle",0),d("eye",x),i._offset=new r.Vector3,i._startNorm=new r.Vector3,i._endNorm=new r.Vector3,i._cameraScale=new r.Vector3,i._parentPosition=new r.Vector3,i._parentQuaternion=new r.Quaternion,i._parentQuaternionInv=new r.Quaternion,i._parentScale=new r.Vector3,i._worldScaleStart=new r.Vector3,i._worldQuaternionInv=new r.Quaternion,i._worldScale=new r.Vector3,i._positionStart=new r.Vector3,i._quaternionStart=new r.Quaternion,i._scaleStart=new r.Vector3,i._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(u(i)),i._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(u(i)),i._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(u(i)),i._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(u(i)),i._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(u(i)),i.domElement.addEventListener("pointerdown",i._onPointerDown),i.domElement.addEventListener("pointermove",i._onPointerHover),i.domElement.addEventListener("pointerup",i._onPointerUp),i}return h(e,r.Object3D),o(e,[{key:"updateMatrixWorld",value:function(){this.enabled&&this.visible&&(void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),c(d(e.prototype),"updateMatrixWorld",this).call(this,this))}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(null!==e&&f.setFromCamera(e,this.camera),e=T(this._gizmo.picker[this.mode],f),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0===this.object||!0===this.dragging||null!=e&&0!==e.button||null!==this.axis&&(null!==e&&f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,r=this.object,i=this.space;"scale"===n?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0===r||null===t||!1===this.dragging||null!==e&&-1!==e.button||(null!==e&&f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===n?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(r.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),"world"===i&&(r.parent&&r.position.add(m.setFromMatrixPosition(r.parent.matrixWorld)),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(m.setFromMatrixPosition(r.parent.matrixWorld))))):"scale"===n?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),g.set(e,e,e)):(m.copy(this.pointStart),g.copy(this.pointEnd),m.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(m),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),r.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==t.search("X")&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===n&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(m.setFromMatrixPosition(this.camera.matrixWorld)),n=!1,"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(m.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(y[t]),m.copy(y[t]),"local"===i&&m.applyQuaternion(this.worldQuaternion),m.cross(this.eye),0===m.length()?n=!0:this.rotationAngle=this._offset.dot(m.normalize())*e),"E"!==t&&!n||(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(b),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){null!==e&&0!==e.button||(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(b),this.dispatchEvent(S),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return f}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}}]),e}();function T(e,t,n){for(var r=t.intersectObject(e,!0),i=0;i<r.length;i++)if(r[i].object.visible||n)return r[i];return!1}var M=new r.Euler,E=new r.Vector3(0,1,0),D=new r.Vector3(0,0,0),P=new r.Matrix4,k=new r.Quaternion,O=new r.Quaternion,A=new r.Vector3,C=new r.Matrix4,N=new r.Vector3(1,0,0),L=new r.Vector3(0,1,0),I=new r.Vector3(0,0,1),R=new r.Vector3,U=new r.Vector3,B=new r.Vector3,F=function(){function e(){a(this,e),(t=l(this,e)).isTransformControlsGizmo=!0,t.type="TransformControlsGizmo";var t,n=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=new r.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=n.clone(),o=((((s.opacity=.15,i=i.clone()).opacity=.5,w=n.clone()).color.setHex(16711680),S=n.clone()).color.setHex(65280),n.clone()),u=(o.color.setHex(255),n.clone()),c=(u.color.setHex(16711680),u.opacity=.5,n.clone()),d=(c.color.setHex(65280),c.opacity=.5,n.clone()),h=(d.color.setHex(255),d.opacity=.5,n.clone());(h.opacity=.25,b=n.clone()).color.setHex(16776960),b.opacity=.25,n.clone().color.setHex(16776960);var p=(((n=n.clone()).color.setHex(7895160),g=new r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new r.BufferGeometry);function m(e,t){return(e=new r.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3)),_=new r.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new r.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(_,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(g,S),[0,.5,0]],[new r.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(_,S)]],Z:[[new r.Mesh(g,o),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(g,o),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(_,o),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),h.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),d.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new r.Line(((y=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),y),i),null,null,null,"helper"]],X:[[new r.Line(f,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(n={XYZE:[[new r.Mesh(m(.5,1),n),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(m(.5,.5),w)]],Y:[[new r.Mesh(m(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(m(.5,.5),o),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(m(.75,1),b),null,[0,Math.PI/2,0]]]},{AXIS:[[new r.Line(f,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},w={X:[[new r.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(_,w),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(p,S),[0,.5,0]],[new r.Mesh(_,S)],[new r.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(p,o),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(_,o),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(p,o),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),d),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),h.clone())]]},S={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},_={X:[[new r.Line(f,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,n=new r.Object3D;for(t in e)for(var i=e[t].length;i--;){var a=e[t][i][0].clone(),s=e[t][i][1],o=e[t][i][2],l=e[t][i][3],u=e[t][i][4];(a.name=t,a.tag=u,s&&a.position.set(s[0],s[1],s[2]),o&&a.rotation.set(o[0],o[1],o[2]),l&&a.scale.set(l[0],l[1],l[2]),a.updateMatrix(),u=a.geometry.clone()).applyMatrix4(a.matrix),a.geometry=u,a.renderOrder=1/0,a.position.set(0,0,0),a.rotation.set(0,0,0),a.scale.set(1,1,1),n.add(a)}return n}return t.gizmo={},t.picker={},t.helper={},t.add(t.gizmo.translate=T(g)),t.add(t.gizmo.rotate=T(n)),t.add(t.gizmo.scale=T(w)),t.add(t.picker.translate=T(v)),t.add(t.picker.rotate=T(x)),t.add(t.picker.scale=T(S)),t.add(t.helper.translate=T(y)),t.add(t.helper.rotate=T(b)),t.add(t.helper.scale=T(_)),t.picker.translate.visible=!1,t.picker.rotate.visible=!1,t.picker.scale.visible=!1,t}return h(e,r.Object3D),o(e,[{key:"updateMatrixWorld",value:function(t){var n=this;if(this.enabled){var r="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:O,i=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var a=0;a<i.length;a++)!function(){var e,t=i[a];if(t.visible=!0,t.rotation.set(0,0,0),t.position.copy(n.worldPosition),e=n.camera.isOrthographicCamera?(n.camera.top-n.camera.bottom)/n.camera.zoom:n.worldPosition.distanceTo(n.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*n.camera.fov/360)/n.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*n.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.visible=!!n.axis,"X"===n.axis&&(v.setFromEuler(M.set(0,0,0)),t.quaternion.copy(r).multiply(v),.9<Math.abs(E.copy(N).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Y"===n.axis&&(v.setFromEuler(M.set(0,0,Math.PI/2)),t.quaternion.copy(r).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Z"===n.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),t.quaternion.copy(r).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"XYZE"===n.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),E.copy(n.rotationAxis),t.quaternion.setFromRotationMatrix(P.lookAt(D,E,L)),t.quaternion.multiply(v),t.visible=n.dragging),"E"===n.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(n.worldPositionStart),t.visible=n.dragging):"END"===t.name?(t.position.copy(n.worldPosition),t.visible=n.dragging):"DELTA"===t.name?(t.position.copy(n.worldPositionStart),t.quaternion.copy(n.worldQuaternionStart),m.set(1e-10,1e-10,1e-10).add(n.worldPositionStart).sub(n.worldPosition).multiplyScalar(-1),m.applyQuaternion(n.worldQuaternionStart.clone().invert()),t.scale.copy(m),t.visible=n.dragging):(t.quaternion.copy(r),n.dragging?t.position.copy(n.worldPositionStart):t.position.copy(n.worldPosition),n.axis&&(t.visible=-1!==n.axis.search(t.name)));t.quaternion.copy(r),"translate"===n.mode||"scale"===n.mode?("X"===t.name&&.99<Math.abs(E.copy(N).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(N).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===n.mode&&(k.copy(r),E.copy(n.eye).applyQuaternion(v.copy(r).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(P.lookAt(n.eye,D,L)),"X"===t.name&&(v.setFromAxisAngle(N,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(k,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(L,Math.atan2(E.x,E.z)),v.multiplyQuaternions(k,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(k,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||n.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||n.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||n.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||n.showX&&n.showY&&n.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,n.enabled&&n.axis&&(t.name===n.axis||n.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}();c(d(e.prototype),"updateMatrixWorld",this).call(this,t)}}}]),e}(),j=function(){function e(){var t;return a(this,e),(t=l(this,e,[new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})])).isTransformControlsPlane=!0,t.type="TransformControlsPlane",t}return h(e,r.Mesh),o(e,[{key:"updateMatrixWorld",value:function(t){if(this.enabled){var n=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(n="local"),R.copy(N).applyQuaternion("local"===n?this.worldQuaternion:O),U.copy(L).applyQuaternion("local"===n?this.worldQuaternion:O),B.copy(I).applyQuaternion("local"===n?this.worldQuaternion:O),E.copy(U),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(R),A.copy(R).cross(E);break;case"Y":E.copy(this.eye).cross(U),A.copy(U).cross(E);break;case"Z":E.copy(this.eye).cross(B),A.copy(B).cross(E);break;case"XY":A.copy(B);break;case"YZ":A.copy(R);break;case"XZ":E.copy(B),A.copy(U);break;case"XYZ":case"E":A.set(0,0,0)}break;default:A.set(0,0,0)}0===A.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(m.set(0,0,0),A,E),this.quaternion.setFromRotationMatrix(C)),c(d(e.prototype),"updateMatrixWorld",this).call(this,t)}}}]),e}()},768:(e,t,n)=>{n.d(t,{x:()=>u});var r=n(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t,n){t=o(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],o(e).constructor):t.apply(e,n))&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e){if(this instanceof n)return(e=a(this,n,[e])).type=r.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e),t=n,(e=[{key:"parse",value:function(e){var t,n,i,a,s,o,l,u,c,d,h,p,f=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},m=function(e,t,n){t=t||1024;for(var r=e.pos,i=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));(i=o.indexOf("\n"))<0&&a<t&&r<e.byteLength;)s+=o,a+=o.length,r+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<i&&(!1!==n&&(e.pos+=a+i+1),s+o.slice(0,i))},g=((e=new Uint8Array(e)).pos=0,function(e){var t,n,r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((e.pos>=e.byteLength||!(t=m(e)))&&f(1,"no header found"),(n=t.match(/^#\?(\S+)/))||f(3,"bad initial token"),o.valid|=1,o.programtype=n[1],o.string+=t+"\n";!1!==(t=m(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((n=t.match(r))&&(o.gamma=parseFloat(n[1])),(n=t.match(i))&&(o.exposure=parseFloat(n[1])),(n=t.match(a))&&(o.valid|=2,o.format=n[1]),(n=t.match(s))&&(o.valid|=4,o.height=parseInt(n[1],10),o.width=parseInt(n[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid||f(3,"missing format specifier"),4&o.valid||f(3,"missing image size specifier"),o}(e)),v=g.width,y=g.height,b=function(e,t,n){var r=t;if(r<8||32767<r||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&f(3,"wrong scanline width");for(var i=new Uint8Array(4*t*n),a=(i.length||f(4,"unable to allocate buffer space"),0),s=0,o=4*r,l=new Uint8Array(4),u=new Uint8Array(o),c=n;0<c&&s<e.byteLength;){s+4>e.byteLength&&f(1),l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==r||f(3,"bad rgbe scanline format");for(var d=0,h=void 0;d<o&&s<e.byteLength;){var p=128<(h=e[s++]);if(p&&(h-=128),(0===h||o<d+h)&&f(3,"bad scanline data"),p)for(var m=e[s++],g=0;g<h;g++)u[d++]=m;else u.set(e.subarray(s,s+h),d),d+=h,s+=h}for(var v=r,y=0;y<v;y++){var b=0;i[a]=u[y+0],b+=r,i[a+1]=u[y+b],b+=r,i[a+2]=u[y+b],b+=r,i[a+3]=u[y+b],a+=4}c--}return i}(e.subarray(e.pos),v,y);switch(this.type){case r.FloatType:for(var x=b.length/4,w=new Float32Array(4*x),S=0;S<x;S++)d=w,h=c=4*S,p=void 0,p=(u=b)[c+3],p=Math.pow(2,p-128)/255,d[h+0]=u[c+0]*p,d[h+1]=u[c+1]*p,d[h+2]=u[c+2]*p,d[h+3]=1;t=w,n=r.FloatType;break;case r.HalfFloatType:x=b.length/4;for(var _=new Uint16Array(4*x),T=0;T<x;T++)s=_,o=a=4*T,l=void 0,l=(i=b)[a+3],l=Math.pow(2,l-128)/255,s[o+0]=r.DataUtils.toHalfFloat(Math.min(i[a+0]*l,65504)),s[o+1]=r.DataUtils.toHalfFloat(Math.min(i[a+1]*l,65504)),s[o+2]=r.DataUtils.toHalfFloat(Math.min(i[a+2]*l,65504)),s[o+3]=r.DataUtils.toHalfFloat(1);t=_,n=r.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:v,height:y,data:t,header:g.string,gamma:g.gamma,exposure:g.exposure,type:n}}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,i,a){return s(o(n.prototype),"load",this).call(this,e,(function(e,n){switch(e.type){case r.FloatType:case r.HalfFloatType:e.colorSpace=r.LinearSRGBColorSpace,e.minFilter=r.LinearFilter,e.magFilter=r.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)}),i,a)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(r.DataTextureLoader)},9432:(e,t,n)=>{n.d(t,{T:()=>p,w:()=>c});var r=n(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var c=function(){function e(){o(this,e),this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return u(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),d=new r.OrthographicCamera(-1,1,1,-1,0,1),h=new(function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(){var e;return o(this,n),(e=function(e,t,n){t=a(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,[],a(e).constructor):t.apply(e,n))&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n)).setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),e.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2)),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e),u(n)}(r.BufferGeometry)),p=function(){function e(t){o(this,e),this._mesh=new r.Mesh(h,t)}return u(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,d)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}()},1705:(e,t,n)=>{n.d(t,{T:()=>l});var r=n(8881),i=n(9432);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(e,t){var o;if(this instanceof n)return(o=function(e,t,n){t=s(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,[],s(e).constructor):t.apply(e,n))&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(this,n)).textureID=void 0!==t?t:"tDiffuse",e instanceof r.ShaderMaterial?(o.uniforms=e.uniforms,o.material=e):e&&(o.uniforms=r.UniformsUtils.clone(e.uniforms),o.material=new r.ShaderMaterial({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:o.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),o.fsQuad=new i.T(o.material),o;throw new TypeError("Cannot call a class as a function")}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e),t=n,(e=[{key:"render",value:function(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.w)},9278:(e,t,n)=>{n.d(t,{M:()=>y,j:()=>h});var r=n(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){t=c(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function u(){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");function n(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,n),(e=l(this,n)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.center=new r.Vector2(.5,.5),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e),o(n,[{key:"copy",value:function(e,t){return u(c(n.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}]),n}(r.Object3D),p=new r.Vector3,f=new r.Matrix4,m=new r.Matrix4,g=new r.Vector3,v=new r.Vector3,y=o((function e(){var t,n,r,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={objects:new WeakMap},u=void 0!==s.element?s.element:document.createElement("div");function c(e,t){return g.setFromMatrixPosition(e.matrixWorld),v.setFromMatrixPosition(t.matrixWorld),g.distanceToSquared(v)}u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),f.copy(t.matrixWorldInverse),m.multiplyMatrices(t.projectionMatrix,f),function e(t,n,a){var s;t.isCSS2DObject&&(p.setFromMatrixPosition(t.matrixWorld),p.applyMatrix4(m),s=!0===t.visible&&-1<=p.z&&p.z<=1&&!0===t.layers.test(a.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,n,a),(s=t.element).style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(p.x*r+r)+"px,"+(-p.y*i+i)+"px)",s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,n,a)),s={distanceToCameraSquared:c(a,t)},l.objects.set(t,s));for(var d=0,h=t.children.length;d<h;d++)e(t.children[d],n,a)}(e,e,t);for(var n=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),a=n.length,s=0,d=n.length;s<d;s++)n[s].element.style.zIndex=a-s},this.setSize=function(e,a){r=(t=e)/2,i=(n=a)/2,u.style.width=e+"px",u.style.height=a+"px"}}))},1897:(e,t,n)=>{n.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var r=n(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){t=c(t);var r=e;if((t=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){return}}}()?Reflect.construct(t,n||[],c(e).constructor):t.apply(e,n))&&("object"===i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==(e=r))return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}function u(){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=new r.Vector3,f=new r.Quaternion,m=new r.Vector3,g=function(){function e(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,e),(t=l(this,e)).isCSS3DObject=!0,t.element=n,t.element.style.position="absolute",t.element.style.pointerEvents="auto",t.element.style.userSelect="none",t.element.setAttribute("draggable",!1),t.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),t}return d(e,r.Object3D),o(e,[{key:"copy",value:function(t,n){return u(c(e.prototype),"copy",this).call(this,t,n),this.element=t.element.cloneNode(!0),this}}]),e}(),v=function(){function e(t){return a(this,e),(t=l(this,e,[t])).isCSS3DSprite=!0,t.rotation2D=0,t}return d(e,g),o(e,[{key:"copy",value:function(t,n){return u(c(e.prototype),"copy",this).call(this,t,n),this.rotation2D=t.rotation2D,this}}]),e}(),y=new r.Matrix4,b=new r.Matrix4,x=o((function e(){var t,n,r,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={camera:{style:""},objects:new WeakMap},u=void 0!==s.element?s.element:document.createElement("div"),c=(u.style.overflow="hidden",this.domElement=u,document.createElement("div")),d=(c.style.transformOrigin="0 0",c.style.pointerEvents="none",u.appendChild(c),document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function g(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function v(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}d.style.transformStyle="preserve-3d",c.appendChild(d),this.getSize=function(){return{width:t,height:n}},this.render=function(e,a){var s=a.projectionMatrix.elements[5]*i,u=(a.view&&a.view.enabled?(c.style.transform="translate( ".concat(-a.view.offsetX*(t/a.view.width),"px, ").concat(-a.view.offsetY*(n/a.view.height),"px )"),c.style.transform+="scale( ".concat(a.view.fullWidth/a.view.width,", ").concat(a.view.fullHeight/a.view.height," )")):c.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===a.parent&&!0===a.matrixWorldAutoUpdate&&a.updateMatrixWorld(),a.isOrthographicCamera&&(x=-(a.right+a.left)/2,w=(a.top+a.bottom)/2),a.view&&a.view.enabled?a.view.height/a.view.fullHeight:1),x=a.isOrthographicCamera?"scale( ".concat(u," )")+"scale("+s+")translate("+h(x)+"px,"+h(w)+"px)"+g(a.matrixWorldInverse):"scale( ".concat(u," )")+"translateZ("+s+"px)"+g(a.matrixWorldInverse),w=(a.isPerspectiveCamera?"perspective("+s+"px) ":"")+x+"translate("+r+"px,"+i+"px)";l.camera.style!==w&&(d.style.transform=w,l.camera.style=w),function e(t,n,r,i){var a,s,u;t.isCSS3DObject&&(a=!0===t.visible&&!0===t.layers.test(r.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(o,n,r),a=t.isCSS3DSprite?(y.copy(r.matrixWorldInverse),y.transpose(),0!==t.rotation2D&&y.multiply(b.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),y.setPosition(p),y.scale(m),y.elements[3]=0,y.elements[7]=0,y.elements[11]=0,y.elements[15]=1,v(y)):v(t.matrixWorld),s=t.element,void 0!==(u=l.objects.get(t))&&u.style===a||(u={style:s.style.transform=a},l.objects.set(t,u)),s.parentNode!==d&&d.appendChild(s),t.onAfterRender(o,n,r)));for(var c=0,h=t.children.length;c<h;c++)e(t.children[c],n,r,i)}(e,e,a,x)},this.setSize=function(e,a){r=(t=e)/2,i=(n=a)/2,u.style.width=e+"px",u.style.height=a+"px",c.style.width=e+"px",c.style.height=a+"px",d.style.width=e+"px",d.style.height=a+"px"}}))},3639:(e,t,n)=>{n.d(t,{C:()=>r});var r={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\n\t\t}"}},9174:(e,t,n)=>{n.d(t,{Vs:()=>function(e,t){if(t===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==r.TriangleFanDrawMode&&t!==r.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var n=e.getIndex();if(null===n){var i=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<a.count;s++)i.push(s);e.setIndex(i),n=e.getIndex()}var o=n.count-2,l=[];if(t===r.TriangleFanDrawMode)for(var u=1;u<=o;u++)l.push(n.getX(0)),l.push(n.getX(u)),l.push(n.getX(u+1));else for(var c=0;c<o;c++)c%2==0?(l.push(n.getX(c)),l.push(n.getX(c+1)),l.push(n.getX(c+2))):(l.push(n.getX(c+2)),l.push(n.getX(c+1)),l.push(n.getX(c)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t}});var r=n(8881)}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>n});var e=__webpack_require__(5330),t=__webpack_require__(5682);const n={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|